146 {
147
149 return;
150
153
154 if (deflected)
156 else if (outSpeed)
158
159 if (isWater)
160 surface = "Hit_Water";
161
163
164 if ( !eff && surface == "" )
165 {
166 eff = EffBulletImpactBase.Cast( surface.
ToType().Spawn() );
167
168 if (eff)
169 {
171 ErrorEx(
string.Format(
"Unregistered surface for bullet impact effect (%1). Register this surface in ImpactMaterials (Script) for better performance.", surface),
ErrorExSeverity.WARNING);
172 }
173 else
174 {
175 if (directHit)
176 {
177 string object_type = directHit.GetType();
178
179 if ( object_type == "" )
180 object_type = "OBJECT_WITHOUT_CONFIG_CLASS";
181
182 ErrorEx(
string.Format(
"Object '%1' with model file: %2 has undefined 'Hit_...' material! Cannot play impact effect.", object_type, directHit.GetShapeName()));
184 }
185 }
186 }
187
188 if ( !eff && surface != "" )
189 {
190 ErrorEx(
string.Format(
"Unregistered surface impact material <%1>! Register this surface in ImpactMaterials (Script).", surface));
192 }
193
194 if (eff)
195 {
196 eff.
EvaluateEffect(directHit, componentIndex, pos, impact_type, surfNormal, exitPos, inSpeed, outSpeed, ammoType);
197 eff.SetAutodestroy(true);
198 SEffectManager.PlayInWorld(eff, pos);
199 }
200 }
void Spawn()
spawn damage trigger
void EvaluateEffect(Object directHit, int componentIndex, vector pos, int impact_type, vector surfNormal, vector exitPos, vector inSpeed, vector outSpeed, string ammoType)
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.
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...