mGm_Lizard

Argon.uc old

Aug 7th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* 3SPN TAM Mod 3.141 Original MOD Base used      */
  2. /* TAM 3.2 Mod changes by Born_2B_Fragged 08/2012 */
  3. /* Scoreboard, Argon Radar, arena scoring fixes   */
  4. /* Thanks to 3SPN for such a GREAT mod !!!        */
  5.  
  6. class Argon extends TeamArenaMaster;
  7.  
  8. var float AutoThawTime;
  9. var float ThawSpeed;
  10. var bool  bTeamHeal;
  11.  
  12. var array<Argon_Pawn> FrozenPawns;
  13.  
  14. function InitGameReplicationInfo()
  15. {
  16.     Super.InitGameReplicationInfo();
  17.  
  18.     if(Argon_GRI(GameReplicationInfo) == None)
  19.         return;
  20.  
  21.     Argon_GRI(GameReplicationInfo).AutoThawTime = AutoThawTime;
  22.     Argon_GRI(GameReplicationInfo).ThawSpeed = ThawSpeed;
  23.     Argon_GRI(GameReplicationInfo).bTeamHeal = bTeamHeal;
  24. }
  25.  
  26. function StartNewRound()
  27. {
  28.     FrozenPawns.Remove(0, FrozenPawns.Length);
  29.  
  30.     Super.StartNewRound();
  31. }
  32.  
  33. function ParseOptions(string Options)
  34. {
  35.     local string InOpt;
  36.  
  37.     Super.ParseOptions(Options);
  38.  
  39.     InOpt = ParseOption(Options, "AutoThawTime");
  40.     if(InOpt != "")
  41.         AutoThawTime = float(InOpt);
  42.  
  43.     InOpt = ParseOption(Options, "ThawSpeed");
  44.     if(InOpt != "")
  45.         ThawSpeed = float(InOpt);
  46.  
  47.     InOpt = ParseOption(Options, "TeamHeal");
  48.     if(InOpt != "")
  49.         bTeamHeal = bool(InOpt);
  50. }
  51.  
  52. event InitGame(string options, out string error)
  53. {
  54.     Super.InitGame(Options, Error);
  55.    
  56.     class'xPawn'.Default.ControllerClass = class'Argon_Bot';
  57. }
  58.  
  59. function string SwapDefaultCombo(string ComboName)
  60. {
  61.     if(ComboName ~= "xGame.ComboSpeed")
  62.         return "3SPNv3141.Argon_ComboSpeed";
  63.     else if(ComboName ~= "xGame.ComboBerserk")
  64.         return "3SPNv3141.Misc_ComboBerserk";
  65.  
  66.     return ComboName;
  67. }
  68.  
  69. function PawnFroze(Argon_Pawn Frozen)
  70. {
  71.     local int i;
  72.  
  73.     for(i = 0; i < FrozenPawns.Length; i++)
  74.     {
  75.         if(FrozenPawns[i] == Frozen)
  76.             return;
  77.     }
  78.  
  79.     FrozenPawns[FrozenPawns.Length] = Frozen;
  80.     Frozen.Spree = 0;
  81.  
  82.     if(Misc_Player(Frozen.Controller) != None)
  83.         Misc_Player(Frozen.Controller).Spree = 0;
  84. }
  85.  
  86. //
  87. // Restart a thawing player. Same as RestartPlayer() just sans the spawn effects
  88. //
  89. function RestartFrozenPlayer(Controller aPlayer, vector Loc, rotator Rot, NavigationPoint Anchor)
  90. {
  91.     local int TeamNum;
  92.     local class<Pawn> DefaultPlayer${1}< ${3} >
  93.     local Vehicle V, Best;
  94.     local vector ViewDir;
  95.     local float BestDist, Dist;
  96.     local TeamInfo BotTeam, OtherTeam;
  97.  
  98.     if ( (!bPlayersVsBots || (Level.NetMode == NM_Standalone)) && bBalanceTeams && (Bot(aPlayer) != None) && (!bCustomBots || (Level.NetMode != NM_Standalone)) )
  99.     {
  100.         BotTeam = aPlayer.PlayerReplicationInfo.Team;
  101.         if ( BotTeam == Teams[0] )
  102.             OtherTeam = Teams[1];
  103.         else
  104.             OtherTeam = Teams[0];
  105.  
  106.         if ( OtherTeam.Size < BotTeam.Size - 1 )
  107.         {
  108.             aPlayer.Destroy();
  109.             return;
  110.         }
  111.     }
  112.  
  113.     if ( bMustJoinBeforeStart && (UnrealPlayer(aPlayer) != None)
  114.         && UnrealPlayer(aPlayer).bLatecomer )
  115.         return;
  116.  
  117.     if ( aPlayer.PlayerReplicationInfo.bOutOfLives )
  118.         return;
  119.  
  120.     if ( aPlayer.IsA('Bot') && TooManyBots(aPlayer) )
  121.     {
  122.         aPlayer.Destroy();
  123.         return;
  124.     }
  125.  
  126.     if( bRestartLevel && Level.NetMode != NM_DedicatedServer && Level.NetMode != NM_ListenServer )
  127.         return;
  128.  
  129.     if ( (aPlayer.PlayerReplicationInfo == None) || (aPlayer.PlayerReplicationInfo.Team == None) )
  130.         TeamNum = 255;
  131.     else
  132.         TeamNum = aPlayer.PlayerReplicationInfo.Team.TeamIndex;
  133.  
  134.     if (aPlayer.PreviousPawnClass!=None && aPlayer.PawnClass != aPlayer.PreviousPawnClass)
  135.         BaseMutator.PlayerChangedClass(aPlayer);
  136.  
  137.     if ( aPlayer.PawnClass != None )
  138.         aPlayer.Pawn = Spawn(aPlayer.PawnClass,,, Loc, Rot);
  139.  
  140.     if( aPlayer.Pawn==None )
  141.     {
  142.         DefaultPlayerClass = GetDefaultPlayerClass(aPlayer);
  143.         aPlayer.Pawn = Spawn(DefaultPlayerClass,,, Loc, Rot);
  144.     }
  145.     if ( aPlayer.Pawn == None )
  146.     {
  147.         log("Couldn't spawn player of type "$aPlayer.PawnClass$" at "$Location);
  148.         aPlayer.GotoState('Dead');
  149.         if ( PlayerController(aPlayer) != None )
  150.             PlayerController(aPlayer).ClientGotoState('Dead','Begin');
  151.         return;
  152.     }
  153.     if ( PlayerController(aPlayer) != None )
  154.         PlayerController(aPlayer).TimeMargin = -0.1;
  155.     if(Anchor != None)
  156.         aPlayer.Pawn.Anchor = Anchor;
  157.     aPlayer.Pawn.LastStartTime = Level.TimeSeconds;
  158.     aPlayer.PreviousPawnClass = aPlayer.Pawn.Class;
  159.  
  160.     aPlayer.Possess(aPlayer.Pawn);
  161.     aPlayer.PawnClass = aPlayer.Pawn.Class;
  162.  
  163.     //aPlayer.Pawn.PlayTeleportEffect(true, true);
  164.     aPlayer.ClientSetRotation(aPlayer.Pawn.Rotation);
  165.     AddDefaultInventory(aPlayer.Pawn);
  166.  
  167.     if ( bAllowVehicles && (Level.NetMode == NM_Standalone) && (PlayerController(aPlayer) != None) )
  168.     {
  169.         // tell bots not to get into nearby vehicles for a little while
  170.         BestDist = 2000;
  171.         ViewDir = vector(aPlayer.Pawn.Rotation);
  172.         for ( V=VehicleList; V!=None; V=V.NextVehicle )
  173.             if ( V.bTeamLocked && (aPlayer.GetTeamNum() == V.Team) )
  174.             {
  175.                 Dist = VSize(V.Location - aPlayer.Pawn.Location);
  176.                 if ( (ViewDir Dot (V.Location - aPlayer.Pawn.Location)) < 0 )
  177.                     Dist *= 2;
  178.                 if ( Dist < BestDist )
  179.                 {
  180.                     Best = V;
  181.                     BestDist = Dist;
  182.                 }
  183.             }
  184.  
  185.         if ( Best != None )
  186.             Best.PlayerStartTime = Level.TimeSeconds + 8;
  187.     }
  188. }
  189.  
  190. // if in health is 0, find the 'ambient' temperature of the map (the average of all player's health)
  191. function PlayerThawed(Argon_Pawn Thawed, optional float Health, optional float Shield)
  192. {
  193.     local vector Pos;
  194.     local vector Vel;
  195.     local rotator Rot;
  196.     local Controller C;
  197.     local array<WeaponData> WD;
  198.     local Inventory inv;
  199.     local int i;
  200.     local NavigationPoint N;
  201.     local Controller LastHitBy;
  202.     local int Team;
  203.  
  204.     if(bEndOfRound)
  205.         return;
  206.  
  207.  
  208. // set health to 100 upon auto-thaw
  209.  
  210.     if(Health == 0.0)
  211.     {
  212.       Health = 100;
  213.     }
  214.  
  215.     Pos = Thawed.Location;
  216.     Rot = Thawed.Rotation;
  217.     Vel = Thawed.Velocity;
  218.     C = Thawed.Controller;
  219.     N = Thawed.Anchor;
  220.     LastHitBy = Thawed.LastHitBy;
  221.  
  222.     if(C.PlayerReplicationInfo == None)
  223.         return;
  224.  
  225.     // store ammo amounts
  226.     WD = Thawed.MyWD;
  227.  
  228.     for(i = 0; i < FrozenPawns.Length; i++)
  229.     {
  230.         if(FrozenPawns[i] == Thawed)
  231.             FrozenPawns.Remove(i, 1);
  232.     }
  233.  
  234.     Thawed.Destroy();
  235.  
  236.     C.PlayerReplicationInfo.bOutOfLives = false;
  237.     C.PlayerReplicationInfo.NumLives = 1;
  238.  
  239.     if(PlayerController(C) != None)
  240.         PlayerController(C).ClientReset();
  241.     RestartFrozenPlayer(C, Pos, Rot, N);
  242.  
  243.     if(C.Pawn != None)
  244.     {
  245.         C.Pawn.SetLocation(Pos);
  246.         C.Pawn.SetRotation(Rot);
  247.         C.Pawn.AddVelocity(Vel);
  248.         C.Pawn.LastHitBy = LastHitBy;
  249.  
  250.         // redistribute ammo
  251.         for(inv = C.Pawn.Inventory; inv != None; inv = inv.Inventory)
  252.         {
  253.             if(Weapon(inv) == None)
  254.                 return;
  255.  
  256.             for(i = 0; i < WD.Length; i++)
  257.             {
  258.                 if(WD[i].WeaponName ~= string(inv.Class))
  259.                 {
  260.                     Weapon(inv).AmmoCharge[0] = WD[i].Ammo[0];
  261.                     Weapon(inv).AmmoCharge[1] = WD[i].Ammo[1];
  262.                     break;
  263.                 }
  264.             }
  265.         }
  266.  
  267.  // set default 100 health
  268.  
  269.         if(Health != 0.0)
  270.             C.Pawn.Health = 100;
  271.         C.Pawn.ShieldStrength = 0;
  272.     }
  273.    
  274.     if(PlayerController(C) != None)
  275.         PlayerController(C).ClientSetRotation(Rot);
  276.  
  277.     Team = C.GetTeamNum();
  278.     if(Team == 255)
  279.         return;
  280.  
  281.     if(TAM_TeamInfo(Teams[Team]) != None && TAM_TeamInfo(Teams[Team]).ComboManager != None)
  282.         TAM_TeamInfo(Teams[Team]).ComboManager.PlayerSpawned(C);
  283.     else if(TAM_TeamInfoRed(Teams[Team]) != None && TAM_TeamInfoRed(Teams[Team]).ComboManager != None)
  284.         TAM_TeamInfoRed(Teams[Team]).ComboManager.PlayerSpawned(C);
  285.     else if(TAM_TeamInfoBlue(Teams[Team]) != None && TAM_TeamInfoBlue(Teams[Team]).ComboManager != None)
  286.         TAM_TeamInfoBlue(Teams[Team]).ComboManager.PlayerSpawned(C);
  287.  
  288.     BroadcastLocalizedMessage(class'Argon_ThawMessage', 255, C.Pawn.PlayerReplicationInfo);
  289. }
  290.  
  291. function PlayerThawedByTouch(Argon_Pawn Thawed, array<Argon_Pawn> Thawers, optional float Health, optional float Shield)
  292. {
  293.     local Controller C;
  294.     local int i;
  295. //    local Argon_PRI fr_PRI;
  296. //    fr_PRI = Argon_PRI(PRI);
  297.  
  298.     if(bEndOfRound)
  299.         return;
  300.  
  301.     C = Thawed.Controller;
  302.     PlayerThawed(Thawed, Health, Shield);
  303.  
  304.     if(PlayerController(C) != None)
  305.         PlayerController(C).ReceiveLocalizedMessage(class'Argon_ThawMessage', 0, Thawers[0].PlayerReplicationInfo);
  306.  
  307.     if(C.PlayerReplicationInfo == None)
  308.         return;
  309.  
  310.     for(i = 0; i < Thawers.Length; i++)
  311.     {
  312.         if(Thawers[i].PlayerReplicationInfo != None)
  313.             {
  314.             Thawers[i].PlayerReplicationInfo.Score += 2.0;
  315. //            fr_PRI.Thaws++;
  316. //            Argon_PRI.AddThaw
  317.             }
  318.  
  319.  
  320.         if(Thawers[i].Controller != None)
  321.             Thawers[i].Controller.AwardAdrenaline(5.0);
  322.  
  323.         if(PlayerController(Thawers[i].Controller) != None)
  324.             PlayerController(Thawers[i].Controller).ReceiveLocalizedMessage(class'Argon_ThawMessage', 1, C.PlayerReplicationInfo);
  325.     }
  326. }
  327.  
  328. function bool CanSpectate(PlayerController Viewer, bool bOnlySpectator, actor ViewTarget)
  329. {
  330.     if(xPawn(ViewTarget) == None && (Controller(ViewTarget) == None || xPawn(Controller(ViewTarget).Pawn) == None))
  331.         return false;
  332.  
  333.     if(bOnlySpectator)
  334.     {
  335.         if(Controller(ViewTarget) != None)
  336.             return (Controller(ViewTarget).PlayerReplicationInfo != None && ViewTarget != Viewer);
  337.         else
  338.             return (xPawn(ViewTarget).IsPlayerPawn());
  339.     }
  340.  
  341.     if(bRespawning || (NextRoundTime <= 1 && bEndOfRound))
  342.         return false;
  343.  
  344.     if(Controller(ViewTarget) != None)
  345.         return (Controller(ViewTarget).PlayerReplicationInfo != None && ViewTarget != Viewer &&
  346.                 (bEndOfRound || (Controller(ViewTarget).GetTeamNum() == Viewer.GetTeamNum()) && Viewer.GetTeamNum() != 255));
  347.     else
  348.     {
  349.         return (xPawn(ViewTarget).IsPlayerPawn() && xPawn(ViewTarget).PlayerReplicationInfo != None &&
  350.                 (bEndOfRound || (xPawn(ViewTarget).GetTeamNum() == Viewer.GetTeamNum()) && Viewer.GetTeamNum() != 255));
  351.     }
  352. }
  353.  
  354. function bool DestroyActor(Actor A)
  355. {
  356.     if(Argon_Pawn(A) != None && Argon_Pawn(A).bFrozen)
  357.         return true;
  358.  
  359.     return Super.DestroyActor(A);
  360. }
  361.  
  362. function EndRound(PlayerReplicationInfo Scorer)
  363. {
  364.     local Argon_Trigger FT;
  365.  
  366.     foreach DynamicActors(class'Argon_Trigger', FT)
  367.         FT.Destroy();
  368.  
  369.     Super.EndRound(Scorer);
  370. }
  371.  
  372. defaultproperties
  373. {
  374.      AutoThawTime=125.000000
  375.      ThawSpeed=0.100000
  376.      bTeamHeal=True
  377.      bDisableTeamCombos=False
  378.      StartingArmor=0
  379.      TeamAIType(0)=Class'3spnv32.Argon_TeamAI'
  380.      TeamAIType(1)=Class'3spnv32.Argon_TeamAI'
  381.      DefaultPlayerClassName="3spnv32.Argon_Pawn"
  382.      ScoreBoardType="3spnv32.Argon_Scoreboard"
  383.      HUDType="3spnv32.Argon_HUD"
  384.      PlayerControllerClassName="3spnv32.Argon_Player"
  385.      GameReplicationInfoClass=Class'3spnv32.Argon_GRI'
  386.      GameName="Argon v3.2"
  387.      Description="Flash Freeze the other team, score a point. Insta-thaw yours."
  388.      Acronym="Argon"
  389. }
Advertisement
Add Comment
Please, Sign In to add comment