More GSC fixes for Gun Game and Infected
Backport setOverrideWatchDvar from IW5pull/4/head
parent
71cd4dfe48
commit
d14eca4f21
|
@ -1415,9 +1415,22 @@ registerWatchDvar( nameString, defaultValue )
|
|||
}
|
||||
|
||||
|
||||
setOverrideWatchDvar( dvarString, value )
|
||||
{
|
||||
dvarString = "scr_" + level.gameType + "_" + dvarString;
|
||||
level.overrideWatchDvars[dvarString] = value;
|
||||
}
|
||||
|
||||
|
||||
getWatchedDvar( dvarString )
|
||||
{
|
||||
dvarString = "scr_" + level.gameType + "_" + dvarString;
|
||||
|
||||
if ( isDefined( level.overrideWatchDvars ) && isDefined( level.overrideWatchDvars[dvarString] ) )
|
||||
{
|
||||
return level.overrideWatchDvars[dvarString];
|
||||
}
|
||||
|
||||
return( level.watchDvars[ dvarString ].value );
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ init()
|
|||
level thread onPlayerConnecting();
|
||||
}
|
||||
|
||||
|
||||
getClassChoice( response )
|
||||
{
|
||||
assert( isDefined( level.classMap[response] ) );
|
||||
|
@ -77,7 +76,6 @@ getWeaponChoice( response )
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
logClassChoice( class, primaryWeapon, specialType, perks )
|
||||
{
|
||||
if ( class == self.lastClass )
|
||||
|
@ -90,7 +88,6 @@ logClassChoice( class, primaryWeapon, specialType, perks )
|
|||
self.lastClass = class;
|
||||
}
|
||||
|
||||
|
||||
cac_getWeapon( classIndex, weaponIndex )
|
||||
{
|
||||
return self getPlayerData( "customClasses", classIndex, "weaponSetups", weaponIndex, "weapon" );
|
||||
|
@ -131,8 +128,6 @@ cac_getOffhand( classIndex )
|
|||
return self getPlayerData( "customClasses", classIndex, "specialGrenade" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
table_getWeapon( tableName, classIndex, weaponIndex )
|
||||
{
|
||||
if ( weaponIndex == 0 )
|
||||
|
@ -505,8 +500,33 @@ giveLoadout( team, class, allowCopycat )
|
|||
loadoutSecondary = table_getWeapon( level.classTableName, 10, 1 );
|
||||
|
||||
//loadoutSecondaryCamo = "none";
|
||||
|
||||
self.loadoutPrimaryCamo = int(tableLookup( "mp/camoTable.csv", 1, loadoutPrimaryCamo, 0 ));
|
||||
self.loadoutPrimary = loadoutPrimary;
|
||||
self.loadoutSecondary = loadoutSecondary;
|
||||
self.loadoutSecondaryCamo = int(tableLookup( "mp/camoTable.csv", 1, loadoutSecondaryCamo, 0 ));
|
||||
|
||||
if ( loadoutSecondary == "none" )
|
||||
secondaryName = "none";
|
||||
else
|
||||
{
|
||||
|
||||
secondaryName = buildWeaponName( loadoutSecondary, loadoutSecondaryAttachment, loadoutSecondaryAttachment2 );
|
||||
self _giveWeapon( secondaryName, int(tableLookup( "mp/camoTable.csv", 1, loadoutSecondaryCamo, 0 ) ) );
|
||||
}
|
||||
|
||||
self SetOffhandPrimaryClass( "other" );
|
||||
|
||||
// Action Slots
|
||||
//self _SetActionSlot( 1, "" );
|
||||
self _SetActionSlot( 1, "nightvision" );
|
||||
self _SetActionSlot( 3, "altMode" );
|
||||
self _SetActionSlot( 4, "" );
|
||||
|
||||
// Perks
|
||||
self _clearPerks();
|
||||
self _detachAll();
|
||||
|
||||
if ( level.killstreakRewards )
|
||||
{
|
||||
if ( getDvarInt( "scr_classic" ) == 1 )
|
||||
|
@ -529,56 +549,39 @@ giveLoadout( team, class, allowCopycat )
|
|||
loadoutKillstreak3 = "none";
|
||||
}
|
||||
|
||||
secondaryName = buildWeaponName( loadoutSecondary, loadoutSecondaryAttachment, loadoutSecondaryAttachment2 );
|
||||
self _giveWeapon( secondaryName, int(tableLookup( "mp/camoTable.csv", 1, loadoutSecondaryCamo, 0 ) ) );
|
||||
|
||||
self.loadoutPrimaryCamo = int(tableLookup( "mp/camoTable.csv", 1, loadoutPrimaryCamo, 0 ));
|
||||
self.loadoutPrimary = loadoutPrimary;
|
||||
self.loadoutSecondary = loadoutSecondary;
|
||||
self.loadoutSecondaryCamo = int(tableLookup( "mp/camoTable.csv", 1, loadoutSecondaryCamo, 0 ));
|
||||
|
||||
self SetOffhandPrimaryClass( "other" );
|
||||
|
||||
// Action Slots
|
||||
//self _SetActionSlot( 1, "" );
|
||||
self _SetActionSlot( 1, "nightvision" );
|
||||
self _SetActionSlot( 3, "altMode" );
|
||||
self _SetActionSlot( 4, "" );
|
||||
|
||||
// Perks
|
||||
self _clearPerks();
|
||||
self _detachAll();
|
||||
|
||||
// these special case giving pistol death have to come before
|
||||
// perk loadout to ensure player perk icons arent overwritten
|
||||
if ( level.dieHardMode )
|
||||
self maps\mp\perks\_perks::givePerk( "specialty_pistoldeath" );
|
||||
|
||||
// only give the deathstreak for the initial spawn for this life.
|
||||
if ( loadoutDeathStreak != "specialty_null" && getTime() == self.spawnTime )
|
||||
{
|
||||
deathVal = int( tableLookup( "mp/perkTable.csv", 1, loadoutDeathStreak, 6 ) );
|
||||
|
||||
if ( self getPerkUpgrade( loadoutPerk1 ) == "specialty_rollover" || self getPerkUpgrade( loadoutPerk2 ) == "specialty_rollover" || self getPerkUpgrade( loadoutPerk3 ) == "specialty_rollover" )
|
||||
deathVal -= 1;
|
||||
|
||||
if ( self.pers["cur_death_streak"] == deathVal )
|
||||
{
|
||||
self thread maps\mp\perks\_perks::givePerk( loadoutDeathStreak );
|
||||
self thread maps\mp\gametypes\_hud_message::splashNotify( loadoutDeathStreak );
|
||||
}
|
||||
else if ( self.pers["cur_death_streak"] > deathVal )
|
||||
{
|
||||
self thread maps\mp\perks\_perks::givePerk( loadoutDeathStreak );
|
||||
}
|
||||
}
|
||||
|
||||
self loadoutAllPerks( loadoutEquipment, loadoutPerk1, loadoutPerk2, loadoutPerk3 );
|
||||
|
||||
self setKillstreaks( loadoutKillstreak1, loadoutKillstreak2, loadoutKillstreak3 );
|
||||
|
||||
if ( self hasPerk( "specialty_extraammo", true ) && getWeaponClass( secondaryName ) != "weapon_projectile" )
|
||||
self giveMaxAmmo( secondaryName );
|
||||
self giveMaxAmmo( secondaryName );
|
||||
|
||||
// only give the deathstreak for the initial spawn for this life.
|
||||
if( self.pers["cur_death_streak"] > 0 )
|
||||
{
|
||||
if ( loadoutDeathStreak != "specialty_null" )
|
||||
{
|
||||
deathVal = int( tableLookup( "mp/perkTable.csv", 1, loadoutDeathStreak, 6 ) );
|
||||
|
||||
if ( self getPerkUpgrade( loadoutPerk1 ) == "specialty_rollover" || self getPerkUpgrade( loadoutPerk2 ) == "specialty_rollover" || self getPerkUpgrade( loadoutPerk3 ) == "specialty_rollover" )
|
||||
deathVal -= 1;
|
||||
|
||||
if ( self.pers["cur_death_streak"] == deathVal )
|
||||
{
|
||||
self thread maps\mp\perks\_perks::givePerk( loadoutDeathStreak );
|
||||
self thread maps\mp\gametypes\_hud_message::splashNotify( loadoutDeathStreak );
|
||||
}
|
||||
else if ( self.pers["cur_death_streak"] > deathVal )
|
||||
{
|
||||
self thread maps\mp\perks\_perks::givePerk( loadoutDeathStreak );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Primary Weapon
|
||||
primaryName = buildWeaponName( loadoutPrimary, loadoutPrimaryAttachment, loadoutPrimaryAttachment2 );
|
||||
|
@ -599,21 +602,34 @@ giveLoadout( team, class, allowCopycat )
|
|||
// Primary Offhand was given by givePerk (it's your perk1)
|
||||
|
||||
// Secondary Offhand
|
||||
offhandSecondaryWeapon = loadoutOffhand + "_mp";
|
||||
if ( loadoutOffhand == "flash_grenade" )
|
||||
self SetOffhandSecondaryClass( "flash" );
|
||||
else
|
||||
self SetOffhandSecondaryClass( "smoke" );
|
||||
offhandSecondaryWeapon = loadoutOffhand;
|
||||
|
||||
self giveWeapon( offhandSecondaryWeapon );
|
||||
if( loadOutOffhand == "smoke_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 1 );
|
||||
else if( loadOutOffhand == "flash_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 2 );
|
||||
else if( loadOutOffhand == "concussion_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 2 );
|
||||
else
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 1 );
|
||||
if ( loadoutOffhand == "none" )
|
||||
self SetOffhandSecondaryClass( "none" );
|
||||
else if ( loadoutOffhand == "flash_grenade_mp" )
|
||||
self SetOffhandSecondaryClass( "flash" );
|
||||
else if ( loadoutOffhand == "smoke_grenade_mp" || loadoutOffhand == "concussion_grenade_mp" )
|
||||
self SetOffhandSecondaryClass( "smoke" );
|
||||
else
|
||||
self SetOffhandSecondaryClass( "flash" );
|
||||
|
||||
switch( offhandSecondaryWeapon )
|
||||
{
|
||||
case "none":
|
||||
break;
|
||||
default:
|
||||
self giveWeapon( offhandSecondaryWeapon );
|
||||
|
||||
if( loadOutOffhand == "smoke_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 1 );
|
||||
else if( loadOutOffhand == "flash_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 2 );
|
||||
else if( loadOutOffhand == "concussion_grenade" )
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 2 );
|
||||
else
|
||||
self setWeaponAmmoClip( offhandSecondaryWeapon, 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
primaryWeapon = primaryName;
|
||||
self.primaryWeapon = primaryWeapon;
|
||||
|
@ -780,7 +796,6 @@ trackRiotShield()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
tryAttach( placement ) // deprecated; hopefully we won't need to bring this defensive function back
|
||||
{
|
||||
if ( !isDefined( placement ) || placement != "back" )
|
||||
|
@ -824,8 +839,6 @@ tryDetach( placement ) // deprecated; hopefully we won't need to bring this defe
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
buildWeaponName( baseName, attachment1, attachment2 )
|
||||
{
|
||||
if ( !isDefined( level.letterToNumber ) )
|
||||
|
@ -891,7 +904,6 @@ buildWeaponName( baseName, attachment1, attachment2 )
|
|||
return ( weaponName + "_mp" );
|
||||
}
|
||||
|
||||
|
||||
makeLettersToNumbers()
|
||||
{
|
||||
array = [];
|
||||
|
@ -1011,7 +1023,6 @@ setKillstreaks( streak1, streak2, streak3 )
|
|||
self.killstreaks = newKillstreaks;
|
||||
}
|
||||
|
||||
|
||||
replenishLoadout() // used by ammo hardpoint.
|
||||
{
|
||||
team = self.pers["team"];
|
||||
|
@ -1036,7 +1047,6 @@ replenishLoadout() // used by ammo hardpoint.
|
|||
self SetWeaponAmmoClip( level.classGrenades[class]["secondary"]["type"], level.classGrenades[class]["secondary"]["count"] );
|
||||
}
|
||||
|
||||
|
||||
onPlayerConnecting()
|
||||
{
|
||||
for(;;)
|
||||
|
@ -1047,14 +1057,18 @@ onPlayerConnecting()
|
|||
{
|
||||
player.pers["class"] = "";
|
||||
}
|
||||
if ( !isDefined( player.pers["lastClass"] ) )
|
||||
{
|
||||
player.pers["lastClass"] = "";
|
||||
}
|
||||
player.class = player.pers["class"];
|
||||
player.lastClass = "";
|
||||
player.lastClass = player.pers["lastClass"];
|
||||
player.detectExplosives = false;
|
||||
player.bombSquadIcons = [];
|
||||
player.bombSquadIds = [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fadeAway( waitDelay, fadeDelay )
|
||||
{
|
||||
|
@ -1064,7 +1078,6 @@ fadeAway( waitDelay, fadeDelay )
|
|||
self.alpha = 0;
|
||||
}
|
||||
|
||||
|
||||
setClass( newClass )
|
||||
{
|
||||
self.curClass = newClass;
|
||||
|
@ -1080,7 +1093,6 @@ getPerkForClass( perkSlot, className )
|
|||
return table_getPerk( level.classTableName, class_num, perkSlot );
|
||||
}
|
||||
|
||||
|
||||
classHasPerk( className, perkName )
|
||||
{
|
||||
return( getPerkForClass( 0, className ) == perkName || getPerkForClass( 1, className ) == perkName || getPerkForClass( 2, className ) == perkName );
|
||||
|
@ -1317,4 +1329,4 @@ isValidWeapon( refString )
|
|||
assertMsg( "Replacing invalid weapon/attachment combo: " + refString );
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -510,13 +510,16 @@ tiValidationCheck()
|
|||
return true;
|
||||
}
|
||||
|
||||
spawnPlayer()
|
||||
spawnPlayer( fauxSpawn )
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
self endon( "joined_spectators" );
|
||||
self notify( "spawned" );
|
||||
self notify( "end_respawn" );
|
||||
|
||||
if ( !isDefined( fauxSpawn ) )
|
||||
fauxSpawn = false;
|
||||
|
||||
if ( isDefined( self.setSpawnPoint ) && self tiValidationCheck() )
|
||||
{
|
||||
spawnPoint = self.setSpawnPoint;
|
||||
|
@ -565,62 +568,69 @@ spawnPlayer()
|
|||
|
||||
self.fauxDead = undefined;
|
||||
|
||||
self.killsThisLife = [];
|
||||
|
||||
self updateSessionState( "playing", "" );
|
||||
self ClearKillcamState();
|
||||
self.cancelkillcam = 1;
|
||||
self openMenu( "killedby_card_hide" );
|
||||
if ( !fauxSpawn )
|
||||
{
|
||||
self.killsThisLife = [];
|
||||
|
||||
self updateSessionState( "playing", "" );
|
||||
self ClearKillcamState();
|
||||
self.cancelkillcam = 1;
|
||||
self openMenu( "killedby_card_hide" );
|
||||
|
||||
self.maxhealth = maps\mp\gametypes\_tweakables::getTweakableValue( "player", "maxhealth" );
|
||||
self.maxhealth = maps\mp\gametypes\_tweakables::getTweakableValue( "player", "maxhealth" );
|
||||
|
||||
self.health = self.maxhealth;
|
||||
|
||||
self.friendlydamage = undefined;
|
||||
self.hasSpawned = true;
|
||||
self.spawnTime = getTime();
|
||||
self.wasTI = !isDefined( spawnPoint );
|
||||
self.afk = false;
|
||||
self.lastStand = undefined;
|
||||
self.infinalStand = undefined;
|
||||
self.inC4Death = undefined;
|
||||
self.damagedPlayers = [];
|
||||
self.moveSpeedScaler = 1;
|
||||
self.killStreakScaler = 1;
|
||||
self.xpScaler = 1;
|
||||
self.objectiveScaler = 1;
|
||||
self.inLastStand = false;
|
||||
self.clampedHealth = undefined;
|
||||
self.shieldDamage = 0;
|
||||
self.shieldBulletHits = 0;
|
||||
self.recentShieldXP = 0;
|
||||
self.health = self.maxhealth;
|
||||
|
||||
self.friendlydamage = undefined;
|
||||
self.hasSpawned = true;
|
||||
self.spawnTime = getTime();
|
||||
self.wasTI = !isDefined( spawnPoint );
|
||||
self.afk = false;
|
||||
self.lastStand = undefined;
|
||||
self.infinalStand = undefined;
|
||||
self.inC4Death = undefined;
|
||||
self.damagedPlayers = [];
|
||||
self.moveSpeedScaler = 1;
|
||||
self.killStreakScaler = 1;
|
||||
self.xpScaler = 1;
|
||||
self.objectiveScaler = 1;
|
||||
self.inLastStand = false;
|
||||
self.clampedHealth = undefined;
|
||||
self.shieldDamage = 0;
|
||||
self.shieldBulletHits = 0;
|
||||
self.recentShieldXP = 0;
|
||||
}
|
||||
|
||||
self.disabledWeapon = 0;
|
||||
self.disabledWeaponSwitch = 0;
|
||||
self.disabledOffhandWeapons = 0;
|
||||
self resetUsability();
|
||||
|
||||
if ( self.pers["lives"] == getGametypeNumLives() )
|
||||
{
|
||||
maps\mp\gametypes\_playerlogic::addToLivesCount();
|
||||
}
|
||||
|
||||
if ( self.pers["lives"] )
|
||||
self.pers["lives"]--;
|
||||
|
||||
self maps\mp\gametypes\_playerlogic::addToAliveCount();
|
||||
|
||||
if ( !hadSpawned || gameHasStarted() || (gameHasStarted() && level.inGracePeriod && self.hasDoneCombat) )
|
||||
self maps\mp\gametypes\_playerlogic::removeFromLivesCount();
|
||||
|
||||
if ( !self.wasAliveAtMatchStart )
|
||||
if ( !fauxSpawn )
|
||||
{
|
||||
acceptablePassedTime = 20;
|
||||
if ( getTimeLimit() > 0 && acceptablePassedTime < getTimeLimit() * 60 / 4 )
|
||||
acceptablePassedTime = getTimeLimit() * 60 / 4;
|
||||
|
||||
if ( self.pers["lives"] == getGametypeNumLives() )
|
||||
{
|
||||
maps\mp\gametypes\_playerlogic::addToLivesCount();
|
||||
}
|
||||
|
||||
if ( level.inGracePeriod || getTimePassed() < acceptablePassedTime * 1000 )
|
||||
self.wasAliveAtMatchStart = true;
|
||||
if ( self.pers["lives"] )
|
||||
self.pers["lives"]--;
|
||||
|
||||
self maps\mp\gametypes\_playerlogic::addToAliveCount();
|
||||
|
||||
if ( !hadSpawned || gameHasStarted() || (gameHasStarted() && level.inGracePeriod && self.hasDoneCombat) )
|
||||
self maps\mp\gametypes\_playerlogic::removeFromLivesCount();
|
||||
|
||||
if ( !self.wasAliveAtMatchStart )
|
||||
{
|
||||
acceptablePassedTime = 20;
|
||||
if ( getTimeLimit() > 0 && acceptablePassedTime < getTimeLimit() * 60 / 4 )
|
||||
acceptablePassedTime = getTimeLimit() * 60 / 4;
|
||||
|
||||
if ( level.inGracePeriod || getTimePassed() < acceptablePassedTime * 1000 )
|
||||
self.wasAliveAtMatchStart = true;
|
||||
}
|
||||
}
|
||||
|
||||
self setClientDvar( "cg_thirdPerson", "0" );
|
||||
|
@ -642,6 +652,14 @@ spawnPlayer()
|
|||
self.spawnPos = spawnOrigin;
|
||||
|
||||
self spawn( spawnOrigin, spawnAngles );
|
||||
|
||||
// immediately fix our stance if we were spawned in place so we don't get stuck in geo
|
||||
if ( fauxSpawn && isDefined( self.faux_spawn_stance ) )
|
||||
{
|
||||
self setStance( self.faux_spawn_stance );
|
||||
self.faux_spawn_stance = undefined;
|
||||
}
|
||||
|
||||
[[level.onSpawnPlayer]]();
|
||||
|
||||
// Don't do this stuff for TI spawn points
|
||||
|
@ -1272,16 +1290,12 @@ Callback_PlayerConnect()
|
|||
if ( self.pers["team"] == "spectator" )
|
||||
{
|
||||
if ( allowTeamChoice() )
|
||||
{
|
||||
self maps\mp\gametypes\_menus::beginTeamChoice();
|
||||
return;
|
||||
}
|
||||
|
||||
self [[ level.autoassign ]]();
|
||||
return;
|
||||
else
|
||||
self [[level.autoassign]]();
|
||||
}
|
||||
|
||||
self maps\mp\gametypes\_menus::beginClassChoice();
|
||||
else
|
||||
self maps\mp\gametypes\_menus::beginClassChoice();
|
||||
}
|
||||
|
||||
/#
|
||||
|
|
|
@ -36,15 +36,13 @@ main()
|
|||
setGuns();
|
||||
|
||||
scoreLimit = level.gun_guns.size;
|
||||
SetDvar( "scr_gun_scorelimit", scoreLimit );
|
||||
registerScoreLimitDvar( level.gameType, scoreLimit );
|
||||
SetDvar( "scr_gun_winlimit", 1 );
|
||||
registerWinLimitDvar( "gun", 1 );
|
||||
SetDvar( "scr_gun_roundlimit", 1 );
|
||||
registerRoundLimitDvar( "gun", 1 );
|
||||
SetDvar( "scr_gun_halftime", 0 );
|
||||
registerHalfTimeDvar( "gun", 0 );
|
||||
|
||||
registerTimeLimitDvar( level.gameType, 10, 0, 20 );
|
||||
registerScoreLimitDvar( level.gameType, scoreLimit );
|
||||
registerRoundLimitDvar( level.gameType, 1, 0, 10 );
|
||||
registerWinLimitDvar( level.gameType, 1, 0, 10 );
|
||||
registerNumLivesDvar( level.gameType, 0, 0, 10 );
|
||||
registerHalfTimeDvar( level.gameType, 0, 0, 1 );
|
||||
|
||||
setSpecialLoadout();
|
||||
|
||||
level.teamBased = false;
|
||||
|
@ -192,7 +190,7 @@ waitLoadoutDone()
|
|||
|
||||
self waittill( "spawned_player" );
|
||||
|
||||
self _setPerk( "specialty_bling", false );
|
||||
self _setPerk( "specialty_bling" );
|
||||
self giveNextGun( true );
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ main()
|
|||
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
|
||||
maps\mp\gametypes\_globallogic::SetupCallbacks();
|
||||
|
||||
|
||||
registerTimeLimitDvar( level.gameType, 10 );
|
||||
setDvar( "scorelimit", 0 );
|
||||
setOverrideWatchDvar( "scorelimit", 0 );
|
||||
registerRoundLimitDvar( level.gameType, 1 );
|
||||
registerWinLimitDvar( level.gameType, 1 );
|
||||
registerNumLivesDvar( level.gameType, 0 );
|
||||
|
|
Loading…
Reference in New Issue