Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
pluginobjectsinteractionmanager.c
Go to the documentation of this file.
1
class
PluginObjectsInteractionManager
extends
PluginBase
2
{
3
private
ref
array<Object>
m_LockedObjects
;
4
private
ref
array<float>
m_LockedObjectsDecay
;
5
private
const
float
TIME_TO_FORCED_UNLOCK
= 60;
6
private
const
float
TICK_RATE
= 10;
7
private
ref
Timer
m_DecayTimer
;
8
9
void
PluginObjectsInteractionManager
()
10
{
11
m_LockedObjects
=
new
array<Object>
;
12
m_LockedObjectsDecay
=
new
array<float>
;
13
//TIMERDEPRECATED - timer for decaying objects
14
m_DecayTimer
=
new
Timer
();
15
m_DecayTimer
.Run(
TICK_RATE
,
this
,
"Decay"
, NULL,
true
);
16
}
17
18
bool
IsFree
(
Object
target)
19
{
20
if
( target &&
m_LockedObjects
.Count() > 0 )
21
{
22
for
(
int
i = 0; i <
m_LockedObjects
.Count(); i++ )
23
{
24
if
(
m_LockedObjects
.Get(i) == target )
25
{
26
return
false
;
27
}
28
}
29
}
30
return
true
;
31
}
32
33
void
Lock
(
Object
target)
34
{
35
if
( target && !
IsFree
(target) )
36
{
37
m_LockedObjects
.Insert(target);
38
m_LockedObjectsDecay
.Insert(0);
39
}
40
}
41
42
void
Release
(
Object
target)
43
{
44
if
( target &&
m_LockedObjects
.Count() > 0 )
45
{
46
for
(
int
i = 0; i <
m_LockedObjects
.Count(); i++ )
47
{
48
if
(
m_LockedObjects
.Get(i) == target )
49
{
50
m_LockedObjects
.Remove(i);
51
m_LockedObjectsDecay
.Remove(i);
52
break
;
53
}
54
}
55
}
56
}
57
58
//FAILSAFE - checks periodically locked objects and releases them automaticaly if given time has passed
59
void
Decay
()
60
{
61
if
(
m_LockedObjectsDecay
.Count() > 0 )
62
{
63
for
(
int
i = 0; i <
m_LockedObjectsDecay
.Count(); i++ )
64
{
65
if
(
m_LockedObjectsDecay
.Get(i) >=
TIME_TO_FORCED_UNLOCK
)
66
{
67
m_LockedObjects
.Remove(i);
68
m_LockedObjectsDecay
.Remove(i);
69
}
70
else
71
{
72
m_LockedObjectsDecay
.Get(i) +=
TICK_RATE
;
73
}
74
}
75
}
76
}
77
};
Object
Definition
objecttyped.c:2
PluginBase
Class PluginMessageManager provides some basic Message Distribution mechanics, if you get instance of...
Definition
pluginbase.c:2
PluginBase::Decay
void Decay()
Definition
pluginobjectsinteractionmanager.c:59
PluginBase::IsFree
bool IsFree(Object target)
Definition
pluginobjectsinteractionmanager.c:18
PluginBase::Lock
void Lock(Object target)
Definition
pluginobjectsinteractionmanager.c:33
PluginBase::m_LockedObjectsDecay
ref array< float > m_LockedObjectsDecay
Definition
pluginobjectsinteractionmanager.c:4
PluginBase::TIME_TO_FORCED_UNLOCK
const float TIME_TO_FORCED_UNLOCK
Definition
pluginobjectsinteractionmanager.c:5
PluginBase::m_DecayTimer
ref Timer m_DecayTimer
Definition
pluginobjectsinteractionmanager.c:7
PluginBase::TICK_RATE
const float TICK_RATE
Definition
pluginobjectsinteractionmanager.c:6
PluginBase::Release
void Release(Object target)
Definition
pluginobjectsinteractionmanager.c:42
PluginBase::m_LockedObjects
ref array< Object > m_LockedObjects
Definition
pluginobjectsinteractionmanager.c:3
PluginBase::PluginObjectsInteractionManager
void PluginObjectsInteractionManager()
Definition
pluginobjectsinteractionmanager.c:9
Timer
Definition
dayzplayerimplement.c:39
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
Games
Dayz
scripts
4_world
plugins
pluginbase
pluginobjectsinteractionmanager.c
Generated by
1.17.0