48 int m_dbgAttemptCount = 0;
55 RegisterNetSyncVariableBool(
"m_IsActive");
56 RegisterNetSyncVariableBool(
"m_IsDeployed");
57 RegisterNetSyncVariableInt(
"m_YieldItemIdx");
101 super.OnStoreSave( ctx );
112 if ( !super.OnStoreLoad(ctx, version) )
117 bool b_is_active =
false;
118 if ( !ctx.
Read( b_is_active ) )
121 bool b_is_in_progress =
false;
124 if ( !ctx.
Read( b_is_in_progress ) )
125 b_is_in_progress =
false;
128 bool b_is_deployed =
false;
129 if ( !ctx.
Read( b_is_deployed ) )
130 b_is_deployed =
false;
135 if (ctx.
Read(enviroMask))
154 super.OnVariablesSynchronized();
178 if ( newState ==
true )
208 g_Game.SurfaceGetType3D( position[0], position[1], position[2], surface_type);
211 return g_Game.IsSurfaceDigable(surface_type);
218 if ( GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(
this ) )
231 vector trapPos = player.GetPosition() + ( player.GetDirection() * 0.5 );
232 trapPos[1] =
g_Game.SurfaceRoadY( trapPos[0], trapPos[2] );
243 if (MemoryPointExists(
"Prey_Position"))
244 m_PreyPos = ModelToWorld(GetMemoryPointPos(
"Prey_Position"));
280 super.CanPutInCargo( parent );
286 super.CanPutIntoHands( parent );
297 m_dbgAttemptCount = 0;
333 m_Timer.Run(duration,
this, fnName);
489 bool success =
false;
501 Print(
"dbgTrapz | success!!!");
502 Print(
"---------------------");
509 string dbgSuccessOverride;
510 if (
GetCLIParam(
"trapsSuccessOverride",dbgSuccessOverride))
512 if (dbgSuccessOverride ==
"true" || dbgSuccessOverride.
ToInt() == 1)
514 else if (dbgSuccessOverride ==
"false" || dbgSuccessOverride.
ToInt() == 0)
547 Debug.
Log(
"CE not enabled, player avoidance not available!");
677 super.OnItemLocationChanged( old_owner, new_owner );
686 else if ( old_owner == NULL && new_owner != NULL )
710 g_Game.SurfaceGetType3D(position[0], position[1], position[2], surfaceType);
718 super.CanDisplayAttachmentSlot( slot_id );
724 super.CanReceiveAttachment( attachment, slotId );
730 super.EEItemAttached( item, slot_name );
743 super.EEItemDetached( item, slot_name );
786 int count = GetInventory().AttachmentCount();
790 for (
int i = 0; i < count; i++)
792 att = GetInventory().GetAttachmentFromIndex(i);
804 super.OnPlacementComplete(player, position, orientation);
808 vector rotation_matrix[3];
815 if (GetInventory().GetCurrentInventoryLocation(source))
817 destination.
SetGroundEx(
this, position, direction);
818 if (
g_Game.IsMultiplayer())
820 player.ServerTakeToDst(source, destination);
825 PlayerBase.Cast(player).GetDayZPlayerInventory().RedirectToHandEvent(
InventoryMode.LOCAL, source, destination);
842 GetInventory().GetCurrentInventoryLocation(loc);
847 vector player_pos = player.GetPosition();
848 vector aim_pos = player.GetAimPosition();
878 const string m_PlaceableWaterType
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap()
ref NoiseParams m_NoisePar
void AddAction(typename actionName)
int UpdateTrapEnviroMask()
void SetTrapEnviroMask(int value)
proto native CEApi GetCEApi()
Get the CE API.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
static float EaseInQuad(float t)
Wrapper class for managing sound through SEffectManager.
proto native int GetType()
returns type of InventoryLocation
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
float m_NoBaitCatchProb
DEPRECATED.
string m_AnimationPhaseTriggered
void SetDeployed(bool newState)
void OnCatchSpawnClient()
float m_DefectRate
Normalized bait qty reduction on unsuccessful catch.
ref Timer m_AlignCatchTimer
DEPRECATED, no reason to keep the information as member.
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
float m_CurrentlyUsedDelta
ref array< string > m_PlaceableWaterSurfaceList
bool CanPutInInventory(EntityAI player)
DEPRECATED.
bool m_BaitNeeded
DEPRECATED.
bool SetCanCatch(out EntityAI bait)
void ResetActiveProgress()
float m_FinalCatchProb
DEPRECATED.
override void OnStoreSave(ParamsWriteContext ctx)
ref multiMap< string, float > m_CatchesPond
DEPRECATED.
EntityAI m_Bait
DEPRECATED.
void PlayCatchEffectsServer()
void UpdateTrapEnviroMask()
void PlayDeployLoopSound()
void StopDeployLoopSound()
DEPRECATED.
void AdjustDetectionRange()
override bool CanPutInCargo(EntityAI parent)
override bool CanBePlaced(Man player, vector position)
void RunTrappingTimer(float duration, string fnName)
generic trapping launcher for traps, use this to store delta info
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
void ClearCatchingComponent()
ref multiMap< string, float > m_CatchesGroundAnimal
DEPRECATED.
bool IsPlayerInVicinity()
ref EffectSound m_DeployLoopSound
DEPRECATED.
int m_AdjustedMaxActiveTime
After this time after deployment, the trap is activated.
void PlayCatchSound(YieldItemBase yItem)
override bool CanDisplayAttachmentSlot(int slot_id)
override void EEItemDetached(EntityAI item, string slot_name)
void Fold(bool keep_connected=false)
void PlayCatchParticleSynced(YieldItemBase yItem)
string m_AnimationPhaseSet
bool m_IsInProgress
DEPRECATED.
bool m_IsUsable
DEPRECATED.
string m_InfoSetup
DEPRECATED.
override bool CanPutIntoHands(EntityAI parent)
int m_MaxActiveTime
Catch spawn and player check interval (expensive-ish).
int m_SpawnUpdateWaitTime
Catch evaluation interval.
void IncreaseElapsedTime()
const string m_PlaceableWaterType ref Timer m_PrevTimer
DEPRECATED.
override bool OnStoreLoad(ParamsReadContext ctx, int version)
string m_AnimationPhaseUsed
void PlayCatchEffectsClient()
void AlignCatch(ItemBase obj, string catch_name)
DEPRECATED.
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
bool IsSurfaceWater(vector position)
ref CatchingContextTrapsBase m_CatchingContext
override bool IsTakeable()
override void EEItemAttached(EntityAI item, string slot_name)
int m_ElapsedTime
Adjusted by init wait time, when appropriate.
ItemBase m_Catch
DEPRECATED.
float m_MinimalDistanceFromPlayersToCatch
Absolute damage dealt to trap when used.
void DetachAllAttachments()
detaches everything on catching end (some slots may not be accessible when folded)
bool IsPlaceableAtPosition(vector position)
void StartActivate(PlayerBase player)
void PlayCatchNoise(YieldItemBase yItem)
override void OnVariablesSynchronized()
this event is called all variables are synchronized on client
void SetCatchSuccessful(bool successful)
void OnCatchSpawnServer()
ref multiMap< string, float > m_CatchesSea
DEPRECATED.
int m_CatchParticleEffecterId
void CatchSetQuant(ItemBase catch)
!DEPRECATED
float m_BaitLossFraction
Max time of trap activity (seconds).
bool m_WaterSurfaceForSetup
DEPRECATED.
void InitCatchingComponent()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void ResetRunningTimerProgress()
override void SetActions()
float m_CurrentMinimalDistance
void SetTrapEnviroMask(int value)
static float GetNoiseReduction(Weather weather)
Manager class for managing Effect (EffectParticle, EffectSound).
static EffectSound PlaySoundEnviroment(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, updating environment variables.
static void ReinitParticleServer(int effecterID, EffecterParameters parameters)
allows re-initializing existing effecter with new parameters (extept m_EffecterType,...
static void DestroyEffecterParticleServer(int effecterID)
static void ReactivateParticleServer(int effecterID)
static int CreateParticleServer(vector pos, EffecterParameters parameters)
returns unique effecter ID
proto bool Write(void value_out)
proto bool Read(void value_in)
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
override void InitTrapValues()
override void InitCatchingComponent()
override bool IsPlaceableAtPosition(vector position)
float GetCatchAINoiseBaseStrength()
string GetCatchDeathSoundset()
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.
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto void Print(void var)
Prints content of variable to console/log.
proto native void SetPosition(vector position)
Set the world position of the Effect.
static proto void MatrixToQuat(vector mat[3], out float d[4])
Converts rotation matrix to quaternion.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
vector GetPosition()
Get the world position of the Effect.
proto native int ToInt()
Converts string to integer.
proto native bool IsCLIParam(string param)
Returns if command line argument is present.
proto bool GetCLIParam(string param, out string val)
Returns command line argument.
InventoryLocationType
types of Inventory Location
class NoiseSystem NoiseParams()
void SetInactive(bool stop_timer=true)
void SetupTrapPlayer(PlayerBase player, bool set_position=true)