Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.58 KB | None | 0 0
  1. Index: binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
  2. ===================================================================
  3. --- binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js  (revision 19359)
  4. +++ binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js  (working copy)
  5. @@ -272,27 +272,27 @@ Trigger.prototype.StartAnEnemyWave = fun
  6.         {
  7.             spawned = true;
  8.             break;
  9.         }
  10.  
  11. -       let cmpPlayer = QueryOwnerInterface(point, IID_Player);
  12. -
  13. -       // Trigger point owned by Gaia if the player is defeated
  14. -       if (cmpPlayer.GetPlayerID() == 0)
  15. +       // Don't spawn attackers for defeated players or players who have won but lost their CC
  16. +       let playerID = QueryOwnerInterface(point, IID_Player).GetPlayerID();
  17. +       let civicCenter = this.playerCivicCenter[playerID];
  18. +       if (!civicCenter)
  19.             continue;
  20.  
  21. -       let targetPos = Engine.QueryInterface(this.playerCivicCenter[cmpPlayer.GetPlayerID()], IID_Position).GetPosition2D();
  22. +       let targetPos = Engine.QueryInterface(civicCenter, IID_Position).GetPosition2D();
  23.  
  24.         for (let attackerTemplate of attackerTemplates)
  25.         {
  26.             // Don't spawn gaia hero if the previous one is still alive
  27. -           if (attackerTemplate.hero && this.gaiaHeroes[cmpPlayer.GetPlayerID()])
  28. +           if (attackerTemplate.hero && this.gaiaHeroes[playerID])
  29.             {
  30. -               let cmpHealth = Engine.QueryInterface(this.gaiaHeroes[cmpPlayer.GetPlayerID()], IID_Health);
  31. +               let cmpHealth = Engine.QueryInterface(this.gaiaHeroes[playerID], IID_Health);
  32.                 if (cmpHealth && cmpHealth.GetHitpoints() != 0)
  33.                 {
  34. -                   this.debugLog("Not spawning hero for player " + cmpPlayer.GetPlayerID() + " as the previous one is still alive");
  35. +                   this.debugLog("Not spawning hero for player " + playerID + " as the previous one is still alive");
  36.                     continue;
  37.                 }
  38.             }
  39.  
  40.             if (dryRun)
  41. @@ -307,11 +307,11 @@ Trigger.prototype.StartAnEnemyWave = fun
  42.                 "queued": true,
  43.                 "targetClasses": undefined
  44.             });
  45.  
  46.             if (attackerTemplate.hero)
  47. -               this.gaiaHeroes[cmpPlayer.GetPlayerID()] = entities[0];
  48. +               this.gaiaHeroes[playerID] = entities[0];
  49.         }
  50.         spawned = true;
  51.     }
  52.  
  53.     if (!spawned)
  54. @@ -336,11 +336,14 @@ Trigger.prototype.PlaceTreasures = funct
  55.  };
  56.  
  57.  Trigger.prototype.OnOwnershipChanged = function(data)
  58.  {
  59.     if (data.entity == this.playerCivicCenter[data.from])
  60. +   {
  61. +       this.playerCivicCenter[data.from] = undefined;
  62.         TriggerHelper.DefeatPlayer(data.from);
  63. +   }
  64.     else if (data.entity == this.treasureFemale[data.from])
  65.     {
  66.         this.treasureFemale[data.from] = undefined;
  67.         Engine.DestroyEntity(data.entity);
  68.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement