From 096693cb3727f2967a57ccb8fd48357b88c6db63 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Mon, 24 Jan 2022 23:35:12 -0800 Subject: [PATCH] Claymore: can be repurchased --- README.md | 5 +- scripts/zm/_zm_reimagined.gsc | 13 ++++ scripts/zm/replaced/_zm_weap_claymore.gsc | 82 +++++++++++++++++++++++ scripts/zm/replaced/utility.gsc | 4 +- 4 files changed, 101 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ff135169..1428bf10 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,9 @@ * Decreased zombie EMP radius by 30% (same radius as perk EMP) * Sprinting no longer wakes up EMP'd zombies +### Claymore +* Can be repurchased + ### Ray Gun * Unupgraded: increased impact damage from 1000 to 1500 (same as max splash damage) * Upgraded: increased impact damage from 1000 to 2000 (same as max splash damage) @@ -201,7 +204,7 @@ ### Mule Kick * Added additional weapon indicator -* Additional weapon is given back when perk is repurchased +* Additional weapon is given back when perk is reacquired * Stowed weapons refill ammo from stock over time ### Tombstone Soda diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index 1687ba64..98975291 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -229,6 +229,7 @@ post_all_players_spawned() wallbuy_increase_trigger_radius(); wallbuy_decrease_upgraded_ammo_cost(); + wallbuy_claymore_changes(); wallbuy_location_changes(); zone_changes(); @@ -2158,6 +2159,18 @@ wallbuy_decrease_upgraded_ammo_cost() } } +wallbuy_claymore_changes() +{ + for(i = 0; i < level._unitriggers.trigger_stubs.size; i++) + { + if(isDefined(level._unitriggers.trigger_stubs[i].zombie_weapon_upgrade) && level._unitriggers.trigger_stubs[i].zombie_weapon_upgrade == "claymore_zm") + { + level._unitriggers.trigger_stubs[i].prompt_and_visibility_func = scripts/zm/replaced/_zm_weap_claymore::claymore_unitrigger_update_prompt; + level._unitriggers.trigger_stubs[i].trigger_func = scripts/zm/replaced/_zm_weap_claymore::buy_claymores; + } + } +} + weapon_spawn_think() { cost = maps/mp/zombies/_zm_weapons::get_weapon_cost( self.zombie_weapon_upgrade ); diff --git a/scripts/zm/replaced/_zm_weap_claymore.gsc b/scripts/zm/replaced/_zm_weap_claymore.gsc index b36bbf82..029ad83f 100644 --- a/scripts/zm/replaced/_zm_weap_claymore.gsc +++ b/scripts/zm/replaced/_zm_weap_claymore.gsc @@ -3,6 +3,88 @@ #include maps\mp\zombies\_zm_utility; #include maps/mp/zombies/_zm_weap_claymore; +buy_claymores() +{ + self.zombie_cost = 1000; + self sethintstring( &"ZOMBIE_CLAYMORE_PURCHASE" ); + self setcursorhint( "HINT_WEAPON", "claymore_zm" ); + self endon( "kill_trigger" ); + if ( !isDefined( self.stub ) ) + { + return; + } + if ( isDefined( self.stub ) && !isDefined( self.stub.claymores_triggered ) ) + { + self.stub.claymores_triggered = 0; + } + self.claymores_triggered = self.stub.claymores_triggered; + while ( 1 ) + { + self waittill( "trigger", who ); + while ( who in_revive_trigger() ) + { + continue; + } + while ( who has_powerup_weapon() ) + { + wait 0.1; + } + if ( is_player_valid( who ) ) + { + if ( who.score >= self.zombie_cost ) + { + if ( !who is_player_placeable_mine( "claymore_zm" ) || who getWeaponAmmoStock( "claymore_zm" ) < 2 ) + { + play_sound_at_pos( "purchase", self.origin ); + who maps/mp/zombies/_zm_score::minus_to_player_score( self.zombie_cost ); + if ( !who is_player_placeable_mine( "claymore_zm" ) ) + { + who thread show_claymore_hint( "claymore_purchased" ); + } + who thread claymore_setup(); + who thread maps/mp/zombies/_zm_audio::create_and_play_dialog( "weapon_pickup", "grenade" ); + if ( isDefined( self.stub ) ) + { + self.claymores_triggered = self.stub.claymores_triggered; + } + if ( self.claymores_triggered == 0 ) + { + model = getent( self.target, "targetname" ); + if ( isDefined( model ) ) + { + model thread maps/mp/zombies/_zm_weapons::weapon_show( who ); + } + else + { + if ( isDefined( self.clientfieldname ) ) + { + level setclientfield( self.clientfieldname, 1 ); + } + } + self.claymores_triggered = 1; + if ( isDefined( self.stub ) ) + { + self.stub.claymores_triggered = 1; + } + } + } + } + else + { + who play_sound_on_ent( "no_purchase" ); + who maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "no_money_weapon" ); + } + } + } +} + +claymore_unitrigger_update_prompt( player ) +{ + self sethintstring( &"ZOMBIE_CLAYMORE_PURCHASE" ); + self setcursorhint( "HINT_WEAPON", "claymore_zm" ); + return 1; +} + claymore_detonation() { self endon( "death" ); diff --git a/scripts/zm/replaced/utility.gsc b/scripts/zm/replaced/utility.gsc index 5e2d3d9c..8380e4f6 100644 --- a/scripts/zm/replaced/utility.gsc +++ b/scripts/zm/replaced/utility.gsc @@ -280,8 +280,8 @@ wallbuy( weapon_name, target, targetname, origin, angles ) wallmodel.angles += (0, 90, 0); wallmodel.script_int = 90; // fix for model sliding right to left - unitrigger_stub.prompt_and_visibility_func = ::claymore_unitrigger_update_prompt; - maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, ::buy_claymores ); + unitrigger_stub.prompt_and_visibility_func = scripts/zm/replaced/_zm_weap_claymore::claymore_unitrigger_update_prompt; + maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, scripts/zm/replaced/_zm_weap_claymore::buy_claymores ); } else {