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

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

Структуры данных

class  TripwireTrapDeployed
 

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

enum  eWireMaterial { WIRE = 0 , BARBED_WIRE = 1 , ROPE = 2 }
 

Функции

void TripwireTrap ()
 
override void OnVariablesSynchronized ()
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void CreateTrigger ()
 
override void OnSteppedOn (EntityAI victim)
 
override void OnItemLocationChanged (EntityAI old_owner, EntityAI new_owner)
 
override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
 
override void EEHealthLevelChanged (int oldLevel, int newLevel, string zone)
 
override void SetInactive (bool stop_timer=true)
 
void SetState (int state_ID)
 
int GetState ()
 returns one of STATE_...
 
void SetWireType (int wireType)
 
int GetWireType ()
 
override void RefreshState ()
 
override void SetupTrapPlayer (PlayerBase player, bool set_position=true)
 
override void StartDeactivate (PlayerBase player)
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanDisplayAttachmentSlot (int slot_id)
 
override void EEItemAttached (EntityAI item, string slot_name)
 
override void EEItemDetached (EntityAI item, string slot_name)
 
override void EEKilled (Object killer)
 
void FoldTripWire ()
 
override void OnInventoryEnter (Man player)
 
override void OnPlacementComplete (Man player, vector position="0 0 0", vector orientation="0 0 0")
 
override void OnPlacementCancelled (Man player)
 
override bool IsDeployable ()
 
override bool IsTakeable ()
 
override string GetDeploySoundset ()
 
override string GetLoopDeploySoundset ()
 
override void SetActions ()
 
void UpdateProxySelections ()
 

Переменные

enum eWireMaterial FOLDED = 3
 
static const int DEPLOYED = 2
 
static const int TRIGGERED = 1
 
int m_State = FOLDED
 
int m_WireMaterial
 
bool m_ResultOfAdvancedPlacing
 
vector m_TriggerPosition
 
vector m_TriggerOrientation
 

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

◆ eWireMaterial

Элементы перечислений
WIRE 
BARBED_WIRE 
ROPE 
3{
4 WIRE = 0,
5 BARBED_WIRE = 1,
6 ROPE = 2
7}
@ WIRE
Definition Trap_TripWire.c:4
@ ROPE
Definition Trap_TripWire.c:6
@ BARBED_WIRE
Definition Trap_TripWire.c:5

Функции

◆ CanDisplayAttachmentSlot()

override bool CanDisplayAttachmentSlot ( int slot_id)
protected
237 {
238 if ( GetState() != DEPLOYED )
239 return false;
240
241 return super.CanDisplayAttachmentSlot( slot_id );
242 }
int GetState()
returns one of STATE_...
Definition Trap_TripWire.c:186
static const int DEPLOYED
Definition Trap_TripWire.c:13
Definition EntityAI.c:95

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

Используется в Entity::CanDisplayAnyAttachmentSlot().

◆ CanReceiveAttachment()

override bool CanReceiveAttachment ( EntityAI attachment,
int slotId )
protected
228 {
229 if ( GetState() != DEPLOYED )
230 return false;
231
232 return super.CanReceiveAttachment( attachment, slotId );
233 }

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

◆ CreateTrigger()

override void CreateTrigger ( )
protected
71 {
72 m_TrapTrigger = TripWireTrigger.Cast(GetGame().CreateObjectEx("TripWireTrigger", GetPosition(), SPAWN_FLAGS));
73 vector mins = "-0.75 0.3 -0.01";
74 vector maxs = "0.75 0.32 0.01";
75 m_TrapTrigger.SetOrientation(GetOrientation());
78
80 }
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
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
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

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

◆ EEHealthLevelChanged()

override void EEHealthLevelChanged ( int oldLevel,
int newLevel,
string zone )
protected
147 {
148 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
149
150 if (GetGame().IsServer())
151 {
153 {
155 RefreshState();
156 }
157 }
158 }
static const int TRIGGERED
Definition Trap_TripWire.c:14
override void RefreshState()
Definition Trap_TripWire.c:202
void SetState(int state_ID)
Definition Trap_TripWire.c:181
Definition constants.c:638
const int STATE_RUINED
Definition constants.c:807

Перекрестные ссылки GetGame(), RefreshState(), SetState(), GameConstants::STATE_RUINED и TRIGGERED.

◆ EEItemAttached()

override void EEItemAttached ( EntityAI item,
string slot_name )
protected
245 {
246 super.EEItemAttached(item, slot_name);
247
248 SetTakeable(false);
249 }
override void SetTakeable(bool pState)
Definition ItemBase.c:9020

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

◆ EEItemDetached()

override void EEItemDetached ( EntityAI item,
string slot_name )
protected
252 {
253 super.EEItemDetached(item, slot_name);
254
255 SetTakeable(false);
256 }

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

◆ EEItemLocationChanged()

override void EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
protected
122 {
123 super.EEItemLocationChanged(oldLoc, newLoc);
124
126 {
127 if (oldLoc.GetType() == InventoryLocationType.GROUND && newLoc.GetType() == InventoryLocationType.GROUND)
128 {
129 SetActive();
130 m_TrapTrigger.SetPosition(m_TriggerPosition);
131 m_TrapTrigger.SetOrientation(m_TriggerOrientation);
132 }
133
135 }
136
137 if (oldLoc.GetType() == InventoryLocationType.GROUND && newLoc.GetType() == InventoryLocationType.CARGO)
138 {
139 SetInactive();
142 RefreshState();
143 }
144 }
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4
bool m_ResultOfAdvancedPlacing
Definition Trap_TripWire.c:19
enum eWireMaterial FOLDED
override void SetInactive(bool stop_timer=true)
Definition Trap_TripWire.c:160
vector m_TriggerOrientation
Definition Trap_TripWire.c:21
vector m_TriggerPosition
Definition Trap_TripWire.c:20
void SetActive()
Definition TrapBase.c:419
void DeleteTrigger()
Definition TrapBase.c:493

Перекрестные ссылки DeleteTrigger(), FOLDED, m_ResultOfAdvancedPlacing, m_TrapTrigger, m_TriggerOrientation, m_TriggerPosition, RefreshState(), SetActive(), SetInactive() и SetState().

◆ EEKilled()

override void EEKilled ( Object killer)
protected
259 {
260 if (m_TrapTrigger)
261 {
263 }
264
265 super.EEKilled(killer);
266 }
override void StartDeactivate(PlayerBase player)
Definition Trap_TripWire.c:218

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

◆ FoldTripWire()

void FoldTripWire ( )
protected
270 {
271 if ( m_AnimationPhaseGrounded != "" )
272 {
273 SetAnimationPhase( m_AnimationPhaseSet, 1 );
274
276 {
277 SetAnimationPhase( m_AnimationPhaseTriggered, 1 );
278 }
279
280 SetAnimationPhase( m_AnimationPhaseGrounded, 0 );
281 }
282 }
string m_AnimationPhaseTriggered
Definition TrapBase.c:34
string m_AnimationPhaseGrounded
Definition TrapBase.c:32
string m_AnimationPhaseSet
Definition TrapBase.c:33

Перекрестные ссылки m_AnimationPhaseGrounded, m_AnimationPhaseSet и m_AnimationPhaseTriggered.

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

◆ GetDeploySoundset()

override string GetDeploySoundset ( )
protected
384 {
385 return "tripwire_deploy_SoundSet";
386 }

◆ GetLoopDeploySoundset()

override string GetLoopDeploySoundset ( )
protected
389 {
390 return "tripwiretrap_deploy_SoundSet";
391 }

◆ GetState()

◆ GetWireType()

int GetWireType ( )
protected
197 {
198 return m_WireMaterial;
199 }
int m_WireMaterial
Definition Trap_TripWire.c:17

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

◆ IsDeployable()

override bool IsDeployable ( )
protected
373 {
374 return true;
375 }

◆ IsTakeable()

override bool IsTakeable ( )
protected
379 {
380 return GetState() != DEPLOYED || (GetInventory().AttachmentCount() == 0 && GetState() == DEPLOYED);
381 }

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

◆ OnInventoryEnter()

override void OnInventoryEnter ( Man player)
protected
285 {
286 SetState( FOLDED );
287 }

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

◆ OnItemLocationChanged()

override void OnItemLocationChanged ( EntityAI old_owner,
EntityAI new_owner )
protected
110 {
111 super.OnItemLocationChanged(old_owner, new_owner);
112
114 if (player)
115 {
117 return;
118 }
119 }
Definition PlayerBaseClient.c:2

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

◆ OnPlacementCancelled()

override void OnPlacementCancelled ( Man player)
protected
364 {
365 super.OnPlacementCancelled(player);
366
368
370 }

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

◆ OnPlacementComplete()

override void OnPlacementComplete ( Man player,
vector position = "0 0 0",
vector orientation = "0 0 0" )
protected
349 {
350 SetIsPlaceSound(true);
351 if (GetGame().IsServer())
352 {
354
358 }
359
360 super.OnPlacementComplete(player, position, orientation);
361 }
void SetIsPlaceSound(bool is_place_sound)
Definition ItemBase.c:9083

Перекрестные ссылки DEPLOYED, GetGame(), m_ResultOfAdvancedPlacing, m_TriggerOrientation, m_TriggerPosition, SetIsPlaceSound() и SetState().

◆ OnSteppedOn()

override void OnSteppedOn ( EntityAI victim)
protected
83 {
84 if (!victim)
85 {
86 return;
87 }
88
89 if (!victim.GetAllowDamage())
90 {
91 return;
92 }
93
94 // We must deal some damage, here 5 shock as melee damage in order to trigger hit animation
95 if (GetGame().IsServer())
96 {
97 victim.ProcessDirectDamage(DT_CLOSE_COMBAT, this, "", "TripWireHit", "0 0 0", 1);
99 SetInactive(false);
100 }
101
102 // We play the trap trigger sound
103 #ifndef SERVER
104 EffectSound sound = SEffectManager.PlaySound("TripwireTrap_Trigger_SoundSet", GetPosition());
105 sound.SetAutodestroy(true);
106 #endif
107 }
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
Manager class for managing Effect (EffectParticle, EffectSound)
Definition EffectManager.c:6
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.
Definition EffectManager.c:169

Перекрестные ссылки GetGame(), GetPosition, SEffectManager::PlaySound(), SetInactive(), SetState() и TRIGGERED.

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext ctx,
int version )
protected
56 {
57 if ( !super.OnStoreLoad(ctx, version) )
58 return false;
59
60 int state = FOLDED;
61 if ( !ctx.Read( state ) )
62 state = FOLDED;
63
64 SetState( state );
66
67 return true;
68 }

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

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext ctx)
protected
48 {
49 super.OnStoreSave(ctx);
50
51 ctx.Write( m_State );
52 }

Перекрестные ссылки CachedObjectsArrays::ARRAY_INT, m_ModifierList, m_ParamList и m_State.

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
protected
38 {
39 super.OnVariablesSynchronized();
40
41 if ( IsPlaceSound() )
42 {
44 }
45 }
void PlayPlaceSound()
Definition ItemBase.c:9148
bool IsPlaceSound()
Definition ItemBase.c:9088

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

◆ RefreshState()

override void RefreshState ( )
protected
203 {
204 super.RefreshState();
205
206 if (GetState() == FOLDED)
207 {
208 FoldTripWire();
209 }
210 }
void FoldTripWire()
Definition Trap_TripWire.c:269

Перекрестные ссылки FOLDED, FoldTripWire() и GetState().

◆ SetActions()

override void SetActions ( )
protected
394 {
395 super.SetActions();
396
398 AddAction(ActionDeployObject);
399 }
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220
Definition ActionTogglePlaceObject.c:2

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

◆ SetInactive()

override void SetInactive ( bool stop_timer = true)
protected
161 {
162 super.SetInactive(stop_timer);
163
164 // de-attach attachments after "activating them"
165 for (int att = 0; att < GetInventory().AttachmentCount(); att++)
166 {
167 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(att));
168 if (attachment)
169 {
170 if (attachment.IsLockedInSlot())
171 {
172 attachment.UnlockFromParent();
173 }
174
175 attachment.OnActivatedByItem(this);
176 GetInventory().DropEntity(InventoryMode.SERVER, this, attachment);
177 }
178 }
179 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
Definition InventoryItem.c:731

◆ SetState()

void SetState ( int state_ID)
protected
182 {
184 }

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

◆ SetupTrapPlayer()

override void SetupTrapPlayer ( PlayerBase player,
bool set_position = true )
protected
213 {
214 super.SetupTrapPlayer( player, set_position );
216 }

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

◆ SetWireType()

void SetWireType ( int wireType)
protected
192 {
194 }

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

◆ StartDeactivate()

override void StartDeactivate ( PlayerBase player)
protected
219 {
220 super.StartDeactivate(player);
221
224 }

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

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

◆ TripwireTrap()

void TripwireTrap ( )
protected
24 {
25 m_DamagePlayers = 0; //How much damage player gets when caught
26 m_InitWaitTime = 0.0; //After this time after deployment, the trap is activated
27 m_DefectRate = 15;
28 m_NeedActivation = false;
29 m_AnimationPhaseGrounded = "inventory";
30 m_AnimationPhaseSet = "placing";
31 m_AnimationPhaseTriggered = "triggered";
32 m_InfoActivationTime = string.Format("#STR_TripwireTrap0%1#STR_TripwireTrap1", m_InitWaitTime.ToString()); // nefunguje dynamicke vyrazy mimo funkcii
33
34 RegisterNetSyncVariableInt("m_State");
35 }
float m_DefectRate
Definition TrapBase.c:19
bool m_NeedActivation
Definition TrapBase.c:18
string m_InfoActivationTime
Definition TrapBase.c:40
float m_InitWaitTime
Definition TrapBase.c:17
float m_DamagePlayers
Definition TrapBase.c:20
proto string ToString()
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.

Перекрестные ссылки string::Format(), m_AnimationPhaseGrounded, m_AnimationPhaseSet, m_AnimationPhaseTriggered, m_DamagePlayers, m_DefectRate, m_InfoActivationTime, m_InitWaitTime, m_NeedActivation и float::ToString().

◆ UpdateProxySelections()

void UpdateProxySelections ( )
protected
406 {
407 if ( GetInventory().AttachmentCount() > 0)
408 {
409 ItemBase attachment = ItemBase.Cast( GetInventory().GetAttachmentFromIndex(0) );
410
411 if ( attachment )
412 {
413 // Hide all proxies
414 for (int i = 1; i <= 3; i++)
415 {
416 HideSelection("s" + i + "_charge");
417 }
418
419 // Now show the one we need to see
420 string proxy_to_show = string.Format("s%1_charge", GetState() );
421 //Print(proxy_to_show);
422 ShowSelection( proxy_to_show );
423 }
424 }
425 }

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

Переменные

◆ DEPLOYED

◆ FOLDED

◆ m_ResultOfAdvancedPlacing

bool m_ResultOfAdvancedPlacing
protected

◆ m_State

int m_State = FOLDED

◆ m_TriggerOrientation

vector m_TriggerOrientation
protected

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

◆ m_TriggerPosition

vector m_TriggerPosition
protected

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

◆ m_WireMaterial

int m_WireMaterial
private

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

◆ TRIGGERED

const int TRIGGERED = 1
static

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