1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-12 08:08:00 -05:00
Files
BO2-Reimagined/scripts/zm/replaced/_zm_craftables.gsc
2023-04-26 00:55:06 -07:00

106 lines
3.6 KiB
Plaintext

#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\zombies\_zm_utility;
#include maps\mp\gametypes_zm\_hud_util;
#include maps\mp\zombies\_zm_laststand;
#include maps\mp\zombies\_zm_equipment;
#include maps\mp\zombies\_zm_unitrigger;
#include maps\mp\zombies\_zm_craftables;
#include maps\mp\zombies\_zm_stats;
#include maps\mp\zombies\_zm_weapons;
#include maps\mp\_demo;
choose_open_craftable( player )
{
self endon( "kill_choose_open_craftable" );
n_playernum = player getentitynumber();
self.b_open_craftable_checking_input = 1;
b_got_input = 1;
hinttexthudelem = newclienthudelem( player );
hinttexthudelem.alignx = "center";
hinttexthudelem.aligny = "middle";
hinttexthudelem.horzalign = "center";
hinttexthudelem.vertalign = "bottom";
hinttexthudelem.y = -100;
if ( player issplitscreen() )
hinttexthudelem.y = -50;
hinttexthudelem.foreground = 1;
hinttexthudelem.hidewheninmenu = 1;
hinttexthudelem.font = "default";
hinttexthudelem.fontscale = 1.0;
hinttexthudelem.alpha = 1;
hinttexthudelem.color = ( 1, 1, 1 );
hinttexthudelem settext( &"ZM_CRAFTABLES_CHANGE_BUILD" );
if ( !isdefined( self.opencraftablehudelem ) )
self.opencraftablehudelem = [];
self.opencraftablehudelem[n_playernum] = hinttexthudelem;
if ( self.n_open_craftable_choice < 0 )
{
self.n_open_craftable_choice = self.a_uts_open_craftables_available.size - 1;
self.equipname = self.a_uts_open_craftables_available[self.n_open_craftable_choice].equipname;
self.hint_string = self.a_uts_open_craftables_available[self.n_open_craftable_choice].hint_string;
self.playertrigger[n_playernum] sethintstring( self.hint_string );
}
while ( isdefined( self.playertrigger[n_playernum] ) && !self.crafted )
{
if (!player isTouching(self.playertrigger[n_playernum]) || !player is_player_looking_at( self.playertrigger[n_playernum].origin, 0.76 ) || player isSprinting() || player isThrowingGrenade())
{
self.opencraftablehudelem[n_playernum].alpha = 0;
wait 0.05;
continue;
}
self.opencraftablehudelem[n_playernum].alpha = 1;
if ( player actionslotonebuttonpressed() )
{
self.n_open_craftable_choice++;
b_got_input = 1;
}
else if ( player actionslottwobuttonpressed() )
{
self.n_open_craftable_choice--;
b_got_input = 1;
}
if ( self.n_open_craftable_choice >= self.a_uts_open_craftables_available.size )
self.n_open_craftable_choice = 0;
else if ( self.n_open_craftable_choice < 0 )
self.n_open_craftable_choice = self.a_uts_open_craftables_available.size - 1;
if ( b_got_input )
{
self.equipname = self.a_uts_open_craftables_available[self.n_open_craftable_choice].equipname;
self.hint_string = self.a_uts_open_craftables_available[self.n_open_craftable_choice].hint_string;
self.playertrigger[n_playernum] sethintstring( self.hint_string );
b_got_input = 0;
}
wait 0.05;
}
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;
}
}