cargo system cleanup (#13396)
This commit is contained in:
@@ -7,6 +7,8 @@ namespace Content.Client.Cargo.Systems;
|
||||
|
||||
public sealed partial class CargoSystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
private static readonly Animation CargoTelepadBeamAnimation = new()
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(0.5),
|
||||
@@ -65,7 +67,7 @@ public sealed partial class CargoSystem
|
||||
if (!Resolve(component.Owner, ref sprite))
|
||||
return;
|
||||
|
||||
component.TryGetData(CargoTelepadVisuals.State, out CargoTelepadState? state);
|
||||
_appearance.TryGetData(component.Owner, CargoTelepadVisuals.State, out CargoTelepadState? state);
|
||||
AnimationPlayerComponent? player = null;
|
||||
|
||||
switch (state)
|
||||
|
||||
@@ -159,9 +159,7 @@ namespace Content.Server.Cargo.Systems
|
||||
|
||||
_idCardSystem.TryFindIdCard(player, out var idCard);
|
||||
order.SetApproverData(idCard);
|
||||
|
||||
|
||||
SoundSystem.Play(component.ConfirmSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid);
|
||||
_audio.PlayPvs(_audio.GetSound(component.ConfirmSound), uid);
|
||||
|
||||
// Log order approval
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||
@@ -233,7 +231,7 @@ namespace Content.Server.Cargo.Systems
|
||||
|
||||
private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component)
|
||||
{
|
||||
SoundSystem.Play(component.ErrorSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid);
|
||||
_audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid);
|
||||
}
|
||||
|
||||
private CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, int index)
|
||||
|
||||
@@ -288,13 +288,18 @@ public sealed partial class CargoSystem
|
||||
var possibleNames = _protoMan.Index<DatasetPrototype>(prototype.NameDataset).Values;
|
||||
var name = _random.Pick(possibleNames);
|
||||
|
||||
var shuttleUid = _map.LoadGrid(CargoMap.Value, prototype.Path.ToString());
|
||||
var xform = Transform(shuttleUid!.Value);
|
||||
MetaData(shuttleUid!.Value).EntityName = name;
|
||||
if (!_map.TryLoad(CargoMap.Value, prototype.Path.ToString(), out var gridList) || gridList == null)
|
||||
{
|
||||
_sawmill.Error($"Could not load the cargo shuttle!");
|
||||
return;
|
||||
}
|
||||
var shuttleUid = gridList[0];
|
||||
var xform = Transform(shuttleUid);
|
||||
MetaData(shuttleUid).EntityName = name;
|
||||
|
||||
// TODO: Something better like a bounds check.
|
||||
xform.LocalPosition += 100 * _index;
|
||||
var comp = EnsureComp<CargoShuttleComponent>(shuttleUid!.Value);
|
||||
var comp = EnsureComp<CargoShuttleComponent>(shuttleUid);
|
||||
comp.Station = component.Owner;
|
||||
comp.Coordinates = xform.Coordinates;
|
||||
|
||||
@@ -302,7 +307,7 @@ public sealed partial class CargoSystem
|
||||
comp.NextCall = _timing.CurTime + TimeSpan.FromSeconds(comp.Cooldown);
|
||||
UpdateShuttleCargoConsoles(comp);
|
||||
_index++;
|
||||
_sawmill.Info($"Added cargo shuttle to {ToPrettyString(shuttleUid!.Value)}");
|
||||
_sawmill.Info($"Added cargo shuttle to {ToPrettyString(shuttleUid)}");
|
||||
}
|
||||
|
||||
private void SellPallets(CargoShuttleComponent component, StationBankAccountComponent bank)
|
||||
@@ -512,7 +517,7 @@ public sealed partial class CargoSystem
|
||||
if (IsBlocked(shuttle))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("cargo-shuttle-console-organics"), player.Value, player.Value);
|
||||
SoundSystem.Play(component.DenySound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid);
|
||||
_audio.PlayPvs(_audio.GetSound(component.DenySound), uid);
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.Cargo.Components;
|
||||
using Content.Server.Labels.Components;
|
||||
using Content.Server.Paper;
|
||||
@@ -13,6 +14,7 @@ namespace Content.Server.Cargo.Systems;
|
||||
public sealed partial class CargoSystem
|
||||
{
|
||||
[Dependency] private readonly PaperSystem _paperSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
private void InitializeTelepad()
|
||||
{
|
||||
@@ -32,7 +34,7 @@ public sealed partial class CargoSystem
|
||||
if (comp.CurrentState == CargoTelepadState.Unpowered)
|
||||
{
|
||||
comp.CurrentState = CargoTelepadState.Idle;
|
||||
appearance?.SetData(CargoTelepadVisuals.State, CargoTelepadState.Idle);
|
||||
_appearance.SetData(comp.Owner, CargoTelepadVisuals.State, CargoTelepadState.Idle, appearance);
|
||||
comp.Accumulator = comp.Delay;
|
||||
continue;
|
||||
}
|
||||
@@ -43,7 +45,7 @@ public sealed partial class CargoSystem
|
||||
if (comp.Accumulator > 0f)
|
||||
{
|
||||
comp.CurrentState = CargoTelepadState.Idle;
|
||||
appearance?.SetData(CargoTelepadVisuals.State, CargoTelepadState.Idle);
|
||||
_appearance.SetData(comp.Owner, CargoTelepadVisuals.State, CargoTelepadState.Idle, appearance);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -78,12 +80,12 @@ public sealed partial class CargoSystem
|
||||
if (order.Amount <= 0)
|
||||
orderDatabase.Orders.Remove(index);
|
||||
|
||||
SoundSystem.Play(comp.TeleportSound.GetSound(), Filter.Pvs(comp.Owner), comp.Owner, AudioParams.Default.WithVolume(-8f));
|
||||
_audio.PlayPvs(_audio.GetSound(comp.TeleportSound), comp.Owner, AudioParams.Default.WithVolume(-8f));
|
||||
SpawnProduct(comp, order);
|
||||
UpdateOrders(orderDatabase);
|
||||
|
||||
comp.CurrentState = CargoTelepadState.Teleporting;
|
||||
appearance?.SetData(CargoTelepadVisuals.State, CargoTelepadState.Teleporting);
|
||||
_appearance.SetData(comp.Owner, CargoTelepadVisuals.State, CargoTelepadState.Teleporting, appearance);
|
||||
comp.Accumulator += comp.Delay;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +108,7 @@ public sealed partial class CargoSystem
|
||||
|
||||
TryComp<AppearanceComponent>(component.Owner, out var appearance);
|
||||
component.CurrentState = CargoTelepadState.Unpowered;
|
||||
appearance?.SetData(CargoTelepadVisuals.State, CargoTelepadState.Unpowered);
|
||||
_appearance.SetData(component.Owner, CargoTelepadVisuals.State, CargoTelepadState.Unpowered, appearance);
|
||||
}
|
||||
|
||||
private void OnTelepadPowerChange(EntityUid uid, CargoTelepadComponent component, ref PowerChangedEvent args)
|
||||
|
||||
@@ -11,6 +11,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly ItemSlotsSystem _slots = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
@@ -45,8 +46,8 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
||||
}
|
||||
|
||||
// please don't delete this thank you
|
||||
public void UpdateBankAccount(StationBankAccountComponent component, int BalanceAdded)
|
||||
public void UpdateBankAccount(StationBankAccountComponent component, int balanceAdded)
|
||||
{
|
||||
component.Balance += BalanceAdded;
|
||||
component.Balance += balanceAdded;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user