DayZ 1.27
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
11 {
13
14 SetAmmoTypes({"ClaymoreMine_Ammo","ClaymoreMine_Secondary_Ammo"});
16 SetParticleOrientation("90 0 0");
17
18 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdLow");
19 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdHigh");
21 }
22
23 override void EOnInit(IEntity other, int extra)
24 {
26 }
27
28 override void EEKilled(Object killer)
29 {
30 super.EEKilled(killer);
31#ifdef DIAG_DEVELOPER
32#ifndef SERVER
33 RemoveDebugVisuals();
34#endif
35#endif
36 }
37
38 override void EEDelete(EntityAI parent)
39 {
40 super.EEDelete(parent);
41
42#ifdef DIAG_DEVELOPER
43#ifndef SERVER
44 RemoveDebugVisuals();
45#endif
46#endif
47 }
48
49 override protected void InitiateExplosion()
50 {
51 if (GetDefused())
52 {
53 return;
54 }
55
56 super.InitiateExplosion();
57 }
58
59 override void AfterStoreLoad()
60 {
61 super.AfterStoreLoad();
62
64 if (GetArmed())
65 {
67 }
68 }
69
71 {
72 super.OnVariablesSynchronized();
73
74 if (m_RAIB)
75 {
76 m_RAIB.OnVariableSynchronized();
77 }
78
80 }
81
82 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
83 {
84 super.EEItemLocationChanged(oldLoc, newLoc);
85
86 if (m_RAIB)
87 {
88 m_RAIB.Pair();
89 }
90 }
91
92
93
98
99 override void PairRemote(notnull EntityAI trigger)
100 {
101 m_RAIB.Pair(trigger);
102 }
103
105 {
106 return m_RAIB.GetPairDevice();
107 }
108
109 override bool CanBeDisarmed()
110 {
111 return GetArmed();
112 }
113
114 override void OnActivatedByItem(notnull ItemBase item)
115 {
116 if (GetGame().IsServer())
117 {
118 if (m_RAIB.IsPaired() && GetArmed())
119 {
120 if (GetPairDevice() == item)
121 {
122 SetHealth("", "", 0.0);
123 }
124 }
125 }
126 }
127
128 override void OnArmed()
129 {
130 super.OnArmed();
131
134
135#ifdef DIAG_DEVELOPER
136#ifndef SERVER
137 // have to call this function a little later, after claymore transform has been finalized
138 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DrawDamageZone, 500);
139#endif
140#endif
141 }
142
143 override void OnDisarmed(bool pWithTool)
144 {
145 super.OnDisarmed(pWithTool);
146
147#ifdef DIAG_DEVELOPER
148 RemoveDebugVisuals();
149#endif
150
151 SetDefused(pWithTool);
152 UnpairRemote();
153
154 if (pWithTool)
155 {
156 SetHealth("", "", 0.0);
157 }
158
161 }
162
163 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
164 {
165 super.OnPlacementComplete(player, position, orientation);
166
167 if (GetGame().IsServer())
168 {
170 if (rdt)
171 {
172 PairWithDevice(rdt);
173 Arm();
174 }
175 }
176 }
177
178 protected void UpdateVisuals()
179 {
180 if (GetArmed() || GetDefused())
181 {
182 ShowSelection(ANIM_PHASE_DEPLOYED);
183 HideSelection(ANIM_PHASE_PACKED);
184 if (GetOnViewIndexChanged())
185 {
186 GetOnViewIndexChanged().Invoke();
187 }
188 }
189 else
190 {
191 HideSelection(ANIM_PHASE_DEPLOYED);
192 ShowSelection(ANIM_PHASE_PACKED);
193 if (GetOnViewIndexChanged())
194 {
195 GetOnViewIndexChanged().Invoke();
196 }
197 }
198 }
199
200 protected void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced = false)
201 {
202 if (pState != m_LastLEDState || pForced)
203 {
204 int selectionIdx = GetHiddenSelectionIndex(SELECTION_NAME_LED);
205
206 switch (pState)
207 {
209 SetObjectTexture(selectionIdx, RemoteDetonator.COLOR_LED_LIT);
210 break;
211 default:
212 SetObjectTexture(selectionIdx, RemoteDetonator.COLOR_LED_OFF);
213 break;
214 }
215
216 m_LastLEDState = pState;
217 }
218 }
219
220 override bool IsTakeable()
221 {
222 return !GetArmed() && super.IsTakeable();
223 }
224
225 override bool IsDeployable()
226 {
227 return true;
228 }
229
230 override void SetActions()
231 {
232 super.SetActions();
233
237 }
238
239 override int GetViewIndex()
240 {
241 if (MemoryPointExists("invView2"))
242 {
243 if (GetArmed())
244 {
245 return 1;
246 }
247 }
248
249 return 0;
250 }
251
252 override string GetDeploySoundset()
253 {
254 return "placeClaymore_SoundSet";
255 }
256
257 override string GetLoopDeploySoundset()
258 {
259 return "claymore_deploy_Soundset";
260 }
261
262 override string GetArmSoundset()
263 {
264 return "claymore_deploy_Soundset";
265 }
266
267 override string GetDisarmSoundset()
268 {
269 return "claymore_disarm_SoundSet";
270 }
271
272 override void OnDebugSpawn()
273 {
274 RemoteDetonatorTrigger rdt = RemoteDetonatorTrigger.Cast(SpawnEntityOnGroundPos("RemoteDetonatorTrigger", GetPosition() + GetDirection() * 0.5));
275 PairWithDevice(rdt);
276 Arm();
277 }
278
279#ifdef DIAG_DEVELOPER
280 //================================================================
281 // DEBUG
282 //================================================================
283
284 protected Shape m_DamageZone;
285
286 override protected string GetDebugText()
287 {
288 string debug_output;
289 debug_output += string.Format("low net id: %1\n", m_RAIB.GetPairDeviceNetIdLow());
290 debug_output += string.Format("high net id: %1\n", m_RAIB.GetPairDeviceNetIdHigh());
291 debug_output += string.Format("pair device: %1\n", m_RAIB.GetPairDevice());
292
293 return debug_output;
294 }
295
296 protected void DrawDamageZone()
297 {
298 if (!DiagMenu.GetBool(DiagMenuIDs.WEAPON_CLAYMORE_DEBUG))
299 {
300 return;
301 }
302
303 auto game = GetGame();
304 string cfgPath = "CfgAmmo " + m_AmmoTypes[0];
305 float hitRange = game.ConfigGetFloat(cfgPath + " indirectHitRange");
306 float hitRangeMultiplier = game.ConfigGetFloat(cfgPath + " indirectHitRangeMultiplier");
307 float verticalAngle = game.ConfigGetFloat(cfgPath + " indirectHitAngle1");
308 float horizontalAngle = game.ConfigGetFloat(cfgPath + " indirectHitAngle2");
309 float range = hitRange * hitRangeMultiplier;
310 vector selfMatrix[4];
311
312 RemoveDebugVisuals();
313
314 GetTransform(selfMatrix);
315 m_DamageZone = Debug.DrawFrustum(horizontalAngle, verticalAngle, range);
316 m_DamageZone.SetMatrix(selfMatrix);
317 }
318
319 void RemoveDebugVisuals()
320 {
321 if ( m_DamageZone )
322 {
323 m_DamageZone.Destroy();
324 m_DamageZone = null;
325 }
326 }
327#endif
328}
329
330class ClaymoreMinePlacing : ClaymoreMine {}
ActionArmExplosiveCB ActionContinuousBaseCB ActionArmExplosive()
Определения ActionArmExplosive.c:18
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
RepairTentActionReciveData m_DamageZone
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
DiagMenuIDs
Определения EDiagMenuIDs.c:2
ref array< string > m_AmmoTypes
Определения ExplosivesBase.c:26
void SetDefused(bool state)
Определения ExplosivesBase.c:307
bool GetArmed()
Определения ExplosivesBase.c:266
void SetAmmoTypes(array< string > pAmmoTypes)
Определения ExplosivesBase.c:318
void SetParticleExplosion(int particle)
Определения ExplosivesBase.c:324
bool GetDefused()
Определения ExplosivesBase.c:302
override void UnpairRemote()
Определения ExplosivesBase.c:127
void Arm()
Определения ExplosivesBase.c:237
void SetParticleOrientation(vector local_ori)
Определения ExplosivesBase.c:340
void ExplosivesBase()
Определения ExplosivesBase.c:42
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
string GetDebugText()
Определения ModifierBase.c:71
ERemoteDetonatorLEDState
Определения RemoteDetonator.c:2
ref RemotelyActivatedItemBehaviour m_RAIB
Определения RemoteDetonator.c:231
void Debug()
Определения UniversalTemperatureSource.c:349
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
override EntityAI GetPairDevice()
Определения ClaymoreMine.c:104
override void PairRemote(notnull EntityAI trigger)
Определения ClaymoreMine.c:99
override void OnDebugSpawn()
Определения ClaymoreMine.c:272
override void OnVariablesSynchronized()
Определения ClaymoreMine.c:70
override bool IsTakeable()
Определения ClaymoreMine.c:220
override void EEDelete(EntityAI parent)
Определения ClaymoreMine.c:38
override void OnDisarmed(bool pWithTool)
Определения ClaymoreMine.c:143
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ClaymoreMine.c:82
void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced=false)
Определения ClaymoreMine.c:200
override string GetDisarmSoundset()
Определения ClaymoreMine.c:267
override void OnArmed()
Определения ClaymoreMine.c:128
override string GetArmSoundset()
Определения ClaymoreMine.c:262
const string ANIM_PHASE_DEPLOYED
Определения ClaymoreMine.c:4
override string GetLoopDeploySoundset()
Определения ClaymoreMine.c:257
const string SELECTION_NAME_LED
Определения ClaymoreMine.c:5
override void EEKilled(Object killer)
Определения ClaymoreMine.c:28
override int GetViewIndex()
Определения ClaymoreMine.c:239
override string GetDeploySoundset()
Определения ClaymoreMine.c:252
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения ClaymoreMine.c:94
void InitiateExplosion()
Определения ClaymoreMine.c:49
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения ClaymoreMine.c:163
ref RemotelyActivatedItemBehaviour m_RAIB
Определения ClaymoreMine.c:7
void ClaymoreMine()
Определения ClaymoreMine.c:10
override void AfterStoreLoad()
Определения ClaymoreMine.c:59
override bool CanBeDisarmed()
Определения ClaymoreMine.c:109
override bool IsDeployable()
Определения ClaymoreMine.c:225
override void SetActions()
Определения ClaymoreMine.c:230
override void OnActivatedByItem(notnull ItemBase item)
Определения ClaymoreMine.c:114
override void EOnInit(IEntity other, int extra)
Определения ClaymoreMine.c:23
ERemoteDetonatorLEDState m_LastLEDState
Определения ClaymoreMine.c:8
const string ANIM_PHASE_PACKED
Определения ClaymoreMine.c:3
void UpdateVisuals()
Определения ClaymoreMine.c:178
Определения ClaymoreMine.c:2
Определения Building.c:6
Определения EnEntity.c:165
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
Определения ObjectTyped.c:2
static const int CLAYMORE_EXPLOSION
Определения ParticleList.c:328
Определения ParticleList.c:12
static RemoteDetonatorTrigger SpawnInPlayerHands(notnull EntityAI pEntity, EntityAI deviceToPair=null)
Определения RemoteDetonator.c:155
proto void CallLater(func fn, int delay=0, bool repeat=false, 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 ...
Определения EnConvert.c:106
proto native CGame GetGame()
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
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
Определения tools.c:8