Skip to content

Commit

Permalink
Fixes being able to vend infinite alcohol (#5305)
Browse files Browse the repository at this point in the history
# About the pull request

Fixes #5291.
This was caused by the booze vendor returning a brand new list of
products every time something asked for them with
`get_listed_products()`, rather than making a single list when
initialised in `populate_product_list()` and returning that.

I also edited the `get_listed_products()` proc of the 'Experimental
Tools' vendor (fancy synth items), since it seemed to be the only one
not returning a global list.
*(I feel like those would all be better as static variables on each
vendor, but there's probably a good reason that they're not.)*

# Explain why it's good for the game

Infinite booze is... bad? 🤔

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: Fixed being able to vend infinite alcohol.
/:cl:
  • Loading branch information
SabreML authored Dec 26, 2023
1 parent 6f4a3bf commit 12d3107
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
26 changes: 14 additions & 12 deletions code/game/machinery/vending/vendor_types/crew/synthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,20 @@ GLOBAL_LIST_INIT(cm_vending_clothing_synth_snowflake, list(
return ..()

/obj/structure/machinery/cm_vending/own_points/experimental_tools/get_listed_products(mob/user)
return list(
list("Autocompressor", 15, /obj/item/clothing/suit/auto_cpr, null, VENDOR_ITEM_REGULAR),
list("Backpack Firefighting Watertank", 15, /obj/item/reagent_container/glass/watertank/atmos, null, VENDOR_ITEM_REGULAR),
list("Breaching Hammer", 15, /obj/item/weapon/twohanded/breacher/synth, null, VENDOR_ITEM_REGULAR),
list("Compact Defibrillator", 15, /obj/item/device/defibrillator/compact, null, VENDOR_ITEM_REGULAR),
list("Compact Nailgun kit", 15, /obj/effect/essentials_set/cnailgun, null, VENDOR_ITEM_REGULAR),
list("Crew Monitor", 15, /obj/item/tool/crew_monitor, null, VENDOR_ITEM_REGULAR),
list("Experimental Meson Goggles", 15, /obj/item/clothing/glasses/night/experimental_mesons, null, VENDOR_ITEM_REGULAR),
list("Maintenance Jack", 15, /obj/item/maintenance_jack, null, VENDOR_ITEM_REGULAR),
list("Portable Dialysis Machine", 15, /obj/item/tool/portadialysis, null, VENDOR_ITEM_REGULAR),
list("Telescopic Baton", 15, /obj/item/weapon/telebaton, null, VENDOR_ITEM_REGULAR),
)
return GLOB.cm_vending_synth_tools

GLOBAL_LIST_INIT(cm_vending_synth_tools, list(
list("Autocompressor", 15, /obj/item/clothing/suit/auto_cpr, null, VENDOR_ITEM_REGULAR),
list("Backpack Firefighting Watertank", 15, /obj/item/reagent_container/glass/watertank/atmos, null, VENDOR_ITEM_REGULAR),
list("Breaching Hammer", 15, /obj/item/weapon/twohanded/breacher/synth, null, VENDOR_ITEM_REGULAR),
list("Compact Defibrillator", 15, /obj/item/device/defibrillator/compact, null, VENDOR_ITEM_REGULAR),
list("Compact Nailgun kit", 15, /obj/effect/essentials_set/cnailgun, null, VENDOR_ITEM_REGULAR),
list("Crew Monitor", 15, /obj/item/tool/crew_monitor, null, VENDOR_ITEM_REGULAR),
list("Experimental Meson Goggles", 15, /obj/item/clothing/glasses/night/experimental_mesons, null, VENDOR_ITEM_REGULAR),
list("Maintenance Jack", 15, /obj/item/maintenance_jack, null, VENDOR_ITEM_REGULAR),
list("Portable Dialysis Machine", 15, /obj/item/tool/portadialysis, null, VENDOR_ITEM_REGULAR),
list("Telescopic Baton", 15, /obj/item/weapon/telebaton, null, VENDOR_ITEM_REGULAR),
))

//------------EXPERIMENTAL TOOL KITS---------------
/obj/effect/essentials_set/cnailgun
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/vending/vendor_types/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
unslashable = FALSE
wrenchable = TRUE

/obj/structure/machinery/cm_vending/sorted/boozeomat/get_listed_products(mob/user)
return list(
/obj/structure/machinery/cm_vending/sorted/boozeomat/populate_product_list(scale)
listed_products = list(
list("ALCOHOL", -1, null, null),
list("Ale", 6, /obj/item/reagent_container/food/drinks/cans/ale, VENDOR_ITEM_REGULAR),
list("Beer", 6, /obj/item/reagent_container/food/drinks/cans/beer, VENDOR_ITEM_REGULAR),
Expand Down Expand Up @@ -97,8 +97,8 @@
unslashable = FALSE
wrenchable = TRUE

/obj/structure/machinery/cm_vending/sorted/boozeomat/chess/get_listed_products(mob/user)
return list(
/obj/structure/machinery/cm_vending/sorted/boozeomat/chess/populate_product_list(scale)
listed_products = list(
list("White Pieces", -1, null, null),
list("Pawn", 2, /obj/item/reagent_container/food/drinks/bottle/vodka/chess/w_pawn, VENDOR_ITEM_REGULAR),
list("Bishop", 2, /obj/item/reagent_container/food/drinks/bottle/vodka/chess/w_bishop, VENDOR_ITEM_REGULAR),
Expand Down

0 comments on commit 12d3107

Please sign in to comment.