From 09e3ff45edcbd7ed6de1e521996d356d6fd7c946 Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Thu, 30 Apr 2020 09:03:46 -0700 Subject: [PATCH] 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. --- patch_mp/maps/mp/gametypes/_healthoverlay.gsc | 242 +++++----- patch_mp/maps/mp/gametypes/_hostmigration.gsc | 82 ++-- patch_mp/maps/mp/gametypes/_menus.gsc | 59 +-- patch_mp/maps/mp/gametypes/_tweakables.gsc | 37 +- patch_mp/readme.md | 19 +- .../maps/mp/gametypes_zm/_healthoverlay.gsc | 244 +++++----- .../maps/mp/gametypes_zm/_hostmigration.gsc | 319 ++++++------ patch_zm/maps/mp/gametypes_zm/_menus.gsc | 62 ++- patch_zm/maps/mp/gametypes_zm/_tweakables.gsc | 37 +- patch_zm/maps/mp/zombies/_zm_chugabud.gsc | 211 +++----- patch_zm/maps/mp/zombies/_zm_equipment.gsc | 454 ++++++++---------- patch_zm/readme.md | 16 +- 12 files changed, 851 insertions(+), 931 deletions(-) diff --git a/patch_mp/maps/mp/gametypes/_healthoverlay.gsc b/patch_mp/maps/mp/gametypes/_healthoverlay.gsc index cfda647..6e75ac6 100644 --- a/patch_mp/maps/mp/gametypes/_healthoverlay.gsc +++ b/patch_mp/maps/mp/gametypes/_healthoverlay.gsc @@ -1,16 +1,16 @@ #include maps/mp/gametypes/_globallogic_player; -init() +init() //checked matches cerberus output { precacheshader( "overlay_low_health" ); - level.healthoverlaycutoff = 0,55; + level.healthoverlaycutoff = 0.55; regentime = level.playerhealthregentime; level.playerhealth_regularregendelay = regentime * 1000; level.healthregendisabled = level.playerhealth_regularregendelay <= 0; level thread onplayerconnect(); } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -23,7 +23,7 @@ onplayerconnect() } } -onjoinedteam() +onjoinedteam() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -33,7 +33,7 @@ onjoinedteam() } } -onjoinedspectators() +onjoinedspectators() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -43,7 +43,7 @@ onjoinedspectators() } } -onplayerspawned() +onplayerspawned() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -53,7 +53,7 @@ onplayerspawned() } } -onplayerkilled() +onplayerkilled() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -63,38 +63,40 @@ onplayerkilled() } } -onplayerdisconnect() +onplayerdisconnect() //checked matches cerberus output { self waittill( "disconnect" ); self notify( "end_healthregen" ); } -playerhealthregen() +playerhealthregen() //checked changed to match cerberus output { self endon( "end_healthregen" ); if ( self.health <= 0 ) { + /* /# assert( !isalive( self ) ); #/ + */ return; } maxhealth = self.health; oldhealth = maxhealth; player = self; health_add = 0; - regenrate = 0,1; + regenrate = 0.1; usetrueregen = 0; veryhurt = 0; player.breathingstoptime = -10000; - thread playerbreathingsound( maxhealth * 0,35 ); - thread playerheartbeatsound( maxhealth * 0,35 ); + thread playerbreathingsound( maxhealth * 0.35 ); + thread playerheartbeatsound( maxhealth * 0.35 ); lastsoundtime_recover = 0; hurttime = 0; newhealth = 0; for ( ;; ) { - wait 0,05; + wait 0.05; if ( isDefined( player.regenrate ) ) { regenrate = player.regenrate; @@ -106,7 +108,7 @@ playerhealthregen() self.atbrinkofdeath = 0; continue; } - else if ( player.health <= 0 ) + if ( player.health <= 0 ) { return; } @@ -114,90 +116,84 @@ playerhealthregen() { continue; } - else + wasveryhurt = veryhurt; + ratio = player.health / maxhealth; + if ( ratio <= level.healthoverlaycutoff ) { - wasveryhurt = veryhurt; - ratio = player.health / maxhealth; - if ( ratio <= level.healthoverlaycutoff ) + veryhurt = 1; + self.atbrinkofdeath = 1; + if ( !wasveryhurt ) { - veryhurt = 1; - self.atbrinkofdeath = 1; - if ( !wasveryhurt ) - { - hurttime = getTime(); - } + 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" ) ) { - 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 ) - { - break; - } - 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 if ( usetrueregen ) + { + newhealth = ratio + regenrate; } else { - oldhealth = player.health; - health_add = 0; - hurttime = getTime(); - player.breathingstoptime = hurttime + 6000; + 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; + 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 ) ) { @@ -211,26 +207,23 @@ decayplayerdamages( decay ) i++; continue; } - else + self.attackerdamage[ i ].damage -= decay; + if ( self.attackerdamage[ i ].damage < 0 ) { - self.attackerdamage[ i ].damage -= decay; - if ( self.attackerdamage[ i ].damage < 0 ) - { - self.attackerdamage[ i ].damage = 0; - } + self.attackerdamage[ i ].damage = 0; } i++; } } -playerbreathingsound( healthcap ) +playerbreathingsound( healthcap ) //checked changed to match cerberus output { self endon( "end_healthregen" ); wait 2; player = self; for ( ;; ) { - wait 0,2; + wait 0.2; if ( player.health <= 0 ) { return; @@ -243,46 +236,41 @@ playerbreathingsound( healthcap ) { 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" ); - wait 0,784; - wait ( 0,1 + randomfloat( 0,8 ) ); + return; + } + 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; - } - } - } -} diff --git a/patch_mp/maps/mp/gametypes/_hostmigration.gsc b/patch_mp/maps/mp/gametypes/_hostmigration.gsc index 1718fec..d89e3d4 100644 --- a/patch_mp/maps/mp/gametypes/_hostmigration.gsc +++ b/patch_mp/maps/mp/gametypes/_hostmigration.gsc @@ -3,8 +3,9 @@ #include common_scripts/utility; #include maps/mp/_utility; -debug_script_structs() +debug_script_structs() //dev call did not check { + /* /# if ( isDefined( level.struct ) ) { @@ -29,9 +30,10 @@ debug_script_structs() } else println( "*** No structs defined." ); #/ + */ } -updatetimerpausedness() +updatetimerpausedness() //checked matches cerberus output { shouldbestopped = isDefined( level.hostmigrationtimer ); if ( !level.timerstopped && shouldbestopped ) @@ -39,38 +41,35 @@ updatetimerpausedness() level.timerstopped = 1; 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(); } -resumetimer() +resumetimer() //checked matches cerberus output { level.discardtime += getTime() - level.migrationtimerpausetime; } -locktimer() +locktimer() //checked matches cerberus output { level endon( "host_migration_begin" ); level endon( "host_migration_end" ); for ( ;; ) { currtime = getTime(); - wait 0,05; + wait 0.05; if ( !level.timerstopped && isDefined( level.discardtime ) ) { level.discardtime += getTime() - currtime; @@ -78,7 +77,7 @@ locktimer() } } -callback_hostmigration() +callback_hostmigration() //checked changed to match cerberus output { setslowmotion( 1, 1, 0 ); makedvarserverinfo( "ui_guncycle", 0 ); @@ -89,38 +88,42 @@ callback_hostmigration() } if ( level.gameended ) { + /* /# println( "Migration starting at time " + getTime() + ", but game has ended, so no countdown." ); #/ + */ return; } + /* /# println( "Migration starting at time " + getTime() ); #/ + */ level.hostmigrationtimer = 1; sethostmigrationstatus( 1 ); level notify( "host_migration_begin" ); thread locktimer(); players = level.players; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { player = players[ i ]; player thread hostmigrationtimerthink(); - i++; } level endon( "host_migration_begin" ); hostmigrationwait(); level.hostmigrationtimer = undefined; sethostmigrationstatus( 0 ); + /* /# println( "Migration finished at time " + getTime() ); #/ + */ recordmatchbegin(); level notify( "host_migration_end" ); } -matchstarttimerconsole_internal( counttime, matchstarttimer ) +matchstarttimerconsole_internal( counttime, matchstarttimer ) //checked matches cerberus output { waittillframeend; visionsetnaked( "mpIntro", 0 ); @@ -128,7 +131,7 @@ matchstarttimerconsole_internal( counttime, matchstarttimer ) while ( counttime > 0 && !level.gameended ) { matchstarttimer thread maps/mp/gametypes/_hud::fontpulse( level ); - wait ( matchstarttimer.inframes * 0,05 ); + wait ( matchstarttimer.inframes * 0.05 ); matchstarttimer setvalue( counttime ); if ( counttime == 2 ) { @@ -136,22 +139,22 @@ matchstarttimerconsole_internal( counttime, matchstarttimer ) } 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" ); wait 0,05; - matchstarttext = createserverfontstring( "objective", 1,5 ); + matchstarttext = createserverfontstring( "objective", 1.5 ); matchstarttext setpoint( "CENTER", "CENTER", 0, -40 ); matchstarttext.sort = 1001; matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] ); matchstarttext.foreground = 0; matchstarttext.hidewheninmenu = 1; matchstarttext settext( game[ "strings" ][ type ] ); - matchstarttimer = createserverfontstring( "objective", 2,2 ); + matchstarttimer = createserverfontstring( "objective", 2.2 ); matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 ); matchstarttimer.sort = 1001; matchstarttimer.color = ( 1, 1, 0 ); @@ -173,7 +176,7 @@ matchstarttimerconsole( type, duration ) matchstarttext destroyelem(); } -hostmigrationwait() +hostmigrationwait() //checked matches cerberus output may need to check order of operations { level endon( "game_ended" ); if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) ) @@ -186,7 +189,7 @@ hostmigrationwait() wait 5; } -waittillhostmigrationcountdown() +waittillhostmigrationcountdown() //checked matches cerberus output { level endon( "host_migration_end" ); if ( !isDefined( level.hostmigrationtimer ) ) @@ -196,13 +199,13 @@ waittillhostmigrationcountdown() level waittill( "host_migration_countdown_begin" ); } -hostmigrationwaitforplayers() +hostmigrationwaitforplayers() //checked matches cerberus output { level endon( "hostmigration_enoughplayers" ); wait 15; } -hostmigrationtimerthink_internal() +hostmigrationtimerthink_internal() //checked matches cerberus output { level endon( "host_migration_begin" ); level endon( "host_migration_end" ); @@ -216,7 +219,7 @@ hostmigrationtimerthink_internal() level waittill( "host_migration_end" ); } -hostmigrationtimerthink() +hostmigrationtimerthink() //checked matches cerberus output { self endon( "disconnect" ); level endon( "host_migration_begin" ); @@ -227,7 +230,7 @@ hostmigrationtimerthink() } } -waittillhostmigrationdone() +waittillhostmigrationdone() //checked matches cerberus output { if ( !isDefined( level.hostmigrationtimer ) ) { @@ -238,7 +241,7 @@ waittillhostmigrationdone() return getTime() - starttime; } -waittillhostmigrationstarts( duration ) +waittillhostmigrationstarts( duration ) //checked matches cerberus output { if ( isDefined( level.hostmigrationtimer ) ) { @@ -248,15 +251,17 @@ waittillhostmigrationstarts( duration ) wait duration; } -waitlongdurationwithhostmigrationpause( duration ) +waitlongdurationwithhostmigrationpause( duration ) //checked matches cerberus output may need to check order of operations { if ( duration == 0 ) { return; } + /* /# assert( duration > 0 ); #/ + */ starttime = getTime(); endtime = getTime() + ( duration * 1000 ); while ( getTime() < endtime ) @@ -268,25 +273,29 @@ waitlongdurationwithhostmigrationpause( duration ) endtime += timepassed; } } + /* /# if ( getTime() != endtime ) { println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); #/ } + */ waittillhostmigrationdone(); return getTime() - starttime; } -waitlongdurationwithhostmigrationpauseemp( duration ) +waitlongdurationwithhostmigrationpauseemp( duration ) //checked matches cerberus output may need to check order of operations { if ( duration == 0 ) { return; } + /* /# assert( duration > 0 ); #/ + */ starttime = getTime(); empendtime = getTime() + ( duration * 1000 ); level.empendtime = empendtime; @@ -302,26 +311,30 @@ waitlongdurationwithhostmigrationpauseemp( duration ) } } } + /* /# if ( getTime() != empendtime ) { println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO empendtime = " + empendtime ); #/ } + */ waittillhostmigrationdone(); level.empendtime = undefined; return getTime() - starttime; } -waitlongdurationwithgameendtimeupdate( duration ) +waitlongdurationwithgameendtimeupdate( duration ) //checked matches cerberus output may need to check order of operations { if ( duration == 0 ) { return; } + /* /# assert( duration > 0 ); #/ + */ starttime = getTime(); endtime = getTime() + ( duration * 1000 ); while ( getTime() < endtime ) @@ -334,12 +347,14 @@ waitlongdurationwithgameendtimeupdate( duration ) wait 1; } } + /* /# if ( getTime() != endtime ) { println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); #/ } + */ while ( isDefined( level.hostmigrationtimer ) ) { endtime += 1000; @@ -348,3 +363,4 @@ waitlongdurationwithgameendtimeupdate( duration ) } return getTime() - starttime; } + diff --git a/patch_mp/maps/mp/gametypes/_menus.gsc b/patch_mp/maps/mp/gametypes/_menus.gsc index 1a4d0db..5af1e64 100644 --- a/patch_mp/maps/mp/gametypes/_menus.gsc +++ b/patch_mp/maps/mp/gametypes/_menus.gsc @@ -2,7 +2,7 @@ #include maps/mp/gametypes/_globallogic; #include maps/mp/_utility; -init() +init() //checked changed to match cerberus output { precachestring( &"open_ingame_menu" ); game[ "menu_team" ] = "team_marinesopfor"; @@ -16,13 +16,9 @@ init() game[ "menu_changeclass_wager" ] = "changeclass_wager"; game[ "menu_changeclass_custom" ] = "changeclass_custom"; game[ "menu_changeclass_barebones" ] = "changeclass_barebones"; - _a18 = level.teams; - _k18 = getFirstArrayKey( _a18 ); - while ( isDefined( _k18 ) ) + foreach ( team in level.teams ) { - team = _a18[ _k18 ]; game[ "menu_changeclass_" + team ] = "changeclass"; - _k18 = getNextArrayKey( _a18, _k18 ); } game[ "menu_controls" ] = "ingame_controls"; game[ "menu_options" ] = "ingame_options"; @@ -50,7 +46,7 @@ init() level thread onplayerconnect(); } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -59,7 +55,7 @@ onplayerconnect() } } -onmenuresponse() +onmenuresponse() //checked changed to match cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -71,7 +67,7 @@ onmenuresponse() self closeingamemenu(); 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" ] ] ) ) { @@ -81,7 +77,7 @@ onmenuresponse() } continue; } - else if ( response == "changeteam" && level.allow_teamchange == "1" ) + if ( response == "changeteam" && level.allow_teamchange == "1" ) { self closemenu(); self closeingamemenu(); @@ -107,12 +103,12 @@ onmenuresponse() } continue; } - else if ( response == "killserverpc" ) + if ( response == "killserverpc" ) { level thread maps/mp/gametypes/_globallogic::killserverpc(); continue; } - else if ( response == "endround" ) + if ( response == "endround" ) { if ( !level.gameended ) { @@ -127,7 +123,7 @@ onmenuresponse() } continue; } - else if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) + if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) { switch( response ) { @@ -143,34 +139,29 @@ onmenuresponse() } 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(); - self closeingamemenu(); - if ( level.rankedmatch && issubstr( response, "custom" ) ) + if ( self isitemlocked( maps/mp/gametypes/_rank::getitemindex( "feature_cac" ) ) ) { - 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" ) - { - player = getplayerfromclientnum( int( response ) ); - if ( isDefined( player ) ) - { - self setcurrentspectatorclient( player ); - } - } + self setcurrentspectatorclient( player ); } } } } + diff --git a/patch_mp/maps/mp/gametypes/_tweakables.gsc b/patch_mp/maps/mp/gametypes/_tweakables.gsc index 4b85e4a..307f7a6 100644 --- a/patch_mp/maps/mp/gametypes/_tweakables.gsc +++ b/patch_mp/maps/mp/gametypes/_tweakables.gsc @@ -1,6 +1,6 @@ #include maps/mp/_utility; -gettweakabledvarvalue( category, name ) +gettweakabledvarvalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -32,14 +32,16 @@ gettweakabledvarvalue( category, name ) dvar = undefined; break; } + /* /# assert( isDefined( dvar ) ); #/ + */ value = getDvarInt( dvar ); return value; } -gettweakabledvar( category, name ) +gettweakabledvar( category, name ) //checked matches cerberus output { switch( category ) { @@ -71,13 +73,15 @@ gettweakabledvar( category, name ) value = undefined; break; } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -gettweakablevalue( category, name ) +gettweakablevalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -114,13 +118,15 @@ gettweakablevalue( category, name ) { return getDvarInt( overridedvar ); } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -gettweakablelastvalue( category, name ) +gettweakablelastvalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -152,13 +158,15 @@ gettweakablelastvalue( category, name ) value = undefined; break; } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -settweakablevalue( category, name, value ) +settweakablevalue( category, name, value ) //checked matches cerberus output { switch( category ) { @@ -193,7 +201,7 @@ settweakablevalue( category, name, value ) setdvar( dvar, value ); } -settweakablelastvalue( category, name, value ) +settweakablelastvalue( category, name, value ) //checked changed to match cerberus output { switch( category ) { @@ -222,11 +230,11 @@ settweakablelastvalue( category, name, value ) level.hudtweaks[ name ].lastvalue = value; break; default: - } + break; } } -registertweakable( category, name, dvar, value ) +registertweakable( category, name, dvar, value ) //checked matches cerberus output { if ( isstring( value ) ) { @@ -324,7 +332,7 @@ registertweakable( category, name, dvar, value ) } } -init() +init() //checked matches cerberus output { level.clienttweakables = []; level.tweakablesinitialized = 1; @@ -362,17 +370,16 @@ init() level thread updateuitweakables(); } -setclienttweakable( category, name ) +setclienttweakable( category, name ) //checked matches cerberus output { level.clienttweakables[ level.clienttweakables.size ] = name; } -updateuitweakables() +updateuitweakables() //checked changed to match cerberus output { for ( ;; ) { - index = 0; - while ( index < level.clienttweakables.size ) + for ( index = 0; index < level.clienttweakables.size; index++ ) { clienttweakable = level.clienttweakables[ index ]; curvalue = gettweakabledvarvalue( "hud", clienttweakable ); @@ -382,13 +389,13 @@ updateuitweakables() updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue ); settweakablelastvalue( "hud", clienttweakable, curvalue ); } - index++; } wait 1; } } -updateserverdvar( dvar, value ) +updateserverdvar( dvar, value ) //checked matches cerberus output { makedvarserverinfo( dvar, value ); } + diff --git a/patch_mp/readme.md b/patch_mp/readme.md index ae6c86e..bcc206c 100644 --- a/patch_mp/readme.md +++ b/patch_mp/readme.md @@ -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/_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/_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/_menus.gsc patch_mp/maps/mp/gametypes/_perplayer.gsc patch_mp/maps/mp/gametypes/_serversettings.gsc +patch_mp/maps/mp/gametypes/_tweakables.gsc patch_mp/maps/mp/gametypes/_weapon_utils.gsc ``` ### 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/_copter.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/_gameobjects.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_utils.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_util.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/_persistence.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/_spawnlogic.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/_weaponobjects.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/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: ``` ``` diff --git a/patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc b/patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc index a7d8f4b..6e75ac6 100644 --- a/patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc +++ b/patch_zm/maps/mp/gametypes_zm/_healthoverlay.gsc @@ -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" ); - level.healthoverlaycutoff = 0,55; + level.healthoverlaycutoff = 0.55; regentime = level.playerhealthregentime; level.playerhealth_regularregendelay = regentime * 1000; level.healthregendisabled = level.playerhealth_regularregendelay <= 0; level thread onplayerconnect(); } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -23,7 +23,7 @@ onplayerconnect() } } -onjoinedteam() +onjoinedteam() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -33,7 +33,7 @@ onjoinedteam() } } -onjoinedspectators() +onjoinedspectators() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -43,7 +43,7 @@ onjoinedspectators() } } -onplayerspawned() +onplayerspawned() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -53,7 +53,7 @@ onplayerspawned() } } -onplayerkilled() +onplayerkilled() //checked matches cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -63,38 +63,40 @@ onplayerkilled() } } -onplayerdisconnect() +onplayerdisconnect() //checked matches cerberus output { self waittill( "disconnect" ); self notify( "end_healthregen" ); } -playerhealthregen() +playerhealthregen() //checked changed to match cerberus output { self endon( "end_healthregen" ); if ( self.health <= 0 ) { + /* /# assert( !isalive( self ) ); #/ + */ return; } maxhealth = self.health; oldhealth = maxhealth; player = self; health_add = 0; - regenrate = 0,1; + regenrate = 0.1; usetrueregen = 0; veryhurt = 0; player.breathingstoptime = -10000; - thread playerbreathingsound( maxhealth * 0,35 ); - thread playerheartbeatsound( maxhealth * 0,35 ); + thread playerbreathingsound( maxhealth * 0.35 ); + thread playerheartbeatsound( maxhealth * 0.35 ); lastsoundtime_recover = 0; hurttime = 0; newhealth = 0; for ( ;; ) { - wait 0,05; + wait 0.05; if ( isDefined( player.regenrate ) ) { regenrate = player.regenrate; @@ -106,7 +108,7 @@ playerhealthregen() self.atbrinkofdeath = 0; continue; } - else if ( player.health <= 0 ) + if ( player.health <= 0 ) { return; } @@ -114,90 +116,84 @@ playerhealthregen() { continue; } - else + wasveryhurt = veryhurt; + ratio = player.health / maxhealth; + if ( ratio <= level.healthoverlaycutoff ) { - wasveryhurt = veryhurt; - ratio = player.health / maxhealth; - if ( ratio <= level.healthoverlaycutoff ) + veryhurt = 1; + self.atbrinkofdeath = 1; + if ( !wasveryhurt ) { - veryhurt = 1; - self.atbrinkofdeath = 1; - if ( !wasveryhurt ) - { - hurttime = getTime(); - } + 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" ) ) { - 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 ) - { - break; - } - 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 if ( usetrueregen ) + { + newhealth = ratio + regenrate; } else { - oldhealth = player.health; - health_add = 0; - hurttime = getTime(); - player.breathingstoptime = hurttime + 6000; + 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; + 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 ) ) { @@ -211,26 +207,23 @@ decayplayerdamages( decay ) i++; continue; } - else + self.attackerdamage[ i ].damage -= decay; + if ( self.attackerdamage[ i ].damage < 0 ) { - self.attackerdamage[ i ].damage -= decay; - if ( self.attackerdamage[ i ].damage < 0 ) - { - self.attackerdamage[ i ].damage = 0; - } + self.attackerdamage[ i ].damage = 0; } i++; } } -playerbreathingsound( healthcap ) +playerbreathingsound( healthcap ) //checked changed to match cerberus output { self endon( "end_healthregen" ); wait 2; player = self; for ( ;; ) { - wait 0,2; + wait 0.2; if ( player.health <= 0 ) { return; @@ -243,46 +236,41 @@ playerbreathingsound( healthcap ) { 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" ); - wait 0,784; - wait ( 0,1 + randomfloat( 0,8 ) ); + return; + } + 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; - } - } - } -} diff --git a/patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc b/patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc index 7eca73c..2fdd0a0 100644 --- a/patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc +++ b/patch_zm/maps/mp/gametypes_zm/_hostmigration.gsc @@ -1,12 +1,11 @@ -#include maps/mp/zombies/_zm; #include maps/mp/gametypes_zm/_hud; -#include maps/mp/zombies/_zm_utility; #include maps/mp/gametypes_zm/_hud_util; #include common_scripts/utility; #include maps/mp/_utility; -debug_script_structs() +debug_script_structs() //dev call did not check { + /* /# if ( isDefined( level.struct ) ) { @@ -31,9 +30,10 @@ debug_script_structs() } else println( "*** No structs defined." ); #/ + */ } -updatetimerpausedness() +updatetimerpausedness() //checked matches cerberus output { shouldbestopped = isDefined( level.hostmigrationtimer ); if ( !level.timerstopped && shouldbestopped ) @@ -41,54 +41,49 @@ updatetimerpausedness() level.timerstopped = 1; 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(); - disablezombies( 1 ); + disablezombies(1); if ( is_true( level._hm_should_pause_spawning ) ) { flag_set( "spawn_zombies" ); } - i = 0; - while ( i < level.players.size ) + for ( i = 0; i < level.players.size; i++ ) { level.players[ i ] enableinvulnerability(); - i++; } } -pausetimer() +pausetimer() //checked matches cerberus output { level.migrationtimerpausetime = getTime(); } -resumetimer() +resumetimer() //checked matches cerberus output { level.discardtime += getTime() - level.migrationtimerpausetime; } -locktimer() +locktimer() //checked matches cerberus output { level endon( "host_migration_begin" ); level endon( "host_migration_end" ); for ( ;; ) { currtime = getTime(); - wait 0,05; + wait 0.05; if ( !level.timerstopped && isDefined( level.discardtime ) ) { level.discardtime += getTime() - currtime; @@ -96,7 +91,7 @@ locktimer() } } -callback_hostmigration() +callback_hostmigration() //checked changed to match cerberus output { redo_link_changes(); setslowmotion( 1, 1, 0 ); @@ -104,71 +99,65 @@ callback_hostmigration() level.hostmigrationreturnedplayercount = 0; 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; } - sethostmigrationstatus( 1 ); + sethostmigrationstatus(1); level notify( "host_migration_begin" ); - i = 0; - while ( i < level.players.size ) + for ( i = 0; i < level.players.size; i++ ) { - 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(); - i++; } - while ( isDefined( level.hostmigration_ai_link_entity_callback ) ) + if ( isdefined( level.hostmigration_ai_link_entity_callback ) ) { - zombies = getaiarray( level.zombie_team ); - while ( isDefined( zombies ) && zombies.size > 0 ) + zombies = getaiarray(level.zombie_team); + if ( isdefined( zombies ) && zombies.size > 0 ) { - _a133 = zombies; - _k133 = getFirstArrayKey( _a133 ); - while ( isDefined( _k133 ) ) + foreach(zombie in zombies) { - 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 ]](); } - _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; thread locktimer(); zombies = getaiarray( level.zombie_team ); - while ( isDefined( zombies ) && zombies.size > 0 ) + if ( isdefined( zombies ) && zombies.size > 0 ) { - _a156 = zombies; - _k156 = getFirstArrayKey( _a156 ); - while ( isDefined( _k156 ) ) + foreach ( zombie in zombies ) { - zombie = _a156[ _k156 ]; - if ( isDefined( zombie._host_migration_link_entity ) ) + if ( isdefined(zombie._host_migration_link_entity ) ) { ent = spawn( "script_origin", zombie.origin ); 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 ); zombie._host_migration_link_helper = ent; zombie linkto( zombie._host_migration_link_helper ); } - _k156 = getNextArrayKey( _a156, _k156 ); } } level endon( "host_migration_begin" ); @@ -178,33 +167,25 @@ callback_hostmigration() flag_clear( "spawn_zombies" ); } hostmigrationwait(); - _a185 = level.players; - _k185 = getFirstArrayKey( _a185 ); - while ( isDefined( _k185 ) ) + foreach ( player in level.players ) { - player = _a185[ _k185 ]; player thread post_migration_become_vulnerable(); - _k185 = getNextArrayKey( _a185, _k185 ); } zombies = getaiarray( level.zombie_team ); - while ( isDefined( zombies ) && zombies.size > 0 ) + if ( isdefined( zombies ) && zombies.size > 0 ) { - _a193 = zombies; - _k193 = getFirstArrayKey( _a193 ); - while ( isDefined( _k193 ) ) + foreach ( zombie in zombies ) { - zombie = _a193[ _k193 ]; - if ( isDefined( zombie._host_migration_link_entity ) ) + if ( isdefined(zombie._host_migration_link_entity ) ) { zombie unlink(); zombie._host_migration_link_helper delete(); zombie._host_migration_link_helper = undefined; zombie._host_migration_link_entity = undefined; } - _k193 = getNextArrayKey( _a193, _k193 ); } } - enablezombies( 1 ); + enablezombies(1); if ( level._hm_should_pause_spawning ) { flag_set( "spawn_zombies" ); @@ -212,46 +193,48 @@ callback_hostmigration() level.hostmigrationtimer = undefined; level._hm_should_pause_spawning = undefined; sethostmigrationstatus( 0 ); -/# - println( "Migration finished at time " + getTime() ); -#/ + /* + /# + println("Migration finished at time " + GetTime()); + #/ + */ level notify( "host_migration_end" ); } -post_migration_become_vulnerable() +post_migration_become_vulnerable() //checked matches cerberus output { self endon( "disconnect" ); - wait 3; + wait( 3 ); self disableinvulnerability(); } -matchstarttimerconsole_internal( counttime, matchstarttimer ) +matchstarttimerconsole_internal( counttime, matchstarttimer ) //checked matches cerberus output { waittillframeend; + visionsetnaked( "mpIntro", 0 ); level endon( "match_start_timer_beginning" ); while ( counttime > 0 && !level.gameended ) { matchstarttimer thread maps/mp/gametypes_zm/_hud::fontpulse( level ); - wait ( matchstarttimer.inframes * 0,05 ); + wait ( matchstarttimer.inframes * 0.05 ); matchstarttimer setvalue( 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" ); wait 0,05; - matchstarttext = createserverfontstring( "objective", 1,5 ); + matchstarttext = createserverfontstring( "objective", 1.5 ); matchstarttext setpoint( "CENTER", "CENTER", 0, -40 ); matchstarttext.sort = 1001; matchstarttext settext( game[ "strings" ][ "waiting_for_teams" ] ); matchstarttext.foreground = 0; matchstarttext.hidewheninmenu = 1; matchstarttext settext( game[ "strings" ][ type ] ); - matchstarttimer = createserverfontstring( "objective", 2,2 ); + matchstarttimer = createserverfontstring( "objective", 2.2 ); matchstarttimer setpoint( "CENTER", "CENTER", 0, 0 ); matchstarttimer.sort = 1001; matchstarttimer.color = ( 1, 1, 0 ); @@ -267,7 +250,7 @@ matchstarttimerconsole( type, duration ) matchstarttext destroyelem(); } -hostmigrationwait() +hostmigrationwait() //checked matches cerberus output may need to check order of operations { level endon( "game_ended" ); if ( level.hostmigrationreturnedplayercount < ( ( level.players.size * 2 ) / 3 ) ) @@ -275,17 +258,18 @@ hostmigrationwait() thread matchstarttimerconsole( "waiting_for_teams", 20 ); hostmigrationwaitforplayers(); } + level notify( "host_migration_countdown_begin" ); thread matchstarttimerconsole( "match_starting_in", 5 ); wait 5; } -hostmigrationwaitforplayers() +hostmigrationwaitforplayers() //checked matches cerberus output { level endon( "hostmigration_enoughplayers" ); wait 15; } -hostmigrationtimerthink_internal() +hostmigrationtimerthink_internal() //checked matches cerberus output { level endon( "host_migration_begin" ); level endon( "host_migration_end" ); @@ -294,23 +278,25 @@ hostmigrationtimerthink_internal() { self waittill( "spawned" ); } - if ( isDefined( self._host_migration_link_entity ) ) + if ( isdefined( self._host_migration_link_entity ) ) { ent = spawn( "script_origin", self.origin ); ent.angles = self.angles; 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 ); 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 freezecontrols( 1 ); level waittill( "host_migration_end" ); } -hostmigrationtimerthink() +hostmigrationtimerthink() //checked matches cerberus output { self endon( "disconnect" ); level endon( "host_migration_begin" ); @@ -319,16 +305,18 @@ hostmigrationtimerthink() { self freezecontrols( 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._host_migration_link_helper delete(); 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 ); } @@ -336,7 +324,7 @@ hostmigrationtimerthink() } } -waittillhostmigrationdone() +waittillhostmigrationdone() //checked matches cerberus output { if ( !isDefined( level.hostmigrationtimer ) ) { @@ -347,7 +335,7 @@ waittillhostmigrationdone() return getTime() - starttime; } -waittillhostmigrationstarts( duration ) +waittillhostmigrationstarts( duration ) //checked matches cerberus output { if ( isDefined( level.hostmigrationtimer ) ) { @@ -357,15 +345,17 @@ waittillhostmigrationstarts( duration ) wait duration; } -waitlongdurationwithhostmigrationpause( duration ) +waitlongdurationwithhostmigrationpause( duration ) //checked matches cerberus output may need to check order of operations { if ( duration == 0 ) { return; } + /* /# assert( duration > 0 ); #/ + */ starttime = getTime(); endtime = getTime() + ( duration * 1000 ); while ( getTime() < endtime ) @@ -377,25 +367,68 @@ waitlongdurationwithhostmigrationpause( duration ) endtime += timepassed; } } + /* +/# if ( getTime() != endtime ) { -/# println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); #/ } + */ waittillhostmigrationdone(); return getTime() - starttime; } -waitlongdurationwithgameendtimeupdate( duration ) +waitlongdurationwithhostmigrationpauseemp( duration ) //checked matches cerberus output may need to check order of operations { if ( duration == 0 ) { return; } + /* /# 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(); endtime = getTime() + ( duration * 1000 ); while ( getTime() < endtime ) @@ -408,12 +441,14 @@ waitlongdurationwithgameendtimeupdate( duration ) wait 1; } } + /* /# if ( getTime() != endtime ) { println( "SCRIPT WARNING: gettime() = " + getTime() + " NOT EQUAL TO endtime = " + endtime ); #/ } + */ while ( isDefined( level.hostmigrationtimer ) ) { endtime += 1000; @@ -423,124 +458,114 @@ waitlongdurationwithgameendtimeupdate( duration ) 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; 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" ); index = a_nodes.size - 1; i = index; - while ( i >= 0 ) + while ( i >= 0; ) { - n_node = a_nodes[ i ]; + n_node = a_nodes[i]; if ( ignore_targetted_nodes == 1 ) { - if ( isDefined( n_node.target ) ) + if ( isdefined( n_node.target ) ) { i--; 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 ); - 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 ) + override_abort = 0; + if ( isdefined( level._chugabud_reject_node_override_func ) ) { - override_abort = 0; - if ( isDefined( level._chugabud_reject_node_override_func ) ) - { - override_abort = [[ level._chugabud_reject_node_override_func ]]( v_origin, n_node ); - } - if ( !override_abort ) - { - found_node = n_node; - break; - } + override_abort = [[ level._chugabud_reject_node_override_func ]]( v_origin, n_node ); + } + if ( !override_abort ) + { + found_node = n_node; + break; } } } } - else - { - i--; - - } + i--; } } return found_node; } -hostmigration_put_player_in_better_place() +hostmigration_put_player_in_better_place() //checked changed to match cerberus output { spawnpoint = undefined; 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 ); } - if ( !isDefined( spawnpoint ) ) + if ( !isdefined(spawnpoint ) ) { 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 ); } - if ( !isDefined( spawnpoint ) ) + if ( !isdefined( spawnpoint ) ) { match_string = ""; 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; } - match_string = ( level.scr_zm_ui_gametype + "_" ) + location; + match_string = level.scr_zm_ui_gametype + "_" + location; spawnpoints = []; structs = getstructarray( "initial_spawn", "script_noteworthy" ); - while ( isDefined( structs ) ) + if ( isdefined( structs ) ) { - _a559 = structs; - _k559 = getFirstArrayKey( _a559 ); - while ( isDefined( _k559 ) ) + foreach ( struct in structs ) { - struct = _a559[ _k559 ]; - while ( isDefined( struct.script_string ) ) + if ( isdefined( struct.script_string ) ) { tokens = strtok( struct.script_string, " " ); - _a565 = tokens; - _k565 = getFirstArrayKey( _a565 ); - while ( isDefined( _k565 ) ) + i = 0; + while ( i < tokens.size ) { - token = _a565[ _k565 ]; if ( token == match_string ) { 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" ); } -/# - 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 ); } - if ( isDefined( spawnpoint ) ) + if ( isdefined( spawnpoint ) ) { self setorigin( spawnpoint.origin ); } } + diff --git a/patch_zm/maps/mp/gametypes_zm/_menus.gsc b/patch_zm/maps/mp/gametypes_zm/_menus.gsc index 97f9513..c6a8a1c 100644 --- a/patch_zm/maps/mp/gametypes_zm/_menus.gsc +++ b/patch_zm/maps/mp/gametypes_zm/_menus.gsc @@ -2,7 +2,7 @@ #include maps/mp/gametypes_zm/_globallogic; #include maps/mp/_utility; -init() +init() //checked changed to match cerberus output { precachestring( &"open_ingame_menu" ); game[ "menu_team" ] = "team_marinesopfor"; @@ -16,13 +16,9 @@ init() game[ "menu_changeclass_wager" ] = "changeclass_wager"; game[ "menu_changeclass_custom" ] = "changeclass_custom"; game[ "menu_changeclass_barebones" ] = "changeclass_barebones"; - _a18 = level.teams; - _k18 = getFirstArrayKey( _a18 ); - while ( isDefined( _k18 ) ) + foreach ( team in level.teams ) { - team = _a18[ _k18 ]; game[ "menu_changeclass_" + team ] = "changeclass"; - _k18 = getNextArrayKey( _a18, _k18 ); } game[ "menu_controls" ] = "ingame_controls"; game[ "menu_options" ] = "ingame_options"; @@ -50,7 +46,7 @@ init() level thread onplayerconnect(); } -onplayerconnect() +onplayerconnect() //checked matches cerberus output { for ( ;; ) { @@ -59,7 +55,7 @@ onplayerconnect() } } -onmenuresponse() +onmenuresponse() //checked changed to match cerberus output { self endon( "disconnect" ); for ( ;; ) @@ -71,7 +67,7 @@ onmenuresponse() self closeingamemenu(); 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" ] ] ) ) { @@ -81,7 +77,7 @@ onmenuresponse() } continue; } - else if ( response == "changeteam" && level.allow_teamchange == "1" ) + if ( response == "changeteam" && level.allow_teamchange == "1" ) { self closemenu(); self closeingamemenu(); @@ -97,7 +93,7 @@ onmenuresponse() } if ( response == "endgame" ) { - if ( self issplitscreen() ) + if ( level.splitscreen ) { level.skipvote = 1; if ( !level.gameended ) @@ -107,15 +103,16 @@ onmenuresponse() } continue; } - else if ( response == "killserverpc" ) + if ( response == "killserverpc" ) { level thread maps/mp/gametypes_zm/_globallogic::killserverpc(); continue; } - else if ( response == "endround" ) + if ( response == "endround" ) { if ( !level.gameended ) { + self gamehistoryplayerquit(); level thread maps/mp/gametypes_zm/_globallogic::forceend(); } else @@ -126,7 +123,7 @@ onmenuresponse() } continue; } - else if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) + if ( menu == game[ "menu_team" ] && level.allow_teamchange == "1" ) { switch( response ) { @@ -142,34 +139,29 @@ onmenuresponse() } 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(); - self closeingamemenu(); - if ( level.rankedmatch && issubstr( response, "custom" ) ) + if ( self isitemlocked( maps/mp/gametypes_zm/_rank::getitemindex( "feature_cac" ) ) ) { - 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" ) - { - player = getplayerfromclientnum( int( response ) ); - if ( isDefined( player ) ) - { - self setcurrentspectatorclient( player ); - } - } + self setcurrentspectatorclient( player ); } } } } + diff --git a/patch_zm/maps/mp/gametypes_zm/_tweakables.gsc b/patch_zm/maps/mp/gametypes_zm/_tweakables.gsc index 4b85e4a..307f7a6 100644 --- a/patch_zm/maps/mp/gametypes_zm/_tweakables.gsc +++ b/patch_zm/maps/mp/gametypes_zm/_tweakables.gsc @@ -1,6 +1,6 @@ #include maps/mp/_utility; -gettweakabledvarvalue( category, name ) +gettweakabledvarvalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -32,14 +32,16 @@ gettweakabledvarvalue( category, name ) dvar = undefined; break; } + /* /# assert( isDefined( dvar ) ); #/ + */ value = getDvarInt( dvar ); return value; } -gettweakabledvar( category, name ) +gettweakabledvar( category, name ) //checked matches cerberus output { switch( category ) { @@ -71,13 +73,15 @@ gettweakabledvar( category, name ) value = undefined; break; } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -gettweakablevalue( category, name ) +gettweakablevalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -114,13 +118,15 @@ gettweakablevalue( category, name ) { return getDvarInt( overridedvar ); } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -gettweakablelastvalue( category, name ) +gettweakablelastvalue( category, name ) //checked matches cerberus output { switch( category ) { @@ -152,13 +158,15 @@ gettweakablelastvalue( category, name ) value = undefined; break; } + /* /# assert( isDefined( value ) ); #/ + */ return value; } -settweakablevalue( category, name, value ) +settweakablevalue( category, name, value ) //checked matches cerberus output { switch( category ) { @@ -193,7 +201,7 @@ settweakablevalue( category, name, value ) setdvar( dvar, value ); } -settweakablelastvalue( category, name, value ) +settweakablelastvalue( category, name, value ) //checked changed to match cerberus output { switch( category ) { @@ -222,11 +230,11 @@ settweakablelastvalue( category, name, value ) level.hudtweaks[ name ].lastvalue = value; break; default: - } + break; } } -registertweakable( category, name, dvar, value ) +registertweakable( category, name, dvar, value ) //checked matches cerberus output { if ( isstring( value ) ) { @@ -324,7 +332,7 @@ registertweakable( category, name, dvar, value ) } } -init() +init() //checked matches cerberus output { level.clienttweakables = []; level.tweakablesinitialized = 1; @@ -362,17 +370,16 @@ init() level thread updateuitweakables(); } -setclienttweakable( category, name ) +setclienttweakable( category, name ) //checked matches cerberus output { level.clienttweakables[ level.clienttweakables.size ] = name; } -updateuitweakables() +updateuitweakables() //checked changed to match cerberus output { for ( ;; ) { - index = 0; - while ( index < level.clienttweakables.size ) + for ( index = 0; index < level.clienttweakables.size; index++ ) { clienttweakable = level.clienttweakables[ index ]; curvalue = gettweakabledvarvalue( "hud", clienttweakable ); @@ -382,13 +389,13 @@ updateuitweakables() updateserverdvar( gettweakabledvar( "hud", clienttweakable ), curvalue ); settweakablelastvalue( "hud", clienttweakable, curvalue ); } - index++; } wait 1; } } -updateserverdvar( dvar, value ) +updateserverdvar( dvar, value ) //checked matches cerberus output { makedvarserverinfo( dvar, value ); } + diff --git a/patch_zm/maps/mp/zombies/_zm_chugabud.gsc b/patch_zm/maps/mp/zombies/_zm_chugabud.gsc index 2ca218a..46c9686 100644 --- a/patch_zm/maps/mp/zombies/_zm_chugabud.gsc +++ b/patch_zm/maps/mp/zombies/_zm_chugabud.gsc @@ -11,7 +11,7 @@ #include maps/mp/_utility; #include maps/mp/zombies/_zm_perks; -init() +init() //checked matches cerberus output { level.chugabud_laststand_func = ::chugabud_laststand; level thread chugabud_hostmigration(); @@ -20,15 +20,15 @@ init() 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( "disconnect" ); @@ -39,7 +39,7 @@ chugabud_laststand() self maps/mp/zombies/_zm_chugabud::chugabud_save_loadout(); self maps/mp/zombies/_zm_chugabud::chugabud_fake_death(); 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; } @@ -102,7 +102,7 @@ chugabud_laststand() 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 ) ) { @@ -112,23 +112,22 @@ chugabud_laststand_cleanup( corpse, str_notify ) 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( "disconnect" ); corpse endon( "death" ); wait delay; - while ( isDefined( corpse.revivetrigger ) ) + if ( isDefined( corpse.revivetrigger ) ) { while ( corpse.revivetrigger.beingrevived ) { wait 0.01; } } - while ( isDefined( self.loadout.perks ) && flag( "solo_game" ) ) + if ( isDefined( self.loadout.perks ) && flag( "solo_game" ) ) { - i = 0; - while ( i < self.loadout.perks.size ) + for ( i = 0; i < self.loadout.perks.size; i++ ) { perk = self.loadout.perks[ i ]; if ( perk == "specialty_quickrevive" ) @@ -137,13 +136,12 @@ chugabud_bleed_timeout( delay, corpse ) corpse notify( "player_revived" ); return; } - i++; } } 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" ); if ( was_revived ) @@ -174,14 +172,14 @@ chugabud_corpse_cleanup( corpse, was_revived ) self.e_chugabud_corpse = undefined; } -chugabud_handle_multiple_instances( corpse ) +chugabud_handle_multiple_instances( corpse ) //checked matches cerberus output { corpse endon( "death" ); self waittill( "perk_chugabud_activated" ); 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.angles = self.angles; @@ -192,7 +190,7 @@ chugabud_spawn_corpse() return corpse; } -chugabud_revive_hud_create() +chugabud_revive_hud_create() //checked matches cerberus output { self.revive_hud = newclienthudelem( self ); self.revive_hud.alignx = "center"; @@ -209,7 +207,7 @@ chugabud_revive_hud_create() return self.revive_hud; } -chugabud_save_loadout() +chugabud_save_loadout() //checked changed to match cerberus output { primaries = self getweaponslistprimaries(); currentweapon = self getcurrentweapon(); @@ -218,17 +216,13 @@ chugabud_save_loadout() self.loadout.weapons = []; self.loadout.score = self.score; self.loadout.current_weapon = -1; - _a376 = primaries; - index = getFirstArrayKey( _a376 ); - while ( isDefined( index ) ) + foreach ( weapon in primaries ) { - weapon = _a376[ index ]; self.loadout.weapons[ index ] = maps/mp/zombies/_zm_weapons::get_player_weapondata( self, weapon ); if ( weapon == currentweapon || self.loadout.weapons[ index ][ "alt_name" ] == currentweapon ) { self.loadout.current_weapon = index; } - index = getNextArrayKey( _a376, index ); } self.loadout.equipment = self get_player_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" ) ) { @@ -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(); loadout = self.loadout; primaries = self getweaponslistprimaries(); - while ( loadout.weapons.size > 1 || primaries.size > 1 ) + if ( loadout.weapons.size > 1 || primaries.size > 1 ) { - _a458 = primaries; - _k458 = getFirstArrayKey( _a458 ); - while ( isDefined( _k458 ) ) + foreach ( weapon in primaries ) { - weapon = _a458[ _k458 ]; self takeweapon( weapon ); - _k458 = getNextArrayKey( _a458, _k458 ); } } i = 0; @@ -292,15 +282,12 @@ chugabud_give_loadout() i++; continue; } - else if ( loadout.weapons[ i ][ "name" ] == "none" ) + if ( loadout.weapons[ i ][ "name" ] == "none" ) { i++; 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++; } if ( loadout.current_weapon >= 0 && isDefined( loadout.weapons[ loadout.current_weapon ][ "name" ] ) ) @@ -314,17 +301,14 @@ chugabud_give_loadout() self.score = loadout.score; self.pers[ "score" ] = loadout.score; perk_array = maps/mp/zombies/_zm_perks::get_perk_array( 1 ); - i = 0; - while ( i < perk_array.size ) + for ( i = 0; i < perk_array.size; i++ ) { perk = perk_array[ i ]; self unsetperk( perk ); self.num_perks--; - 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; while ( i < loadout.perks.size ) @@ -334,7 +318,7 @@ chugabud_give_loadout() i++; 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; } @@ -343,10 +327,7 @@ chugabud_give_loadout() i++; continue; } - else - { - maps/mp/zombies/_zm_perks::give_perk( loadout.perks[ i ] ); - } + maps/mp/zombies/_zm_perks::give_perk( loadout.perks[ 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 ) { @@ -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" ) ) { @@ -386,7 +367,7 @@ chugabud_restore_claymore() } } -chugabud_fake_death() +chugabud_fake_death() //checked matches cerberus output { level notify( "fake_death" ); self notify( "fake_death" ); @@ -401,7 +382,7 @@ chugabud_fake_death() wait 0.9; } -chugabud_fake_revive() +chugabud_fake_revive() //checked matches cerberus output { level notify( "fake_revive" ); self notify( "fake_revive" ); @@ -446,7 +427,7 @@ chugabud_fake_revive() self disableinvulnerability(); } -chugabud_get_spawnpoint() +chugabud_get_spawnpoint() //checked partially changed to match cerberus output nested foreach is probably bad { spawnpoint = undefined; if ( get_chugabug_spawn_point_from_nodes( self.origin, 500, 700, 64, 1 ) ) @@ -475,36 +456,30 @@ chugabud_get_spawnpoint() { match_string = ""; 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; } - match_string = ( level.scr_zm_ui_gametype + "_" ) + location; + match_string = level.scr_zm_ui_gametype + "_" + location; spawnpoints = []; structs = getstructarray( "initial_spawn", "script_noteworthy" ); - while ( isDefined( structs ) ) + if ( isdefined( structs ) ) { - _a744 = structs; - _k744 = getFirstArrayKey( _a744 ); - while ( isDefined( _k744 ) ) + foreach ( struct in structs ) { - struct = _a744[ _k744 ]; - while ( isDefined( struct.script_string ) ) + if ( isdefined( struct.script_string ) ) { tokens = strtok( struct.script_string, " " ); - _a750 = tokens; - _k750 = getFirstArrayKey( _a750 ); - while ( isDefined( _k750 ) ) + i = 0; + while ( i < tokens.size ) { - token = _a750[ _k750 ]; - if ( token == match_string ) + if ( tokens[ i ] == match_string ) { spawnpoints[ spawnpoints.size ] = struct; } - _k750 = getNextArrayKey( _a750, _k750 ); + i++; } } - _k744 = getNextArrayKey( _a744, _k744 ); } } if ( !isDefined( spawnpoints ) || spawnpoints.size == 0 ) @@ -521,7 +496,7 @@ chugabud_get_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 ) ) { @@ -529,7 +504,7 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh } found_node = undefined; 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" ); index = a_nodes.size - 1; @@ -545,7 +520,7 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh 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 ) ) { @@ -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 ) ) @@ -584,28 +555,26 @@ get_chugabug_spawn_point_from_nodes( v_origin, min_radius, max_radius, max_heigh 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; } -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; } -save_weapons_for_chugabud( player ) +save_weapons_for_chugabud( player ) //checked changed to match cerberus output { self.chugabud_melee_weapons = []; - i = 0; - while ( i < level._melee_weapons.size ) + for ( i = 0; i < level._melee_weapons.size; i++ ) { 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 ) ) { @@ -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; - while ( i < level._melee_weapons.size ) + for ( i = 0; i < level._melee_weapons.size; i++ ) { self restore_weapon_for_chugabud( player, level._melee_weapons[ i ].weapon_name ); - i++; } 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; } @@ -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 ); - _a941 = perk_array; - _k941 = getFirstArrayKey( _a941 ); - while ( isDefined( _k941 ) ) + foreach ( perk in perk_array ) { - perk = _a941[ _k941 ]; ent unsetperk( perk ); - _k941 = getNextArrayKey( _a941, _k941 ); } return perk_array; } -playchugabudtimeraudio() +playchugabudtimeraudio() //checked matches cerberus output { self endon( "chugabud_grabbed" ); self endon( "chugabud_timedout" ); @@ -665,14 +628,14 @@ playchugabudtimeraudio() } } -playchugabudtimerout( player ) +playchugabudtimerout( player ) //checked matches cerberus output { self endon( "chugabud_grabbed" ); self waittill( "chugabud_timedout" ); player playsoundtoplayer( "zmb_chugabud_timer_out", player ); } -chugabud_hostmigration() +chugabud_hostmigration() //checked changed to match cerberus output { level endon( "end_game" ); level notify( "chugabud_hostmigration" ); @@ -681,22 +644,18 @@ chugabud_hostmigration() { level waittill( "host_migration_end" ); chugabuds = getentarray( "player_chugabud_model", "script_noteworthy" ); - _a1000 = chugabuds; - _k1000 = getFirstArrayKey( _a1000 ); - while ( isDefined( _k1000 ) ) + foreach ( model in chugabuds ) { - model = _a1000[ _k1000 ]; 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 ) ) { @@ -705,7 +664,7 @@ player_has_chugabud_corpse() 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; upgradedweapon = weapon; @@ -714,7 +673,7 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check ) upgradedweapon = level.zombie_weapons[ weapon ].upgrade_name; } players = getplayers(); - while ( isDefined( players ) ) + if ( isDefined( players ) ) { player_index = 0; while ( player_index < players.size ) @@ -725,21 +684,16 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check ) player_index++; 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; - while ( i < player.loadout.weapons.size ) + chugabud_weapon = player.loadout.weapons[ i ]; + if ( isDefined( chugabud_weapon ) && chugabud_weapon[ "name" ] == weapon || chugabud_weapon[ "name" ] == upgradedweapon ) { - chugabud_weapon = player.loadout.weapons[ i ]; - if ( isDefined( chugabud_weapon ) || chugabud_weapon[ "name" ] == weapon && chugabud_weapon[ "name" ] == upgradedweapon ) - { - count++; - } - i++; + count++; } } } @@ -750,7 +704,7 @@ is_weapon_available_in_chugabud_corpse( weapon, player_to_check ) return count; } -chugabud_corpse_cleanup_on_spectator( player ) +chugabud_corpse_cleanup_on_spectator( player ) //checked changed to match cerberus output { self endon( "death" ); player endon( "disconnect" ); @@ -760,15 +714,12 @@ chugabud_corpse_cleanup_on_spectator( player ) { break; } - else - { - wait 0.01; - } + wait 0.01; } 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" ); height_offset = 30; @@ -788,19 +739,16 @@ chugabud_corpse_revive_icon( player ) { if ( !isDefined( self.revive_hud_elem ) ) { - return; - } - else - { - hud_elem.x = self.origin[ 0 ]; - hud_elem.y = self.origin[ 1 ]; - hud_elem.z = self.origin[ 2 ] + height_offset; - wait 0.01; + break; } + 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 ) ) { @@ -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" ); if ( isDefined( level.whos_who_client_setup ) ) @@ -845,3 +793,4 @@ deactivate_chugabud_effects_and_audio() } + diff --git a/patch_zm/maps/mp/zombies/_zm_equipment.gsc b/patch_zm/maps/mp/zombies/_zm_equipment.gsc index a405923..0ebc3b8 100644 --- a/patch_zm/maps/mp/zombies/_zm_equipment.gsc +++ b/patch_zm/maps/mp/zombies/_zm_equipment.gsc @@ -9,7 +9,7 @@ #include maps/mp/_utility; #include common_scripts/utility; -init() +init() //checked matches cerberus output { init_equipment_upgrade(); onplayerconnect_callback( ::equipment_placement_watcher ); @@ -19,13 +19,15 @@ init() level._riotshield_dissapear_fx = loadfx( "maps/zombie/fx_zmb_tranzit_shield_explo" ); } level.placeable_equipment_destroy_fn = []; + registerclientfield( "scriptmover", "equipment_activated", 12000, 4, "int" ); + if ( isDefined( level._no_equipment_activated_clientfield ) && !level._no_equipment_activated_clientfield ) { registerclientfield( "scriptmover", "equipment_activated", 12000, 4, "int" ); } } -signal_equipment_activated( val ) +signal_equipment_activated( val ) //checked changed to match cerberus output { if ( !isDefined( val ) ) { @@ -37,16 +39,14 @@ signal_equipment_activated( val ) } self endon( "death" ); self setclientfield( "equipment_activated", val ); - i = 0; - while ( i < 2 ) + for ( i = 0; i < 2; i++ ) { wait_network_frame(); - i++; } self setclientfield( "equipment_activated", 0 ); } -register_equipment( equipment_name, hint, howto_hint, hint_icon, equipmentvo, watcher_thread, transfer_fn, drop_fn, pickup_fn, place_fn ) +register_equipment( equipment_name, hint, howto_hint, hint_icon, equipmentvo, watcher_thread, transfer_fn, drop_fn, pickup_fn, place_fn ) //checked matches cerberus output { if ( !isDefined( level.zombie_include_equipment ) || isDefined( level.zombie_include_equipment[ equipment_name ] ) && !level.zombie_include_equipment[ equipment_name ] ) { @@ -77,16 +77,24 @@ register_equipment( equipment_name, hint, howto_hint, hint_icon, equipmentvo, wa level.zombie_equipment[ equipment_name ] = struct; } -is_equipment_included( equipment_name ) +is_equipment_included( equipment_name ) //checked changed at own discretion { if ( !isDefined( level.zombie_include_equipment ) ) { return 0; } - return isDefined( level.zombie_include_equipment[ equipment_name ] ); + if ( !isDefined( level.zombie_include_equipment[ equipment_name ] ) ) + { + return 0; + } + if ( level.zombie_include_equipment[ equipment_name ] == 0 ) + { + return 0; + } + return 1; } -include_zombie_equipment( equipment_name ) +include_zombie_equipment( equipment_name ) //checked matches cerberus output { if ( !isDefined( level.zombie_include_equipment ) ) { @@ -96,7 +104,7 @@ include_zombie_equipment( equipment_name ) precacheitem( equipment_name ); } -limit_zombie_equipment( equipment_name, limited ) +limit_zombie_equipment( equipment_name, limited ) //checked matches cerberus output { if ( !isDefined( level._limited_equipment ) ) { @@ -112,12 +120,11 @@ limit_zombie_equipment( equipment_name, limited ) } } -init_equipment_upgrade() +init_equipment_upgrade() //checked changed to match cerberus output { equipment_spawns = []; equipment_spawns = getentarray( "zombie_equipment_upgrade", "targetname" ); - i = 0; - while ( i < equipment_spawns.size ) + for ( i = 0; i < equipment_spawns.size; i++ ) { hint_string = get_equipment_hint( equipment_spawns[ i ].zombie_equipment_upgrade ); equipment_spawns[ i ] sethintstring( hint_string ); @@ -125,11 +132,10 @@ init_equipment_upgrade() equipment_spawns[ i ] usetriggerrequirelookat(); equipment_spawns[ i ] add_to_equipment_trigger_list( equipment_spawns[ i ].zombie_equipment_upgrade ); equipment_spawns[ i ] thread equipment_spawn_think(); - i++; } } -get_equipment_hint( equipment_name ) +get_equipment_hint( equipment_name ) //checked matches cerberus output { /* /# @@ -139,7 +145,7 @@ get_equipment_hint( equipment_name ) return level.zombie_equipment[ equipment_name ].hint; } -get_equipment_howto_hint( equipment_name ) +get_equipment_howto_hint( equipment_name ) //checked matches cerberus output { /* /# @@ -149,7 +155,7 @@ get_equipment_howto_hint( equipment_name ) return level.zombie_equipment[ equipment_name ].howto_hint; } -get_equipment_icon( equipment_name ) +get_equipment_icon( equipment_name ) //checked matches cerberus output { /* /# @@ -159,7 +165,7 @@ get_equipment_icon( equipment_name ) return level.zombie_equipment[ equipment_name ].hint_icon; } -add_to_equipment_trigger_list( equipment_name ) +add_to_equipment_trigger_list( equipment_name ) //checked matches cerberus output { /* /# @@ -170,7 +176,7 @@ add_to_equipment_trigger_list( equipment_name ) level.zombie_equipment[ equipment_name ].models[ level.zombie_equipment[ equipment_name ].models.size ] = getent( self.target, "targetname" ); } -equipment_spawn_think() +equipment_spawn_think() //checked changed to match cerberus output { for ( ;; ) { @@ -180,50 +186,43 @@ equipment_spawn_think() wait 0.1; continue; } - else + if ( is_limited_equipment( self.zombie_equipment_upgrade ) ) { - if ( is_limited_equipment( self.zombie_equipment_upgrade ) ) + player setup_limited_equipment( self.zombie_equipment_upgrade ); + if ( isDefined( level.hacker_tool_positions ) ) { - player setup_limited_equipment( self.zombie_equipment_upgrade ); - if ( isDefined( level.hacker_tool_positions ) ) - { - new_pos = random( level.hacker_tool_positions ); - self.origin = new_pos.trigger_org; - model = getent( self.target, "targetname" ); - model.origin = new_pos.model_org; - model.angles = new_pos.model_ang; - } + new_pos = random( level.hacker_tool_positions ); + self.origin = new_pos.trigger_org; + model = getent( self.target, "targetname" ); + model.origin = new_pos.model_org; + model.angles = new_pos.model_ang; } - player equipment_give( self.zombie_equipment_upgrade ); } + player equipment_give( self.zombie_equipment_upgrade ); } } -set_equipment_invisibility_to_player( equipment, invisible ) +set_equipment_invisibility_to_player( equipment, invisible ) //checked changed to match cerberus output { triggers = level.zombie_equipment[ equipment ].triggers; - i = 0; - while ( i < triggers.size ) + for ( i = 0; i < triggers.size; i++ ) { if ( isDefined( triggers[ i ] ) ) { triggers[ i ] setinvisibletoplayer( self, invisible ); } - i++; } models = level.zombie_equipment[ equipment ].models; - i = 0; - while ( i < models.size ) + for ( i = 0; i < models.size; i++ ) { if ( isDefined( models[ i ] ) ) { models[ i ] setinvisibletoplayer( self, invisible ); } - i++; } } -equipment_take( equipment ) +equipment_take( equipment ) //checked matches cerberus output { if ( !isDefined( equipment ) ) { @@ -282,7 +281,7 @@ equipment_take( equipment ) } } -equipment_give( equipment ) +equipment_give( equipment ) //checked matches cerberus output { if ( !isDefined( equipment ) ) { @@ -319,7 +318,7 @@ equipment_give( equipment ) self maps/mp/zombies/_zm_audio::create_and_play_dialog( "weapon_pickup", level.zombie_equipment[ equipment ].vox ); } -equipment_slot_watcher( equipment ) +equipment_slot_watcher( equipment ) //checked changed to match cerberus output { self notify( "kill_equipment_slot_watcher" ); self endon( "kill_equipment_slot_watcher" ); @@ -355,54 +354,45 @@ equipment_slot_watcher( equipment ) } self waittill( "equipment_select_response_done" ); } - continue; } else if ( curr_weapon == equipment && !self.current_equipment_active[ equipment ] ) { self notify( equipment + "_activate" ); self.current_equipment_active[ equipment ] = 1; - continue; } - else + else if ( curr_weapon != equipment && self.current_equipment_active[ equipment ] ) { - if ( curr_weapon != equipment && self.current_equipment_active[ equipment ] ) - { - self notify( equipment + "_deactivate" ); - self.current_equipment_active[ equipment ] = 0; - } + self notify( equipment + "_deactivate" ); + self.current_equipment_active[ equipment ] = 0; } } } -is_limited_equipment( equipment ) +is_limited_equipment( equipment ) //checked changed to match cerberus output { - while ( isDefined( level._limited_equipment ) ) + if ( isDefined( level._limited_equipment ) ) { - i = 0; - while ( i < level._limited_equipment.size ) + for ( i = 0; i < level._limited_equipment.size; i++ ) { if ( level._limited_equipment[ i ] == equipment ) { return 1; } - i++; } } return 0; } -limited_equipment_in_use( equipment ) +limited_equipment_in_use( equipment ) //checked changed to match cerberus output { players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { current_equipment = players[ i ] get_player_equipment(); if ( isDefined( current_equipment ) && current_equipment == equipment ) { return 1; } - i++; } if ( isDefined( level.dropped_equipment ) && isDefined( level.dropped_equipment[ equipment ] ) ) { @@ -411,58 +401,56 @@ limited_equipment_in_use( equipment ) return 0; } -setup_limited_equipment( equipment ) +setup_limited_equipment( equipment ) //checked changed to match cerberus output { players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { players[ i ] set_equipment_invisibility_to_player( equipment, 1 ); - i++; } self thread release_limited_equipment_on_disconnect( equipment ); self thread release_limited_equipment_on_equipment_taken( equipment ); } -release_limited_equipment_on_equipment_taken( equipment ) +release_limited_equipment_on_equipment_taken( equipment ) //checked changed to match cerberus output { self endon( "disconnect" ); self waittill_either( equipment + "_taken", "spawned_spectator" ); players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { players[ i ] set_equipment_invisibility_to_player( equipment, 0 ); - i++; } } -release_limited_equipment_on_disconnect( equipment ) +release_limited_equipment_on_disconnect( equipment ) //checked changed to match cerberus output { self endon( equipment + "_taken" ); self waittill( "disconnect" ); players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { if ( isalive( players[ i ] ) ) { players[ i ] set_equipment_invisibility_to_player( equipment, 0 ); } - i++; } } -is_equipment_active( equipment ) +is_equipment_active( equipment ) //changed at own discretion { if ( !isDefined( self.current_equipment_active ) || !isDefined( self.current_equipment_active[ equipment ] ) ) { return 0; } - return self.current_equipment_active[ equipment ]; + if ( self.current_equipment_active[ equipment ] ) + { + return 1; + } + return 0; } -init_equipment_hint_hudelem( x, y, alignx, aligny, fontscale, alpha ) +init_equipment_hint_hudelem( x, y, alignx, aligny, fontscale, alpha ) //checked matches cerberus output { self.x = x; self.y = y; @@ -473,7 +461,7 @@ init_equipment_hint_hudelem( x, y, alignx, aligny, fontscale, alpha ) self.sort = 20; } -setup_equipment_client_hintelem() +setup_equipment_client_hintelem() //checked matches cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -491,7 +479,7 @@ setup_equipment_client_hintelem() } } -show_equipment_hint( equipment ) +show_equipment_hint( equipment ) //checked matches cerberus output { self notify( "kill_previous_show_equipment_hint_thread" ); self endon( "kill_previous_show_equipment_hint_thread" ); @@ -506,7 +494,7 @@ show_equipment_hint( equipment ) self show_equipment_hint_text( text ); } -show_equipment_hint_text( text ) +show_equipment_hint_text( text ) //checked matches cerberus output { self notify( "hide_equipment_hint_text" ); wait 0.05; @@ -527,12 +515,13 @@ show_equipment_hint_text( text ) self.hintelem destroy(); } -equipment_onspawnretrievableweaponobject( watcher, player ) +equipment_onspawnretrievableweaponobject( watcher, player ) //checked partially changed to match cerberus output changed at own discretion { + iswallmount = 0; self.plant_parent = self; - if ( isDefined( level.placeable_equipment_type[ self.name ] ) ) + if ( isDefined( level.placeable_equipment_type[ self.name ] ) && level.placeable_equipment_type[ self.name ] == "wallmount" ) { - iswallmount = level.placeable_equipment_type[ self.name ] == "wallmount"; + iswallmount = 1; } if ( !isDefined( player.turret_placement ) || !player.turret_placement[ "result" ] ) { @@ -585,18 +574,15 @@ equipment_onspawnretrievableweaponobject( watcher, player ) plant_origin = player.turret_placement[ "origin" ]; plant_angles = player.turret_placement[ "angles" ]; } + else if ( isDefined( level.placeable_equipment_type[ self.name ] ) && level.placeable_equipment_type[ self.name ] == "wallmount" ) + { + plant_origin = self.origin; + plant_angles = self.angles; + } else { - if ( isDefined( level.placeable_equipment_type[ self.name ] ) && level.placeable_equipment_type[ self.name ] == "wallmount" ) - { - plant_origin = self.origin; - plant_angles = self.angles; - } - else - { - plant_origin = self.origin; - plant_angles = self.angles; - } + plant_origin = self.origin; + plant_angles = self.angles; } if ( isDefined( level.check_force_deploy_origin ) ) { @@ -607,14 +593,11 @@ equipment_onspawnretrievableweaponobject( watcher, player ) self.plant_parent = player; } } - else + else if ( isDefined( level.check_force_deploy_z ) ) { - if ( isDefined( level.check_force_deploy_z ) ) + if ( player [[ level.check_force_deploy_z ]]( self, plant_origin, plant_angles ) ) { - if ( player [[ level.check_force_deploy_z ]]( self, plant_origin, plant_angles ) ) - { - plant_origin = ( plant_origin[ 0 ], plant_origin[ 1 ], player.origin[ 2 ] + 10 ); - } + plant_origin = ( plant_origin[ 0 ], plant_origin[ 1 ], player.origin[ 2 ] + 10 ); } } if ( isDefined( iswallmount ) && iswallmount ) @@ -641,7 +624,7 @@ equipment_onspawnretrievableweaponobject( watcher, player ) } } -equipment_retrieve( player ) +equipment_retrieve( player ) //checked changed to match cerberus output { if ( isDefined( self ) ) { @@ -653,15 +636,12 @@ equipment_retrieve( player ) player equipment_give( weaponname ); self.owner = player; } - else + else if ( player != original_owner ) { - if ( player != original_owner ) - { - equipment_transfer( weaponname, original_owner, player ); - self.owner = player; - } - player equipment_from_deployed( weaponname ); + equipment_transfer( weaponname, original_owner, player ); + self.owner = player; } + player equipment_from_deployed( weaponname ); if ( isDefined( self.requires_pickup ) && self.requires_pickup ) { if ( isDefined( level.zombie_equipment[ weaponname ].pickup_fn ) ) @@ -692,7 +672,7 @@ equipment_retrieve( player ) } } -equipment_drop_to_planted( equipment, player ) +equipment_drop_to_planted( equipment, player ) //checked matches cerberus output { /* /# @@ -725,7 +705,7 @@ equipment_drop_to_planted( equipment, player ) } } -equipment_transfer( weaponname, fromplayer, toplayer ) +equipment_transfer( weaponname, fromplayer, toplayer ) //checked matches cerberus output { if ( is_limited_equipment( weaponname ) ) { @@ -785,7 +765,7 @@ equipment_transfer( weaponname, fromplayer, toplayer ) } } -equipment_release( equipment ) +equipment_release( equipment ) //checked matches cerberus output { /* /# @@ -795,7 +775,7 @@ equipment_release( equipment ) self equipment_take( equipment ); } -equipment_drop( equipment ) +equipment_drop( equipment ) //checked matches cerberus output { if ( isDefined( level.zombie_equipment[ equipment ].place_fn ) ) { @@ -835,7 +815,7 @@ equipment_drop( equipment ) self notify( "equipment_dropped" ); } -equipment_grab( equipment, item ) +equipment_grab( equipment, item ) //checked matches cerberus output { /* /# @@ -851,7 +831,7 @@ equipment_grab( equipment, item ) } } -equipment_orphaned( equipment ) +equipment_orphaned( equipment ) //checked matches cerberus output { /* /# @@ -861,7 +841,7 @@ equipment_orphaned( equipment ) self equipment_take( equipment ); } -equipment_to_deployed( equipment ) +equipment_to_deployed( equipment ) //checked matches cerberus output { /* /# @@ -886,7 +866,7 @@ equipment_to_deployed( equipment ) self setactionslot( 1, "" ); } -equipment_from_deployed( equipment ) +equipment_from_deployed( equipment ) //checked matches cerberus output { if ( !isDefined( equipment ) ) { @@ -920,7 +900,7 @@ equipment_from_deployed( equipment ) self notify( equipment + "_pickup" ); } -eqstub_get_unitrigger_origin() +eqstub_get_unitrigger_origin() //checked matches cerberus output { if ( isDefined( self.origin_parent ) ) { @@ -931,7 +911,7 @@ eqstub_get_unitrigger_origin() return self.origin + eq_unitrigger_offset; } -eqstub_on_spawn_trigger( trigger ) +eqstub_on_spawn_trigger( trigger ) //checked matches cerberus output { if ( isDefined( self.link_parent ) ) { @@ -941,7 +921,7 @@ eqstub_on_spawn_trigger( trigger ) } } -equipment_buy( equipment ) +equipment_buy( equipment ) //checked changed at own discretion { /* /# @@ -952,7 +932,7 @@ equipment_buy( equipment ) { self equipment_drop( self.current_equipment ); } - if ( equipment != "riotshield_zm" && equipment == "alcatraz_shield_zm" && isDefined( self.player_shield_reset_health ) ) + if ( ( equipment == "riotshield_zm" || equipment == "alcatraz_shield_zm" ) && isDefined( self.player_shield_reset_health ) ) { self [[ self.player_shield_reset_health ]](); } @@ -963,7 +943,7 @@ equipment_buy( equipment ) self equipment_give( equipment ); } -generate_equipment_unitrigger( classname, origin, angles, flags, radius, script_height, hint, icon, think, moving ) +generate_equipment_unitrigger( classname, origin, angles, flags, radius, script_height, hint, icon, think, moving ) //checked matches cerberus output { if ( !isDefined( radius ) ) { @@ -1053,7 +1033,7 @@ generate_equipment_unitrigger( classname, origin, angles, flags, radius, script_ return unitrigger_stub; } -can_pick_up_equipment( equipment_name, equipment_trigger ) +can_pick_up_equipment( equipment_name, equipment_trigger ) //checked matches cerberus output { if ( self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || self in_revive_trigger() ) { @@ -1086,15 +1066,16 @@ can_pick_up_equipment( equipment_name, equipment_trigger ) return 1; } -same_team_placed_equipment( equipment_trigger ) +same_team_placed_equipment( equipment_trigger ) //checked changed at own discretion { - if ( isDefined( equipment_trigger ) && isDefined( equipment_trigger.stub ) && isDefined( equipment_trigger.stub.model ) && isDefined( equipment_trigger.stub.model.owner ) ) + if ( isDefined( equipment_trigger ) && isDefined( equipment_trigger.stub ) && isDefined( equipment_trigger.stub.model ) && isDefined( equipment_trigger.stub.model.owner ) && equipment_trigger.stub.model.owner.pers[ "team" ] == self.pers[ "team" ] ) { - return equipment_trigger.stub.model.owner.pers[ "team" ] == self.pers[ "team" ]; + return 1; } + return 0; } -placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) +placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) //checked changed to match cerberus output { pickupmodel = spawn( "script_model", origin ); if ( isDefined( angles ) ) @@ -1134,10 +1115,7 @@ placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) } tup = anglesToUp( angles ); eq_unitrigger_offset = 12 * tup; - if ( isDefined( pickupmodel.canmove ) ) - { - pickupmodel.stub = generate_equipment_unitrigger( "trigger_radius_use", torigin + eq_unitrigger_offset, angles, 0, tradius, 64, hint, equipname, ::placed_equipment_unitrigger_think, pickupmodel.canmove ); - } + pickupmodel.stub = generate_equipment_unitrigger( "trigger_radius_use", torigin + eq_unitrigger_offset, angles, 0, tradius, 64, hint, equipname, ::placed_equipment_unitrigger_think, pickupmodel.canmove ); pickupmodel.stub.model = pickupmodel; pickupmodel.stub.equipname = equipname; pickupmodel.equipname = equipname; @@ -1159,37 +1137,34 @@ placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) return pickupmodel; } -watch_player_visibility( equipment ) +watch_player_visibility( equipment ) //checked partially changed to match cerberus output continue in foreach bad check the github for more info { self endon( "kill_trigger" ); self setinvisibletoall(); while ( isDefined( self ) ) { players = getplayers(); - _a1142 = players; - _k1142 = getFirstArrayKey( _a1142 ); - while ( isDefined( _k1142 ) ) + i = 0; + while ( i < players.size ) { - player = _a1142[ _k1142 ]; if ( !isDefined( player ) ) { + i++; + continue; } - else + invisible = !player can_pick_up_equipment( equipment, self ); + if ( isDefined( self ) ) { - invisible = !player can_pick_up_equipment( equipment, self ); - if ( isDefined( self ) ) - { - self setinvisibletoplayer( player, invisible ); - } - wait 0.05; + self setinvisibletoplayer( player, invisible ); } - _k1142 = getNextArrayKey( _a1142, _k1142 ); + wait 0.05; + i++; } wait 1; } } -placed_equipment_unitrigger_think() +placed_equipment_unitrigger_think() //checked matches cerberus output { self endon( "kill_trigger" ); self thread watch_player_visibility( self.stub.equipname ); @@ -1205,7 +1180,7 @@ placed_equipment_unitrigger_think() } } -pickup_placed_equipment( player ) +pickup_placed_equipment( player ) //checked changed to match cerberus output { /* /# @@ -1222,6 +1197,7 @@ pickup_placed_equipment( player ) { if ( isDefined( level.dropped_equipment ) && isDefined( level.dropped_equipment[ stub.equipname ] ) && level.dropped_equipment[ stub.equipname ] == stub ) { + level.dropped_equipment[stub.equipname] = undefined; } } if ( isDefined( stub.model ) ) @@ -1233,7 +1209,7 @@ pickup_placed_equipment( player ) player.pickup_equipment = 0; } -dropped_equipment_think( model, equipname, origin, angles, tradius, toffset ) +dropped_equipment_think( model, equipname, origin, angles, tradius, toffset ) //checked changed to match cerberus output { pickupmodel = spawn( "script_model", origin ); if ( isDefined( angles ) ) @@ -1243,7 +1219,7 @@ dropped_equipment_think( model, equipname, origin, angles, tradius, toffset ) pickupmodel setmodel( model ); if ( isDefined( level.equipment_safe_to_drop ) ) { - if ( !( self [[ level.equipment_safe_to_drop ]]( pickupmodel ) ) ) + if ( !self [[ level.equipment_safe_to_drop ]]( pickupmodel ) ) { equipment_disappear_fx( pickupmodel.origin, undefined, pickupmodel.angles ); pickupmodel delete(); @@ -1270,7 +1246,7 @@ dropped_equipment_think( model, equipname, origin, angles, tradius, toffset ) { offset = 64; tforward = anglesToForward( angles ); - torigin = torigin + ( toffset * tforward ) + vectorScale( ( 0, 0, 0 ), 8 ); + torigin = torigin + toffset * tforward + vectorScale( ( 0, 0, 1 ), 8 ); } if ( isDefined( pickupmodel.canmove ) ) { @@ -1297,7 +1273,7 @@ dropped_equipment_think( model, equipname, origin, angles, tradius, toffset ) return pickupmodel; } -dropped_equipment_unitrigger_think() +dropped_equipment_unitrigger_think() //checked matches cerberus output { self endon( "kill_trigger" ); self thread watch_player_visibility( self.stub.equipname ); @@ -1313,7 +1289,7 @@ dropped_equipment_unitrigger_think() } } -pickup_dropped_equipment( player ) +pickup_dropped_equipment( player ) //checked matches cerberus output { player.pickup_equipment = 1; stub = self.stub; @@ -1327,7 +1303,7 @@ pickup_dropped_equipment( player ) player.pickup_equipment = 0; } -dropped_equipment_destroy( gusto ) +dropped_equipment_destroy( gusto ) //checked changed to match cerberus output { stub = self.stub; if ( isDefined( gusto ) && gusto ) @@ -1341,14 +1317,14 @@ dropped_equipment_destroy( gusto ) { stub.model delete(); } - if ( isDefined( self.original_owner ) || is_limited_equipment( stub.equipname ) && maps/mp/zombies/_zm_weapons::is_weapon_included( stub.equipname ) ) + if ( isDefined( self.original_owner ) && is_limited_equipment( stub.equipname ) || maps/mp/zombies/_zm_weapons::is_weapon_included( stub.equipname ) ) { self.original_owner equipment_take( stub.equipname ); } thread maps/mp/zombies/_zm_unitrigger::unregister_unitrigger( stub ); } -add_placeable_equipment( equipment, modelname, destroy_fn, type ) +add_placeable_equipment( equipment, modelname, destroy_fn, type ) //checked matches cerberus output { if ( !isDefined( level.placeable_equipment ) ) { @@ -1369,7 +1345,7 @@ add_placeable_equipment( equipment, modelname, destroy_fn, type ) level.placeable_equipment_type[ equipment ] = type; } -is_placeable_equipment( equipment ) +is_placeable_equipment( equipment ) //checked matches cerberus output { if ( isDefined( level.placeable_equipment ) && isDefined( level.placeable_equipment[ equipment ] ) ) { @@ -1378,7 +1354,7 @@ is_placeable_equipment( equipment ) return 0; } -equipment_placement_watcher() +equipment_placement_watcher() //checked matches cerberus output { self endon( "death_or_disconnect" ); for ( ;; ) @@ -1391,10 +1367,10 @@ equipment_placement_watcher() } } -equipment_watch_placement( equipment ) +equipment_watch_placement( equipment ) //checked changed to match cerberus output { self.turret_placement = undefined; - carry_offset = vectorScale( ( 0, 0, 0 ), 22 ); + carry_offset = vectorScale( ( 1, 0, 0 ), 22 ); carry_angles = ( 0, 0, 0 ); placeturret = spawnturret( "auto_turret", self.origin, equipment + "_turret" ); placeturret.angles = self.angles; @@ -1410,11 +1386,11 @@ equipment_watch_placement( equipment ) { self thread watch_melee_swipes( equipment, placeturret ); } - self notify( "create_equipment_turret" ); + self notify( "create_equipment_turret", placeturret ); ended = self waittill_any_return( "weapon_change", "grenade_fire", "death_or_disconnect" ); if ( isDefined( level.use_legacy_equipment_placement ) && !level.use_legacy_equipment_placement ) { - self.turret_placement = self canplayerplaceturret( /*placeturret*/ ); + self.turret_placement = self canplayerplaceturret( placeturret ); } if ( ended == "weapon_change" ) { @@ -1430,7 +1406,7 @@ equipment_watch_placement( equipment ) placeturret delete(); } -watch_melee_swipes( equipment, turret ) +watch_melee_swipes( equipment, turret ) //checked matches cerberus output { self endon( "weapon_change" ); self endon( "grenade_fire" ); @@ -1465,7 +1441,7 @@ watch_melee_swipes( equipment, turret ) } } -player_get_equipment_damage( equipment ) +player_get_equipment_damage( equipment ) //checked matches cerberus output { if ( isDefined( self.equipment_damage ) && isDefined( self.equipment_damage[ equipment ] ) ) { @@ -1474,7 +1450,7 @@ player_get_equipment_damage( equipment ) return 0; } -player_set_equipment_damage( equipment, damage ) +player_set_equipment_damage( equipment, damage ) //checked matches cerberus output { if ( !isDefined( self.equipment_damage ) ) { @@ -1483,7 +1459,7 @@ player_set_equipment_damage( equipment, damage ) self.equipment_damage[ equipment ] = damage; } -player_damage_equipment( equipment, damage, origin ) +player_damage_equipment( equipment, damage, origin ) //checked matches cerberus output { if ( !isDefined( self.equipment_damage ) ) { @@ -1508,7 +1484,7 @@ player_damage_equipment( equipment, damage, origin ) } } -item_damage( damage ) +item_damage( damage ) //checked changed to match cerberus output { if ( isDefined( self.isriotshield ) && self.isriotshield ) { @@ -1516,37 +1492,28 @@ item_damage( damage ) { self.owner [[ level.riotshield_damage_callback ]]( damage, 0 ); } - else + else if ( isDefined( level.deployed_riotshield_damage_callback ) ) { - if ( isDefined( level.deployed_riotshield_damage_callback ) ) - { - self [[ level.deployed_riotshield_damage_callback ]]( damage ); - } + self [[ level.deployed_riotshield_damage_callback ]]( damage ); } } - else + else if ( isDefined( self.owner ) ) { - if ( isDefined( self.owner ) ) - { - self.owner player_damage_equipment( self.equipname, damage, self.origin ); - return; - } - else - { - if ( !isDefined( self.damage ) ) - { - self.damage = 0; - } - self.damage += damage; - if ( self.damage > 1500 ) - { - self thread dropped_equipment_destroy( 1 ); - } - } + self.owner player_damage_equipment( self.equipname, damage, self.origin ); + return; + } + else if ( !isDefined( self.damage ) ) + { + self.damage = 0; + } + self.damage += damage; + if ( self.damage > 1500 ) + { + self thread dropped_equipment_destroy( 1 ); } } -item_watch_damage() +item_watch_damage() //checked matches cerberus output { self endon( "death" ); self setcandamage( 1 ); @@ -1558,7 +1525,7 @@ item_watch_damage() } } -item_watch_explosions() +item_watch_explosions() //checked matches cerberus output may need to check order of operations { self endon( "death" ); while ( 1 ) @@ -1566,7 +1533,7 @@ item_watch_explosions() level waittill( "grenade_exploded", position, radius, idamage, odamage ); wait randomfloatrange( 0.05, 0.3 ); distsqrd = distancesquared( self.origin, position ); - if ( distsqrd < ( radius * radius ) ) + if ( distsqrd < radius * radius ) { dist = sqrt( distsqrd ); dist /= radius; @@ -1576,7 +1543,7 @@ item_watch_explosions() } } -get_item_health() +get_item_health() //dev call did not check { /* /# @@ -1617,7 +1584,7 @@ get_item_health() */ } -debughealth() +debughealth() //dev call did not check { /* /# @@ -1638,7 +1605,7 @@ debughealth() */ } -item_choke() +item_choke() //checked matches cerberus output { if ( !isDefined( level.item_choke_count ) ) { @@ -1652,7 +1619,7 @@ item_choke() } } -is_equipment_ignored( equipname ) +is_equipment_ignored( equipname ) //checked matches cerberus output { if ( isDefined( level.equipment_ignored_by_zombies ) && isDefined( equipname ) && isDefined( level.equipment_ignored_by_zombies[ equipname ] ) ) { @@ -1661,7 +1628,7 @@ is_equipment_ignored( equipname ) return 0; } -enemies_ignore_equipment( equipname ) +enemies_ignore_equipment( equipname ) //checked matches cerberus output { if ( !isDefined( level.equipment_ignored_by_zombies ) ) { @@ -1670,7 +1637,7 @@ enemies_ignore_equipment( equipname ) level.equipment_ignored_by_zombies[ equipname ] = equipname; } -item_attract_zombies() +item_attract_zombies() //checked partially changed to match cerberus output did not change for loop to while loop more info on the github about continues { self endon( "death" ); self notify( "stop_attracting_zombies" ); @@ -1719,65 +1686,56 @@ item_attract_zombies() i++; continue; } - else if ( isDefined( ai[ i ].ignore_equipment ) && ai[ i ].ignore_equipment ) + if ( isDefined( ai[ i ].ignore_equipment ) && ai[ i ].ignore_equipment ) { i++; continue; } - else + if ( isDefined( level.ignore_equipment ) ) { - if ( isDefined( level.ignore_equipment ) ) - { - if ( self [[ level.ignore_equipment ]]( ai[ i ] ) ) - { - i++; - continue; - } - } - else if ( isDefined( ai[ i ].is_inert ) && ai[ i ].is_inert ) + if ( self [[ level.ignore_equipment ]]( ai[ i ] ) ) { i++; continue; } - else + } + if ( isDefined( ai[ i ].is_inert ) && ai[ i ].is_inert ) + { + i++; + continue; + } + if ( isDefined( ai[ i ].is_traversing ) && ai[ i ].is_traversing ) + { + i++; + continue; + } + vdist = abs( ai[ i ].origin[ 2 ] - self.origin[ 2 ] ); + distsqrd = distance2dsquared( ai[ i ].origin, self.origin ); + if ( ( self.equipname == "riotshield_zm" || self.equipname == "alcatraz_shield_zm" ) && isDefined( self.equipname ) ) + { + vdistmax = 108; + } + should_attack = 0; + if ( isDefined( level.should_attack_equipment ) ) + { + should_attack = self [[ level.should_attack_equipment ]]( distsqrd ); + } + if ( distsqrd < distmax && distsqrd > distmin && vdist < vdistmax || should_attack ) + { + if ( isDefined( ai[ i ].isscreecher ) && !ai[ i ].isscreecher && !ai[ i ] is_quad() && !ai[ i ] is_leaper() ) { - if ( isDefined( ai[ i ].is_traversing ) && ai[ i ].is_traversing ) - { - i++; - continue; - } - else - { - vdist = abs( ai[ i ].origin[ 2 ] - self.origin[ 2 ] ); - distsqrd = distance2dsquared( ai[ i ].origin, self.origin ); - if ( isDefined( self.equipname ) || self.equipname == "riotshield_zm" && self.equipname == "alcatraz_shield_zm" ) - { - vdistmax = 108; - } - should_attack = 0; - if ( isDefined( level.should_attack_equipment ) ) - { - should_attack = self [[ level.should_attack_equipment ]]( distsqrd ); - } - if ( distsqrd < distmax && distsqrd > distmin || vdist < vdistmax && should_attack ) - { - if ( isDefined( ai[ i ].isscreecher ) && !ai[ i ].isscreecher && !ai[ i ] is_quad() && !ai[ i ] is_leaper() ) - { - ai[ i ] thread attack_item( self ); - item_choke(); - } - } - item_choke(); - } + ai[ i ] thread attack_item( self ); + item_choke(); } } + item_choke(); i++; } wait 0.1; } } -attack_item( item ) +attack_item( item ) //checked changed to match cerberus output { self endon( "death" ); item endon( "death" ); @@ -1821,12 +1779,9 @@ attack_item( item ) { melee_anim = "zm_stumpy_melee"; } - else + else if ( self.zombie_move_speed == "run" || self.zombie_move_speed == "sprint" ) { - if ( self.zombie_move_speed == "run" || self.zombie_move_speed == "sprint" ) - { - melee_anim = "zm_run_melee_crawl"; - } + melee_anim = "zm_run_melee_crawl"; } } self orientmode( "face point", item.origin ); @@ -1847,7 +1802,7 @@ attack_item( item ) self orientmode( "face default" ); } -attack_item_interrupt( item ) +attack_item_interrupt( item ) //checked matches cerberus output { if ( isDefined( self.has_legs ) && !self.has_legs ) { @@ -1866,7 +1821,7 @@ attack_item_interrupt( item ) self.item = undefined; } -attack_item_stop( item ) +attack_item_stop( item ) //checked matches cerberus output { self notify( "attack_item_stop" ); self endon( "attack_item_stop" ); @@ -1882,7 +1837,7 @@ attack_item_stop( item ) } } -window_notetracks( msg, equipment ) +window_notetracks( msg, equipment ) //checked matches cerberus output { self endon( "death" ); equipment endon( "death" ); @@ -1900,40 +1855,34 @@ window_notetracks( msg, equipment ) } } -destructible_equipment_list_check() +destructible_equipment_list_check() //checked changed at own discretion { if ( !isDefined( level.destructible_equipment ) ) { level.destructible_equipment = []; } - i = 0; - while ( i < level.destructible_equipment.size ) + for ( i = 0; i < level.destructible_equipment.size; i++ ) { if ( !isDefined( level.destructible_equipment[ i ] ) ) { arrayremoveindex( level.destructible_equipment, i ); - continue; - } - else - { - i++; } } } -destructible_equipment_list_add( item ) +destructible_equipment_list_add( item ) //checked matches cerberus output { destructible_equipment_list_check(); level.destructible_equipment[ level.destructible_equipment.size ] = item; } -get_destructible_equipment_list() +get_destructible_equipment_list() //checked matches cerberus output { destructible_equipment_list_check(); return level.destructible_equipment; } -equipment_disappear_fx( origin, fx, angles ) +equipment_disappear_fx( origin, fx, angles ) //checked matches cerberus output { effect = level._equipment_disappear_fx; if ( isDefined( fx ) ) @@ -1951,3 +1900,6 @@ equipment_disappear_fx( origin, fx, angles ) wait 1.1; } + + + diff --git a/patch_zm/readme.md b/patch_zm/readme.md index 141cc79..56f1c8d 100644 --- a/patch_zm/readme.md +++ b/patch_zm/readme.md @@ -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/_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/_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/_menus.gsc patch_zm/maps/mp/gametypes_zm/_perplayer.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/zombies/_zm_blockers.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_game_module.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: ``` -patch_zm/maps/mp/gametypes_zm/_dev.gsc patch_zm/maps/mp/gametypes_zm/_gameobjects.gsc patch_zm/maps/mp/gametypes_zm/_globallogic.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_vehicle.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_util.gsc -patch_zm/maps/mp/gametypes_zm/_menus.gsc patch_zm/maps/mp/gametypes_zm/_spawning.gsc patch_zm/maps/mp/gametypes_zm/_spawnlogic.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/_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. //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_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_gasmask.gsc patch_zm/maps/mp/zombies/_zm_hackables_boards.gsc