DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл TrapBase.c

См. исходные тексты.

Перечисления

enum  SoundTypeTrap { ACTIVATING = 5 }
 

Функции

void TrapBase ()
 
void OnUpdate (EntityAI victim)
 
TrapTrigger GetTrapTrigger ()
 
override void OnVariablesSynchronized ()
 this event is called all variables are synchronized on client
 
override void EEDelete (EntityAI parent)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
bool IsActive ()
 
bool IsInactive ()
 
override bool IsTakeable ()
 
bool IsActivable ()
 
bool IsPlaceable ()
 
bool IsPlaceableAtPosition (vector position)
 
void Disarm ()
 
void OnDisarm ()
 also called from RPC on client
 
void SnapOnObject (EntityAI victim)
 
void RemoveFromObject (EntityAI victim)
 
void OnSteppedOn (EntityAI victim)
 
void OnSteppedOut (EntityAI victim)
 
void Synch (EntityAI victim)
 keeping "step" here for consistency only
 
override void OnRPC (PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
 
void RefreshState ()
 
void SetupTrap ()
 
void SetupTrapPlayer (PlayerBase player, bool set_position=true)
 
void AddDefect ()
 
void SetActive ()
 
void OnActivate ()
 
void StartActivate (PlayerBase player)
 
void StartDeactivate (PlayerBase player)
 
void SetInactive (bool stop_timer=true)
 
void CreateTrigger ()
 
void DeleteTrigger ()
 
void DeferredEnableTrigger ()
 
override void OnItemLocationChanged (EntityAI old_owner, EntityAI new_owner)
 
override void EEItemAttached (EntityAI item, string slot_name)
 
override void EEItemDetached (EntityAI item, string slot_name)
 
override void OnPlacementComplete (Man player, vector position="0 0 0", vector orientation="0 0 0")
 
override bool CanPutInCargo (EntityAI parent)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanRemoveFromHands (EntityAI parent)
 
override bool CanBePlaced (Man player, vector position)
 
bool CanBeClapped ()
 DEPRECATED Set if trap can be disarmed using ActionClapBearTrapWithThisItem.
 
bool CanBeDisarmed ()
 
void SetDisarmed (bool disarmed)
 DEPRECATED.
 
bool GetDisarmed ()
 DEPRECATED.
 
override void SetActions ()
 
EntityAI GetClosestCarWheel (EntityAI victim)
 
void DamageClothing (PlayerBase player)
 
void PlayDeployLoopSound ()
 
void StopDeployLoopSound ()
 DEPRECATED.
 

Переменные

enum SoundTypeTrap SPAWN_FLAGS = ECE_LOCAL
 
const int DAMAGE_TRIGGER_MINE = 75
 
const float UPDATE_TIMER_INTERVAL = 0.05
 
float m_InitWaitTime
 
bool m_NeedActivation
 
float m_DefectRate
 
float m_DamagePlayers
 
float m_DamageOthers
 
bool m_AddActivationDefect
 
bool m_AddDeactivationDefect
 
bool m_IsActive
 
bool m_IsInProgress
 
bool m_Disarmed = false
 
bool m_WasActivatedOrDeactivated
 DEPRECATED Used for explosive traps to prevent detonation after destroying through disarm action.
 
string m_AnimationPhaseGrounded
 
string m_AnimationPhaseSet
 
string m_AnimationPhaseTriggered
 
string m_InfoSetup
 
string m_InfoDeactivated
 
string m_InfoDamageManipulation
 
string m_InfoDamage
 
string m_InfoActivationTime
 
ref Timer m_Timer
 
ref Timer m_UpdateTimer
 
TrapTrigger m_TrapTrigger
 
ref array< intm_ClothingDmg
 
ref EffectSound m_DeployLoopSound
 DEPRECATED.
 

Перечисления

◆ SoundTypeTrap

Элементы перечислений
ACTIVATING 
2{
3 ACTIVATING = 5,
4}
@ ACTIVATING
Definition TrapBase.c:3

Функции

◆ AddDefect()

void AddDefect ( )
protected
412 {
413 if ( GetGame().IsServer() )
414 {
415 DecreaseHealth( "", "", m_DefectRate );
416 }
417 }
float m_DefectRate
Definition TrapBase.c:19
proto native CGame GetGame()

Перекрестные ссылки GetGame() и m_DefectRate.

Используется в SetActive(), SetInactive() и ItemBase::SetUsed().

◆ CanBeClapped()

bool CanBeClapped ( )
protected

DEPRECATED Set if trap can be disarmed using ActionClapBearTrapWithThisItem.

594 {
595 return true;
596 }

◆ CanBeDisarmed()

bool CanBeDisarmed ( )
protected
600 {
601 return false;
602 }

◆ CanBePlaced()

override bool CanBePlaced ( Man player,
vector position )
protected
588 {
590 }
bool IsPlaceableAtPosition(vector position)
Definition TrapBase.c:195
Definition EntityAI.c:95

Перекрестные ссылки IsPlaceableAtPosition().

◆ CanPutInCargo()

override bool CanPutInCargo ( EntityAI parent)
protected
563 {
564 if ( !super.CanPutInCargo(parent) )
565 {
566 return false;
567 }
568
569 return IsTakeable();
570 }
override bool IsTakeable()
Definition TrapBase.c:162

Перекрестные ссылки IsTakeable().

◆ CanPutIntoHands()

override bool CanPutIntoHands ( EntityAI parent)
protected
573 {
574 if ( !super.CanPutIntoHands( parent ) )
575 {
576 return false;
577 }
578
579 return IsTakeable();
580 }

Перекрестные ссылки IsTakeable().

◆ CanRemoveFromHands()

override bool CanRemoveFromHands ( EntityAI parent)
protected
583 {
584 return IsTakeable();
585 }

Перекрестные ссылки IsTakeable().

◆ CreateTrigger()

void CreateTrigger ( )
protected
481 {
482 if (Class.CastTo(m_TrapTrigger, GetGame().CreateObjectEx("TrapTrigger", GetPosition(), SPAWN_FLAGS)))
483 {
484 vector mins = "-0.01 -0.05 -0.01";
485 vector maxs = "0.01 0.5 0.01";
486 m_TrapTrigger.SetOrientation(GetOrientation());
490 }
491 }
vector GetOrientation()
Definition AreaDamageManager.c:306
void DeferredEnableTrigger()
Definition TrapBase.c:502
enum SoundTypeTrap SPAWN_FLAGS
TrapTrigger m_TrapTrigger
Definition TrapBase.c:44
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Super root of all classes in Enforce script.
Definition EnScript.c:11
void SetParentObject(TrapBase obj)
Definition TrapTrigger.c:18
void SetExtents(vector mins, vector maxs)
Set the size of the Trigger, avoid using SetCollisionBox directly.
Definition Trigger.c:116
Definition EnConvert.c:106
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

Перекрестные ссылки CALL_CATEGORY_SYSTEM, Class::CastTo(), DeferredEnableTrigger(), GetGame(), GetOrientation(), GetPosition, m_TrapTrigger, Trigger::SetExtents(), TrapTrigger::SetParentObject() и SPAWN_FLAGS.

Используется в InitZoneServer(), ContaminatedArea_Dynamic::InitZoneServer(), HotSpringArea::InitZoneServer(), SpookyArea::InitZoneServer() и VolcanicArea::InitZoneServer().

◆ DamageClothing()

void DamageClothing ( PlayerBase player)
protected
670 {
671 //Array used to find all relevant information about currently equipped clothes
673
674 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("LEGS")));
675 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BACK")));
676 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("VEST")));
677 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("HeadGear")));
678 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("Mask")));
679 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BODY")));
680 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("FEET")));
681 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("GLOVES")));
682
683 //Damage all currently equipped clothes
684 for (int i = 0; i < equippedClothes.Count(); i++)
685 {
686 //If no item is equipped on slot, slot is ignored
687 if (equippedClothes[i] == null)
688 {
689 continue;
690 }
691
692 equippedClothes[i].DecreaseHealth(m_ClothingDmg[i], false);
693 }
694 }
ref array< int > m_ClothingDmg
Definition TrapBase.c:46
Definition DallasMask.c:2

