Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SRGameRules extends GameRules;
  2.  
  3. var Pawn LastDamagePawn;
  4. var int LastDamage;
  5.  
  6. function PostBeginPlay()
  7. {
  8.     if( Level.Game.GameRulesModifiers==None )
  9.         Level.Game.GameRulesModifiers = Self;
  10.     else Level.Game.GameRulesModifiers.AddGameRules(Self);
  11. }
  12.  
  13. function AddGameRules(GameRules GR)
  14. {
  15.     if ( GR!=Self )
  16.         Super.AddGameRules(GR);
  17. }
  18.  
  19. function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
  20. {
  21.     local ClientPerkRepLink R;
  22.     local SRCustomProgress S;
  23.  
  24.     if ( (NextGameRules != None) && NextGameRules.PreventDeath(Killed,Killer, damageType,HitLocation) )
  25.         return true;
  26.  
  27.     if( xPlayer(Killer)!=None && Killed.Controller!=None && Killed.Controller!=Killer )
  28.     {
  29.         R = FindStatsFor(Killer);
  30.         if( R!=None )
  31.             for( S=R.CustomLink; S!=None; S=S.NextLink )
  32.                 S.NotifyPlayerKill(Killed,damageType);
  33.     }
  34.     if( xPlayer(Killed.Controller)!=None && Killer!=None && Killer.Pawn!=None )
  35.     {
  36.         R = FindStatsFor(Killed.Controller);
  37.         if( R!=None )
  38.             for( S=R.CustomLink; S!=None; S=S.NextLink )
  39.                 S.NotifyPlayerKilled(Killer.Pawn,damageType);
  40.     }
  41.     return false;
  42. }
  43.  
  44. static final function ClientPerkRepLink FindStatsFor( Controller C )
  45. {
  46.     local LinkedReplicationInfo L;
  47.  
  48.     if( C.PlayerReplicationInfo==None )
  49.         return None;
  50.     for( L=C.PlayerReplicationInfo.CustomReplicationInfo; L!=None; L=L.NextReplicationInfo )
  51.         if( ClientPerkRepLink(L)!=None )
  52.             return ClientPerkRepLink(L);
  53.     return None;
  54. }
  55.  
  56. function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
  57. {
  58.     if ( NextGameRules != None )
  59.         damage = NextGameRules.NetDamage(OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
  60.     if( injured!=None )
  61.     {
  62.         if( Monster(injured)!=None )
  63.         {
  64.             //if( !Class'mutDamagePopup'.Default.bMsgZedsDamage )
  65.                 return Damage;
  66.         }
  67.         //else //if( !Class'mutDamagePopup'.Default.bMsgPlayersDamage )
  68.         //  return Damage;
  69.  
  70.         if( LastDamagePawn!=None && LastDamagePawn!=injured )
  71.         {
  72.             Timer();
  73.             LastDamagePawn = None;
  74.         }
  75.         if( LastDamagePawn==None )
  76.         {
  77.             LastDamagePawn = injured;
  78.             LastDamage = 0;
  79.             SetTimer(0.1,false);
  80.         }
  81.         LastDamage+=Damage;
  82.     }
  83.     return Damage;
  84. }
  85. function Timer()
  86. {
  87.     if( LastDamagePawn!=None )
  88.     {
  89.         class'DamagePopup'.static.showdamage(LastDamagePawn,LastDamagePawn.Location+vect(0,0,1)*LastDamagePawn.CollisionHeight,LastDamage);
  90.         LastDamagePawn=none;
  91.         LastDamage=0;
  92.     }
  93. }
  94.  
  95. defaultproperties
  96. {
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement