Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс Grenade_Base
+ Граф наследования:Grenade_Base:

Защищенные члены

override void CreateLight ()
 
void ~FlashGrenade ()
 
void Pin ()
 
void Unpin ()
 
override void OnActivatedByTripWire ()
 DEPRECATED use OnActivatedByItem.
 
override void OnActivatedByItem (notnull ItemBase item)
 
bool IsPinned ()
 
bool IsPinnable ()
 
void ActivateImmediate ()
 
void ActivateRandomTime ()
 
void SetPinnable (bool state)
 
void SetFuseDelay (float delay)
 
void SetGrenadeType (EGrenadeType type)
 
EGrenadeType GetGrenadeType ()
 
void Activate ()
 
void Deactivate ()
 
override void InitiateExplosion ()
 
void ExplodeGrenade (EGrenadeType grenade_type)
 DEPRECATED - for backward compatibility only.
 
void OnPin ()
 
void OnUnpin ()
 
void OnActivateStarted ()
 
void OnActivateFinished ()
 
void OnActivateImmediate ()
 
void OnDeactivate ()
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override bool CanBeArmed ()
 
override bool CanBeDisarmed ()
 
override bool CanExplodeInFire ()
 
override void SetActions ()
 
override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
void Grenade_Base ()
 

Защищенные данные

const float DEFAULT_FUSE_DELAY = 10
 
ref Timer m_FuseTimer
 
float m_FuseDelay
 
float m_RemainingFuseTime
 
bool m_Pinned
 
bool m_Pinnable
 
EGrenadeType m_GrenadeType
 

Закрытые члены