Перекрестные ссылки m_ClothingDmg.

Используется в OnSteppedOn().

◆ DeferredEnableTrigger()

void DeferredEnableTrigger ( )
protected
503 {
504 if (m_TrapTrigger)
506 }
void SetEnabled()
prevents insider adding in the wrong position, HOTFIX
Definition TrapTrigger.c:52

Перекрестные ссылки m_TrapTrigger и TrapTrigger::SetEnabled().

Используется в CreateTrigger().

◆ DeleteTrigger()

void DeleteTrigger ( )
protected
494 {
495 if (m_TrapTrigger)
496 {
498 m_TrapTrigger.DeleteSafe();
499 }
500 }

Перекрестные ссылки m_TrapTrigger и TrapTrigger::SetParentObject().

Используется в EEItemLocationChanged(), SetInactive() и StartDeactivate().

◆ Disarm()

void Disarm ( )
protected
210 {
211 SetInactive(false);
212 RefreshState();
213 GetGame().RPCSingleParam(this, ERPCs.RPC_TRAP_DISARM, null, true);
214
215 OnDisarm();
216 }
ERPCs
Definition ERPCs.c:2
void RefreshState()
Definition TrapBase.c:336
void SetInactive(bool stop_timer=true)
Definition TrapBase.c:464
void OnDisarm()
also called from RPC on client

