cargo system cleanup (#13396)
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user