[Tweak] Торговая станция карго вынесена на отдельную карту (#391)
* feat: торговая станция вынесена на отдельную карту * tweak: отключить случайный поворот и офсет станции
This commit is contained in:
@@ -57,7 +57,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_audio.PlayPvs(component.ConfirmSound, uid);
|
_audio.PlayPvs(component.ConfirmSound, uid);
|
||||||
UpdateBankAccount(stationUid.Value, bank, (int) price);
|
UpdateBankAccount(stationUid.Value, bank, (int)price);
|
||||||
QueueDel(args.Used);
|
QueueDel(args.Used);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,8 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
#region Interface
|
#region Interface
|
||||||
|
|
||||||
private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleApproveOrderMessage args)
|
private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component,
|
||||||
|
CargoConsoleApproveOrderMessage args)
|
||||||
{
|
{
|
||||||
if (args.Session.AttachedEntity is not { Valid: true } player)
|
if (args.Session.AttachedEntity is not { Valid: true } player)
|
||||||
return;
|
return;
|
||||||
@@ -184,7 +185,9 @@ namespace Content.Server.Cargo.Systems
|
|||||||
order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle);
|
order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle);
|
||||||
_audio.PlayPvs(component.ConfirmSound, uid);
|
_audio.PlayPvs(component.ConfirmSound, uid);
|
||||||
|
|
||||||
ConsolePopup(args.Session, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(tradeDestination.Value).EntityName)));
|
ConsolePopup(args.Session,
|
||||||
|
Loc.GetString("cargo-console-trade-station",
|
||||||
|
("destination", MetaData(tradeDestination.Value).EntityName)));
|
||||||
|
|
||||||
// Log order approval
|
// Log order approval
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
@@ -195,7 +198,8 @@ namespace Content.Server.Cargo.Systems
|
|||||||
UpdateOrders(station.Value, orderDatabase);
|
UpdateOrders(station.Value, orderDatabase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityUid? TryFulfillOrder(StationDataComponent stationData, CargoOrderData order, StationCargoOrderDatabaseComponent orderDatabase)
|
private EntityUid? TryFulfillOrder(StationDataComponent stationData, CargoOrderData order,
|
||||||
|
StationCargoOrderDatabaseComponent orderDatabase)
|
||||||
{
|
{
|
||||||
// No slots at the trade station
|
// No slots at the trade station
|
||||||
_listEnts.Clear();
|
_listEnts.Clear();
|
||||||
@@ -219,7 +223,8 @@ namespace Content.Server.Cargo.Systems
|
|||||||
{
|
{
|
||||||
tradeDestination = trade;
|
tradeDestination = trade;
|
||||||
order.NumDispatched++;
|
order.NumDispatched++;
|
||||||
if (order.OrderQuantity <= order.NumDispatched) //Spawn a crate on free pellets until the order is fulfilled.
|
if (order.OrderQuantity <=
|
||||||
|
order.NumDispatched) //Spawn a crate on free pellets until the order is fulfilled.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,16 +239,15 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
private void GetTradeStations(StationDataComponent data, ref List<EntityUid> ents)
|
private void GetTradeStations(StationDataComponent data, ref List<EntityUid> ents)
|
||||||
{
|
{
|
||||||
foreach (var gridUid in data.Grids)
|
var tradeStationQuery = AllEntityQuery<TradeStationComponent>();
|
||||||
|
while (tradeStationQuery.MoveNext(out var uid, out _))
|
||||||
{
|
{
|
||||||
if (!_tradeQuery.HasComponent(gridUid))
|
ents.Add(uid);
|
||||||
continue;
|
|
||||||
|
|
||||||
ents.Add(gridUid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleRemoveOrderMessage args)
|
private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component,
|
||||||
|
CargoConsoleRemoveOrderMessage args)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
|
|
||||||
@@ -253,7 +257,8 @@ namespace Content.Server.Cargo.Systems
|
|||||||
RemoveOrder(station.Value, args.OrderId, orderDatabase);
|
RemoveOrder(station.Value, args.OrderId, orderDatabase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
|
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component,
|
||||||
|
CargoConsoleAddOrderMessage args)
|
||||||
{
|
{
|
||||||
if (args.Session.AttachedEntity is not { Valid: true } player)
|
if (args.Session.AttachedEntity is not { Valid: true } player)
|
||||||
return;
|
return;
|
||||||
@@ -286,7 +291,6 @@ namespace Content.Server.Cargo.Systems
|
|||||||
// Log order addition
|
// Log order addition
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
$"{ToPrettyString(player):user} added order [orderId:{data.OrderId}, quantity:{data.OrderQuantity}, product:{data.ProductId}, requester:{data.Requester}, reason:{data.Reason}]");
|
$"{ToPrettyString(player):user} added order [orderId:{data.OrderId}, quantity:{data.OrderQuantity}, product:{data.ProductId}, requester:{data.Requester}, reason:{data.Reason}]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnOrderUIOpened(EntityUid uid, CargoOrderConsoleComponent component, BoundUIOpenedEvent args)
|
private void OnOrderUIOpened(EntityUid uid, CargoOrderConsoleComponent component, BoundUIOpenedEvent args)
|
||||||
@@ -325,9 +329,11 @@ namespace Content.Server.Cargo.Systems
|
|||||||
_audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid);
|
_audio.PlayPvs(_audio.GetSound(component.ErrorSound), uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct, int id)
|
private static CargoOrderData GetOrderData(CargoConsoleAddOrderMessage args, CargoProductPrototype cargoProduct,
|
||||||
|
int id)
|
||||||
{
|
{
|
||||||
return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Cost, args.Amount, args.Requester, args.Reason);
|
return new CargoOrderData(id, cargoProduct.Product, cargoProduct.Cost, args.Amount, args.Requester,
|
||||||
|
args.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component)
|
public static int GetOutstandingOrderCount(StationCargoOrderDatabaseComponent component)
|
||||||
@@ -422,6 +428,7 @@ namespace Content.Server.Cargo.Systems
|
|||||||
{
|
{
|
||||||
orderDB.Orders.RemoveAt(sequenceIdx);
|
orderDB.Orders.RemoveAt(sequenceIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateOrders(dbUid, orderDB);
|
UpdateOrders(dbUid, orderDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +440,8 @@ namespace Content.Server.Cargo.Systems
|
|||||||
component.Orders.Clear();
|
component.Orders.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB, [NotNullWhen(true)] out CargoOrderData? orderOut)
|
private static bool PopFrontOrder(StationCargoOrderDatabaseComponent orderDB,
|
||||||
|
[NotNullWhen(true)] out CargoOrderData? orderOut)
|
||||||
{
|
{
|
||||||
var orderIdx = orderDB.Orders.FindIndex(order => order.Approved);
|
var orderIdx = orderDB.Orders.FindIndex(order => order.Approved);
|
||||||
if (orderIdx == -1)
|
if (orderIdx == -1)
|
||||||
@@ -450,13 +458,15 @@ namespace Content.Server.Cargo.Systems
|
|||||||
// Order is complete. Remove from the queue.
|
// Order is complete. Remove from the queue.
|
||||||
orderDB.Orders.RemoveAt(orderIdx);
|
orderDB.Orders.RemoveAt(orderIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to fulfill the next outstanding order.
|
/// Tries to fulfill the next outstanding order.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, string? paperProto)
|
private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn,
|
||||||
|
string? paperProto)
|
||||||
{
|
{
|
||||||
if (!PopFrontOrder(orderDB, out var order))
|
if (!PopFrontOrder(orderDB, out var order))
|
||||||
return false;
|
return false;
|
||||||
@@ -497,7 +507,6 @@ namespace Content.Server.Cargo.Systems
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeductFunds(StationBankAccountComponent component, int amount)
|
private void DeductFunds(StationBankAccountComponent component, int amount)
|
||||||
@@ -507,11 +516,12 @@ namespace Content.Server.Cargo.Systems
|
|||||||
|
|
||||||
#region Station
|
#region Station
|
||||||
|
|
||||||
private bool TryGetOrderDatabase([NotNullWhen(true)] EntityUid? stationUid, [MaybeNullWhen(false)] out StationCargoOrderDatabaseComponent dbComp)
|
private bool TryGetOrderDatabase([NotNullWhen(true)] EntityUid? stationUid,
|
||||||
|
[MaybeNullWhen(false)] out StationCargoOrderDatabaseComponent dbComp)
|
||||||
{
|
{
|
||||||
return TryComp(stationUid, out dbComp);
|
return TryComp(stationUid, out dbComp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
using Content.Server.Cargo.Components;
|
using Content.Server.Cargo.Components;
|
||||||
|
using Content.Server.GameTicking;
|
||||||
|
using Content.Server.Station.Systems;
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Cargo;
|
using Content.Shared.Cargo;
|
||||||
using Content.Shared.Cargo.BUI;
|
using Content.Shared.Cargo.BUI;
|
||||||
using Content.Shared.Cargo.Components;
|
using Content.Shared.Cargo.Components;
|
||||||
using Content.Shared.Cargo.Events;
|
using Content.Shared.Cargo.Events;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
|
using Content.Shared.Shuttles.Components;
|
||||||
|
using Content.Shared.Whitelist;
|
||||||
|
using Robust.Server.Maps;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Random;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Cargo.Systems;
|
namespace Content.Server.Cargo.Systems;
|
||||||
@@ -16,9 +21,12 @@ public sealed partial class CargoSystem
|
|||||||
/*
|
/*
|
||||||
* Handles cargo shuttle / trade mechanics.
|
* Handles cargo shuttle / trade mechanics.
|
||||||
*/
|
*/
|
||||||
|
private MapId? TradeStationMap { get; set; }
|
||||||
|
|
||||||
private static readonly SoundPathSpecifier ApproveSound = new("/Audio/Effects/Cargo/ping.ogg");
|
private static readonly SoundPathSpecifier ApproveSound = new("/Audio/Effects/Cargo/ping.ogg");
|
||||||
|
|
||||||
|
private const string TradeStationMapPath = "/Maps/Shuttles/trading_outpost.yml";
|
||||||
|
|
||||||
private void InitializeShuttle()
|
private void InitializeShuttle()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<TradeStationComponent, GridSplitEvent>(OnTradeSplit);
|
SubscribeLocalEvent<TradeStationComponent, GridSplitEvent>(OnTradeSplit);
|
||||||
@@ -30,6 +38,17 @@ public sealed partial class CargoSystem
|
|||||||
SubscribeLocalEvent<CargoPalletConsoleComponent, BoundUIOpenedEvent>(OnPalletUIOpen);
|
SubscribeLocalEvent<CargoPalletConsoleComponent, BoundUIOpenedEvent>(OnPalletUIOpen);
|
||||||
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
||||||
|
SubscribeLocalEvent<StationInitializedEvent>(OnStationInitialize);
|
||||||
|
|
||||||
|
Subs.CVar(_cfgManager, CCVars.GridFill, SetGridFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetGridFill(bool obj)
|
||||||
|
{
|
||||||
|
if (obj && _ticker.RunLevel != GameRunLevel.PreRoundLobby) // Ensure run level is in game
|
||||||
|
{
|
||||||
|
SetupTradeStation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Console
|
#region Console
|
||||||
@@ -58,12 +77,13 @@ public sealed partial class CargoSystem
|
|||||||
if (Transform(uid).GridUid is not EntityUid gridUid)
|
if (Transform(uid).GridUid is not EntityUid gridUid)
|
||||||
{
|
{
|
||||||
_uiSystem.SetUiState(bui,
|
_uiSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState(0, 0, false));
|
new CargoPalletConsoleInterfaceState(0, 0, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPalletGoods(gridUid, out var toSell, out var amount);
|
GetPalletGoods(gridUid, out var toSell, out var amount);
|
||||||
_uiSystem.SetUiState(bui,
|
_uiSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true));
|
new CargoPalletConsoleInterfaceState((int)amount, toSell.Count, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPalletUIOpen(EntityUid uid, CargoPalletConsoleComponent component, BoundUIOpenedEvent args)
|
private void OnPalletUIOpen(EntityUid uid, CargoPalletConsoleComponent component, BoundUIOpenedEvent args)
|
||||||
@@ -83,7 +103,6 @@ public sealed partial class CargoSystem
|
|||||||
/// I dont want it to explode if cargo uses a conveyor to move 8000 pineapple slices or whatever, they are
|
/// I dont want it to explode if cargo uses a conveyor to move 8000 pineapple slices or whatever, they are
|
||||||
/// known for their entity spam i wouldnt put it past them
|
/// known for their entity spam i wouldnt put it past them
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
private void OnPalletAppraise(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletAppraiseMessage args)
|
private void OnPalletAppraise(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletAppraiseMessage args)
|
||||||
{
|
{
|
||||||
var player = args.Session.AttachedEntity;
|
var player = args.Session.AttachedEntity;
|
||||||
@@ -94,7 +113,8 @@ public sealed partial class CargoSystem
|
|||||||
UpdatePalletConsoleInterface(uid);
|
UpdatePalletConsoleInterface(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCargoShuttleConsoleStartup(EntityUid uid, CargoShuttleConsoleComponent component, ComponentStartup args)
|
private void OnCargoShuttleConsoleStartup(EntityUid uid, CargoShuttleConsoleComponent component,
|
||||||
|
ComponentStartup args)
|
||||||
{
|
{
|
||||||
var station = _station.GetOwningStation(uid);
|
var station = _station.GetOwningStation(uid);
|
||||||
UpdateShuttleState(uid, station);
|
UpdateShuttleState(uid, station);
|
||||||
@@ -106,12 +126,18 @@ public sealed partial class CargoSystem
|
|||||||
TryComp<CargoShuttleComponent>(orderDatabase?.Shuttle, out var shuttle);
|
TryComp<CargoShuttleComponent>(orderDatabase?.Shuttle, out var shuttle);
|
||||||
|
|
||||||
var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle);
|
var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle);
|
||||||
var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty;
|
var shuttleName = orderDatabase?.Shuttle != null
|
||||||
|
? MetaData(orderDatabase.Shuttle.Value).EntityName
|
||||||
|
: string.Empty;
|
||||||
|
|
||||||
if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui))
|
if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui))
|
||||||
_uiSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState(
|
_uiSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState(
|
||||||
station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"),
|
station != null
|
||||||
string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName,
|
? MetaData(station.Value).EntityName
|
||||||
|
: Loc.GetString("cargo-shuttle-console-station-unknown"),
|
||||||
|
string.IsNullOrEmpty(shuttleName)
|
||||||
|
? Loc.GetString("cargo-shuttle-console-shuttle-not-found")
|
||||||
|
: shuttleName,
|
||||||
orders
|
orders
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -154,13 +180,14 @@ public sealed partial class CargoSystem
|
|||||||
// We won't be able to fit the whole order on, so make one
|
// We won't be able to fit the whole order on, so make one
|
||||||
// which represents the space we do have left:
|
// which represents the space we do have left:
|
||||||
var reducedOrder = new CargoOrderData(order.OrderId,
|
var reducedOrder = new CargoOrderData(order.OrderId,
|
||||||
order.ProductId, order.Price, spaceRemaining, order.Requester, order.Reason);
|
order.ProductId, order.Price, spaceRemaining, order.Requester, order.Reason);
|
||||||
orders.Add(reducedOrder);
|
orders.Add(reducedOrder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
orders.Add(order);
|
orders.Add(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
spaceRemaining -= numToShip;
|
spaceRemaining -= numToShip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +206,8 @@ public sealed partial class CargoSystem
|
|||||||
|
|
||||||
/// GetCargoPallets(gridUid, BuySellType.Sell) to return only Sell pads
|
/// GetCargoPallets(gridUid, BuySellType.Sell) to return only Sell pads
|
||||||
/// GetCargoPallets(gridUid, BuySellType.Buy) to return only Buy pads
|
/// GetCargoPallets(gridUid, BuySellType.Buy) to return only Buy pads
|
||||||
private List<(EntityUid Entity, CargoPalletComponent Component, TransformComponent PalletXform)> GetCargoPallets(EntityUid gridUid, BuySellType requestType = BuySellType.All)
|
private List<(EntityUid Entity, CargoPalletComponent Component, TransformComponent PalletXform)> GetCargoPallets(
|
||||||
|
EntityUid gridUid, BuySellType requestType = BuySellType.All)
|
||||||
{
|
{
|
||||||
_pads.Clear();
|
_pads.Clear();
|
||||||
|
|
||||||
@@ -199,7 +227,6 @@ public sealed partial class CargoSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
_pads.Add((uid, comp, compXform));
|
_pads.Add((uid, comp, compXform));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _pads;
|
return _pads;
|
||||||
@@ -215,7 +242,8 @@ public sealed partial class CargoSystem
|
|||||||
|
|
||||||
foreach (var pallet in pallets)
|
foreach (var pallet in pallets)
|
||||||
{
|
{
|
||||||
var aabb = _lookup.GetAABBNoContainer(pallet.Entity, pallet.Transform.LocalPosition, pallet.Transform.LocalRotation);
|
var aabb = _lookup.GetAABBNoContainer(pallet.Entity, pallet.Transform.LocalPosition,
|
||||||
|
pallet.Transform.LocalRotation);
|
||||||
|
|
||||||
if (_lookup.AnyLocalEntitiesIntersecting(gridUid, aabb, LookupFlags.Dynamic))
|
if (_lookup.AnyLocalEntitiesIntersecting(gridUid, aabb, LookupFlags.Dynamic))
|
||||||
continue;
|
continue;
|
||||||
@@ -325,7 +353,7 @@ public sealed partial class CargoSystem
|
|||||||
if (xform.GridUid is not EntityUid gridUid)
|
if (xform.GridUid is not EntityUid gridUid)
|
||||||
{
|
{
|
||||||
_uiSystem.SetUiState(bui,
|
_uiSystem.SetUiState(bui,
|
||||||
new CargoPalletConsoleInterfaceState(0, 0, false));
|
new CargoPalletConsoleInterfaceState(0, 0, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +361,7 @@ public sealed partial class CargoSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var stackPrototype = _protoMan.Index<StackPrototype>(component.CashType);
|
var stackPrototype = _protoMan.Index<StackPrototype>(component.CashType);
|
||||||
_stack.Spawn((int) price, stackPrototype, xform.Coordinates);
|
_stack.Spawn((int)price, stackPrototype, xform.Coordinates);
|
||||||
_audio.PlayPvs(ApproveSound, uid);
|
_audio.PlayPvs(ApproveSound, uid);
|
||||||
UpdatePalletConsoleInterface(uid);
|
UpdatePalletConsoleInterface(uid);
|
||||||
}
|
}
|
||||||
@@ -343,6 +371,64 @@ public sealed partial class CargoSystem
|
|||||||
private void OnRoundRestart(RoundRestartCleanupEvent ev)
|
private void OnRoundRestart(RoundRestartCleanupEvent ev)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
CleanupTradeStation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStationInitialize(StationInitializedEvent args)
|
||||||
|
{
|
||||||
|
if (!HasComp<StationCargoOrderDatabaseComponent>(args.Station))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_cfgManager.GetCVar(CCVars.GridFill))
|
||||||
|
SetupTradeStation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupTradeStation()
|
||||||
|
{
|
||||||
|
if (TradeStationMap.HasValue && _mapManager.MapExists(TradeStationMap.Value))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TradeStationMap = _mapManager.CreateMap();
|
||||||
|
|
||||||
|
var loadOptions = new MapLoadOptions
|
||||||
|
{
|
||||||
|
LoadMap = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_mapLoader.TryLoad(TradeStationMap.Value, TradeStationMapPath, out _, loadOptions))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var mapUid = _mapManager.GetMapEntityId(TradeStationMap.Value);
|
||||||
|
var ftl = EnsureComp<FTLDestinationComponent>(mapUid);
|
||||||
|
ftl.Whitelist = new EntityWhitelist
|
||||||
|
{
|
||||||
|
Components =
|
||||||
|
[
|
||||||
|
_factory.GetComponentName(typeof(CargoShuttleComponent))
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
_metaSystem.SetEntityName(mapUid, $"Торговая Станция {_random.Next(1000):000}");
|
||||||
|
_console.RefreshShuttleConsoles();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CleanupTradeStation()
|
||||||
|
{
|
||||||
|
if (!TradeStationMap.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mapManager.MapExists(TradeStationMap.Value))
|
||||||
|
{
|
||||||
|
_mapManager.DeleteMap(TradeStationMap.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
TradeStationMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,4 +437,4 @@ public sealed partial class CargoSystem
|
|||||||
/// deleted but after the price has been calculated.
|
/// deleted but after the price has been calculated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ByRefEvent]
|
[ByRefEvent]
|
||||||
public readonly record struct EntitySoldEvent(HashSet<EntityUid> Sold);
|
public readonly record struct EntitySoldEvent(HashSet<EntityUid> Sold);
|
||||||
@@ -7,6 +7,7 @@ using Content.Server.Shuttles.Systems;
|
|||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Server._White.Economy;
|
using Content.Server._White.Economy;
|
||||||
|
using Content.Server.GameTicking;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Cargo;
|
using Content.Shared.Cargo;
|
||||||
@@ -16,6 +17,8 @@ using Content.Shared.Mobs.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -44,6 +47,11 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
|||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||||
[Dependency] private readonly BankCardSystem _bankCard = default!; // WD
|
[Dependency] private readonly BankCardSystem _bankCard = default!; // WD
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfgManager = default!; // WD
|
||||||
|
[Dependency] private readonly IMapManager _mapManager = default!; // WD
|
||||||
|
[Dependency] private readonly IComponentFactory _factory = default!; // WD
|
||||||
|
[Dependency] private readonly MapLoaderSystem _mapLoader = default!; // WD
|
||||||
|
[Dependency] private readonly GameTicker _ticker = default!; // WD
|
||||||
|
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
private EntityQuery<CargoSellBlacklistComponent> _blacklistQuery;
|
private EntityQuery<CargoSellBlacklistComponent> _blacklistQuery;
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ namespace Content.Shared.CCVar
|
|||||||
/// Whether a random position offset will be applied to the station on roundstart.
|
/// Whether a random position offset will be applied to the station on roundstart.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<bool> StationOffset =
|
public static readonly CVarDef<bool> StationOffset =
|
||||||
CVarDef.Create("game.station_offset", true);
|
CVarDef.Create("game.station_offset", false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When the default blueprint is loaded what is the maximum amount it can be offset from 0,0.
|
/// When the default blueprint is loaded what is the maximum amount it can be offset from 0,0.
|
||||||
@@ -246,7 +246,7 @@ namespace Content.Shared.CCVar
|
|||||||
/// Whether a random rotation will be applied to the station on roundstart.
|
/// Whether a random rotation will be applied to the station on roundstart.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<bool> StationRotation =
|
public static readonly CVarDef<bool> StationRotation =
|
||||||
CVarDef.Create("game.station_rotation", true);
|
CVarDef.Create("game.station_rotation", false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When enabled, guests will be assigned permanent UIDs and will have their preferences stored.
|
/// When enabled, guests will be assigned permanent UIDs and will have their preferences stored.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ entities:
|
|||||||
- uid: 2
|
- uid: 2
|
||||||
components:
|
components:
|
||||||
- type: MetaData
|
- type: MetaData
|
||||||
name: Automated Trade Station
|
name: Автономная Торговая Станция
|
||||||
- type: Transform
|
- type: Transform
|
||||||
pos: -2.9375,-1.625
|
pos: -2.9375,-1.625
|
||||||
parent: invalid
|
parent: invalid
|
||||||
@@ -382,6 +382,11 @@ entities:
|
|||||||
chunkSize: 4
|
chunkSize: 4
|
||||||
- type: GasTileOverlay
|
- type: GasTileOverlay
|
||||||
- type: RadiationGridResistance
|
- type: RadiationGridResistance
|
||||||
|
- type: ProtectedGrid
|
||||||
|
- type: TradeStation
|
||||||
|
- type: Shuttle
|
||||||
|
linearDamping: 10000
|
||||||
|
angularDamping: 10000
|
||||||
- proto: AirAlarm
|
- proto: AirAlarm
|
||||||
entities:
|
entities:
|
||||||
- uid: 802
|
- uid: 802
|
||||||
|
|||||||
@@ -46,12 +46,12 @@
|
|||||||
path: /Maps/Shuttles/cargo.yml
|
path: /Maps/Shuttles/cargo.yml
|
||||||
- type: GridSpawn
|
- type: GridSpawn
|
||||||
groups:
|
groups:
|
||||||
trade:
|
# trade:
|
||||||
addComponents:
|
# addComponents:
|
||||||
- type: ProtectedGrid
|
# - type: ProtectedGrid
|
||||||
- type: TradeStation
|
# - type: TradeStation
|
||||||
paths:
|
# paths:
|
||||||
- /Maps/Shuttles/trading_outpost.yml
|
# - /Maps/Shuttles/trading_outpost.yml
|
||||||
mining:
|
mining:
|
||||||
paths:
|
paths:
|
||||||
- /Maps/Shuttles/mining.yml
|
- /Maps/Shuttles/mining.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user