Second Chance Mutator. Mutator "Second Chance" Second Chance Mutator. Mutator "Second Chance" This version implements the revival of everyone after universal death once per map. SecondChanceMut.uc SecondChanceRules.uc Link to compiled version: YaDisk Author: Flame
#1
Posted:
Second Chance Mutator. Mutator “Second Chance”
This version implements the revival of everyone after universal death once per map.
SecondChanceMut.uc
class SecondChanceMut extends Mutator;
var SecondChanceRules Rules;
function PostBeginPlay()
{
if (Rules == None)
Rules = Spawn(class'SecondChanceRules');
}
defaultproperties
{
GroupName="KF-SecondChance"
FriendlyName="SecondChanceMut"
Description="SecondChanceMut"
}
SecondChanceRules.uc
class SecondChanceRules extends GameRules;
var bool bActivated;
function PostBeginPlay()
{
if (Level.Game.GameRulesModifiers == None)
Level.Game.GameRulesModifiers = Self;
else
Level.Game.GameRulesModifiers.AddGameRules(Self);
}
function AddGameRules(GameRules GR)
{
if (GR != Self)
Super.AddGameRules(GR);
}
function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
{
if (!bActivated && KFGameType(Level.Game).WaveNum <= KFGameType(Level.Game).FinalWave)
{
ResurrectPlayers();
bActivated = true;
return false;
}
if (NextGameRules != None)
return NextGameRules.CheckEndGame(Winner, Reason);
return true;
}
// Приходится чуток поизвращаться. Тут почему то не прокатывает стандартное оживление из той же админки
function ResurrectPlayers()
{
local Controller C;
local Pawn tmpPawn;
tmpPawn = Spawn(class'Pawn');
// Flame. В KFGameType есть проверка на bWaveInProgress
KFGameType(Level.Game).bWaveInProgress = false;
//
for (C = Level.ControllerList; C != None; C = C.nextController)
{
if (C.IsA('PlayerController') && C.PlayerReplicationInfo.PlayerID > 0)
{
// Flame. В KFGameType есть проверка на bOutOfLives и на C.Pawn!=none. Эти две строчки позволят обойти это
C.PlayerReplicationInfo.bOutOfLives = false;
C.Pawn = tmpPawn;
//
Level.Game.RestartPlayer(C);
}
}
KFGameType(Level.Game).bWaveInProgress = true;
tmpPawn.Destroy();
}
Link to compiled version: YaDisk Author: Flame