74 RegisterNetSyncVariableBool(
"m_IsActive");
75 RegisterNetSyncVariableBool(
"m_IsInProgress");
88 super.OnVariablesSynchronized();
90 if (
g_Game.IsMultiplayer())
102 super.EEDelete(parent);
113 super.OnStoreSave(ctx);
122 if ( !super.OnStoreLoad(ctx, version) )
125 bool b_is_active =
false;
126 if ( !ctx.Read( b_is_active ) )
129 bool b_is_in_progress =
false;
130 if ( !ctx.Read( b_is_in_progress ) )
131 b_is_in_progress =
false;
138 if (b_is_in_progress && !b_is_active)
174 if ( GetHierarchyRootPlayer() != null && GetHierarchyRootPlayer().GetEntityInHands() ==
this )
178 vector player_pos = player.GetPosition();
179 vector aim_pos = player.GetAimPosition();
181 if (
vector.DistanceSq( player_pos, aim_pos ) <= (
Math.SqrFloat( 1.5 ) ) )
192 if ( position[1] <
g_Game.SurfaceGetSeaLevelMax() + 0.03 )
196 else if (
g_Game.SurfaceIsPond( position[0], position[2] ) )
208 g_Game.RPCSingleParam(
this,
ERPCs.RPC_TRAP_DISARM, null,
true);
239 else if (victim.IsInherited(
ItemBase))
242 float damage_coef = 1;
244 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
246 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity();
253 g_Game.GetInventoryItemSize(victim_item, item_size_x, item_size_y);
255 float add_damage = 300 * damage_coef /
Math.Clamp(item_size_x * item_size_y, 1,
int.
MAX);
256 victim_item.DecreaseHealth(
"",
"", add_damage);
285 if (victim && !victim.GetAllowDamage())
288 Param1<EntityAI> p =
new Param1<EntityAI>(victim);
289 g_Game.RPCSingleParam(
this,
ERPCs.RPC_TRAP_VICTIM, p,
true);
297 super.OnRPC(sender, rpc_type, ctx);
299 if ( !
g_Game.IsDedicatedServer() )
303 case ERPCs.RPC_TRAP_VICTIM:
304 Param1<EntityAI> victim =
new Param1<EntityAI>(null);
306 if (ctx.Read(victim))
314 case ERPCs.RPC_TRAP_DISARM:
373 if (GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this))
384 player.LocalDropEntity(
this);
386 vector trapPos = player.GetDirection() * 1.5;
433 HideSelection(
"safety_pin");
469 vector mins =
"-0.01 -0.05 -0.01";
470 vector maxs =
"0.01 0.5 0.01";
495 super.OnItemLocationChanged(old_owner, new_owner);
502 if (old_owner == NULL && new_owner != NULL &&
IsActive())
505 if ( new_owner.IsPlayer() )
509 else if (new_owner.GetHierarchyRootPlayer())
520 super.EEItemAttached(item, slot_name);
528 super.EEItemDetached(item, slot_name);
536 super.OnPlacementComplete(player, position, orientation);
540 SetOrientation(orientation);
549 if ( !super.CanPutInCargo(parent) )
559 if ( !super.CanPutIntoHands( parent ) )
632 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId,
slotName);
640 if (wheelEntity && wheelEntity.IsInherited(
CarWheel))
642 vector entPosXZ = wheelEntity.GetPosition();
644 if (
vector.Distance(trapPosXZ, entPosXZ) < 1)
659 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"LEGS")));
660 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BACK")));
661 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"VEST")));
662 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"HeadGear")));
663 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"Mask")));
664 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BODY")));
665 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"FEET")));
666 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"GLOVES")));
669 for (
int i = 0; i < equippedClothes.Count(); i++)
672 if (equippedClothes[i] == null)
ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap()
void AddAction(typename actionName)
override void EEItemDetached(EntityAI item, string slot_name)
override void EEItemAttached(EntityAI item, string slot_name)
const int ECE_CREATEPHYSICS
PlayerSpawnPreset slotName
Super root of all classes in Enforce script.
do not process rotations !
Wrapper class for managing sound through SEffectManager.
script counterpart to engine's class Inventory
proto native EntityAI GetAttachmentFromIndex(int index)
proto native int AttachmentCount()
Returns count of attachments attached to this item.
The class that will be instanced (moddable).
override void OnActivate()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void SetActions()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override void EEDelete(EntityAI parent)
override void OnVariablesSynchronized()
override bool CanPutInCargo(EntityAI parent)
override bool CanPutIntoHands(EntityAI parent)
override bool IsTakeable()
override bool CanRemoveFromHands(EntityAI parent)
override bool CanBePlaced(Man player, vector position)
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto native void SetPosition(vector position)
Set the world position of the Effect.
vector GetPosition()
Get the world position of the Effect.
void OnStoreSave(ParamsWriteContext ctx)
bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnRPC(ParamsReadContext ctx)
string m_AnimationPhaseTriggered
void DeferredEnableTrigger()
string m_InfoDamageManipulation
bool m_WasActivatedOrDeactivated
DEPRECATED Used for explosive traps to prevent detonation after destroying through disarm action.
ref array< int > m_ClothingDmg
TrapTrigger GetTrapTrigger()
enum SoundTypeTrap SPAWN_FLAGS
void PlayDeployLoopSound()
void StopDeployLoopSound()
DEPRECATED.
void Synch(EntityAI victim)
keeping "step" here for consistency only
string m_AnimationPhaseGrounded
const float UPDATE_TIMER_INTERVAL
void OnSteppedOut(EntityAI victim)
void RemoveFromObject(EntityAI victim)
void OnSteppedOn(EntityAI victim)
ref EffectSound m_DeployLoopSound
DEPRECATED.
const int DAMAGE_TRIGGER_MINE
EntityAI GetClosestCarWheel(EntityAI victim)
string m_InfoActivationTime
string m_AnimationPhaseSet
void SnapOnObject(EntityAI victim)
void SetInactive(bool stop_timer=true)
void DamageClothing(PlayerBase player)
bool CanBeClapped()
DEPRECATED Set if trap can be disarmed using ActionClapBearTrapWithThisItem.
TrapTrigger m_TrapTrigger
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
void SetDisarmed(bool disarmed)
DEPRECATED.
bool GetDisarmed()
DEPRECATED.
bool IsPlaceableAtPosition(vector position)
void StartActivate(PlayerBase player)
bool m_AddActivationDefect
bool m_AddDeactivationDefect
void StartDeactivate(PlayerBase player)