372{
375}
376
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)";
382
384
386 {
387 return true;
388 }
389
391 {
393
394 switch (pState)
395 {
398 break;
399 default:
401 }
402
404 SetSynchDirty();
405 }
406
408 {
409 super.SetActions();
410
413 }
414}
415
417{
419
420 protected bool m_LED;
421 protected ref RemotelyActivatedItemBehaviour
m_RAIB;
422
424 {
425 m_RAIB =
new RemotelyActivatedItemBehaviour(
this);
427
428 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdLow");
429 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdHigh");
431
433 }
434
435 override bool IsKit()
436 {
437 return false;
438 }
439
441 {
442 super.OnVariablesSynchronized();
443
445 {
446 m_RAIB.OnVariableSynchronized();
447 }
448
450 }
451
452 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
453 {
454 super.EEItemLocationChanged(oldLoc, newLoc);
455
457 {
459 }
460 }
461
463 {
465 }
466
468 {
469 super.OnCEUpdate();
470
472 {
474 {
476
477 return;
478 }
479 }
480
482 }
483
485 {
487 }
488
490 {
493 }
494
496 {
498 {
499 if (
m_RAIB.IsPaired() && !IsRuined())
500 {
502 if (device && vector.DistanceSq(
GetPosition(), device.GetPosition()) <= Math.SqrFloat(UAMaxDistances.EXPLOSIVE_REMOTE_ACTIVATION))
503 {
504 device.OnActivatedByItem(this);
505 }
506 }
507 }
508 }
509
511 {
513 }
514
516 {
518 }
519
521 {
522 return m_RAIB.GetPairDevice();
523 }
524
526 {
527 string type = "RemoteDetonatorTrigger";
529 PlayerBase player = PlayerBase.Cast(pEntity);
530 if (player)
531 {
532 ItemBase inHandsItem = player.GetItemInHands();
533 if (inHandsItem)
534 {
535 if (deviceToPair)
536 {
537 ReplaceDetonatorItemOnArmLambda onArmLambda = new ReplaceDetonatorItemOnArmLambda(inHandsItem, type);
538 onArmLambda.SetPairDevice(deviceToPair);
539 MiscGameplayFunctions.TurnItemIntoItemEx(player, onArmLambda);
540 }
541 else
542 {
543 ReplaceDetonatorItemLambda lambda = new ReplaceDetonatorItemLambda(inHandsItem, type);
544 MiscGameplayFunctions.TurnItemIntoItemEx(player, lambda);
545 }
546
547
549 }
550 else
552
554 if (player.GetItemInHands())
555 player.GetItemAccessor().OnItemInHandsChanged();
556 }
557
558 return rdt;
559 }
560
562 {
564 {
565 if (phase > 0.01)
566 {
568 }
569 }
570 }
571
573 {
575
577
581 }
582
583#ifdef DIAG_DEVELOPER
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
596{
598 {
600 }
601
602 override bool IsKit()
603 {
604 return false;
605 }
606
608 {
610 }
611
613 {
614 super.EEKilled(killer);
615
617 }
618
620 {
621 super.SetActions();
622
625 }
626}
627
629{
631 {
633
634 MiscGameplayFunctions.TransferItemProperties(old_item, new_item);
635 }
636}
637
639{
641
643 {
644 m_PairDevice = device;
645 }
646
648 {
649 super.OnSuccess(new_item);
650
651 RemoteDetonator detonator = RemoteDetonator.Cast(new_item);
652 if (detonator)
653 {
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
671 {
673 if (explosive)
674 {
675 explosive.LockTriggerSlots();
676 explosive.SetTakeable(true);
677 }
678 }
679}
680
682{
684 {
686
687 RemoteDetonator detonator = RemoteDetonator.Cast(
m_OldItem);
688 if (detonator)
689 {
690 if (detonator.GetRemotelyActivatedItemBehaviour())
691 {
693 if (explosive)
694 {
695 explosive.Disarm();
696 }
697 }
698 }
699 }
700
702 {
703 super.OnAbort();
704
705 RemoteDetonator detonator = RemoteDetonator.Cast(
m_OldItem);
706 if (detonator)
707 {
708 if (detonator.GetRemotelyActivatedItemBehaviour())
709 {
711 if (explosive)
712 {
713 explosive.LockExplosivesSlots();
714 }
715 }
716 }
717 }
718}
ActionAttachExplosivesTriggerCB ActionContinuousBaseCB ActionAttachExplosivesTrigger()
ActionDisarmExplosiveWithRemoteDetonatorCB ActionDisarmExplosiveCB ActionDisarmExplosiveWithRemoteDetonator()
ActionDisarmExplosiveWithRemoteDetonatorUnpairedCB ActionDisarmExplosiveCB ActionDisarmExplosiveWithRemoteDetonatorUnpaired()
void AddAction(typename actionName)
void RemoveAction(typename actionName)
class EconomyOutputStrings OFF
override void EEKilled(Object killer)
class GP5GasMask extends MaskBase ItemBase
const string COLOR_LED_OFF
void UpdateLED(string selection, string color)
void UpdateLED(ERemoteDetonatorLEDState pState, bool pForced=false)
RemoteDetonatorTrigger RemoteDetonator RemoteDetonatorReceiver()
ERemoteDetonatorLEDState m_LastLEDState
const string COLOR_LED_LIT
override void OnWasDetached(EntityAI parent, int slot_id)
const string SELECTION_NAME_LED
ReplaceDetonatorItemLambda ReplaceItemWithNewLambdaBase SetPairDevice(EntityAI device)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void SetActions()
EntityAI GetControlledDevice()
static RemoteDetonatorTrigger SpawnInPlayerHands(notnull EntityAI pEntity, EntityAI deviceToPair=null)
override void OnActivatedByItem(notnull ItemBase item)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void SetControlledDevice(EntityAI pDevice)
override void OnCEUpdate()
override void OnAnimationPhaseStarted(string animSource, float phase)
override void UnpairRemote()
const string ANIM_PHASE_TRIGGER
void RemoteDetonatorTrigger()
ref RemotelyActivatedItemBehaviour m_RAIB
override void PairRemote(notnull EntityAI trigger)
override void OnVariablesSynchronized()
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
override void OnSuccess(EntityAI new_item)
void OnAbort()
Step Out - notification on abort.
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
base class for transformation operations (creating one item from another)
proto native CGame GetGame()
class JsonUndergroundAreaTriggerData GetPosition
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.