DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
KitBase.c
Go to the documentation of this file.
1class KitBase extends ItemBase
2{
3 ref protected EffectSound m_DeployLoopSound;
4 protected bool m_DeployedRegularly;
5
6 void KitBase()
7 {
8 RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
9 RegisterNetSyncVariableBool("m_IsDeploySound");
10 }
11
12 void ~KitBase()
13 {
15 }
16
17 override bool IsBasebuildingKit()
18 {
19 return true;
20 }
21
22 override bool HasProxyParts()
23 {
24 return true;
25 }
26
28 {
29 super.OnVariablesSynchronized();
30
31 if ( IsDeploySound() )
32 {
34 }
35
37 {
39 }
40
42 {
44 }
45
46 if ( m_DeployedRegularly && IsSoundSynchRemote() )
47 {
49 }
50 }
51
52 override void EEInit()
53 {
54 super.EEInit();
55
56 //set visual on init
59
61 }
62
64 {
65 return true;
66 }
67
68 override void EEItemDetached(EntityAI item, string slot_name)
69 {
70 super.EEItemDetached( item, slot_name );
71
72 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
73 if ( player && player.IsPlayerDisconnected() )
74 return;
75
76 if (item && slot_name == "Rope")
77 {
78 if (GetGame().IsServer() && !m_DeployedRegularly)
79 {
80 DisassembleKit(ItemBase.Cast(item));
81 Delete();
82 }
83 }
84 }
85
86 override void OnItemLocationChanged( EntityAI old_owner, EntityAI new_owner )
87 {
88 super.OnItemLocationChanged( old_owner, new_owner );
89
90 //update visuals after location change
92 }
93
94 override void OnEndPlacement()
95 {
96 m_DeployedRegularly = true;
98 }
99
100 override void OnPlacementCancelled( Man player )
101 {
102 super.OnPlacementCancelled(player);
103 m_DeployedRegularly = false;
104 }
105
106 override bool IsDeployable()
107 {
108 return true;
109 }
110
112 {
113 return false;
114 }
115
116 override string GetDeploySoundset()
117 {
118 return "putDown_FenceKit_SoundSet";
119 }
120
121 override string GetLoopDeploySoundset()
122 {
123 //return "BarbedWire_Deploy_loop_SoundSet";
124 return "Shelter_Site_Build_Loop_SoundSet";
125 }
126
127 override string GetDeployFinishSoundset()
128 {
129 return "";
130 }
131
132 override void RefreshPhysics()
133 {
134 super.RefreshPhysics();
135
137 }
138
139 //Update visuals and physics
141 {
142 SetAnimationPhase( "Inventory", 0 );
143 SetAnimationPhase( "Placing", 1 );
144 }
145
147 {
148 AddProxyPhysics( "Inventory" );
149 RemoveProxyPhysics( "Placing" );
150 }
151
153 {
154 if ( !GetGame().IsDedicatedServer() )
155 {
157 {
159 }
160 }
161 }
162
164 {
165 if ( !GetGame().IsDedicatedServer() )
166 {
169 }
170 }
171
173 {
174 if (!IsHologram())
175 {
176 Rope rope = Rope.Cast(GetInventory().CreateAttachment("Rope"));
177 }
178 }
179
181
182 void CreateRope(Rope rope)
183 {
184 if (!rope)
185 return;
186
187 InventoryLocation targetLoc = rope.GetTargetLocation();
188 if (targetLoc && targetLoc.GetType() != InventoryLocationType.GROUND)
189 {
190 MiscGameplayFunctions.TransferItemProperties(this, rope);
191 return;
192 }
193
194 EntityAI newRope = EntityAI.Cast(GetGame().CreateObjectEx(rope.GetType(), GetPosition(), ECE_PLACE_ON_SURFACE));
195
196 if (newRope)
197 MiscGameplayFunctions.TransferItemProperties(this, newRope);
198
199 rope.Delete();
200 }
201
202 override void SetActions()
203 {
204 super.SetActions();
205
208 }
209}
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
void AddAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
void UpdateVisuals()
void UpdatePhysics()
InventoryLocationType
types of Inventory Location
override bool IsHologram()
Definition ItemBase.c:5556
void PlayDeploySound()
Definition ItemBase.c:8920
void SoundSynchRemote()
Definition ItemBase.c:8883
void PlayDeployFinishSound()
Definition ItemBase.c:8929
bool IsDeploySound()
Definition ItemBase.c:8915
bool CanPlayDeployLoopSound()
Definition ItemBase.c:8947
bool IsSoundSynchRemote()
Definition ItemBase.c:8890
protected ref EffectSound m_DeployLoopSound
Definition TrapBase.c:47
void PlayDeployLoopSound()
Definition TrapBase.c:651
void StopDeployLoopSound()
Definition TrapBase.c:661
class JsonUndergroundAreaTriggerData GetPosition
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
void SoundStop()
Stops sound.
InventoryLocation.
proto native int GetType()
returns type of InventoryLocation
void KitBase()
Definition KitBase.c:6
void AssembleKit()
Definition KitBase.c:172
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition KitBase.c:86
override string GetDeploySoundset()
Definition KitBase.c:116
override string GetLoopDeploySoundset()
Definition KitBase.c:121
override bool IsBasebuildingKit()
Definition KitBase.c:17
void PlayDeployLoopSound()
Definition KitBase.c:152
void UpdateVisuals()
Definition KitBase.c:140
void StopDeployLoopSound()
Definition KitBase.c:163
override void EEInit()
Definition KitBase.c:52
override void RefreshPhysics()
Definition KitBase.c:132
protected bool m_DeployedRegularly
Definition KitBase.c:4
override void EEItemDetached(EntityAI item, string slot_name)
Definition KitBase.c:68
override void OnPlacementCancelled(Man player)
Definition KitBase.c:100
override bool HasProxyParts()
Definition KitBase.c:22
override bool CanAssignAttachmentsToQuickbar()
Definition KitBase.c:111
override bool DisassembleOnLastDetach()
Definition KitBase.c:63
void ~KitBase()
Definition KitBase.c:12
override bool IsDeployable()
Definition KitBase.c:106
override void OnEndPlacement()
Definition KitBase.c:94
void UpdatePhysics()
Definition KitBase.c:146
void CreateRope(Rope rope)
Definition KitBase.c:182
override string GetDeployFinishSoundset()
Definition KitBase.c:127
override void OnVariablesSynchronized()
Definition KitBase.c:27
void DisassembleKit(ItemBase item)
Definition KitBase.c:180
override void SetActions()
Definition KitBase.c:202
override void DisassembleKit(ItemBase item)
Definition FenceKit.c:48
override string GetLoopDeploySoundset()
Definition ShelterKit.c:51
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
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.
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native CGame GetGame()
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10