Перекрестные ссылки GetGame(), TrapBase::OnDisarm(), RefreshState() и SetInactive().

◆ EEDelete()

override void EEDelete ( EntityAI parent)
protected
106 {
107 super.EEDelete(parent);
108
109 if (GetGame() && m_TrapTrigger)
110 {
111 GetGame().ObjectDelete(m_TrapTrigger);
113 }
114 }

Перекрестные ссылки GetGame() и m_TrapTrigger.

◆ EEItemAttached()

override void EEItemAttached ( EntityAI item,
string slot_name )
protected
534 {
535 super.EEItemAttached(item, slot_name);
536
537 if (GetGame().IsServer())
538 RefreshState();
539 }

Перекрестные ссылки GetGame() и RefreshState().

◆ EEItemDetached()

override void EEItemDetached ( EntityAI item,
string slot_name )
protected
542 {
543 super.EEItemDetached(item, slot_name);
544
545 if (GetGame().IsServer())
546 RefreshState();
547 }

Перекрестные ссылки GetGame() и RefreshState().

◆ GetClosestCarWheel()

EntityAI GetClosestCarWheel ( EntityAI victim)
protected

carscript specific handling (not all traps are uses this)

ruined wheel, bail out

ignore all spare wheel

actual, healthy wheel, let it pass

629 {
632 trapPosXZ[1] = 0;
633
634 GameInventory inv = victim.GetInventory();
635 for (int i = 0; i < inv.AttachmentCount(); i++)
636 {
638 EntityAI wheelEntity = inv.GetAttachmentFromIndex(i);
639 if (wheelEntity && wheelEntity.Type() == CarWheel_Ruined)
640 {
641 continue;
642 }
643
645 int slotId;
646 string slotName;
647 wheelEntity.GetInventory().GetCurrentAttachmentSlotInfo(slotId, slotName);
648 slotName.ToLower();
649 if (slotName.Contains("spare"))
650 {
651 continue
652 }
653
655 if (wheelEntity && wheelEntity.IsInherited(CarWheel))
656 {
657 vector entPosXZ = wheelEntity.GetPosition();
658 entPosXZ[1] = 0;
660 {
661 return wheelEntity;
662 }
663 }
664 }
665
666 return null;
667 }
PlayerSpawnPreset slotName
Definition InventoryItem.c:310
Definition InventoryItem.c:413
Definition Building.c:6
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

Перекрестные ссылки vector::Distance(), GetPosition и slotName.

Используется в OnUpdate() и TrapBase::OnUpdate().

◆ GetDisarmed()

bool GetDisarmed ( )
protected

DEPRECATED.

612 {
613 return m_Disarmed;
614 }
bool m_Disarmed
Definition TrapBase.c:28

Перекрестные ссылки m_Disarmed.

◆ GetTrapTrigger()

TrapTrigger GetTrapTrigger ( )
protected
83 {
84 return m_TrapTrigger;
85 }

Перекрестные ссылки m_TrapTrigger.

◆ IsActivable()

bool IsActivable ( )
protected
173 {
174 return !IsActive() && GetHierarchyRootPlayer() == null && GetHierarchyParent() == null && m_IsInProgress == false && !IsRuined() && m_NeedActivation;
175 }
bool m_NeedActivation
Definition TrapBase.c:18
bool m_IsInProgress
Definition TrapBase.c:26
bool IsActive()
Definition TrapBase.c:151

Перекрестные ссылки IsActive(), m_IsInProgress и m_NeedActivation.

◆ IsActive()

bool IsActive ( )
protected
152 {
153 return m_IsActive && m_IsInProgress == false && GetHierarchyRootPlayer() == null;
154 }
bool m_IsActive
Definition TrapBase.c:25

Перекрестные ссылки m_IsActive и m_IsInProgress.

◆ IsInactive()

bool IsInactive ( )
protected
157 {
158 return !IsActive() && m_IsInProgress == false && GetHierarchyRootPlayer() == null;
159 }

Перекрестные ссылки IsActive() и m_IsInProgress.

Используется в RefreshState().

◆ IsPlaceable()

