From 7bd966b4cb55447caee3ec9074bf2ffdc37c6683 Mon Sep 17 00:00:00 2001 From: Goat <126099705+Goat-Real@users.noreply.github.com> Date: Sun, 16 Jun 2024 22:42:36 -0600 Subject: [PATCH] Allows fire extinguishers to refill from plumbed tanks (#84004) ## About The Pull Request Changes `tanktype` to be a list and `AttemptRefill` to properly check for a list. Also adds a `has_reagent` check to `AttemptRefill` to prevent people from converting a fuel tank to plumbed to refill a fire extinguisher with welding fuel. ## Why It's Good For The Game People be allowed to refill fire extinguishers from the plumbed variant of tanks. Also I thought it would be funny if we could refill extinguishers from water coolers. fix: #68174 ## Changelog :cl: Goat qol: fire extinguishers can now be filled via stationary tanks. (and water coolers) /:cl: --- code/game/objects/items/extinguisher.dm | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/extinguisher.dm b/code/game/objects/items/extinguisher.dm index be47d700905..ac309e275d7 100644 --- a/code/game/objects/items/extinguisher.dm +++ b/code/game/objects/items/extinguisher.dm @@ -32,7 +32,11 @@ /// Can we refill this at a water tank? var/refilling = FALSE /// What tank we need to refill this. - var/tanktype = /obj/structure/reagent_dispensers/watertank + var/tanktypes = list( + /obj/structure/reagent_dispensers/watertank, + /obj/structure/reagent_dispensers/plumbed, + /obj/structure/reagent_dispensers/water_cooler, + ) /// something that should be replaced with base_icon_state var/sprite_name = "fire_extinguisher" /// Maximum distance launched water will travel. @@ -131,7 +135,10 @@ tank_holder_icon_state = "holder_foam_extinguisher" dog_fashion = null chem = /datum/reagent/firefighting_foam - tanktype = /obj/structure/reagent_dispensers/foamtank + tanktypes = list( + /obj/structure/reagent_dispensers/foamtank, + /obj/structure/reagent_dispensers/plumbed, + ) sprite_name = "foam_extinguisher" precision = TRUE max_water = 100 @@ -178,10 +185,14 @@ . += span_notice("Alt-click to empty it.") /obj/item/extinguisher/proc/AttemptRefill(atom/target, mob/user) - if(istype(target, tanktype) && target.Adjacent(user)) + if(is_type_in_list(target, tanktypes) && target.Adjacent(user)) if(reagents.total_volume == reagents.maximum_volume) balloon_alert(user, "already full!") return TRUE + // Make sure we're refilling with the proper chem. + if(!(target.reagents.has_reagent(chem))) + balloon_alert(user, "can't refill with this liquid!") + return TRUE var/obj/structure/reagent_dispensers/W = target //will it work? var/transferred = W.reagents.trans_to(src, max_water, transferred_by = user) if(transferred > 0) @@ -305,5 +316,8 @@ name = "fire extender" desc = "A traditional red fire extinguisher. Made in Britain... wait, what?" chem = /datum/reagent/fuel - tanktype = /obj/structure/reagent_dispensers/fueltank + tanktypes = list( + /obj/structure/reagent_dispensers/fueltank, + /obj/structure/reagent_dispensers/plumbed + ) cooling_power = 0