Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
containerlocked.c
Go to the documentation of this file.
2{
3 protected int m_LockedMask = 0;
4 protected int m_OpeningMask = 0;
5
7 {
8 int count = GetDoorCount();
9 for (int i = 0; i < count; i++)
10 {
11 LockDoor(i);
12 }
13 }
14
16 {
17 super.OnStoreSave(ctx);
18
19 ctx.Write(m_LockedMask);
20 ctx.Write(m_OpeningMask);
21 }
22
23 override bool OnStoreLoad(ParamsReadContext ctx, int version)
24 {
25 if (!super.OnStoreLoad(ctx, version))
26 return false;
27
28 ctx.Read(m_LockedMask);
29 ctx.Read(m_OpeningMask);
30
32
33 return true;
34 }
35
36 protected void HandleDoorLoad()
37 {
38 int count = GetDoorCount();
39 int i;
40
41 //locking
42 for (i = 0; i < count; i++)
43 {
44 if (m_LockedMask & (1 << i))
45 {
46 LockDoor(i,true);
47 }
48 else
49 {
50 UnlockDoor(i);
51 }
52 }
53
54 //then opening
55 for (i = 0; i < count; i++)
56 {
57 if (m_OpeningMask & (1 << i) && !IsDoorLocked(i))
58 {
59 OpenDoor(i);
60 }
61 }
62 }
63
65 //events
66
67 override void OnDoorLocked(DoorLockParams params)
68 {
69 super.OnDoorLocked(params);
70
71 m_LockedMask |= 1 << params.param1;
72
73
74 string selectionName = string.Format("side%1_lock",(params.param1 + 1));
75 SetAnimationPhase(selectionName,0);
76 }
77
78 override void OnDoorUnlocked(DoorLockParams params)
79 {
80 super.OnDoorUnlocked(params);
81
82 int doorIdx = params.param1;
83
84 m_LockedMask &= ~(1 << doorIdx);
85
86 string selectionName = string.Format("side%1_lock",(doorIdx + 1));
87 SetAnimationPhase(selectionName,1);
88
89 if (!GetGame().IsDedicatedServer())
90 SEffectManager.PlaySoundEnviroment("Land_ContainerLocked_lock_SoundSet",GetDoorSoundPos(doorIdx));
91 }
92
93 override void OnDoorCloseStart(DoorStartParams params)
94 {
95 super.OnDoorCloseStart(params);
96
97 m_OpeningMask &= ~(1 << params.param1);
98 }
99
100 override void OnDoorOpenStart(DoorStartParams params)
101 {
102 super.OnDoorOpenStart(params);
103
104 m_OpeningMask |= 1 << params.param1;
105 }
106}
107
108class Land_ContainerLocked_Blue_DE : ContainerLockedBase
109{
110 override int GetLockCompatibilityType(int doorIdx)
112 return 1 << EBuildingLockType.SHIP_CONTAINER_0;
113 }
115
117{
118 override int GetLockCompatibilityType(int doorIdx)
119 {
120 return 1 << EBuildingLockType.SHIP_CONTAINER_1;
121 }
122}
124class Land_ContainerLocked_Orange_DE : ContainerLockedBase
125{
126 override int GetLockCompatibilityType(int doorIdx)
127 {
128 return 1 << EBuildingLockType.SHIP_CONTAINER_2;
129 }
130}
133{
134 override int GetLockCompatibilityType(int doorIdx)
135 {
136 return 1 << EBuildingLockType.SHIP_CONTAINER_3;
137 }
138}
Param1< int > DoorStartParams
Definition building.c:1
Param1< int > DoorLockParams
Definition building.c:3
override void OnStoreSave(ParamsWriteContext ctx)
override void OnDoorOpenStart(DoorStartParams params)
override void OnDoorCloseStart(DoorStartParams params)
override void OnDoorUnlocked(DoorLockParams params)
override void OnDoorLocked(DoorLockParams params)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySoundEnviroment(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, updating environment variables.
Serialization general interface. Serializer API works with:
Definition serializer.c:56
ContainerLockedBase BuildingSuper GetLockCompatibilityType(int doorIdx)
EBuildingLockType
proto native CGame GetGame()