Roundleave ship clean up (#653)

* cryo shuttle rework

* Update entities.ftl
This commit is contained in:
Ed
2024-12-09 20:39:56 +03:00
committed by GitHub
parent bec8d7a7d4
commit 22b0f46890
9 changed files with 117 additions and 66 deletions

View File

@@ -1,15 +1,7 @@
using System.Globalization;
using System.Linq;
using System.Numerics;
using Content.Server.Chat.Systems;
using Content.Server.Mind;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Systems;
using Content.Shared._CP14.Cargo;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Roles.Jobs;
using Robust.Shared.Map;
using Robust.Shared.Random;
@@ -17,12 +9,6 @@ namespace Content.Server._CP14.Cargo;
public sealed partial class CP14CargoSystem
{
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly SharedJobSystem _job = default!;
[Dependency] private readonly StationJobsSystem _stationJobs = default!;
private void InitializeShuttle()
{
SubscribeLocalEvent<CP14TravelingStoreShipComponent, FTLCompletedEvent>(OnFTLCompleted);
@@ -102,10 +88,6 @@ public sealed partial class CP14CargoSystem
{
station.OnStation = false;
var b = station.Balance;
PlayersPurgeJobs(ent);
SellingThings((ent.Comp.Station, station)); // +balance
TopUpBalance((ent.Comp.Station, station)); //+balance
BuyToQueue((ent.Comp.Station, station)); //-balance +buyQueue
@@ -121,44 +103,4 @@ public sealed partial class CP14CargoSystem
UpdateAllStores();
}
private void PlayersPurgeJobs(Entity<CP14TravelingStoreShipComponent> ent)
{
var childrens = Transform(ent).ChildEnumerator;
HashSet<EntityUid> toDelete = new();
while (childrens.MoveNext(out var uid))
{
if (!_mind.TryGetMind(uid, out var mindId, out var mindComp))
continue;
if (!_job.MindTryGetJob(mindId, out var jobProto))
continue;
_adminLog.Add(LogType.Action,
LogImpact.High,
$"{ToPrettyString(uid):player} was leave the round on traveling merchant ship");
_chatSystem.DispatchStationAnnouncement(ent.Comp.Station,
Loc.GetString(
"cp14-earlyleave-ship-announcement",
("character", mindComp.CharacterName ?? "Unknown"),
("entity", ent.Owner), // gender things for supporting downstreams with other languages
("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Loc.GetString(jobProto.Name)))
),
Loc.GetString("cp14-ship-sender"),
playDefaultSound: false
);
_stationJobs.TryAdjustJobSlot(ent.Comp.Station, jobProto, 1, clamp: true);
toDelete.Add(uid);
}
while (toDelete.Count > 0)
{
var r = toDelete.First();
toDelete.Remove(r);
QueueDel(r);
}
}
}