DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DamageSystem.c
См. документацию.
3 proto native float GetDamage(string zoneName, string healthType);
4 proto native float GetHighestDamage(string healthType);
5};
6
7//-----------------------------------------------------------------------------
8
11{
12 CLOSE_COMBAT, // 0
13 FIRE_ARM, // 1
15 STUN,
16 CUSTOM
17}
18
19//-----------------------------------------------------------------------------
20class DamageSystem
21{
22 static proto native void CloseCombatDamage(EntityAI source, Object targetObject, int targetComponentIndex, string ammoTypeName, vector worldPos, int directDamageFlags = ProcessDirectDamageFlags.ALL_TRANSFER);
23 static proto native void CloseCombatDamageName(EntityAI source, Object targetObject, string targetComponentName, string ammoTypeName, vector worldPos, int directDamageFlags = ProcessDirectDamageFlags.ALL_TRANSFER);
24
25 static proto native void ExplosionDamage(EntityAI source, Object directHitObject, string ammoTypeName, vector worldPos, int damageType);
26
27 static bool GetDamageZoneMap(EntityAI entity, out DamageZoneMap zoneMap)
28 {
29 string path_base;
30 string path;
31
32 if (entity.IsWeapon())
33 {
34 path_base = CFG_WEAPONSPATH;
35 }
36 else if (entity.IsMagazine())
37 {
38 path_base = CFG_MAGAZINESPATH;
39 }
40 else
41 {
42 path_base = CFG_VEHICLESPATH;
43 }
44
45 path_base = string.Format("%1 %2 DamageSystem DamageZones", path_base, entity.GetType());
46
47 if (!GetGame().ConfigIsExisting(path_base))
48 {
49 return false;
50 }
51 else
52 {
53 string zone;
54 array<string> zone_names = new array<string>;
55 array<string> component_names;
56
57 entity.GetDamageZones(zone_names);
58 for (int i = 0; i < zone_names.Count(); i++)
59 {
60 component_names = new array<string>;
61 zone = zone_names.Get(i);
62
63 path = string.Format("%1 %2 componentNames ", path_base, zone);
64 if (GetGame().ConfigIsExisting(path))
65 {
66 GetGame().ConfigGetTextArray(path,component_names);
67 }
68 zoneMap.Insert(zone,component_names);
69 }
70
71 return true;
72 }
73 }
74
76 static bool GetDamageZoneFromComponentName(notnull EntityAI entity, string component, out string damageZone)
77 {
78 DamageZoneMap zoneMap = entity.GetEntityDamageZoneMap();
79 array<array<string>> components;
80 components = zoneMap.GetValueArray();
81 for (int i = 0; i < components.Count(); i++)
82 {
83 array<string> inner = components.Get(i);
84 for (int j = 0; j < inner.Count(); j++)
85 {
86 string innerComponentName = inner.Get(j);
87 innerComponentName.ToLower();
88
89 //We don't have a component name, no need to proceed
90 if ( innerComponentName == "" )
91 break;
92
93 if (innerComponentName == component)
94 {
95 damageZone = zoneMap.GetKey(i);
96 return true;
97 }
98 }
99 }
100 damageZone = "";
101 return false;
102 }
103
104 static bool GetComponentNamesFromDamageZone(notnull EntityAI entity, string damageZone, out array<string> componentNames)
105 {
106 string path;
107
108 if (entity.IsWeapon())
109 {
111 }
112 else if (entity.IsMagazine())
113 {
115 }
116 else
117 {
119 }
120
121 path = string.Format("%1 %2 DamageSystem DamageZones %3 componentNames", path, entity.GetType(), damageZone);
122 if (GetGame().ConfigIsExisting(path))
123 {
124 GetGame().ConfigGetTextArray(path,componentNames);
125 return true;
126 }
127
128 return false;
129 }
130
131 static string GetDamageDisplayName(EntityAI entity, string zone)
132 {
133 string component_name;
134 entity.GetEntityDamageDisplayNameMap().Find(zone.Hash(), component_name);
135 component_name = Widget.TranslateString(component_name);
136 return component_name;
137 }
138
139 static void ResetAllZones(EntityAI entity)
140 {
141 DamageZoneMap zonesMap = new DamageZoneMap();
142 DamageSystem.GetDamageZoneMap(entity, zonesMap);
143 array<string> zones = zonesMap.GetKeyArray();
144 entity.SetHealth("", "Health", entity.GetMaxHealth("","Health"));
145 entity.SetHealth("", "Shock", entity.GetMaxHealth("","Shock"));
146 entity.SetHealth("", "Blood", entity.GetMaxHealth("","Blood"));
147
148 foreach (string zone : zones)
149 {
150 entity.SetHealth(zone, "Health", entity.GetMaxHealth(zone,"Health"));
151 entity.SetHealth(zone, "Shock", entity.GetMaxHealth(zone,"Shock"));
152 entity.SetHealth(zone, "Blood", entity.GetMaxHealth(zone,"Blood"));
153 }
154 }
155}
156
157typedef map<string,ref array<string>> DamageZoneMap; //<zone_name,<components>>
class LogManager EntityAI
map
Определения ControlsXboxNew.c:4
static string GetDamageDisplayName(EntityAI entity, string zone)
Определения DamageSystem.c:131
FIRE_ARM
Определения DamageSystem.c:1
static proto native void CloseCombatDamageName(EntityAI source, Object targetObject, string targetComponentName, string ammoTypeName, vector worldPos, int directDamageFlags=ProcessDirectDamageFlags.ALL_TRANSFER)
EXPLOSION
Определения DamageSystem.c:2
static bool GetDamageZoneMap(EntityAI entity, out DamageZoneMap zoneMap)
Определения DamageSystem.c:27
enum DamageType CloseCombatDamage(EntityAI source, Object targetObject, int targetComponentIndex, string ammoTypeName, vector worldPos, int directDamageFlags=ProcessDirectDamageFlags.ALL_TRANSFER)
static bool GetComponentNamesFromDamageZone(notnull EntityAI entity, string damageZone, out array< string > componentNames)
Определения DamageSystem.c:104
static proto native void ExplosionDamage(EntityAI source, Object directHitObject, string ammoTypeName, vector worldPos, int damageType)
static bool GetDamageZoneFromComponentName(notnull EntityAI entity, string component, out string damageZone)
Returns damage zone to which the named component belongs.
Определения DamageSystem.c:76
map< string, ref array< string > > DamageZoneMap
Определения DamageSystem.c:157
static void ResetAllZones(EntityAI entity)
Определения DamageSystem.c:139
CLOSE_COMBAT
Определения DamageSystem.c:0
CUSTOM
Определения DamageSystem.c:5
STUN
Определения DamageSystem.c:3
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
ProcessDirectDamageFlags
Определения Object.c:2
string path
Определения OptionSelectorMultistate.c:142
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
Определения Building.c:6
TODO doc.
Определения EnScript.c:118
Определения ObjectTyped.c:2
proto native float GetDamage(string zoneName, string healthType)
proto native float GetHighestDamage(string healthType)
Определения DamageSystem.c:2
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
class LOD Object
proto native CGame GetGame()
const string CFG_VEHICLESPATH
Определения constants.c:220
const string CFG_WEAPONSPATH
Определения constants.c:221
const string CFG_MAGAZINESPATH
Определения constants.c:222
proto native int Hash()
Returns hash of string.
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.
proto int ToLower()
Changes string to lowercase. Returns length.