3 static const int RAYCAST_SOURCES_COUNT = 5;
6 static const vector m_RaycastSources[RAYCAST_SOURCES_COUNT] = {
32 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
45 super.CreateTrigger();
47 vector mins =
"-0.1 -0.05 -0.1";
48 vector maxs =
"0.1 0.4 0.1";
57 if (victim && victim.IsInherited(
CarScript))
69 if (
GetGame().IsServer() && victim)
71 if (!victim.GetAllowDamage())
77 Param1<EntityAI> params =
new Param1<EntityAI>(victim);
84 foreach (
vector raycastSourcePosition: m_RaycastSources)
86 vector raycastStart = ModelToWorld(raycastSourcePosition);
87 vector raycastEnd =
"0 0.5 0" + raycastStart;
91 rayInput.type = ObjIntersectFire;
92 rayInput.radius = 0.05;
99 if (result.obj && !result.obj.IsDamageDestroyed() && !result.obj.IsAnyInherited({ItemBase, Plant}))
101 OnServerSteppedOn(result.obj, result.obj.GetDamageZoneNameByComponentIndex(result.component));
111 else if (!
GetGame().IsDedicatedServer())
117 victim.SpawnDamageDealtEffect();
140 obj.ProcessDirectDamage(
DamageType.CLOSE_COMBAT,
this, damageZone,
"BearTrapHit_CarWheel",
"0 0 0", 1);
152 if (obj.IsDamageDestroyed())
155 string zoneUsed = damageZone;
156 if (damageZone ==
"zone_leg_random")
158 zoneUsed =
"LeftLeg";
159 if (
Math.RandomIntInclusive(0, 1) == 1)
160 zoneUsed =
"RightLeg";
165 if (obj.IsInherited(
PlayerBase) || (
Class.CastTo(zombie,obj) && !zombie.IsCrawling() &&
Math.RandomIntInclusive(0, 1) == 1))
167 CauseVictimToStartLimping(obj,
"");
170 obj.ProcessDirectDamage(
DamageType.CLOSE_COMBAT,
this, zoneUsed,
"BearTrapHit",
"0 0 0", 1);
177 void CauseVictimToStartLimping(
Object obj,
string damagedZone)
181 if (
Class.CastTo(player,obj))
183 player.DamageAllLegs(player.GetMaxHealth() * 2);
185 else if (
Class.CastTo(zombie,obj))
187 zombie.SetHealth(
"LeftLeg",
"Health", 0.0);
188 zombie.SetHealth(
"RightLeg",
"Health", 0.0);
192 void PlaySoundBiteLeg()
195 sound.SetAutodestroy(
true);
198 void PlaySoundBiteEmpty()
201 sound.SetAutodestroy(
true);
207 sound.SetAutodestroy(
true);
220 PlaySoundBiteEmpty();
230 super.OnPlacementComplete(player, position, orientation);
246 return "beartrap_deploy_SoundSet";
269 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
275 super.GetDebugActions(outputList);
280 if (super.OnAction(action_id, player, ctx))
284 if (action_id ==
EActions.ACTIVATE_ENTITY)
288 else if (action_id ==
EActions.DEACTIVATE_ENTITY)