77 RegisterNetSyncVariableBool(
"m_IsActive");
78 RegisterNetSyncVariableBool(
"m_IsInProgress");
79 RegisterNetSyncVariableBoolSignal(
"m_FallTriggered");
92 super.OnVariablesSynchronized();
94 if (
g_Game.IsMultiplayer())
111 super.EEDelete(parent);
122 super.OnStoreSave(ctx);
131 if ( !super.OnStoreLoad(ctx, version) )
134 bool b_is_active =
false;
135 if ( !ctx.
Read( b_is_active ) )
138 bool b_is_in_progress =
false;
139 if ( !ctx.
Read( b_is_in_progress ) )
140 b_is_in_progress =
false;
147 if (b_is_in_progress && !b_is_active)
183 if ( GetHierarchyRootPlayer() != null && GetHierarchyRootPlayer().GetEntityInHands() ==
this )
187 vector player_pos = player.GetPosition();
188 vector aim_pos = player.GetAimPosition();
217 g_Game.RPCSingleParam(
this,
ERPCs.RPC_TRAP_DISARM, null,
true);
248 else if (victim.IsInherited(
ItemBase))
251 float damage_coef = 1;
253 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
255 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity();
262 g_Game.GetInventoryItemSize(victim_item, item_size_x, item_size_y);
264 float add_damage = 300 * damage_coef /
Math.
Clamp(item_size_x * item_size_y, 1,
int.
MAX);
265 victim_item.DecreaseHealth(
"",
"", add_damage);
294 if (victim && !victim.GetAllowDamage())
297 Param1<EntityAI> p =
new Param1<EntityAI>(victim);
298 g_Game.RPCSingleParam(
this,
ERPCs.RPC_TRAP_VICTIM, p,
true);
306 super.OnRPC(sender, rpc_type, ctx);
308 if ( !
g_Game.IsDedicatedServer() )
312 case ERPCs.RPC_TRAP_VICTIM:
313 Param1<EntityAI> victim =
new Param1<EntityAI>(null);
315 if (ctx.
Read(victim))
323 case ERPCs.RPC_TRAP_DISARM:
382 if (GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this))
393 player.LocalDropEntity(
this);
395 vector trapPos = player.GetDirection() * 1.5;
442 HideSelection(
"safety_pin");
478 vector mins =
"-0.01 -0.05 -0.01";
479 vector maxs =
"0.01 0.5 0.01";
504 super.OnItemLocationChanged(old_owner, new_owner);
511 if (old_owner == NULL && new_owner != NULL &&
IsActive())
514 if ( new_owner.IsPlayer() )
518 else if (new_owner.GetHierarchyRootPlayer())
529 super.EEItemAttached(item, slot_name);
537 super.EEItemDetached(item, slot_name);
558 if ( !super.CanPutInCargo(parent) )
568 if ( !super.CanPutIntoHands( parent ) )
641 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId,
slotName);
649 if (wheelEntity && wheelEntity.IsInherited(
CarWheel))
651 vector entPosXZ = wheelEntity.GetPosition();
668 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"LEGS")));
669 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BACK")));
670 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"VEST")));
671 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"HeadGear")));
672 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"Mask")));
673 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BODY")));
674 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"FEET")));
675 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"GLOVES")));
678 for (
int i = 0; i < equippedClothes.Count(); i++)
681 if (equippedClothes[i] == null)
ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap()
void OnItemLocationChanged(ItemBase item)
void AddAction(typename actionName)
override void EEItemDetached(EntityAI item, string slot_name)
override void OnItemFallRebuilding()
@Note for modders: This method and is subject to change!
override void EEItemAttached(EntityAI item, string slot_name)
void OnRPC(PlayerIdentity sender, int rpcType, ParamsReadContext ctx)
const int ECE_CREATEPHYSICS
PlayerSpawnPreset slotName
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
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)
override void EOnContact(IEntity other, Contact extra)
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 RemoveFromObject(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)
Super root of all classes in Enforce script.
do not process rotations !
Wrapper class for managing sound through SEffectManager.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
The class that will be instanced (moddable)
proto bool Write(void value_out)
proto bool Read(void value_in)
override void OnSteppedOn(EntityAI victim)
override void CreateTrigger()
override void OnActivate()
override void OnTriggeredByFallEffectsClient()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override bool CanBeDisarmed()
override void SetActions()
override void OnSteppedOut(EntityAI victim)
override void OnTriggeredByFall(Contact extra)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto native void SetPosition(vector position)
Set the world position of the Effect.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float SqrFloat(float f)
Returns squared value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
vector GetPosition()
Get the world position of the Effect.