Files
Bubberstation/code/modules/vending/snack.dm
Roxy 87ebbba36a Refactor custom vending machine brand selection (#92205)
## About The Pull Request

The list of options you could choose from when screwdrivering a custom
vending machine circuit board was hard-coded and also contained copy
pastes of every vending machine name (some of which were outdated). It
was yucky
- Add a new var on `/obj/machinery/vending` called `allow_custom`,
defaults to FALSE and determines whether that type shows up as an option
when screwdrivering a custom vending machine board, I've went through
and made assignments for it mirror what was in the old static list i.e.
this won't introduce any new options
- Change the hard-coded static list to be built on Initialize,
populating with every subtype that has `allow_custom` set to TRUE
- Eliminate a second static list that was just the inverse of the first
one (first one was typepath = name and this one was just name =
typepath)
- Changed an `istype` check to `==` because old behavior meant subtypes
of a given vending machine would have their type set to the supertype if
that was also a valid custom vending machine option

## Why It's Good For The Game

Cleaner code, no needing to maintain two separate entries for the name
of a vending machine, eligibility for a machine to be used in custom
vending machines is now a var on the type instead of in a random file
pertaining to circuit boards

## Changelog
🆑
refactor: refactored custom vending machine brand code, a new var on
/obj/machinery/vending called allow_custom now determines whether the
machine can be chosen when screwdrivering the circuit board
/🆑
2025-07-30 01:11:24 +10:00

68 lines
2.2 KiB
Plaintext

/obj/machinery/vending/snack
name = "\improper Getmore Chocolate Corp"
desc = "A snack machine courtesy of the Getmore Chocolate Corporation, based out of Mars."
product_slogans = "Try our new nougat bar!;Twice the calories for half the price!"
product_ads = "The healthiest!;Award-winning chocolate bars!;Mmm! So good!;Oh my god it's so juicy!;Have a snack.;Snacks are good for you!;Have some more Getmore!;Best quality snacks straight from mars.;We love chocolate!;Try our new jerky!"
icon_state = "snack"
panel_type = "panel2"
light_mask = "snack-light-mask"
products = list(
/obj/item/food/spacetwinkie = 6,
/obj/item/food/cheesiehonkers = 6,
/obj/item/food/candy = 6,
/obj/item/food/chips = 6,
/obj/item/food/chips/shrimp = 6,
/obj/item/food/sosjerky = 6,
/obj/item/food/cornchips/random = 6,
/obj/item/food/sosjerky = 6,
/obj/item/food/no_raisin = 6,
/obj/item/food/peanuts = 6,
/obj/item/food/peanuts/random = 3,
/obj/item/food/cnds = 6,
/obj/item/food/cnds/random = 3,
/obj/item/food/semki = 6,
/obj/item/reagent_containers/cup/glass/dry_ramen = 3,
/obj/item/storage/box/gum = 3,
/obj/item/food/energybar = 6,
/obj/item/food/hot_shots = 6,
/obj/item/food/sticko = 6,
/obj/item/food/sticko/random = 3,
/obj/item/food/shok_roks = 6,
/obj/item/food/shok_roks/random = 3,
)
contraband = list(
/obj/item/food/syndicake = 6,
/obj/item/food/peanuts/ban_appeal = 3,
/obj/item/food/candy/bronx = 1,
)
premium = list(
/obj/item/food/spacers_sidekick = 3,
/obj/item/food/pistachios = 3,
/obj/item/food/swirl_lollipop = 3,
)
refill_canister = /obj/item/vending_refill/snack
req_access = list(ACCESS_KITCHEN)
default_price = PAYCHECK_CREW * 0.6
extra_price = PAYCHECK_CREW
payment_department = ACCOUNT_SRV
allow_custom = TRUE
/obj/item/vending_refill/snack
machine_name = "Getmore Chocolate Corp"
/obj/machinery/vending/snack/blue
icon_state = "snackblue"
allow_custom = FALSE
/obj/machinery/vending/snack/orange
icon_state = "snackorange"
allow_custom = FALSE
/obj/machinery/vending/snack/green
icon_state = "snackgreen"
allow_custom = FALSE
/obj/machinery/vending/snack/teal
icon_state = "snackteal"
allow_custom = FALSE