75 RegisterNetSyncVariableBool(
"m_IsActive");
76 RegisterNetSyncVariableBool(
"m_IsInProgress");
77 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
78 RegisterNetSyncVariableBool(
"m_IsDeploySound");
91 super.OnVariablesSynchronized();
108 if (
GetGame().IsMultiplayer() )
124 super.EEDelete(parent);
136 super.OnStoreSave(ctx);
146 if ( !super.OnStoreLoad(ctx, version) )
149 bool b_is_active =
false;
150 if ( !ctx.
Read( b_is_active ) )
153 bool b_is_in_progress =
false;
154 if ( !ctx.
Read( b_is_in_progress ) )
155 b_is_in_progress =
false;
162 if (b_is_in_progress && !b_is_active)
198 if ( GetHierarchyRootPlayer() != null && GetHierarchyRootPlayer().GetHumanInventory().GetEntityInHands() ==
this )
202 vector player_pos = player.GetPosition();
203 vector aim_pos = player.GetAimPosition();
216 if (
GetGame().SurfaceIsSea( position[0], position[2] ) )
220 else if (
GetGame().SurfaceIsPond( position[0], position[2] ) )
255 if ( victim.IsInherited(SurvivorBase))
263 else if (victim.IsInherited(
ItemBase))
266 float damage_coef = 1;
268 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
270 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity();
279 float add_damage = 300 * damage_coef /
Math.
Clamp(item_size_x * item_size_y, 1,
int.
MAX);
280 victim_item.DecreaseHealth(
"",
"", add_damage);
312 if (victim && !victim.GetAllowDamage())
317 Param1<EntityAI> p =
new Param1<EntityAI>(victim);
326 super.OnRPC(sender, rpc_type, ctx);
328 if ( !
GetGame().IsDedicatedServer() )
332 case ERPCs.RPC_TRAP_VICTIM:
334 ref Param1<EntityAI> p_victim =
new Param1<EntityAI>(NULL);
336 if (ctx.
Read(p_victim))
346 case ERPCs.RPC_TRAP_DISARM:
352 ref Param1<bool> p =
new Param1<bool>(
false);
356 bool play = p.param1;
426 if ( GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this ) )
439 Error(
"Mojmir: TODO");
440 player.LocalDropEntity(
this );
442 vector trapPos = ( player.GetDirection() ) * 1.5;
492 HideSelection(
"safety_pin");
534 vector mins =
"-0.01 -0.05 -0.01";
535 vector maxs =
"0.01 0.5 0.01";
550 super.OnItemLocationChanged(old_owner, new_owner);
557 if (old_owner == NULL && new_owner != NULL &&
IsActive())
560 if ( new_owner.IsPlayer() )
564 else if (new_owner.GetHierarchyRootPlayer())
575 super.EEItemAttached(item, slot_name);
585 super.EEItemDetached(item, slot_name);
595 if ( !super.CanPutInCargo(parent) )
605 if ( !super.CanPutIntoHands( parent ) )
699 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName);
707 if (wheelEntity && wheelEntity.IsInherited(
CarWheel))
709 vector entPosXZ = wheelEntity.GetPosition();
726 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"LEGS")));
727 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BACK")));
728 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"VEST")));
729 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"HeadGear")));
730 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"Mask")));
731 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"BODY")));
732 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"FEET")));
733 equippedClothes.Insert(
ClothingBase.Cast(player.GetItemOnSlot(
"GLOVES")));
736 for (
int i = 0; i < equippedClothes.Count(); i++)
739 if (equippedClothes[i] == null)
void AddAction(typename actionName)
override void EEItemDetached(EntityAI item, string slot_name)
override bool CanPutIntoHands(EntityAI parent)
override void EEItemAttached(EntityAI item, string slot_name)
const int ECE_CREATEPHYSICS
override void EEDelete(EntityAI parent)
override bool IsTakeable()
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
bool CanPlayDeployLoopSound()
override void OnVariablesSynchronized()
void OnStoreSave(ParamsWriteContext ctx)
bool OnStoreLoad(ParamsReadContext ctx, int version)
override bool CanPutInCargo(EntityAI parent)
void OnRPC(float stamina, float stamina_cap, bool cooldown)
deprecated use, StaminaHandler uses SyncJunctures now
string m_AnimationPhaseTriggered
protected ref EffectSound m_DeployLoopSound
protected const float UPDATE_TIMER_INTERVAL
string m_InfoDamageManipulation
bool m_WasActivatedOrDeactivated
DEPRECATED Used for explosive traps to prevent detonation after destroying through disarm action.
enum SoundTypeTrap SPAWN_FLAGS
void PlayDeployLoopSound()
void StopDeployLoopSound()
string m_AnimationPhaseGrounded
override bool CanBePlaced(Man player, vector position)
void RemoveFromObject(EntityAI victim)
protected void Synch(EntityAI victim)
keeping "step" here for consistency only
protected void DamageClothing(PlayerBase player)
protected EntityAI GetClosestCarWheel(EntityAI victim)
string m_InfoActivationTime
string m_AnimationPhaseSet
void SnapOnObject(EntityAI victim)
void SetInactive(bool stop_timer=true)
protected ref array< int > m_ClothingDmg
bool CanBeClapped()
DEPRECATED Set if trap can be disarmed using ActionClapBearTrapWithThisItem.
protected const int DAMAGE_TRIGGER_MINE
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
protected bool m_IsInProgress
bool m_AddDeactivationDefect
protected bool m_Disarmed
override bool CanRemoveFromHands(EntityAI parent)
void StartDeactivate(PlayerBase player)
protected TrapTrigger m_TrapTrigger
class JsonUndergroundAreaTriggerData GetPosition
proto native void ObjectDelete(Object obj)
proto void GetInventoryItemSize(InventoryItem item, out int width, out int height)
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Super root of all classes in Enforce script.
do not process rotations !
Wrapper class for managing sound through SEffectManager.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
void SoundStop()
Stops sound.
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)
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
override void OnSteppedOut(EntityAI victim)
override bool CanBeDisarmed()
override string GetLoopDeploySoundset()
override void OnSteppedOn(EntityAI victim)
override void OnActivate()
override void SetActions()
override void CreateTrigger()
void SetParentObject(TrapBase obj)
void SetExtents(vector mins, vector maxs)
Set the size of the Trigger, avoid using SetCollisionBox directly.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
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 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'.
static proto float SqrFloat(float f)
Returns squared value.
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.