mGm_Lizard

Argon.uc

Aug 7th, 2015
212
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 !!! Line 98 random spawns */
  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.     //spawn at a PlayerStart instead of the Player's position
  99.     local NavigationPoint NewPlayerStart;
  100.     local byte InTeam = 1;
  101.     local string incomingName;
  102.  
  103.     if ( (aPlayer != None) && (aPlayer.StartSpot != None) )
  104.         LastPlayerStartSpot = aPlayer.StartSpot;
  105.  
  106.     NewPlayerStart = Super.FindPlayerStart(aPlayer, InTeam, incomingName );
  107.     if ( NewPlayerStart != None )
  108.         LastStartSpot = NewPlayerStart;
  109.     Loc = NewPlayerStart.Location;
  110.     Rot = NewPlayerStart.Rotation;
  111.    
  112.     //original code below
  113.     if ( (!bPlayersVsBots || (Level.NetMode == NM_Standalone)) && bBalanceTeams && (Bot(aPlayer) != None) && (!bCustomBots || (Level.NetMode != NM_Standalone)) )
  114.     {
  115.         BotTeam = aPlayer.PlayerReplicationInfo.Team;
  116.         if ( BotTeam == Teams[0] )
  117.             OtherTeam = Teams[1];
  118.         else
  119.             OtherTeam = Teams[0];
  120.  
  121.         if ( OtherTeam.Size < BotTeam.Size - 1 )
  122.         {
  123.             aPlayer.Destroy();
  124.             return;
  125.         }
  126.     }
  127.  
  128.     if ( bMustJoinBeforeStart && (UnrealPlayer(aPlayer) != None)
  129.         && UnrealPlayer(aPlayer).bLatecomer )
  130.         return;
  131.  
  132.     if ( aPlayer.PlayerReplicationInfo.bOutOfLives )
  133.         return;
  134.  
  135.     if ( aPlayer.IsA('Bot') && TooManyBots(aPlayer) )
  136.     {
  137.         aPlayer.Destroy();
  138.         return;
  139.     }
  140.  
  141.     if( bRestartLevel && Level.NetMode != NM_DedicatedServer && Level.NetMode != NM_ListenServer )
  142.         return;
  143.  
  144.     if ( (aPlayer.PlayerReplicationInfo == None) || (aPlayer.PlayerReplicationInfo.Team == None) )
  145.         TeamNum = 255;
  146.     else
  147.         TeamNum = aPlayer.PlayerReplicationInfo.Team.TeamIndex;
  148.  
  149.     if (aPlayer.PreviousPawnClass!=None && aPlayer.PawnClass != aPlayer.PreviousPawnClass)
  150.         BaseMutator.PlayerChangedClass(aPlayer);
  151.  
  152.     if ( aPlayer.PawnClass != None )
  153.         aPlayer.Pawn = Spawn(aPlayer.PawnClass,,, Loc, Rot);
  154.  
  155.     if( aPlayer.Pawn==None )
  156.     {
  157.         DefaultPlayerClass = GetDefaultPlayerClass(aPlayer);
  158.         aPlayer.Pawn = Spawn(DefaultPlayerClass,,, Loc, Rot);
  159.     }
  160.     if ( aPlayer.Pawn == None )
  161.     {
  162.         log("Couldn't spawn player of type "$aPlayer.PawnClass$" at "$Location);
  163.         aPlayer.GotoState('Dead');
  164.         if ( PlayerController(aPlayer) != None )
  165.             PlayerController(aPlayer).ClientGotoState('Dead','Begin');
  166.         return;
  167.     }
  168.     if ( PlayerController(aPlayer) != None )
  169.         PlayerController(aPlayer).TimeMargin = -0.1;
  170.     if(Anchor != None)
  171.         aPlayer.Pawn.Anchor = Anchor;
  172.     aPlayer.Pawn.LastStartTime = Level.TimeSeconds;
  173.     aPlayer.PreviousPawnClass = aPlayer.Pawn.Class;
  174.  
  175.     aPlayer.Possess(aPlayer.Pawn);
  176.     aPlayer.PawnClass = aPlayer.Pawn.Class;
  177.  
  178.     //aPlayer.Pawn.PlayTeleportEffect(true, true);
  179.     aPlayer.ClientSetRotation(aPlayer.Pawn.Rotation);
  180.     AddDefaultInventory(aPlayer.Pawn);
  181.  
  182.     if ( bAllowVehicles && (Level.NetMode == NM_Standalone) && (PlayerController(aPlayer) != None) )
  183.     {
  184.         // tell bots not to get into nearby vehicles for a little while
  185.         BestDist = 2000;
  186.         ViewDir = vector(aPlayer.Pawn.Rotation);
  187.         for ( V=VehicleList; V!=None; V=V.NextVehicle )
  188.             if ( V.bTeamLocked && (aPlayer.GetTeamNum() == V.Team) )
  189.             {
  190.                 Dist = VSize(V.Location - aPlayer.Pawn.Location);
  191.                 if ( (ViewDir Dot (V.Location - aPlayer.Pawn.Location)) < 0 )
  192.                     Dist *= 2;
  193.                 if ( Dist < BestDist )
  194.                 {
  195.                     Best = V;
  196.                     BestDist = Dist;
  197.                 }
  198.             }
  199.  
  200.         if ( Best != None )
  201.             Best.PlayerStartTime = Level.TimeSeconds + 8;
  202.     }
  203. }
  204.  
  205. // if in health is 0, find the 'ambient' temperature of the map (the average of all player's health)
  206. function PlayerThawed(Argon_Pawn Thawed, optional float Health, optional float Shield)
  207. {
  208.     local vector Pos;
  209.     local vector Vel;
  210.     local rotator Rot;
  211.     local Controller C;
  212.     local array<WeaponData> WD;
  213.     local Inventory inv;
  214.     local int i;
  215.     local NavigationPoint N;
  216.     local Controller LastHitBy;
  217.     local int Team;
  218.  
  219.     if(bEndOfRound)
  220.         return;
  221.  
  222.  
  223. // set health to 100 upon auto-thaw
  224.  
  225.     if(Health == 0.0)
  226.     {
  227.       Health = 100;
  228.     }
  229.  
  230.     Pos = Thawed.Location;
  231.     Rot = Thawed.Rotation;
  232.     Vel = Thawed.Velocity;
  233.     C = Thawed.Controller;
  234.     N = Thawed.Anchor;
  235.     LastHitBy = Thawed.LastHitBy;
  236.  
  237.     if(C.PlayerReplicationInfo == None)
  238.         return;
  239.  
  240.     // store ammo amounts
  241.     WD = Thawed.MyWD;
  242.  
  243.     for(i = 0; i < FrozenPawns.Length; i++)
  244.     {
  245.         if(FrozenPawns[i] == Thawed)
  246.             FrozenPawns.Remove(i, 1);
  247.     }
  248.  
  249.     Thawed.Destroy();
  250.  
  251.     C.PlayerReplicationInfo.bOutOfLives = false;
  252.     C.PlayerReplicationInfo.NumLives = 1;
  253.  
  254.     if(PlayerController(C) != None)
  255.         PlayerController(C).ClientReset();
  256.     RestartFrozenPlayer(C, Pos, Rot, N);
  257.  
  258.     if(C.Pawn != None)
  259.     {
  260.         C.Pawn.SetLocation(Pos);
  261.         C.Pawn.SetRotation(Rot);
  262.         C.Pawn.AddVelocity(Vel);
  263.         C.Pawn.LastHitBy = LastHitBy;
  264.  
  265.         // redistribute ammo
  266.         for(inv = C.Pawn.Inventory; inv != None; inv = inv.Inventory)
  267.         {
  268.             if(Weapon(inv) == None)
  269.                 return;
  270.  
  271.             for(i = 0; i < WD.Length; i++)
  272.             {
  273.                 if(WD[i].WeaponName ~= string(inv.Class))
  274.                 {
  275.                     Weapon(inv).AmmoCharge[0] = WD[i].Ammo[0];
  276.                     Weapon(inv).AmmoCharge[1] = WD[i].Ammo[1];
  277.                     break;
  278.                 }
  279.             }
  280.         }
  281.  
  282.  // set default 100 health
  283.  
  284.         if(Health != 0.0)
  285.             C.Pawn.Health = 100;
  286.         C.Pawn.ShieldStrength = 0;
  287.     }
  288.    
  289.     if(PlayerController(C) != None)
  290.         PlayerController(C).ClientSetRotation(Rot);
  291.  
  292.     Team = C.GetTeamNum();
  293.     if(Team == 255)
  294.         return;
  295.  
  296.     if(TAM_TeamInfo(Teams[Team]) != None && TAM_TeamInfo(Teams[Team]).ComboManager != None)
  297.         TAM_TeamInfo(Teams[Team]).ComboManager.PlayerSpawned(C);
  298.     else if(TAM_TeamInfoRed(Teams[Team]) != None && TAM_TeamInfoRed(Teams[Team]).ComboManager != None)
  299.         TAM_TeamInfoRed(Teams[Team]).ComboManager.PlayerSpawned(C);
  300.     else if(TAM_TeamInfoBlue(Teams[Team]) != None && TAM_TeamInfoBlue(Teams[Team]).ComboManager != None)
  301.         TAM_TeamInfoBlue(Teams[Team]).ComboManager.PlayerSpawned(C);
  302.  
  303.     BroadcastLocalizedMessage(class'Argon_ThawMessage', 255, C.Pawn.PlayerReplicationInfo);
  304. }
  305.  
  306. function PlayerThawedByTouch(Argon_Pawn Thawed, array<Argon_Pawn> Thawers, optional float Health, optional float Shield)
  307. {
  308.     local Controller C;
  309.     local int i;
  310. //    local Argon_PRI fr_PRI;
  311. //    fr_PRI = Argon_PRI(PRI);
  312.  
  313.     if(bEndOfRound)
  314.         return;
  315.  
  316.     C = Thawed.Controller;
  317.     PlayerThawed(Thawed, Health, Shield);
  318.  
  319.     if(PlayerController(C) != None)
  320.         PlayerController(C).ReceiveLocalizedMessage(class'Argon_ThawMessage', 0, Thawers[0].PlayerReplicationInfo);
  321.  
  322.     if(C.PlayerReplicationInfo == None)
  323.         return;
  324.  
  325.     for(i = 0; i < Thawers.Length; i++)
  326.     {
  327.         if(Thawers[i].PlayerReplicationInfo != None)
  328.             {
  329.             Thawers[i].PlayerReplicationInfo.Score += 2.0;
  330. //            fr_PRI.Thaws++;
  331. //            Argon_PRI.AddThaw
  332.             }
  333.  
  334.  
  335.         if(Thawers[i].Controller != None)
  336.             Thawers[i].Controller.AwardAdrenaline(5.0);
  337.  
  338.         if(PlayerController(Thawers[i].Controller) != None)
  339.             PlayerController(Thawers[i].Controller).ReceiveLocalizedMessage(class'Argon_ThawMessage', 1, C.PlayerReplicationInfo);
  340.     }
  341. }
  342.  
  343. function bool CanSpectate(PlayerController Viewer, bool bOnlySpectator, actor ViewTarget)
  344. {
  345.     if(xPawn(ViewTarget) == None && (Controller(ViewTarget) == None || xPawn(Controller(ViewTarget).Pawn) == None))
  346.         return false;
  347.  
  348.     if(bOnlySpectator)
  349.     {
  350.         if(Controller(ViewTarget) != None)
  351.             return (Controller(ViewTarget).PlayerReplicationInfo != None && ViewTarget != Viewer);
  352.         else
  353.             return (xPawn(ViewTarget).IsPlayerPawn());
  354.     }
  355.  
  356.     if(bRespawning || (NextRoundTime <= 1 && bEndOfRound))
  357.         return false;
  358.  
  359.     if(Controller(ViewTarget) != None)
  360.         return (Controller(ViewTarget).PlayerReplicationInfo != None && ViewTarget != Viewer &&
  361.                 (bEndOfRound || (Controller(ViewTarget).GetTeamNum() == Viewer.GetTeamNum()) && Viewer.GetTeamNum() != 255));
  362.     else
  363.     {
  364.         return (xPawn(ViewTarget).IsPlayerPawn() && xPawn(ViewTarget).PlayerReplicationInfo != None &&
  365.                 (bEndOfRound || (xPawn(ViewTarget).GetTeamNum() == Viewer.GetTeamNum()) && Viewer.GetTeamNum() != 255));
  366.     }
  367. }
  368.  
  369. function bool DestroyActor(Actor A)
  370. {
  371.     if(Argon_Pawn(A) != None && Argon_Pawn(A).bFrozen)
  372.         return true;
  373.  
  374.     return Super.DestroyActor(A);
  375. }
  376.  
  377. function EndRound(PlayerReplicationInfo Scorer)
  378. {
  379.     local Argon_Trigger FT;
  380.  
  381.     foreach DynamicActors(class'Argon_Trigger', FT)
  382.         FT.Destroy();
  383.  
  384.     Super.EndRound(Scorer);
  385. }
  386.  
  387. defaultproperties
  388. {
  389.      AutoThawTime=125.000000
  390.      ThawSpeed=0.100000
  391.      bTeamHeal=True
  392.      bDisableTeamCombos=False
  393.      StartingArmor=0
  394.      TeamAIType(0)=Class'3spnv32.Argon_TeamAI'
  395.      TeamAIType(1)=Class'3spnv32.Argon_TeamAI'
  396.      DefaultPlayerClassName="3spnv32.Argon_Pawn"
  397.      ScoreBoardType="3spnv32.Argon_Scoreboard"
  398.      HUDType="3spnv32.Argon_HUD"
  399.      PlayerControllerClassName="3spnv32.Argon_Player"
  400.      GameReplicationInfoClass=Class'3spnv32.Argon_GRI'
  401.      GameName="Argon v3.2"
  402.      Description="Flash Freeze the other team, score a point. Insta-thaw yours."
  403.      Acronym="Argon"
  404. }
Advertisement
Add Comment
Please, Sign In to add comment