Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New vends #110

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d3917dc
CuddlyCritterVend
dvir001 Jul 28, 2023
37113e1
Vend
dvir001 Jul 29, 2023
82f3eb1
Merge branch 'New-Vends' of https://github.com/dvir001/frontier-stati…
dvir001 Jul 29, 2023
9047c02
Vend
dvir001 Jul 29, 2023
51c237f
Vends & more
dvir001 Jul 29, 2023
85acbe3
Vends
dvir001 Jul 29, 2023
a7f2aaf
Vends
dvir001 Jul 29, 2023
fc7df82
Restock
dvir001 Jul 29, 2023
f8d9151
Update MarketPriceComponent.cs
dvir001 Jul 29, 2023
52d6b00
Small price fix
dvir001 Jul 29, 2023
1bd5943
Another price fix
dvir001 Jul 29, 2023
a0f5a6a
Merge branch 'new-frontiers-14:master' into New-Vends
dvir001 Jul 30, 2023
01c72f0
Update chang.yml
dvir001 Jul 31, 2023
e7b151a
Update coffee.yml
dvir001 Jul 31, 2023
1432a5c
Update cola.yml
dvir001 Jul 31, 2023
fdba051
Update discount.yml
dvir001 Jul 31, 2023
b7d97d8
Update donut.yml
dvir001 Jul 31, 2023
c0b4a75
Update happyhonk.yml
dvir001 Jul 31, 2023
03eeee5
Update pwrgame.yml
dvir001 Jul 31, 2023
0509e2f
Update snack.yml
dvir001 Jul 31, 2023
0365160
Update sovietsoda.yml
dvir001 Jul 31, 2023
b6b10e0
Update sovietsoda.yml
dvir001 Jul 31, 2023
0ce91e2
Update spaceup.yml
dvir001 Jul 31, 2023
e1127ec
Update starkist.yml
dvir001 Jul 31, 2023
895d4e3
Update sustenance.yml
dvir001 Jul 31, 2023
04ec847
Update drinks.yml
dvir001 Jul 31, 2023
5d1e119
Update drinks_cans.yml
dvir001 Jul 31, 2023
132b53a
Update drinks_cups.yml
dvir001 Jul 31, 2023
ae1c3c1
Update drinks_flasks.yml
dvir001 Jul 31, 2023
92b0527
Update donut.yml
dvir001 Jul 31, 2023
d209aa4
Update snacks.yml
dvir001 Jul 31, 2023
ccd1d9b
Update drinks_cups.yml
dvir001 Jul 31, 2023
0eabea5
Update shamblersjuice.yml
dvir001 Jul 31, 2023
45cb80e
Update soda.yml
dvir001 Jul 31, 2023
d669a31
Update cuddlycritter.yml
dvir001 Jul 31, 2023
93c2604
Update cuddlycritter.yml
dvir001 Jul 31, 2023
f64a80f
Update drinks_cups.yml
dvir001 Jul 31, 2023
2978881
Update drinks.yml
dvir001 Jul 31, 2023
9693f86
Update drinks_cans.yml
dvir001 Jul 31, 2023
548c78c
Update drinks_cups.yml
dvir001 Jul 31, 2023
0976b61
Update drinks_flasks.yml
dvir001 Jul 31, 2023
8d5c739
Update donut.yml
dvir001 Jul 31, 2023
0edc50a
Update toys.yml
dvir001 Jul 31, 2023
bb267f1
Update crayons.yml
dvir001 Jul 31, 2023
29959f3
Update drinks_flasks.yml
dvir001 Jul 31, 2023
af80c72
Update box.yml
dvir001 Jul 31, 2023
3087186
Update snacks.yml
dvir001 Jul 31, 2023
5e31140
Merge branch 'new-frontiers-14:master' into New-Vends
dvir001 Jul 31, 2023
85f9e6c
Update VendingMachineSystem.cs
dvir001 Aug 1, 2023
a6ecc97
Update VendingMachineMenu.xaml.cs
dvir001 Aug 1, 2023
85030d3
Update cuddlycritter.yml
dvir001 Aug 1, 2023
f921573
Merge branch 'new-frontiers-14:master' into New-Vends
dvir001 Aug 1, 2023
8e86069
Revert "Update snacks.yml"
dvir001 Aug 2, 2023
01cfcdd
Revert "Update box.yml"
dvir001 Aug 2, 2023
7925df1
Revert "Update drinks_flasks.yml"
dvir001 Aug 2, 2023
d504b50
Update chang.yml
dvir001 Aug 2, 2023
8e32f1a
Update coffee.yml
dvir001 Aug 2, 2023
6082720
Update cola.yml
dvir001 Aug 2, 2023
e6592bd
Update donut.yml
dvir001 Aug 2, 2023
5186992
Update pwrgame.yml
dvir001 Aug 2, 2023
28e2abc
Update spaceup.yml
dvir001 Aug 2, 2023
a36353d
Update starkist.yml
dvir001 Aug 2, 2023
88f7cc1
Update drinks_cups.yml
dvir001 Aug 2, 2023
cc16448
Update drinks_cups.yml
dvir001 Aug 2, 2023
38518b5
Update happyhonk.yml
dvir001 Aug 2, 2023
4c1e17a
Update shamblersjuice.yml
dvir001 Aug 2, 2023
843b8a7
Update snack.yml
dvir001 Aug 2, 2023
0a61f63
Update soda.yml
dvir001 Aug 2, 2023
8b195ab
Update drinks_cans.yml
dvir001 Aug 2, 2023
6590c62
Update drinks_flasks.yml
dvir001 Aug 2, 2023
2bc5cb3
Update donut.yml
dvir001 Aug 2, 2023
00bd876
Update box.yml
dvir001 Aug 2, 2023
04ac2e2
Update snacks.yml
dvir001 Aug 2, 2023
40e50c5
Update discount.yml
dvir001 Aug 2, 2023
3b38124
Update donut.yml
dvir001 Aug 2, 2023
fcb7564
Update sovietsoda.yml
dvir001 Aug 2, 2023
c8dcded
Update sustenance.yml
dvir001 Aug 2, 2023
1eb0df9
Update drinks.yml
dvir001 Aug 2, 2023
0ea9587
Update snacks.yml
dvir001 Aug 2, 2023
3f4f33e
Update toys.yml
dvir001 Aug 2, 2023
ee8fd6b
Update drinks_cans.yml
dvir001 Aug 2, 2023
e7c8dac
Update toys.yml
dvir001 Aug 2, 2023
0062347
Update drinks.yml
dvir001 Aug 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ public void Populate(List<VendingMachineInventoryEntry> inventory, float priceMo
cost = (int) (cost * priceModifier);
}

// This block exists to allow the MarketPrice flag to set a price
if (prototype != null && prototype.TryGetComponent<MarketPriceComponent>(out var marketPriceComponent))
{
if (marketPriceComponent.Price != 0)
{
var price = (float) marketPriceComponent.Price;
cost = (int) (price);
}
}
// This block exists to allow the MarketPrice flag to set a price

vendingItem.Text = $"[${cost}] {itemName} [{entry.Amount}]";
vendingItem.Icon = icon;
}
Expand Down
45 changes: 45 additions & 0 deletions Content.Server/Cargo/Systems/PricingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,26 @@ public double GetEstimatedPrice(EntityPrototype prototype)
return price;
}

public double GetEstimatedMarketPrice(EntityPrototype prototype)
{
var ev = new EstimatedPriceCalculationEvent()
{
Prototype = prototype,
};

RaiseLocalEvent(ref ev);

if (ev.Handled)
return ev.Price;

var price = ev.Price;
price += GetMarketPrice(prototype);

// TODO: Proper container support.

return price;
}

/// <summary>
/// Appraises an entity, returning it's price.
/// </summary>
Expand Down Expand Up @@ -328,6 +348,31 @@ private double GetStaticPrice(EntityPrototype prototype)
return price;
}

private double GetMarketPrice(EntityUid uid)
{
var price = 0.0;

if (TryComp<MarketPriceComponent>(uid, out var marketPrice))
{
price += marketPrice.Price;
}

return price;
}

private double GetMarketPrice(EntityPrototype prototype)
{
var price = 0.0;

if (prototype.Components.TryGetValue(_factory.GetComponentName(typeof(MarketPriceComponent)), out var marketProto))
{
var marketPrice = (MarketPriceComponent) marketProto.Component;
price += marketPrice.Price;
}

return price;
}

/// <summary>
/// Appraises a grid, this is mainly meant to be used by yarrs.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type,

var totalPrice = ((int) price);

// This block exists to allow the MarketPrice flag to set a price
var priceMarket = _pricing.GetEstimatedMarketPrice(proto);
if (priceMarket == null || priceMarket == 0) { }
else { totalPrice = ((int) priceMarket); }
// This block exists to allow the MarketPrice flag to set a price

if (totalPrice > bank.Balance)
{
_popupSystem.PopupEntity(Loc.GetString("bank-insufficient-funds"), uid);
Expand Down
14 changes: 14 additions & 0 deletions Content.Shared/Cargo/Components/MarketPriceComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Content.Shared.Cargo.Components;

/// <summary>
/// This is used for setting a static, unchanging price for buying an object.
/// </summary>
[RegisterComponent]
public sealed class MarketPriceComponent : Component
{
/// <summary>
/// The price of the object this component is on.
/// </summary>
[DataField("price", required: true)]
public double Price;
}
Binary file added Resources/Audio/_NF/Items/Toys/wehhelp.ogg
Binary file not shown.
3 changes: 0 additions & 3 deletions Resources/Locale/en-US/_NF/adventure/adventure.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ adventure-title = New Frontier Adventure Mode
adventure-description = Join a ship crew or buy your own and explore, research, salvage, or haul your way to riches!
currency = Spesos

advertisement-astrovend-1 = Spessman's Choice!
advertisement-astrovend-2 = Don't leave home without a suit!

guide-entry-adventure = New Frontiers Program
guide-entry-bank = NT Galactic Bank
guide-entry-shipyard = Frontier Shipyards
Expand Down
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/advertisements/vending/astro.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
advertisement-astrovend-1 = Spessman's Choice!
advertisement-astrovend-2 = Don't leave home without a suit!
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
advertisement-cuddlycritter-1 = Brighten your day with a fluffy friend!
advertisement-cuddlycritter-2 = Hug therapy starts here!
advertisement-cuddlycritter-3 = Give in to the plushie temptation!
advertisement-cuddlycritter-4 = You won't resist their charm!
advertisement-cuddlycritter-5 = Warning: Extreme cuteness ahead!
advertisement-cuddlycritter-6 = Help me I'm trapped in a NanoTrasen factory forced to make Plushies!
advertisement-cuddlycritter-7 = Softer then asbestos!
advertisement-cuddlycritter-8 = The best crayon colors in space, proposition 65
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ ent-CrateVendingMachineRestockAmmo = { ent-CrateVendingMachineRestockAmmoFilled
.desc = { ent-CrateVendingMachineRestockAmmoFilled.desc }

ent-CrateVendingMachineRestockCircuitVend = { ent-CrateVendingMachineRestockCircuitVendFilled }
.desc = { ent-CrateVendingMachineRestockCircuitVendFilled.desc }
.desc = { ent-CrateVendingMachineRestockCircuitVendFilled.desc }

ent-CrateVendingMachineRestockCuddlyCritterVend = { ent-CrateVendingMachineRestockCuddlyCritterVendFilled }
.desc = { ent-CrateVendingMachineRestockCuddlyCritterVendFilled.desc }
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ent-CrateVendingMachineRestockAstroVendFilled = AstroVend restock crate
.desc = Contains two restock boxes for the AstroVend vendor.
.desc = Contains two restock boxes for the AstroVend vending machine.

ent-CrateVendingMachineRestockAmmoFilled = Liberation restock crate
.desc = Contains two restock boxes for the Liberation vending machine.

ent-CrateVendingMachineRestockCircuitVendFilled = CircuitVend restock crate
.desc = Contains two restock boxes for a CircuitVend vending machine.
.desc = Contains two restock boxes for a CircuitVend vending machine.

ent-CrateVendingMachineRestockCuddlyCritterVendFilled = CuddlyCritterVend restock crate
.desc = Contains two restock boxes for a CuddlyCritterVend vending machine.
2 changes: 2 additions & 0 deletions Resources/Prototypes/Catalog/Fills/Crates/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@
- id: ClothingHeadBandRed
- id: FoamCutlass
amount: 2
- id: ClothingEyesEyepatch
amount: 2

- type: entity
id: CrateFunToyBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
FoodSnackSyndi: 3
DrinkRamen: 3
DrinkHellRamen: 2

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
DrinkDrGibbCan: 3
DrinkFourteenLokoCan: 3
emaggedInventory:
DrinkNukieCan: 3
DrinkChangelingStingCan: 3
DrinkNukieCan: 2
DrinkChangelingStingCan: 2
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/nothing.rsi
- type: MarketPrice
price: 1

- type: entity
parent: DrinkGlassBase
Expand Down Expand Up @@ -2155,7 +2157,7 @@
- Trash
- type: SpaceGarbage
- type: StaticPrice
price: 7.5
price: 5.5

- type: entity
parent: DrinkRamen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
- type: StaticPrice
price: 5.5


- type: entity
parent: DrinkCanBaseFull
id: DrinkColaCan
Expand Down Expand Up @@ -321,6 +322,8 @@
sprite: Objects/Consumable/Drinks/robustnukie.rsi
- type: Item
sprite: Objects/Consumable/Drinks/robustnukie.rsi
- type: StaticPrice
price: 20

- type: entity
parent: DrinkCanBaseFull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Blunt: 0
- type: ItemCooldown
- type: StaticPrice
price: 4.5
price: 4

- type: entity
parent: DrinkBaseCup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- type: PhysicalComposition
materialComposition:
Steel: 50
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -29,7 +31,7 @@
- type: TrashOnEmpty
solution: drink
- type: StaticPrice
price: 12.5
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -40,6 +42,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/detflask.rsi
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -50,6 +54,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/flask.rsi
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -60,6 +66,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/barflask.rsi
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -70,6 +78,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/flask_old.rsi
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -80,6 +90,8 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/lithiumflask.rsi
- type: StaticPrice
price: 7

- type: entity
parent: DrinkBase
Expand All @@ -90,3 +102,5 @@
- type: Drink
- type: Sprite
sprite: Objects/Consumable/Drinks/vacuumflask.rsi
- type: StaticPrice
price: 7
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
sprite: Objects/Consumable/Food/Baked/donut.rsi
size: 1
- type: StaticPrice
price: 12
price: 5

# Tastes like donut.

# The sprinkles are now an overlay, so you can put them on any donut! If we really
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
- box5
- pink-box6
- type: Appearance
- type: StaticPrice
price: 12

# Egg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
materialComposition:
Plastic: 50
- type: StaticPrice
price: 4.5
price: 1
- type: MarketPrice
price: 5

- type: entity
parent: BaseFoodCondimentPacket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
Glass: 100
- type: SpaceGarbage
- type: StaticPrice
price: 3
price: 2
- type: MarketPrice
price: 10

- type: entity
name: broken plate
Expand All @@ -66,6 +68,8 @@
- type: SpaceGarbage
- type: StaticPrice
price: 1
- type: MarketPrice
price: 5

# Small Plate

Expand Down Expand Up @@ -97,6 +101,8 @@
acts: [ "Destruction" ]
- type: StaticPrice
price: 2
- type: MarketPrice
price: 10

- type: entity
parent: FoodPlateTrash
Expand All @@ -105,6 +111,8 @@
- type: Sprite
sprite: Objects/Consumable/Food/plates.rsi
state: plate-small-trash
- type: StaticPrice
price: 1

# Plastic Plate

Expand All @@ -122,6 +130,8 @@
- Trash
- type: StaticPrice
price: 1
- type: MarketPrice
price: 5

- type: entity
name: plastic plate
Expand All @@ -137,6 +147,8 @@
- Trash
- type: StaticPrice
price: 1
- type: MarketPrice
price: 5

# Pie Tin

Expand Down
Loading
Loading