Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SRGameRules extends GameRules;
- var Pawn LastDamagePawn;
- var int LastDamage;
- 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 PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
- {
- local ClientPerkRepLink R;
- local SRCustomProgress S;
- if ( (NextGameRules != None) && NextGameRules.PreventDeath(Killed,Killer, damageType,HitLocation) )
- return true;
- if( xPlayer(Killer)!=None && Killed.Controller!=None && Killed.Controller!=Killer )
- {
- R = FindStatsFor(Killer);
- if( R!=None )
- for( S=R.CustomLink; S!=None; S=S.NextLink )
- S.NotifyPlayerKill(Killed,damageType);
- }
- if( xPlayer(Killed.Controller)!=None && Killer!=None && Killer.Pawn!=None )
- {
- R = FindStatsFor(Killed.Controller);
- if( R!=None )
- for( S=R.CustomLink; S!=None; S=S.NextLink )
- S.NotifyPlayerKilled(Killer.Pawn,damageType);
- }
- return false;
- }
- static final function ClientPerkRepLink FindStatsFor( Controller C )
- {
- local LinkedReplicationInfo L;
- if( C.PlayerReplicationInfo==None )
- return None;
- for( L=C.PlayerReplicationInfo.CustomReplicationInfo; L!=None; L=L.NextReplicationInfo )
- if( ClientPerkRepLink(L)!=None )
- return ClientPerkRepLink(L);
- return None;
- }
- function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
- {
- if ( NextGameRules != None )
- damage = NextGameRules.NetDamage(OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
- if( injured!=None )
- {
- if( Monster(injured)!=None )
- {
- //if( !Class'mutDamagePopup'.Default.bMsgZedsDamage )
- return Damage;
- }
- //else //if( !Class'mutDamagePopup'.Default.bMsgPlayersDamage )
- // return Damage;
- if( LastDamagePawn!=None && LastDamagePawn!=injured )
- {
- Timer();
- LastDamagePawn = None;
- }
- if( LastDamagePawn==None )
- {
- LastDamagePawn = injured;
- LastDamage = 0;
- SetTimer(0.1,false);
- }
- LastDamage+=Damage;
- }
- return Damage;
- }
- function Timer()
- {
- if( LastDamagePawn!=None )
- {
- class'DamagePopup'.static.showdamage(LastDamagePawn,LastDamagePawn.Location+vect(0,0,1)*LastDamagePawn.CollisionHeight,LastDamage);
- LastDamagePawn=none;
- LastDamage=0;
- }
- }
- defaultproperties
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement