DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ClaymoreMine.c
См. документацию.
2{
3 protected const string ANIM_PHASE_PACKED = "Bag";
4 protected const string ANIM_PHASE_DEPLOYED = "Mine";
5 protected const string SELECTION_NAME_LED = "LED";
6
9
10 protected bool m_IsFalling = false;
11 protected bool m_FallTriggered = false;
12
14 {
16
17 SetAmmoTypes({"ClaymoreMine_Ammo","ClaymoreMine_Secondary_Ammo"});
18 //SetParticleExplosion(ParticleList.CLAYMORE_EXPLOSION);
19 SetParticleOrientation("90 0 0");
20
21 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdLow");
22 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdHigh");
24 }
25
26 override void EOnInit(IEntity other, int extra)
27 {
29 }
30
31 override void EEKilled(Object killer)
32 {
33 super.EEKilled(killer);
34#ifdef DIAG_DEVELOPER
35#ifndef SERVER
36 RemoveDebugVisuals();
37#endif
38#endif
39 }
40
41 override void EEDelete(EntityAI parent)
42 {
43 super.EEDelete(parent);
44
45#ifdef DIAG_DEVELOPER
46#ifndef SERVER
47 RemoveDebugVisuals();
48#endif
49#endif
50 }
51
52 override protected void InitiateExplosion()
53 {
54 if (GetDefused())
55 {
56 return;
57 }
58
59 super.InitiateExplosion();
60 }
61
62 override void AfterStoreLoad()
63 {
64 super.AfterStoreLoad();
65
67 if (GetArmed())
68 {
70 }
71 }
72
74 {
75 super.OnVariablesSynchronized();
76
77 if (m_RAIB)
78 {
79 m_RAIB.OnVariableSynchronized();
80 }
81
83 }
84
85 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
86 {
87 super.EEItemLocationChanged(oldLoc, newLoc);
88
89 if (m_RAIB)
90 {
91 m_RAIB.Pair();
92 }
93 }
94
95
96
101
102 override void PairRemote(notnull EntityAI trigger)
103 {
104 m_RAIB.Pair(trigger);
105 }
106
108 {
109 return m_RAIB.GetPairDevice();
110 }
111
112 override bool CanBeDisarmed()
113 {
114 return GetArmed();
115 }
116
117 override void OnActivatedByItem(notnull ItemBase item)
118 {
119 if (g_Game.IsServer())
120 {
121 if (m_RAIB.IsPaired() && GetArmed())
122 {
123 if (GetPairDevice() == item)
124 {
125 SetHealth("", "", 0.0);
126 }
127 }
128 }
129 }
130
131 override void OnArmed()
132 {
133 super.OnArmed();
134
137
138#ifdef DIAG_DEVELOPER
139#ifndef SERVER
140 // have to call this function a little later, after claymore transform has been finalized
141 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DrawDamageZone, 500);
142#endif
143#endif
144 }
145
146 override void OnDisarmed(bool pWithTool)
147 {
148 super.OnDisarmed(pWithTool);
149
150#ifdef DIAG_DEVELOPER
151 RemoveDebugVisuals();
152#endif
153
154 SetDefused(pWithTool);
155 UnpairRemote();
156
157 if (pWithTool)
158 {
159 SetHealth("", "", 0.0);
160 }
161
164 }
165
166 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
167 {
168 super.OnPlacementComplete(player, position, orientation);
169
170 if (g_Game.IsServer())
171 {
173 if (rdt)
174 {
175 PairWithDevice(rdt);
176 Arm();
177 }
178 }
179 }
180
181 protected void UpdateVisuals()
182 {
183 if (GetArmed() || GetDefused())
184 {
185 ShowSelection(ANIM_PHASE_DEPLOYED);
186 HideSelection(ANIM_PHASE_PACKED);
187 if (GetOnViewIndexChanged())
188 {
189 GetOnViewIndexChanged().Invoke();
190 }
191 }
192 else
193 {
194 HideSelection(ANIM_PHASE_DEPLOYED);
195 ShowSelection(ANIM_PHASE_PACKED);
196 if (GetOnViewIndexChanged())
197 {
198 GetOnViewIndexChanged().Invoke();
199 }
200 }
201 }
202
203 protected void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced = false)
204 {
205 if (pState != m_LastLEDState || pForced)
206 {
207 int selectionIdx = GetHiddenSelectionIndex(SELECTION_NAME_LED);
208
209 switch (pState)
210 {
212 SetObjectTexture(selectionIdx, RemoteDetonator.COLOR_LED_LIT);
213 break;
214 default:
215 SetObjectTexture(selectionIdx, RemoteDetonator.COLOR_LED_OFF);
216 break;
217 }
218
219 m_LastLEDState = pState;
220 }
221 }
222
223 override bool IsTakeable()
224 {
225 return !GetArmed() && super.IsTakeable();
226 }
227
228 override bool IsDeployable()
229 {
230 return true;
231 }
232
233 override void SetActions()
234 {
235 super.SetActions();
236
240 }
241
242 override void OnItemFallRebuilding()
243 {
244 if (!g_Game.IsServer())
245 return;
246
247 m_IsFalling = true;
248 }
249
251 override void EOnContact(IEntity other, Contact extra)
252 {
253 if (!g_Game.IsServer() || !m_IsFalling || m_FallTriggered)
254 return;
255
256 OnTriggeredByFall(extra);
257 m_FallTriggered = true;
258 }
259
261 protected void OnTriggeredByFall(Contact extra)
262 {
263 if (!g_Game.IsServer() || !m_IsFalling)
264 return;
265
267 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ClearIsFalling, 800);
268 }
269
270 protected void ClearIsFalling()
271 {
272 m_IsFalling = false;
273 }
274
275 override int GetViewIndex()
276 {
277 if (MemoryPointExists("invView2"))
278 {
279 if (GetArmed())
280 {
281 return 1;
282 }
283 }
284
285 return 0;
286 }
287
288 override string GetDeploySoundset()
289 {
290 return "placeClaymore_SoundSet";
291 }
292
293 override string GetLoopDeploySoundset()
294 {
295 return "claymore_deploy_Soundset";
296 }
297
298 override string GetArmSoundset()
299 {
300 return "claymore_disarm_SoundSet";
301 }
302
303 override string GetDisarmSoundset()
304 {
305 return "claymore_disarm_SoundSet";
306 }
307
309 {
310 return "claymore_disarm_long_SoundSet";
311 }
312
313 override void OnDebugSpawn()
314 {
315 RemoteDetonatorTrigger rdt = RemoteDetonatorTrigger.Cast(SpawnEntityOnGroundPos("RemoteDetonatorTrigger", GetPosition() + GetDirection() * 0.5));
316 PairWithDevice(rdt);
317 Arm();
318 }
319
320#ifdef DIAG_DEVELOPER
321 //================================================================
322 // DEBUG
323 //================================================================
324
325 protected Shape m_DamageZone;
326
327 override protected string GetDebugText()
328 {
329 string debug_output;
330 debug_output += string.Format("low net id: %1\n", m_RAIB.GetPairDeviceNetIdLow());
331 debug_output += string.Format("high net id: %1\n", m_RAIB.GetPairDeviceNetIdHigh());
332 debug_output += string.Format("pair device: %1\n", m_RAIB.GetPairDevice());
333
334 return debug_output;
335 }
336
337 protected void DrawDamageZone()
338 {
339 if (!DiagMenu.GetBool(DiagMenuIDs.WEAPON_CLAYMORE_DEBUG))
340 {
341 return;
342 }
343
344 string cfgPath = "CfgAmmo " + m_AmmoTypes[0];
345 float hitRange = g_Game.ConfigGetFloat(cfgPath + " indirectHitRange");
346 float hitRangeMultiplier = g_Game.ConfigGetFloat(cfgPath + " indirectHitRangeMultiplier");
347 float verticalAngle = g_Game.ConfigGetFloat(cfgPath + " indirectHitAngle1");
348 float horizontalAngle = g_Game.ConfigGetFloat(cfgPath + " indirectHitAngle2");
349 float range = hitRange * hitRangeMultiplier;
350 vector selfMatrix[4];
351
352 RemoveDebugVisuals();
353
354 GetTransform(selfMatrix);
355 m_DamageZone = Debug.DrawFrustum(horizontalAngle, verticalAngle, range);
356 m_DamageZone.SetMatrix(selfMatrix);
357 }
358
359 void RemoveDebugVisuals()
360 {
361 if ( m_DamageZone )
362 {
363 m_DamageZone.Destroy();
364 m_DamageZone = null;
365 }
366 }
367#endif
368}
369
370class ClaymoreMinePlacing : ClaymoreMine {}
ActionArmExplosiveCB ActionContinuousBaseCB ActionArmExplosive()
Определения ActionArmExplosive.c:18
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
RepairTentActionReciveData m_DamageZone
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
string Debug()
Определения CachedEquipmentStorageBase.c:26
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
vector orientation
Определения DustKickupEffects.c:21
DiagMenuIDs
Определения EDiagMenuIDs.c:2
ref array< string > m_AmmoTypes
Определения ExplosivesBase.c:26
void SetDefused(bool state)
Определения ExplosivesBase.c:289
bool GetArmed()
Определения ExplosivesBase.c:248
void SetAmmoTypes(array< string > pAmmoTypes)
Определения ExplosivesBase.c:300
bool GetDefused()
Определения ExplosivesBase.c:284
override void UnpairRemote()
Определения ExplosivesBase.c:99
void Arm()
Определения ExplosivesBase.c:219
void SetParticleOrientation(vector local_ori)
Определения ExplosivesBase.c:323
void ExplosivesBase()
Определения ExplosivesBase.c:45
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:4778
string GetDebugText()
Определения ModifierBase.c:71
ERemoteDetonatorLEDState
Определения RemoteDetonator.c:2
ref RemotelyActivatedItemBehaviour m_RAIB
Определения RemoteDetonator.c:231
override EntityAI GetPairDevice()
Определения ClaymoreMine.c:107
override void PairRemote(notnull EntityAI trigger)
Определения ClaymoreMine.c:102
bool m_IsFalling
Определения ClaymoreMine.c:10
override void OnDebugSpawn()
Определения ClaymoreMine.c:313
override void OnVariablesSynchronized()
Определения ClaymoreMine.c:73
override bool IsTakeable()
Определения ClaymoreMine.c:223
override void EEDelete(EntityAI parent)
Определения ClaymoreMine.c:41
override void OnDisarmed(bool pWithTool)
Определения ClaymoreMine.c:146
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ClaymoreMine.c:85
void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced=false)
Определения ClaymoreMine.c:203
override string GetDisarmSoundset()
Определения ClaymoreMine.c:303
override void OnArmed()
Определения ClaymoreMine.c:131
void OnTriggeredByFall(Contact extra)
SERVER: decide what "triggered by falling" means for this mine.
Определения ClaymoreMine.c:261
override string GetArmSoundset()
Определения ClaymoreMine.c:298
const string ANIM_PHASE_DEPLOYED
Определения ClaymoreMine.c:4
override string GetLoopDeploySoundset()
Определения ClaymoreMine.c:293
const string SELECTION_NAME_LED
Определения ClaymoreMine.c:5
override void EEKilled(Object killer)
Определения ClaymoreMine.c:31
override string GetDisarmSoundsetUnpaired()
Определения ClaymoreMine.c:308
override int GetViewIndex()
Определения ClaymoreMine.c:275
override string GetDeploySoundset()
Определения ClaymoreMine.c:288
override void EOnContact(IEntity other, Contact extra)
Fires when the (now dynamic) trap actually hits something - the real "it fell" moment.
Определения ClaymoreMine.c:251
bool m_FallTriggered
Определения ClaymoreMine.c:11
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения ClaymoreMine.c:97
void InitiateExplosion()
Определения ClaymoreMine.c:52
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения ClaymoreMine.c:166
ref RemotelyActivatedItemBehaviour m_RAIB
Определения ClaymoreMine.c:7
void ClaymoreMine()
Определения ClaymoreMine.c:13
override void AfterStoreLoad()
Определения ClaymoreMine.c:62
override bool CanBeDisarmed()
Определения ClaymoreMine.c:112
override bool IsDeployable()
Определения ClaymoreMine.c:228
void ClearIsFalling()
Определения ClaymoreMine.c:270
override void SetActions()
Определения ClaymoreMine.c:233
override void OnActivatedByItem(notnull ItemBase item)
Определения ClaymoreMine.c:117
override void EOnInit(IEntity other, int extra)
Определения ClaymoreMine.c:26
override void OnItemFallRebuilding()
Определения ClaymoreMine.c:242
ERemoteDetonatorLEDState m_LastLEDState
Определения ClaymoreMine.c:8
const string ANIM_PHASE_PACKED
Определения ClaymoreMine.c:3
void UpdateVisuals()
Определения ClaymoreMine.c:181
Определения ClaymoreMine.c:2
Определения Contact.c:10
Определения EnEntity.c:165
InventoryLocation.
Определения InventoryLocation.c:30
Определения ObjectTyped.c:2
static RemoteDetonatorTrigger SpawnInPlayerHands(notnull EntityAI pEntity, EntityAI deviceToPair=null)
Определения RemoteDetonator.c:155
Определения EnConvert.c:119
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
static proto string Format(string fmt, 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)
Gets n-th character from string.
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8