diff --git a/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs b/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs index f0555750676..956badab60a 100644 --- a/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs +++ b/Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs @@ -2,7 +2,6 @@ using Content.Client.UserInterface.Controls; using Content.Shared.VendingMachines; using Content.Shared.Cargo.Components; -using Content.Shared._NF.Cargo.Components; using Content.Shared.Stacks; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; @@ -111,8 +110,12 @@ public void Populate(List inventory, float priceMo { if (priceComponent.Price != 0) { - var price = (float)priceComponent.Price; - cost = (int) (price * priceModifier); + var price = (float) priceComponent.Price; + + if (priceComponent.VendingPriceModReplacer != 0 && priceModifier < priceComponent.VendingPriceModReplacer) + priceModifier = priceComponent.VendingPriceModReplacer; + + cost = (int) (price * priceModifier); } else { @@ -144,14 +147,6 @@ public void Populate(List inventory, float priceMo } } - // This block exists to allow the VendPrice flag to set a vending machine item price. - if (prototype != null && prototype.TryGetComponent(out var vendPriceComponent) && vendPriceComponent.Price != 0 && cost <= (float) vendPriceComponent.Price) - { - var price = (float) vendPriceComponent.Price; - cost = (int) price; - } - // This block exists to allow the VendPrice flag to set a vending machine item price. - vendingItem.Text = $"[${cost}] {itemName} [{entry.Amount}]"; vendingItem.Icon = icon; filteredInventory.Add(i); diff --git a/Content.Server/Cargo/Systems/PricingSystem.cs b/Content.Server/Cargo/Systems/PricingSystem.cs index bf6bba6e773..42c7906042e 100644 --- a/Content.Server/Cargo/Systems/PricingSystem.cs +++ b/Content.Server/Cargo/Systems/PricingSystem.cs @@ -5,7 +5,6 @@ using Content.Shared.Administration; using Content.Shared.Body.Components; using Content.Shared.Cargo.Components; -using Content.Shared._NF.Cargo.Components; using Content.Shared.Chemistry.Components.SolutionManager; using Content.Shared.Chemistry.Reagent; using Content.Shared.Materials; @@ -172,29 +171,6 @@ public double GetEstimatedPrice(EntityPrototype prototype) return price; } - /// - /// Add a hardcoded price for an item to set how much it will cost to buy it from a vending machine, while allowing staticPrice to set its sell price. - /// - public double GetEstimatedVendPrice(EntityPrototype prototype) - { - var ev = new EstimatedPriceCalculationEvent() - { - Prototype = prototype, - }; - - RaiseLocalEvent(ref ev); - - if (ev.Handled) - return ev.Price; - - var price = ev.Price; - price += GetVendPrice(prototype); - - // TODO: Proper container support. - - return price; - } - /// /// Appraises an entity, returning it's price. /// @@ -359,17 +335,17 @@ private double GetStaticPrice(EntityPrototype prototype) return price; } - private double GetVendPrice(EntityPrototype prototype) + public double GetStaticVendingPriceMod(EntityPrototype prototype) { - var price = 0.0; + var vendingPriceModReplacer = 0.0; - if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(VendPriceComponent)), out var vendProto)) + if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(StaticPriceComponent)), out var staticProto)) { - var vendPrice = (VendPriceComponent) vendProto.Component; - price += vendPrice.Price; + var staticPrice = (StaticPriceComponent) staticProto.Component; + vendingPriceModReplacer += staticPrice.VendingPriceModReplacer; } - return price; + return vendingPriceModReplacer; } /// diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 3a9cb0e3550..d45056ad3ae 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -356,16 +356,16 @@ public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type, price = 20; if (TryComp(component.Owner, out var modifier)) - price *= modifier.Mod; + { + var vendingPriceModReplacer = _pricing.GetStaticVendingPriceMod(proto); + if (vendingPriceModReplacer != 0 && modifier.Mod < vendingPriceModReplacer) + price *= vendingPriceModReplacer; + else + price *= modifier.Mod; + } var totalPrice = (int) price; - // This block exists to allow the VendPrice flag to set a vending machine item price. - var priceVend = _pricing.GetEstimatedVendPrice(proto); - if (priceVend != null && totalPrice <= (int) priceVend) - totalPrice = (int) priceVend; - // This block exists to allow the VendPrice flag to set a vending machine item price. - if (totalPrice > bank.Balance) { _popupSystem.PopupEntity(Loc.GetString("bank-insufficient-funds"), uid); diff --git a/Content.Shared/Cargo/Components/StaticPriceComponent.cs b/Content.Shared/Cargo/Components/StaticPriceComponent.cs index 320cd0a6135..44d2079dfc4 100644 --- a/Content.Shared/Cargo/Components/StaticPriceComponent.cs +++ b/Content.Shared/Cargo/Components/StaticPriceComponent.cs @@ -11,4 +11,10 @@ public sealed partial class StaticPriceComponent : Component /// [DataField("price", required: true)] public double Price; + + /// + /// Frontier - Edit the vending machine mod to use a diffrent mod, can only be used to add a higher mod then the existing one of the vending machine. + /// + [DataField("vendingPriceModReplacer", required: false)] + public float VendingPriceModReplacer; } diff --git a/Content.Shared/_NF/Cargo/Components/VendPriceComponent.cs b/Content.Shared/_NF/Cargo/Components/VendPriceComponent.cs deleted file mode 100644 index 84c16db2f64..00000000000 --- a/Content.Shared/_NF/Cargo/Components/VendPriceComponent.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Content.Shared._NF.Cargo.Components; - -/// -/// This is used for setting a static, unchanging price for buying an object from a vending machine. -/// -[RegisterComponent] -public sealed partial class VendPriceComponent : Component -{ - /// - /// The price of the object this component is on. - /// - [DataField("price", required: true)] - public double Price; -} diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/bio.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/bio.yml index 7391ea9901f..b6c7215d5f7 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/bio.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/bio.yml @@ -13,8 +13,8 @@ modifiers: coefficients: Caustic: 0.5 - - type: VendPrice - price: 400 + - type: StaticPrice + price: 40 - type: entity parent: ClothingOuterBioGeneral diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml index ab2b8b90f0a..5e6a00ed3af 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml @@ -114,7 +114,6 @@ Radiation: 0.75 Caustic: 0.5 - type: GroupExamine - - type: VendPrice # Frontier - price: 750 - type: StaticPrice # Frontier price: 50 + vendingPriceModReplacer: 15 # Frontier - 50x15=750 diff --git a/Resources/Prototypes/Entities/Objects/Misc/monkeycube.yml b/Resources/Prototypes/Entities/Objects/Misc/monkeycube.yml index ff093700449..d97f560f8ec 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/monkeycube.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/monkeycube.yml @@ -18,8 +18,7 @@ state: box - type: StaticPrice price: 20 - - type: VendPrice - price: 900 # 150 per monkey (Meat worth 200) + vendingPriceModReplacer: 45 # Frontier - 20x45=900, 150 per monkey (Meat worth 200) - type: entity parent: BaseItem diff --git a/Resources/Prototypes/Entities/Objects/Tools/fulton.yml b/Resources/Prototypes/Entities/Objects/Tools/fulton.yml index 57a3bab5129..ec0f5fa1547 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/fulton.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/fulton.yml @@ -80,8 +80,6 @@ acts: [ "Destruction" ] - type: StaticPrice price: 20 - - type: VendPrice - price: 12000 - type: entity id: Fulton1 diff --git a/Resources/Prototypes/_NF/Catalog/Fills/Boxes/general.yml b/Resources/Prototypes/_NF/Catalog/Fills/Boxes/general.yml index 891b9387444..1ea00a7465f 100644 --- a/Resources/Prototypes/_NF/Catalog/Fills/Boxes/general.yml +++ b/Resources/Prototypes/_NF/Catalog/Fills/Boxes/general.yml @@ -80,5 +80,6 @@ - type: Sprite layers: - state: box - - type: VendPrice - price: 1200 + - type: StaticPrice + price: 20 + vendingPriceModReplacer: 60 # Frontier - 20x60=1200 diff --git a/Resources/Prototypes/_NF/Entities/Objects/Fun/prizeticket.yml b/Resources/Prototypes/_NF/Entities/Objects/Fun/prizeticket.yml index 9fec3f0a661..dc9be9e4bff 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Fun/prizeticket.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Fun/prizeticket.yml @@ -98,8 +98,6 @@ name: prize ball description: I wounder whats inside! components: - - type: VendPrice - price: 500 - type: Sprite sprite: _NF/Objects/Fun/prizeticket.rsi layers: @@ -286,3 +284,6 @@ - id: PlushieAbductorAgent prob: 0.20 orGroup: Prize + - type: StaticPrice + price: 20 + vendingPriceModReplacer: 50 # Frontier - 20x50=1000 diff --git a/Resources/Prototypes/_NF/Entities/Objects/Tools/handheld_mass_scanner.yml b/Resources/Prototypes/_NF/Entities/Objects/Tools/handheld_mass_scanner.yml index d132701d415..36467eca4d6 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Tools/handheld_mass_scanner.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Tools/handheld_mass_scanner.yml @@ -37,6 +37,4 @@ - key: enum.RadarConsoleUiKey.Key type: RadarConsoleBoundUserInterface - type: StaticPrice - price: 20 - - type: VendPrice - price: 5000 + price: 200