fix(s1: GSC): make SP work with the new client update
All checks were successful
lint / Lint GSC files (push) Successful in 9s
All checks were successful
lint / Lint GSC files (push) Successful in 9s
This commit is contained in:
44
scripts/mp/_patches.gsc
Normal file
44
scripts/mp/_patches.gsc
Normal file
@ -0,0 +1,44 @@
|
||||
main()
|
||||
{
|
||||
replacefunc( maps\mp\_utility::getlastlivingplayer, ::getlastlivingplayer_stub );
|
||||
replacefunc( maps\mp\gametypes\common_sd_sr::ononeleftevent, ::ononeleftevent_stub );
|
||||
}
|
||||
|
||||
getlastlivingplayer_stub( team )
|
||||
{
|
||||
live_player = undefined;
|
||||
|
||||
foreach ( player in level.players )
|
||||
{
|
||||
if ( isdefined( team ) && player.team != team )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !maps\mp\_utility::isreallyalive( player ) && !player maps\mp\gametypes\_playerlogic::mayspawn() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assertex( !isdefined( live_player ), "getLastLivingPlayer() found more than one live player on team." );
|
||||
|
||||
live_player = player;
|
||||
}
|
||||
|
||||
return live_player;
|
||||
}
|
||||
|
||||
ononeleftevent_stub( team )
|
||||
{
|
||||
if ( level.bombexploded || level.bombdefused )
|
||||
return;
|
||||
|
||||
last_player = maps\mp\_utility::getlastlivingplayer( team );
|
||||
|
||||
if ( !isdefined( last_player ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
last_player thread maps\mp\gametypes\common_sd_sr::givelastonteamwarning();
|
||||
}
|
23
scripts/mp/_team_balance.gsc
Normal file
23
scripts/mp/_team_balance.gsc
Normal file
@ -0,0 +1,23 @@
|
||||
init()
|
||||
{
|
||||
// define onteamselection callback function used in balanceteams()
|
||||
level.onteamselection = ::set_team;
|
||||
}
|
||||
|
||||
set_team(team)
|
||||
{
|
||||
if (team != self.pers["team"])
|
||||
{
|
||||
self.switching_teams = true;
|
||||
self.joining_team = team;
|
||||
self.leaving_team = self.pers["team"];
|
||||
}
|
||||
|
||||
if (self.sessionstate == "playing")
|
||||
{
|
||||
self suicide();
|
||||
}
|
||||
|
||||
maps\mp\gametypes\_menus::addtoteam(team);
|
||||
maps\mp\gametypes\_menus::endrespawnnotify();
|
||||
}
|
Reference in New Issue
Block a user