Files
Bubberstation/code/game/objects/items/vending_items.dm
SkyratBot 6221130798 [MIRROR] Arcargo: Vendor Cargo and Vending Machine Update (#26782)
* Arcargo: Vendor Cargo and Vending Machine Update (#81582)

Another one.

## About The Pull Request
This pull request originally had a design doc that @ Fikou and I worked
on, but that was never really polished up for publishing quality so I'll
forgo it for now and be as descript as possible here.

### Core changes
- This pull request adds a new NTOS app to the game, the restock
tracker. The restock tracker shows a comprehensive list of vending
machines across the station, as long as there is a need for that vending
machine to get restocked.
- This has also been pre-installed into the cargo data disks.
(`/obj/item/computer_disk/quartermaster`)
- Vending machines now store a total of 20% of the cost of any purchase
made within themselves into a small pool of cash. This only applies to
premium and normal purchases, not to contraband, as they're technically
not sanctioned by the company.
- The restock tracker app will also track which vending machines have
the most credits stored internally inside them.
- By refilling a vending machine, the stored credits within are paid out
to any crewmember who goes and restocks the station, while also paying
out *half that amount to the cargo budget*, serving as a basic but
otherwise easy tertiary money making method on the same level of
complexity as doing bounties, with the added benefit of actually helping
to assist the station for jobs like... assistant.

![image](https://github.com/tgstation/tgstation/assets/41715314/59cee2d9-7e60-4733-8a76-d88fe5b8c3f2)

### Break Stuff
- Anyway, when you try and smash a vending machine open with a melee
weapon of choice, it can now pay out 50 credits at a time as a way to
make money at zero risk to yourself.
- ~~Except for the horrible risk to yourself.~~

![image](https://github.com/tgstation/tgstation/assets/41715314/23208bf0-8484-40b9-b753-0ffdb57d770f)

### Cargo Specific Changes
- Restock units may now be sold for a small profit as well, to
incentivize cargo to keep the station stocked further.
- The `STATION_TRAIT_VENDING_SHORTAGE` trait will now add a small amount
of existing credits into the vending machines on station, to incentivize
cargo to fix the issue during the round and not just push for an early
shuttle call. Or, more accurately, provide the crew with a money making
scheme to engage better with the station trait as it stands.

### This also refactors behavior on vending machines
- This pull request also finally changes it so that vending machines now
use the payment component, which as a consequence allows for the
following improvements:
* Vending machines may now pull from physical credits on your person,
not just requiring you to have money on your ID card.
* Vending machines may also use credits being pulled by the player
interacting with the vending machine, allowing for handless mobs to be
able to purchase items from a vending machine.
* Finally makes the "use-for-everything buying things component" used by
the most utilized component of the in-game economy, to reduce the
quantity of unique implementations of purchasing things in the code.
- Existing vending specific checks are retained on before handing off
behavior to the payment component, for behavior such as purchasing
cigarettes/alcohol under the age of 18/21.

Notes:
- Vending machines will lose their internal credits stored when
deconstructed, as a security measure.
- Vending machines will now show the total amount of credits that a mob
has on their person, combining physical credits as well as credits held
in their ID card to accurately portray their total wealth across the mob
in question.

## Why It's Good For The Game

First off, this is largely an excuse to move vending machine behavior
over to the payment component for the purposes to less code copy-paste,
and to try and make the implementation more wide-spread.

Second, this implements a new tertiary economy method to the game, in
the same design space as bounties, which serve as common methods of
making money without necessarily being specific to their job in
question, with the primary goal of providing small amounts of work to
the crew and a basic interaction with the economy system.

Additionally, it gives cargo more things they can do to assist the
station, and a way to know which parts of the station need support as a
result.
It improves the interaction between the vending shortage station trait
as well, making it a challenge with depth as opposed to a more
oppressive round change that players would rather reroll the game over.

Additionally, this makes a few price tweaks to vending restock modules
as well to help incentivize buying some of the more minor restock kits,
and a few select bumps on restocks that cover wide enough territory to
necessitate fewer restocks.

* Arcargo: Vendor Cargo and Vending Machine Update

---------

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
2024-03-06 22:29:57 -05:00

66 lines
1.7 KiB
Plaintext

/*
Vending machine refills can be found at /code/modules/vending/ within each vending machine's respective file
*/
/obj/item/vending_refill
name = "resupply canister"
var/machine_name = "Generic"
icon = 'icons/obj/vending_restock.dmi'
icon_state = "refill_snack"
inhand_icon_state = "restock_unit"
desc = "A vending machine restock cart."
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
obj_flags = CONDUCTS_ELECTRICITY
force = 7
throwforce = 10
throw_speed = 1
throw_range = 7
w_class = WEIGHT_CLASS_BULKY
armor_type = /datum/armor/item_vending_refill
/**
* Built automatically from the corresponding vending machine.
* If null, considered to be full. Otherwise, is list(/typepath = amount).
*/
var/list/products
var/list/product_categories
var/list/contraband
var/list/premium
/datum/armor/item_vending_refill
fire = 70
acid = 30
/obj/item/vending_refill/Initialize(mapload)
. = ..()
name = "\improper [machine_name] restocking unit"
/obj/item/vending_refill/examine(mob/user)
. = ..()
var/num = get_part_rating()
if (num == INFINITY)
. += "It's sealed tight, completely full of supplies."
else if (num == 0)
. += "It's empty!"
else
. += "It can restock [num] item\s."
/obj/item/vending_refill/get_part_rating()
if (!products || !product_categories || !contraband || !premium)
return INFINITY
. = 0
for(var/key in products)
. += products[key]
for(var/key in contraband)
. += contraband[key]
for(var/key in premium)
. += premium[key]
for (var/list/category as anything in product_categories)
var/list/products = category["products"]
for (var/product_key in products)
. += products[product_key]
return .