Limit dispenser importing to specific jobs (#18805)

* Limit dispenser importing to specific jobs

This change is designed to encourage people playing specific jobs to set up their dispensers how they like, and slow down other people who may try to do that job from under them by requiring them to do it manually. Therefore chemists and bartenders can import a list of recipes into their respective dispensers, but a medical doctor can't rush in and immediately print their favourite 7 bottles before the chemist even walks in the door.

* Fix nulls
This commit is contained in:
SatinIsle
2025-12-08 20:23:08 +00:00
committed by CHOMPStation2StaffMirrorBot
parent 50d9481fa2
commit 65aa2cbdc7
5 changed files with 15 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
ui_title = "Premium Drink Dispensary"
accept_drinking = 1
var/max_cartridges = 90
import_job = null
/obj/machinery/chemical_dispenser/premium/full
spawn_cartridges = list(

View File

@@ -25,6 +25,7 @@
var/list/recording_recipe
/// Saves all the recipes recorded by the machine
var/list/saved_recipes = list()
var/import_job = JOB_CHEMIST
/obj/machinery/chemical_dispenser/Initialize(mapload)
. = ..()
@@ -203,6 +204,9 @@
. = TRUE
if("import_config")
if(import_job && (ui.user.mind.assigned_role != import_job))
to_chat(ui.user, span_warning("This option is only available to the job: [import_job]"))
return FALSE
var/list/our_data = params["config"]
if(!islist(our_data))
return FALSE

View File

@@ -64,6 +64,7 @@
icon_state = "soda_dispenser"
ui_title = "Soda Dispenser"
accept_drinking = 1
import_job = JOB_BARTENDER
/obj/machinery/chemical_dispenser/bar_soft/full
spawn_cartridges = list(
@@ -95,6 +96,7 @@
icon_state = "booze_dispenser"
ui_title = "Booze Dispenser"
accept_drinking = 1
import_job = JOB_BARTENDER
/obj/machinery/chemical_dispenser/bar_alc/full
spawn_cartridges = list(
@@ -127,6 +129,7 @@
icon_state = "coffee_dispenser"
ui_title = "Coffee Dispenser"
accept_drinking = 1
import_job = JOB_BARTENDER
/obj/machinery/chemical_dispenser/bar_coffee/full
spawn_cartridges = list(

View File

@@ -4,6 +4,7 @@
dispense_reagents = list(
REAGENT_ID_WATER, REAGENT_ID_SUGAR, REAGENT_ID_ETHANOL, REAGENT_ID_RADIUM, REAGENT_ID_AMMONIA, REAGENT_ID_DIETHYLAMINE, REAGENT_ID_PLANTBGONE, REAGENT_ID_MUTAGEN, REAGENT_ID_CALCIUM
)
import_job = JOB_XENOBOTANIST
/obj/machinery/chemical_dispenser/xenoflora/full
spawn_cartridges = list(
@@ -24,6 +25,7 @@
dispense_reagents = list(
REAGENT_ID_NUTRIMENT, REAGENT_ID_PROTEIN, REAGENT_ID_MILK
)
import_job = null
/obj/machinery/chemical_dispenser/biochemistry/full
spawn_cartridges = list(
@@ -32,6 +34,9 @@
/obj/item/reagent_containers/chem_disp_cartridge/milk
)
/obj/machinery/chemical_dispenser/ert/specialops
import_job = null
/obj/machinery/chemical_dispenser/ert/specialops
spawn_cartridges = list(
/obj/item/reagent_containers/chem_disp_cartridge/inaprov,
@@ -70,3 +75,4 @@
name = "chemical dispenser"
icon_state = "dispenser_2way"
desc = "A mysterious machine which can fabricate many chemicals."
import_job = null

View File

@@ -438,6 +438,7 @@
icon_state = "kettle"
ui_title = "kettle"
accept_drinking = 1
import_job = null
/obj/machinery/chemical_dispenser/kettle/full
spawn_cartridges = list(