DayZ 1.24
Loading...
Searching...
No Matches
KitBase.c
Go to the documentation of this file.
1class KitBase extends ItemBase
2{
4 protected bool m_DeployedRegularly;
5
6 void KitBase()
7 {
8 RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
9 RegisterNetSyncVariableBool("m_IsDeploySound");
10 }
11
16
17 override bool IsBasebuildingKit()
18 {
19 return true;
20 }
21
22 override bool HasProxyParts()
23 {
24 return true;
25 }
26
27 override bool CanProxyObstruct()
28 {
29 return false;
30 }
31
33 {
34 super.OnVariablesSynchronized();
35
36 if (IsDeploySound())
38
41
44
45 if (m_DeployedRegularly && IsSoundSynchRemote())
47 }
48
49 override void EEInit()
50 {
51 super.EEInit();
52
53 //set visual on init
56
57 if (GetGame().IsServer())
58 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(AssembleKit);
59 }
60
62 {
63 return true;
64 }
65
66 override void EEItemDetached(EntityAI item, string slot_name)
67 {
68 super.EEItemDetached(item, slot_name);
69
70 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
71 if (player && player.IsPlayerDisconnected())
72 return;
73
74 if (item && slot_name == "Rope")
75 {
76 if (GetGame().IsServer() && !m_DeployedRegularly)
77 {
79 Delete();
80 }
81 }
82 }
83
85 {
86 super.OnItemLocationChanged(old_owner, new_owner);
87
88 //update visuals after location change
90 }
91
92 override void OnEndPlacement()
93 {
94 m_DeployedRegularly = true;
96 }
97
98 override void OnPlacementCancelled(Man player)
99 {
100 super.OnPlacementCancelled(player);
101 m_DeployedRegularly = false;
102 }
103
104 override bool IsDeployable()
105 {
106 return true;
107 }
108
110 {
111 return false;
112 }
113
114 override string GetDeploySoundset()
115 {
116 return "putDown_FenceKit_SoundSet";
117 }
118
119 override string GetLoopDeploySoundset()
120 {
121 //return "BarbedWire_Deploy_loop_SoundSet";
122 return "Shelter_Site_Build_Loop_SoundSet";
123 }
124
125 override string GetDeployFinishSoundset()
126 {
127 return "";
128 }
129
130 override void RefreshPhysics()
131 {
132 super.RefreshPhysics();
133
135 }
136
137 //Update visuals and physics
139 {
140 SetAnimationPhase("Inventory", 0);
141 SetAnimationPhase("Placing", 1);
142 }
143
145 {
146 AddProxyPhysics("Inventory");
147 RemoveProxyPhysics("Placing");
148 }
149
151 {
152 if (!GetGame().IsDedicatedServer())
153 {
154 if (!m_DeployLoopSound || !m_DeployLoopSound.IsSoundPlaying())
156 }
157 }
158
160 {
161 if (!GetGame().IsDedicatedServer())
162 {
163 m_DeployLoopSound.SetSoundFadeOut(0.5);
164 m_DeployLoopSound.SoundStop();
165 }
166 }
167
169 {
170 if (!IsHologram())
171 Rope rope = Rope.Cast(GetInventory().CreateAttachment("Rope"));
172 }
173
175
177 {
178 if (!rope)
179 return;
180
181 InventoryLocation targetLoc = rope.GetTargetLocation();
182 if (targetLoc && targetLoc.GetType() != InventoryLocationType.GROUND)
183 {
184 MiscGameplayFunctions.TransferItemProperties(this, rope);
185 return;
186 }
187
188 EntityAI newRope = EntityAI.Cast(GetGame().CreateObjectEx(rope.GetType(), GetPosition(), ECE_PLACE_ON_SURFACE));
189
190 if (newRope)
191 MiscGameplayFunctions.TransferItemProperties(this, newRope);
192
193 rope.Delete();
194 }
195
196 override void SetActions()
197 {
198 super.SetActions();
199
201 AddAction(ActionDeployObject);
202 }
203}
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
void UpdateVisuals()
void UpdatePhysics()
InventoryLocationType
types of Inventory Location
bool CanPlayDeployLoopSound()
Definition ItemBase.c:9039
void SoundSynchRemote()
Definition ItemBase.c:8945
override bool IsHologram()
Definition ItemBase.c:5641
void PlayDeploySound()
Definition ItemBase.c:9003
void PlayDeployFinishSound()
Definition ItemBase.c:9015
bool IsDeploySound()
Definition ItemBase.c:8977
bool IsSoundSynchRemote()
Definition ItemBase.c:8952
void PlayDeployLoopSound()
void StopDeployLoopSound()
ref EffectSound m_DeployLoopSound
Definition TrapBase.c:47
class JsonUndergroundAreaTriggerData GetPosition
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
InventoryLocation.
void UpdateVisuals()
Definition KitBase.c:138
override bool IsBasebuildingKit()
Definition KitBase.c:17
bool m_DeployedRegularly
Definition KitBase.c:4
override string GetDeployFinishSoundset()
Definition KitBase.c:125
override bool HasProxyParts()
Definition KitBase.c:22
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition KitBase.c:84
void PlayDeployLoopSound()
Definition KitBase.c:150
override void SetActions()
Definition KitBase.c:196
void CreateRope(Rope rope)
Definition KitBase.c:176
void DisassembleKit(ItemBase item)
Definition KitBase.c:174
override bool DisassembleOnLastDetach()
Definition KitBase.c:61
override string GetDeploySoundset()
Definition KitBase.c:114
override bool CanAssignAttachmentsToQuickbar()
Definition KitBase.c:109
void ~KitBase()
Definition KitBase.c:12
void KitBase()
Definition KitBase.c:6
override void OnPlacementCancelled(Man player)
Definition KitBase.c:98
override void EEItemDetached(EntityAI item, string slot_name)
Definition KitBase.c:66
override void OnVariablesSynchronized()
Definition KitBase.c:32
override void RefreshPhysics()
Definition KitBase.c:130
override void EEInit()
Definition KitBase.c:49
void AssembleKit()
Definition KitBase.c:168
void UpdatePhysics()
Definition KitBase.c:144
override string GetLoopDeploySoundset()
Definition KitBase.c:119
override bool CanProxyObstruct()
Definition KitBase.c:27
void StopDeployLoopSound()
Definition KitBase.c:159
override bool IsDeployable()
Definition KitBase.c:104
override void OnEndPlacement()
Definition KitBase.c:92
override void DisassembleKit(ItemBase item)
Definition FenceKit.c:48
override string GetLoopDeploySoundset()
Definition ShelterKit.c:51
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
proto native CGame GetGame()
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10