From b13f03bcda07bf56a1dc6b8dfe220ede3db05840 Mon Sep 17 00:00:00 2001 From: Will <7099514+Willburd@users.noreply.github.com> Date: Thu, 26 Mar 2026 23:20:52 -0400 Subject: [PATCH] Trolley tanker draining fix, and memory savings (#19341) * fix trolly tankers and don't make lists on everything * a better solution * same line * fix those too * moved to correct file --- code/__defines/reagents.dm | 3 ++ code/_helpers/global_lists.dm | 38 +++++++++++++++++++ code/modules/detectivework/tools/rag.dm | 2 +- .../reagents/reagent_containers/glass.dm | 37 ++---------------- vorestation.dme | 1 + 5 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 code/__defines/reagents.dm diff --git a/code/__defines/reagents.dm b/code/__defines/reagents.dm new file mode 100644 index 0000000000..c0c3d62588 --- /dev/null +++ b/code/__defines/reagents.dm @@ -0,0 +1,3 @@ +#define REAGENT_CONTAINER_CAN_BE_PLACED_INTO_DEFAULT "default_container" +#define REAGENT_CONTAINER_CAN_BE_PLACED_INTO_WATERCOOLER "watercooler_container" +#define REAGENT_CONTAINER_CAN_BE_PLACED_INTO_NONE "forbidden_container" diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 03c4c07ba1..47554e0571 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -416,6 +416,44 @@ GLOBAL_LIST_INIT(obtainable_chemical_blacklist, list( REAGENT_ID_SUPERMATTER )) +GLOBAL_LIST_INIT(reagent_containers_can_be_placed_into, list( + REAGENTCONTAINER_CANBEPLACED_DEFAULT = list( + /obj/machinery/chem_master, + /obj/machinery/chemical_dispenser, + /obj/machinery/reagentgrinder, + /obj/structure/table, + /obj/structure/closet, + /obj/structure/sink, + /obj/item/storage, + /obj/machinery/atmospherics/unary/cryo_cell, + /obj/machinery/dna_scannernew, + /obj/item/grenade/chem_grenade, + /mob/living/bot/medbot, + /obj/item/storage/secure/safe, + /obj/machinery/iv_drip, + /obj/structure/medical_stand, + /obj/machinery/disposal, + /mob/living/simple_mob/animal/passive/cow, + /mob/living/simple_mob/animal/goat, + /obj/machinery/sleeper, + /obj/machinery/smartfridge, + /obj/machinery/biogenerator, + /obj/structure/frame, + /obj/machinery/radiocarbon_spectrometer, + /obj/machinery/portable_atmospherics/powered/reagent_distillery, + /obj/machinery/computer/pandemic, + /obj/machinery/reagent_refinery, + /obj/vehicle/train/trolley_tank, + ), + REAGENTCONTAINER_CANBEPLACED_WATERCOOLER = list( + /obj/structure/table, + /obj/structure/closet, + /obj/structure/sink + ), + REAGENT_CONTAINER_CAN_BE_PLACED_INTO_NONE = list( + ), +)) + GLOBAL_LIST_EMPTY(item_tf_spawnpoints) // Global variable tracking which items are item tf spawnpoints // Options for transforming into a different mob in virtual reality. diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index f5a4f5e23b..6c21f7c450 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -20,8 +20,8 @@ amount_per_transfer_from_this = 5 max_transfer_amount = 5 volume = 10 - can_be_placed_into = null flags = OPENCONTAINER | NOBLUDGEON + container_can_be_placed_into = REAGENT_CONTAINER_CAN_BE_PLACED_INTO_NONE unacidable = FALSE drop_sound = 'sound/items/drop/cloth.ogg' pickup_sound = 'sound/items/pickup/cloth.ogg' diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index a0de4a0dcb..4125862ffb 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -23,35 +23,9 @@ var/label_text = "" + var/container_can_be_placed_into = REAGENT_CONTAINER_CAN_BE_PLACED_INTO_DEFAULT var/list/prefill = null //Reagents to fill the container with on New(), formatted as "reagentID" = quantity - var/list/can_be_placed_into = list( - /obj/machinery/chem_master/, - /obj/machinery/chemical_dispenser, - /obj/machinery/reagentgrinder, - /obj/structure/table, - /obj/structure/closet, - /obj/structure/sink, - /obj/item/storage, - /obj/machinery/atmospherics/unary/cryo_cell, - /obj/machinery/dna_scannernew, - /obj/item/grenade/chem_grenade, - /mob/living/bot/medbot, - /obj/item/storage/secure/safe, - /obj/machinery/iv_drip, - /obj/structure/medical_stand, - /obj/machinery/disposal, - /mob/living/simple_mob/animal/passive/cow, - /mob/living/simple_mob/animal/goat, - /obj/machinery/sleeper, - /obj/machinery/smartfridge/, - /obj/machinery/biogenerator, - /obj/structure/frame, - /obj/machinery/radiocarbon_spectrometer, - /obj/machinery/portable_atmospherics/powered/reagent_distillery, - /obj/machinery/computer/pandemic - ) - ///Var for attack_self chain var/special_handling = FALSE @@ -138,7 +112,7 @@ /obj/item/reagent_containers/glass/afterattack(var/obj/target, var/mob/user, var/proximity) if(!proximity || !is_open_container()) //Is the container open & are they next to whatever they're clicking? return 1 //If not, do nothing. - for(var/type in can_be_placed_into) //Is it something it can be placed into? + for(var/type in GLOB.reagent_containers_can_be_placed_into[container_can_be_placed_into]) //Is it something it can be placed into? if(istype(target, type)) return 1 if(standard_dispenser_refill(user, target)) //Are they clicking a water tank/some dispenser? @@ -421,12 +395,7 @@ max_transfer_amount = 120 volume = 2000 slowdown = 2 - - can_be_placed_into = list( - /obj/structure/table, - /obj/structure/closet, - /obj/structure/sink - ) + container_can_be_placed_into = REAGENT_CONTAINER_CAN_BE_PLACED_INTO_WATERCOOLER /obj/item/reagent_containers/glass/pint_mug desc = "A rustic pint mug designed for drinking ale." diff --git a/vorestation.dme b/vorestation.dme index 50fb469552..b925c90258 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -161,6 +161,7 @@ #include "code\__defines\qdel.dm" #include "code\__defines\radiation.dm" #include "code\__defines\radio.dm" +#include "code\__defines\reagents.dm" #include "code\__defines\recipe.dm" #include "code\__defines\refinery.dm" #include "code\__defines\request_console.dm"