checked 10 more scripts

8 are for mp and zm _healthoverlay, _hostmigration, _menus, and _tweakables. Additionally _zm_chugabud, and _zm_equipment were checked for zm.
This commit is contained in:
JezuzLizard 2020-04-30 09:03:46 -07:00
parent 535c5c1737
commit 09e3ff45ed
12 changed files with 851 additions and 931 deletions

View File

@ -1,16 +1,16 @@
#include maps/mp/gametypes/_globallogic_player; #include maps/mp/gametypes/_globallogic_player;
init() init() //checked matches cerberus output
{ {
precacheshader( "overlay_low_health" ); precacheshader( "overlay_low_health" );
level.healthoverlaycutoff = 0,55; level.healthoverlaycutoff = 0.55;
regentime = level.playerhealthregentime; regentime = level.playerhealthregentime;
level.playerhealth_regularregendelay = regentime * 1000; level.playerhealth_regularregendelay = regentime * 1000;
level.healthregendisabled = level.playerhealth_regularregendelay <= 0; level.healthregendisabled = level.playerhealth_regularregendelay <= 0;
level thread onplayerconnect(); level thread onplayerconnect();
} }
onplayerconnect() onplayerconnect() //checked matches cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
@ -23,7 +23,7 @@ onplayerconnect()
} }
} }
onjoinedteam() onjoinedteam() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -33,7 +33,7 @@ onjoinedteam()
} }
} }
onjoinedspectators() onjoinedspectators() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -43,7 +43,7 @@ onjoinedspectators()
} }
} }
onplayerspawned() onplayerspawned() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -53,7 +53,7 @@ onplayerspawned()
} }
} }
onplayerkilled() onplayerkilled() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -63,38 +63,40 @@ onplayerkilled()
} }
} }
onplayerdisconnect() onplayerdisconnect() //checked matches cerberus output
{ {
self waittill( "disconnect" ); self waittill( "disconnect" );
self notify( "end_healthregen" ); self notify( "end_healthregen" );
} }
playerhealthregen() playerhealthregen() //checked changed to match cerberus output
{ {
self endon( "end_healthregen" ); self endon( "end_healthregen" );
if ( self.health <= 0 ) if ( self.health <= 0 )
{ {
/*
/# /#
assert( !isalive( self ) ); assert( !isalive( self ) );
#/ #/
*/
return; return;
} }
maxhealth = self.health; maxhealth = self.health;
oldhealth = maxhealth; oldhealth = maxhealth;
player = self; player = self;
health_add = 0; health_add = 0;
regenrate = 0,1; regenrate = 0.1;
usetrueregen = 0; usetrueregen = 0;
veryhurt = 0; veryhurt = 0;
player.breathingstoptime = -10000; player.breathingstoptime = -10000;
thread playerbreathingsound( maxhealth * 0,35 ); thread playerbreathingsound( maxhealth * 0.35 );
thread playerheartbeatsound( maxhealth * 0,35 ); thread playerheartbeatsound( maxhealth * 0.35 );
lastsoundtime_recover = 0; lastsoundtime_recover = 0;
hurttime = 0; hurttime = 0;
newhealth = 0; newhealth = 0;
for ( ;; ) for ( ;; )
{ {
wait 0,05; wait 0.05;
if ( isDefined( player.regenrate ) ) if ( isDefined( player.regenrate ) )
{ {
regenrate = player.regenrate; regenrate = player.regenrate;
@ -106,7 +108,7 @@ playerhealthregen()
self.atbrinkofdeath = 0; self.atbrinkofdeath = 0;
continue; continue;
} }
else if ( player.health <= 0 ) if ( player.health <= 0 )
{ {
return; return;
} }
@ -114,90 +116,84 @@ playerhealthregen()
{ {
continue; continue;
} }
else wasveryhurt = veryhurt;
ratio = player.health / maxhealth;
if ( ratio <= level.healthoverlaycutoff )
{ {
wasveryhurt = veryhurt; veryhurt = 1;
ratio = player.health / maxhealth; self.atbrinkofdeath = 1;
if ( ratio <= level.healthoverlaycutoff ) if ( !wasveryhurt )
{ {
veryhurt = 1; hurttime = getTime();
self.atbrinkofdeath = 1;
if ( !wasveryhurt )
{
hurttime = getTime();
}
} }
if ( player.health >= oldhealth ) }
if ( player.health >= oldhealth )
{
regentime = level.playerhealth_regularregendelay;
if ( player hasperk( "specialty_healthregen" ) )
{ {
regentime = level.playerhealth_regularregendelay; regentime = int( regentime / getDvarFloat( "perk_healthRegenMultiplier" ) );
}
if ( ( getTime() - hurttime ) < regentime )
{
continue;
}
else if ( level.healthregendisabled )
{
continue;
}
else if ( ( getTime() - lastsoundtime_recover ) > regentime )
{
lastsoundtime_recover = getTime();
self notify( "snd_breathing_better" );
}
if ( veryhurt )
{
newhealth = ratio;
veryhurttime = 3000;
if ( player hasperk( "specialty_healthregen" ) ) if ( player hasperk( "specialty_healthregen" ) )
{ {
regentime = int( regentime / getDvarFloat( "perk_healthRegenMultiplier" ) ); veryhurttime = int( veryhurttime / getDvarFloat( "perk_healthRegenMultiplier" ) );
} }
if ( ( getTime() - hurttime ) < regentime ) if ( getTime() > ( hurttime + veryhurttime ) )
{ {
break; newhealth += regenrate;
} }
else if ( level.healthregendisabled ) }
{ else if ( usetrueregen )
break; {
} newhealth = ratio + regenrate;
else if ( ( getTime() - lastsoundtime_recover ) > regentime )
{
lastsoundtime_recover = getTime();
self notify( "snd_breathing_better" );
}
if ( veryhurt )
{
newhealth = ratio;
veryhurttime = 3000;
if ( player hasperk( "specialty_healthregen" ) )
{
veryhurttime = int( veryhurttime / getDvarFloat( "perk_healthRegenMultiplier" ) );
}
if ( getTime() > ( hurttime + veryhurttime ) )
{
newhealth += regenrate;
}
}
else if ( usetrueregen )
{
newhealth = ratio + regenrate;
}
else
{
newhealth = 1;
}
if ( newhealth >= 1 )
{
self maps/mp/gametypes/_globallogic_player::resetattackerlist();
newhealth = 1;
}
if ( newhealth <= 0 )
{
return;
}
player setnormalhealth( newhealth );
change = player.health - oldhealth;
if ( change > 0 )
{
player decayplayerdamages( change );
}
oldhealth = player.health;
break;
} }
else else
{ {
oldhealth = player.health; newhealth = 1;
health_add = 0;
hurttime = getTime();
player.breathingstoptime = hurttime + 6000;
} }
if ( newhealth >= 1 )
{
self maps/mp/gametypes/_globallogic_player::resetattackerlist();
newhealth = 1;
}
if ( newhealth <= 0 )
{
return;
}
player setnormalhealth( newhealth );
change = player.health - oldhealth;
if ( change > 0 )
{
player decayplayerdamages( change );
}
oldhealth = player.health;
continue;
} }
oldhealth = player.health;
health_add = 0;
hurttime = getTime();
player.breathingstoptime = hurttime + 6000;
} }
} }
decayplayerdamages( decay ) decayplayerdamages( decay ) //checked partially changed to match cerberus output //continues in for loops bad see github for more info
{ {
if ( !isDefined( self.attackerdamage ) ) if ( !isDefined( self.attackerdamage ) )
{ {
@ -211,26 +207,23 @@ decayplayerdamages( decay )
i++; i++;
continue; continue;
} }
else self.attackerdamage[ i ].damage -= decay;
if ( self.attackerdamage[ i ].damage < 0 )
{ {
self.attackerdamage[ i ].damage -= decay; self.attackerdamage[ i ].damage = 0;
if ( self.attackerdamage[ i ].damage < 0 )
{
self.attackerdamage[ i ].damage = 0;
}
} }
i++; i++;
} }
} }
playerbreathingsound( healthcap ) playerbreathingsound( healthcap ) //checked changed to match cerberus output
{ {
self endon( "end_healthregen" ); self endon( "end_healthregen" );
wait 2; wait 2;
player = self; player = self;
for ( ;; ) for ( ;; )
{ {
wait 0,2; wait 0.2;
if ( player.health <= 0 ) if ( player.health <= 0 )
{ {
return; return;
@ -243,46 +236,41 @@ playerbreathingsound( healthcap )
{ {
continue; continue;
} }
else player notify( "snd_breathing_hurt" );
wait 0.784;
wait ( 0.1 + randomfloat( 0.8 ) );
}
}
playerheartbeatsound( healthcap ) //checked changed to match cerberus output
{
self endon( "end_healthregen" );
self.hearbeatwait = 0.2;
wait 2;
player = self;
for ( ;; )
{
wait 0.2;
if ( player.health <= 0 )
{ {
player notify( "snd_breathing_hurt" ); return;
wait 0,784; }
wait ( 0,1 + randomfloat( 0,8 ) ); if ( player.health >= healthcap )
{
self.hearbeatwait = 0.3;
continue;
}
else if ( level.healthregendisabled && getTime() > player.breathingstoptime )
{
self.hearbeatwait = 0.3;
continue;
}
player playlocalsound( "mpl_player_heartbeat" );
wait self.hearbeatwait;
if ( self.hearbeatwait <= 0.6 )
{
self.hearbeatwait += 0.1;
} }
} }
} }
playerheartbeatsound( healthcap )
{
self endon( "end_healthregen" );
self.hearbeatwait = 0,2;
wait 2;
player = self;
for ( ;; )
{
wait 0,2;
if ( player.health <= 0 )
{
return;
}
if ( player.health >= healthcap )
{
self.hearbeatwait = 0,3;
continue;
}
else if ( level.healthregendisabled && getTime() > player.breathingstoptime )
{
self.hearbeatwait = 0,3;
continue;
}
else
{
player playlocalsound( "mpl_player_heartbeat" );
wait self.hearbeatwait;
if ( self.hearbeatwait <= 0,6 )
{
self.hearbeatwait += 0,1;
}
}
}
}

View File

@ -3,8 +3,9 @@
#include common_scripts/utility; #include common_scripts/utility;
#include maps/mp/_utility; #include maps/mp/_utility;
debug_script_structs() debug_script_structs() //dev call did not check
{ {
/*
/# /#
if ( isDefined( level.struct ) ) if ( isDefined( level.struct ) )
{ {
@ -29,9 +30,10 @@ debug_script_structs()
} }
else println( "*** No structs defined." ); else println( "*** No structs defined." );
#/ #/
*/
} }
updatetimerpausedness() updatetimerpausedness() //checked matches cerberus output
{ {
shouldbestopped = isDefined( level.hostmigrationtimer ); shouldbestopped = isDefined( level.hostmigrationtimer );
if ( !level.timerstopped && shouldbestopped ) if ( !level.timerstopped && shouldbestopped )
@ -39,38 +41,35 @@ updatetimerpausedness()
level.timerstopped = 1; level.timerstopped = 1;
level.timerpausetime = getTime(); level.timerpausetime = getTime();
} }
else else if ( level.timerstopped && !shouldbestopped )
{ {
if ( level.timerstopped && !shouldbestopped ) level.timerstopped = 0;
{ level.discardtime += getTime() - level.timerpausetime;
level.timerstopped = 0;
level.discardtime += getTime() - level.timerpausetime;
}
} }
} }
callback_hostmigrationsave() callback_hostmigrationsave() //checked matches cerberus output
{ {
} }
pausetimer() pausetimer() //checked matches cerberus output
{ {
level.migrationtimerpausetime = getTime(); level.migrationtimerpausetime = getTime();
} }
resumetimer() resumetimer() //checked matches cerberus output
{ {
level.discardtime += getTime() - level.migrationtimerpausetime; level.discardtime += getTime() - level.migrationtimerpausetime;
} }
locktimer() locktimer() //checked matches cerberus output
{ {
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
level endon( "host_migration_end" ); level endon( "host_migration_end" );
for ( ;; ) for ( ;; )
{ {
currtime = getTime(); currtime = getTime();
wait 0,05; wait 0.05;
if ( !level.timerstopped && isDefined( level.discardtime ) ) if ( !level.timerstopped && isDefined( level.discardtime ) )
{ {
level.discardtime += getTime() - currtime; level.discardtime += getTime() - currtime;
@ -78,7 +77,7 @@ locktimer()
} }
} }
callback_hostmigration() callback_hostmigration() //checked changed to match cerberus output
{ {
setslowmotion( 1, 1, 0 ); setslowmotion( 1, 1, 0 );
makedvarserverinfo( "ui_guncycle", 0 ); makedvarserverinfo( "ui_guncycle", 0 );
@ -89,38 +88,42 @@ callback_hostmigration()
} }
if ( level.gameended ) if ( level.gameended )
{ {
/*
/# /#
println( "Migration starting at time " + getTime() + ", but game has ended, so no countdown." ); println( "Migration starting at time " + getTime() + ", but game has ended, so no countdown." );
#/ #/
*/
return; return;
} }
/*
/# /#
println( "Migration starting at time " + getTime() ); println( "Migration starting at time " + getTime() );
#/ #/
*/
level.hostmigrationtimer = 1; level.hostmigrationtimer = 1;
sethostmigrationstatus( 1 ); sethostmigrationstatus( 1 );
level notify( "host_migration_begin" ); level notify( "host_migration_begin" );
thread locktimer(); thread locktimer();
players = level.players; players = level.players;
i = 0; for ( i = 0; i < players.size; i++ )
while ( i < players.size )
{ {
player = players[ i ]; player = players[ i ];
player thread hostmigrationtimerthink(); player thread hostmigrationtimerthink();
i++;
} }
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
hostmigrationwait(); hostmigrationwait();
level.hostmigrationtimer = undefined; level.hostmigrationtimer = undefined;
sethostmigrationstatus( 0 ); sethostmigrationstatus( 0 );
/*
/# /#
println( "Migration finished at time " + getTime() ); println( "Migration finished at time " + getTime() );
#/ #/
*/
recordmatchbegin(); recordmatchbegin();
level notify( "host_migration_end" ); level notify( "host_migration_end" );
} }
matchstarttimerconsole_internal( counttime, matchstarttimer ) matchstarttimerconsole_internal( counttime, matchstarttimer ) //checked matches cerberus output
{ {
waittillframeend; waittillframeend;
visionsetnaked( "mpIntro", 0 ); visionsetnaked( "mpIntro", 0 );
@ -128,7 +131,7 @@ matchstarttimerconsole_internal( counttime, matchstarttimer )
while ( counttime > 0 && !level.gameended ) while ( counttime > 0 && !level.gameended )
{ {
matchstarttimer thread maps/mp/gametypes/_hud::fontpulse( level ); matchstarttimer thread maps/mp/gametypes/_hud::fontpulse( level );
wait ( matchstarttimer.inframes * 0,05 ); wait ( matchstarttimer.inframes * 0.05 );
matchstarttimer setvalue( counttime ); matchstarttimer setvalue( counttime );
if ( counttime == 2 ) if ( counttime == 2 )
{ {
@ -136,22 +139,22 @@ matchstarttimerconsole_internal( counttime, matchstarttimer )
} }
counttime--; counttime--;
wait ( 1 - ( matchstarttimer.inframes * 0,05 ) ); wait ( 1 - ( matchstarttimer.inframes * 0.05 ) );
} }
} }
matchstarttimerconsole( type, duration ) matchstarttimerconsole( type, duration ) //checked matches cerberus output
{ {
level notify( "match_start_timer_beginning" ); level notify( "match_start_timer_beginning" );
wait 0,05; wait 0,05;
matchstarttext = createserverfontstring( "objective", 1,5 ); matchstarttext = createserverfontstring( "objective", 1.5 );
matchstarttext setpoint( "CENTER", "CENTER", 0, -40 ); matchstarttext setpoint( "CENTER", "CENTER", 0, -40 );
matchstarttext.sort = 1001; matchstarttext.sort = 1001;
matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] ); matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] );
matchstarttext.foreground = 0; matchstarttext.foreground = 0;
matchstarttext.hidewheninmenu = 1; matchstarttext.hidewheninmenu = 1;
matchstarttext settext( game[ "strings" ][ type ] ); matchstarttext settext( game[ "strings" ][ type ] );
matchstarttimer = createserverfontstring( "objective", 2,2 ); matchstarttimer = createserverfontstring( "objective", 2.2 );
matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 ); matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 );
matchstarttimer.sort = 1001; matchstarttimer.sort = 1001;
matchstarttimer.color = ( 1, 1, 0 ); matchstarttimer.color = ( 1, 1, 0 );
@ -173,7 +176,7 @@ matchstarttimerconsole( type, duration )
matchstarttext destroyelem(); matchstarttext destroyelem();
} }
hostmigrationwait() hostmigrationwait() //checked matches cerberus output may need to check order of operations
{ {
level endon( "game_ended" ); level endon( "game_ended" );
if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) ) if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) )
@ -186,7 +189,7 @@ hostmigrationwait()
wait 5; wait 5;
} }
waittillhostmigrationcountdown() waittillhostmigrationcountdown() //checked matches cerberus output
{ {
level endon( "host_migration_end" ); level endon( "host_migration_end" );
if ( !isDefined( level.hostmigrationtimer ) ) if ( !isDefined( level.hostmigrationtimer ) )
@ -196,13 +199,13 @@ waittillhostmigrationcountdown()
level waittill( "host_migration_countdown_begin" ); level waittill( "host_migration_countdown_begin" );
} }
hostmigrationwaitforplayers() hostmigrationwaitforplayers() //checked matches cerberus output
{ {
level endon( "hostmigration_enoughplayers" ); level endon( "hostmigration_enoughplayers" );
wait 15; wait 15;
} }
hostmigrationtimerthink_internal() hostmigrationtimerthink_internal() //checked matches cerberus output
{ {
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
level endon( "host_migration_end" ); level endon( "host_migration_end" );
@ -216,7 +219,7 @@ hostmigrationtimerthink_internal()
level waittill( "host_migration_end" ); level waittill( "host_migration_end" );
} }
hostmigrationtimerthink() hostmigrationtimerthink() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
@ -227,7 +230,7 @@ hostmigrationtimerthink()
} }
} }
waittillhostmigrationdone() waittillhostmigrationdone() //checked matches cerberus output
{ {
if ( !isDefined( level.hostmigrationtimer ) ) if ( !isDefined( level.hostmigrationtimer ) )
{ {
@ -238,7 +241,7 @@ waittillhostmigrationdone()
return getTime() - starttime; return getTime() - starttime;
} }
waittillhostmigrationstarts( duration ) waittillhostmigrationstarts( duration ) //checked matches cerberus output
{ {
if ( isDefined( level.hostmigrationtimer ) ) if ( isDefined( level.hostmigrationtimer ) )
{ {
@ -248,15 +251,17 @@ waittillhostmigrationstarts( duration )
wait duration; wait duration;
} }
waitlongdurationwithhostmigrationpause( duration ) waitlongdurationwithhostmigrationpause( duration ) //checked matches cerberus output may need to check order of operations
{ {
if ( duration == 0 ) if ( duration == 0 )
{ {
return; return;
} }
/*
/# /#
assert( duration > 0 ); assert( duration > 0 );
#/ #/
*/
starttime = getTime(); starttime = getTime();
endtime = getTime() + ( duration * 1000 ); endtime = getTime() + ( duration * 1000 );
while ( getTime() < endtime ) while ( getTime() < endtime )
@ -268,25 +273,29 @@ waitlongdurationwithhostmigrationpause( duration )
endtime += timepassed; endtime += timepassed;
} }
} }
/*
/# /#
if ( getTime() != endtime ) if ( getTime() != endtime )
{ {
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime );
#/ #/
} }
*/
waittillhostmigrationdone(); waittillhostmigrationdone();
return getTime() - starttime; return getTime() - starttime;
} }
waitlongdurationwithhostmigrationpauseemp( duration ) waitlongdurationwithhostmigrationpauseemp( duration ) //checked matches cerberus output may need to check order of operations
{ {
if ( duration == 0 ) if ( duration == 0 )
{ {
return; return;
} }
/*
/# /#
assert( duration > 0 ); assert( duration > 0 );
#/ #/
*/
starttime = getTime(); starttime = getTime();
empendtime = getTime() + ( duration * 1000 ); empendtime = getTime() + ( duration * 1000 );
level.empendtime = empendtime; level.empendtime = empendtime;
@ -302,26 +311,30 @@ waitlongdurationwithhostmigrationpauseemp( duration )
} }
} }
} }
/*
/# /#
if ( getTime() != empendtime ) if ( getTime() != empendtime )
{ {
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO empendtime = " + empendtime ); println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO empendtime = " + empendtime );
#/ #/
} }
*/
waittillhostmigrationdone(); waittillhostmigrationdone();
level.empendtime = undefined; level.empendtime = undefined;
return getTime() - starttime; return getTime() - starttime;
} }
waitlongdurationwithgameendtimeupdate( duration ) waitlongdurationwithgameendtimeupdate( duration ) //checked matches cerberus output may need to check order of operations
{ {
if ( duration == 0 ) if ( duration == 0 )
{ {
return; return;
} }
/*
/# /#
assert( duration > 0 ); assert( duration > 0 );
#/ #/
*/
starttime = getTime(); starttime = getTime();
endtime = getTime() + ( duration * 1000 ); endtime = getTime() + ( duration * 1000 );
while ( getTime() < endtime ) while ( getTime() < endtime )
@ -334,12 +347,14 @@ waitlongdurationwithgameendtimeupdate( duration )
wait 1; wait 1;
} }
} }
/*
/# /#
if ( getTime() != endtime ) if ( getTime() != endtime )
{ {
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime );
#/ #/
} }
*/
while ( isDefined( level.hostmigrationtimer ) ) while ( isDefined( level.hostmigrationtimer ) )
{ {
endtime += 1000; endtime += 1000;
@ -348,3 +363,4 @@ waitlongdurationwithgameendtimeupdate( duration )
} }
return getTime() - starttime; return getTime() - starttime;
} }

View File

@ -2,7 +2,7 @@
#include maps/mp/gametypes/_globallogic; #include maps/mp/gametypes/_globallogic;
#include maps/mp/_utility; #include maps/mp/_utility;
init() init() //checked changed to match cerberus output
{ {
precachestring( &"open_ingame_menu" ); precachestring( &"open_ingame_menu" );
game[ "menu_team" ] = "team_marinesopfor"; game[ "menu_team" ] = "team_marinesopfor";
@ -16,13 +16,9 @@ init()
game[ "menu_changeclass_wager" ] = "changeclass_wager"; game[ "menu_changeclass_wager" ] = "changeclass_wager";
game[ "menu_changeclass_custom" ] = "changeclass_custom"; game[ "menu_changeclass_custom" ] = "changeclass_custom";
game[ "menu_changeclass_barebones" ] = "changeclass_barebones"; game[ "menu_changeclass_barebones" ] = "changeclass_barebones";
_a18 = level.teams; foreach ( team in level.teams )
_k18 = getFirstArrayKey( _a18 );
while ( isDefined( _k18 ) )
{ {
team = _a18[ _k18 ];
game[ "menu_changeclass_" + team ] = "changeclass"; game[ "menu_changeclass_" + team ] = "changeclass";
_k18 = getNextArrayKey( _a18, _k18 );
} }
game[ "menu_controls" ] = "ingame_controls"; game[ "menu_controls" ] = "ingame_controls";
game[ "menu_options" ] = "ingame_options"; game[ "menu_options" ] = "ingame_options";
@ -50,7 +46,7 @@ init()
level thread onplayerconnect(); level thread onplayerconnect();
} }
onplayerconnect() onplayerconnect() //checked matches cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
@ -59,7 +55,7 @@ onplayerconnect()
} }
} }
onmenuresponse() onmenuresponse() //checked changed to match cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -71,7 +67,7 @@ onmenuresponse()
self closeingamemenu(); self closeingamemenu();
if ( level.console ) if ( level.console )
{ {
if ( game[ "menu_changeclass" ] != menu && game[ "menu_changeclass_offline" ] != menu || menu == game[ "menu_team" ] && menu == game[ "menu_controls" ] ) if ( menu == game[ "menu_changeclass" ] || menu == game[ "menu_changeclass_offline" ] || menu == game[ "menu_team" ] || menu == game[ "menu_controls" ] )
{ {
if ( isDefined( level.teams[ self.pers[ "team" ] ] ) ) if ( isDefined( level.teams[ self.pers[ "team" ] ] ) )
{ {
@ -81,7 +77,7 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( response == "changeteam" && level.allow_teamchange == "1" ) if ( response == "changeteam" && level.allow_teamchange == "1" )
{ {
self closemenu(); self closemenu();
self closeingamemenu(); self closeingamemenu();
@ -107,12 +103,12 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( response == "killserverpc" ) if ( response == "killserverpc" )
{ {
level thread maps/mp/gametypes/_globallogic::killserverpc(); level thread maps/mp/gametypes/_globallogic::killserverpc();
continue; continue;
} }
else if ( response == "endround" ) if ( response == "endround" )
{ {
if ( !level.gameended ) if ( !level.gameended )
{ {
@ -127,7 +123,7 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" )
{ {
switch( response ) switch( response )
{ {
@ -143,34 +139,29 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( menu == game[ "menu_changeclass" ] || menu == game[ "menu_changeclass_offline" ] || menu == game[ "menu_changeclass_wager" ] || menu == game[ "menu_changeclass_custom" ] || menu == game[ "menu_changeclass_barebones" ] )
{ {
if ( game[ "menu_changeclass" ] != menu && game[ "menu_changeclass_offline" ] != menu && game[ "menu_changeclass_wager" ] != menu || menu == game[ "menu_changeclass_custom" ] && menu == game[ "menu_changeclass_barebones" ] ) self closemenu();
self closeingamemenu();
if ( level.rankedmatch && issubstr( response, "custom" ) )
{ {
self closemenu(); if ( self isitemlocked( maps/mp/gametypes/_rank::getitemindex( "feature_cac" ) ) )
self closeingamemenu();
if ( level.rankedmatch && issubstr( response, "custom" ) )
{ {
if ( self isitemlocked( maps/mp/gametypes/_rank::getitemindex( "feature_cac" ) ) ) kick( self getentitynumber() );
{
kick( self getentitynumber() );
}
} }
self.selectedclass = 1;
self [[ level.class ]]( response );
break;
} }
else self.selectedclass = 1;
self [[ level.class ]]( response );
continue;
}
if ( menu == "spectate" )
{
player = getplayerfromclientnum( int( response ) );
if ( isDefined( player ) )
{ {
if ( menu == "spectate" ) self setcurrentspectatorclient( player );
{
player = getplayerfromclientnum( int( response ) );
if ( isDefined( player ) )
{
self setcurrentspectatorclient( player );
}
}
} }
} }
} }
} }

View File

@ -1,6 +1,6 @@
#include maps/mp/_utility; #include maps/mp/_utility;
gettweakabledvarvalue( category, name ) gettweakabledvarvalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -32,14 +32,16 @@ gettweakabledvarvalue( category, name )
dvar = undefined; dvar = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( dvar ) ); assert( isDefined( dvar ) );
#/ #/
*/
value = getDvarInt( dvar ); value = getDvarInt( dvar );
return value; return value;
} }
gettweakabledvar( category, name ) gettweakabledvar( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -71,13 +73,15 @@ gettweakabledvar( category, name )
value = undefined; value = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
gettweakablevalue( category, name ) gettweakablevalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -114,13 +118,15 @@ gettweakablevalue( category, name )
{ {
return getDvarInt( overridedvar ); return getDvarInt( overridedvar );
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
gettweakablelastvalue( category, name ) gettweakablelastvalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -152,13 +158,15 @@ gettweakablelastvalue( category, name )
value = undefined; value = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
settweakablevalue( category, name, value ) settweakablevalue( category, name, value ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -193,7 +201,7 @@ settweakablevalue( category, name, value )
setdvar( dvar, value ); setdvar( dvar, value );
} }
settweakablelastvalue( category, name, value ) settweakablelastvalue( category, name, value ) //checked changed to match cerberus output
{ {
switch( category ) switch( category )
{ {
@ -222,11 +230,11 @@ settweakablelastvalue( category, name, value )
level.hudtweaks[ name ].lastvalue = value; level.hudtweaks[ name ].lastvalue = value;
break; break;
default: default:
} break;
} }
} }
registertweakable( category, name, dvar, value ) registertweakable( category, name, dvar, value ) //checked matches cerberus output
{ {
if ( isstring( value ) ) if ( isstring( value ) )
{ {
@ -324,7 +332,7 @@ registertweakable( category, name, dvar, value )
} }
} }
init() init() //checked matches cerberus output
{ {
level.clienttweakables = []; level.clienttweakables = [];
level.tweakablesinitialized = 1; level.tweakablesinitialized = 1;
@ -362,17 +370,16 @@ init()
level thread updateuitweakables(); level thread updateuitweakables();
} }
setclienttweakable( category, name ) setclienttweakable( category, name ) //checked matches cerberus output
{ {
level.clienttweakables[ level.clienttweakables.size ] = name; level.clienttweakables[ level.clienttweakables.size ] = name;
} }
updateuitweakables() updateuitweakables() //checked changed to match cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
index = 0; for ( index = 0; index < level.clienttweakables.size; index++ )
while ( index < level.clienttweakables.size )
{ {
clienttweakable = level.clienttweakables[ index ]; clienttweakable = level.clienttweakables[ index ];
curvalue = gettweakabledvarvalue( "hud", clienttweakable ); curvalue = gettweakabledvarvalue( "hud", clienttweakable );
@ -382,13 +389,13 @@ updateuitweakables()
updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue ); updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue );
settweakablelastvalue( "hud", clienttweakable, curvalue ); settweakablelastvalue( "hud", clienttweakable, curvalue );
} }
index++;
} }
wait 1; wait 1;
} }
} }
updateserverdvar( dvar, value ) updateserverdvar( dvar, value ) //checked matches cerberus output
{ {
makedvarserverinfo( dvar, value ); makedvarserverinfo( dvar, value );
} }

View File

@ -1,4 +1,4 @@
### The following gscs compile and run successfully with no known errors: ### The following scripts compile and run successfully with no known errors:
``` ```
patch_mp/maps/mp/gametypes/_clientids.gsc patch_mp/maps/mp/gametypes/_clientids.gsc
patch_mp/maps/mp/gametypes/_globalentities.gsc patch_mp/maps/mp/gametypes/_globalentities.gsc
@ -23,9 +23,13 @@ patch_mp/maps/mp/bots/_bot.gsc
patch_mp/maps/mp/gametypes/_callbacksetup.gsc patch_mp/maps/mp/gametypes/_callbacksetup.gsc
patch_mp/maps/mp/gametypes/_damagefeedback.gsc patch_mp/maps/mp/gametypes/_damagefeedback.gsc
patch_mp/maps/mp/gametypes/_healthoverlay.gsc
patch_mp/maps/mp/gametypes/_hostmigration.gsc
patch_mp/maps/mp/gametypes/_hud.gsc patch_mp/maps/mp/gametypes/_hud.gsc
patch_mp/maps/mp/gametypes/_menus.gsc
patch_mp/maps/mp/gametypes/_perplayer.gsc patch_mp/maps/mp/gametypes/_perplayer.gsc
patch_mp/maps/mp/gametypes/_serversettings.gsc patch_mp/maps/mp/gametypes/_serversettings.gsc
patch_mp/maps/mp/gametypes/_tweakables.gsc
patch_mp/maps/mp/gametypes/_weapon_utils.gsc patch_mp/maps/mp/gametypes/_weapon_utils.gsc
``` ```
### The following scripts are not checked yet, uploaded to setup a baseline: ### The following scripts are not checked yet, uploaded to setup a baseline:
@ -45,8 +49,6 @@ patch_mp/maps/mp/gametypes/_battlechatter.gsc
patch_mp/maps/mp/gametypes/_class.gsc patch_mp/maps/mp/gametypes/_class.gsc
patch_mp/maps/mp/gametypes/_copter.gsc patch_mp/maps/mp/gametypes/_copter.gsc
patch_mp/maps/mp/gametypes/_deathicons.gsc patch_mp/maps/mp/gametypes/_deathicons.gsc
patch_mp/maps/mp/gametypes/_dev.gsc
patch_mp/maps/mp/gametypes/_dev_class.gsc
patch_mp/maps/mp/gametypes/_friendicons.gsc patch_mp/maps/mp/gametypes/_friendicons.gsc
patch_mp/maps/mp/gametypes/_gameobjects.gsc patch_mp/maps/mp/gametypes/_gameobjects.gsc
patch_mp/maps/mp/gametypes/_globallogic.gsc patch_mp/maps/mp/gametypes/_globallogic.gsc
@ -59,12 +61,9 @@ patch_mp/maps/mp/gametypes/_globallogic_spawn.gsc
patch_mp/maps/mp/gametypes/_globallogic_ui.gsc patch_mp/maps/mp/gametypes/_globallogic_ui.gsc
patch_mp/maps/mp/gametypes/_globallogic_utils.gsc patch_mp/maps/mp/gametypes/_globallogic_utils.gsc
patch_mp/maps/mp/gametypes/_globallogic_vehicle.gsc patch_mp/maps/mp/gametypes/_globallogic_vehicle.gsc
patch_mp/maps/mp/gametypes/_healthoverlay.gsc
patch_mp/maps/mp/gametypes/_hostmigration.gsc
patch_mp/maps/mp/gametypes/_hud_message.gsc patch_mp/maps/mp/gametypes/_hud_message.gsc
patch_mp/maps/mp/gametypes/_hud_util.gsc patch_mp/maps/mp/gametypes/_hud_util.gsc
patch_mp/maps/mp/gametypes/_killcam.gsc patch_mp/maps/mp/gametypes/_killcam.gsc
patch_mp/maps/mp/gametypes/_menus.gsc
patch_mp/maps/mp/gametypes/_objpoints.gsc patch_mp/maps/mp/gametypes/_objpoints.gsc
patch_mp/maps/mp/gametypes/_persistence.gsc patch_mp/maps/mp/gametypes/_persistence.gsc
patch_mp/maps/mp/gametypes/_pregame.gsc patch_mp/maps/mp/gametypes/_pregame.gsc
@ -72,7 +71,6 @@ patch_mp/maps/mp/gametypes/_rank.gsc
patch_mp/maps/mp/gametypes/_spawning.gsc patch_mp/maps/mp/gametypes/_spawning.gsc
patch_mp/maps/mp/gametypes/_spawnlogic.gsc patch_mp/maps/mp/gametypes/_spawnlogic.gsc
patch_mp/maps/mp/gametypes/_spectating.gsc patch_mp/maps/mp/gametypes/_spectating.gsc
patch_mp/maps/mp/gametypes/_tweakables.gsc
patch_mp/maps/mp/gametypes/_wager.gsc patch_mp/maps/mp/gametypes/_wager.gsc
patch_mp/maps/mp/gametypes/_weaponobjects.gsc patch_mp/maps/mp/gametypes/_weaponobjects.gsc
patch_mp/maps/mp/gametypes/_weapons.gsc patch_mp/maps/mp/gametypes/_weapons.gsc
@ -91,6 +89,13 @@ patch_mp/maps/mp/gametypes/sd.gsc
patch_mp/maps/mp/gametypes/shrp.gsc patch_mp/maps/mp/gametypes/shrp.gsc
patch_mp/maps/mp/gametypes/tdm.gsc patch_mp/maps/mp/gametypes/tdm.gsc
``` ```
### The following scipts are dev scripts filled with dev calls making them useless to modify for now
```
patch_mp/maps/mp/gametypes/_dev.gsc
patch_mp/maps/mp/gametypes/_dev_class.gsc
```
### notes: ### notes:
``` ```
``` ```

View File

@ -1,16 +1,16 @@
#include maps/mp/gametypes_zm/_globallogic_player; #include maps/mp/gametypes/_globallogic_player;
init() init() //checked matches cerberus output
{ {
precacheshader( "overlay_low_health" ); precacheshader( "overlay_low_health" );
level.healthoverlaycutoff = 0,55; level.healthoverlaycutoff = 0.55;
regentime = level.playerhealthregentime; regentime = level.playerhealthregentime;
level.playerhealth_regularregendelay = regentime * 1000; level.playerhealth_regularregendelay = regentime * 1000;
level.healthregendisabled = level.playerhealth_regularregendelay <= 0; level.healthregendisabled = level.playerhealth_regularregendelay <= 0;
level thread onplayerconnect(); level thread onplayerconnect();
} }
onplayerconnect() onplayerconnect() //checked matches cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
@ -23,7 +23,7 @@ onplayerconnect()
} }
} }
onjoinedteam() onjoinedteam() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -33,7 +33,7 @@ onjoinedteam()
} }
} }
onjoinedspectators() onjoinedspectators() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -43,7 +43,7 @@ onjoinedspectators()
} }
} }
onplayerspawned() onplayerspawned() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -53,7 +53,7 @@ onplayerspawned()
} }
} }
onplayerkilled() onplayerkilled() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -63,38 +63,40 @@ onplayerkilled()
} }
} }
onplayerdisconnect() onplayerdisconnect() //checked matches cerberus output
{ {
self waittill( "disconnect" ); self waittill( "disconnect" );
self notify( "end_healthregen" ); self notify( "end_healthregen" );
} }
playerhealthregen() playerhealthregen() //checked changed to match cerberus output
{ {
self endon( "end_healthregen" ); self endon( "end_healthregen" );
if ( self.health <= 0 ) if ( self.health <= 0 )
{ {
/*
/# /#
assert( !isalive( self ) ); assert( !isalive( self ) );
#/ #/
*/
return; return;
} }
maxhealth = self.health; maxhealth = self.health;
oldhealth = maxhealth; oldhealth = maxhealth;
player = self; player = self;
health_add = 0; health_add = 0;
regenrate = 0,1; regenrate = 0.1;
usetrueregen = 0; usetrueregen = 0;
veryhurt = 0; veryhurt = 0;
player.breathingstoptime = -10000; player.breathingstoptime = -10000;
thread playerbreathingsound( maxhealth * 0,35 ); thread playerbreathingsound( maxhealth * 0.35 );
thread playerheartbeatsound( maxhealth * 0,35 ); thread playerheartbeatsound( maxhealth * 0.35 );
lastsoundtime_recover = 0; lastsoundtime_recover = 0;
hurttime = 0; hurttime = 0;
newhealth = 0; newhealth = 0;
for ( ;; ) for ( ;; )
{ {
wait 0,05; wait 0.05;
if ( isDefined( player.regenrate ) ) if ( isDefined( player.regenrate ) )
{ {
regenrate = player.regenrate; regenrate = player.regenrate;
@ -106,7 +108,7 @@ playerhealthregen()
self.atbrinkofdeath = 0; self.atbrinkofdeath = 0;
continue; continue;
} }
else if ( player.health <= 0 ) if ( player.health <= 0 )
{ {
return; return;
} }
@ -114,90 +116,84 @@ playerhealthregen()
{ {
continue; continue;
} }
else wasveryhurt = veryhurt;
ratio = player.health / maxhealth;
if ( ratio <= level.healthoverlaycutoff )
{ {
wasveryhurt = veryhurt; veryhurt = 1;
ratio = player.health / maxhealth; self.atbrinkofdeath = 1;
if ( ratio <= level.healthoverlaycutoff ) if ( !wasveryhurt )
{ {
veryhurt = 1; hurttime = getTime();
self.atbrinkofdeath = 1;
if ( !wasveryhurt )
{
hurttime = getTime();
}
} }
if ( player.health >= oldhealth ) }
if ( player.health >= oldhealth )
{
regentime = level.playerhealth_regularregendelay;
if ( player hasperk( "specialty_healthregen" ) )
{ {
regentime = level.playerhealth_regularregendelay; regentime = int( regentime / getDvarFloat( "perk_healthRegenMultiplier" ) );
}
if ( ( getTime() - hurttime ) < regentime )
{
continue;
}
else if ( level.healthregendisabled )
{
continue;
}
else if ( ( getTime() - lastsoundtime_recover ) > regentime )
{
lastsoundtime_recover = getTime();
self notify( "snd_breathing_better" );
}
if ( veryhurt )
{
newhealth = ratio;
veryhurttime = 3000;
if ( player hasperk( "specialty_healthregen" ) ) if ( player hasperk( "specialty_healthregen" ) )
{ {
regentime = int( regentime / getDvarFloat( "perk_healthRegenMultiplier" ) ); veryhurttime = int( veryhurttime / getDvarFloat( "perk_healthRegenMultiplier" ) );
} }
if ( ( getTime() - hurttime ) < regentime ) if ( getTime() > ( hurttime + veryhurttime ) )
{ {
break; newhealth += regenrate;
} }
else if ( level.healthregendisabled ) }
{ else if ( usetrueregen )
break; {
} newhealth = ratio + regenrate;
else if ( ( getTime() - lastsoundtime_recover ) > regentime )
{
lastsoundtime_recover = getTime();
self notify( "snd_breathing_better" );
}
if ( veryhurt )
{
newhealth = ratio;
veryhurttime = 3000;
if ( player hasperk( "specialty_healthregen" ) )
{
veryhurttime = int( veryhurttime / getDvarFloat( "perk_healthRegenMultiplier" ) );
}
if ( getTime() > ( hurttime + veryhurttime ) )
{
newhealth += regenrate;
}
}
else if ( usetrueregen )
{
newhealth = ratio + regenrate;
}
else
{
newhealth = 1;
}
if ( newhealth >= 1 )
{
self maps/mp/gametypes_zm/_globallogic_player::resetattackerlist();
newhealth = 1;
}
if ( newhealth <= 0 )
{
return;
}
player setnormalhealth( newhealth );
change = player.health - oldhealth;
if ( change > 0 )
{
player decayplayerdamages( change );
}
oldhealth = player.health;
break;
} }
else else
{ {
oldhealth = player.health; newhealth = 1;
health_add = 0;
hurttime = getTime();
player.breathingstoptime = hurttime + 6000;
} }
if ( newhealth >= 1 )
{
self maps/mp/gametypes/_globallogic_player::resetattackerlist();
newhealth = 1;
}
if ( newhealth <= 0 )
{
return;
}
player setnormalhealth( newhealth );
change = player.health - oldhealth;
if ( change > 0 )
{
player decayplayerdamages( change );
}
oldhealth = player.health;
continue;
} }
oldhealth = player.health;
health_add = 0;
hurttime = getTime();
player.breathingstoptime = hurttime + 6000;
} }
} }
decayplayerdamages( decay ) decayplayerdamages( decay ) //checked partially changed to match cerberus output //continues in for loops bad see github for more info
{ {
if ( !isDefined( self.attackerdamage ) ) if ( !isDefined( self.attackerdamage ) )
{ {
@ -211,26 +207,23 @@ decayplayerdamages( decay )
i++; i++;
continue; continue;
} }
else self.attackerdamage[ i ].damage -= decay;
if ( self.attackerdamage[ i ].damage < 0 )
{ {
self.attackerdamage[ i ].damage -= decay; self.attackerdamage[ i ].damage = 0;
if ( self.attackerdamage[ i ].damage < 0 )
{
self.attackerdamage[ i ].damage = 0;
}
} }
i++; i++;
} }
} }
playerbreathingsound( healthcap ) playerbreathingsound( healthcap ) //checked changed to match cerberus output
{ {
self endon( "end_healthregen" ); self endon( "end_healthregen" );
wait 2; wait 2;
player = self; player = self;
for ( ;; ) for ( ;; )
{ {
wait 0,2; wait 0.2;
if ( player.health <= 0 ) if ( player.health <= 0 )
{ {
return; return;
@ -243,46 +236,41 @@ playerbreathingsound( healthcap )
{ {
continue; continue;
} }
else player notify( "snd_breathing_hurt" );
wait 0.784;
wait ( 0.1 + randomfloat( 0.8 ) );
}
}
playerheartbeatsound( healthcap ) //checked changed to match cerberus output
{
self endon( "end_healthregen" );
self.hearbeatwait = 0.2;
wait 2;
player = self;
for ( ;; )
{
wait 0.2;
if ( player.health <= 0 )
{ {
player notify( "snd_breathing_hurt" ); return;
wait 0,784; }
wait ( 0,1 + randomfloat( 0,8 ) ); if ( player.health >= healthcap )
{
self.hearbeatwait = 0.3;
continue;
}
else if ( level.healthregendisabled && getTime() > player.breathingstoptime )
{
self.hearbeatwait = 0.3;
continue;
}
player playlocalsound( "mpl_player_heartbeat" );
wait self.hearbeatwait;
if ( self.hearbeatwait <= 0.6 )
{
self.hearbeatwait += 0.1;
} }
} }
} }
playerheartbeatsound( healthcap )
{
self endon( "end_healthregen" );
self.hearbeatwait = 0,2;
wait 2;
player = self;
for ( ;; )
{
wait 0,2;
if ( player.health <= 0 )
{
return;
}
if ( player.health >= healthcap )
{
self.hearbeatwait = 0,3;
continue;
}
else if ( level.healthregendisabled && getTime() > player.breathingstoptime )
{
self.hearbeatwait = 0,3;
continue;
}
else
{
player playlocalsound( "mpl_player_heartbeat" );
wait self.hearbeatwait;
if ( self.hearbeatwait <= 0,6 )
{
self.hearbeatwait += 0,1;
}
}
}
}

View File

@ -1,12 +1,11 @@
#include maps/mp/zombies/_zm;
#include maps/mp/gametypes_zm/_hud; #include maps/mp/gametypes_zm/_hud;
#include maps/mp/zombies/_zm_utility;
#include maps/mp/gametypes_zm/_hud_util; #include maps/mp/gametypes_zm/_hud_util;
#include common_scripts/utility; #include common_scripts/utility;
#include maps/mp/_utility; #include maps/mp/_utility;
debug_script_structs() debug_script_structs() //dev call did not check
{ {
/*
/# /#
if ( isDefined( level.struct ) ) if ( isDefined( level.struct ) )
{ {
@ -31,9 +30,10 @@ debug_script_structs()
} }
else println( "*** No structs defined." ); else println( "*** No structs defined." );
#/ #/
*/
} }
updatetimerpausedness() updatetimerpausedness() //checked matches cerberus output
{ {
shouldbestopped = isDefined( level.hostmigrationtimer ); shouldbestopped = isDefined( level.hostmigrationtimer );
if ( !level.timerstopped && shouldbestopped ) if ( !level.timerstopped && shouldbestopped )
@ -41,54 +41,49 @@ updatetimerpausedness()
level.timerstopped = 1; level.timerstopped = 1;
level.timerpausetime = getTime(); level.timerpausetime = getTime();
} }
else else if ( level.timerstopped && !shouldbestopped )
{ {
if ( level.timerstopped && !shouldbestopped ) level.timerstopped = 0;
{ level.discardtime += getTime() - level.timerpausetime;
level.timerstopped = 0;
level.discardtime += getTime() - level.timerpausetime;
}
} }
} }
callback_hostmigrationsave() callback_hostmigrationsave() //checked matches cerberus output
{ {
} }
callback_prehostmigrationsave() callback_prehostmigrationsave() //checked matches cerberus output
{ {
undo_link_changes(); undo_link_changes();
disablezombies( 1 ); disablezombies(1);
if ( is_true( level._hm_should_pause_spawning ) ) if ( is_true( level._hm_should_pause_spawning ) )
{ {
flag_set( "spawn_zombies" ); flag_set( "spawn_zombies" );
} }
i = 0; for ( i = 0; i < level.players.size; i++ )
while ( i < level.players.size )
{ {
level.players[ i ] enableinvulnerability(); level.players[ i ] enableinvulnerability();
i++;
} }
} }
pausetimer() pausetimer() //checked matches cerberus output
{ {
level.migrationtimerpausetime = getTime(); level.migrationtimerpausetime = getTime();
} }
resumetimer() resumetimer() //checked matches cerberus output
{ {
level.discardtime += getTime() - level.migrationtimerpausetime; level.discardtime += getTime() - level.migrationtimerpausetime;
} }
locktimer() locktimer() //checked matches cerberus output
{ {
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
level endon( "host_migration_end" ); level endon( "host_migration_end" );
for ( ;; ) for ( ;; )
{ {
currtime = getTime(); currtime = getTime();
wait 0,05; wait 0.05;
if ( !level.timerstopped && isDefined( level.discardtime ) ) if ( !level.timerstopped && isDefined( level.discardtime ) )
{ {
level.discardtime += getTime() - currtime; level.discardtime += getTime() - currtime;
@ -96,7 +91,7 @@ locktimer()
} }
} }
callback_hostmigration() callback_hostmigration() //checked changed to match cerberus output
{ {
redo_link_changes(); redo_link_changes();
setslowmotion( 1, 1, 0 ); setslowmotion( 1, 1, 0 );
@ -104,71 +99,65 @@ callback_hostmigration()
level.hostmigrationreturnedplayercount = 0; level.hostmigrationreturnedplayercount = 0;
if ( level.gameended ) if ( level.gameended )
{ {
/# /*
println( "Migration starting at time " + getTime() + ", but game has ended, so no countdown." ); /#
#/ println("Migration starting at time " + GetTime() + ", but game has ended, so no countdown.");
#/
*/
return; return;
} }
sethostmigrationstatus( 1 ); sethostmigrationstatus(1);
level notify( "host_migration_begin" ); level notify( "host_migration_begin" );
i = 0; for ( i = 0; i < level.players.size; i++ )
while ( i < level.players.size )
{ {
if ( isDefined( level.hostmigration_link_entity_callback ) ) if ( isdefined( level.hostmigration_link_entity_callback ) )
{ {
if ( !isDefined( level.players[ i ]._host_migration_link_entity ) ) if ( !isdefined( level.players[ i ]._host_migration_link_entity ) )
{ {
level.players[ i ]._host_migration_link_entity = level.players[ i ] [[ level.hostmigration_link_entity_callback ]](); level.players[i]._host_migration_link_entity = level.players[ i ] [[ level.hostmigration_link_entity_callback ]]();
} }
} }
level.players[ i ] thread hostmigrationtimerthink(); level.players[ i ] thread hostmigrationtimerthink();
i++;
} }
while ( isDefined( level.hostmigration_ai_link_entity_callback ) ) if ( isdefined( level.hostmigration_ai_link_entity_callback ) )
{ {
zombies = getaiarray( level.zombie_team ); zombies = getaiarray(level.zombie_team);
while ( isDefined( zombies ) && zombies.size > 0 ) if ( isdefined( zombies ) && zombies.size > 0 )
{ {
_a133 = zombies; foreach(zombie in zombies)
_k133 = getFirstArrayKey( _a133 );
while ( isDefined( _k133 ) )
{ {
zombie = _a133[ _k133 ]; if ( !isdefined( zombie._host_migration_link_entity ) )
if ( !isDefined( zombie._host_migration_link_entity ) )
{ {
zombie._host_migration_link_entity = zombie [[ level.hostmigration_ai_link_entity_callback ]](); zombie._host_migration_link_entity = zombie [[ level.hostmigration_ai_link_entity_callback ]]();
} }
_k133 = getNextArrayKey( _a133, _k133 );
} }
} }
} }
if ( level.inprematchperiod ) else if ( level.inprematchperiod )
{ {
level waittill( "prematch_over" ); level waittill("prematch_over");
} }
/# /*
println( "Migration starting at time " + getTime() ); /#
#/ println( "Migration starting at time " + GetTime() );
#/
*/
level.hostmigrationtimer = 1; level.hostmigrationtimer = 1;
thread locktimer(); thread locktimer();
zombies = getaiarray( level.zombie_team ); zombies = getaiarray( level.zombie_team );
while ( isDefined( zombies ) && zombies.size > 0 ) if ( isdefined( zombies ) && zombies.size > 0 )
{ {
_a156 = zombies; foreach ( zombie in zombies )
_k156 = getFirstArrayKey( _a156 );
while ( isDefined( _k156 ) )
{ {
zombie = _a156[ _k156 ]; if ( isdefined(zombie._host_migration_link_entity ) )
if ( isDefined( zombie._host_migration_link_entity ) )
{ {
ent = spawn( "script_origin", zombie.origin ); ent = spawn( "script_origin", zombie.origin );
ent.angles = zombie.angles; ent.angles = zombie.angles;
zombie linkto( ent ); zombie linkto(ent);
ent linkto( zombie._host_migration_link_entity, "tag_origin", zombie._host_migration_link_entity worldtolocalcoords( ent.origin ), ent.angles + zombie._host_migration_link_entity.angles ); ent linkto( zombie._host_migration_link_entity, "tag_origin", zombie._host_migration_link_entity worldtolocalcoords( ent.origin ), ent.angles + zombie._host_migration_link_entity.angles );
zombie._host_migration_link_helper = ent; zombie._host_migration_link_helper = ent;
zombie linkto( zombie._host_migration_link_helper ); zombie linkto( zombie._host_migration_link_helper );
} }
_k156 = getNextArrayKey( _a156, _k156 );
} }
} }
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
@ -178,33 +167,25 @@ callback_hostmigration()
flag_clear( "spawn_zombies" ); flag_clear( "spawn_zombies" );
} }
hostmigrationwait(); hostmigrationwait();
_a185 = level.players; foreach ( player in level.players )
_k185 = getFirstArrayKey( _a185 );
while ( isDefined( _k185 ) )
{ {
player = _a185[ _k185 ];
player thread post_migration_become_vulnerable(); player thread post_migration_become_vulnerable();
_k185 = getNextArrayKey( _a185, _k185 );
} }
zombies = getaiarray( level.zombie_team ); zombies = getaiarray( level.zombie_team );
while ( isDefined( zombies ) && zombies.size > 0 ) if ( isdefined( zombies ) && zombies.size > 0 )
{ {
_a193 = zombies; foreach ( zombie in zombies )
_k193 = getFirstArrayKey( _a193 );
while ( isDefined( _k193 ) )
{ {
zombie = _a193[ _k193 ]; if ( isdefined(zombie._host_migration_link_entity ) )
if ( isDefined( zombie._host_migration_link_entity ) )
{ {
zombie unlink(); zombie unlink();
zombie._host_migration_link_helper delete(); zombie._host_migration_link_helper delete();
zombie._host_migration_link_helper = undefined; zombie._host_migration_link_helper = undefined;
zombie._host_migration_link_entity = undefined; zombie._host_migration_link_entity = undefined;
} }
_k193 = getNextArrayKey( _a193, _k193 );
} }
} }
enablezombies( 1 ); enablezombies(1);
if ( level._hm_should_pause_spawning ) if ( level._hm_should_pause_spawning )
{ {
flag_set( "spawn_zombies" ); flag_set( "spawn_zombies" );
@ -212,46 +193,48 @@ callback_hostmigration()
level.hostmigrationtimer = undefined; level.hostmigrationtimer = undefined;
level._hm_should_pause_spawning = undefined; level._hm_should_pause_spawning = undefined;
sethostmigrationstatus( 0 ); sethostmigrationstatus( 0 );
/# /*
println( "Migration finished at time " + getTime() ); /#
#/ println("Migration finished at time " + GetTime());
#/
*/
level notify( "host_migration_end" ); level notify( "host_migration_end" );
} }
post_migration_become_vulnerable() post_migration_become_vulnerable() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
wait 3; wait( 3 );
self disableinvulnerability(); self disableinvulnerability();
} }
matchstarttimerconsole_internal( counttime, matchstarttimer ) matchstarttimerconsole_internal( counttime, matchstarttimer ) //checked matches cerberus output
{ {
waittillframeend; waittillframeend;
visionsetnaked( "mpIntro", 0 );
level endon( "match_start_timer_beginning" ); level endon( "match_start_timer_beginning" );
while ( counttime > 0 && !level.gameended ) while ( counttime > 0 && !level.gameended )
{ {
matchstarttimer thread maps/mp/gametypes_zm/_hud::fontpulse( level ); matchstarttimer thread maps/mp/gametypes_zm/_hud::fontpulse( level );
wait ( matchstarttimer.inframes * 0,05 ); wait ( matchstarttimer.inframes * 0.05 );
matchstarttimer setvalue( counttime ); matchstarttimer setvalue( counttime );
counttime--; counttime--;
wait ( 1 - ( matchstarttimer.inframes * 0.05 ) );
wait ( 1 - ( matchstarttimer.inframes * 0,05 ) );
} }
} }
matchstarttimerconsole( type, duration ) matchstarttimerconsole( type, duration ) //checked matches cerberus output
{ {
level notify( "match_start_timer_beginning" ); level notify( "match_start_timer_beginning" );
wait 0,05; wait 0,05;
matchstarttext = createserverfontstring( "objective", 1,5 ); matchstarttext = createserverfontstring( "objective", 1.5 );
matchstarttext setpoint( "CENTER", "CENTER", 0, -40 ); matchstarttext setpoint( "CENTER", "CENTER", 0, -40 );
matchstarttext.sort = 1001; matchstarttext.sort = 1001;
matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] ); matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] );
matchstarttext.foreground = 0; matchstarttext.foreground = 0;
matchstarttext.hidewheninmenu = 1; matchstarttext.hidewheninmenu = 1;
matchstarttext settext( game[ "strings" ][ type ] ); matchstarttext settext( game[ "strings" ][ type ] );
matchstarttimer = createserverfontstring( "objective", 2,2 ); matchstarttimer = createserverfontstring( "objective", 2.2 );
matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 ); matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 );
matchstarttimer.sort = 1001; matchstarttimer.sort = 1001;
matchstarttimer.color = ( 1, 1, 0 ); matchstarttimer.color = ( 1, 1, 0 );
@ -267,7 +250,7 @@ matchstarttimerconsole( type, duration )
matchstarttext destroyelem(); matchstarttext destroyelem();
} }
hostmigrationwait() hostmigrationwait() //checked matches cerberus output may need to check order of operations
{ {
level endon( "game_ended" ); level endon( "game_ended" );
if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) ) if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) )
@ -275,17 +258,18 @@ hostmigrationwait()
thread matchstarttimerconsole( "waiting_for_teams", 20 ); thread matchstarttimerconsole( "waiting_for_teams", 20 );
hostmigrationwaitforplayers(); hostmigrationwaitforplayers();
} }
level notify( "host_migration_countdown_begin" );
thread matchstarttimerconsole( "match_starting_in", 5 ); thread matchstarttimerconsole( "match_starting_in", 5 );
wait 5; wait 5;
} }
hostmigrationwaitforplayers() hostmigrationwaitforplayers() //checked matches cerberus output
{ {
level endon( "hostmigration_enoughplayers" ); level endon( "hostmigration_enoughplayers" );
wait 15; wait 15;
} }
hostmigrationtimerthink_internal() hostmigrationtimerthink_internal() //checked matches cerberus output
{ {
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
level endon( "host_migration_end" ); level endon( "host_migration_end" );
@ -294,23 +278,25 @@ hostmigrationtimerthink_internal()
{ {
self waittill( "spawned" ); self waittill( "spawned" );
} }
if ( isDefined( self._host_migration_link_entity ) ) if ( isdefined( self._host_migration_link_entity ) )
{ {
ent = spawn( "script_origin", self.origin ); ent = spawn( "script_origin", self.origin );
ent.angles = self.angles; ent.angles = self.angles;
self linkto( ent ); self linkto( ent );
ent linkto( self._host_migration_link_entity, "tag_origin", self._host_migration_link_entity worldtolocalcoords( ent.origin ), ent.angles + self._host_migration_link_entity.angles ); ent linkto( self._host_migration_link_entity, "tag_origin", self._host_migration_link_entity worldtolocalcoords( ent.origin ), ent.angles + self._host_migration_link_entity.angles );
self._host_migration_link_helper = ent; self._host_migration_link_helper = ent;
/# /*
println( "Linking player to ent " + self._host_migration_link_entity.targetname ); /#
#/ println( "Linking player to ent " + self._host_migration_link_entity.targetname );
#/
*/
} }
self.hostmigrationcontrolsfrozen = 1; self.hostmigrationcontrolsfrozen = 1;
self freezecontrols( 1 ); self freezecontrols( 1 );
level waittill( "host_migration_end" ); level waittill( "host_migration_end" );
} }
hostmigrationtimerthink() hostmigrationtimerthink() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
level endon( "host_migration_begin" ); level endon( "host_migration_begin" );
@ -319,16 +305,18 @@ hostmigrationtimerthink()
{ {
self freezecontrols( 0 ); self freezecontrols( 0 );
self.hostmigrationcontrolsfrozen = 0; self.hostmigrationcontrolsfrozen = 0;
/# /*
println( " Host migration unfreeze controls" ); /#
#/ println(" Host migration unfreeze controls");
#/
*/
} }
if ( isDefined( self._host_migration_link_entity ) ) if ( isdefined( self._host_migration_link_entity ) )
{ {
self unlink(); self unlink();
self._host_migration_link_helper delete(); self._host_migration_link_helper delete();
self._host_migration_link_helper = undefined; self._host_migration_link_helper = undefined;
if ( isDefined( self._host_migration_link_entity._post_host_migration_thread ) ) if ( isdefined( self._host_migration_link_entity._post_host_migration_thread ) )
{ {
self thread [[ self._host_migration_link_entity._post_host_migration_thread ]]( self._host_migration_link_entity ); self thread [[ self._host_migration_link_entity._post_host_migration_thread ]]( self._host_migration_link_entity );
} }
@ -336,7 +324,7 @@ hostmigrationtimerthink()
} }
} }
waittillhostmigrationdone() waittillhostmigrationdone() //checked matches cerberus output
{ {
if ( !isDefined( level.hostmigrationtimer ) ) if ( !isDefined( level.hostmigrationtimer ) )
{ {
@ -347,7 +335,7 @@ waittillhostmigrationdone()
return getTime() - starttime; return getTime() - starttime;
} }
waittillhostmigrationstarts( duration ) waittillhostmigrationstarts( duration ) //checked matches cerberus output
{ {
if ( isDefined( level.hostmigrationtimer ) ) if ( isDefined( level.hostmigrationtimer ) )
{ {
@ -357,15 +345,17 @@ waittillhostmigrationstarts( duration )
wait duration; wait duration;
} }
waitlongdurationwithhostmigrationpause( duration ) waitlongdurationwithhostmigrationpause( duration ) //checked matches cerberus output may need to check order of operations
{ {
if ( duration == 0 ) if ( duration == 0 )
{ {
return; return;
} }
/*
/# /#
assert( duration > 0 ); assert( duration > 0 );
#/ #/
*/
starttime = getTime(); starttime = getTime();
endtime = getTime() + ( duration * 1000 ); endtime = getTime() + ( duration * 1000 );
while ( getTime() < endtime ) while ( getTime() < endtime )
@ -377,25 +367,68 @@ waitlongdurationwithhostmigrationpause( duration )
endtime += timepassed; endtime += timepassed;
} }
} }
/*
/#
if ( getTime() != endtime ) if ( getTime() != endtime )
{ {
/#
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime );
#/ #/
} }
*/
waittillhostmigrationdone(); waittillhostmigrationdone();
return getTime() - starttime; return getTime() - starttime;
} }
waitlongdurationwithgameendtimeupdate( duration ) waitlongdurationwithhostmigrationpauseemp( duration ) //checked matches cerberus output may need to check order of operations
{ {
if ( duration == 0 ) if ( duration == 0 )
{ {
return; return;
} }
/*
/# /#
assert( duration > 0 ); assert( duration > 0 );
#/ #/
*/
starttime = getTime();
empendtime = getTime() + ( duration * 1000 );
level.empendtime = empendtime;
while ( getTime() < empendtime )
{
waittillhostmigrationstarts( ( empendtime - getTime() ) / 1000 );
if ( isDefined( level.hostmigrationtimer ) )
{
timepassed = waittillhostmigrationdone();
if ( isDefined( empendtime ) )
{
empendtime += timepassed;
}
}
}
/*
/#
if ( getTime() != empendtime )
{
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO empendtime = " + empendtime );
#/
}
*/
waittillhostmigrationdone();
level.empendtime = undefined;
return getTime() - starttime;
}
waitlongdurationwithgameendtimeupdate( duration ) //checked matches cerberus output may need to check order of operations
{
if ( duration == 0 )
{
return;
}
/*
/#
assert( duration > 0 );
#/
*/
starttime = getTime(); starttime = getTime();
endtime = getTime() + ( duration * 1000 ); endtime = getTime() + ( duration * 1000 );
while ( getTime() < endtime ) while ( getTime() < endtime )
@ -408,12 +441,14 @@ waitlongdurationwithgameendtimeupdate( duration )
wait 1; wait 1;
} }
} }
/*
/# /#
if ( getTime() != endtime ) if ( getTime() != endtime )
{ {
println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime );
#/ #/
} }
*/
while ( isDefined( level.hostmigrationtimer ) ) while ( isDefined( level.hostmigrationtimer ) )
{ {
endtime += 1000; endtime += 1000;
@ -423,124 +458,114 @@ waitlongdurationwithgameendtimeupdate( duration )
return getTime() - starttime; return getTime() - starttime;
} }
find_alternate_player_place( v_origin, min_radius, max_radius, max_height, ignore_targetted_nodes ) find_alternate_player_place( v_origin, min_radius, max_radius, max_height, ignore_targetted_nodes ) //checked partially changed to match cerberus output //continue in for loop bad see github for more info
{ {
found_node = undefined; found_node = undefined;
a_nodes = getnodesinradiussorted( v_origin, max_radius, min_radius, max_height, "pathnodes" ); a_nodes = getnodesinradiussorted( v_origin, max_radius, min_radius, max_height, "pathnodes" );
while ( isDefined( a_nodes ) && a_nodes.size > 0 ) if ( isdefined( a_nodes) && a_nodes.size > 0 )
{ {
a_player_volumes = getentarray( "player_volume", "script_noteworthy" ); a_player_volumes = getentarray( "player_volume", "script_noteworthy" );
index = a_nodes.size - 1; index = a_nodes.size - 1;
i = index; i = index;
while ( i >= 0 ) while ( i >= 0; )
{ {
n_node = a_nodes[ i ]; n_node = a_nodes[i];
if ( ignore_targetted_nodes == 1 ) if ( ignore_targetted_nodes == 1 )
{ {
if ( isDefined( n_node.target ) ) if ( isdefined( n_node.target ) )
{ {
i--; i--;
continue; continue;
} }
} }
else if ( !positionwouldtelefrag( n_node.origin ) )
{ {
if ( !positionwouldtelefrag( n_node.origin ) ) if ( maps/mp/zombies/_zm_utility::check_point_in_enabled_zone( n_node.origin, 1, a_player_volumes ) )
{ {
if ( maps/mp/zombies/_zm_utility::check_point_in_enabled_zone( n_node.origin, 1, a_player_volumes ) ) v_start = ( n_node.origin[ 0 ], n_node.origin[ 1 ], n_node.origin[ 2 ] + 30 );
v_end = ( n_node.origin[ 0 ], n_node.origin[ 1 ], n_node.origin[ 2 ] - 30 );
trace = bullettrace( v_start, v_end, 0, undefined );
if ( trace["fraction"] < 1 )
{ {
v_start = ( n_node.origin[ 0 ], n_node.origin[ 1 ], n_node.origin[ 2 ] + 30 ); override_abort = 0;
v_end = ( n_node.origin[ 0 ], n_node.origin[ 1 ], n_node.origin[ 2 ] - 30 ); if ( isdefined( level._chugabud_reject_node_override_func ) )
trace = bullettrace( v_start, v_end, 0, undefined );
if ( trace[ "fraction" ] < 1 )
{ {
override_abort = 0; override_abort = [[ level._chugabud_reject_node_override_func ]]( v_origin, n_node );
if ( isDefined( level._chugabud_reject_node_override_func ) ) }
{ if ( !override_abort )
override_abort = [[ level._chugabud_reject_node_override_func ]]( v_origin, n_node ); {
} found_node = n_node;
if ( !override_abort ) break;
{
found_node = n_node;
break;
}
} }
} }
} }
} }
else i--;
{
i--;
}
} }
} }
return found_node; return found_node;
} }
hostmigration_put_player_in_better_place() hostmigration_put_player_in_better_place() //checked changed to match cerberus output
{ {
spawnpoint = undefined; spawnpoint = undefined;
spawnpoint = find_alternate_player_place( self.origin, 50, 150, 64, 1 ); spawnpoint = find_alternate_player_place( self.origin, 50, 150, 64, 1 );
if ( !isDefined( spawnpoint ) ) if ( !isdefined(spawnpoint ) )
{ {
spawnpoint = find_alternate_player_place( self.origin, 150, 400, 64, 1 ); spawnpoint = find_alternate_player_place( self.origin, 150, 400, 64, 1 );
} }
if ( !isDefined( spawnpoint ) ) if ( !isdefined(spawnpoint ) )
{ {
spawnpoint = find_alternate_player_place( self.origin, 50, 400, 256, 0 ); spawnpoint = find_alternate_player_place( self.origin, 50, 400, 256, 0 );
} }
if ( !isDefined( spawnpoint ) ) if ( !isdefined( spawnpoint ) )
{ {
spawnpoint = maps/mp/zombies/_zm::check_for_valid_spawn_near_team( self, 1 ); spawnpoint = maps/mp/zombies/_zm::check_for_valid_spawn_near_team( self, 1 );
} }
if ( !isDefined( spawnpoint ) ) if ( !isdefined( spawnpoint ) )
{ {
match_string = ""; match_string = "";
location = level.scr_zm_map_start_location; location = level.scr_zm_map_start_location;
if ( location != "default" && location == "" && isDefined( level.default_start_location ) ) if ( location == "default" || location == "" && isdefined(level.default_start_location ) )
{ {
location = level.default_start_location; location = level.default_start_location;
} }
match_string = ( level.scr_zm_ui_gametype + "_" ) + location; match_string = level.scr_zm_ui_gametype + "_" + location;
spawnpoints = []; spawnpoints = [];
structs = getstructarray( "initial_spawn", "script_noteworthy" ); structs = getstructarray( "initial_spawn", "script_noteworthy" );
while ( isDefined( structs ) ) if ( isdefined( structs ) )
{ {
_a559 = structs; foreach ( struct in structs )
_k559 = getFirstArrayKey( _a559 );
while ( isDefined( _k559 ) )
{ {
struct = _a559[ _k559 ]; if ( isdefined( struct.script_string ) )
while ( isDefined( struct.script_string ) )
{ {
tokens = strtok( struct.script_string, " " ); tokens = strtok( struct.script_string, " " );
_a565 = tokens; i = 0;
_k565 = getFirstArrayKey( _a565 ); while ( i < tokens.size )
while ( isDefined( _k565 ) )
{ {
token = _a565[ _k565 ];
if ( token == match_string ) if ( token == match_string )
{ {
spawnpoints[ spawnpoints.size ] = struct; spawnpoints[ spawnpoints.size ] = struct;
} }
_k565 = getNextArrayKey( _a565, _k565 ); i++;
} }
} }
_k559 = getNextArrayKey( _a559, _k559 );
} }
} }
if ( !isDefined( spawnpoints ) || spawnpoints.size == 0 ) else if ( !isdefined(spawnpoints) || spawnpoints.size == 0 )
{ {
spawnpoints = getstructarray( "initial_spawn_points", "targetname" ); spawnpoints = getstructarray( "initial_spawn_points", "targetname" );
} }
/# /*
assert( isDefined( spawnpoints ), "Could not find initial spawn points!" ); /#
#/ assert( isdefined( spawnpoints ), "Could not find initial spawn points!" );
#/
*/
spawnpoint = maps/mp/zombies/_zm::getfreespawnpoint( spawnpoints, self ); spawnpoint = maps/mp/zombies/_zm::getfreespawnpoint( spawnpoints, self );
} }
if ( isDefined( spawnpoint ) ) if ( isdefined( spawnpoint ) )
{ {
self setorigin( spawnpoint.origin ); self setorigin( spawnpoint.origin );
} }
} }

View File

@ -2,7 +2,7 @@
#include maps/mp/gametypes_zm/_globallogic; #include maps/mp/gametypes_zm/_globallogic;
#include maps/mp/_utility; #include maps/mp/_utility;
init() init() //checked changed to match cerberus output
{ {
precachestring( &"open_ingame_menu" ); precachestring( &"open_ingame_menu" );
game[ "menu_team" ] = "team_marinesopfor"; game[ "menu_team" ] = "team_marinesopfor";
@ -16,13 +16,9 @@ init()
game[ "menu_changeclass_wager" ] = "changeclass_wager"; game[ "menu_changeclass_wager" ] = "changeclass_wager";
game[ "menu_changeclass_custom" ] = "changeclass_custom"; game[ "menu_changeclass_custom" ] = "changeclass_custom";
game[ "menu_changeclass_barebones" ] = "changeclass_barebones"; game[ "menu_changeclass_barebones" ] = "changeclass_barebones";
_a18 = level.teams; foreach ( team in level.teams )
_k18 = getFirstArrayKey( _a18 );
while ( isDefined( _k18 ) )
{ {
team = _a18[ _k18 ];
game[ "menu_changeclass_" + team ] = "changeclass"; game[ "menu_changeclass_" + team ] = "changeclass";
_k18 = getNextArrayKey( _a18, _k18 );
} }
game[ "menu_controls" ] = "ingame_controls"; game[ "menu_controls" ] = "ingame_controls";
game[ "menu_options" ] = "ingame_options"; game[ "menu_options" ] = "ingame_options";
@ -50,7 +46,7 @@ init()
level thread onplayerconnect(); level thread onplayerconnect();
} }
onplayerconnect() onplayerconnect() //checked matches cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
@ -59,7 +55,7 @@ onplayerconnect()
} }
} }
onmenuresponse() onmenuresponse() //checked changed to match cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) for ( ;; )
@ -71,7 +67,7 @@ onmenuresponse()
self closeingamemenu(); self closeingamemenu();
if ( level.console ) if ( level.console )
{ {
if ( game[ "menu_changeclass" ] != menu && game[ "menu_changeclass_offline" ] != menu || menu == game[ "menu_team" ] && menu == game[ "menu_controls" ] ) if ( menu == game[ "menu_changeclass" ] || menu == game[ "menu_changeclass_offline" ] || menu == game[ "menu_team" ] || menu == game[ "menu_controls" ] )
{ {
if ( isDefined( level.teams[ self.pers[ "team" ] ] ) ) if ( isDefined( level.teams[ self.pers[ "team" ] ] ) )
{ {
@ -81,7 +77,7 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( response == "changeteam" && level.allow_teamchange == "1" ) if ( response == "changeteam" && level.allow_teamchange == "1" )
{ {
self closemenu(); self closemenu();
self closeingamemenu(); self closeingamemenu();
@ -97,7 +93,7 @@ onmenuresponse()
} }
if ( response == "endgame" ) if ( response == "endgame" )
{ {
if ( self issplitscreen() ) if ( level.splitscreen )
{ {
level.skipvote = 1; level.skipvote = 1;
if ( !level.gameended ) if ( !level.gameended )
@ -107,15 +103,16 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( response == "killserverpc" ) if ( response == "killserverpc" )
{ {
level thread maps/mp/gametypes_zm/_globallogic::killserverpc(); level thread maps/mp/gametypes_zm/_globallogic::killserverpc();
continue; continue;
} }
else if ( response == "endround" ) if ( response == "endround" )
{ {
if ( !level.gameended ) if ( !level.gameended )
{ {
self gamehistoryplayerquit();
level thread maps/mp/gametypes_zm/_globallogic::forceend(); level thread maps/mp/gametypes_zm/_globallogic::forceend();
} }
else else
@ -126,7 +123,7 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" )
{ {
switch( response ) switch( response )
{ {
@ -142,34 +139,29 @@ onmenuresponse()
} }
continue; continue;
} }
else if ( menu == game[ "menu_changeclass" ] || menu == game[ "menu_changeclass_offline" ] || menu == game[ "menu_changeclass_wager" ] || menu == game[ "menu_changeclass_custom" ] || menu == game[ "menu_changeclass_barebones" ] )
{ {
if ( game[ "menu_changeclass" ] != menu && game[ "menu_changeclass_offline" ] != menu && game[ "menu_changeclass_wager" ] != menu || menu == game[ "menu_changeclass_custom" ] && menu == game[ "menu_changeclass_barebones" ] ) self closemenu();
self closeingamemenu();
if ( level.rankedmatch && issubstr( response, "custom" ) )
{ {
self closemenu(); if ( self isitemlocked( maps/mp/gametypes_zm/_rank::getitemindex( "feature_cac" ) ) )
self closeingamemenu();
if ( level.rankedmatch && issubstr( response, "custom" ) )
{ {
if ( self isitemlocked( maps/mp/gametypes_zm/_rank::getitemindex( "feature_cac" ) ) ) kick( self getentitynumber() );
{
kick( self getentitynumber() );
}
} }
self.selectedclass = 1;
self [[ level.class ]]( response );
break;
} }
else self.selectedclass = 1;
self [[ level.class ]]( response );
continue;
}
if ( menu == "spectate" )
{
player = getplayerfromclientnum( int( response ) );
if ( isDefined( player ) )
{ {
if ( menu == "spectate" ) self setcurrentspectatorclient( player );
{
player = getplayerfromclientnum( int( response ) );
if ( isDefined( player ) )
{
self setcurrentspectatorclient( player );
}
}
} }
} }
} }
} }

View File

@ -1,6 +1,6 @@
#include maps/mp/_utility; #include maps/mp/_utility;
gettweakabledvarvalue( category, name ) gettweakabledvarvalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -32,14 +32,16 @@ gettweakabledvarvalue( category, name )
dvar = undefined; dvar = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( dvar ) ); assert( isDefined( dvar ) );
#/ #/
*/
value = getDvarInt( dvar ); value = getDvarInt( dvar );
return value; return value;
} }
gettweakabledvar( category, name ) gettweakabledvar( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -71,13 +73,15 @@ gettweakabledvar( category, name )
value = undefined; value = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
gettweakablevalue( category, name ) gettweakablevalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -114,13 +118,15 @@ gettweakablevalue( category, name )
{ {
return getDvarInt( overridedvar ); return getDvarInt( overridedvar );
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
gettweakablelastvalue( category, name ) gettweakablelastvalue( category, name ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -152,13 +158,15 @@ gettweakablelastvalue( category, name )
value = undefined; value = undefined;
break; break;
} }
/*
/# /#
assert( isDefined( value ) ); assert( isDefined( value ) );
#/ #/
*/
return value; return value;
} }
settweakablevalue( category, name, value ) settweakablevalue( category, name, value ) //checked matches cerberus output
{ {
switch( category ) switch( category )
{ {
@ -193,7 +201,7 @@ settweakablevalue( category, name, value )
setdvar( dvar, value ); setdvar( dvar, value );
} }
settweakablelastvalue( category, name, value ) settweakablelastvalue( category, name, value ) //checked changed to match cerberus output
{ {
switch( category ) switch( category )
{ {
@ -222,11 +230,11 @@ settweakablelastvalue( category, name, value )
level.hudtweaks[ name ].lastvalue = value; level.hudtweaks[ name ].lastvalue = value;
break; break;
default: default:
} break;
} }
} }
registertweakable( category, name, dvar, value ) registertweakable( category, name, dvar, value ) //checked matches cerberus output
{ {
if ( isstring( value ) ) if ( isstring( value ) )
{ {
@ -324,7 +332,7 @@ registertweakable( category, name, dvar, value )
} }
} }
init() init() //checked matches cerberus output
{ {
level.clienttweakables = []; level.clienttweakables = [];
level.tweakablesinitialized = 1; level.tweakablesinitialized = 1;
@ -362,17 +370,16 @@ init()
level thread updateuitweakables(); level thread updateuitweakables();
} }
setclienttweakable( category, name ) setclienttweakable( category, name ) //checked matches cerberus output
{ {
level.clienttweakables[ level.clienttweakables.size ] = name; level.clienttweakables[ level.clienttweakables.size ] = name;
} }
updateuitweakables() updateuitweakables() //checked changed to match cerberus output
{ {
for ( ;; ) for ( ;; )
{ {
index = 0; for ( index = 0; index < level.clienttweakables.size; index++ )
while ( index < level.clienttweakables.size )
{ {
clienttweakable = level.clienttweakables[ index ]; clienttweakable = level.clienttweakables[ index ];
curvalue = gettweakabledvarvalue( "hud", clienttweakable ); curvalue = gettweakabledvarvalue( "hud", clienttweakable );
@ -382,13 +389,13 @@ updateuitweakables()
updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue ); updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue );
settweakablelastvalue( "hud", clienttweakable, curvalue ); settweakablelastvalue( "hud", clienttweakable, curvalue );
} }
index++;
} }
wait 1; wait 1;
} }
} }
updateserverdvar( dvar, value ) updateserverdvar( dvar, value ) //checked matches cerberus output
{ {
makedvarserverinfo( dvar, value ); makedvarserverinfo( dvar, value );
} }

View File

@ -11,7 +11,7 @@
#include maps/mp/_utility; #include maps/mp/_utility;
#include maps/mp/zombies/_zm_perks; #include maps/mp/zombies/_zm_perks;
init() init() //checked matches cerberus output
{ {
level.chugabud_laststand_func = ::chugabud_laststand; level.chugabud_laststand_func = ::chugabud_laststand;
level thread chugabud_hostmigration(); level thread chugabud_hostmigration();
@ -20,15 +20,15 @@ init()
add_custom_limited_weapon_check( ::is_weapon_available_in_chugabud_corpse ); add_custom_limited_weapon_check( ::is_weapon_available_in_chugabud_corpse );
} }
chugabug_precache() chugabug_precache() //checked matches cerberus output
{ {
} }
chugabud_player_init() chugabud_player_init() //checked matches cerberus output
{ {
} }
chugabud_laststand() chugabud_laststand() //checked changed to match cerberus output
{ {
self endon( "player_suicide" ); self endon( "player_suicide" );
self endon( "disconnect" ); self endon( "disconnect" );
@ -39,7 +39,7 @@ chugabud_laststand()
self maps/mp/zombies/_zm_chugabud::chugabud_save_loadout(); self maps/mp/zombies/_zm_chugabud::chugabud_save_loadout();
self maps/mp/zombies/_zm_chugabud::chugabud_fake_death(); self maps/mp/zombies/_zm_chugabud::chugabud_fake_death();
wait 3; wait 3;
if ( isDefined( self.insta_killed ) || self.insta_killed && isDefined( self.disable_chugabud_corpse ) ) if ( isDefined( self.insta_killed ) && self.insta_killed || isDefined( self.disable_chugabud_corpse ) )
{ {
create_corpse = 0; create_corpse = 0;
} }
@ -102,7 +102,7 @@ chugabud_laststand()
self chugabud_laststand_cleanup( corpse, undefined ); self chugabud_laststand_cleanup( corpse, undefined );
} }
chugabud_laststand_cleanup( corpse, str_notify ) chugabud_laststand_cleanup( corpse, str_notify ) //checked matches cerberus output
{ {
if ( isDefined( str_notify ) ) if ( isDefined( str_notify ) )
{ {
@ -112,23 +112,22 @@ chugabud_laststand_cleanup( corpse, str_notify )
self chugabud_corpse_cleanup( corpse, 1 ); self chugabud_corpse_cleanup( corpse, 1 );
} }
chugabud_bleed_timeout( delay, corpse ) chugabud_bleed_timeout( delay, corpse ) //checked changed to match cerberus output
{ {
self endon( "player_suicide" ); self endon( "player_suicide" );
self endon( "disconnect" ); self endon( "disconnect" );
corpse endon( "death" ); corpse endon( "death" );
wait delay; wait delay;
while ( isDefined( corpse.revivetrigger ) ) if ( isDefined( corpse.revivetrigger ) )
{ {
while ( corpse.revivetrigger.beingrevived ) while ( corpse.revivetrigger.beingrevived )
{ {
wait 0.01; wait 0.01;
} }
} }
while ( isDefined( self.loadout.perks ) && flag( "solo_game" ) ) if ( isDefined( self.loadout.perks ) && flag( "solo_game" ) )
{ {
i = 0; for ( i = 0; i < self.loadout.perks.size; i++ )
while ( i < self.loadout.perks.size )
{ {
perk = self.loadout.perks[ i ]; perk = self.loadout.perks[ i ];
if ( perk == "specialty_quickrevive" ) if ( perk == "specialty_quickrevive" )
@ -137,13 +136,12 @@ chugabud_bleed_timeout( delay, corpse )
corpse notify( "player_revived" ); corpse notify( "player_revived" );
return; return;
} }
i++;
} }
} }
self chugabud_corpse_cleanup( corpse, 0 ); self chugabud_corpse_cleanup( corpse, 0 );
} }
chugabud_corpse_cleanup( corpse, was_revived ) chugabud_corpse_cleanup( corpse, was_revived ) //checked matches cerberus output
{ {
self notify( "chugabud_effects_cleanup" ); self notify( "chugabud_effects_cleanup" );
if ( was_revived ) if ( was_revived )
@ -174,14 +172,14 @@ chugabud_corpse_cleanup( corpse, was_revived )
self.e_chugabud_corpse = undefined; self.e_chugabud_corpse = undefined;
} }
chugabud_handle_multiple_instances( corpse ) chugabud_handle_multiple_instances( corpse ) //checked matches cerberus output
{ {
corpse endon( "death" ); corpse endon( "death" );
self waittill( "perk_chugabud_activated" ); self waittill( "perk_chugabud_activated" );
self chugabud_corpse_cleanup( corpse, 0 ); self chugabud_corpse_cleanup( corpse, 0 );
} }
chugabud_spawn_corpse() chugabud_spawn_corpse() //checked matches cerberus output
{ {
corpse = maps/mp/zombies/_zm_clone::spawn_player_clone( self, self.origin, undefined, self.whos_who_shader ); corpse = maps/mp/zombies/_zm_clone::spawn_player_clone( self, self.origin, undefined, self.whos_who_shader );
corpse.angles = self.angles; corpse.angles = self.angles;
@ -192,7 +190,7 @@ chugabud_spawn_corpse()
return corpse; return corpse;
} }
chugabud_revive_hud_create() chugabud_revive_hud_create() //checked matches cerberus output
{ {
self.revive_hud = newclienthudelem( self ); self.revive_hud = newclienthudelem( self );
self.revive_hud.alignx = "center"; self.revive_hud.alignx = "center";
@ -209,7 +207,7 @@ chugabud_revive_hud_create()
return self.revive_hud; return self.revive_hud;
} }
chugabud_save_loadout() chugabud_save_loadout() //checked changed to match cerberus output
{ {
primaries = self getweaponslistprimaries(); primaries = self getweaponslistprimaries();
currentweapon = self getcurrentweapon(); currentweapon = self getcurrentweapon();
@ -218,17 +216,13 @@ chugabud_save_loadout()
self.loadout.weapons = []; self.loadout.weapons = [];
self.loadout.score = self.score; self.loadout.score = self.score;
self.loadout.current_weapon = -1; self.loadout.current_weapon = -1;
_a376 = primaries; foreach ( weapon in primaries )
index = getFirstArrayKey( _a376 );
while ( isDefined( index ) )
{ {
weapon = _a376[ index ];
self.loadout.weapons[ index ] = maps/mp/zombies/_zm_weapons::get_player_weapondata( self, weapon ); self.loadout.weapons[ index ] = maps/mp/zombies/_zm_weapons::get_player_weapondata( self, weapon );
if ( weapon == currentweapon || self.loadout.weapons[ index ][ "alt_name" ] == currentweapon ) if ( weapon == currentweapon || self.loadout.weapons[ index ][ "alt_name" ] == currentweapon )
{ {
self.loadout.current_weapon = index; self.loadout.current_weapon = index;
} }
index = getNextArrayKey( _a376, index );
} }
self.loadout.equipment = self get_player_equipment(); self.loadout.equipment = self get_player_equipment();
if ( isDefined( self.loadout.equipment ) ) if ( isDefined( self.loadout.equipment ) )
@ -249,7 +243,7 @@ chugabud_save_loadout()
} }
} }
chugabud_save_grenades() chugabud_save_grenades() //checked matches cerberus output
{ {
if ( self hasweapon( "emp_grenade_zm" ) ) if ( self hasweapon( "emp_grenade_zm" ) )
{ {
@ -268,20 +262,16 @@ chugabud_save_grenades()
} }
} }
chugabud_give_loadout() chugabud_give_loadout() //checked partially changed to match cerberus output continues in for loops bad see the github for more info
{ {
self takeallweapons(); self takeallweapons();
loadout = self.loadout; loadout = self.loadout;
primaries = self getweaponslistprimaries(); primaries = self getweaponslistprimaries();
while ( loadout.weapons.size > 1 || primaries.size > 1 ) if ( loadout.weapons.size > 1 || primaries.size > 1 )
{ {
_a458 = primaries; foreach ( weapon in primaries )
_k458 = getFirstArrayKey( _a458 );
while ( isDefined( _k458 ) )
{ {
weapon = _a458[ _k458 ];
self takeweapon( weapon ); self takeweapon( weapon );
_k458 = getNextArrayKey( _a458, _k458 );
} }
} }
i = 0; i = 0;
@ -292,15 +282,12 @@ chugabud_give_loadout()
i++; i++;
continue; continue;
} }
else if ( loadout.weapons[ i ][ "name" ] == "none" ) if ( loadout.weapons[ i ][ "name" ] == "none" )
{ {
i++; i++;
continue; continue;
} }
else self maps/mp/zombies/_zm_weapons::weapondata_give( loadout.weapons[ i ] );
{
self maps/mp/zombies/_zm_weapons::weapondata_give( loadout.weapons[ i ] );
}
i++; i++;
} }
if ( loadout.current_weapon >= 0 && isDefined( loadout.weapons[ loadout.current_weapon ][ "name" ] ) ) if ( loadout.current_weapon >= 0 && isDefined( loadout.weapons[ loadout.current_weapon ][ "name" ] ) )
@ -314,17 +301,14 @@ chugabud_give_loadout()
self.score = loadout.score; self.score = loadout.score;
self.pers[ "score" ] = loadout.score; self.pers[ "score" ] = loadout.score;
perk_array = maps/mp/zombies/_zm_perks::get_perk_array( 1 ); perk_array = maps/mp/zombies/_zm_perks::get_perk_array( 1 );
i = 0; for ( i = 0; i < perk_array.size; i++ )
while ( i < perk_array.size )
{ {
perk = perk_array[ i ]; perk = perk_array[ i ];
self unsetperk( perk ); self unsetperk( perk );
self.num_perks--; self.num_perks--;
self set_perk_clientfield( perk, 0 ); self set_perk_clientfield( perk, 0 );
i++;
} }
while ( isDefined( loadout.perks ) && loadout.perks.size > 0 ) if ( isDefined( loadout.perks ) && loadout.perks.size > 0 )
{ {
i = 0; i = 0;
while ( i < loadout.perks.size ) while ( i < loadout.perks.size )
@ -334,7 +318,7 @@ chugabud_give_loadout()
i++; i++;
continue; continue;
} }
else if ( loadout.perks[ i ] == "specialty_quickrevive" && flag( "solo_game" ) ) if ( loadout.perks[ i ] == "specialty_quickrevive" && flag( "solo_game" ) )
{ {
level.solo_game_free_player_quickrevive = 1; level.solo_game_free_player_quickrevive = 1;
} }
@ -343,10 +327,7 @@ chugabud_give_loadout()
i++; i++;
continue; continue;
} }
else maps/mp/zombies/_zm_perks::give_perk( loadout.perks[ i ] );
{
maps/mp/zombies/_zm_perks::give_perk( loadout.perks[ i ] );
}
i++; i++;
} }
} }
@ -361,7 +342,7 @@ chugabud_give_loadout()
} }
} }
chugabud_restore_grenades() chugabud_restore_grenades() //checked matches cerberus output
{ {
if ( isDefined( self.loadout.hasemp ) && self.loadout.hasemp ) if ( isDefined( self.loadout.hasemp ) && self.loadout.hasemp )
{ {
@ -375,7 +356,7 @@ chugabud_restore_grenades()
} }
} }
chugabud_restore_claymore() chugabud_restore_claymore() //checked matches cerberus output
{ {
if ( isDefined( self.loadout.hasclaymore ) && self.loadout.hasclaymore && !self hasweapon( "claymore_zm" ) ) if ( isDefined( self.loadout.hasclaymore ) && self.loadout.hasclaymore && !self hasweapon( "claymore_zm" ) )
{ {
@ -386,7 +367,7 @@ chugabud_restore_claymore()
} }
} }
chugabud_fake_death() chugabud_fake_death() //checked matches cerberus output
{ {
level notify( "fake_death" ); level notify( "fake_death" );
self notify( "fake_death" ); self notify( "fake_death" );
@ -401,7 +382,7 @@ chugabud_fake_death()
wait 0.9; wait 0.9;
} }
chugabud_fake_revive() chugabud_fake_revive() //checked matches cerberus output
{ {
level notify( "fake_revive" ); level notify( "fake_revive" );
self notify( "fake_revive" ); self notify( "fake_revive" );
@ -446,7 +427,7 @@ chugabud_fake_revive()
self disableinvulnerability(); self disableinvulnerability();
} }
chugabud_get_spawnpoint() chugabud_get_spawnpoint() //checked partially changed to match cerberus output nested foreach is probably bad
{ {
spawnpoint = undefined; spawnpoint = undefined;
if ( get_chugabug_spawn_point_from_nodes( self.origin, 500, 700, 64, 1 ) ) if ( get_chugabug_spawn_point_from_nodes( self.origin, 500, 700, 64, 1 ) )
@ -475,36 +456,30 @@ chugabud_get_spawnpoint()
{ {
match_string = ""; match_string = "";
location = level.scr_zm_map_start_location; location = level.scr_zm_map_start_location;
if ( location != "default" && location == "" && isDefined( level.default_start_location ) ) if ( (location == "default" || location == "" ) && isdefined( level.default_start_location ) )
{ {
location = level.default_start_location; location = level.default_start_location;
} }
match_string = ( level.scr_zm_ui_gametype + "_" ) + location; match_string = level.scr_zm_ui_gametype + "_" + location;
spawnpoints = []; spawnpoints = [];
structs = getstructarray( "initial_spawn", "script_noteworthy" ); structs = getstructarray( "initial_spawn", "script_noteworthy" );
while ( isDefined( structs ) ) if ( isdefined( structs ) )
{ {
_a744 = structs; foreach ( struct in structs )
_k744 = getFirstArrayKey( _a744 );
while ( isDefined( _k744 ) )
{ {
struct = _a744[ _k744 ]; if ( isdefined( struct.script_string ) )
while ( isDefined( struct.script_string ) )
{ {
tokens = strtok( struct.script_string, " " ); tokens = strtok( struct.script_string, " " );
_a750 = tokens; i = 0;
_k750 = getFirstArrayKey( _a750 ); while ( i < tokens.size )
while ( isDefined( _k750 ) )
{ {
token = _a750[ _k750 ]; if ( tokens[ i ] == match_string )
if ( token == match_string )
{ {
spawnpoints[ spawnpoints.size ] = struct; spawnpoints[ spawnpoints.size ] = struct;
} }
_k750 = getNextArrayKey( _a750, _k750 ); i++;
} }
} }
_k744 = getNextArrayKey( _a744, _k744 );
} }
} }
if ( !isDefined( spawnpoints ) || spawnpoints.size == 0 ) if ( !isDefined( spawnpoints ) || spawnpoints.size == 0 )
@ -521,7 +496,7 @@ chugabud_get_spawnpoint()
return spawnpoint; return spawnpoint;
} }
get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_height, ignore_targetted_nodes ) get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_height, ignore_targetted_nodes ) //checked partially changed to match cerberus output changed at own discretion
{ {
if ( !isDefined( level.chugabud_spawn_struct ) ) if ( !isDefined( level.chugabud_spawn_struct ) )
{ {
@ -529,7 +504,7 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh
} }
found_node = undefined; found_node = undefined;
a_nodes = getnodesinradiussorted( v_origin, max_radius, min_radius, max_height, "pathnodes" ); a_nodes = getnodesinradiussorted( v_origin, max_radius, min_radius, max_height, "pathnodes" );
while ( isDefined( a_nodes ) && a_nodes.size > 0 ) if ( isDefined( a_nodes ) && a_nodes.size > 0 )
{ {
a_player_volumes = getentarray( "player_volume", "script_noteworthy" ); a_player_volumes = getentarray( "player_volume", "script_noteworthy" );
index = a_nodes.size - 1; index = a_nodes.size - 1;
@ -545,7 +520,7 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh
continue; continue;
} }
} }
else if ( !positionwouldtelefrag( n_node.origin ) ) if ( !positionwouldtelefrag( n_node.origin ) )
{ {
if ( maps/mp/zombies/_zm_utility::check_point_in_enabled_zone( n_node.origin, 1, a_player_volumes ) ) if ( maps/mp/zombies/_zm_utility::check_point_in_enabled_zone( n_node.origin, 1, a_player_volumes ) )
{ {
@ -567,11 +542,7 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh
} }
} }
} }
else i--;
{
i--;
}
} }
} }
if ( isDefined( found_node ) ) if ( isDefined( found_node ) )
@ -584,28 +555,26 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh
return 0; return 0;
} }
force_corpse_respawn_position( forced_corpse_position ) force_corpse_respawn_position( forced_corpse_position ) //checked matches cerberus output
{ {
level.chugabud_force_corpse_position = forced_corpse_position; level.chugabud_force_corpse_position = forced_corpse_position;
} }
force_player_respawn_position( forced_player_position ) force_player_respawn_position( forced_player_position ) //checked matches cerberus output
{ {
level.chugabud_force_player_position = forced_player_position; level.chugabud_force_player_position = forced_player_position;
} }
save_weapons_for_chugabud( player ) save_weapons_for_chugabud( player ) //checked changed to match cerberus output
{ {
self.chugabud_melee_weapons = []; self.chugabud_melee_weapons = [];
i = 0; for ( i = 0; i < level._melee_weapons.size; i++ )
while ( i < level._melee_weapons.size )
{ {
self save_weapon_for_chugabud( player, level._melee_weapons[ i ].weapon_name ); self save_weapon_for_chugabud( player, level._melee_weapons[ i ].weapon_name );
i++;
} }
} }
save_weapon_for_chugabud( player, weapon_name ) save_weapon_for_chugabud( player, weapon_name ) //checked matches cerberus output
{ {
if ( player hasweapon( weapon_name ) ) if ( player hasweapon( weapon_name ) )
{ {
@ -613,20 +582,18 @@ save_weapon_for_chugabud( player, weapon_name )
} }
} }
restore_weapons_for_chugabud( player ) restore_weapons_for_chugabud( player ) //checked changed to match cerberus output
{ {
i = 0; for ( i = 0; i < level._melee_weapons.size; i++ )
while ( i < level._melee_weapons.size )
{ {
self restore_weapon_for_chugabud( player, level._melee_weapons[ i ].weapon_name ); self restore_weapon_for_chugabud( player, level._melee_weapons[ i ].weapon_name );
i++;
} }
self.chugabud_melee_weapons = undefined; self.chugabud_melee_weapons = undefined;
} }
restore_weapon_for_chugabud( player, weapon_name ) restore_weapon_for_chugabud( player, weapon_name ) //checked changed to match cerberus output
{ {
if ( isDefined( weapon_name ) || !isDefined( self.chugabud_melee_weapons ) && !isDefined( self.chugabud_melee_weapons[ weapon_name ] ) ) if ( isDefined( weapon_name ) || !isDefined( self.chugabud_melee_weapons ) || !isDefined( self.chugabud_melee_weapons[ weapon_name ] ) )
{ {
return; return;
} }
@ -638,21 +605,17 @@ restore_weapon_for_chugabud( player, weapon_name )
} }
} }
chugabud_save_perks( ent ) chugabud_save_perks( ent ) //checked changed to match cerberus output
{ {
perk_array = ent get_perk_array( 1 ); perk_array = ent get_perk_array( 1 );
_a941 = perk_array; foreach ( perk in perk_array )
_k941 = getFirstArrayKey( _a941 );
while ( isDefined( _k941 ) )
{ {
perk = _a941[ _k941 ];
ent unsetperk( perk ); ent unsetperk( perk );
_k941 = getNextArrayKey( _a941, _k941 );
} }
return perk_array; return perk_array;
} }
playchugabudtimeraudio() playchugabudtimeraudio() //checked matches cerberus output
{ {
self endon( "chugabud_grabbed" ); self endon( "chugabud_grabbed" );
self endon( "chugabud_timedout" ); self endon( "chugabud_timedout" );
@ -665,14 +628,14 @@ playchugabudtimeraudio()
} }
} }
playchugabudtimerout( player ) playchugabudtimerout( player ) //checked matches cerberus output
{ {
self endon( "chugabud_grabbed" ); self endon( "chugabud_grabbed" );
self waittill( "chugabud_timedout" ); self waittill( "chugabud_timedout" );
player playsoundtoplayer( "zmb_chugabud_timer_out", player ); player playsoundtoplayer( "zmb_chugabud_timer_out", player );
} }
chugabud_hostmigration() chugabud_hostmigration() //checked changed to match cerberus output
{ {
level endon( "end_game" ); level endon( "end_game" );
level notify( "chugabud_hostmigration" ); level notify( "chugabud_hostmigration" );
@ -681,22 +644,18 @@ chugabud_hostmigration()
{ {
level waittill( "host_migration_end" ); level waittill( "host_migration_end" );
chugabuds = getentarray( "player_chugabud_model", "script_noteworthy" ); chugabuds = getentarray( "player_chugabud_model", "script_noteworthy" );
_a1000 = chugabuds; foreach ( model in chugabuds )
_k1000 = getFirstArrayKey( _a1000 );
while ( isDefined( _k1000 ) )
{ {
model = _a1000[ _k1000 ];
playfxontag( level._effect[ "powerup_on" ], model, "tag_origin" ); playfxontag( level._effect[ "powerup_on" ], model, "tag_origin" );
_k1000 = getNextArrayKey( _a1000, _k1000 );
} }
} }
} }
player_revived_cleanup_chugabud_corpse() player_revived_cleanup_chugabud_corpse() //checked matches cerberus output
{ {
} }
player_has_chugabud_corpse() player_has_chugabud_corpse() //checked matches cerberus output
{ {
if ( isDefined( self.e_chugabud_corpse ) ) if ( isDefined( self.e_chugabud_corpse ) )
{ {
@ -705,7 +664,7 @@ player_has_chugabud_corpse()
return 0; return 0;
} }
is_weapon_available_in_chugabud_corpse( weapon, player_to_check ) is_weapon_available_in_chugabud_corpse( weapon, player_to_check ) //checked partially changed to match cerberus output
{ {
count = 0; count = 0;
upgradedweapon = weapon; upgradedweapon = weapon;
@ -714,7 +673,7 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check )
upgradedweapon = level.zombie_weapons[ weapon ].upgrade_name; upgradedweapon = level.zombie_weapons[ weapon ].upgrade_name;
} }
players = getplayers(); players = getplayers();
while ( isDefined( players ) ) if ( isDefined( players ) )
{ {
player_index = 0; player_index = 0;
while ( player_index < players.size ) while ( player_index < players.size )
@ -725,21 +684,16 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check )
player_index++; player_index++;
continue; continue;
} }
else if ( player player_has_chugabud_corpse() )
{ {
while ( player player_has_chugabud_corpse() ) if ( isDefined( player.loadout ) && isDefined( player.loadout.weapons ) )
{ {
while ( isDefined( player.loadout ) && isDefined( player.loadout.weapons ) ) for ( i = 0; i < player.loadout.weapons.size; i++ )
{ {
i = 0; chugabud_weapon = player.loadout.weapons[ i ];
while ( i < player.loadout.weapons.size ) if ( isDefined( chugabud_weapon ) && chugabud_weapon[ "name" ] == weapon || chugabud_weapon[ "name" ] == upgradedweapon )
{ {
chugabud_weapon = player.loadout.weapons[ i ]; count++;
if ( isDefined( chugabud_weapon ) || chugabud_weapon[ "name" ] == weapon && chugabud_weapon[ "name" ] == upgradedweapon )
{
count++;
}
i++;
} }
} }
} }
@ -750,7 +704,7 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check )
return count; return count;
} }
chugabud_corpse_cleanup_on_spectator( player ) chugabud_corpse_cleanup_on_spectator( player ) //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
player endon( "disconnect" ); player endon( "disconnect" );
@ -760,15 +714,12 @@ chugabud_corpse_cleanup_on_spectator( player )
{ {
break; break;
} }
else wait 0.01;
{
wait 0.01;
}
} }
player chugabud_corpse_cleanup( self, 0 ); player chugabud_corpse_cleanup( self, 0 );
} }
chugabud_corpse_revive_icon( player ) chugabud_corpse_revive_icon( player ) //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
height_offset = 30; height_offset = 30;
@ -788,19 +739,16 @@ chugabud_corpse_revive_icon( player )
{ {
if ( !isDefined( self.revive_hud_elem ) ) if ( !isDefined( self.revive_hud_elem ) )
{ {
return; break;
}
else
{
hud_elem.x = self.origin[ 0 ];
hud_elem.y = self.origin[ 1 ];
hud_elem.z = self.origin[ 2 ] + height_offset;
wait 0.01;
} }
hud_elem.x = self.origin[ 0 ];
hud_elem.y = self.origin[ 1 ];
hud_elem.z = self.origin[ 2 ] + height_offset;
wait 0.01;
} }
} }
activate_chugabud_effects_and_audio() activate_chugabud_effects_and_audio() //checked matches cerberus output
{ {
if ( isDefined( level.whos_who_client_setup ) ) if ( isDefined( level.whos_who_client_setup ) )
{ {
@ -822,7 +770,7 @@ activate_chugabud_effects_and_audio()
} }
} }
deactivate_chugabud_effects_and_audio() deactivate_chugabud_effects_and_audio() //checked matches cerberus output
{ {
self waittill_any( "death", "chugabud_effects_cleanup" ); self waittill_any( "death", "chugabud_effects_cleanup" );
if ( isDefined( level.whos_who_client_setup ) ) if ( isDefined( level.whos_who_client_setup ) )
@ -845,3 +793,4 @@ deactivate_chugabud_effects_and_audio()
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
### The following gscs compile and run successfully with no known errors: ### The following scripts compile and run successfully with no known errors:
``` ```
patch_zm/maps/mp/gametypes_zm/_clientids.gsc patch_zm/maps/mp/gametypes_zm/_clientids.gsc
patch_zm/maps/mp/gametypes_zm/_globalentities.gsc patch_zm/maps/mp/gametypes_zm/_globalentities.gsc
@ -50,12 +50,18 @@ patch_zm/maps/mp/zombies/_zm_pers_upgrades_functions.gsc
``` ```
patch_zm/maps/mp/gametypes_zm/_callbacksetup.gsc patch_zm/maps/mp/gametypes_zm/_callbacksetup.gsc
patch_zm/maps/mp/gametypes_zm/_damagefeedback.gsc patch_zm/maps/mp/gametypes_zm/_damagefeedback.gsc
patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc
patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc
patch_zm/maps/mp/gametypes_zm/_hud.gsc patch_zm/maps/mp/gametypes_zm/_hud.gsc
patch_zm/maps/mp/gametypes_zm/_menus.gsc
patch_zm/maps/mp/gametypes_zm/_perplayer.gsc patch_zm/maps/mp/gametypes_zm/_perplayer.gsc
patch_zm/maps/mp/gametypes_zm/_serversettings.gsc patch_zm/maps/mp/gametypes_zm/_serversettings.gsc
patch_zm/maps/mp/gametypes_zm/_tweakables.gsc
patch_zm/maps/mp/gametypes_zm/_weapon_utils.gsc patch_zm/maps/mp/gametypes_zm/_weapon_utils.gsc
patch_zm/maps/mp/zombies/_zm_blockers.gsc patch_zm/maps/mp/zombies/_zm_blockers.gsc
patch_zm/maps/mp/zombies/_zm_buildables.gsc patch_zm/maps/mp/zombies/_zm_buildables.gsc
patch_zm/maps/mp/zombies/_zm_chugabud.gsc
patch_zm/maps/mp/zombies/_zm_equipment.gsc
patch_zm/maps/mp/zombies/_zm_equip_turbine.gsc patch_zm/maps/mp/zombies/_zm_equip_turbine.gsc
patch_zm/maps/mp/zombies/_zm_game_module.gsc patch_zm/maps/mp/zombies/_zm_game_module.gsc
patch_zm/maps/mp/zombies/_zm_laststand.gsc patch_zm/maps/mp/zombies/_zm_laststand.gsc
@ -71,7 +77,6 @@ patch_zm/maps/mp/zombies/_zm_weap_cymbal_monkey.gsc
``` ```
### The following scripts are not checked yet, uploaded to setup a baseline: ### The following scripts are not checked yet, uploaded to setup a baseline:
``` ```
patch_zm/maps/mp/gametypes_zm/_dev.gsc
patch_zm/maps/mp/gametypes_zm/_gameobjects.gsc patch_zm/maps/mp/gametypes_zm/_gameobjects.gsc
patch_zm/maps/mp/gametypes_zm/_globallogic.gsc patch_zm/maps/mp/gametypes_zm/_globallogic.gsc
patch_zm/maps/mp/gametypes_zm/_globallogic_actor.gsc patch_zm/maps/mp/gametypes_zm/_globallogic_actor.gsc
@ -84,15 +89,11 @@ patch_zm/maps/mp/gametypes_zm/_globallogic_ui.gsc
patch_zm/maps/mp/gametypes_zm/_globallogic_utils.gsc patch_zm/maps/mp/gametypes_zm/_globallogic_utils.gsc
patch_zm/maps/mp/gametypes_zm/_globallogic_vehicle.gsc patch_zm/maps/mp/gametypes_zm/_globallogic_vehicle.gsc
patch_zm/maps/mp/gametypes_zm/_gv_actions.gsc patch_zm/maps/mp/gametypes_zm/_gv_actions.gsc
patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc
patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc
patch_zm/maps/mp/gametypes_zm/_hud_message.gsc patch_zm/maps/mp/gametypes_zm/_hud_message.gsc
patch_zm/maps/mp/gametypes_zm/_hud_util.gsc patch_zm/maps/mp/gametypes_zm/_hud_util.gsc
patch_zm/maps/mp/gametypes_zm/_menus.gsc
patch_zm/maps/mp/gametypes_zm/_spawning.gsc patch_zm/maps/mp/gametypes_zm/_spawning.gsc
patch_zm/maps/mp/gametypes_zm/_spawnlogic.gsc patch_zm/maps/mp/gametypes_zm/_spawnlogic.gsc
patch_zm/maps/mp/gametypes_zm/_spectating.gsc patch_zm/maps/mp/gametypes_zm/_spectating.gsc
patch_zm/maps/mp/gametypes_zm/_tweakables.gsc
patch_zm/maps/mp/gametypes_zm/_weaponobjects.gsc patch_zm/maps/mp/gametypes_zm/_weaponobjects.gsc
patch_zm/maps/mp/gametypes_zm/_weapons.gsc patch_zm/maps/mp/gametypes_zm/_weapons.gsc
``` ```
@ -100,9 +101,8 @@ patch_zm/maps/mp/gametypes_zm/_weapons.gsc
``` ```
//I will put these off to towards much later since the hacker and gas mask are parts of the game that do not exist inside the game in any capacity whatsoever. //I will put these off to towards much later since the hacker and gas mask are parts of the game that do not exist inside the game in any capacity whatsoever.
//Therefore, whether or not they work is irrelevant. //Therefore, whether or not they work is irrelevant.
patch_zm/maps/mp/gametypes_zm/_dev.gsc
patch_zm/maps/mp/zombies/_zm_devgui.gsc patch_zm/maps/mp/zombies/_zm_devgui.gsc
patch_zm/maps/mp/zombies/_zm_chugabud.gsc
patch_zm/maps/mp/zombies/_zm_equipment.gsc
patch_zm/maps/mp/zombies/_zm_equip_hacker.gsc patch_zm/maps/mp/zombies/_zm_equip_hacker.gsc
patch_zm/maps/mp/zombies/_zm_equip_gasmask.gsc patch_zm/maps/mp/zombies/_zm_equip_gasmask.gsc
patch_zm/maps/mp/zombies/_zm_hackables_boards.gsc patch_zm/maps/mp/zombies/_zm_hackables_boards.gsc