Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
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
}
IsLocked
bool IsLocked(IEntity user, BaseCompartmentSlot compartmentSlot)
Definition
SCR_BaseLockComponent.c:48
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
Unlock
void Unlock(Managed source, bool auth)
Definition
SCR_SpawnLockComponent.c:51
m_RequestLocks
SCR_SpawnLockComponentClass m_RequestLocks
Lock
void Lock(Managed source, bool auth)
Definition
SCR_SpawnLockComponent.c:35
TryLock
bool TryLock(Managed source, bool auth)
Definition
SCR_SpawnLockComponent.c:94
m_AuthorityLocks
ref set< Managed > m_AuthorityLocks
Definition
SCR_SpawnLockComponent.c:21
Type
int Type
Definition
ScriptCamera.c:17
Debug
Definition
Debug.c:13
IEntity
Definition
IEntity.c:13
SCR_SpawnLockComponentClass
Definition
SCR_SpawnLockComponent.c:2
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
ToString
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
scripts
Game
Respawn
Utilities
SCR_SpawnLockComponent.c
Generated by
1.17.0