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
🆑 Goat
qol: fire extinguishers can now be filled via stationary tanks. (and
water coolers)
/🆑
This commit is contained in:
Goat
2024-06-17 04:42:36 +00:00
committed by GitHub
parent af86359446
commit 7bd966b4cb
+18 -4
View File
@@ -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