3 protected const string SLOT_TRIGGER =
"TriggerRemoteDetonator_Receiver";
4 protected const string ANIM_PHASE_TRIGGER_REMOTE =
"TriggerRemote";
6 protected bool m_UsedAsCharge;
17 RegisterNetSyncVariableInt(
"m_RAIB.m_PairDeviceNetIdLow");
18 RegisterNetSyncVariableInt(
"m_RAIB.m_PairDeviceNetIdHigh");
21 override void EOnInit(
IEntity other,
int extra)
23 if (!
g_Game.IsMultiplayer())
28 override void EEKilled(
Object killer)
31 GetGame().GetAnalyticsServer().OnEntityKilled(killer,
this);
34 override bool HasLockedTriggerSlots()
36 return GetInventory().GetSlotLock(
InventorySlots.GetSlotIdFromString(SLOT_TRIGGER));
39 override void LockTriggerSlots()
41 GetInventory().SetSlotLock(
InventorySlots.GetSlotIdFromString(SLOT_TRIGGER),
true);
44 override void UnlockTriggerSlots()
46 GetInventory().SetSlotLock(
InventorySlots.GetSlotIdFromString(SLOT_TRIGGER),
false);
51 if (!super.OnStoreLoad(ctx, version))
57 bool locked = GetInventory().GetSlotLock(slotId);
60 GetInventory().SetSlotLock(slotId,
false);
61 locked = GetInventory().GetSlotLock(slotId);
70 super.OnStoreSave(ctx);
75 override void OnVariablesSynchronized()
77 super.OnVariablesSynchronized();
81 m_RAIB.OnVariableSynchronized();
85 UpdateVisuals(GetInventory().FindAttachment(slotId));
90 super.EEItemLocationChanged(oldLoc, newLoc);
98 override bool CanReceiveAttachment(
EntityAI attachment,
int slotId)
101 GetInventory().GetCurrentInventoryLocation(il);
108 if (timer && !timer.IsAlarmOn())
116 override bool CanDisplayAttachmentSlot(
int slot_id)
123 return FindAttachmentBySlotName(
slotName) !=
null;
130 override bool IsTakeable()
132 return !
GetArmed() && super.IsTakeable();
135 override bool IsDeployable()
140 override void SetActions()
148 override void OnWasAttached(
EntityAI parent,
int slot_id)
150 super.OnWasAttached(parent, slot_id);
152 m_UsedAsCharge =
false;
156 m_UsedAsCharge =
true;
160 override void OnWasDetached(
EntityAI parent,
int slot_id)
162 super.OnWasDetached(parent, slot_id);
166 m_UsedAsCharge =
false;
175 return !m_UsedAsCharge;
181 override void EEHealthLevelChanged(
int oldLevel,
int newLevel,
string zone)
183 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
189 for (
int attachmentIdx = 0; attachmentIdx < GetInventory().AttachmentCount(); attachmentIdx++)
191 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(attachmentIdx));
194 attachment.UnlockFromParent();
195 attachment.SetHealth(
"",
"", 0.0);
210 override void PairRemote(notnull
EntityAI trigger)
218 return m_RAIB.GetPairDevice();
221 override bool CanBeArmed()
223 if (!super.CanBeArmed())
228 return HasLockedTriggerSlots() && !
GetArmed();
231 override bool CanBeDisarmed()
236 override void OnActivatedByItem(notnull
ItemBase item)
247 SetHealth(
"",
"", 0.0);
254 if (GetPairDevice() == item)
256 SetHealth(
"",
"", 0.0);
263 override void OnDisarmed(
bool pWithTool)
265 super.OnDisarmed(pWithTool);
270 for (
int att = 0; att < GetInventory().AttachmentCount(); att++)
272 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(att));
275 attachment.UnlockFromParent();
276 if (attachment.IsInherited(RemoteDetonator))
280 GetInventory().DropEntity(
InventoryMode.SERVER,
this, attachment);
281 attachment.SetHealth(
"",
"", 0.0);
295 override void EEItemAttached(
EntityAI item,
string slot_name)
297 super.EEItemAttached(item, slot_name);
299 if (slot_name == SLOT_TRIGGER)
300 OnTriggerAttached(item);
303 override void EEItemDetached(
EntityAI item,
string slot_name)
305 super.EEItemDetached(item, slot_name);
307 if (slot_name == SLOT_TRIGGER)
308 OnTriggerDetached(item);
311 override void UpdateLED(
int pState)
316 receiver.UpdateLED(pState,
true);
320 protected void OnTriggerAttached(
EntityAI entity)
323 UpdateVisuals(entity);
326 for (
int att = 0; att < GetInventory().AttachmentCount(); att++)
328 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(att));
331 attachment.LockToParent();
336 protected void OnTriggerDetached(
EntityAI entity)
342 protected void UpdateVisuals(
EntityAI entity)
346 SetAnimationPhase(ANIM_PHASE_TRIGGER_REMOTE, 0.0);
350 SetAnimationPhase(ANIM_PHASE_TRIGGER_REMOTE, 1.0);
355 override string GetDeploySoundset()
357 return "placeImprovisedExplosive_SoundSet";
360 override string GetLoopDeploySoundset()
362 return "improvisedexplosive_deploy_SoundSet";
365 override protected bool UsesGlobalDeploy()