1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-10 23:27:57 -05:00

Buried: add buildable took hint string

Buildables: fix took hint string
Buildables: fix other triggers being disabled when all buildables were built
Optimize buildable code
This commit is contained in:
Jbleezy
2023-03-06 21:05:43 -08:00
parent 50fff6466f
commit a89e5ef5fd
5 changed files with 80 additions and 234 deletions

View File

@ -77,66 +77,81 @@ buildable_place_think()
self sethintstring( self.stub.hint_string );
}
}
if ( isDefined( player_built ) )
if ( self.stub.persistent == 4 )
{
self [[ self.stub.custom_completion_callback ]]( player_built );
return;
}
if ( self.stub.persistent == 0 )
{
self.stub maps\mp\zombies\_zm_buildables::buildablestub_remove();
thread maps\mp\zombies\_zm_unitrigger::unregister_unitrigger( self.stub );
return;
}
if ( self.stub.persistent == 3 )
{
maps\mp\zombies\_zm_buildables::stub_unbuild_buildable( self.stub, 1 );
return;
}
if ( self.stub.persistent == 2 )
{
if ( isDefined( player_built ) )
{
self scripts\zm\replaced\_zm_buildables_pooled::pooledbuildabletrigger_update_prompt( player_built );
}
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.bought ) && self.stub.bought )
{
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 ( !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.built ) && !self.stub.built )
{
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 );
@ -152,23 +167,35 @@ buildable_place_think()
self play_sound_on_ent( "purchase" );
self.stub.bought = 1;
if ( isDefined( self.stub.model ) )
{
self.stub.model thread maps\mp\zombies\_zm_buildables::model_fly_away();
}
player maps\mp\zombies\_zm_weapons::weapon_give( self.stub.weaponname );
if ( isDefined( level.zombie_include_buildables[ self.stub.equipname ].onbuyweapon ) )
{
self [[ level.zombie_include_buildables[ 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";
}
if ( isDefined( level.zombie_buildables[ self.stub.equipname ].bought ) )
{
self.stub.hint_string = level.zombie_buildables[ self.stub.equipname ].bought;
}
else
{
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 maps\mp\zombies\_zm_buildables::track_buildables_pickedup( self.stub.weaponname );
}
@ -180,36 +207,44 @@ buildable_place_think()
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( self.stub.built ) && !self.stub.built )
{
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 );
}
if ( player has_player_equipment( self.stub.weaponname ) )
{
continue;
}
if (player.score < self.stub.cost)
{
self play_sound_on_ent( "no_purchase" );
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 );
@ -218,14 +253,17 @@ buildable_place_think()
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_buildables[ self.stub.equipname ].onbuyweapon ) )
{
self [[ level.zombie_include_buildables[ self.stub.equipname ].onbuyweapon ]]( player );
}
if ( self.stub.weaponname != "keys_zm" )
{
player setactionslot( 1, "weapon", self.stub.weaponname );
}
if ( isDefined( level.zombie_buildables[ self.stub.equipname ].bought ) )
{
self.stub.hint_string = level.zombie_buildables[ self.stub.equipname ].bought;
@ -234,6 +272,7 @@ buildable_place_think()
{
self.stub.hint_string = "";
}
self sethintstring( self.stub.hint_string );
player maps\mp\zombies\_zm_buildables::track_buildables_pickedup( self.stub.weaponname );
continue;
@ -245,172 +284,4 @@ buildable_place_think()
}
}
}
}
bptrigger_think_persistent( player_built )
{
if ( !isdefined( player_built ) || self [[ self.stub.prompt_and_visibility_func ]]( player_built ) )
{
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( self.stub.built ) && self.stub.built ) )
{
self.stub.hint_string = "";
self sethintstring( self.stub.hint_string );
self setcursorhint( "HINT_NOICON" );
return;
}
if ( player != self.parent_player )
continue;
if ( !is_player_valid( player ) )
{
player thread ignore_triggers( 0.5 );
continue;
}
if ( player has_player_equipment( self.stub.weaponname ) )
continue;
if (player.score < self.stub.cost)
{
self play_sound_on_ent( "no_purchase" );
continue;
}
if ( isdefined( self.stub.buildablestruct.onbought ) )
self [[ self.stub.buildablestruct.onbought ]]( player );
else 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_buildables[self.stub.equipname].onbuyweapon ) )
self [[ level.zombie_include_buildables[self.stub.equipname].onbuyweapon ]]( player );
if ( self.stub.weaponname != "keys_zm" )
player setactionslot( 1, "weapon", self.stub.weaponname );
self.stub.cursor_hint = "HINT_NOICON";
self.stub.cursor_hint_weapon = undefined;
self setcursorhint( self.stub.cursor_hint );
if ( isdefined( level.zombie_buildables[self.stub.equipname].bought ) )
self.stub.hint_string = level.zombie_buildables[self.stub.equipname].bought;
else
self.stub.hint_string = "";
self sethintstring( self.stub.hint_string );
player track_buildables_pickedup( self.stub.weaponname );
}
else
{
self.stub.hint_string = "";
self sethintstring( self.stub.hint_string );
self.stub.cursor_hint = "HINT_NOICON";
self.stub.cursor_hint_weapon = undefined;
self setcursorhint( self.stub.cursor_hint );
}
}
}
}
bptrigger_think_one_use_and_fly( player_built )
{
if ( isdefined( player_built ) )
self scripts\zm\replaced\_zm_buildables_pooled::pooledbuildabletrigger_update_prompt( player_built );
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.bought ) && self.stub.bought )
{
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 ( !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.built ) && self.stub.built ) )
{
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;
}
player maps\mp\zombies\_zm_score::minus_to_player_score( self.stub.cost );
self play_sound_on_ent( "purchase" );
self.stub.bought = 1;
if ( isdefined( self.stub.model ) )
self.stub.model thread model_fly_away();
player maps\mp\zombies\_zm_weapons::weapon_give( self.stub.weaponname );
if ( isdefined( level.zombie_include_buildables[self.stub.equipname].onbuyweapon ) )
self [[ level.zombie_include_buildables[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_buildables_pickedup( self.stub.weaponname );
}
}