mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-10 15:17:57 -05:00
Craftables: add purchase cost
This commit is contained in:
@ -2714,9 +2714,9 @@ buildbuildable( buildable, craft )
|
||||
{
|
||||
if ( isDefined( buildable ) || stub.persistent != 3 )
|
||||
{
|
||||
displayname = stub get_equipment_display_name();
|
||||
hint_string = stub get_equipment_hint_string();
|
||||
stub.cost = stub get_equipment_cost();
|
||||
stub.trigger_hintstring = "Hold ^3[{+activate}]^7 for " + displayname + " [Cost: " + stub.cost + "]";
|
||||
stub.trigger_hintstring = hint_string + " [Cost: " + stub.cost + "]";
|
||||
stub.trigger_func = ::buildable_place_think;
|
||||
|
||||
if (craft)
|
||||
@ -2728,7 +2728,7 @@ buildbuildable( buildable, craft )
|
||||
}
|
||||
else
|
||||
{
|
||||
level.zombie_buildables[stub.equipname].hint = "Hold ^3[{+activate}]^7 to craft " + displayname;
|
||||
level.zombie_buildables[stub.equipname].hint = "Hold ^3[{+activate}]^7 to craft " + stub get_equipment_display_name();
|
||||
stub.prompt_and_visibility_func = ::buildabletrigger_update_prompt;
|
||||
}
|
||||
|
||||
@ -2749,6 +2749,20 @@ buildbuildable( buildable, craft )
|
||||
}
|
||||
}
|
||||
|
||||
get_equipment_hint_string()
|
||||
{
|
||||
if (self.equipname == "packasplat")
|
||||
{
|
||||
return "Hold ^3[{+activate}]^7 to convert Blundergat into Acidgat";
|
||||
}
|
||||
else if (self.equipname == "equip_dieseldrone_zm")
|
||||
{
|
||||
return "Hold ^3[{+activate}]^7 to take the Maxis Drone";
|
||||
}
|
||||
|
||||
return "Hold ^3[{+activate}]^7 for " + get_equipment_display_name();
|
||||
}
|
||||
|
||||
get_equipment_display_name()
|
||||
{
|
||||
if (self.equipname == "turbine")
|
||||
@ -2763,7 +2777,7 @@ get_equipment_display_name()
|
||||
{
|
||||
return "Electric Trap";
|
||||
}
|
||||
else if (self.equipname == "riotshield_zm")
|
||||
else if (self.equipname == "riotshield_zm" || self.equipname == "alcatraz_shield_zm" || self.equipname == "tomb_shield_zm")
|
||||
{
|
||||
return "Zombie Shield";
|
||||
}
|
||||
@ -2803,6 +2817,10 @@ get_equipment_cost()
|
||||
{
|
||||
return 10000;
|
||||
}
|
||||
else if (self.equipname == "packasplat")
|
||||
{
|
||||
return 2500;
|
||||
}
|
||||
|
||||
return 1000;
|
||||
}
|
||||
@ -3455,9 +3473,9 @@ updatebuildables()
|
||||
{
|
||||
if(IsDefined(stub.equipname))
|
||||
{
|
||||
displayname = stub get_equipment_display_name();
|
||||
stub.cost = 1000;
|
||||
stub.trigger_hintstring = "Hold ^3[{+activate}]^7 for " + displayname + " [Cost: " + stub.cost + "]";
|
||||
hint_string = stub get_equipment_hint_string();
|
||||
stub.cost = stub get_equipment_cost();
|
||||
stub.trigger_hintstring = hint_string + " [Cost: " + stub.cost + "]";
|
||||
stub.trigger_func = ::buildable_place_think;
|
||||
}
|
||||
}
|
||||
|
120
scripts/zm/replaced/zm_alcatraz_utility.gsc
Normal file
120
scripts/zm/replaced/zm_alcatraz_utility.gsc
Normal file
@ -0,0 +1,120 @@
|
||||
#include maps\mp\_utility;
|
||||
#include common_scripts\utility;
|
||||
#include maps\mp\zombies\_zm_utility;
|
||||
#include maps\mp\zm_alcatraz_utility;
|
||||
#include maps\mp\zombies\_zm_craftables;
|
||||
|
||||
#using_animtree("fxanim_props");
|
||||
|
||||
blundergat_upgrade_station()
|
||||
{
|
||||
t_upgrade = getent( "blundergat_upgrade", "targetname" );
|
||||
t_upgrade.equipname = "packasplat";
|
||||
t_upgrade.cost = t_upgrade scripts\zm\_zm_reimagined::get_equipment_cost();
|
||||
t_upgrade sethintstring( &"ZM_PRISON_CONVERT_START", " [Cost: " + t_upgrade.cost + "]" );
|
||||
waittill_crafted( "packasplat" );
|
||||
m_converter = t_upgrade.m_upgrade_machine;
|
||||
v_angles = m_converter gettagangles( "tag_origin" );
|
||||
v_weapon_origin_offset = anglestoforward( v_angles ) * 1 + anglestoright( v_angles ) * 10 + anglestoup( v_angles ) * 1.75;
|
||||
v_weapon_angles_offset = ( 0, 90, -90 );
|
||||
m_converter.v_weapon_origin = m_converter gettagorigin( "tag_origin" ) + v_weapon_origin_offset;
|
||||
m_converter.v_weapon_angles = v_angles + v_weapon_angles_offset;
|
||||
m_converter useanimtree( #animtree );
|
||||
m_converter.fxanims["close"] = %fxanim_zom_al_packasplat_start_anim;
|
||||
m_converter.fxanims["inject"] = %fxanim_zom_al_packasplat_idle_anim;
|
||||
m_converter.fxanims["open"] = %fxanim_zom_al_packasplat_end_anim;
|
||||
m_converter.n_start_time = getanimlength( m_converter.fxanims["close"] );
|
||||
m_converter.n_idle_time = getanimlength( m_converter.fxanims["inject"] );
|
||||
m_converter.n_end_time = getanimlength( m_converter.fxanims["open"] );
|
||||
|
||||
while ( true )
|
||||
{
|
||||
t_upgrade thread blundergat_change_hintstring( &"ZM_PRISON_CONVERT_START", " [Cost: " + t_upgrade.cost + "]" );
|
||||
|
||||
t_upgrade waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = t_upgrade [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
str_valid_weapon = undefined;
|
||||
|
||||
if ( player hasweapon( "blundergat_zm" ) )
|
||||
str_valid_weapon = "blundergat_zm";
|
||||
else if ( player hasweapon( "blundergat_upgraded_zm" ) )
|
||||
str_valid_weapon = "blundergat_upgraded_zm";
|
||||
|
||||
if (player.score < t_upgrade.cost)
|
||||
{
|
||||
self play_sound_on_ent( "no_purchase" );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isdefined( str_valid_weapon ) )
|
||||
{
|
||||
player maps\mp\zombies\_zm_score::minus_to_player_score( t_upgrade.cost );
|
||||
t_upgrade play_sound_on_ent( "purchase" );
|
||||
|
||||
player takeweapon( str_valid_weapon );
|
||||
player.is_pack_splatting = 1;
|
||||
t_upgrade setinvisibletoall();
|
||||
m_converter.worldgun = spawn_weapon_model( str_valid_weapon, undefined, m_converter.v_weapon_origin, m_converter.v_weapon_angles );
|
||||
m_converter blundergat_upgrade_station_inject( str_valid_weapon );
|
||||
t_upgrade thread blundergat_change_hintstring( &"ZM_PRISON_CONVERT_PICKUP" );
|
||||
|
||||
if ( isdefined( player ) )
|
||||
{
|
||||
t_upgrade setvisibletoplayer( player );
|
||||
t_upgrade thread wait_for_player_to_take( player, str_valid_weapon );
|
||||
}
|
||||
|
||||
t_upgrade thread wait_for_timeout();
|
||||
t_upgrade waittill_any( "acid_timeout", "acid_taken" );
|
||||
|
||||
if ( isdefined( player ) )
|
||||
player.is_pack_splatting = undefined;
|
||||
|
||||
m_converter.worldgun delete();
|
||||
wait 0.5;
|
||||
t_upgrade setvisibletoall();
|
||||
}
|
||||
else
|
||||
{
|
||||
t_upgrade thread blundergat_change_hintstring( &"ZM_PRISON_MISSING_BLUNDERGAT" );
|
||||
wait 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blundergat_change_hintstring( hint_string, hint_string_cost )
|
||||
{
|
||||
self notify( "new_change_hint_string" );
|
||||
self endon( "new_change_hint_string" );
|
||||
|
||||
while ( isdefined( self.is_locked ) && self.is_locked )
|
||||
wait 0.05;
|
||||
|
||||
if (isDefined(hint_string_cost))
|
||||
{
|
||||
self sethintstring( hint_string, hint_string_cost );
|
||||
}
|
||||
else
|
||||
{
|
||||
self sethintstring( hint_string );
|
||||
}
|
||||
|
||||
wait 0.05;
|
||||
|
||||
if (isDefined(hint_string_cost))
|
||||
{
|
||||
self sethintstring( hint_string, hint_string_cost );
|
||||
}
|
||||
else
|
||||
{
|
||||
self sethintstring( hint_string );
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#include maps\mp\_utility;
|
||||
#include common_scripts\utility;
|
||||
#include maps\mp\zombies\_zm_utility;
|
||||
#include maps\mp\zombies\_zm_craftables;
|
||||
#include maps\mp\zm_alcatraz_utility;
|
||||
|
||||
#include scripts\zm\replaced\zm_alcatraz_classic;
|
||||
@ -12,6 +13,7 @@
|
||||
main()
|
||||
{
|
||||
replaceFunc(maps\mp\zm_alcatraz_classic::give_afterlife, scripts\zm\replaced\zm_alcatraz_classic::give_afterlife);
|
||||
replaceFunc(maps\mp\zm_alcatraz_utility::blundergat_upgrade_station, scripts\zm\replaced\zm_alcatraz_utility::blundergat_upgrade_station);
|
||||
replaceFunc(maps\mp\zm_alcatraz_weap_quest::wolf_spit_out_powerup, scripts\zm\replaced\zm_alcatraz_weap_quest::wolf_spit_out_powerup);
|
||||
replaceFunc(maps\mp\zombies\_zm_afterlife::afterlife_add, scripts\zm\replaced\_zm_afterlife::afterlife_add);
|
||||
replaceFunc(maps\mp\zombies\_zm_ai_brutus::brutus_spawn, scripts\zm\replaced\_zm_ai_brutus::brutus_spawn);
|
||||
@ -46,6 +48,7 @@ init()
|
||||
plane_set_pieces_shared();
|
||||
|
||||
level thread plane_auto_refuel();
|
||||
level thread updatecraftables();
|
||||
}
|
||||
|
||||
zombie_init_done()
|
||||
@ -319,4 +322,277 @@ plane_auto_refuel()
|
||||
|
||||
scripts\zm\_zm_reimagined::buildcraftable( "refuelable_plane" );
|
||||
}
|
||||
}
|
||||
|
||||
updatecraftables()
|
||||
{
|
||||
flag_wait( "start_zombie_round_logic" );
|
||||
|
||||
wait 1;
|
||||
|
||||
foreach (stub in level._unitriggers.trigger_stubs)
|
||||
{
|
||||
if(IsDefined(stub.equipname))
|
||||
{
|
||||
hint_string = stub scripts\zm\_zm_reimagined::get_equipment_hint_string();
|
||||
stub.cost = stub scripts\zm\_zm_reimagined::get_equipment_cost();
|
||||
stub.trigger_hintstring = hint_string + " [Cost: " + stub.cost + "]";
|
||||
stub.trigger_func = ::craftable_place_think;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
craftable_place_think()
|
||||
{
|
||||
self endon( "kill_trigger" );
|
||||
player_crafted = undefined;
|
||||
|
||||
while ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
status = player player_can_craft( self.stub.craftablespawn );
|
||||
|
||||
if ( !status )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
|
||||
if ( isdefined( self.stub.oncantuse ) )
|
||||
self.stub [[ self.stub.oncantuse ]]( player );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isdefined( self.stub.onbeginuse ) )
|
||||
self.stub [[ self.stub.onbeginuse ]]( player );
|
||||
|
||||
result = self craftable_use_hold_think( player );
|
||||
team = player.pers["team"];
|
||||
|
||||
if ( isdefined( self.stub.onenduse ) )
|
||||
self.stub [[ self.stub.onenduse ]]( team, player, result );
|
||||
|
||||
if ( !result )
|
||||
continue;
|
||||
|
||||
if ( isdefined( self.stub.onuse ) )
|
||||
self.stub [[ self.stub.onuse ]]( player );
|
||||
|
||||
prompt = player player_craft( self.stub.craftablespawn );
|
||||
player_crafted = player;
|
||||
self.stub.hint_string = prompt;
|
||||
self sethintstring( self.stub.hint_string );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.craftablestub.onfullycrafted ) )
|
||||
{
|
||||
b_result = self.stub [[ self.stub.craftablestub.onfullycrafted ]]();
|
||||
|
||||
if ( !b_result )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( player_crafted ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 0 )
|
||||
{
|
||||
self.stub craftablestub_remove();
|
||||
thread maps\mp\zombies\_zm_unitrigger::unregister_unitrigger( self.stub );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 3 )
|
||||
{
|
||||
stub_uncraft_craftable( self.stub, 1 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 2 )
|
||||
{
|
||||
if ( isdefined( player_crafted ) )
|
||||
self craftabletrigger_update_prompt( player_crafted );
|
||||
|
||||
if ( !maps\mp\zombies\_zm_weapons::limited_weapon_below_quota( self.stub.weaponname, undefined ) )
|
||||
{
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.str_taken ) && self.stub.str_taken )
|
||||
{
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.model ) )
|
||||
{
|
||||
self.stub.model notsolid();
|
||||
self.stub.model show();
|
||||
}
|
||||
|
||||
while ( self.stub.persistent == 2 )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
self.stub.bought = 1;
|
||||
|
||||
if ( isdefined( self.stub.model ) )
|
||||
self.stub.model thread model_fly_away( self );
|
||||
|
||||
player maps\mp\zombies\_zm_weapons::weapon_give( self.stub.weaponname );
|
||||
|
||||
if ( isdefined( level.zombie_include_craftables[self.stub.equipname].onbuyweapon ) )
|
||||
self [[ level.zombie_include_craftables[self.stub.equipname].onbuyweapon ]]( player );
|
||||
|
||||
if ( !maps\mp\zombies\_zm_weapons::limited_weapon_below_quota( self.stub.weaponname, undefined ) )
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED";
|
||||
else
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX";
|
||||
|
||||
self sethintstring( self.stub.hint_string );
|
||||
player track_craftables_pickedup( self.stub.craftablespawn );
|
||||
}
|
||||
}
|
||||
else if ( !isdefined( player_crafted ) || self craftabletrigger_update_prompt( player_crafted ) )
|
||||
{
|
||||
if ( isdefined( self.stub.model ) )
|
||||
{
|
||||
self.stub.model notsolid();
|
||||
self.stub.model show();
|
||||
}
|
||||
|
||||
while ( self.stub.persistent == 1 )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.score < self.stub.cost)
|
||||
{
|
||||
self play_sound_on_ent( "no_purchase" );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( player has_player_equipment( self.stub.weaponname ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.zombie_craftable_persistent_weapon ) )
|
||||
{
|
||||
if ( self [[ level.zombie_craftable_persistent_weapon ]]( player ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isdefined( level.zombie_custom_equipment_setup ) )
|
||||
{
|
||||
if ( self [[ level.zombie_custom_equipment_setup ]]( player ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !maps\mp\zombies\_zm_equipment::is_limited_equipment( self.stub.weaponname ) || !maps\mp\zombies\_zm_equipment::limited_equipment_in_use( self.stub.weaponname ) )
|
||||
{
|
||||
player maps\mp\zombies\_zm_score::minus_to_player_score( self.stub.cost );
|
||||
self play_sound_on_ent( "purchase" );
|
||||
|
||||
player maps\mp\zombies\_zm_equipment::equipment_buy( self.stub.weaponname );
|
||||
player giveweapon( self.stub.weaponname );
|
||||
player setweaponammoclip( self.stub.weaponname, 1 );
|
||||
|
||||
if ( isdefined( level.zombie_include_craftables[self.stub.equipname].onbuyweapon ) )
|
||||
self [[ level.zombie_include_craftables[self.stub.equipname].onbuyweapon ]]( player );
|
||||
else if ( self.stub.weaponname != "keys_zm" )
|
||||
player setactionslot( 1, "weapon", self.stub.weaponname );
|
||||
|
||||
if ( isdefined( level.zombie_craftablestubs[self.stub.equipname].str_taken ) )
|
||||
self.stub.hint_string = level.zombie_craftablestubs[self.stub.equipname].str_taken;
|
||||
else
|
||||
self.stub.hint_string = "";
|
||||
|
||||
self sethintstring( self.stub.hint_string );
|
||||
player track_craftables_pickedup( self.stub.craftablespawn );
|
||||
}
|
||||
else
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#include maps\mp\_utility;
|
||||
#include common_scripts\utility;
|
||||
#include maps\mp\zombies\_zm_utility;
|
||||
#include maps\mp\zombies\_zm_craftables;
|
||||
|
||||
#include scripts\zm\replaced\zm_tomb_craftables;
|
||||
#include scripts\zm\replaced\zm_tomb_dig;
|
||||
@ -18,6 +19,7 @@ init()
|
||||
level.zombie_init_done = ::zombie_init_done;
|
||||
level.special_weapon_magicbox_check = ::tomb_special_weapon_magicbox_check;
|
||||
level.custom_magic_box_timer_til_despawn = ::custom_magic_box_timer_til_despawn;
|
||||
level.zombie_custom_equipment_setup = ::setup_quadrotor_purchase;
|
||||
|
||||
challenges_changes();
|
||||
soul_box_changes();
|
||||
@ -25,6 +27,7 @@ init()
|
||||
level thread increase_solo_door_prices();
|
||||
level thread remove_shovels_from_map();
|
||||
level thread zombie_blood_dig_changes();
|
||||
level thread updatecraftables();
|
||||
}
|
||||
|
||||
on_player_connect()
|
||||
@ -298,4 +301,311 @@ custom_magic_box_timer_til_despawn( magic_box )
|
||||
{
|
||||
self delete();
|
||||
}
|
||||
}
|
||||
|
||||
updatecraftables()
|
||||
{
|
||||
flag_wait( "start_zombie_round_logic" );
|
||||
|
||||
wait 1;
|
||||
|
||||
foreach (stub in level._unitriggers.trigger_stubs)
|
||||
{
|
||||
if(IsDefined(stub.equipname))
|
||||
{
|
||||
hint_string = stub scripts\zm\_zm_reimagined::get_equipment_hint_string();
|
||||
stub.cost = stub scripts\zm\_zm_reimagined::get_equipment_cost();
|
||||
stub.trigger_hintstring = hint_string + " [Cost: " + stub.cost + "]";
|
||||
stub.trigger_func = ::craftable_place_think;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
craftable_place_think()
|
||||
{
|
||||
self endon( "kill_trigger" );
|
||||
player_crafted = undefined;
|
||||
|
||||
while ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
status = player player_can_craft( self.stub.craftablespawn );
|
||||
|
||||
if ( !status )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
|
||||
if ( isdefined( self.stub.oncantuse ) )
|
||||
self.stub [[ self.stub.oncantuse ]]( player );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isdefined( self.stub.onbeginuse ) )
|
||||
self.stub [[ self.stub.onbeginuse ]]( player );
|
||||
|
||||
result = self craftable_use_hold_think( player );
|
||||
team = player.pers["team"];
|
||||
|
||||
if ( isdefined( self.stub.onenduse ) )
|
||||
self.stub [[ self.stub.onenduse ]]( team, player, result );
|
||||
|
||||
if ( !result )
|
||||
continue;
|
||||
|
||||
if ( isdefined( self.stub.onuse ) )
|
||||
self.stub [[ self.stub.onuse ]]( player );
|
||||
|
||||
prompt = player player_craft( self.stub.craftablespawn );
|
||||
player_crafted = player;
|
||||
self.stub.hint_string = prompt;
|
||||
self sethintstring( self.stub.hint_string );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.craftablestub.onfullycrafted ) )
|
||||
{
|
||||
b_result = self.stub [[ self.stub.craftablestub.onfullycrafted ]]();
|
||||
|
||||
if ( !b_result )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( player_crafted ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 0 )
|
||||
{
|
||||
self.stub craftablestub_remove();
|
||||
thread maps\mp\zombies\_zm_unitrigger::unregister_unitrigger( self.stub );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 3 )
|
||||
{
|
||||
stub_uncraft_craftable( self.stub, 1 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( self.stub.persistent == 2 )
|
||||
{
|
||||
if ( isdefined( player_crafted ) )
|
||||
self craftabletrigger_update_prompt( player_crafted );
|
||||
|
||||
if ( !maps\mp\zombies\_zm_weapons::limited_weapon_below_quota( self.stub.weaponname, undefined ) )
|
||||
{
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.str_taken ) && self.stub.str_taken )
|
||||
{
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isdefined( self.stub.model ) )
|
||||
{
|
||||
self.stub.model notsolid();
|
||||
self.stub.model show();
|
||||
}
|
||||
|
||||
while ( self.stub.persistent == 2 )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
self.stub.bought = 1;
|
||||
|
||||
if ( isdefined( self.stub.model ) )
|
||||
self.stub.model thread model_fly_away( self );
|
||||
|
||||
player maps\mp\zombies\_zm_weapons::weapon_give( self.stub.weaponname );
|
||||
|
||||
if ( isdefined( level.zombie_include_craftables[self.stub.equipname].onbuyweapon ) )
|
||||
self [[ level.zombie_include_craftables[self.stub.equipname].onbuyweapon ]]( player );
|
||||
|
||||
if ( !maps\mp\zombies\_zm_weapons::limited_weapon_below_quota( self.stub.weaponname, undefined ) )
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED";
|
||||
else
|
||||
self.stub.hint_string = &"ZOMBIE_GO_TO_THE_BOX";
|
||||
|
||||
self sethintstring( self.stub.hint_string );
|
||||
player track_craftables_pickedup( self.stub.craftablespawn );
|
||||
}
|
||||
}
|
||||
else if ( !isdefined( player_crafted ) || self craftabletrigger_update_prompt( player_crafted ) )
|
||||
{
|
||||
if ( isdefined( self.stub.model ) )
|
||||
{
|
||||
self.stub.model notsolid();
|
||||
self.stub.model show();
|
||||
}
|
||||
|
||||
while ( self.stub.persistent == 1 )
|
||||
{
|
||||
self waittill( "trigger", player );
|
||||
|
||||
if ( isdefined( player.screecher_weapon ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.custom_craftable_validation ) )
|
||||
{
|
||||
valid = self [[ level.custom_craftable_validation ]]( player );
|
||||
|
||||
if ( !valid )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !( isdefined( self.stub.crafted ) && self.stub.crafted ) )
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( player != self.parent_player )
|
||||
continue;
|
||||
|
||||
if ( !is_player_valid( player ) )
|
||||
{
|
||||
player thread ignore_triggers( 0.5 );
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.score < self.stub.cost)
|
||||
{
|
||||
self play_sound_on_ent( "no_purchase" );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( player has_player_equipment( self.stub.weaponname ) )
|
||||
continue;
|
||||
|
||||
if ( isdefined( level.zombie_craftable_persistent_weapon ) )
|
||||
{
|
||||
if ( self [[ level.zombie_craftable_persistent_weapon ]]( player ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isdefined( level.zombie_custom_equipment_setup ) )
|
||||
{
|
||||
if ( self [[ level.zombie_custom_equipment_setup ]]( player ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !maps\mp\zombies\_zm_equipment::is_limited_equipment( self.stub.weaponname ) || !maps\mp\zombies\_zm_equipment::limited_equipment_in_use( self.stub.weaponname ) )
|
||||
{
|
||||
player maps\mp\zombies\_zm_score::minus_to_player_score( self.stub.cost );
|
||||
self play_sound_on_ent( "purchase" );
|
||||
|
||||
player maps\mp\zombies\_zm_equipment::equipment_buy( self.stub.weaponname );
|
||||
player giveweapon( self.stub.weaponname );
|
||||
player setweaponammoclip( self.stub.weaponname, 1 );
|
||||
|
||||
if ( isdefined( level.zombie_include_craftables[self.stub.equipname].onbuyweapon ) )
|
||||
self [[ level.zombie_include_craftables[self.stub.equipname].onbuyweapon ]]( player );
|
||||
else if ( self.stub.weaponname != "keys_zm" )
|
||||
player setactionslot( 1, "weapon", self.stub.weaponname );
|
||||
|
||||
if ( isdefined( level.zombie_craftablestubs[self.stub.equipname].str_taken ) )
|
||||
self.stub.hint_string = level.zombie_craftablestubs[self.stub.equipname].str_taken;
|
||||
else
|
||||
self.stub.hint_string = "";
|
||||
|
||||
self sethintstring( self.stub.hint_string );
|
||||
player track_craftables_pickedup( self.stub.craftablespawn );
|
||||
}
|
||||
else
|
||||
{
|
||||
self.stub.hint_string = "";
|
||||
self sethintstring( self.stub.hint_string );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setup_quadrotor_purchase( player )
|
||||
{
|
||||
if ( self.stub.weaponname == "equip_dieseldrone_zm" )
|
||||
{
|
||||
if ( players_has_weapon( "equip_dieseldrone_zm" ) )
|
||||
return true;
|
||||
|
||||
quadrotor = getentarray( "quadrotor_ai", "targetname" );
|
||||
|
||||
if ( quadrotor.size >= 1 )
|
||||
return true;
|
||||
|
||||
player maps\mp\zombies\_zm_score::minus_to_player_score( self.stub.cost );
|
||||
self play_sound_on_ent( "purchase" );
|
||||
|
||||
quadrotor_set_unavailable();
|
||||
player giveweapon( "equip_dieseldrone_zm" );
|
||||
player setweaponammoclip( "equip_dieseldrone_zm", 1 );
|
||||
player playsoundtoplayer( "zmb_buildable_pickup_complete", player );
|
||||
|
||||
if ( isdefined( self.stub.craftablestub.use_actionslot ) )
|
||||
player setactionslot( self.stub.craftablestub.use_actionslot, "weapon", "equip_dieseldrone_zm" );
|
||||
else
|
||||
player setactionslot( 2, "weapon", "equip_dieseldrone_zm" );
|
||||
|
||||
player notify( "equip_dieseldrone_zm_given" );
|
||||
level thread quadrotor_watcher( player );
|
||||
player thread maps\mp\zombies\_zm_audio::create_and_play_dialog( "general", "build_dd_plc" );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Reference in New Issue
Block a user