Arrivals tweaks (#14773)

Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2023-03-23 12:37:43 +11:00
committed by GitHub
parent 837e92683e
commit 9932fe5c07
4 changed files with 36 additions and 28 deletions

View File

@@ -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
{
}

View File

@@ -11,6 +11,7 @@ using Content.Server.Station.Components;
using Content.Server.Station.Systems; using Content.Server.Station.Systems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Mobs.Components;
using Content.Shared.Shuttles.Components; using Content.Shared.Shuttles.Components;
using Content.Shared.Spawners.Components; using Content.Shared.Spawners.Components;
using Content.Shared.Tiles; using Content.Shared.Tiles;
@@ -141,21 +142,13 @@ public sealed class ArrivalsSystem : EntitySystem
private void OnArrivalsFTL(EntityUid uid, ArrivalsShuttleComponent component, ref FTLStartedEvent args) 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) if (!_cfgManager.GetCVar(CCVars.ArrivalsReturns) && args.FromMapUid != null)
{ {
var clockedQuery = AllEntityQuery<ClockedInComponent, TransformComponent>(); var pendingEntQuery = GetEntityQuery<PendingClockInComponent>();
var mobQuery = GetEntityQuery<MobStateComponent>();
// Clock them in when they FTL var xformQuery = GetEntityQuery<TransformComponent>();
while (clockedQuery.MoveNext(out var cUid, out _, out var xform)) DumpChildren(uid, ref args, pendingEntQuery, mobQuery, xformQuery);
{
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 pendingQuery = AllEntityQuery<PendingClockInComponent, TransformComponent>(); var pendingQuery = AllEntityQuery<PendingClockInComponent, TransformComponent>();
@@ -163,10 +156,38 @@ public sealed class ArrivalsSystem : EntitySystem
// Clock them in when they FTL // Clock them in when they FTL
while (pendingQuery.MoveNext(out var pUid, out _, out var xform)) while (pendingQuery.MoveNext(out var pUid, out _, out var xform))
{ {
// Cheaper to iterate pending arrivals than all children
if (xform.GridUid != uid) if (xform.GridUid != uid)
continue; 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);
} }
} }

View File

@@ -41,7 +41,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile, args.HumanoidCharacterProfile,
args.Station); args.Station);
EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
return; return;
} }
@@ -53,7 +52,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile, args.HumanoidCharacterProfile,
args.Station); args.Station);
EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
return; return;
} }
} }
@@ -69,7 +67,6 @@ public sealed class SpawnPointSystem : EntitySystem
args.HumanoidCharacterProfile, args.HumanoidCharacterProfile,
args.Station); args.Station);
EnsureComp<ClockedInComponent>(args.SpawnResult.Value);
return; return;
} }

View 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. - 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. - 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] - [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".) [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. - 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.