74 RegisterNetSyncVariableBool(
"m_IsActive");
75 RegisterNetSyncVariableBool(
"m_IsInProgress");
88 super.OnVariablesSynchronized();
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().GetHumanInventory().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 (
GetGame().SurfaceIsPond( position[0], position[2] ) )
208 GetGame().RPCSingleParam(
this,
ERPCs.RPC_TRAP_DISARM, null,
true);
231 if ( victim.IsInherited(SurvivorBase))
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 GetGame().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);
270 OnSteppedOut(victim);
285 if (victim && !victim.GetAllowDamage())
288 Param1<EntityAI> p =
new Param1<EntityAI>(victim);
289 GetGame().RPCSingleParam(
this,
ERPCs.RPC_TRAP_VICTIM, p,
true);
297 super.OnRPC(sender, rpc_type, ctx);
299 if ( !
GetGame().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:
320 Param1<bool> p =
new Param1<bool>(
false);
322 bool isActivating =
false;
324 isActivating = p.param1;
383 if (GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this))
394 player.LocalDropEntity(
this);
396 vector trapPos = player.GetDirection() * 1.5;
443 HideSelection(
"safety_pin");
479 vector mins =
"-0.01 -0.05 -0.01";
480 vector maxs =
"0.01 0.5 0.01";
505 super.OnItemLocationChanged(old_owner, new_owner);
512 if (old_owner == NULL && new_owner != NULL &&
IsActive())
515 if ( new_owner.IsPlayer() )
519 else if (new_owner.GetHierarchyRootPlayer())
530 super.EEItemAttached(item, slot_name);
538 super.EEItemDetached(item, slot_name);
546 super.OnPlacementComplete(player, position, orientation);
550 SetOrientation(orientation);
559 if ( !super.CanPutInCargo(parent) )
569 if ( !super.CanPutIntoHands( parent ) )
642 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId,
slotName);
650 if (wheelEntity && wheelEntity.IsInherited(
CarWheel))
652 vector entPosXZ = wheelEntity.GetPosition();
654 if (
vector.Distance(trapPosXZ, entPosXZ) < 1)
669 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"LEGS")));
670 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BACK")));
671 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"VEST")));
672 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"HeadGear")));
673 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"Mask")));
674 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BODY")));
675 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"FEET")));
676 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"GLOVES")));
679 for (
int i = 0; i < equippedClothes.Count(); i++)
682 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)
Serialization general interface. Serializer API works with:
override void OnActivate()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void SetActions()
void SetEnabled()
prevents insider adding in the wrong position, HOTFIX
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)
proto native CGame GetGame()
proto native void SetPosition(vector position)
Set the world position of the Effect.
class JsonUndergroundAreaTriggerData GetPosition
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 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)