1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-07 21:59:49 -05:00
BO2-Reimagined/scripts/zm/replaced/_zm_equip_electrictrap.gsc
Jbleezy 772a713a39 Electric Trap: remove zombie death explosion
Electric Trap: remove wait before kill
2024-04-12 15:49:19 -07:00

117 lines
2.7 KiB
Plaintext

#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\zombies\_zm_utility;
startelectrictrapdeploy(weapon)
{
self endon("death");
self endon("disconnect");
self endon("equip_electrictrap_zm_taken");
self thread maps\mp\zombies\_zm_equip_electrictrap::watchforcleanup();
electricradius = 45;
if (!isDefined(self.electrictrap_health))
{
self.electrictrap_health = 30;
}
if (isDefined(weapon))
{
wait 0.5;
self trap_power_on(weapon);
self thread maps\mp\zombies\_zm_equip_electrictrap::electrictrapthink(weapon, electricradius);
self thread electrictrapdecay(weapon);
self thread maps\mp\zombies\_zm_buildables::delete_on_disconnect(weapon);
weapon waittill("death");
if (isDefined(weapon.electrap_sound_ent))
{
weapon.electrap_sound_ent playsound("wpn_zmb_electrap_stop");
weapon.electrap_sound_ent delete();
weapon.electrap_sound_ent = undefined;
}
self notify("etrap_cleanup");
}
}
trap_power_on(weapon)
{
weapon.power_on = 1;
weapon.power_on_time = getTime() - 2000; // ::electrictrapthink doesn't start until after 2 seconds
weapon notify("stop_attracting_zombies");
if (!isDefined(weapon.electrap_sound_ent))
{
weapon.electrap_sound_ent = spawn("script_origin", weapon.origin);
}
weapon.electrap_sound_ent playsound("wpn_zmb_electrap_start");
weapon.electrap_sound_ent playloopsound("wpn_zmb_electrap_loop", 2);
weapon thread maps\mp\zombies\_zm_equip_electrictrap::trapfx();
}
electrictrapdecay(weapon)
{
self endon("death");
self endon("disconnect");
self endon("equip_electrictrap_zm_taken");
while (isDefined(weapon))
{
if (weapon.power_on)
{
self.electrictrap_health--;
if (self.electrictrap_health <= 0)
{
maps\mp\zombies\_zm_equipment::equipment_disappear_fx(weapon.origin, undefined, weapon.angles);
self maps\mp\zombies\_zm_equip_electrictrap::cleanupoldtrap();
self.electrictrap_health = undefined;
self thread maps\mp\zombies\_zm_equipment::equipment_release(level.electrictrap_name);
return;
}
}
wait 1;
}
}
cleanupoldtrap()
{
if (isDefined(self.buildableelectrictrap))
{
if (isDefined(self.buildableelectrictrap.stub))
{
thread maps\mp\zombies\_zm_unitrigger::unregister_unitrigger(self.buildableelectrictrap.stub);
self.buildableelectrictrap.stub = undefined;
}
if (isDefined(self.buildableelectrictrap.electrap_sound_ent))
{
self.buildableelectrictrap.electrap_sound_ent delete();
self.buildableelectrictrap.electrap_sound_ent = undefined;
}
self.buildableelectrictrap delete();
self.electrictrap_health = undefined;
}
}
electrictrapkill(weapon)
{
self endon("death");
self.is_on_fire = 0;
self notify("stop_flame_damage");
self dodamage(self.health + 666, self.origin);
}
etrap_choke()
{
// no choke
}