Arma Reforger Explorer
1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SpawnLockComponent.c
Go to the documentation of this file.
1
class
SCR_SpawnLockComponentClass
: ScriptComponentClass
2
{
3
}
4
12
class
SCR_SpawnLockComponent :
ScriptComponent
13
{
16
protected
ref set<Managed>
m_RequestLocks
=
new
set<Managed>();
17
21
protected
ref set<Managed>
m_AuthorityLocks
=
new
set<Managed>();
22
23
//------------------------------------------------------------------------------------------------
24
protected
override
void
OnPostInit
(IEntity owner)
25
{
26
super.OnPostInit(owner);
27
if
(!PlayerController.Cast(owner))
28
Debug.Error(
string
.Format(
"%1 is not attached to a %2!"
, Type().ToString(), PlayerController));
29
}
30
31
//------------------------------------------------------------------------------------------------
35
void
Lock
(Managed source,
bool
auth)
36
{
37
if
(auth)
38
m_AuthorityLocks
.Insert(source);
39
else
40
m_RequestLocks
.Insert(source);
41
42
#ifdef _ENABLE_RESPAWN_LOGS
43
PrintLocks(
"SCR_SpawnLockComponent::Lock()"
, source, auth);
44
#endif
45
}
46
47
//------------------------------------------------------------------------------------------------
51
void
Unlock
(Managed source,
bool
auth)
52
{
53
if
(auth)
54
{
55
int
index
=
m_AuthorityLocks
.Find(source);
56
if
(
index
== -1)
57
return
;
58
59
m_AuthorityLocks
.Remove(
index
);
60
}
61
else
62
{
63
int
index
=
m_RequestLocks
.Find(source);
64
if
(
index
== -1)
65
return
;
66
67
m_RequestLocks
.Remove(
index
);
68
}
69
70
#ifdef _ENABLE_RESPAWN_LOGS
71
PrintLocks(
"SCR_SpawnLockComponent::Unlock()"
, source, auth);
72
#endif
73
}
74
75
//------------------------------------------------------------------------------------------------
81
bool
IsLocked
(
bool
auth)
82
{
83
if
(auth)
84
return
!
m_AuthorityLocks
.IsEmpty();
85
else
86
return
!
m_RequestLocks
.IsEmpty();
87
}
88
89
//------------------------------------------------------------------------------------------------
94
bool
TryLock
(Managed source,
bool
auth)
95
{
96
if
(
IsLocked
(auth))
97
return
false
;
98
99
Lock
(source, auth);
100
return
true
;
101
}
102
103
#ifdef _ENABLE_RESPAWN_LOGS
104
105
//------------------------------------------------------------------------------------------------
110
void
PrintLocks(
string
ctx, Managed src,
bool
auth)
111
{
112
Print(
string
.Format(
"%1 (reqCnt: %2 | authCnt: %3 | (src: %4, auth: %5)"
,
113
ctx,
m_RequestLocks
.Count(),
m_AuthorityLocks
.Count(), src, auth), LogLevel.NORMAL);
114
}
115
#endif
116
}
m_RequestLocks
SCR_SpawnLockComponentClass m_RequestLocks
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
Lock
void Lock(Managed source, bool auth)
Definition:
SCR_SpawnLockComponent.c:35
Unlock
void Unlock(Managed source, bool auth)
Definition:
SCR_SpawnLockComponent.c:51
OnPostInit
protected override void OnPostInit(IEntity owner)
Editable Mine.
Definition:
SCR_SpawnLockComponent.c:24
m_AuthorityLocks
protected ref set< Managed > m_AuthorityLocks
Definition:
SCR_SpawnLockComponent.c:21
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition:
SCR_DestructionSynchronizationComponent.c:17
SCR_SpawnLockComponentClass
Definition:
SCR_SpawnLockComponent.c:1
TryLock
bool TryLock(Managed source, bool auth)
Definition:
SCR_SpawnLockComponent.c:94
IsLocked
bool IsLocked(bool auth)
Definition:
SCR_SpawnLockComponent.c:81
scripts_Arma_Reforger_v1.1.0.42
scripts
Game
Respawn
Utilities
SCR_SpawnLockComponent.c
Generated by
1.8.17