147 {
148
150 return;
151
154
155 if (deflected)
157 else if (outSpeed)
159
160 if (isWater)
161 surface = "Hit_Water";
162
164
165 if ( !eff && surface == "" )
166 {
167 eff = EffBulletImpactBase.Cast( surface.
ToType().Spawn() );
168
169 if (eff)
170 {
172 ErrorEx(
string.Format(
"Unregistered surface for bullet impact effect (%1). Register this surface in ImpactMaterials (Script) for better performance.", surface),
ErrorExSeverity.WARNING);
173 }
174 else
175 {
176 if (directHit)
177 {
178 string object_type = directHit.GetType();
179
180 if ( object_type == "" )
181 object_type = "OBJECT_WITHOUT_CONFIG_CLASS";
182
183 ErrorEx(
string.Format(
"Object '%1' with model file: %2 has undefined 'Hit_...' material! Cannot play impact effect.", object_type, directHit.GetShapeName()));
185 }
186 }
187 }
188
189 if ( !eff && surface != "" )
190 {
191 ErrorEx(
string.Format(
"Unregistered surface impact material <%1>! Register this surface in ImpactMaterials (Script).", surface));
193 }
194
195 if (eff)
196 {
197 eff.
EvaluateEffect(directHit, componentIndex, pos, impact_type, surfNormal, exitPos, inSpeed, outSpeed,
ammoType);
198 eff.SetAutodestroy(true);
199 SEffectManager.PlayInWorld(eff, pos);
200 }
201 }
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...