bool IsPlaceable ( )
protected
178 {
179 if ( GetHierarchyRootPlayer() != null && GetHierarchyRootPlayer().GetHumanInventory().GetEntityInHands() == this )
180 {
181 PlayerBase player = PlayerBase.Cast( GetHierarchyRootPlayer() );
182
183 vector player_pos = player.GetPosition();
184 vector aim_pos = player.GetAimPosition();
185
186 if ( vector.DistanceSq( player_pos, aim_pos ) <= ( Math.SqrFloat( 1.5 ) ) )
187 {
189 }
190 }
191
192 return false;
193 }
Definition EnMath.c:7
Definition PlayerBaseClient.c:2
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto float SqrFloat(float f)
Returns squared value.

Перекрестные ссылки vector::DistanceSq(), IsPlaceableAtPosition() и Math::SqrFloat().

◆ IsPlaceableAtPosition()

bool IsPlaceableAtPosition ( vector position)
protected
196 {
197 if ( position[1] < g_Game.SurfaceGetSeaLevelMax() + 0.03 )
198 {
199 return false;
200 }
201 else if ( GetGame().SurfaceIsPond( position[0], position[2] ) )
202 {
203 return false;
204 }
205
206 return true;
207 }
DayZGame g_Game
Definition DayZGame.c:3815

Перекрестные ссылки g_Game и GetGame().

Используется в CanBePlaced() и IsPlaceable().

◆ IsTakeable()

override bool IsTakeable ( )
protected
163 {
164 if ( m_IsInProgress == false && !IsActive() )
165 {
166 return true;
167 }
168
169 return false;
170 }

Перекрестные ссылки IsActive() и m_IsInProgress.

◆ OnActivate()

◆ OnDisarm()

void OnDisarm ( )
protected

also called from RPC on client

◆ OnItemLocationChanged()

override void OnItemLocationChanged ( EntityAI old_owner,
EntityAI new_owner )
protected
509 {
510 super.OnItemLocationChanged(old_owner, new_owner);
511
512 if (GetGame().IsServer())
513 {
514 RefreshState();
515
516 // TAKE ACTIVE TRAP FROM VICINITY
517 if (old_owner == NULL && new_owner != NULL && IsActive())
518 {
519 // TAKE INTO HANDS
520 if ( new_owner.IsPlayer() )
521 {
523 }
524 else if (new_owner.GetHierarchyRootPlayer())
525 {
526 SnapOnObject(new_owner.GetHierarchyRootPlayer());
527 }
528 }
529 }
530
531 }
void SnapOnObject(EntityAI victim)
Definition TrapBase.c:221

Перекрестные ссылки GetGame(), IsActive(), RefreshState() и SnapOnObject().

◆ OnPlacementComplete()

override void OnPlacementComplete ( Man player,
vector position = "0 0 0",
vector orientation = "0 0 0" )
protected
550 {
551 super.OnPlacementComplete(player, position, orientation);
552
553 if (GetGame().IsServer())
554 {
555 SetOrientation(orientation);
557 PlaceOnSurface();
558 SetSynchDirty();
559 }
560 }
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition Effect.c:438

Перекрестные ссылки GetGame() и SetPosition().

◆ OnRPC()

override void OnRPC ( PlayerIdentity sender,
int rpc_type,
ParamsReadContext ctx )
protected
301 {
302 super.OnRPC(sender, rpc_type, ctx);
303
304 if ( !GetGame().IsDedicatedServer() )
305 {
306 switch (rpc_type)
307 {
308 case ERPCs.RPC_TRAP_VICTIM:
310
311 if (ctx.Read(victim))
312 {
313 if (victim.param1)
314 SnapOnObject(victim.param1);
315 }
316
317 break;
318
319 case ERPCs.RPC_TRAP_DISARM:
320 OnDisarm();
321 break;
322
323 case SoundTypeTrap.ACTIVATING:
324
325 Param1<bool> p = new Param1<bool>(false);
326
327 bool isActivating = false;
328 if (ctx.Read(p))
329 isActivating = p.param1;
330
331 break;
332 }
333 }
334 }
SoundTypeTrap
Definition TrapBase.c:2

Перекрестные ссылки GetGame(), TrapBase::OnDisarm() и SnapOnObject().

◆ OnSteppedOn()

void OnSteppedOn ( EntityAI victim)
protected
279 {
280 SetInactive(false);
281 }

Перекрестные ссылки SetInactive().

◆ OnSteppedOut()

void OnSteppedOut ( EntityAI victim)
protected
167 {
168 if (victim.IsInherited(CarScript))
169 {
170 if (m_UpdateTimer && m_UpdateTimer.IsRunning())
171 {
172 m_UpdateTimer.Stop();
173 }
174 }
175 }
ref Timer m_UpdateTimer
Definition RadialMenu.c:20
Definition CivilianSedan.c:2

Перекрестные ссылки m_UpdateTimer.

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext ctx,
int version )
protected
126 {
127 if ( !super.OnStoreLoad(ctx, version) )
128 return false;
129
130 bool b_is_active = false;
131 if ( !ctx.Read( b_is_active ) )
132 b_is_active = false;
133
134 bool b_is_in_progress = false;
135 if ( !ctx.Read( b_is_in_progress ) )
136 b_is_in_progress = false;
137
138 if ( b_is_active )
139 {
140 SetActive();
141 }
142
144 {
146 }
147
148 return true;
149 }
void SetActive()
Definition TrapBase.c:419
void StartActivate(PlayerBase player)
Definition TrapBase.c:443

Перекрестные ссылки SetActive() и StartActivate().

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext ctx)
protected
117 {
118 super.OnStoreSave(ctx);
119
120 ctx.Write(m_IsActive);
121 ctx.Write(m_IsInProgress);
122 }

Перекрестные ссылки m_IsActive и m_IsInProgress.

◆ OnUpdate()

void OnUpdate ( EntityAI victim)
protected
90 {
91 if (victim && victim.IsInherited(CarScript))
92 {
94 if (wheel)
95 {
97 }
98 }
99 }
void OnServerSteppedOn(Object obj, string damageZone)
Definition Trap_LandMine.c:177
EntityAI GetClosestCarWheel(EntityAI victim)
Definition TrapBase.c:628

Перекрестные ссылки GetClosestCarWheel() и TrapBase::OnServerSteppedOn().

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
protected

this event is called all variables are synchronized on client

89 {
90 super.OnVariablesSynchronized();
91
92 if (IsDeploySound())
94
95 if (GetGame().IsMultiplayer())
96 {
98 SetActive();
99
102 }
103 }
void PlayDeploySound()
Definition ItemBase.c:9124
bool IsDeploySound()
Definition ItemBase.c:9098

Перекрестные ссылки GetGame(), IsDeploySound(), m_IsActive, m_IsInProgress, PlayDeploySound(), SetActive() и StartActivate().

◆ PlayDeployLoopSound()

void PlayDeployLoopSound ( )
protected

◆ RefreshState()

void RefreshState ( )
protected
337 {
339 {
340 return;
341 }
342
343 if ( GetGame().IsServer() )
344 {
345 // item is owned by player
346 if ( GetHierarchyRootPlayer() != NULL && m_AnimationPhaseGrounded != "" )
347 {
348 SetAnimationPhase( m_AnimationPhaseSet, 1 );
350 {
351 SetAnimationPhase( m_AnimationPhaseTriggered, 1 );
352 }
353 SetAnimationPhase( m_AnimationPhaseGrounded, 0 );
354 }
355 // item is set active
356 else if ( IsActive() )
357 {
358 if ( m_AnimationPhaseGrounded != "" )
359 {
360 SetAnimationPhase( m_AnimationPhaseGrounded, 1 );
361 }
363 {
364 SetAnimationPhase( m_AnimationPhaseTriggered, 1 );
365 SetAnimationPhase( m_AnimationPhaseSet, 0 );
366 }
367 }
368 // item is inactive and not owned by player (on the ground)
369 else if ( IsInactive() )
370 {
372 {
373 SetAnimationPhase( m_AnimationPhaseGrounded, 1 );
374 }
376 {
377 SetAnimationPhase( m_AnimationPhaseSet, 1 );
378 SetAnimationPhase( m_AnimationPhaseTriggered, 0 );
379 }
380 }
381 }
382 }
string m_AnimationPhaseTriggered
Definition TrapBase.c:34
bool m_WasActivatedOrDeactivated
DEPRECATED Used for explosive traps to prevent detonation after destroying through disarm action.
Definition TrapBase.c:30
string m_AnimationPhaseGrounded
Definition TrapBase.c:32
string m_AnimationPhaseSet
Definition TrapBase.c:33
bool IsInactive()
Definition TrapBase.c:156

Перекрестные ссылки GetGame(), IsActive(), IsInactive(), m_AnimationPhaseGrounded, m_AnimationPhaseSet, m_AnimationPhaseTriggered и m_WasActivatedOrDeactivated.

Используется в Disarm(), EEHealthLevelChanged(), EEItemAttached(), EEItemDetached(), EEItemLocationChanged(), OnItemLocationChanged(), OnStoreLoad(), SetActive(), SetInactive() и SnapOnObject().

◆ RemoveFromObject()

void RemoveFromObject ( EntityAI victim)
protected
274 {
276 }
void OnSteppedOut(EntityAI victim)
Definition Trap_LandMine.c:166

Перекрестные ссылки TrapBase::OnSteppedOut().

◆ SetActions()

override void SetActions ( )
protected
621 {
622 super.SetActions();
623
625 }
ActionActivateTrapCB ActionContinuousBaseCB ActionActivateTrap()
Definition ActionActivateTrap.c:18
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220

Перекрестные ссылки ActionActivateTrap() и AddAction().

◆ SetActive()

void SetActive ( )
protected
420 {
422
423 m_IsInProgress = false;
424 m_IsActive = true;
425
427 {
428 AddDefect();
429 }
430
431 if (GetGame().IsServer())
432 {
434 RefreshState();
435 SetSynchDirty();
436 }
437
438 OnActivate();
439 }
void OnActivate()
Definition Trap_LandMine.c:67
void CreateTrigger()
Definition TrapBase.c:480
void AddDefect()
Definition TrapBase.c:411
bool m_AddActivationDefect
Definition TrapBase.c:23

Перекрестные ссылки AddDefect(), TrapBase::CreateTrigger(), GetGame(), m_AddActivationDefect, m_IsActive, m_IsInProgress, m_WasActivatedOrDeactivated, TrapBase::OnActivate() и RefreshState().

Используется в EEItemLocationChanged(), Icon::Icon(), UniversalTemperatureSourceDebug::Init(), ItemBase::OnItemLocationChanged(), ItemBase::OnPlacementComplete(), OnStoreLoad(), ItemBase::OnStoreLoad(), OnVariablesSynchronized(), HandsContainer::Refresh(), Container::Select(), LayoutHolder::SetFirstActive(), Container::SetNextActive(), AttachmentsGroupContainer::SetNextActive(), LayoutHolder::SetNextActive(), Container::SetPreviousActive(), AttachmentsGroupContainer::SetPreviousActive(), LayoutHolder::SetPreviousActive(), LayoutHolder::SetSameLevelNextActive(), LayoutHolder::SetSameLevelPreviousActive(), TrapSpawnBase::SetupTrap(), SetupTrapPlayer(), SlotsIcon::SlotsIcon(), StartActivate(), RainProcurementComponentBase::StartRainProcurement() и RainProcurementComponentBase::StopRainProcurement().

◆ SetDisarmed()

void SetDisarmed ( bool disarmed)
protected

DEPRECATED.

606 {
608 }

Перекрестные ссылки m_Disarmed.

◆ SetInactive()

void SetInactive ( bool stop_timer = true)
protected
465 {
467
468 m_IsActive = false;
469 if (m_Timer && stop_timer)
470 m_Timer.Stop();
471
473 AddDefect();
474
475 SetSynchDirty();
477 RefreshState();
478 }
void DeleteTrigger()
Definition TrapBase.c:493
ref Timer m_Timer
Definition TrapBase.c:42
bool m_AddDeactivationDefect
Definition TrapBase.c:24

Перекрестные ссылки AddDefect(), DeleteTrigger(), m_AddDeactivationDefect, m_IsActive, m_Timer, m_WasActivatedOrDeactivated и RefreshState().

Используется в Disarm(), TrapBase::EEHealthLevelChanged(), EEItemLocationChanged(), ItemBase::Fold(), ItemBase::OnItemLocationChanged(), TrapBase::OnServerSteppedOn(), OnServerSteppedOn() и OnSteppedOn().

◆ SetupTrap()

void SetupTrap ( )
protected
385 {
386 if (GetGame().IsServer())
387 {
388 if (GetHierarchyRootPlayer() && GetHierarchyRootPlayer().CanDropEntity(this))
389 SetupTrapPlayer(PlayerBase.Cast(GetHierarchyRootPlayer()));
390 }
391 }
void SetupTrapPlayer(PlayerBase player, bool set_position=true)
Definition TrapBase.c:393

Перекрестные ссылки GetGame() и SetupTrapPlayer().

◆ SetupTrapPlayer()

void SetupTrapPlayer ( PlayerBase player,
bool set_position = true )
protected
394 {
395 if (GetGame().IsServer())
396 {
397 if (set_position)
398 {
399 player.LocalDropEntity(this);
400
401 vector trapPos = player.GetDirection() * 1.5;
402 trapPos[1] = 0;
403 SetPosition(player.GetPosition() + trapPos);
404 }
405
406 if (m_NeedActivation == false)
407 SetActive();
408 }
409 }

Перекрестные ссылки GetGame(), m_NeedActivation, SetActive() и SetPosition().

Используется в ItemBase::OnPlacementComplete(), SetupTrap() и ItemBase::SetupTrap().

◆ SnapOnObject()

void SnapOnObject ( EntityAI victim)
protected
222 {
223 if ( GetGame().IsServer() )
224 {
225 if ( m_Timer )
226 {
227 m_Timer.Stop();
228 }
229
230 RefreshState();
231
232 if (m_DamagePlayers > 0)
233 {
234 if (victim)
235 {
236 if ( victim.IsInherited(SurvivorBase))
237 {
238 victim.DecreaseHealth("", "", m_DamagePlayers);
239 }
240 else if (victim.IsInherited(DayZCreatureAI))
241 {
242 victim.DecreaseHealth("", "", m_DamageOthers);
243 }
244 else if (victim.IsInherited(ItemBase))
245 {
247 float damage_coef = 1;
248
249 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
250 {
251 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity(); // Lower quantity increases damage exposure
252 }
253
254 if (damage_coef > 0)
255 {
256 int item_size_x = 1;
257 int item_size_y = 1;
258 GetGame().GetInventoryItemSize(victim_item, item_size_x, item_size_y);
259
260 float add_damage = 300 * damage_coef / Math.Clamp(item_size_x * item_size_y, 1, int.MAX);
261 victim_item.DecreaseHealth("", "", add_damage);
262 }
263 }
264 }
265 }
266
267 Synch(victim);
268 }
269
271 }
const int MAX
Definition EnConvert.c:27
void Synch(EntityAI victim)
keeping "step" here for consistency only
Definition TrapBase.c:286
void OnSteppedOn(EntityAI victim)
Definition TrapBase.c:278
float m_DamagePlayers
Definition TrapBase.c:20
float m_DamageOthers
Definition TrapBase.c:21
do not process rotations !
Definition DayZAnimal.c:612
Definition InventoryItem.c:731
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'.

Перекрестные ссылки Math::Clamp(), GetGame(), m_DamageOthers, m_DamagePlayers, m_Timer, MAX, TrapBase::OnSteppedOn(), RefreshState() и Synch().

Используется в OnItemLocationChanged() и OnRPC().

◆ StartActivate()

void StartActivate ( PlayerBase player)
protected
444 {
445 if (GetGame().IsServer())
446 {
448 HideSelection("safety_pin");
449
450 if (m_InitWaitTime > 0)
451 {
452 m_IsInProgress = true;
453 m_Timer.Run(m_InitWaitTime, this, "SetActive");
454
455 SetSynchDirty();
456 }
457 else
458 SetActive();
459 }
460 }
float m_InitWaitTime
Definition TrapBase.c:17
Definition DayZPlayerImplement.c:63

Перекрестные ссылки CALL_CATEGORY_SYSTEM, GetGame(), m_InitWaitTime, m_IsInProgress, m_Timer и SetActive().

Используется в TrapBase::OnPlacementComplete(), OnPlacementComplete(), OnStoreLoad() и OnVariablesSynchronized().

◆ StartDeactivate()

void StartDeactivate ( PlayerBase player)
protected
219 {
220 super.StartDeactivate(player);
221
224 }
enum eWireMaterial FOLDED
void SetState(int state_ID)
Definition Trap_TripWire.c:181

Перекрестные ссылки DeleteTrigger(), FOLDED и SetState().

Используется в EEKilled() и OnItemLocationChanged().

◆ StopDeployLoopSound()

void StopDeployLoopSound ( )
protected

DEPRECATED.

◆ Synch()

void Synch ( EntityAI victim)
protected

keeping "step" here for consistency only

287 {
288 if (GetGame().IsServer())
289 {
290 if (victim && !victim.GetAllowDamage())
291 return;
292
294 GetGame().RPCSingleParam(this, ERPCs.RPC_TRAP_VICTIM, p, true);
295 }
296
297 }

Перекрестные ссылки GetGame().

Используется в TrapBase::OnServerSteppedOn(), OnServerSteppedOn() и SnapOnObject().

◆ TrapBase()

void TrapBase ( )
protected

timer calling OnUpdate in configured interval

49 {
50 m_IsInProgress = false;
51 m_NeedActivation = true;
52 m_InitWaitTime = 5; //After this time after deployment, the trap is activated
53 m_DefectRate = 15; //Added damage after trap activation
54 m_DamagePlayers = 25; //How much damage player gets when caught
55 m_DamageOthers = 100; //How much damage others gets when caught
56
59
61
65
66 m_InfoSetup = "#STR_TrapBase0";
67 m_InfoDeactivated = "#STR_TrapBase1";
68 m_InfoDamageManipulation = "#STR_TrapBase2";
69 m_InfoDamage = "#STR_TrapBase3";
70 m_InfoActivationTime = "#STR_TrapBase4" + m_InitWaitTime.ToString() + "#STR_TrapBase5";
71
72 m_UpdateTimer = new ref Timer();
73
74 RegisterNetSyncVariableBool("m_IsActive");
75 RegisterNetSyncVariableBool("m_IsInProgress");
76 RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
77 RegisterNetSyncVariableBool("m_IsDeploySound");
78 }
string m_InfoDamageManipulation
Definition TrapBase.c:38
string m_InfoActivationTime
Definition TrapBase.c:40
string m_InfoSetup
Definition TrapBase.c:36
string m_InfoDeactivated
Definition TrapBase.c:37
string m_InfoDamage
Definition TrapBase.c:39
ref Timer m_UpdateTimer
Definition TrapBase.c:43
proto string ToString()

Перекрестные ссылки m_AddActivationDefect, m_AddDeactivationDefect, m_AnimationPhaseGrounded, m_AnimationPhaseSet, m_AnimationPhaseTriggered, m_DamageOthers, m_DamagePlayers, m_DefectRate, m_InfoActivationTime, m_InfoDamage, m_InfoDamageManipulation, m_InfoDeactivated, m_InfoSetup, m_InitWaitTime, m_IsInProgress, m_NeedActivation, m_UpdateTimer, m_WasActivatedOrDeactivated и float::ToString().

Переменные

◆ DAMAGE_TRIGGER_MINE

const int DAMAGE_TRIGGER_MINE = 75
protected

Используется в OnSteppedOn().

◆ m_AddActivationDefect

bool m_AddActivationDefect
protected

Используется в SetActive() и TrapBase().

◆ m_AddDeactivationDefect

bool m_AddDeactivationDefect
protected

Используется в LandMineTrap(), SetInactive() и TrapBase().

◆ m_AnimationPhaseGrounded

string m_AnimationPhaseGrounded
protected

◆ m_AnimationPhaseSet

◆ m_AnimationPhaseTriggered

◆ m_ClothingDmg

ref array<int> m_ClothingDmg
protected

Используется в DamageClothing() и LandMineTrap().

◆ m_DamageOthers

float m_DamageOthers
protected

Используется в TrapBase::BearTrap(), SnapOnObject() и TrapBase().

◆ m_DamagePlayers

float m_DamagePlayers
protected

◆ m_DefectRate

◆ m_DeployLoopSound

ref EffectSound m_DeployLoopSound
protected

DEPRECATED.

◆ m_Disarmed

bool m_Disarmed = false
protected

Используется в GetDisarmed() и SetDisarmed().

◆ m_InfoActivationTime

string m_InfoActivationTime
protected

Используется в LandMineTrap(), TrapBase() и TripwireTrap().

◆ m_InfoDamage

string m_InfoDamage
protected

Используется в TrapBase().

◆ m_InfoDamageManipulation

string m_InfoDamageManipulation
protected

Используется в TrapBase().

◆ m_InfoDeactivated

string m_InfoDeactivated
protected

Используется в TrapBase().

◆ m_InfoSetup

string m_InfoSetup
protected

Используется в TrapBase().

◆ m_InitWaitTime

◆ m_IsActive

bool m_IsActive
protected

◆ m_IsInProgress

◆ m_NeedActivation

bool m_NeedActivation
protected

Используется в IsActivable(), SetupTrapPlayer(), TrapBase() и TripwireTrap().

◆ m_Timer

ref Timer m_Timer
protected

◆ m_TrapTrigger

◆ m_UpdateTimer

ref Timer m_UpdateTimer
protected

◆ m_WasActivatedOrDeactivated

bool m_WasActivatedOrDeactivated
protected

DEPRECATED Used for explosive traps to prevent detonation after destroying through disarm action.

Используется в RefreshState(), SetActive(), SetInactive() и TrapBase().

◆ SPAWN_FLAGS

enum SoundTypeTrap SPAWN_FLAGS = ECE_LOCAL

Используется в CreateTrigger().

◆ UPDATE_TIMER_INTERVAL

const float UPDATE_TIMER_INTERVAL = 0.05
protected

Используется в TrapBase::OnSteppedOn() и OnSteppedOn().