From 9932fe5c07dbf36e168f2f858775b02d3d9c9c62 Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Thu, 23 Mar 2023 12:37:43 +1100
Subject: [PATCH] Arrivals tweaks (#14773)
Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
---
.../Shuttles/Components/ClockedInComponent.cs | 11 -----
.../Shuttles/Systems/ArrivalsSystem.cs | 49 +++++++++++++------
.../EntitySystems/SpawnPointSystem.cs | 3 --
Resources/Server Info/Rules.txt | 1 +
4 files changed, 36 insertions(+), 28 deletions(-)
delete mode 100644 Content.Server/Shuttles/Components/ClockedInComponent.cs
diff --git a/Content.Server/Shuttles/Components/ClockedInComponent.cs b/Content.Server/Shuttles/Components/ClockedInComponent.cs
deleted file mode 100644
index 5415b72b14..0000000000
--- a/Content.Server/Shuttles/Components/ClockedInComponent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Content.Server.Shuttles.Components;
-
-///
-/// Added to players after having been spawned onto the station.
-/// Prevents them from taking the arrivals shuttle.
-///
-[RegisterComponent]
-public sealed class ClockedInComponent : Component
-{
-
-}
diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
index 97bf75b673..7f6c8057c4 100644
--- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
+++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs
@@ -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();
-
- // 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();
+ var mobQuery = GetEntityQuery();
+ var xformQuery = GetEntityQuery();
+ DumpChildren(uid, ref args, pendingEntQuery, mobQuery, xformQuery);
}
var pendingQuery = AllEntityQuery();
@@ -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(pUid);
+ RemCompDeferred(pUid);
+ }
+ }
+
+ private void DumpChildren(EntityUid uid,
+ ref FTLStartedEvent args,
+ EntityQuery pendingEntQuery,
+ EntityQuery mobQuery,
+ EntityQuery 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);
}
}
diff --git a/Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs b/Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
index 60388bded2..13753461af 100644
--- a/Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
+++ b/Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
@@ -41,7 +41,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile,
args.Station);
- EnsureComp(args.SpawnResult.Value);
return;
}
@@ -53,7 +52,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile,
args.Station);
- EnsureComp(args.SpawnResult.Value);
return;
}
}
@@ -69,7 +67,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile,
args.Station);
- EnsureComp(args.SpawnResult.Value);
return;
}
diff --git a/Resources/Server Info/Rules.txt b/Resources/Server Info/Rules.txt
index a46269b96c..3075ace175 100644
--- a/Resources/Server Info/Rules.txt
+++ b/Resources/Server Info/Rules.txt
@@ -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.
--
2.52.0