mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Merge pull request #1374 from yogstation13/upstream-merge-38549
[MIRROR] Improve how vending machine restocking works
This commit is contained in:
@@ -215,37 +215,36 @@
|
||||
name = "Booze-O-Mat Vendor (Machine Board)"
|
||||
desc = "You can turn the \"brand selection\" dial using a screwdriver."
|
||||
build_path = /obj/machinery/vending/boozeomat
|
||||
req_components = list(
|
||||
/obj/item/vending_refill/boozeomat = 3)
|
||||
req_components = list(/obj/item/vending_refill/boozeomat = 1)
|
||||
|
||||
var/static/list/vending_names_paths = list(/obj/machinery/vending/boozeomat = "Booze-O-Mat",
|
||||
/obj/machinery/vending/coffee = "Solar's Best Hot Drinks",
|
||||
/obj/machinery/vending/snack = "Getmore Chocolate Corp",
|
||||
/obj/machinery/vending/cola = "Robust Softdrinks",
|
||||
/obj/machinery/vending/cigarette = "ShadyCigs Deluxe",
|
||||
/obj/machinery/vending/games = "\improper Good Clean Fun",
|
||||
/obj/machinery/vending/autodrobe = "AutoDrobe",
|
||||
/obj/machinery/vending/wardrobe/sec_wardrobe = "SecDrobe",
|
||||
/obj/machinery/vending/wardrobe/medi_wardrobe = "MediDrobe",
|
||||
/obj/machinery/vending/wardrobe/engi_wardrobe = "EngiDrobe",
|
||||
/obj/machinery/vending/wardrobe/atmos_wardrobe = "AtmosDrobe",
|
||||
/obj/machinery/vending/wardrobe/cargo_wardrobe = "CargoDrobe",
|
||||
/obj/machinery/vending/wardrobe/robo_wardrobe = "RoboDrobe",
|
||||
/obj/machinery/vending/wardrobe/science_wardrobe = "SciDrobe",
|
||||
/obj/machinery/vending/wardrobe/hydro_wardrobe = "HyDrobe",
|
||||
/obj/machinery/vending/wardrobe/curator_wardrobe = "CuraDrobe",
|
||||
/obj/machinery/vending/wardrobe/bar_wardrobe = "BarDrobe",
|
||||
/obj/machinery/vending/wardrobe/chef_wardrobe = "ChefDrobe",
|
||||
/obj/machinery/vending/wardrobe/jani_wardrobe = "JaniDrobe",
|
||||
/obj/machinery/vending/wardrobe/law_wardrobe = "LawDrobe",
|
||||
/obj/machinery/vending/wardrobe/chap_wardrobe = "ChapDrobe",
|
||||
/obj/machinery/vending/wardrobe/chem_wardrobe = "ChemDrobe",
|
||||
/obj/machinery/vending/wardrobe/gene_wardrobe = "GeneDrobe",
|
||||
/obj/machinery/vending/wardrobe/viro_wardrobe = "ViroDrobe",
|
||||
/obj/machinery/vending/clothing = "ClothesMate",
|
||||
/obj/machinery/vending/medical = "NanoMed Plus",
|
||||
/obj/machinery/vending/wallmed = "NanoMed")
|
||||
needs_anchored = FALSE
|
||||
var/static/list/vending_names_paths = list(
|
||||
/obj/machinery/vending/boozeomat = "Booze-O-Mat",
|
||||
/obj/machinery/vending/coffee = "Solar's Best Hot Drinks",
|
||||
/obj/machinery/vending/snack = "Getmore Chocolate Corp",
|
||||
/obj/machinery/vending/cola = "Robust Softdrinks",
|
||||
/obj/machinery/vending/cigarette = "ShadyCigs Deluxe",
|
||||
/obj/machinery/vending/games = "\improper Good Clean Fun",
|
||||
/obj/machinery/vending/autodrobe = "AutoDrobe",
|
||||
/obj/machinery/vending/wardrobe/sec_wardrobe = "SecDrobe",
|
||||
/obj/machinery/vending/wardrobe/medi_wardrobe = "MediDrobe",
|
||||
/obj/machinery/vending/wardrobe/engi_wardrobe = "EngiDrobe",
|
||||
/obj/machinery/vending/wardrobe/atmos_wardrobe = "AtmosDrobe",
|
||||
/obj/machinery/vending/wardrobe/cargo_wardrobe = "CargoDrobe",
|
||||
/obj/machinery/vending/wardrobe/robo_wardrobe = "RoboDrobe",
|
||||
/obj/machinery/vending/wardrobe/science_wardrobe = "SciDrobe",
|
||||
/obj/machinery/vending/wardrobe/hydro_wardrobe = "HyDrobe",
|
||||
/obj/machinery/vending/wardrobe/curator_wardrobe = "CuraDrobe",
|
||||
/obj/machinery/vending/wardrobe/bar_wardrobe = "BarDrobe",
|
||||
/obj/machinery/vending/wardrobe/chef_wardrobe = "ChefDrobe",
|
||||
/obj/machinery/vending/wardrobe/jani_wardrobe = "JaniDrobe",
|
||||
/obj/machinery/vending/wardrobe/law_wardrobe = "LawDrobe",
|
||||
/obj/machinery/vending/wardrobe/chap_wardrobe = "ChapDrobe",
|
||||
/obj/machinery/vending/wardrobe/chem_wardrobe = "ChemDrobe",
|
||||
/obj/machinery/vending/wardrobe/gene_wardrobe = "GeneDrobe",
|
||||
/obj/machinery/vending/wardrobe/viro_wardrobe = "ViroDrobe",
|
||||
/obj/machinery/vending/clothing = "ClothesMate",
|
||||
/obj/machinery/vending/medical = "NanoMed Plus",
|
||||
/obj/machinery/vending/wallmed = "NanoMed")
|
||||
|
||||
/obj/item/circuitboard/machine/vendor/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
@@ -261,7 +260,7 @@
|
||||
/obj/item/circuitboard/machine/vendor/proc/set_type(obj/machinery/vending/typepath)
|
||||
build_path = typepath
|
||||
name = "[vending_names_paths[build_path]] Vendor (Machine Board)"
|
||||
req_components = list(initial(typepath.refill_canister) = initial(typepath.refill_count))
|
||||
req_components = list(initial(typepath.refill_canister) = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/vendor/apply_default_parts(obj/machinery/M)
|
||||
for(var/typepath in vending_names_paths)
|
||||
@@ -865,14 +864,14 @@
|
||||
build_path = /obj/machinery/vending/donksofttoyvendor
|
||||
req_components = list(
|
||||
/obj/item/stack/sheet/glass = 1,
|
||||
/obj/item/vending_refill/donksoft = 3)
|
||||
/obj/item/vending_refill/donksoft = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/vending/syndicatedonksofttoyvendor
|
||||
name = "Syndicate Donksoft Toy Vendor (Machine Board)"
|
||||
build_path = /obj/machinery/vending/toyliberationstation
|
||||
req_components = list(
|
||||
/obj/item/stack/sheet/glass = 1,
|
||||
/obj/item/vending_refill/donksoft = 3)
|
||||
/obj/item/vending_refill/donksoft = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/dish_drive
|
||||
name = "Dish Drive (Machine Board)"
|
||||
|
||||
@@ -18,19 +18,34 @@
|
||||
throw_range = 7
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 70, "acid" = 30)
|
||||
var/charges = list(0, 0, 0) //how many restocking "charges" the refill has for standard/contraband/coin products
|
||||
var/init_charges = list(0, 0, 0)
|
||||
|
||||
// Built automatically from the corresponding vending machine.
|
||||
// If null, considered to be full. Otherwise, is list(/typepath = amount).
|
||||
var/list/products
|
||||
var/list/contraband
|
||||
var/list/premium
|
||||
|
||||
/obj/item/vending_refill/New(amt = -1)
|
||||
..()
|
||||
/obj/item/vending_refill/Initialize(mapload)
|
||||
. = ..()
|
||||
name = "\improper [machine_name] restocking unit"
|
||||
if(isnum(amt) && amt > -1)
|
||||
charges[1] = amt
|
||||
|
||||
/obj/item/vending_refill/examine(mob/user)
|
||||
..()
|
||||
if(charges[1] > 0)
|
||||
to_chat(user, "It can restock [charges[1]+charges[2]+charges[3]] item(s).")
|
||||
var/num = get_part_rating()
|
||||
if (num == INFINITY)
|
||||
to_chat(user, "It's sealed tight, completely full of supplies.")
|
||||
else if (num == 0)
|
||||
to_chat(user, "It's empty!")
|
||||
else
|
||||
to_chat(user, "It's empty!")
|
||||
to_chat(user, "It can restock [num] item\s.")
|
||||
|
||||
/obj/item/vending_refill/get_part_rating()
|
||||
if (!products || !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]
|
||||
|
||||
Reference in New Issue
Block a user