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();
192 if ( position[1] <
g_Game.SurfaceGetSeaLevelMax() + 0.03 )
196 else if (
GetGame().SurfaceIsPond( position[0], position[2] ) )
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();
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);
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();
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 OnVariablesSynchronized()
override void EEItemDetached(EntityAI item, string slot_name)
override void EEItemAttached(EntityAI item, string slot_name)
const int ECE_CREATEPHYSICS
PlayerSpawnPreset slotName
override void EEDelete(EntityAI parent)
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 OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
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)
proto void GetInventoryItemSize(InventoryItem item, out int width, out int height)
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
override ScriptCallQueue GetCallQueue(int call_category)
proto native void ObjectDelete(Object obj)
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 void Call(func fn, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
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 OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override bool CanBeDisarmed()
override void SetActions()
override void OnSteppedOut(EntityAI victim)
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
proto native CGame GetGame()
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'.
class JsonUndergroundAreaTriggerData GetPosition