DayZ 1.24
Loading...
Searching...
No Matches
ImpactMaterials Class Reference
Collaboration diagram for ImpactMaterials:
[legend]

Static Private Attributes

static ref map< string, typenamem_ImpactEffect
 
static int m_LastRegisteredMaterial = 0
 
static ref map< string, intm_IgnoredAmmo
 Map of ammo which will not spawn any impact effect.
 
static int m_LastRegisteredIgnoredAmmo = 0
 
Surface effects

Register all hit materials here! When modding, these can be unregistered with 'UnregisterSurface' if so desired

static int PLASTIC = RegisterSurface("Hit_Plastic")
 
static int SAND = RegisterSurface("Hit_Sand")
 
static int TEXTILE = RegisterSurface("Hit_Textile")
 
static int CONCRETE = RegisterSurface("Hit_Concrete")
 
static int GRAVEL = RegisterSurface("Hit_Gravel")
 
static int DIRT = RegisterSurface("Hit_Dirt")
 
static int FOLIAGE = RegisterSurface("Hit_Foliage")
 
static int GRASS = RegisterSurface("Hit_Grass")
 
static int WOOD = RegisterSurface("Hit_Wood")
 
static int METAL = RegisterSurface("Hit_Metal")
 
static int GLASS = RegisterSurface("Hit_Glass")
 
static int GLASS_THIN = RegisterSurface("Hit_Glass_Thin")
 
static int WATER = RegisterSurface("Hit_Water")
 
static int RUBBER = RegisterSurface("Hit_Rubber")
 
static int PLASTER = RegisterSurface("Hit_Plaster")
 
static int MEATBONES = RegisterSurface("Hit_MeatBones")
 
static int MEATBONES_SHOVEL = RegisterSurface("Hit_MeatBones_MeleeShovel")
 
static int MEATBONES_PIPEWRENCH = RegisterSurface("Hit_MeatBones_MeleePipeWrench")
 
static int MEATBONES_WRENCH = RegisterSurface("Hit_MeatBones_MeleeWrench")
 
static int MEATBONES_FIST = RegisterSurface("Hit_MeatBones_MeleeFist")
 
static int UNDEFINED = RegisterSurface("Hit_Undefined")
 
static int ERROR_NO_MATERIAL = RegisterSurface("Hit_ErrorNoMaterial")
 

Ignored ammo

Register ammo which will not spawn impact effects here When modding, these can be unregistered with 'UnregisterIgnoredAmmo' if so desired

static int FIST = RegisterIgnoredAmmo("MeleeFist")
 
static int FIST_HEAVY = RegisterIgnoredAmmo("MeleeFist_Heavy")
 
static int SOFT = RegisterIgnoredAmmo("MeleeSoft")
 
static int SOFT_HEAVY = RegisterIgnoredAmmo("MeleeSoft_Heavy")
 
static int DUMMY = RegisterIgnoredAmmo("Dummy_Light")
 
static int DUMMY_HEAVY = RegisterIgnoredAmmo("Dummy_Heavy")
 
static int RegisterSurface (string surface)
 
static bool UnregisterSurface (string surface)
 
static int RegisterIgnoredAmmo (string ammo)
 
static bool UnregisterIgnoredAmmo (string ammo)
 
static GetImpactEffect (string surface, string ammoType)
 
static void EvaluateImpactEffectEx (ImpactEffectsData pData)
 
static void EvaluateImpactEffect (Object directHit, int componentIndex, string surface, vector pos, int impact_type, vector surfNormal, vector exitPos, vector inSpeed, vector outSpeed, bool deflected, string ammoType, bool isWater)
 

Detailed Description

Definition at line 28 of file ImpactEffects.c.

Member Function Documentation

◆ EvaluateImpactEffect()

static void ImpactMaterials::EvaluateImpactEffect ( Object directHit,
int componentIndex,
string surface,
vector pos,
int impact_type,
vector surfNormal,
vector exitPos,
vector inSpeed,
vector outSpeed,
bool deflected,
string ammoType,
bool isWater )
inlinestaticprivate

Definition at line 140 of file ImpactEffects.c.

141 {
142 // No impact effects wanted for this ammo
143 if (m_IgnoredAmmo.Contains(ammoType))
144 return;
145
146 if (impact_type == ImpactTypes.UNKNOWN)
148
149 if (deflected)
150 impact_type = ImpactTypes.RICOCHET;
151 else if (outSpeed)
152 impact_type = ImpactTypes.PENETRATE;
153
154 if (isWater)
155 surface = "Hit_Water";
156
158
159 if (!eff && surface == "") // handle undefined surface
160 {
161 eff = EffBulletImpactBase.Cast(surface.ToType().Spawn());
162
163 if (eff)
164 {
165 RegisterSurface(surface);
166 ErrorEx(string.Format("Unregistered surface for bullet impact effect (%1). Register this surface in ImpactMaterials (Script) for better performance.", surface), ErrorExSeverity.WARNING);
167 }
168 else
169 {
170 if (directHit)
171 {
172 string object_type = directHit.GetType();
173
174 if (object_type == "")
175 object_type = "OBJECT_WITHOUT_CONFIG_CLASS";
176
177 ErrorEx(string.Format("Object '%1' with model file: %2 has undefined 'Hit_...' material! Cannot play impact effect.", object_type, directHit.GetShapeName()));
178 eff = EffBulletImpactBase.Cast(GetImpactEffect("Hit_ErrorNoMaterial", ammoType).Spawn());
179 }
180 }
181 }
182
183 if (!eff && surface != "")
184 {
185 ErrorEx(string.Format("Unregistered surface impact material <%1>! Register this surface in ImpactMaterials (Script).", surface));
186 eff = EffBulletImpactBase.Cast(GetImpactEffect("Hit_Undefined", ammoType).Spawn());
187 }
188
189 if (eff)
190 {
192 eff.SetAutodestroy(true);
194 }
195 }
void Spawn()
spawn damage trigger
ImpactTypes
static int RegisterSurface(string surface)
static GetImpactEffect(string surface, string ammoType)
static ref map< string, int > m_IgnoredAmmo
Map of ammo which will not spawn any impact effect.
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...

References ErrorEx, GetImpactEffect(), m_IgnoredAmmo, SEffectManager::PlayInWorld(), RegisterSurface(), Spawn(), and string::ToType().

Referenced by EvaluateImpactEffectEx().

◆ EvaluateImpactEffectEx()

static void ImpactMaterials::EvaluateImpactEffectEx ( ImpactEffectsData pData)
inlinestaticprivate

Definition at line 135 of file ImpactEffects.c.

136 {
137 EvaluateImpactEffect(pData.m_DirectHit, pData.m_ComponentIndex, pData.m_Surface, pData.m_Position, pData.m_ImpactType, pData.m_SurfaceNormal, pData.m_ExitPosition, pData.m_InSpeed, pData.m_OutSpeed, pData.m_IsDeflected, pData.m_AmmoType, pData.m_IsWater);
138 }
static void EvaluateImpactEffect(Object directHit, int componentIndex, string surface, vector pos, int impact_type, vector surfNormal, vector exitPos, vector inSpeed, vector outSpeed, bool deflected, string ammoType, bool isWater)

References EvaluateImpactEffect().

Referenced by CGame::CloseCombatEffects(), and CGame::FirearmEffects().

◆ GetImpactEffect()

static ImpactMaterials::GetImpactEffect ( string surface,
string ammoType )
inlinestaticprivate

Definition at line 123 of file ImpactEffects.c.

124 {
125 string key = string.Format("%1_%2", surface, ammoType);
126
127 typename eff_type = m_ImpactEffect[key];
128
129 if (eff_type)
130 return eff_type;
131 else
132 return m_ImpactEffect[surface];
133 }
static ref map< string, typename > m_ImpactEffect

References m_ImpactEffect.

Referenced by EvaluateImpactEffect().

◆ RegisterIgnoredAmmo()

static int ImpactMaterials::RegisterIgnoredAmmo ( string ammo)
inlinestaticprivate

Definition at line 100 of file ImpactEffects.c.

101 {
102 if (!m_IgnoredAmmo)
104
106
108
110 }
static int m_LastRegisteredIgnoredAmmo

References m_IgnoredAmmo, and m_LastRegisteredIgnoredAmmo.

◆ RegisterSurface()

static int ImpactMaterials::RegisterSurface ( string surface)
inlinestaticprivate

Definition at line 79 of file ImpactEffects.c.

80 {
81 if (!m_ImpactEffect)
83
84 m_ImpactEffect.Insert(surface, surface.ToType());
85
87 }
static int m_LastRegisteredMaterial

References m_ImpactEffect, m_LastRegisteredMaterial, and string::ToType().

Referenced by EvaluateImpactEffect().

◆ UnregisterIgnoredAmmo()

static bool ImpactMaterials::UnregisterIgnoredAmmo ( string ammo)
inlinestaticprivate

Definition at line 112 of file ImpactEffects.c.

113 {
114 if (m_IgnoredAmmo)
115 {
116 m_IgnoredAmmo.Remove(ammo);
117 return !m_IgnoredAmmo.Contains(ammo);
118 }
119
120 return false;
121 }

References m_IgnoredAmmo.

◆ UnregisterSurface()

static bool ImpactMaterials::UnregisterSurface ( string surface)
inlinestaticprivate

Definition at line 89 of file ImpactEffects.c.

90 {
92 {
93 m_ImpactEffect.Remove(surface);
94 return !m_ImpactEffect.Contains(surface);
95 }
96
97 return false;
98 }

References m_ImpactEffect.

Member Data Documentation

◆ CONCRETE

int ImpactMaterials::CONCRETE = RegisterSurface("Hit_Concrete")
staticprivate

Definition at line 45 of file ImpactEffects.c.

◆ DIRT

int ImpactMaterials::DIRT = RegisterSurface("Hit_Dirt")
staticprivate

Definition at line 47 of file ImpactEffects.c.

◆ DUMMY

int ImpactMaterials::DUMMY = RegisterIgnoredAmmo("Dummy_Light")
staticprivate

Definition at line 75 of file ImpactEffects.c.

◆ DUMMY_HEAVY

int ImpactMaterials::DUMMY_HEAVY = RegisterIgnoredAmmo("Dummy_Heavy")
staticprivate

Definition at line 76 of file ImpactEffects.c.

◆ ERROR_NO_MATERIAL

int ImpactMaterials::ERROR_NO_MATERIAL = RegisterSurface("Hit_ErrorNoMaterial")
staticprivate

Definition at line 63 of file ImpactEffects.c.

◆ FIST

int ImpactMaterials::FIST = RegisterIgnoredAmmo("MeleeFist")
staticprivate

Definition at line 71 of file ImpactEffects.c.

◆ FIST_HEAVY

int ImpactMaterials::FIST_HEAVY = RegisterIgnoredAmmo("MeleeFist_Heavy")
staticprivate

Definition at line 72 of file ImpactEffects.c.

◆ FOLIAGE

int ImpactMaterials::FOLIAGE = RegisterSurface("Hit_Foliage")
staticprivate

Definition at line 48 of file ImpactEffects.c.

◆ GLASS

int ImpactMaterials::GLASS = RegisterSurface("Hit_Glass")
staticprivate

Definition at line 52 of file ImpactEffects.c.

◆ GLASS_THIN

int ImpactMaterials::GLASS_THIN = RegisterSurface("Hit_Glass_Thin")
staticprivate

Definition at line 53 of file ImpactEffects.c.

◆ GRASS

int ImpactMaterials::GRASS = RegisterSurface("Hit_Grass")
staticprivate

Definition at line 49 of file ImpactEffects.c.

◆ GRAVEL

int ImpactMaterials::GRAVEL = RegisterSurface("Hit_Gravel")
staticprivate

Definition at line 46 of file ImpactEffects.c.

◆ m_IgnoredAmmo

ref map<string, int> ImpactMaterials::m_IgnoredAmmo
staticprivate

Map of ammo which will not spawn any impact effect.

Definition at line 34 of file ImpactEffects.c.

Referenced by EvaluateImpactEffect(), RegisterIgnoredAmmo(), and UnregisterIgnoredAmmo().

◆ m_ImpactEffect

ref map<string, typename> ImpactMaterials::m_ImpactEffect
staticprivate

Definition at line 30 of file ImpactEffects.c.

Referenced by GetImpactEffect(), RegisterSurface(), and UnregisterSurface().

◆ m_LastRegisteredIgnoredAmmo

int ImpactMaterials::m_LastRegisteredIgnoredAmmo = 0
staticprivate

Definition at line 35 of file ImpactEffects.c.

Referenced by RegisterIgnoredAmmo().

◆ m_LastRegisteredMaterial

int ImpactMaterials::m_LastRegisteredMaterial = 0
staticprivate

Definition at line 31 of file ImpactEffects.c.

Referenced by RegisterSurface().

◆ MEATBONES

int ImpactMaterials::MEATBONES = RegisterSurface("Hit_MeatBones")
staticprivate

Definition at line 57 of file ImpactEffects.c.

◆ MEATBONES_FIST

int ImpactMaterials::MEATBONES_FIST = RegisterSurface("Hit_MeatBones_MeleeFist")
staticprivate

Definition at line 61 of file ImpactEffects.c.

◆ MEATBONES_PIPEWRENCH

int ImpactMaterials::MEATBONES_PIPEWRENCH = RegisterSurface("Hit_MeatBones_MeleePipeWrench")
staticprivate

Definition at line 59 of file ImpactEffects.c.

◆ MEATBONES_SHOVEL

int ImpactMaterials::MEATBONES_SHOVEL = RegisterSurface("Hit_MeatBones_MeleeShovel")
staticprivate

Definition at line 58 of file ImpactEffects.c.

◆ MEATBONES_WRENCH

int ImpactMaterials::MEATBONES_WRENCH = RegisterSurface("Hit_MeatBones_MeleeWrench")
staticprivate

Definition at line 60 of file ImpactEffects.c.

◆ METAL

int ImpactMaterials::METAL = RegisterSurface("Hit_Metal")
staticprivate

Definition at line 51 of file ImpactEffects.c.

◆ PLASTER

int ImpactMaterials::PLASTER = RegisterSurface("Hit_Plaster")
staticprivate

Definition at line 56 of file ImpactEffects.c.

◆ PLASTIC

int ImpactMaterials::PLASTIC = RegisterSurface("Hit_Plastic")
staticprivate

Definition at line 42 of file ImpactEffects.c.

◆ RUBBER

int ImpactMaterials::RUBBER = RegisterSurface("Hit_Rubber")
staticprivate

Definition at line 55 of file ImpactEffects.c.

◆ SAND

int ImpactMaterials::SAND = RegisterSurface("Hit_Sand")
staticprivate

Definition at line 43 of file ImpactEffects.c.

◆ SOFT

int ImpactMaterials::SOFT = RegisterIgnoredAmmo("MeleeSoft")
staticprivate

Definition at line 73 of file ImpactEffects.c.

◆ SOFT_HEAVY

int ImpactMaterials::SOFT_HEAVY = RegisterIgnoredAmmo("MeleeSoft_Heavy")
staticprivate

Definition at line 74 of file ImpactEffects.c.

◆ TEXTILE

int ImpactMaterials::TEXTILE = RegisterSurface("Hit_Textile")
staticprivate

Definition at line 44 of file ImpactEffects.c.

◆ UNDEFINED

int ImpactMaterials::UNDEFINED = RegisterSurface("Hit_Undefined")
staticprivate

Definition at line 62 of file ImpactEffects.c.

◆ WATER

int ImpactMaterials::WATER = RegisterSurface("Hit_Water")
staticprivate

Definition at line 54 of file ImpactEffects.c.

◆ WOOD

int ImpactMaterials::WOOD = RegisterSurface("Hit_Wood")
staticprivate

Definition at line 50 of file ImpactEffects.c.


The documentation for this class was generated from the following file: