DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AmmunitionPiles.c
См. документацию.
3{
5
6 static float GetAmmoWeightByBulletType(string bulletType)
7 {
8 if (m_AmmoWeightByBulletType.Contains(bulletType))
9 {
10 return m_AmmoWeightByBulletType.Get(bulletType);
11 }
12 else
13 {
14 float ammoWeight;
15 string ammoTypeName;
16 GetGame().ConfigGetText( string.Format("CfgAmmo %1 spawnPileType", bulletType) , ammoTypeName);
17 if (ammoTypeName)
18 ammoWeight = GetGame().ConfigGetFloat(string.Format("CfgMagazines %1 weight", ammoTypeName));
19 else
20 ErrorEx("empty 'spawnPileType' for bullet type:" + bulletType);
21 if (ammoWeight)
22 m_AmmoWeightByBulletType.Insert(bulletType, ammoWeight);
23 return ammoWeight;
24 }
25 }
26
27 override bool IsAmmoPile()
28 {
29 return true;
30 }
31
32 override protected float GetWeightSpecialized(bool forceRecalc = false)
33 {
34 #ifdef DEVELOPER
35 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
36 {
37 WeightDebugData data = WeightDebug.GetWeightDebug(this);
38 data.SetCalcDetails("TAmmo: ("+GetAmmoCount()+"(Ammo count) * "+ GetConfigWeightModifiedDebugText());
39 }
40 #endif
41
42 return GetAmmoCount() * GetConfigWeightModified();
43 }
44
45 override void SetQuantityToMinimum()
46 {
47 ServerSetAmmoCount(1);
48 }
49
51 {
52 float dmgPerUse = GetGame().ConfigGetFloat("cfgAmmo " + info.GetAmmoType() + " dmgPerUse");
53 float totalDmg = info.GetProjectileDamage() + dmgPerUse;
54 float health = Math.Max(1 - totalDmg, 0);
55
57 SetHealth01("","", health);
58
59 // SetCartridgeDamageAtIndex() MUST be called AFTER SetHealth01()!!
60 // otherwise, decreasing health by less than an entire health level get ignored
61 SetCartridgeDamageAtIndex(0, totalDmg);
62 }
63};
64
84{
85 override bool IsInventoryVisible()
86 {
88 return CanBeActionTarget();
89 }
90
91 override bool CanBeActionTarget()
92 {
93 if (super.CanBeActionTarget())
94 {
95 EntityAI parent = EntityAI.Cast(GetParent());
96 if (parent)
97 {
98 return !parent.IsManagingArrows();
99 }
100 }
101 return true;
102 }
103
104 override void EEParentedTo(EntityAI parent)
105 {
106 if (!parent)
107 return;
108
109 ArrowManagerBase arrowManager = parent.GetArrowManager();
110 if (arrowManager)
111 {
112 arrowManager.AddArrow(this);
113 }
114 }
115
116 override void EEParentedFrom(EntityAI parent)
117 {
118 if (!parent)
119 return;
120
121 ArrowManagerBase arrowManager = parent.GetArrowManager();
122 if (arrowManager)
123 {
124 arrowManager.RemoveArrow(this);
125 }
126 }
127}
128
129class Ammo_DartSyringe: Ammunition_Base {};
135
136//bolts
138
139class Ammo_ImprovisedBolt_1 : Bolt_Base
140{
141 override void SetActions()
142 {
143 super.SetActions();
144
146 }
147}
148
150class Ammo_CupidsBolt : Bolt_Base
151{
152 override void EEParentedTo(EntityAI parent)
153 {
154 Delete();
155 }
156
157 override void EEParentedFrom(EntityAI parent);
158
159 static void PlayOnHitParticle(vector position)
160 {
161 ParticleManager.GetInstance().PlayInWorld(ParticleList.BOLT_CUPID_HIT, position);
162 }
163}
164
165// 40mm
166
168{
169 override bool IsTakeable()
170 {
171 return GetAnimationPhase("Visibility") == 0;
172 }
173
174 override bool IsInventoryVisible()
175 {
176 if (!super.IsInventoryVisible())
177 {
178 return false;
179 }
180
181 return IsTakeable();
182 }
184
186{
187 override bool ShootsExplosiveAmmo()
188 {
189 return true;
190 }
191
192 override void OnActivatedByItem(notnull ItemBase item)
193 {
194 if (GetGame().IsServer())
195 {
196 DamageSystem.ExplosionDamage(this, null, "Explosion_40mm_Ammo", item.GetPosition(), DamageType.EXPLOSION);
197 }
198 }
199
200 override void EEKilled(Object killer)
201 {
202 super.EEKilled(killer);
203 DamageSystem.ExplosionDamage(this, null, "Explosion_40mm_Ammo", GetPosition(), DamageType.EXPLOSION);
204 GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( DeleteSafe, 1000, false);
205 }
206
207 override void OnDamageDestroyed(int oldLevel)
208 {
209 super.OnDamageDestroyed(oldLevel);
210 #ifndef SERVER
211 ClearFlags(EntityFlags.VISIBLE, false);
212 #endif
213 }
214}
215//class Ammo_40mm_Grenade_Gas: Ammo_40mm_Base {};
216class Ammo_40mm_ChemGas: Ammo_40mm_Base
217{
218 override void OnActivatedByItem(notnull ItemBase item)
220 if (GetGame().IsServer())
221 {
222 GetGame().CreateObject("ContaminatedArea_Local", item.GetPosition());
223 }
224 }
225
226 override void EEKilled(Object killer)
227 {
228 super.EEKilled(killer);
229 GetGame().CreateObject("ContaminatedArea_Local", GetPosition());
230 GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( DeleteSafe, 1000, false);
231 }
233 override void OnDamageDestroyed(int oldLevel)
234 {
235 super.OnDamageDestroyed(oldLevel);
236
237 #ifndef SERVER
238 ClearFlags(EntityFlags.VISIBLE, false);
240 #endif
241 }
242
243
244}
245
247{
249 protected float m_ParticleLifetime;
250 protected int m_ParticleId;
251 protected bool m_Activated;
252
254 {
255 RegisterNetSyncVariableBool("m_Activated");
256 }
257
259 {
260 super.OnVariablesSynchronized();
261
262 if (m_Activated)
263 {
264 #ifndef SERVER
265 string particleStrIdentifier = GetGame().ConfigGetTextOut(string.Format("CfgMagazines %1 particleStrIdentifier", GetType()));
266 m_ParticleId = ParticleList.GetParticleIDByName(particleStrIdentifier);
267 if (m_ParticleId > 0)
268 {
269 m_ParticleSmoke = ParticleManager.GetInstance().PlayOnObject(m_ParticleId, this);
270 m_ParticleSmoke.SetWiggle(7, 0.3);
271 }
272 #endif
273 }
274 }
275
276 protected void Activate()
277 {
278 m_ParticleLifetime = GetGame().ConfigGetFloat(string.Format("CfgMagazines %1 particleLifeTime", GetType()));
279 m_Activated = true;
280 SetSynchDirty();
281
283 }
284
286 override void EEKilled(Object killer)
287 {
288 //analytics (behaviour from EntityAI)
289 GetGame().GetAnalyticsServer().OnEntityKilled(killer, this);
290 }
291
292 override void EEDelete(EntityAI parent)
293 {
294 #ifndef SERVER
295 if (m_ParticleSmoke)
296 {
297 m_ParticleSmoke.Stop();
298 }
299 #endif
300
301 super.EEDelete(parent);
302 }
303
304 override bool CanPutInCargo( EntityAI parent )
305 {
306 return !m_Activated;
307 }
308
309 override void OnActivatedByItem(notnull ItemBase item)
310 {
311 SetHealth("", "", 0.0);
312 Activate();
313 }
314}
315
316class Ammo_40mm_Smoke_Red: Ammo_40mm_Smoke_ColorBase {};
eBleedingSourceType GetType()
Определения BleedingSource.c:63
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
static void PlayOnHitParticle(vector position)
Определения AmmunitionPiles.c:159
Ammo_HuntingBolt Bolt_Base SetActions()
Определения AmmunitionPiles.c:141
override void EEKilled(Object killer)
Определения AmmunitionPiles.c:232
Ammo_40mm_Explosive Ammo_40mm_Base OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения AmmunitionPiles.c:218
override void OnDamageDestroyed(int oldLevel)
Определения AmmunitionPiles.c:239
Ammo_40mm_Base EEParentedTo
map
Определения ControlsXboxNew.c:4
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
class GP5GasMask extends MaskBase ItemBase
Magazine Magazine_Base
Определения Magazine.c:1
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
Определения AmmunitionPiles.c:79
Определения AmmunitionPiles.c:77
Определения AmmunitionPiles.c:66
Определения AmmunitionPiles.c:80
Определения AmmunitionPiles.c:69
override bool IsTakeable()
Определения AmmunitionPiles.c:169
override bool IsInventoryVisible()
Определения AmmunitionPiles.c:174
override bool ShootsExplosiveAmmo()
Определения AmmunitionPiles.c:187
override void EEKilled(Object killer)
Определения AmmunitionPiles.c:200
override void OnActivatedByItem(notnull ItemBase item)
Определения AmmunitionPiles.c:192
override void OnDamageDestroyed(int oldLevel)
Определения AmmunitionPiles.c:207
Particle m_ParticleSmoke
Определения AmmunitionPiles.c:248
void Activate()
Определения AmmunitionPiles.c:276
override void OnActivatedByItem(notnull ItemBase item)
Определения AmmunitionPiles.c:309
override void EEKilled(Object killer)
special behaviour - do not call super
Определения AmmunitionPiles.c:286
float m_ParticleLifetime
Определения AmmunitionPiles.c:249
override bool CanPutInCargo(EntityAI parent)
Определения AmmunitionPiles.c:304
override void OnVariablesSynchronized()
Определения AmmunitionPiles.c:258
void Ammo_40mm_Smoke_ColorBase()
Определения AmmunitionPiles.c:253
override void EEDelete(EntityAI parent)
Определения AmmunitionPiles.c:292
Определения AmmunitionPiles.c:65
Определения AmmunitionPiles.c:81
Определения AmmunitionPiles.c:70
Определения AmmunitionPiles.c:74
Определения AmmunitionPiles.c:72
Определения AmmunitionPiles.c:68
Определения AmmunitionPiles.c:76
Определения AmmunitionPiles.c:130
Определения AmmunitionPiles.c:133
Определения AmmunitionPiles.c:132
Определения AmmunitionPiles.c:131
override void SetFromProjectile(ProjectileStoppedInfo info)
Определения AmmunitionPiles.c:50
static float GetAmmoWeightByBulletType(string bulletType)
Определения AmmunitionPiles.c:6
float GetWeightSpecialized(bool forceRecalc=false)
Определения AmmunitionPiles.c:32
override bool IsAmmoPile()
Определения AmmunitionPiles.c:27
static ref map< string, float > m_AmmoWeightByBulletType
Определения AmmunitionPiles.c:4
override void SetQuantityToMinimum()
Определения AmmunitionPiles.c:45
ammo pile base
Определения AmmunitionPiles.c:3
void OnEntityKilled(Object killer, EntityAI target)
Определения AnalyticsManagerServer.c:48
void RemoveArrow(EntityAI arrow)
Определения ArrowManagerBase.c:18
void AddArrow(EntityAI arrow)
Определения ArrowManagerBase.c:13
override void EEParentedTo(EntityAI parent)
Определения AmmunitionPiles.c:104
override bool IsInventoryVisible()
Определения AmmunitionPiles.c:85
override bool CanBeActionTarget()
Определения AmmunitionPiles.c:91
override void EEParentedFrom(EntityAI parent)
Определения AmmunitionPiles.c:116
Определения AmmunitionPiles.c:84
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native Object CreateObject(string type, vector pos, bool create_local=false, bool init_ai=false, bool create_physics=true)
Creates object of certain type.
string ConfigGetTextOut(string path)
Get string value from config on path.
Определения Game.c:463
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
AnalyticsManagerServer GetAnalyticsServer()
Определения Game.c:1508
Определения Building.c:6
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения ObjectTyped.c:2
Legacy way of using particles in the game.
Определения Particle.c:7
static const int BOLT_CUPID_HIT
Определения ParticleList.c:341
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
Определения ParticleList.c:500
static const int GRENADE_CHEM_BREAK
Определения ParticleList.c:326
Определения ParticleList.c:12
proto native string GetAmmoType()
proto native float GetProjectileDamage()
Определения DayZGame.c:18
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
void SetCalcDetails(string details)
Определения Debug.c:816
Определения Debug.c:799
Определения EnConvert.c:106
class LOD Object
proto native CGame GetGame()
enum ShapeType ErrorEx
EntityFlags
Entity flags.
Определения EnEntity.c:115
static proto float Max(float x, float y)
Returns bigger of two given values.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407
proto native int ClearFlags(int flags, bool immedUpdate=true)