Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
trapspawnbase.c
Go to the documentation of this file.
1class TrapSpawnBase extends ItemBase
2{
4 bool m_CanCatch = false;
5
6 //configurable stuff
16
17 //derived stuff
18 private int m_InitWaitTime;
20 private int m_ElapsedTime;
21 private int m_ActivationTime;
22 private int m_RollSuccessTime;
24 private float m_CurrentlyUsedDelta;
25 private bool m_IsCatchSuccessful;
26 private int m_CatchEnviroMask = 0;
27 private int m_YieldItemIdxLocal = -1;
28 private int m_YieldItemIdx = -1;
29 private int m_CatchParticleEffecterId = -1;
30
31 vector m_PreyPos; // The position where prey will be spawned -> Will be overriden later
32
33 protected bool m_IsActive;
34 protected bool m_IsPastWaitingTime;
35 protected bool m_IsDeployed;
36
37 ref Timer m_Timer;
38
42
44
46
47 #ifdef DEVELOPER
48 int m_dbgAttemptCount = 0;
49 #endif
50
52 {
54
55 RegisterNetSyncVariableBool("m_IsActive");
56 RegisterNetSyncVariableBool("m_IsDeployed");
57 RegisterNetSyncVariableInt("m_YieldItemIdx");
58
59 //DEPRECATED stuff below, legacy reasons only
60 m_CatchesPond = new multiMap<string, float>; //yields now in WorldData.InitYieldBank
61 m_CatchesSea = new multiMap<string, float>; //yields now in WorldData.InitYieldBank
62 m_CatchesGroundAnimal = new multiMap<string, float>; //yields now in WorldData.InitYieldBank
63 }
64
66 {
67 if (m_Timer)
68 {
69 m_Timer.Stop();
70 delete m_Timer;
71 }
72
74 }
75
98
99 override void OnStoreSave( ParamsWriteContext ctx )
100 {
101 super.OnStoreSave( ctx );
102
103 ctx.Write( m_IsActive );
104
105 ctx.Write( m_IsDeployed );
106
108 }
109
110 override bool OnStoreLoad( ParamsReadContext ctx, int version )
111 {
112 if ( !super.OnStoreLoad(ctx, version) )
113 return false;
114
115 m_IsStoreLoad = true;
116
117 bool b_is_active = false;
118 if ( !ctx.Read( b_is_active ) )
119 b_is_active = false;
120
121 bool b_is_in_progress = false;
122 if (version < 139)
123 {
124 if ( !ctx.Read( b_is_in_progress ) )
125 b_is_in_progress = false;
126 }
127
128 bool b_is_deployed = false;
129 if ( !ctx.Read( b_is_deployed ) )
130 b_is_deployed = false;
131
132 if (version >= 139)
133 {
134 int enviroMask;
135 if (ctx.Read(enviroMask))
136 m_CatchEnviroMask = enviroMask;
137 }
138
139 if (b_is_active)
140 {
142 SetActive();
143 }
144
145 SetDeployed( b_is_deployed );
146
147 m_IsStoreLoad = false;
148 return true;
149 }
150
153 {
154 super.OnVariablesSynchronized();
155
157 {
159 if (m_YieldItemIdxLocal != -1)
161 }
162 }
163
164 bool IsActive()
165 {
166 return m_IsActive;
167 }
168
170 {
171 return m_IsDeployed;
172 }
173
174 void SetDeployed( bool newState )
175 {
176 m_IsDeployed = newState;
177
178 if ( newState == true )
179 {
181 {
182 SetAnimationPhase( m_AnimationPhaseSet, 1 );
183 SetAnimationPhase( m_AnimationPhaseTriggered, 0 );
184 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
185 }
186 }
187 else
188 {
190 {
191 SetAnimationPhase( m_AnimationPhaseSet, 0 );
192 SetAnimationPhase( m_AnimationPhaseTriggered, 1 );
193 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
194 }
195 }
196
197 SetSynchDirty();
198 }
199
200 override bool IsTakeable()
201 {
202 return true;
203 }
204
206 {
207 string surface_type;
208 g_Game.SurfaceGetType3D( position[0], position[1], position[2], surface_type);
209
210 // check surface
211 return g_Game.IsSurfaceDigable(surface_type);
212 }
213
215 {
216 if ( g_Game.IsServer() )
217 {
218 if ( GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity( this ) )
219 {
220 SetupTrapPlayer( PlayerBase.Cast( GetHierarchyRootPlayer() ) );
221 }
222 }
223 }
224
225 void SetupTrapPlayer( PlayerBase player, bool set_position = true )
226 {
227 if ( g_Game.IsServer() )
228 {
229 if ( set_position )
230 {
231 vector trapPos = player.GetPosition() + ( player.GetDirection() * 0.5 );
232 trapPos[1] = g_Game.SurfaceRoadY( trapPos[0], trapPos[2] );
233 SetPosition( trapPos );
234 }
235
236 SetDeployed( true );
237 }
238 }
239
241 {
243 if (MemoryPointExists("Prey_Position"))
244 m_PreyPos = ModelToWorld(GetMemoryPointPos("Prey_Position"));
245 }
246
247 void Fold()
248 {
249 if ( g_Game.IsServer() && m_IsFoldable == true )
250 {
251 SetInactive();
252 }
253 }
254
255 // Deal damage to trap on specific events
257 {
258 if ( g_Game.IsServer() )
259 {
260 DecreaseHealth( "", "", m_DefectRate );
261 }
262 }
263
264 void StartActivate( PlayerBase player ) { }
265
266 // IsTakeable is used to hide tooltips as well, so we use a custom method instead
267 // Used to prevent players from taking traps which should be set for catching
269 {
270 if ( !IsDeployed() || ( GetInventory().AttachmentCount() == 0 && IsDeployed() ) )
271 {
272 return true;
273 }
274
275 return false;
276 }
277
278 override bool CanPutInCargo( EntityAI parent )
279 {
280 super.CanPutInCargo( parent );
281 return CanBeTaken();
282 }
283
284 override bool CanPutIntoHands( EntityAI parent )
285 {
286 super.CanPutIntoHands( parent );
287 return CanBeTaken();
288 }
289
291 {
292 m_ActivationTime = g_Game.GetTickTime();
293 m_ElapsedTime = 0;
295
296 #ifdef DEVELOPER
297 m_dbgAttemptCount = 0;
298 #endif
299 }
300
314
316 void RunTrappingTimer(float duration, string fnName)
317 {
318 if (!m_Timer)
320 else
321 m_Timer.Stop();
322
323 #ifdef DEVELOPER
324 if (IsCLIParam("trapsQuick"))
325 {
327 m_Timer.Run(1, this, fnName);
328 }
329 else
330 #endif
331 {
332 m_CurrentlyUsedDelta = duration;
333 m_Timer.Run(duration, this, fnName);
334 }
335 }
336
337 // Set animation phases according to state
339 {
341
342 if ( g_Game.IsServer() && !IsActive() )
343 {
344 SetCatchSuccessful(false);
345 m_IsActive = true;
346 m_IsPastWaitingTime = false;
347 m_YieldItemIdx = -1;
348
352
353 SetSynchDirty();
354
356 {
357 SetAnimationPhase( m_AnimationPhaseSet, 1 );
358 SetAnimationPhase( m_AnimationPhaseTriggered, 0 );
359 SetAnimationPhase( m_AnimationPhaseUsed, 1 );
360 }
361
364 if (!m_IsStoreLoad) //presumably activated by the player, store load initializes component separately
365 {
368
371 }
372 else //presumed store load
373 {
375
376 RunTrappingTimer(m_UpdateWaitTime,"EvaluateCatch");
378 }
379 }
380 }
381
383 {
384 if ( g_Game.IsServer() )
385 {
386 // We stop timers as the trap is no longer active, then update visuals
387 m_IsActive = false;
388
390
391 if ( m_Timer )
392 {
393 m_Timer.Stop();
394 }
395
396 m_IsPastWaitingTime = false;
397
398 SetDeployed( false );
399
400 SetSynchDirty();
401 }
402 }
403
404 void SetUsed()
405 {
406 if ( g_Game.IsServer() )
407 {
408 // We updated state, visuals and stop timers
409 m_IsActive = false;
410 m_IsDeployed = false;
411
412 // Deal damage to trap
413 AddDefect();
416
418
419 if ( m_Timer )
420 {
421 m_Timer.Stop();
422 }
423
424 m_IsPastWaitingTime = false;
425
427 {
428 SetAnimationPhase( m_AnimationPhaseSet, 1 );
429 SetAnimationPhase( m_AnimationPhaseTriggered, 1 );
430 SetAnimationPhase( m_AnimationPhaseUsed, 0 );
431 }
432
433 m_CatchingContext = null;
434
435 SetSynchDirty();
436 }
437 }
438
440 {
442
443 #ifdef DEVELOPER
444 if (IsCLIParam("catchingLogs"))
445 {
446 Print("dbgTrapz | delta: " + m_CurrentlyUsedDelta);
447 Print("dbgTrapz | m_ElapsedTime: " + m_ElapsedTime);
448 Print("dbgTrapz | m_AdjustedMaxActiveTime: " + m_AdjustedMaxActiveTime);
449 }
450 #endif
451 }
452
454 {
456 {
457 float time = m_ElapsedTime - m_RollSuccessTime;
458 float timeLimit = m_AdjustedMaxActiveTime - m_RollSuccessTime;
459 time = Math.InverseLerp(0,timeLimit,time);
460 time = Easing.EaseInQuad(time);
463
464 #ifdef DEVELOPER
465 if (IsCLIParam("catchingLogs"))
466 {
467 Print("dbgTrapz | adjusted distance: " + m_CurrentMinimalDistance + "/" + m_MinimalDistanceFromPlayersToCatch + " | LERP progress: " + time);
468 }
469 #endif
470 }
471 }
472
474 {
475 #ifdef DEVELOPER
476 m_dbgAttemptCount++;
477 #endif
478
479 m_IsPastWaitingTime = true;
481
482 #ifdef DEVELOPER
483 if (IsCLIParam("catchingLogs"))
484 {
485 Print("dbgTrapz | m_dbgAttemptCount: " + m_dbgAttemptCount + "/" + (m_MaxActiveTime/m_UpdateWaitTime));
486 }
487 #endif
488
489 bool success = false;
491
492 if (m_CanCatch)
493 {
494 if (m_CatchingContext.RollCatch())
495 {
496 success = true;
497
498 #ifdef DEVELOPER
499 if (IsCLIParam("catchingLogs"))
500 {
501 Print("dbgTrapz | success!!!");
502 Print("---------------------");
503 }
504 #endif
505 }
506 }
507
508 #ifdef DEVELOPER
509 string dbgSuccessOverride;
510 if (GetCLIParam("trapsSuccessOverride",dbgSuccessOverride))
511 {
512 if (dbgSuccessOverride == "true" || dbgSuccessOverride.ToInt() == 1)
513 success = true;
514 else if (dbgSuccessOverride == "false" || dbgSuccessOverride.ToInt() == 0)
515 success = false;
516 }
517 #endif
518
519 m_Timer.Stop();
520
521 #ifdef DEVELOPER
522 if (m_ElapsedTime >= m_AdjustedMaxActiveTime || (IsCLIParam("trapsQuick") && !success))
523 #else
525 #endif
526 {
527 SetUsed();
528 return;
529 }
530
531 if (success)
532 {
536 }
537 else
538 {
539 RunTrappingTimer(m_UpdateWaitTime,"EvaluateCatch");
540 }
541 }
542
544 {
545 if (!GetCEApi())
546 {
547 Debug.Log("CE not enabled, player avoidance not available!");
548 return false;
549 }
550
551 return !GetCEApi().AvoidPlayer(GetPosition(), m_CurrentMinimalDistance);
552 }
553
555 {
558
559 #ifdef DEVELOPER
560 if (IsCLIParam("trapsQuick") || m_CurrentMinimalDistance <= 0 || !IsPlayerInVicinity())
561 #else
563 #endif
564 {
565 SpawnCatch();
566 }
568 {
570 }
571 }
572
573 // Actually spawns the prey
575 {
576 // Only server side, let's make sure
577 if (g_Game.IsMultiplayer() && g_Game.IsClient())
578 return;
579
581
582 ItemBase catch;
583 if (m_CanCatch)
584 {
585 catch = ItemBase.Cast(m_CatchingContext.SpawnAndSetupCatch(m_YieldItemIdx,m_PreyPos));
586
588 SetCatchSuccessful(catch != null);
589 // We change the trap state and visuals
590 SetUsed();
591 }
592
593 SetSynchDirty();
594 }
595
596 void SetCatchSuccessful(bool successful)
597 {
598 m_IsCatchSuccessful = successful;
599 }
600
605
607 {
608 UpdatePreyPos(); //previously set on server only
609
611 }
612
613 protected void PlayCatchEffectsServer()
614 {
615 if (m_YieldItemIdx == -1)
616 return;
617
618 YieldItemBase yItem = g_Game.GetMission().GetWorldData().GetCatchYieldBank().GetYieldItemByIdx(m_YieldItemIdx);
619
620 PlayCatchNoise(yItem);
622 }
623
624 protected void PlayCatchEffectsClient()
625 {
626 if (m_YieldItemIdx == -1)
627 return;
628
629 YieldItemBase yItem = g_Game.GetMission().GetWorldData().GetCatchYieldBank().GetYieldItemByIdx(m_YieldItemIdx);
630 PlayCatchSound(yItem);
631 }
632
633 protected void PlayCatchSound(YieldItemBase yItem)
634 {
635 if (yItem.GetCatchDeathSoundset() != "")
637 }
638
639 protected void PlayCatchNoise(YieldItemBase yItem)
640 {
641 string noiseType = yItem.GetCatchAINoise();
642 if (noiseType == "")
643 return;
644
646 m_NoisePar.Load(noiseType);
647 float noiseMultiplier = yItem.GetCatchAINoiseBaseStrength();
648 noiseMultiplier *= NoiseAIEvaluate.GetNoiseReduction(g_Game.GetWeather());
649 g_Game.GetNoiseSystem().AddNoiseTarget(m_PreyPos, 5, m_NoisePar, noiseMultiplier);
650 }
651
653 {
654 int particleId = yItem.GetCatchParticleID();
655 if (particleId == ParticleList.INVALID)
656 return;
657
659 {
661 }
662 else
663 {
664 SEffectManager.ReinitParticleServer(m_CatchParticleEffecterId, new ParticleEffecterParameters("ParticleEffecter", 5, particleId)); //reinit here, since particleId might differ
666 }
667 }
668
669 //Pre-roll validation, bait compatibility handled between YieldItems and bait type
670 bool SetCanCatch( out EntityAI bait )
671 {
672 return m_CatchingContext.IsValid();
673 }
674
675 override void OnItemLocationChanged( EntityAI old_owner, EntityAI new_owner )
676 {
677 super.OnItemLocationChanged( old_owner, new_owner );
678
679 if ( g_Game.IsServer() )
680 {
681 // throw trap from vicinity if the trap does not need installation ( action required )
682 if ( new_owner == NULL && m_NeedInstalation == false )
683 {
684 SetActive();
685 }
686 else if ( old_owner == NULL && new_owner != NULL )
687 {
688 if ( m_IsFoldable )
689 {
690 Fold();
691 }
692 else
693 {
694 SetInactive();
695 }
696 }
697
698 if (m_YieldItemIdx != -1) //resets sound effect idx
699 {
700 m_YieldItemIdx = -1;
701 SetSynchDirty();
702 }
703 }
704 }
705
706 // Generic water check, no real distinction between pond or sea
707 bool IsSurfaceWater(vector position)
708 {
709 string surfaceType;
710 g_Game.SurfaceGetType3D(position[0], position[1], position[2], surfaceType);
711
712 return Surface.AllowedWaterSurface(position[1] + 0.1, surfaceType, m_PlaceableWaterSurfaceList);
713 }
714
715 // Can only receive attachment if deployed
716 override bool CanDisplayAttachmentSlot( int slot_id )
717 {
718 super.CanDisplayAttachmentSlot( slot_id );
719 return IsDeployed();
720 }
721
722 override bool CanReceiveAttachment( EntityAI attachment, int slotId )
723 {
724 super.CanReceiveAttachment( attachment, slotId );
725 return IsDeployed();
726 }
727
728 override void EEItemAttached( EntityAI item, string slot_name )
729 {
730 super.EEItemAttached( item, slot_name );
731
732 if (IsActive() && g_Game.IsServer())
733 {
735 m_CatchingContext.UpdateDataAndMasks();
736 m_CatchingContext.GenerateResult();
738 }
739 }
740
741 override void EEItemDetached(EntityAI item, string slot_name)
742 {
743 super.EEItemDetached( item, slot_name );
744
745 if (IsActive() && g_Game.IsServer())
746 {
748 m_CatchingContext.UpdateDataAndMasks();
749 m_CatchingContext.GenerateResult();
751 }
752 }
753
755
757 {
759 delete m_CatchingContext;
760 }
761
763 {
764 m_CatchEnviroMask = m_CatchingContext.UpdateTrapEnviroMask();
765 }
766
767 void SetTrapEnviroMask(int value)
768 {
769 m_CatchingContext.SetTrapEnviroMask(value);
770 }
771
773 {
775 {
777 m_CatchingContext.RemoveBait();
778 else
780 }
781 }
782
785 {
786 int count = GetInventory().AttachmentCount();
787 if (count > 0)
788 {
789 EntityAI att;
790 for (int i = 0; i < count; i++)
791 {
792 att = GetInventory().GetAttachmentFromIndex(i);
793 GetInventory().DropEntity(InventoryMode.SERVER,this,att);
794 }
795 }
796 }
797
798 //================================================================
799 // ADVANCED PLACEMENT
800 //================================================================
801
802 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
803 {
804 super.OnPlacementComplete(player, position, orientation);
805
806 if (g_Game.IsServer())
807 {
808 vector rotation_matrix[3];
809 float direction[4];
810 Math3D.YawPitchRollMatrix(orientation, rotation_matrix);
811 Math3D.MatrixToQuat(rotation_matrix, direction);
813 InventoryLocation destination = new InventoryLocation;
814
815 if (GetInventory().GetCurrentInventoryLocation(source))
816 {
817 destination.SetGroundEx(this, position, direction);
818 if (g_Game.IsMultiplayer())
819 {
820 player.ServerTakeToDst(source, destination);
821 SetupTrapPlayer(PlayerBase.Cast(player), false);
822 }
823 else // singleplayer
824 {
825 PlayerBase.Cast(player).GetDayZPlayerInventory().RedirectToHandEvent(InventoryMode.LOCAL, source, destination);
826 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SetupTrapPlayer, 100, false, PlayerBase.Cast(player), false);
827 }
828 }
829
832 SetActive();
833 }
834 }
835
836
838 {
839 if ( g_Game.IsServer() )
840 {
842 GetInventory().GetCurrentInventoryLocation(loc);
843 if (loc.GetType() == InventoryLocationType.HANDS)
844 {
845 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
846
847 vector player_pos = player.GetPosition();
848 vector aim_pos = player.GetAimPosition();
849
850 if ( vector.DistanceSq(player_pos, aim_pos) <= ( 1.5 * 1.5 ) )
851 {
852 return IsPlaceableAtPosition( aim_pos );
853 }
854 }
855 }
856
857 return false;
858 }
859
860 override bool CanBePlaced( Man player, vector position )
861 {
862 return IsPlaceableAtPosition(position);
863 }
864
865 // We add the action to deploy a trap laid on ground
866 override void SetActions()
867 {
868 super.SetActions();
869
872 }
873
874 // ===============================================================
875 // ===================== DEPRECATED ============================
876 // ===============================================================
877
878 const string m_PlaceableWaterType
879
886 protected bool m_IsInProgress;
887 protected ref EffectSound m_DeployLoopSound;
888 protected EntityAI m_Bait;
892
894 ref multiMap<string, float> m_CatchesPond;
895 ref multiMap<string, float> m_CatchesSea;
896 ref multiMap<string, float> m_CatchesGroundAnimal;
897
901 void AlignCatch(ItemBase obj, string catch_name);
906 // ===============================================================
907}
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
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.
Definition debug.c:2
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.
Definition debug.c:182
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition easing.c:3
static float EaseInQuad(float t)
Definition easing.c:19
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
InventoryLocation.
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_BaitCatchProb
float m_DefectRate
Normalized bait qty reduction on unsuccessful catch.
bool m_CanCatch
ref Timer m_AlignCatchTimer
DEPRECATED, no reason to keep the information as member.
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
int m_CatchEnviroMask
bool m_IsCatchSuccessful
float m_CurrentlyUsedDelta
ref array< string > m_PlaceableWaterSurfaceList
void SetInactive()
bool CanPutInInventory(EntityAI player)
DEPRECATED.
bool CanBeTaken()
bool m_BaitNeeded
DEPRECATED.
bool SetCanCatch(out EntityAI bait)
void ResetActiveProgress()
float m_FinalCatchProb
DEPRECATED.
override void OnStoreSave(ParamsWriteContext ctx)
int m_UpdateWaitTime
ref multiMap< string, float > m_CatchesPond
DEPRECATED.
void InitTrapValues()
int m_YieldItemIdx
void EvaluateCatch()
EntityAI m_Bait
DEPRECATED.
bool m_IsFoldable
void PlayCatchEffectsServer()
void UpdateTrapEnviroMask()
void UpdatePreyPos()
void PlayDeployLoopSound()
void StopDeployLoopSound()
DEPRECATED.
void AdjustDetectionRange()
override bool CanPutInCargo(EntityAI parent)
override bool CanBePlaced(Man player, vector position)
void HandleBaitLoss()
int m_YieldItemIdxLocal
void AddDefect()
void RunTrappingTimer(float duration, string fnName)
generic trapping launcher for traps, use this to store delta info
int m_InitWaitTimeMax
void SetActive()
int m_ActivationTime
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
void ClearCatchingComponent()
ref multiMap< string, float > m_CatchesGroundAnimal
DEPRECATED.
void SetupTrap()
bool IsPlayerInVicinity()
ref EffectSound m_DeployLoopSound
DEPRECATED.
Definition barbedwire.c:413
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)
bool m_NeedInstalation
int m_InitWaitTimeMin
void Fold(bool keep_connected=false)
Definition spotlight.c:238
void PlayCatchParticleSynced(YieldItemBase yItem)
string m_AnimationPhaseSet
bool m_IsInProgress
DEPRECATED.
bool m_IsUsable
DEPRECATED.
string m_InfoSetup
DEPRECATED.
bool m_IsActive
override bool CanPutIntoHands(EntityAI parent)
int m_MaxActiveTime
Catch spawn and player check interval (expensive-ish).
int m_SpawnUpdateWaitTime
Catch evaluation interval.
bool IsPlaceable()
void IncreaseElapsedTime()
const string m_PlaceableWaterType ref Timer m_PrevTimer
DEPRECATED.
override bool OnStoreLoad(ParamsReadContext ctx, int version)
int m_InitWaitTime
duh
string m_AnimationPhaseUsed
void PlayCatchEffectsClient()
void SetUsed()
void AlignCatch(ItemBase obj, string catch_name)
DEPRECATED.
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
bool IsSurfaceWater(vector position)
ref CatchingContextTrapsBase m_CatchingContext
void ~TrapSpawnBase()
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.
vector m_PreyPos
float m_MinimalDistanceFromPlayersToCatch
Absolute damage dealt to trap when used.
int m_RollSuccessTime
bool m_IsDeployed
void DetachAllAttachments()
detaches everything on catching end (some slots may not be accessible when folded)
bool IsActive()
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 TrySpawnCatch()
void SetCatchSuccessful(bool successful)
void Fold()
void OnCatchSpawnServer()
ref Timer m_Timer
Definition raycaster.c:5
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 SpawnCatch()
bool m_IsPastWaitingTime
void ResetRunningTimerProgress()
bool IsDeployed()
void TrapSpawnBase()
override void SetActions()
float m_CurrentMinimalDistance
void SetTrapEnviroMask(int value)
Definition enmath.c:7
static float GetNoiseReduction(Weather weather)
static const int INVALID
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)
Definition surface.c:31
override void InitTrapValues()
Definition trap_fishnet.c:3
override void InitCatchingComponent()
override bool IsPlaceableAtPosition(vector position)
const string SEA
const string FRESH
fake
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.
DayZGame g_Game
Definition dayzgame.c:3942
Serializer ParamsReadContext
Definition gameplay.c:15
Serializer ParamsWriteContext
Definition gameplay.c:16
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.
Definition effect.c:463
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].
Definition enmath.c:106
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.
Definition effect.c:473
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.
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
InventoryLocationType
types of Inventory Location
bool m_IsStoreLoad
Definition itembase.c:4966
bool IsActive()
class NoiseSystem NoiseParams()
Definition noise.c:15
void AddDefect()
Definition trapbase.c:396
void SetActive()
Definition trapbase.c:404
void SetInactive(bool stop_timer=true)
Definition trapbase.c:449
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
Definition trapbase.c:378