Files
UT99-Mod-SmartCTF-ChaCha/Classes/SmartCTFGameReplicationInfo.UC

210 lines
5.3 KiB
Plaintext

// This class gets spawned in the mutator, serverside.
// Because of its Role, it will also get copied to clients.
// The replicated variables are accessible there.
class SmartCTFGameReplicationInfo expands ReplicationInfo;
var int TickRate;
var bool bShowFCLocation, bStatsDrawFaces, bPlay30SecSound, bDrawLogo, bExtraStats, bShowSpecs, bDoKeybind, bSCTFSbDef, bSnowyScoreboard, bXmasImages;
var float SbDelayC;
var color SpectatorColor;
var string CountryFlagsPackage;
var class<ScoreBoard> NormalScoreBoardClass;
var SmartCTFEndStats EndStats;
var SmartCTFWelcomeNewPlayers WelcomeNewPlayers;
var SmartCTFPlayerReplicationInfo PRIArray[64];
var bool bInitialized, bServerInfoSetServerSide, bDoneBind;
var class<HUD> DefaultHUDType;
replication
{
// Settings
reliable if( Role == ROLE_Authority )
bShowFCLocation, bPlay30SecSound, bStatsDrawFaces, bDrawLogo, bExtraStats, CountryFlagsPackage, bShowSpecs, bSCTFSbDef, bDoKeybind, bSnowyScoreboard, bXmasImages;
reliable if( Role == ROLE_Authority )
bInitialized, TickRate, NormalScoreBoardClass, EndStats, bServerInfoSetServerSide, DefaultHUDType, DoBind, SbDelayC, SpectatorColor;
}
simulated function PostBeginPlay()
{
SetTimer( 0.5, True );
}
simulated function Timer()
{
local PlayerPawn P;
RefreshPRI();
if (Level.Netmode == NM_DedicatedServer || bDoneBind || !bDoKeybind) return; // Only execute on clients, if bind hasn't been done yet and if bind should be done.
foreach AllActors(class 'PlayerPawn', P)
if (Viewport(P.Player) != None) break;
if(P!=None) DoBind(P);
bDoneBind=true;
}
simulated function SmartCTFPlayerReplicationInfo GetStats( Actor P )
{
local int i;
local PlayerReplicationInfo PRI;
if( !P.IsA( 'Pawn' ) ) return None;
PRI = Pawn( P ).PlayerReplicationInfo;
if( PRI == None ) return None;
for( i = 0; i < 64; i++ )
{
if( PRIArray[i] == None ) break;
if( PRIArray[i].Owner == PRI ) return PRIArray[i];
}
return None;
}
simulated function SmartCTFPlayerReplicationInfo GetStatsByPRI( PlayerReplicationInfo PRI )
{
local int i;
if( PRI == None ) return None;
for( i = 0; i < 64; i++ )
{
if( PRIArray[i] == None ) break;
if( PRIArray[i].Owner == PRI ) return PRIArray[i];
}
return None;
}
simulated function SmartCTFPlayerReplicationInfo GetStatNr( byte i )
{
return PRIArray[i];
}
simulated function ClearStats()
{
local int i;
for( i = 0; i < 64; i++ )
{
if( PRIArray[i] == None ) break;
PRIArray[i].ClearStats();
}
}
simulated function RefreshPRI()
{
local SmartCTFPlayerReplicationInfo PRI;
local int i;
for( i = 0; i < 64; i++ ) PRIArray[i] = None;
i = 0;
ForEach AllActors( class'SmartCTFPlayerReplicationInfo', PRI )
{
if( i < 64 )
{
if( PRI.Owner != None ) PRIArray[i++] = PRI;
}
else break;
}
}
simulated function DoBind(PlayerPawn P)
{
local string keyBinding;
if ((InStr( Caps(P.ConsoleCommand("Keybinding F3")), "MUTATE SMARTCTF SHOWSTATS") == -1))
{
keyBinding = P.ConsoleCommand("Keybinding F3");
P.ConsoleCommand("SET INPUT F3 mutate smartctf showstats|"$keyBinding);
}
}
defaultproperties
{
TickRate=0
bShowFCLocation=False
bStatsDrawFaces=False
bPlay30SecSound=False
bDrawLogo=False
bExtraStats=False
bShowSpecs=False
bDoKeybind=False
bSCTFSbDef=False
bSnowyScoreboard=False
bXmasImages=False
SbDelayC=0.000000
SpectatorColor=(R=0,G=0,B=0,A=0)
CountryFlagsPackage=""
NormalScoreBoardClass=None
EndStats=None
PRIArray(0)=None
PRIArray(1)=None
PRIArray(2)=None
PRIArray(3)=None
PRIArray(4)=None
PRIArray(5)=None
PRIArray(6)=None
PRIArray(7)=None
PRIArray(8)=None
PRIArray(9)=None
PRIArray(10)=None
PRIArray(11)=None
PRIArray(12)=None
PRIArray(13)=None
PRIArray(14)=None
PRIArray(15)=None
PRIArray(16)=None
PRIArray(17)=None
PRIArray(18)=None
PRIArray(19)=None
PRIArray(20)=None
PRIArray(21)=None
PRIArray(22)=None
PRIArray(23)=None
PRIArray(24)=None
PRIArray(25)=None
PRIArray(26)=None
PRIArray(27)=None
PRIArray(28)=None
PRIArray(29)=None
PRIArray(30)=None
PRIArray(31)=None
PRIArray(32)=None
PRIArray(33)=None
PRIArray(34)=None
PRIArray(35)=None
PRIArray(36)=None
PRIArray(37)=None
PRIArray(38)=None
PRIArray(39)=None
PRIArray(40)=None
PRIArray(41)=None
PRIArray(42)=None
PRIArray(43)=None
PRIArray(44)=None
PRIArray(45)=None
PRIArray(46)=None
PRIArray(47)=None
PRIArray(48)=None
PRIArray(49)=None
PRIArray(50)=None
PRIArray(51)=None
PRIArray(52)=None
PRIArray(53)=None
PRIArray(54)=None
PRIArray(55)=None
PRIArray(56)=None
PRIArray(57)=None
PRIArray(58)=None
PRIArray(59)=None
PRIArray(60)=None
PRIArray(61)=None
PRIArray(62)=None
PRIArray(63)=None
bInitialized=False
bServerInfoSetServerSide=False
bDoneBind=False
DefaultHUDType=None
RemoteRole=ROLE_SimulatedProxy
}