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

Buildables: optimize progress bar update

This commit is contained in:
Jbleezy
2023-04-26 00:55:06 -07:00
parent 3b4176ee55
commit 4f71ba0cd6
4 changed files with 49 additions and 0 deletions

View File

@ -505,6 +505,38 @@ player_build( buildable, pieces )
return "";
}
player_progress_bar( start_time, build_time, building_prompt )
{
self.usebar = self createprimaryprogressbar();
self.usebartext = self createprimaryprogressbartext();
if ( isdefined( building_prompt ) )
self.usebartext settext( building_prompt );
else
self.usebartext settext( &"ZOMBIE_BUILDING" );
if ( isdefined( self ) && isdefined( start_time ) && isdefined( build_time ) )
self player_progress_bar_update( start_time, build_time );
self.usebartext destroyelem();
self.usebar destroyelem();
}
player_progress_bar_update( start_time, build_time )
{
self endon( "entering_last_stand" );
self endon( "death" );
self endon( "disconnect" );
self endon( "buildable_progress_end" );
self.usebar updatebar( 0.01, 1000 / build_time );
while ( isdefined( self ) && gettime() - start_time < build_time )
{
wait 0.05;
}
}
model_go_away(weaponname)
{
self hide();

View File

@ -88,4 +88,19 @@ choose_open_craftable( player )
self.b_open_craftable_checking_input = 0;
self.opencraftablehudelem[n_playernum] destroy();
self.opencraftablehudelem[n_playernum] = undefined;
}
player_progress_bar_update( start_time, craft_time )
{
self endon( "entering_last_stand" );
self endon( "death" );
self endon( "disconnect" );
self endon( "craftable_progress_end" );
self.usebar updatebar( 0.01, 1000 / craft_time );
while ( isdefined( self ) && gettime() - start_time < craft_time )
{
wait 0.05;
}
}

View File

@ -59,6 +59,7 @@ main()
replaceFunc(maps\mp\zombies\_zm_ai_brutus::brutus_health_increases, scripts\zm\replaced\_zm_ai_brutus::brutus_health_increases);
replaceFunc(maps\mp\zombies\_zm_ai_brutus::brutus_cleanup_at_end_of_grief_round, scripts\zm\replaced\_zm_ai_brutus::brutus_cleanup_at_end_of_grief_round);
replaceFunc(maps\mp\zombies\_zm_craftables::choose_open_craftable, scripts\zm\replaced\_zm_craftables::choose_open_craftable);
replaceFunc(maps\mp\zombies\_zm_craftables::player_progress_bar_update, scripts\zm\replaced\_zm_craftables::player_progress_bar_update);
replaceFunc(maps\mp\zombies\_zm_riotshield_prison::doriotshielddeploy, scripts\zm\replaced\_zm_riotshield_prison::doriotshielddeploy);
replaceFunc(maps\mp\zombies\_zm_riotshield_prison::trackriotshield, scripts\zm\replaced\_zm_riotshield_prison::trackriotshield);
replaceFunc(maps\mp\zombies\_zm_weap_riotshield_prison::init, scripts\zm\replaced\_zm_weap_riotshield_prison::init);

View File

@ -70,6 +70,7 @@ main()
replaceFunc(maps\mp\zombies\_zm_ai_mechz::mechz_set_starting_health, scripts\zm\replaced\_zm_ai_mechz::mechz_set_starting_health);
replaceFunc(maps\mp\zombies\_zm_ai_mechz::mechz_round_tracker, scripts\zm\replaced\_zm_ai_mechz::mechz_round_tracker);
replaceFunc(maps\mp\zombies\_zm_craftables::choose_open_craftable, scripts\zm\replaced\_zm_craftables::choose_open_craftable);
replaceFunc(maps\mp\zombies\_zm_craftables::player_progress_bar_update, scripts\zm\replaced\_zm_craftables::player_progress_bar_update);
replaceFunc(maps\mp\zombies\_zm_powerup_zombie_blood::zombie_blood_powerup, scripts\zm\replaced\_zm_powerup_zombie_blood::zombie_blood_powerup);
replaceFunc(maps\mp\zombies\_zm_riotshield_tomb::doriotshielddeploy, scripts\zm\replaced\_zm_riotshield_tomb::doriotshielddeploy);
replaceFunc(maps\mp\zombies\_zm_riotshield_tomb::trackriotshield, scripts\zm\replaced\_zm_riotshield_tomb::trackriotshield);