class SchlonzGameRules extends GameRules; var SchlonzUdpLink udpsock; var bool statsLogged; function bool Init( int ip, int port ) { local bool rc; udpsock = spawn( class'SchlonzUdpLink' ); if( udpsock != None ) { //udpsock.setIpPort( 168954625, 21844 ); udpsock.setIpPort( ip, port ); udpsock.bindNextAvail(); log( "***** SCHLONZ UDPLINK *****" ); rc = true; } else { log( "***** ERROR CREATIING SCHLONZ UDPLINK *****" ); rc = false; } statsLogged = false; return rc; } function Shutdown() { if( udpsock != None ) { udpsock.Destroy(); } } event Destroyed() { if( !statsLogged ) { LogF( "destroyed " $ Level.TimeSeconds ); LogEndGame(); } Shutdown(); Super.Destroyed(); } function LogF( string LogString ) { if( udpsock != None ) { udpsock.sText( LogString ); } else { log( "***** NO SCHLONZ UDPLINK" ); } } function string EncStr( string str ) { //local string xxx; //xxx = "\\'"; //return ReplaceText( str, "'", xxx ); return str; } event PostBeginPlay() { /* local GameStats gs; if( Level.NetMode == NM_DedicatedServer ) { log( "***** LOG START" ); //Init( 168954625, 21844 ); LogF( "startgame " $ Level.Year $ "." $ Level.Month $ "." $ Level.Day $ " " $ Level.Hour $ ":" $ Level.Minute $ ":" $ Level.Second $ " " $ Level.TimeSeconds ); gs = Spawn( class'GameStats' ); LogF( "level '" $ EncStr(Level.Title) $ "' '" $ gs.GetMapFileName() $ "' '" $ EncStr(Level.Author) $ "' '" $ Level.Game.Class $ "' '" $ EncStr(Level.Game.GameName) $ "'" ); gs.Destroy(); log( "***** LOG START END" ); } */ } function LogStartGame() { local GameStats gs; if( Level.NetMode == NM_DedicatedServer ) { log( "***** LOG START" ); gs = Spawn( class'GameStats' ); LogF( "startgame£" $ Level.Day $ "." $ Level.Month $ "." $ Level.Year $ " " $ Level.Hour $ ":" $ Level.Minute $ ":" $ Level.Second $ " " $ Level.TimeSeconds $ "£" $ gs.GetMapFileName() $ "£" $ EncStr(Level.Author) $ "£" $ Level.Game.Class $ "£" $ EncStr(Level.Game.GameName) ); gs.Destroy(); log( "***** LOG START END" ); } } function LogEndGame() { local Controller c; local PlayerReplicationInfo pri; statsLogged = true; for( c=Level.ControllerList; c!=None; c=c.NextController ) { pri = c.PlayerReplicationInfo; LogF( "score£" $ EncStr(pri.PlayerName) $ "£" $ int(pri.Score) $ "£" $ int(pri.Deaths) $ "£" $ pri.Team.TeamIndex ); } LogF( "endgame£" $ Level.Day $ "." $ Level.Month $ "." $ Level.Year $ " " $ Level.Hour $ ":" $ Level.Minute $ ":" $ Level.Second $ " " $ Level.TimeSeconds ); } function bool CheckEndGame( PlayerReplicationInfo Winner, string Reason ) { if( (NextGameRules != None) && !NextGameRules.CheckEndGame(Winner,Reason ) ) { LogF( "NoEndGame" ); return false; } LogEndGame(); return true; } function bool PreventDeath( Pawn Killed, Controller Killer, class damageType, vector HitLocation ) { if( (NextGameRules != None) && NextGameRules.PreventDeath( Killed,Killer, damageType, HitLocation ) ) { //LogF( "PreventDeath" ); return true; } // log a kill if( Killed != None && Killer != None && damageType != None ) { LogF( "kill£" $ EncStr(Killed.PlayerReplicationInfo.PlayerName) $ "£" $ EncStr(Killer.PlayerReplicationInfo.PLayerName) $ "£" $ damageType $ "£" $ Level.TimeSeconds ); } return false; } function bool OverridePickupQuery( Pawn Other, Pickup item, out byte bAllowPickup ) { local float PlayersSize; if( HealthPack(item) != None || MiniHealthPack(item) != None ) { if( Other.PlayerReplicationInfo != None ) { if( Other.PlayerReplicationInfo.bBot ) { PlayersSize = SchlonzXPawnBot( Other ).PlayerSize; if( PlayersSize != 1 ) { if( PlayersSize > 1 ) PlayersSize -= 0.2; else PlayersSize += 0.2; if ( other.SetCollisionSize(Other.Default.CollisionRadius * PlayersSize,Other.Default.CollisionHeight * PlayersSize) ) { Other.SetDrawScale(PlayersSize); Other.SetLocation(Other.Location); if( PlayersSize >= 1 ) { Other.GroundSpeed = 440; } else { Other.GroundSpeed = 440 * PlayersSize; } SchlonzXPawnBot( Other ).PlayerSize = PlayersSize; } } } } } return Super.OverridePickupQuery( Other, item, bAllowPickup ); } function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, vector Momentum, class DamageType ) { local float PlayersSize; if( instigatedBy == None ) return Damage; if( DamageType != None ) instigatedBy.ClientMessage( DamageType.Name ); PlayersSize = 1; if( instigatedBy != None ) if( instigatedBy.PlayerReplicationInfo != None ) if( instigatedBy.PlayerReplicationInfo.bBot ) PlayersSize = SchlonzXPawnBot( instigatedBy ).PlayerSize; if( PlayersSize > 1 ) PlayersSize = 2 - PlayersSize; Damage *= PlayersSize; // reduce bots impact on players if( injured != None ) { if( injured.PlayerReplicationInfo != None ) { if( ! injured.PlayerReplicationInfo.bBot ) { // injured.ClientMessage( "Damage "$Damage$" : "$(Damage*0.5) ); Damage *= 0.5; } } } return Damage; } defaultproperties { }