Advertisement
poosh

TSCGameReplicationInfo

Nov 9th, 2014
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class TSCGameReplicationInfo extends TSCGameReplicationInfoBase;
  2.  
  3.  
  4. var byte OvertimeWaves;         // number of Overtime waves
  5. var byte SudDeathWaves;         // number of Sudden Death waves
  6.  
  7.  
  8. var float BaseRadiusSqr; // Base radius squared, set from TSCGameType
  9. var float MinBaseZ, MaxBaseZ; // min and max Z difference between player and base, set from TSCGameType
  10.  
  11.  
  12. replication
  13. {
  14.     reliable if ( bNetInitial && Role==ROLE_Authority )
  15.         OvertimeWaves, SudDeathWaves,
  16.         BaseRadiusSqr, MinBaseZ, MaxBaseZ;
  17. }
  18.  
  19.  
  20.  
  21.  
  22. simulated function bool AtBase(Vector CheckLocation, Actor TeamBase)
  23. {
  24.     local float ZDiff;
  25.    
  26.     if ( TSCBaseGuardian(TeamBase) == none || !TSCBaseGuardian(TeamBase).bActive )
  27.         return false;
  28.    
  29.     ZDiff = CheckLocation.Z - TeamBase.Location.Z;
  30.     return ZDiff >= MinBaseZ && ZDiff <= MaxBaseZ
  31.         && VSizeSquared(CheckLocation - TeamBase.Location) < BaseRadiusSqr;
  32. }
  33.  
  34. simulated function bool AtOwnBase(Pawn Player)
  35. {
  36.     if ( Player.PlayerReplicationInfo == none || Player.PlayerReplicationInfo.Team == none )
  37.         return false;
  38.        
  39.     return AtBase(Player.Location, Player.PlayerReplicationInfo.Team.HomeBase);
  40. }
  41.  
  42. simulated function bool AtEnemyBase(Pawn Player)
  43. {
  44.     local int TeamIndex;
  45.    
  46.     if ( Player.PlayerReplicationInfo == none || Player.PlayerReplicationInfo.Team == none )
  47.         return false;
  48.        
  49.     TeamIndex = Player.PlayerReplicationInfo.Team.TeamIndex;
  50.     if ( TeamIndex < 0 || TeamIndex > 1 )
  51.         return false;
  52.        
  53.     return AtBase(Player.Location, Teams[1-TeamIndex].HomeBase);
  54. }
  55.  
  56.  
  57. defaultproperties
  58. {
  59.     BaseRadiusSqr=1562500 // 25 m
  60.     MinBaseZ=-60
  61.     MaxBaseZ=200
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement