7 bool m_CanCatch =
false;
28 const string m_PlaceableWaterType
53 m_UpdateWaitTime = 10;
55 m_NeedInstalation =
true;
58 m_MinimalDistanceFromPlayersToCatch = 0;
61 m_NoBaitCatchProb = 50;
65 m_AnimationPhaseUsed =
"";
69 m_CatchesGroundAnimal = NULL;
75 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
76 RegisterNetSyncVariableBool(
"m_IsDeploySound");
77 RegisterNetSyncVariableBool(
"m_IsActive");
78 RegisterNetSyncVariableBool(
"m_IsDeployed");
88 super.OnStoreSave( ctx );
94 ctx.
Write( m_IsDeployed );
99 if ( !super.OnStoreLoad(ctx, version) )
102 bool b_is_active =
false;
103 if ( !ctx.
Read( b_is_active ) )
106 bool b_is_in_progress =
false;
107 if ( !ctx.
Read( b_is_in_progress ) )
108 b_is_in_progress =
false;
110 bool b_is_deployed =
false;
111 if ( !ctx.
Read( b_is_deployed ) )
112 b_is_deployed =
false;
119 if ( b_is_in_progress && !b_is_active )
124 SetDeployed( b_is_deployed );
132 super.OnVariablesSynchronized();
162 m_IsDeployed = newState;
164 if ( newState ==
true )
170 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
179 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
204 if ( GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this ) )
217 vector trapPos = player.GetPosition() + ( player.GetDirection() * 0.5 );
228 if (
GetGame().IsServer() && m_IsFoldable ==
true )
249 if ( !IsDeployed() || ( GetInventory().AttachmentCount() == 0 && IsDeployed() ) )
259 super.CanPutInCargo( parent );
265 super.CanPutIntoHands( parent );
280 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
302 SetDeployed(
false );
314 m_IsDeployed =
false;
324 SetAnimationPhase( m_AnimationPhaseUsed, 0 );
346 m_CanCatch = SetCanCatch( m_Bait );
352 if ( m_MinimalDistanceFromPlayersToCatch > 0 )
363 m_Timer.Run( m_UpdateWaitTime,
this,
"SpawnCatch" );
371 m_FinalCatchProb = m_BaitCatchProb;
373 m_FinalCatchProb = m_NoBaitCatchProb;
377 if ( MemoryPointExists(
"Prey_Position") )
379 m_PreyPos = ModelToWorld( GetMemoryPointPos(
"Prey_Position") );
388 bait = GetInventory().FindAttachment( slotIdx );
395 if ( !edibleBait.GetFoodStage().IsFoodBurned() && !edibleBait.GetFoodStage().IsFoodRotten() )
412 float item_quantity =
catch.GetQuantityMax() * coef;
413 item_quantity =
Math.
Round(item_quantity);
414 catch.SetQuantity( item_quantity );
420 super.OnItemLocationChanged( old_owner, new_owner );
425 if ( new_owner == NULL && m_NeedInstalation ==
false )
429 else if ( old_owner == NULL && new_owner != NULL )
455 super.CanDisplayAttachmentSlot( slot_id );
461 super.CanReceiveAttachment( attachment, slotId );
467 super.EEItemAttached( item, slot_name );
470 if ( IsDeployed() && slot_name ==
"Trap_Bait" )
482 super.OnPlacementComplete( player, position, orientation );
494 if ( !
GetGame().IsDedicatedServer() )
505 if ( !
GetGame().IsDedicatedServer() )
534 if ( GetHierarchyRootPlayer() != NULL && GetHierarchyRootPlayer().GetHumanInventory().GetEntityInHands() ==
this )
538 vector player_pos = player.GetPosition();
539 vector aim_pos = player.GetAimPosition();
void AddAction(typename actionName)
proto native bool AvoidPlayer(vector vPos, float fDistance)
Check if there is a player within a radius.
proto native CEApi GetCEApi()
Get the CE API.
void SetIsDeploySound(bool is_deploy_sound)
bool CanPlayDeployLoopSound()
string m_AnimationPhaseTriggered
protected ref EffectSound m_DeployLoopSound
void PlayDeployLoopSound()
void StopDeployLoopSound()
string m_AnimationPhaseSet
void SetInactive(bool stop_timer=true)
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
void StartActivate(PlayerBase player)
protected bool m_IsInProgress
class JsonUndergroundAreaTriggerData GetPosition
proto void SurfaceGetType3D(float x, float y, float z, out string type)
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
proto native float SurfaceRoadY(float x, float z)
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.
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
string m_AnimationPhaseTriggered
protected ref EffectSound m_DeployLoopSound
void SetDeployed(bool newState)
protected bool m_IsActive
ref Timer m_AlignCatchTimer
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
bool CanPutInInventory(EntityAI player)
protected bool m_IsDeployed
bool SetCanCatch(out EntityAI bait)
override void OnStoreSave(ParamsWriteContext ctx)
ref multiMap< string, float > m_CatchesPond
const string m_PlaceableWaterType protected ref array< string > m_PlaceableWaterSurfaceList
DEPRECATED.
void PlayDeployLoopSound()
void StopDeployLoopSound()
override bool CanPutInCargo(EntityAI parent)
override bool CanBePlaced(Man player, vector position)
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
ref multiMap< string, float > m_CatchesGroundAnimal
override bool CanDisplayAttachmentSlot(int slot_id)
string m_AnimationPhaseSet
override bool CanPutIntoHands(EntityAI parent)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
string m_AnimationPhaseUsed
void AlignCatch(ItemBase obj, string catch_name)
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
bool IsSurfaceWater(vector position)
override bool IsTakeable()
override void EEItemAttached(EntityAI item, string slot_name)
float m_MinimalDistanceFromPlayersToCatch
bool IsPlaceableAtPosition(vector position)
void StartActivate(PlayerBase player)
override void OnVariablesSynchronized()
this event is called all variables are synchronized on client
protected bool m_IsInProgress
protected EntityAI m_Bait
ref multiMap< string, float > m_CatchesSea
void CatchSetQuant(ItemBase catch)
bool m_WaterSurfaceForSetup
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override void SetActions()
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)
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
override string GetLoopDeploySoundset()
override bool IsPlaceableAtPosition(vector position)
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.
proto native CGame GetGame()
proto native void SetPosition(vector position)
Set the world position of the Effect.
static proto float Round(float f)
Returns mathematical round of value.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].