From ca62beb91f31f0566afc22465f10178127e64a62 Mon Sep 17 00:00:00 2001 From: Remuchi <72476615+Remuchi@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:19:47 +0700 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=BA?= =?UTF-8?q?=D1=80=D0=B0=D1=88=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=B8=D0=B3?= =?UTF-8?q?=D1=80=D1=8B=20(#389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tabletop/Components/TabletopGameComponent.cs | 14 ++++++++++++++ Content.Server/Tabletop/TabletopSystem.cs | 13 +++++++++++++ Resources/Locale/en-US/tabletop/tabletop.ftl | 1 + Resources/Locale/ru-RU/tabletop/tabletop.ftl | 1 + 4 files changed, 29 insertions(+) diff --git a/Content.Server/Tabletop/Components/TabletopGameComponent.cs b/Content.Server/Tabletop/Components/TabletopGameComponent.cs index da7a09b213..c22e2ba703 100644 --- a/Content.Server/Tabletop/Components/TabletopGameComponent.cs +++ b/Content.Server/Tabletop/Components/TabletopGameComponent.cs @@ -37,5 +37,19 @@ namespace Content.Server.Tabletop.Components /// [ViewVariables] public TabletopSession? Session { get; set; } = null; + + // Skyedra Fix start + /// + /// How many holograms have been spawned onto this board. + /// + [ViewVariables] + public int HologramsSpawned { get; set; } = 0; + + /// + /// How many holograms are allowed to be spawned total by players. + /// + [ViewVariables] + public int MaximumHologramsAllowed { get; set; } = 10; + // Skyedra Fix end } } diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index 4376ec4bc6..301f91622d 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -68,6 +68,9 @@ namespace Content.Server.Tabletop // Find the entity, remove it from the session and set it's position to the tabletop session.Entities.TryGetValue(entity, out var result); session.Entities.Remove(result); + + tabletop.HologramsSpawned--; // White Dream fix + QueueDel(result); } @@ -90,6 +93,16 @@ namespace Content.Server.Tabletop if (!TryComp(handEnt, out var item)) return; + // Skye hotfix to prevent people from infinitely spawning mice on the board games and crashing server. + if (component.HologramsSpawned >= component.MaximumHologramsAllowed) + { + _popupSystem.PopupEntity(Loc.GetString("tabletop-max-entities"), uid, args.User); + return; + } + + component.HologramsSpawned++; + // Skye hotfix end + var meta = MetaData(handEnt); var protoId = meta.EntityPrototype?.ID; diff --git a/Resources/Locale/en-US/tabletop/tabletop.ftl b/Resources/Locale/en-US/tabletop/tabletop.ftl index b2bacd1649..30dd4d7f90 100644 --- a/Resources/Locale/en-US/tabletop/tabletop.ftl +++ b/Resources/Locale/en-US/tabletop/tabletop.ftl @@ -4,6 +4,7 @@ tabletop-verb-dump-pieces = Dump Pieces tabletop-default-board-name = Board Game tabletop-error-remove-non-hologram = You cant remove a built in piece! tabletop-added-piece = The board shimmers brightly! +tabletop-max-entities = Maximum number of holograms placed. ## Chess tabletop-chess-board-name = Chess diff --git a/Resources/Locale/ru-RU/tabletop/tabletop.ftl b/Resources/Locale/ru-RU/tabletop/tabletop.ftl index 0eb4535fe6..19173cb7a3 100644 --- a/Resources/Locale/ru-RU/tabletop/tabletop.ftl +++ b/Resources/Locale/ru-RU/tabletop/tabletop.ftl @@ -5,6 +5,7 @@ tabletop-verb-dump-pieces = Сбросить куски tabletop-default-board-name = Настольная игра tabletop-error-remove-non-hologram = Вы не можете удалить встроенный элемент! tabletop-added-piece = Доска ярко переливается! +tabletop-max-entities = Максимальное количество голограмм уже поставлено. ## Chess From 66b951b0a603977b22c50fbc9abe7acd54c00ec0 Mon Sep 17 00:00:00 2001 From: ThereDrD0 <88589686+ThereDrD0@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:43:09 +0300 Subject: [PATCH 2/5] fix: fix proebanniy inhands (#390) --- .../Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml index 08963e423b..adb3cae442 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml @@ -10,7 +10,6 @@ - state: icon map: [ "enum.GunVisualLayers.Base" ] - type: Item - # If you update this also update the bulldog's size. size: Large - type: Clothing sprite: Objects/Weapons/Guns/Shotguns/db_shotgun.rsi @@ -52,6 +51,7 @@ - type: EmitSoundOnLand sound: collection: ShotgunsDrop + - type: Appearance - type: entity @@ -126,7 +126,6 @@ shape: - 0,0,4,0 sprite: White/Objects/Weapons/Guns/Shotguns/db_shotgun-inhands.rsi - heldPrefix: db - type: Gun fireRate: 2 - type: BallisticAmmoProvider @@ -159,7 +158,6 @@ sprite: White/Objects/Weapons/Guns/Shotguns/enforcer-inhands.rsi - type: Item sprite: White/Objects/Weapons/Guns/Shotguns/enforcer-inhands.rsi - heldPrefix: enforcer - type: BallisticAmmoProvider - type: entity @@ -177,11 +175,10 @@ description: When an old Remington design meets modern materials, this is the result. A favourite weapon of militia forces throughout many worlds. Uses .50 shotgun shells. components: - type: Item + sprite: White/Objects/Weapons/Guns/Shotguns/pump-inhands.rsi size: Normal shape: - 0,0,4,0 - sprite: White/Objects/Weapons/Guns/Shotguns/pump-inhands.rsi - heldPrefix: pump - type: Sprite sprite: White/Objects/Weapons/Guns/Shotguns/pump-icons.rsi - type: Clothing @@ -289,7 +286,6 @@ shape: - 0,0,4,0 sprite: White/Objects/Weapons/Guns/Shotguns/improvised_shotgun-inhands.rsi - heldPrefix: improvised - type: Gun fireRate: 4 #No reason to stifle the firerate since you have to manually reload every time anyways. - type: BallisticAmmoProvider From 5cfbe13c423b6ab4b4e6a19c030161ce9ed3d756 Mon Sep 17 00:00:00 2001 From: RavmorganButOnCocaine Date: Fri, 28 Jun 2024 09:44:12 +0000 Subject: [PATCH 3/5] Automatic changelog update --- Resources/Changelog/ChangelogWhite.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Resources/Changelog/ChangelogWhite.yml b/Resources/Changelog/ChangelogWhite.yml index c6f9280888..1d323ed3d4 100644 --- a/Resources/Changelog/ChangelogWhite.yml +++ b/Resources/Changelog/ChangelogWhite.yml @@ -5028,3 +5028,12 @@ id: 330 time: '2024-06-27T20:54:09.0000000+00:00' url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/387 +- author: ThereDrD + changes: + - message: "\u0418\u043D\u0445\u0435\u043D\u0434\u044B \u0434\u0440\u043E\u0431\u043E\ + \u0432\u0438\u043A\u043E\u0432 \u0432\u0435\u0440\u043D\u0443\u043B\u0438\u0441\ + \u044C" + type: Fix + id: 331 + time: '2024-06-28T09:43:09.0000000+00:00' + url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/390 From a07fdd78840407917fd19750b183dd88e6b9be8f Mon Sep 17 00:00:00 2001 From: Remuchi <72476615+Remuchi@users.noreply.github.com> Date: Fri, 28 Jun 2024 19:23:19 +0700 Subject: [PATCH 4/5] =?UTF-8?q?[Tweak]=20=D0=A2=D0=BE=D1=80=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=8F=20=D1=81=D1=82=D0=B0=D0=BD=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BA=D0=B0=D1=80=D0=B3=D0=BE=20=D0=B2=D1=8B=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=D0=B5=D0=BD=D0=B0=20=D0=BD=D0=B0=20=D0=BE=D1=82=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=83=D1=8E=20=D0=BA=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D1=83=20(#391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: торговая станция вынесена на отдельную карту * tweak: отключить случайный поворот и офсет станции --- .../Cargo/Systems/CargoSystem.Orders.cs | 50 +++++--- .../Cargo/Systems/CargoSystem.Shuttle.cs | 116 +++++++++++++++--- Content.Server/Cargo/Systems/CargoSystem.cs | 8 ++ Content.Shared/CCVar/CCVars.cs | 4 +- Resources/Maps/Shuttles/trading_outpost.yml | 7 +- .../Prototypes/Entities/Stations/base.yml | 12 +- 6 files changed, 153 insertions(+), 44 deletions(-) diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index 9ce414adc3..9bccabe98c 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -57,7 +57,7 @@ namespace Content.Server.Cargo.Systems return; _audio.PlayPvs(component.ConfirmSound, uid); - UpdateBankAccount(stationUid.Value, bank, (int) price); + UpdateBankAccount(stationUid.Value, bank, (int)price); QueueDel(args.Used); } @@ -100,7 +100,8 @@ namespace Content.Server.Cargo.Systems #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) return; @@ -184,7 +185,9 @@ namespace Content.Server.Cargo.Systems order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle); _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 _adminLogger.Add(LogType.Action, LogImpact.Low, @@ -195,7 +198,8 @@ namespace Content.Server.Cargo.Systems 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 _listEnts.Clear(); @@ -219,7 +223,8 @@ namespace Content.Server.Cargo.Systems { tradeDestination = trade; 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; } } @@ -234,16 +239,15 @@ namespace Content.Server.Cargo.Systems private void GetTradeStations(StationDataComponent data, ref List ents) { - foreach (var gridUid in data.Grids) + var tradeStationQuery = AllEntityQuery(); + while (tradeStationQuery.MoveNext(out var uid, out _)) { - if (!_tradeQuery.HasComponent(gridUid)) - continue; - - ents.Add(gridUid); + ents.Add(uid); } } - private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleRemoveOrderMessage args) + private void OnRemoveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, + CargoConsoleRemoveOrderMessage args) { var station = _station.GetOwningStation(uid); @@ -253,7 +257,8 @@ namespace Content.Server.Cargo.Systems 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) return; @@ -286,7 +291,6 @@ namespace Content.Server.Cargo.Systems // Log order addition _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}]"); - } 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); } - 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) @@ -422,6 +428,7 @@ namespace Content.Server.Cargo.Systems { orderDB.Orders.RemoveAt(sequenceIdx); } + UpdateOrders(dbUid, orderDB); } @@ -433,7 +440,8 @@ namespace Content.Server.Cargo.Systems 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); if (orderIdx == -1) @@ -450,13 +458,15 @@ namespace Content.Server.Cargo.Systems // Order is complete. Remove from the queue. orderDB.Orders.RemoveAt(orderIdx); } + return true; } /// /// Tries to fulfill the next outstanding order. /// - private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, string? paperProto) + private bool FulfillNextOrder(StationCargoOrderDatabaseComponent orderDB, EntityCoordinates spawn, + string? paperProto) { if (!PopFrontOrder(orderDB, out var order)) return false; @@ -497,7 +507,6 @@ namespace Content.Server.Cargo.Systems } return true; - } private void DeductFunds(StationBankAccountComponent component, int amount) @@ -507,11 +516,12 @@ namespace Content.Server.Cargo.Systems #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); } #endregion } -} +} \ No newline at end of file diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index 3bcd6d8d20..eed2724985 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -1,12 +1,17 @@ using Content.Server.Cargo.Components; +using Content.Server.GameTicking; +using Content.Server.Station.Systems; using Content.Shared.Stacks; using Content.Shared.Cargo; using Content.Shared.Cargo.BUI; using Content.Shared.Cargo.Components; using Content.Shared.Cargo.Events; +using Content.Shared.CCVar; using Content.Shared.GameTicking; +using Content.Shared.Shuttles.Components; +using Content.Shared.Whitelist; +using Robust.Server.Maps; using Robust.Shared.Map; -using Robust.Shared.Random; using Robust.Shared.Audio; namespace Content.Server.Cargo.Systems; @@ -16,9 +21,12 @@ public sealed partial class CargoSystem /* * Handles cargo shuttle / trade mechanics. */ + private MapId? TradeStationMap { get; set; } private static readonly SoundPathSpecifier ApproveSound = new("/Audio/Effects/Cargo/ping.ogg"); + private const string TradeStationMapPath = "/Maps/Shuttles/trading_outpost.yml"; + private void InitializeShuttle() { SubscribeLocalEvent(OnTradeSplit); @@ -30,6 +38,17 @@ public sealed partial class CargoSystem SubscribeLocalEvent(OnPalletUIOpen); SubscribeLocalEvent(OnRoundRestart); + SubscribeLocalEvent(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 @@ -58,12 +77,13 @@ public sealed partial class CargoSystem if (Transform(uid).GridUid is not EntityUid gridUid) { _uiSystem.SetUiState(bui, - new CargoPalletConsoleInterfaceState(0, 0, false)); + new CargoPalletConsoleInterfaceState(0, 0, false)); return; } + GetPalletGoods(gridUid, out var toSell, out var amount); _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) @@ -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 /// known for their entity spam i wouldnt put it past them /// - private void OnPalletAppraise(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletAppraiseMessage args) { var player = args.Session.AttachedEntity; @@ -94,7 +113,8 @@ public sealed partial class CargoSystem 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); UpdateShuttleState(uid, station); @@ -106,12 +126,18 @@ public sealed partial class CargoSystem TryComp(orderDatabase?.Shuttle, out var 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)) _uiSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState( - station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"), - string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName, + station != null + ? MetaData(station.Value).EntityName + : Loc.GetString("cargo-shuttle-console-station-unknown"), + string.IsNullOrEmpty(shuttleName) + ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") + : shuttleName, orders )); } @@ -154,13 +180,14 @@ public sealed partial class CargoSystem // We won't be able to fit the whole order on, so make one // which represents the space we do have left: 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); } else { orders.Add(order); } + spaceRemaining -= numToShip; } } @@ -179,7 +206,8 @@ public sealed partial class CargoSystem /// GetCargoPallets(gridUid, BuySellType.Sell) to return only Sell 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(); @@ -199,7 +227,6 @@ public sealed partial class CargoSystem } _pads.Add((uid, comp, compXform)); - } return _pads; @@ -215,7 +242,8 @@ public sealed partial class CargoSystem 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)) continue; @@ -325,7 +353,7 @@ public sealed partial class CargoSystem if (xform.GridUid is not EntityUid gridUid) { _uiSystem.SetUiState(bui, - new CargoPalletConsoleInterfaceState(0, 0, false)); + new CargoPalletConsoleInterfaceState(0, 0, false)); return; } @@ -333,7 +361,7 @@ public sealed partial class CargoSystem return; var stackPrototype = _protoMan.Index(component.CashType); - _stack.Spawn((int) price, stackPrototype, xform.Coordinates); + _stack.Spawn((int)price, stackPrototype, xform.Coordinates); _audio.PlayPvs(ApproveSound, uid); UpdatePalletConsoleInterface(uid); } @@ -343,6 +371,64 @@ public sealed partial class CargoSystem private void OnRoundRestart(RoundRestartCleanupEvent ev) { Reset(); + CleanupTradeStation(); + } + + private void OnStationInitialize(StationInitializedEvent args) + { + if (!HasComp(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(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. /// [ByRefEvent] -public readonly record struct EntitySoldEvent(HashSet Sold); +public readonly record struct EntitySoldEvent(HashSet Sold); \ No newline at end of file diff --git a/Content.Server/Cargo/Systems/CargoSystem.cs b/Content.Server/Cargo/Systems/CargoSystem.cs index f6109570ac..5d377553dc 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.cs @@ -7,6 +7,7 @@ using Content.Server.Shuttles.Systems; using Content.Server.Stack; using Content.Server.Station.Systems; using Content.Server._White.Economy; +using Content.Server.GameTicking; using Content.Shared.Access.Systems; using Content.Shared.Administration.Logs; using Content.Shared.Cargo; @@ -16,6 +17,8 @@ using Content.Shared.Mobs.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; +using Robust.Shared.Configuration; +using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.Random; @@ -44,6 +47,11 @@ public sealed partial class CargoSystem : SharedCargoSystem [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly MetaDataSystem _metaSystem = default!; [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 _xformQuery; private EntityQuery _blacklistQuery; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 1ba1358a83..6041e31826 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -233,7 +233,7 @@ namespace Content.Shared.CCVar /// Whether a random position offset will be applied to the station on roundstart. /// public static readonly CVarDef StationOffset = - CVarDef.Create("game.station_offset", true); + CVarDef.Create("game.station_offset", false); /// /// 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. /// public static readonly CVarDef StationRotation = - CVarDef.Create("game.station_rotation", true); + CVarDef.Create("game.station_rotation", false); /// /// When enabled, guests will be assigned permanent UIDs and will have their preferences stored. diff --git a/Resources/Maps/Shuttles/trading_outpost.yml b/Resources/Maps/Shuttles/trading_outpost.yml index f040d58253..50ba19f31e 100644 --- a/Resources/Maps/Shuttles/trading_outpost.yml +++ b/Resources/Maps/Shuttles/trading_outpost.yml @@ -23,7 +23,7 @@ entities: - uid: 2 components: - type: MetaData - name: Automated Trade Station + name: Автономная Торговая Станция - type: Transform pos: -2.9375,-1.625 parent: invalid @@ -382,6 +382,11 @@ entities: chunkSize: 4 - type: GasTileOverlay - type: RadiationGridResistance + - type: ProtectedGrid + - type: TradeStation + - type: Shuttle + linearDamping: 10000 + angularDamping: 10000 - proto: AirAlarm entities: - uid: 802 diff --git a/Resources/Prototypes/Entities/Stations/base.yml b/Resources/Prototypes/Entities/Stations/base.yml index da5875d2bc..07b3f161a3 100644 --- a/Resources/Prototypes/Entities/Stations/base.yml +++ b/Resources/Prototypes/Entities/Stations/base.yml @@ -46,12 +46,12 @@ path: /Maps/Shuttles/cargo.yml - type: GridSpawn groups: - trade: - addComponents: - - type: ProtectedGrid - - type: TradeStation - paths: - - /Maps/Shuttles/trading_outpost.yml +# trade: +# addComponents: +# - type: ProtectedGrid +# - type: TradeStation +# paths: +# - /Maps/Shuttles/trading_outpost.yml mining: paths: - /Maps/Shuttles/mining.yml From ef4e2feba95a7062ca956d29713d3b7c1ad90289 Mon Sep 17 00:00:00 2001 From: RavmorganButOnCocaine Date: Fri, 28 Jun 2024 12:24:22 +0000 Subject: [PATCH 5/5] Automatic changelog update --- Resources/Changelog/ChangelogWhite.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Resources/Changelog/ChangelogWhite.yml b/Resources/Changelog/ChangelogWhite.yml index 1d323ed3d4..5d61e179e2 100644 --- a/Resources/Changelog/ChangelogWhite.yml +++ b/Resources/Changelog/ChangelogWhite.yml @@ -5037,3 +5037,14 @@ id: 331 time: '2024-06-28T09:43:09.0000000+00:00' url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/390 +- author: Remuchi + changes: + - message: "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\ + \u0430\u044F \u0442\u043E\u0440\u0433\u043E\u0432\u0430\u044F \u0441\u0442\u0430\ + \u043D\u0446\u0438\u044F \u0432\u044B\u043D\u0435\u0441\u0435\u043D\u0430 \u043D\ + \u0430 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u0443\u044E \u043A\u0430\u0440\ + \u0442\u0443." + type: Add + id: 332 + time: '2024-06-28T12:23:19.0000000+00:00' + url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/391