From 4975eef5bd8dbac9ae82fbea2a25354199673708 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 29 Apr 2023 14:59:24 +1000 Subject: [PATCH] Cargo 1984 (#15579) --- .../UserInterface/StatValuesCommand.cs | 44 ++++++++++++------- .../Computers/base_structurecomputers.yml | 2 - .../Structures/Machines/vending_machines.yml | 2 +- .../Structures/Piping/Atmospherics/unary.yml | 4 -- .../Structures/Shuttles/thrusters.yml | 2 +- .../Storage/Crates/base_structurecrates.yml | 2 + .../Entities/Structures/base_structure.yml | 2 - 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Content.Server/UserInterface/StatValuesCommand.cs b/Content.Server/UserInterface/StatValuesCommand.cs index 7ca39fce26..7356a0204a 100644 --- a/Content.Server/UserInterface/StatValuesCommand.cs +++ b/Content.Server/UserInterface/StatValuesCommand.cs @@ -1,4 +1,5 @@ using System.Globalization; +using System.Linq; using Content.Server.Administration; using Content.Server.Cargo.Systems; using Content.Server.EUI; @@ -16,6 +17,11 @@ namespace Content.Server.UserInterface; [AdminCommand(AdminFlags.Debug)] public sealed class StatValuesCommand : IConsoleCommand { + [Dependency] private readonly EuiManager _eui = default!; + [Dependency] private readonly IComponentFactory _factory = default!; + [Dependency] private readonly IEntityManager _entManager = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; + public string Command => "showvalues"; public string Description => Loc.GetString("stat-values-desc"); public string Help => $"{Command} "; @@ -51,24 +57,33 @@ public sealed class StatValuesCommand : IConsoleCommand return; } - var euiManager = IoCManager.Resolve(); var eui = new StatValuesEui(); - euiManager.OpenEui(eui, pSession); + _eui.OpenEui(eui, pSession); eui.SendMessage(message); } + public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + { + if (args.Length == 1) + { + return CompletionResult.FromOptions(new[] { "cargosell", "lathesell", "melee" }); + } + + return CompletionResult.Empty; + } + private StatValuesEuiMessage GetCargo() { // Okay so there's no easy way to do this with how pricing works // So we'll just get the first value for each prototype ID which is probably good enough for the majority. var values = new List(); - var entManager = IoCManager.Resolve(); - var priceSystem = entManager.System(); - var metaQuery = entManager.GetEntityQuery(); + var priceSystem = _entManager.System(); + var metaQuery = _entManager.GetEntityQuery(); var prices = new HashSet(256); + var ents = _entManager.GetEntities().ToArray(); - foreach (var entity in entManager.GetEntities()) + foreach (var entity in ents) { if (!metaQuery.TryGetComponent(entity, out var meta)) continue; @@ -107,15 +122,13 @@ public sealed class StatValuesCommand : IConsoleCommand private StatValuesEuiMessage GetMelee() { - var compFactory = IoCManager.Resolve(); - var protoManager = IoCManager.Resolve(); - var values = new List(); + var meleeName = _factory.GetComponentName(typeof(MeleeWeaponComponent)); - foreach (var proto in protoManager.EnumeratePrototypes()) + foreach (var proto in _proto.EnumeratePrototypes()) { if (proto.Abstract || - !proto.Components.TryGetValue(compFactory.GetComponentName(typeof(MeleeWeaponComponent)), + !proto.Components.TryGetValue(meleeName, out var meleeComp)) { continue; @@ -153,20 +166,19 @@ public sealed class StatValuesCommand : IConsoleCommand private StatValuesEuiMessage GetLatheMessage() { var values = new List(); - var protoManager = IoCManager.Resolve(); - var priceSystem = IoCManager.Resolve().GetEntitySystem(); + var priceSystem = _entManager.System(); - foreach (var proto in protoManager.EnumeratePrototypes()) + foreach (var proto in _proto.EnumeratePrototypes()) { var cost = 0.0; foreach (var (material, count) in proto.RequiredMaterials) { - var materialPrice = protoManager.Index(material).Price; + var materialPrice = _proto.Index(material).Price; cost += materialPrice * count; } - var sell = priceSystem.GetEstimatedPrice(protoManager.Index(proto.Result)); + var sell = priceSystem.GetEstimatedPrice(_proto.Index(proto.Result)); values.Add(new[] { diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/base_structurecomputers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/base_structurecomputers.yml index 4f1ab73fec..6d90c0f2b8 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/base_structurecomputers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/base_structurecomputers.yml @@ -56,5 +56,3 @@ containers: board: !type:Container ents: [] - - type: StaticPrice - price: 400 diff --git a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml index d4a34c9548..2fb7f3c064 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml @@ -72,7 +72,7 @@ - type: SentienceTarget flavorKind: station-event-random-sentience-flavor-mechanical - type: StaticPrice - price: 200 + price: 100 - type: Appearance - type: WiresVisuals diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 11d2b9a1f8..6c3bf09eec 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -16,8 +16,6 @@ nodeGroupID: Pipe pipeDirection: South - type: CollideOnAnchor - - type: StaticPrice - price: 200 - type: entity parent: GasUnaryBase @@ -254,8 +252,6 @@ !type:PipeNode nodeGroupID: Pipe pipeDirection: South - - type: StaticPrice - price: 500 - type: Transform noRot: false diff --git a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml index a17037220a..eab6009855 100644 --- a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml +++ b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml @@ -38,7 +38,7 @@ - !type:DoActsBehavior acts: ["Destruction"] - type: StaticPrice - price: 1000 + price: 300 placement: mode: SnapgridCenter diff --git a/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml b/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml index ab435b1976..a38cbe66b8 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Crates/base_structurecrates.yml @@ -65,6 +65,8 @@ entity_storage: !type:Container paper_label: !type:ContainerSlot - type: ItemSlots + - type: StaticPrice + price: 50 - type: Construction graph: CrateGenericSteel node: crategenericsteel diff --git a/Resources/Prototypes/Entities/Structures/base_structure.yml b/Resources/Prototypes/Entities/Structures/base_structure.yml index eb3bac465b..44fc1156e4 100644 --- a/Resources/Prototypes/Entities/Structures/base_structure.yml +++ b/Resources/Prototypes/Entities/Structures/base_structure.yml @@ -53,8 +53,6 @@ - MidImpassable - LowImpassable - type: Anchorable - - type: StaticPrice - price: 50 - type: Tag id: Structure -- 2.51.2