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