override void OnExplosionEffects (Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
 
void FlashGrenade ()
 
void M67Grenade ()
 
void ~M67Grenade ()
 
void RGD5Grenade ()
 
void ~RGD5Grenade ()
 

Закрытые данные

const float FX_RANGE_MAX_MULT = 1.0
 

Подробное описание

Конструктор(ы)

◆ ~FlashGrenade()

void ~FlashGrenade ( )
inlineprotected
92{}

◆ ~M67Grenade()

void ~M67Grenade ( )
inlineprivate
10{}

◆ ~RGD5Grenade()

void ~RGD5Grenade ( )
inlineprivate
10{}

◆ Grenade_Base()

void Grenade_Base ( )
inlineprotected
295 {
296 m_Pinned = true;
297 m_FuseTimer = new Timer;
299
300 SetPinnable(true);
302 SetGrenadeType(EGrenadeType.FRAGMENTATION);
303
304 RegisterNetSyncVariableBool("m_Pinned");
305 }
EGrenadeType
Definition Grenade_Base.c:2
const float DEFAULT_FUSE_DELAY
Definition Grenade_Base.c:32
void SetGrenadeType(EGrenadeType type)
Definition Grenade_Base.c:112
void SetFuseDelay(float delay)
Definition Grenade_Base.c:107
void SetPinnable(bool state)
Definition Grenade_Base.c:102
ref Timer m_FuseTimer
Definition Grenade_Base.c:34
bool m_Pinned
Definition Grenade_Base.c:38
float m_RemainingFuseTime
Definition Grenade_Base.c:36
Definition DayZPlayerImplement.c:63

Перекрестные ссылки DEFAULT_FUSE_DELAY, m_FuseTimer, m_Pinned, m_RemainingFuseTime, SetFuseDelay(), SetGrenadeType() и SetPinnable().

Методы

◆ Activate()

void Activate ( )
inlineprotected

run only the remaining part (already unpinned and pinned)

123 {
124 if (!m_FuseTimer.IsRunning())
125 {
127 if (m_RemainingFuseTime > 0)
128 {
129 //Debug.Log(string.Format("Grenade activated num of seconds to explosion: %1", m_RemainingFuseTime));
130 m_FuseTimer.Run(m_RemainingFuseTime, this, "OnActivateFinished");
131 }
132 else
133 {
134 //Debug.Log(string.Format("Grenade activated num of seconds to explosion: %1", m_FuseDelay));
135 m_FuseTimer.Run(m_FuseDelay, this, "OnActivateFinished");
136 }
137
138 }
139 }
float m_FuseDelay
Definition Grenade_Base.c:35

Перекрестные ссылки m_FuseDelay, m_FuseTimer и m_RemainingFuseTime.

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

◆ ActivateImmediate()

void ActivateImmediate ( )
inlineprotected
91 {
93 }
void OnActivateImmediate()
Definition Grenade_Base.c:210

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

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

◆ ActivateRandomTime()

void ActivateRandomTime ( )
inlineprotected

to millis

96 {
97 float delay = Math.RandomFloat(1, 20);
98 delay *= 1000;
99 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(ActivateImmediate, delay, false);
100 }
void ActivateImmediate()
Definition Grenade_Base.c:90
Definition EnMath.c:7
Definition EntityAI.c:95
proto native CGame GetGame()
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

Перекрестные ссылки ActivateImmediate(), CALL_CATEGORY_GAMEPLAY, GetGame() и Math::RandomFloat().

◆ CanBeArmed()

override bool CanBeArmed ( )
inlineprotected
251 {
252 return false;
253 }

◆ CanBeDisarmed()

override bool CanBeDisarmed ( )
inlineprotected
256 {
257 return false;
258 }

◆ CanExplodeInFire()

override bool CanExplodeInFire ( )
inlineprotected
261 {
262 return true;
263 }

◆ CreateLight()

override void CreateLight ( )
inlineprotected
88 {
90 }
ExplosiveLight m_Light
light
Definition ExplosivesBase.c:31
void FlashGrenadeLight()
Definition Grenade_Base.c:17
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Definition ExplosivesBase.c:2
Definition PointLightBase.c:2

Перекрестные ссылки FlashGrenadeLight(), GetPosition и m_Light.

◆ Deactivate()

void Deactivate ( )
inlineprotected
142 {
143 if (m_FuseTimer.IsRunning())
144 {
145 m_RemainingFuseTime = m_FuseTimer.GetRemaining();
146 m_FuseTimer.Stop();
147 OnDeactivate();
148 }
149 }
void OnDeactivate()

Перекрестные ссылки m_FuseTimer, m_RemainingFuseTime и OnDeactivate().

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

◆ EEItemLocationChanged()

override void EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
inlineprotected

activate grenade when it leaves player hands (safety handle released)

274 {
275 super.EEItemLocationChanged(oldLoc, newLoc);
276
278 if (newLoc.GetType() != InventoryLocationType.HANDS && !IsPinned())
279 {
280 Activate();
281 }
282 }
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4
bool IsPinned()
Definition Grenade_Base.c:74
void Activate()
Definition Grenade_Base.c:122

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

◆ ExplodeGrenade()

void ExplodeGrenade ( EGrenadeType grenade_type)
inlineprotected

DEPRECATED - for backward compatibility only.

172 {
174 }
override void InitiateExplosion()
Definition Grenade_Base.c:151

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

◆ FlashGrenade()

void FlashGrenade ( )
inlineprivate
80 {
81 SetAmmoType("FlashGrenade_Ammo");
82 SetFuseDelay(2);
83 SetGrenadeType(EGrenadeType.ILLUMINATING);
85 }
void SetParticleExplosion(int particle)
Definition ExplosivesBase.c:294
void SetAmmoType(string pAmmoType)
Definition ExplosivesBase.c:283
Definition ParticleList.c:12
static const int GRENADE_M84
Definition ParticleList.c:127

Перекрестные ссылки ParticleList::GRENADE_M84, SetAmmoType(), SetFuseDelay(), SetGrenadeType() и SetParticleExplosion().

◆ GetGrenadeType()

EGrenadeType GetGrenadeType ( )
inlineprotected
118 {
119 return m_GrenadeType;
120 }
EGrenadeType m_GrenadeType
Definition Grenade_Base.c:42

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

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

◆ InitiateExplosion()

override void InitiateExplosion ( )
inlineprotected
152 {
153 switch (GetGrenadeType())
154 {
155 case EGrenadeType.FRAGMENTATION:
156 case EGrenadeType.ILLUMINATING:
157 for (int i = 0; i < m_AmmoTypes.Count(); i++)
158 {
159 Explode(DamageType.EXPLOSION, m_AmmoTypes[i]);
160 }
161 break;
162 case EGrenadeType.CHEMICAL:
163 case EGrenadeType.NON_LETHAL:
164 break;
165 }
166
167 OnExplode();
168 }
DamageType
exposed from C++ (do not change)
Definition DamageSystem.c:11
void OnExplode()
Definition ExplosivesBase.c:171
ref array< string > m_AmmoTypes
Definition ExplosivesBase.c:26
override void Explode(int damageType, string ammoType="")
Definition Trap_LandMine.c:220
EGrenadeType GetGrenadeType()
Definition Grenade_Base.c:117

Перекрестные ссылки Explode(), GetGrenadeType(), m_AmmoTypes и OnExplode().

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

◆ IsPinnable()

bool IsPinnable ( )
inlineprotected

cannot be pinned once the fuse has started

80 {
82 if (m_FuseTimer.IsRunning())
83 {
84 return false;
85 }
86
87 return m_Pinnable;
88 }
bool m_Pinnable
Definition Grenade_Base.c:39

Перекрестные ссылки m_FuseTimer и m_Pinnable.

◆ IsPinned()

bool IsPinned ( )
inlineprotected
75 {
76 return m_Pinned;
77 }

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

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

◆ M67Grenade()

void M67Grenade ( )
inlineprivate
4 {
5 SetAmmoType("M67Grenade_Ammo");
8 }
static const int M67
Definition ParticleList.c:131

Перекрестные ссылки ParticleList::M67, SetAmmoType(), SetFuseDelay() и SetParticleExplosion().

◆ OnActivatedByItem()

override void OnActivatedByItem ( notnull ItemBase item)
inlineprotected
64 {
65 if (item == this)
66 {
68 return;
69 }
70
71 Unpin();
72 }
void Unpin()
Definition Grenade_Base.c:52
void OnActivateFinished()
Definition Grenade_Base.c:201

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

◆ OnActivatedByTripWire()

override void OnActivatedByTripWire ( )
protected

DEPRECATED use OnActivatedByItem.

◆ OnActivateFinished()

void OnActivateFinished ( )
inlineprotected
202 {
203 if (GetGame().IsServer())
204 {
205 SetHealth("", "", 0.0); // causes explosion when grenade is destroyed
206 SetTakeable(false);
207 }
208 }
override void SetTakeable(bool pState)
Definition ItemBase.c:8971

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

Используется в Grenade_ChemGas::EOnContact() и OnActivatedByItem().

◆ OnActivateImmediate()

void OnActivateImmediate ( )
inlineprotected
211 {
212 if (GetGame().IsServer())
213 {
214 SetHealth("", "", 0.0); // causes explosion when grenade is destroyed
215 SetTakeable(false);
216 }
217 }

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

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

◆ OnActivateStarted()

void OnActivateStarted ( )
protected

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

◆ OnDeactivate()

void OnDeactivate ( )
protected

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

◆ OnExplosionEffects()

override void OnExplosionEffects ( Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
float energyFactor,
float explosionFactor,
bool isWater,
string ammoType )
inlineprivate

values less than 1.0 make no sense

removes possible obstacles made by items around the grenade(or on the same position)

6 {
8
10
11 if (player)
12 {
13 vector headPos = player.GetDamageZonePos("Head"); // animated position in the middle of the zone
14 float ammoRangeKill = GetGame().ConfigGetFloat(string.Format("CfgAmmo %1 indirectHitRange", ammoType));
15 float ammoRangeMaxMult = 4.0;
16
17 string indirectHitRangeMultiplier = string.Format("CfgAmmo %1 indirectHitRangeMultiplier", ammoType);
18 if (GetGame().ConfigIsExisting(indirectHitRangeMultiplier))
19 {
21 ammoRangeMaxMult = Math.Clamp(GetGame().ConfigGetFloat(indirectHitRangeMultiplier), 1.0, float.MAX);
22 }
23
26
27 float dist = vector.Distance(headPos, pos);
28 float distSq = vector.DistanceSq(headPos, pos);
30
31 if (distSq <= radiusMaxSq)
32 {
33 // ignore collisions with parent if fireplace
35 EntityAI parent = invItem.GetHierarchyParent();
37
38 if (!parent || !parent.IsFireplace())
39 parent = null;
40 else if (parent)
41 excluded.Insert(parent);
42
44 excluded.Insert(this); //Ignore self for visibility check
45
46 //There shouldn't be cases justifying we go further than first entry (if in fireplace, self does not impact)
48 rayParams.flags = CollisionFlags.ALLOBJECTS;
50
53 for (int i = 0; i < results.Count(); i++)
54 {
55 if (results[i].obj && !results[i].obj.IsInherited(ItemBase))
56 {
57 hitObjects.Insert(results[i].obj);
58 }
59 }
60
61 //If player is not first index, object is between player and grenade
62 if (hitObjects.Count() && PlayerBase.Cast(hitObjects[0]))
63 {
64 float effectCoef;
66 {
67 effectCoef = 1.0; //edge case, landed right on the edge
68 }
70 effectCoef = Math.Clamp(effectCoef, 0.1, 100.0);
71
72 player.OnPlayerReceiveFlashbangHitStart(MiscGameplayFunctions.IsPlayerOrientedTowardPos(player, pos, 60));
73 player.GetFlashbangEffect().SetupFlashbangValues(effectCoef, effectCoef, effectCoef);
74 }
75 }
76 }
77 }
const int MAX
Definition EnConvert.c:27
PlayerBase GetPlayer()
Definition ModifierBase.c:47
Definition DayZPhysics.c:124
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
Definition Building.c:6
const float FX_RANGE_MAX_MULT
Definition FlashGrenade.c:3
Definition ItemBase.c:14
Definition InventoryItem.c:731
Definition PlayerBaseClient.c:2
Definition DayZPhysics.c:50
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
CollisionFlags
Definition EnDebug.c:141
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 SqrFloat(float f)
Returns squared value.

Перекрестные ссылки Math::Clamp(), vector::Distance(), vector::DistanceSq(), GetGame(), GetPlayer(), MAX, DayZPhysics::RaycastRVProxy() и Math::SqrFloat().

◆ OnPin()

void OnPin ( )
inlineprotected
177 {
178 m_Pinned = true;
179 if (GetGame().IsServer())
180 {
181 ForceFarBubble(false);
182 SetSynchDirty();
183 }
184
185 Deactivate();
186 }
void Deactivate()
Definition Grenade_Base.c:141

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

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

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected
232 {
233 if (!super.OnStoreLoad(ctx, version))
234 return false;
235
236 bool pinned;
237 if (version >= 107)
238 {
239 if (!ctx.Read(pinned))
240 {
241 return false;
242 }
243
245 }
246
247 return true;
248 }

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

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext ctx)
inlineprotected
222 {
223 super.OnStoreSave(ctx);
224
225 if (GetGame().SaveVersion() >= 107)
226 {
227 ctx.Write(m_Pinned);
228 }
229 }

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

◆ OnUnpin()

void OnUnpin ( )
inlineprotected
189 {
190 m_Pinned = false;
191 if (GetGame().IsServer())
192 {
193 ForceFarBubble(true);
194 SetSynchDirty();
195 }
196
198 }
void OnActivateStarted()

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

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

◆ OnWasAttached()

override void OnWasAttached ( EntityAI parent,
int slot_id )
inlineprotected
285 {
286 super.OnWasAttached(parent, slot_id);
287
288 if (parent.IsAnyInherited({TrapBase,ImprovisedExplosive}))
289 {
290 Deactivate();
291 }
292 }

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

◆ Pin()

void Pin ( )
inlineprotected
45 {
46 if (!m_Pinned && m_Pinnable)
47 {
48 OnPin();
49 }
50 }
void OnPin()
Definition Grenade_Base.c:176

Перекрестные ссылки m_Pinnable, m_Pinned и OnPin().

◆ RGD5Grenade()

void RGD5Grenade ( )
inlineprivate
4 {
5 SetAmmoType("RGD5Grenade_Ammo");
8 }
static const int RGD5
Definition ParticleList.c:130

Перекрестные ссылки ParticleList::RGD5, SetAmmoType(), SetFuseDelay() и SetParticleExplosion().

◆ SetActions()

override void SetActions ( )
inlineprotected
266 {
267 super.SetActions();
268
269 AddAction(ActionUnpin);
270 AddAction(ActionPin);
271 }
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220

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

◆ SetFuseDelay()

void SetFuseDelay ( float delay)
inlineprotected
108 {
110 }

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

Используется в FlashGrenade(), Grenade_Base(), M67Grenade() и RGD5Grenade().

◆ SetGrenadeType()

void SetGrenadeType ( EGrenadeType type)
inlineprotected
113 {
114 m_GrenadeType = type;
115 }

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

Используется в FlashGrenade(), Grenade_Base() и Grenade_ChemGas::Grenade_ChemGas().

◆ SetPinnable()

void SetPinnable ( bool state)
inlineprotected
103 {
105 }

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

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

◆ Unpin()

void Unpin ( )
inlineprotected
53 {
54 if (m_Pinned)
55 {
56 OnUnpin();
57 }
58 }
void OnUnpin()
Definition Grenade_Base.c:188

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

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

Поля

◆ DEFAULT_FUSE_DELAY

const float DEFAULT_FUSE_DELAY = 10
protected

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

◆ FX_RANGE_MAX_MULT

const float FX_RANGE_MAX_MULT = 1.0
private

◆ m_FuseDelay

float m_FuseDelay
protected

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

◆ m_FuseTimer

ref Timer m_FuseTimer
protected

Используется в Activate(), Deactivate(), Grenade_Base() и IsPinnable().

◆ m_GrenadeType

EGrenadeType m_GrenadeType
protected

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

◆ m_Pinnable

bool m_Pinnable
protected

Используется в IsPinnable(), Pin() и SetPinnable().

◆ m_Pinned

◆ m_RemainingFuseTime

float m_RemainingFuseTime
protected

Используется в Activate(), Deactivate() и Grenade_Base().


Объявления и описания членов классов находятся в файлах: