]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Arrivals tweaks (#14773)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Thu, 23 Mar 2023 01:37:43 +0000 (12:37 +1100)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2023 01:37:43 +0000 (12:37 +1100)
Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
Content.Server/Shuttles/Components/ClockedInComponent.cs [deleted file]
Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
Resources/Server Info/Rules.txt

diff --git a/Content.Server/Shuttles/Components/ClockedInComponent.cs b/Content.Server/Shuttles/Components/ClockedInComponent.cs
deleted file mode 100644 (file)
index 5415b72..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Content.Server.Shuttles.Components;
-
-/// <summary>
-/// Added to players after having been spawned onto the station.
-/// Prevents them from taking the arrivals shuttle.
-/// </summary>
-[RegisterComponent]
-public sealed class ClockedInComponent : Component
-{
-
-}
index 97bf75b6738bcb4805e4d07068b64d50b6db84f1..7f6c8057c457a391571c2068845a42a24103d780 100644 (file)
@@ -11,6 +11,7 @@ using Content.Server.Station.Components;
 using Content.Server.Station.Systems;
 using Content.Shared.Administration;
 using Content.Shared.CCVar;
+using Content.Shared.Mobs.Components;
 using Content.Shared.Shuttles.Components;
 using Content.Shared.Spawners.Components;
 using Content.Shared.Tiles;
@@ -141,21 +142,13 @@ public sealed class ArrivalsSystem : EntitySystem
 
     private void OnArrivalsFTL(EntityUid uid, ArrivalsShuttleComponent component, ref FTLStartedEvent args)
     {
-        // Anyone already clocked in yeet them off the shuttle.
+        // Any mob then yeet them off the shuttle.
         if (!_cfgManager.GetCVar(CCVars.ArrivalsReturns) && args.FromMapUid != null)
         {
-            var clockedQuery = AllEntityQuery<ClockedInComponent, TransformComponent>();
-
-            // Clock them in when they FTL
-            while (clockedQuery.MoveNext(out var cUid, out _, out var xform))
-            {
-                if (xform.GridUid != uid)
-                    continue;
-
-                var rotation = xform.LocalRotation;
-                _transform.SetCoordinates(cUid, new EntityCoordinates(args.FromMapUid.Value, args.FTLFrom.Transform(xform.LocalPosition)));
-                _transform.SetWorldRotation(cUid, args.FromRotation + rotation);
-            }
+            var pendingEntQuery = GetEntityQuery<PendingClockInComponent>();
+            var mobQuery = GetEntityQuery<MobStateComponent>();
+            var xformQuery = GetEntityQuery<TransformComponent>();
+            DumpChildren(uid, ref args, pendingEntQuery, mobQuery, xformQuery);
         }
 
         var pendingQuery = AllEntityQuery<PendingClockInComponent, TransformComponent>();
@@ -163,10 +156,38 @@ public sealed class ArrivalsSystem : EntitySystem
         // Clock them in when they FTL
         while (pendingQuery.MoveNext(out var pUid, out _, out var xform))
         {
+            // Cheaper to iterate pending arrivals than all children
             if (xform.GridUid != uid)
                 continue;
 
-            EnsureComp<ClockedInComponent>(pUid);
+            RemCompDeferred<PendingClockInComponent>(pUid);
+        }
+    }
+
+    private void DumpChildren(EntityUid uid,
+        ref FTLStartedEvent args,
+        EntityQuery<PendingClockInComponent> pendingEntQuery,
+        EntityQuery<MobStateComponent> mobQuery,
+        EntityQuery<TransformComponent> xformQuery)
+    {
+        if (pendingEntQuery.HasComponent(uid))
+            return;
+
+        var xform = xformQuery.GetComponent(uid);
+
+        if (mobQuery.HasComponent(uid))
+        {
+            var rotation = xform.LocalRotation;
+            _transform.SetCoordinates(uid, new EntityCoordinates(args.FromMapUid!.Value, args.FTLFrom.Transform(xform.LocalPosition)));
+            _transform.SetWorldRotation(uid, args.FromRotation + rotation);
+            return;
+        }
+
+        var children = xform.ChildEnumerator;
+
+        while (children.MoveNext(out var child))
+        {
+            DumpChildren(child.Value, ref args, pendingEntQuery, mobQuery, xformQuery);
         }
     }
 
index 60388bded2d3ad99f21e5cf3991af5033ad0dc35..13753461afb5c0a9f89cca5980d8932ab27e4ba9 100644 (file)
@@ -41,7 +41,6 @@ public sealed class SpawnPointSystem : EntitySystem
                     args.HumanoidCharacterProfile,
                     args.Station);
 
-                EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
                 return;
             }
 
@@ -53,7 +52,6 @@ public sealed class SpawnPointSystem : EntitySystem
                     args.HumanoidCharacterProfile,
                     args.Station);
 
-                EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
                 return;
             }
         }
@@ -69,7 +67,6 @@ public sealed class SpawnPointSystem : EntitySystem
                 args.HumanoidCharacterProfile,
                 args.Station);
 
-            EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
             return;
         }
 
index a46269b96c57742221cf36a98bd6e79ea9ffe2b1..3075ace17501a07a3af9b950521f8ac6c3fbaf72 100644 (file)
@@ -37,6 +37,7 @@ This is the "short" form of the rules, which has all the information any regular
     - Do not intentionally make other players' lives hell for your own amusement.
     - Antagonists have lots of leeway with this rule and may kill/sabotage as they see fit, but if it degrades the experience for majority of the rest of the server you will be told to stop.
     - [color=#ff0000]THE ROUND IS NOT OVER UNTIL THE END-ROUND SUMMARY APPEARS. KILLING SOMEONE FOR NO REASON BEFORE THIS WILL BE HANDLED ACCORDINGLY.[/color]
+    - Do not grief / spawnkill players on the arrivals station, arrivals shuttle, or other newly spawned areas. This applies if you are an antagonist.
 
 [color=#a4885c]12.[/color] Don't harass or target players across rounds for actions in prior rounds or for actions outside of the game (this is referred to as "Metagrudging".)
     - Annoying players for IC reasons in the current round is fine; doing it across rounds or as a ghost role after they kill you is not.