]> git.deb.at Git - rhonda/impostor.git/commitdiff
Refactor Polus meeting room spawning logic
authorminiduikboot <mini@duikbo.at>
Sun, 20 Jun 2021 19:44:18 +0000 (21:44 +0200)
committerminiduikboot <mini@duikbo.at>
Fri, 25 Jun 2021 16:46:28 +0000 (18:46 +0200)
Also adjust the constants to the new constants used in game

src/Impostor.Server/Net/Inner/Objects/ShipStatus/InnerPolusShipStatus.cs

index c7ccc2265284748db4e675a20d04032c1e3e2700..4ba0490574bb184b951fb9ca27f4e61ba4ce17fb 100644 (file)
@@ -24,9 +24,9 @@ namespace Impostor.Server.Net.Inner.Objects.ShipStatus
 
         public override Vector2 InitialSpawnCenter { get; } = new Vector2(16.64f, -2.46f);
 
-        public override Vector2 MeetingSpawnCenter { get; } = new Vector2(17.726f, -16.286f);
+        public override Vector2 MeetingSpawnCenter { get; } = new Vector2(17.4f, -16.286f);
 
-        public Vector2 MeetingSpawnCenter2 { get; } = new Vector2(-17.7f, -17.5f);
+        public Vector2 MeetingSpawnCenter2 { get; } = new Vector2(17.4f, -17.515f);
 
         public override Vector2 GetSpawnLocation(InnerPlayerControl player, int numPlayers, bool initialSpawn)
         {
@@ -35,19 +35,16 @@ namespace Impostor.Server.Net.Inner.Objects.ShipStatus
                 return base.GetSpawnLocation(player, numPlayers, initialSpawn);
             }
 
-            Vector2 position;
-            int halfPlayers = numPlayers / 2; // floored intentionally
-            int spawnId = player.PlayerId % 15;
+            var halfPlayers = numPlayers / 2; // floored intentionally
+            var spawnId = player.PlayerId % 15;
             if (player.PlayerId < halfPlayers)
             {
-                position = this.MeetingSpawnCenter + (new Vector2(0.6f, 0) * spawnId);
+                return this.MeetingSpawnCenter + (new Vector2(0.6f, 0) * spawnId);
             }
             else
             {
-                position = this.MeetingSpawnCenter2 + (new Vector2(0.6f, 0) * (spawnId - halfPlayers));
+                return this.MeetingSpawnCenter2 + (new Vector2(0.6f, 0) * (spawnId - halfPlayers));
             }
-
-            return position;
         }
 
         protected override void AddSystems(Dictionary<SystemTypes, ISystemType> systems)