DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл RemoteDetonator.c

См. исходные тексты.

Структуры данных

class  RemoteDetonatorTrigger
 
class  ReplaceDetonatorItemLambda
 
class  ReplaceDetonatorItemOnDisarmLambda
 

Перечисления

enum  ERemoteDetonatorLEDState { OFF = 0 , LIT }
 

Функции

bool IsKit ()
 
void UpdateLED (ERemoteDetonatorLEDState pState, bool pForced=false)
 
override void SetActions ()
 
RemoteDetonatorTrigger RemoteDetonator RemoteDetonatorReceiver ()
 
void RemoteDetonatorTrigger ()
 
override void OnVariablesSynchronized ()
 
override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
 
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour ()
 
override void OnCEUpdate ()
 
override void PairRemote (notnull EntityAI trigger)
 
override void UnpairRemote ()
 
override void OnActivatedByItem (notnull ItemBase item)
 Called when this item is activated by other.
 
void SetControlledDevice (EntityAI pDevice)
 
bool IsConnected ()
 
EntityAI GetControlledDevice ()
 
static RemoteDetonatorTrigger SpawnInPlayerHands (notnull EntityAI pEntity, EntityAI deviceToPair=null)
 
override void OnAnimationPhaseStarted (string animSource, float phase)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override void EEKilled (Object killer)
 
ReplaceDetonatorItemLambda ReplaceItemWithNewLambdaBase SetPairDevice (EntityAI device)
 
override void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
 
override void OnSuccess (EntityAI new_item)
 
override void OnAbort ()
 

Переменные

enum ERemoteDetonatorLEDState COLOR_LED_OFF = "#(argb,8,8,3)color(0,0,0,1.0,co)"
 
const string COLOR_LED_LIT = "#(argb,8,8,3)color(1,0,0,1.0,co)"
 
const string SELECTION_NAME_LED = "LED"
 
ERemoteDetonatorLEDState m_LastLEDState
 
const string ANIM_PHASE_TRIGGER = "trigger"
 
bool m_LED
 
ref RemotelyActivatedItemBehaviour m_RAIB
 

Перечисления

◆ ERemoteDetonatorLEDState

Элементы перечислений
OFF 
LIT 
2{
3 OFF = 0,
4 LIT,
5}
@ LIT
Definition RemoteDetonator.c:4
@ OFF
Definition RemoteDetonator.c:3

Функции

◆ CopyOldPropertiesToNew()

override void CopyOldPropertiesToNew ( notnull EntityAI old_item,
EntityAI new_item )
273 {
274 m_PairDevice = device;
275 }
276
277 override void OnSuccess(EntityAI new_item)
278 {
override void OnSuccess(EntityAI new_item)
Definition RemoteDetonator.c:277
Definition Building.c:6
Definition EntityAI.c:95

◆ EEItemLocationChanged()

override void EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
protected
269{
270 EntityAI m_PairDevice
Definition RemoteDetonator.c:259

◆ EEKilled()

override void EEKilled ( Object killer)
protected
243 {
244 super.EEKilled(killer);
245
247 }
void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced=false)
Definition RemoteDetonator.c:20
ERemoteDetonatorLEDState
Definition RemoteDetonator.c:2

Перекрестные ссылки UpdateLED().

◆ GetControlledDevice()

EntityAI GetControlledDevice ( )
protected
332 {
333 super.OnAbort();

◆ GetRemotelyActivatedItemBehaviour()

override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour ( )
protected

◆ IsConnected()

bool IsConnected ( )
protected

◆ IsKit()

override bool IsKit ( )
protected
16 {
17 return true;
18 }

◆ OnAbort()

override void OnAbort ( )
protected
301 {
302 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
303 if (explosive)
304 {
305 explosive.LockTriggerSlots();
306 explosive.SetTakeable(true);
307 }
308 }

◆ OnActivatedByItem()

override void OnActivatedByItem ( notnull ItemBase item)
protected

Called when this item is activated by other.

312{
313 override void OnSuccess(EntityAI new_item)
314 {
315 super.OnSuccess(new_item);
316
317 RemoteDetonator detonator = RemoteDetonator.Cast(m_OldItem);
318 if (detonator)

◆ OnAnimationPhaseStarted()

override void OnAnimationPhaseStarted ( string animSource,
float phase )
protected
372{
373 OFF = 0,
374 LIT,
375}
376
377class RemoteDetonator : Inventory_Base
378{
379 const string COLOR_LED_OFF = "#(argb,8,8,3)color(0,0,0,1.0,co)";
380 const string COLOR_LED_LIT = "#(argb,8,8,3)color(1,0,0,1.0,co)";
381 const string SELECTION_NAME_LED = "LED";
382
384
385 bool IsKit()
386 {
387 return true;
388 }
389
391 {
392 int selectionIdx = GetHiddenSelectionIndex(SELECTION_NAME_LED);
393
394 switch (pState)
395 {
397 SetObjectTexture(selectionIdx, COLOR_LED_LIT);
398 break;
399 default:
400 SetObjectTexture(selectionIdx, COLOR_LED_OFF);
401 }
402
404 SetSynchDirty();
405 }
406
407 override void SetActions()
408 {
409 super.SetActions();
410
413 }
414}
415
416class RemoteDetonatorTrigger : RemoteDetonator
417{
418 protected const string ANIM_PHASE_TRIGGER = "trigger";
419
420 protected bool m_LED;
422
424 {
426 m_RAIB.SetTrigger();
427
428 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdLow");
429 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdHigh");
430 RegisterNetSyncVariableInt("m_LastLEDState", 0, EnumTools.GetEnumSize(ERemoteDetonatorLEDState));
431
433 }
434
435 override bool IsKit()
436 {
437 return false;
438 }
439
440 override void OnVariablesSynchronized()
441 {
442 super.OnVariablesSynchronized();
443
444 if (m_RAIB)
445 {
446 m_RAIB.OnVariableSynchronized();
447 }
448
450 }
451
453 {
454 super.EEItemLocationChanged(oldLoc, newLoc);
455
456 if (m_RAIB)
457 {
458 m_RAIB.Pair();
459 }
460 }
461
463 {
464 return m_RAIB;
465 }
466
467 override void OnCEUpdate()
468 {
469 super.OnCEUpdate();
470
471 if (!IsRuined() && IsConnected() && GetControlledDevice())
472 {
474 {
476
477 return;
478 }
479 }
480
482 }
483
484 override void PairRemote(notnull EntityAI trigger)
485 {
486 m_RAIB.Pair(trigger);
487 }
488
489 override void UnpairRemote()
490 {
492 m_RAIB.Unpair();
493 }
494
496 {
497 if (GetGame().IsServer())
498 {
499 if (m_RAIB.IsPaired() && !IsRuined())
500 {
503 {
504 device.OnActivatedByItem(this);
505 }
506 }
507 }
508 }
509
511 {
512 m_RAIB.Pair(pDevice);
513 }
514
515 bool IsConnected()
516 {
517 return m_RAIB.IsPaired();
518 }
519
521 {
522 return m_RAIB.GetPairDevice();
523 }
524
526 {
527 string type = "RemoteDetonatorTrigger";
530 if (player)
531 {
532 ItemBase inHandsItem = player.GetItemInHands();
533 if (inHandsItem)
534 {
535 if (deviceToPair)
536 {
538 onArmLambda.SetPairDevice(deviceToPair);
539 MiscGameplayFunctions.TurnItemIntoItemEx(player, onArmLambda);
540 }
541 else
542 {
544 MiscGameplayFunctions.TurnItemIntoItemEx(player, lambda);
545 }
546
547
548 rdt = RemoteDetonatorTrigger.Cast(player.GetItemInHands());
549 }
550 else
551 rdt = RemoteDetonatorTrigger.Cast(player.GetHumanInventory().CreateInHands(type));
552
554 if (player.GetItemInHands())
555 player.GetItemAccessor().OnItemInHandsChanged();
556 }
557
558 return rdt;
559 }
560
561 override void OnAnimationPhaseStarted(string animSource, float phase)
562 {
564 {
565 if (phase > 0.01)
566 {
568 }
569 }
570 }
571
572 override void SetActions()
573 {
574 super.SetActions();
575
577
581 }
582
583#ifdef DIAG_DEVELOPER
584 override protected string GetDebugText()
585 {
586 string debug_output;
587 debug_output += string.Format("low net id: %1\n", m_RAIB.GetPairDeviceNetIdLow());
588 debug_output += string.Format("high net id: %1\n", m_RAIB.GetPairDeviceNetIdHigh());
589 debug_output += string.Format("pair device: %1\n", m_RAIB.GetPairDevice());
590 return debug_output;
591 }
592#endif
593}
594
595class RemoteDetonatorReceiver : RemoteDetonator
596{
598 {
600 }
601
602 override bool IsKit()
603 {
604 return false;
605 }
606
607 override void OnWasDetached(EntityAI parent, int slot_id)
608 {
610 }
611
612 override void EEKilled(Object killer)
613 {
614 super.EEKilled(killer);
615
617 }
618
619 override void SetActions()
620 {
621 super.SetActions();
622
625 }
626}
627
629{
631 {
632 super.CopyOldPropertiesToNew(old_item, new_item);
633
634 MiscGameplayFunctions.TransferItemProperties(old_item, new_item);
635 }
636}
637
639{
640 EntityAI m_PairDevice
641
643 {
644 m_PairDevice = device;
645 }
646
647 override void OnSuccess(EntityAI new_item)
648 {
649 super.OnSuccess(new_item);
650
651 RemoteDetonator detonator = RemoteDetonator.Cast(new_item);
652 if (detonator)
653 {
654 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
655 if (explosive)
656 {
657 ItemBase receiver = ItemBase.Cast(explosive.GetInventory().CreateAttachment("RemoteDetonatorReceiver"));
658 if (receiver)
659 {
660 MiscGameplayFunctions.TransferItemProperties(detonator, receiver);
661 receiver.LockToParent();
662 explosive.SetTakeable(false);
663 explosive.PairWithDevice(detonator);
664 explosive.Arm();
665 }
666 }
667 }
668 }
669
670 override void OnAbort()
671 {
672 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
673 if (explosive)
674 {
675 explosive.LockTriggerSlots();
676 explosive.SetTakeable(true);
677 }
678 }
679}
680
682{
683 override void OnSuccess(EntityAI new_item)
684 {
685 super.OnSuccess(new_item);
686
687 RemoteDetonator detonator = RemoteDetonator.Cast(m_OldItem);
688 if (detonator)
689 {
690 if (detonator.GetRemotelyActivatedItemBehaviour())
691 {
692 ExplosivesBase explosive = ExplosivesBase.Cast(detonator.GetRemotelyActivatedItemBehaviour().GetPairDevice());
693 if (explosive)
694 {
695 explosive.Disarm();
696 }
697 }
698 }
699 }
700
701 override void OnAbort()
702 {
703 super.OnAbort();
704
705 RemoteDetonator detonator = RemoteDetonator.Cast(m_OldItem);
706 if (detonator)
707 {
708 if (detonator.GetRemotelyActivatedItemBehaviour())
709 {
710 ExplosivesBase explosive = ExplosivesBase.Cast(detonator.GetRemotelyActivatedItemBehaviour().GetPairDevice());
711 if (explosive)
712 {
713 explosive.LockExplosivesSlots();
714 }
715 }
716 }
717 }
718}
ActionAttachExplosivesTriggerCB ActionContinuousBaseCB ActionAttachExplosivesTrigger()
Definition ActionAttachExplosivesTrigger.c:11
ActionDisarmExplosiveWithRemoteDetonatorCB ActionDisarmExplosiveCB ActionDisarmExplosiveWithRemoteDetonator()
Definition ActionDisarmExplosiveWithRemoteDetonator.c:11
ActionDisarmExplosiveWithRemoteDetonatorUnpairedCB ActionDisarmExplosiveCB ActionDisarmExplosiveWithRemoteDetonatorUnpaired()
Definition ActionDisarmExplosiveWithRemoteDetonatorUnpaired.c:11
override void OnSuccess(EntityAI new_item)
Definition ActionRestrainTarget.c:221
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Definition AdvancedCommunication.c:252
void SetActions()
Definition AdvancedCommunication.c:213
override void EEKilled(Object killer)
Definition ExplosivesBase.c:93
const string COLOR_LED_OFF
Definition Land_Underground_Panel.c:21
void UpdateLED(string selection, string color)
Definition Land_Underground_Panel.c:331
string GetDebugText()
Definition ModifierBase.c:71
RemoteDetonatorTrigger RemoteDetonator RemoteDetonatorReceiver()
Definition RemoteDetonator.c:227
bool IsKit()
Definition RemoteDetonator.c:15
ERemoteDetonatorLEDState m_LastLEDState
Definition RemoteDetonator.c:13
override void OnAbort()
Definition RemoteDetonator.c:300
const string COLOR_LED_LIT
Definition RemoteDetonator.c:10
override void OnWasDetached(EntityAI parent, int slot_id)
Definition RemoteDetonator.c:237
const string SELECTION_NAME_LED
Definition RemoteDetonator.c:11
ReplaceDetonatorItemLambda ReplaceItemWithNewLambdaBase SetPairDevice(EntityAI device)
Definition RemoteDetonator.c:272
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Definition ActionAttachOnTrap.c:2
Definition ActionTriggerRemotely.c:2
Definition EnConvert.c:590
static int GetEnumSize(typename e)
Return amount of values in enum.
Definition EnConvert.c:623
Definition BarbedBaseballBat.c:2
InventoryLocation.
Definition InventoryLocation.c:29
Definition InventoryItem.c:731
Definition EnMath.c:7
Definition ObjectTyped.c:2
Definition PlayerBaseClient.c:2
Definition RemoteDetonator.c:47
override void OnCEUpdate()
Definition RemoteDetonator.c:97
override bool IsKit()
Definition RemoteDetonator.c:65
const string ANIM_PHASE_TRIGGER
Definition RemoteDetonator.c:48
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Definition RemoteDetonator.c:92
override void PairRemote(notnull EntityAI trigger)
Definition RemoteDetonator.c:114
void SetControlledDevice(EntityAI pDevice)
Definition RemoteDetonator.c:140
EntityAI GetControlledDevice()
Definition RemoteDetonator.c:150
override void UnpairRemote()
Definition RemoteDetonator.c:119
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition RemoteDetonator.c:82
bool IsConnected()
Definition RemoteDetonator.c:145
static RemoteDetonatorTrigger SpawnInPlayerHands(notnull EntityAI pEntity, EntityAI deviceToPair=null)
Definition RemoteDetonator.c:155
override void OnActivatedByItem(notnull ItemBase item)
Definition RemoteDetonator.c:125
void RemoteDetonatorTrigger()
Definition RemoteDetonator.c:53
ref RemotelyActivatedItemBehaviour m_RAIB
Definition RemoteDetonator.c:51
override void OnVariablesSynchronized()
Definition RemoteDetonator.c:70
bool m_LED
Definition RemoteDetonator.c:50
override void OnAnimationPhaseStarted(string animSource, float phase)
Definition RemoteDetonator.c:191
override void SetActions()
Definition RemoteDetonator.c:202
Definition RemotelyActivatedItemBehaviour.c:2
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Definition RemoteDetonator.c:260
Definition RemoteDetonator.c:312
override void OnSuccess(EntityAI new_item)
Definition RemoteDetonator.c:313
override void OnAbort()
Definition RemoteDetonator.c:331
base class for transformation operations (creating one item from another)
Definition ReplaceItemWithNewLambdaBase.c:5
EntityAI m_OldItem
Definition ReplaceItemWithNewLambdaBase.c:6
Definition ActionConstants.c:106
const float EXPLOSIVE_REMOTE_ACTIVATION
Definition ActionConstants.c:114
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()
static proto float SqrFloat(float f)
Returns squared value.

◆ OnCEUpdate()

override void OnCEUpdate ( )
protected
278 {
279 super.OnSuccess(new_item);
280
281 RemoteDetonator detonator = RemoteDetonator.Cast(new_item);
282 if (detonator)
283 {
284 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
285 if (explosive)
286 {
287 ItemBase receiver = ItemBase.Cast(explosive.GetInventory().CreateAttachment("RemoteDetonatorReceiver"));
288 if (receiver)
289 {
290 MiscGameplayFunctions.TransferItemProperties(detonator, receiver);
291 receiver.LockToParent();
292 explosive.SetTakeable(false);

◆ OnSuccess()

override void OnSuccess ( EntityAI new_item)
protected
278 {
279 super.OnSuccess(new_item);
280
281 RemoteDetonator detonator = RemoteDetonator.Cast(new_item);
282 if (detonator)
283 {
284 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
285 if (explosive)
286 {
287 ItemBase receiver = ItemBase.Cast(explosive.GetInventory().CreateAttachment("RemoteDetonatorReceiver"));
288 if (receiver)
289 {
290 MiscGameplayFunctions.TransferItemProperties(detonator, receiver);
291 receiver.LockToParent();
292 explosive.SetTakeable(false);
293 explosive.PairWithDevice(detonator);
294 explosive.Arm();
295 }
296 }
297 }
298 }

◆ OnVariablesSynchronized()

◆ OnWasDetached()

override void OnWasDetached ( EntityAI parent,
int slot_id )
protected
238 {
240 }

Перекрестные ссылки UpdateLED().

Используется в Entity::EEItemLocationChanged().

◆ PairRemote()

override void PairRemote ( notnull EntityAI trigger)
protected

◆ RemoteDetonatorReceiver()

RemoteDetonatorTrigger RemoteDetonator RemoteDetonatorReceiver ( )
protected

◆ RemoteDetonatorTrigger()

void RemoteDetonatorTrigger ( )
protected
233 {
234 return false;
235 }
236
237 override void OnWasDetached(EntityAI parent, int slot_id)
238 {
240 }
241
242 override void EEKilled(Object killer)
243 {
override void EEKilled(Object killer)
Definition RemoteDetonator.c:242

◆ SetActions()

◆ SetControlledDevice()

void SetControlledDevice ( EntityAI pDevice)
protected
321 {
322 ExplosivesBase explosive = ExplosivesBase.Cast(detonator.GetRemotelyActivatedItemBehaviour().GetPairDevice());
323 if (explosive)

◆ SetPairDevice()

273 {
274 m_PairDevice = device;
275 }

◆ SpawnInPlayerHands()

static RemoteDetonatorTrigger SpawnInPlayerHands ( notnull EntityAI pEntity,
EntityAI deviceToPair = null )
staticprotected

item replaced, use different IK

337 {
338 if (detonator.GetRemotelyActivatedItemBehaviour())
339 {
340 ExplosivesBase explosive = ExplosivesBase.Cast(detonator.GetRemotelyActivatedItemBehaviour().GetPairDevice());
341 if (explosive)
342 {
343 explosive.LockExplosivesSlots();
344 }
345 }
346 }
347 }
348}

◆ UnpairRemote()

override void UnpairRemote ( )
protected
301 {
302 ExplosivesBase explosive = ExplosivesBase.Cast(m_PairDevice);
303 if (explosive)

◆ UpdateLED()

void UpdateLED ( ERemoteDetonatorLEDState pState,
bool pForced = false )
protected
21 {
22 int selectionIdx = GetHiddenSelectionIndex(SELECTION_NAME_LED);
23
24 switch (pState)
25 {
27 SetObjectTexture(selectionIdx, COLOR_LED_LIT);
28 break;
29 default:
30 SetObjectTexture(selectionIdx, COLOR_LED_OFF);
31 }
32
34 SetSynchDirty();
35 }
enum ERemoteDetonatorLEDState COLOR_LED_OFF

Перекрестные ссылки COLOR_LED_LIT, COLOR_LED_OFF, m_LastLEDState и SELECTION_NAME_LED.

Используется в RemoteDetonatorTrigger::OnAnimationPhaseStarted(), RemoteDetonatorTrigger::OnCEUpdate(), RemoteDetonatorTrigger::OnVariablesSynchronized(), RemoteDetonatorTrigger::RemoteDetonatorTrigger() и RemoteDetonatorTrigger::UnpairRemote().

Переменные

◆ ANIM_PHASE_TRIGGER

const string ANIM_PHASE_TRIGGER = "trigger"
protected

◆ COLOR_LED_LIT

const string COLOR_LED_LIT = "#(argb,8,8,3)color(1,0,0,1.0,co)"

Используется в UpdateLED().

◆ COLOR_LED_OFF

enum ERemoteDetonatorLEDState COLOR_LED_OFF = "#(argb,8,8,3)color(0,0,0,1.0,co)"

◆ m_LastLEDState

◆ m_LED

bool m_LED
protected

◆ m_RAIB

◆ SELECTION_NAME_LED

const string SELECTION_NAME_LED = "LED"

Используется в UpdateLED().