Storage tanks fill levels (#23005)

# Summary

This PR adds visual fill levels for fuel, extinguisher, water, cooking
oil and lube tanks.
The cooking oil tank now is also persistent and was added to the cargo
order manifest.

Sprites by @alsoandanswer 

## Preview

<img width="404" height="472" alt="image"
src="https://github.com/user-attachments/assets/4ff4a0dd-e790-4a63-bc1a-6e198199ee7c"
/>
This commit is contained in:
FabianK3
2026-08-08 10:22:15 +00:00
committed by GitHub
parent 3ad98267bc
commit 4770cc0739
9 changed files with 75 additions and 40 deletions
+14
View File
@@ -26,6 +26,20 @@
groupable = TRUE
spawn_amount = 1
/singleton/cargo_item/cookingoil
category = "miscellaneous"
name = "cooking oil tank"
supplier = "orion"
description = "A tank filled with cooking oil."
price = 450
items = list(
/obj/structure/reagent_dispensers/cookingoil
)
access = 0
container_type = "box"
groupable = TRUE
spawn_amount = 1
/singleton/cargo_item/sculptingblock
category = "miscellaneous"
name = "sculpting block"
@@ -331,15 +331,6 @@ STOCK_ITEM_UNCOMMON(bang, 0.5)
var/obj/item/gun/bang/B = pick(subtypesof(/obj/item/gun/bang))
new B(L)
STOCK_ITEM_UNCOMMON(cookingoil, 1)
var/turf/T = get_turf(L)
if(!turf_clear(T))
for(var/turf/U in range(T,1))
if(turf_clear(U))
T = U
break
new /obj/structure/reagent_dispensers/cookingoil(T)
STOCK_ITEM_UNCOMMON(coin, 1.3)
new /obj/random/coin(L)
if(prob(20))
+49 -2
View File
@@ -2,7 +2,7 @@
name = "strange dispenser"
desc = "What the fuck is this?"
icon = 'icons/obj/reagent_dispensers.dmi'
icon_state = "watertank"
icon_state = "watertank" // Mapping icon
density = 1
anchored = 0
maxhealth = OBJECT_HEALTH_HIGH
@@ -12,6 +12,7 @@
var/capacity = 1000
var/can_tamper = TRUE
var/is_leaking = FALSE
var/has_fill_levels = FALSE // Features base underlay and overlays for 100%, 80%, 60%, 40%, 20% fill levels
var/is_persistent = FALSE
/obj/structure/reagent_dispensers/mechanics_hints(mob/user, distance, is_adjacent)
@@ -29,11 +30,49 @@
/obj/structure/reagent_dispensers/Initialize()
. = ..()
if(has_fill_levels)
icon_state = "[icon_state]_underlay" // Replace mapping icon with underlay version for fill level overlay
create_reagents(capacity)
if (!possible_transfer_amounts)
src.verbs -= /obj/structure/reagent_dispensers/verb/set_APTFT
if(is_persistent)
SSpersistence.objectsRegisterTrack(src)
update_icon()
/obj/structure/reagent_dispensers/update_icon()
if(!has_fill_levels)
return
ClearOverlays()
var/level = reagents.total_volume / capacity
var/fill_level_overlay = null
if(level <= 1.0)
fill_level_overlay = "_100"
if(level <= 0.8)
fill_level_overlay = "_80"
if(level <= 0.6)
fill_level_overlay = "_60"
if(level <= 0.4)
fill_level_overlay = "_40"
if(level <= 0.2)
fill_level_overlay = "_20"
if(level == 0)
fill_level_overlay = null
if(fill_level_overlay)
AddOverlays("[initial(icon_state)][fill_level_overlay]")
. = ..()
// Debug verb, uncomment if you are in need to adjust a lot of tanks
// /obj/structure/reagent_dispensers/verb/adjust_regeant_total_volume()
// set name = "Set reagent total volume"
// set category = "Object"
// set src in view(1)
// var/x = tgui_input_number(usr, "Select the total reagent amount for this. ", "[src]", capacity, capacity, 0)
// if (x)
// reagents.total_volume = x
// update_icon()
/obj/structure/reagent_dispensers/persistent_objects_get_content()
var/list/content = ..()
@@ -70,8 +109,8 @@
qdel(src)
/obj/structure/reagent_dispensers/attackby(obj/item/attacking_item, mob/user)
var/obj/item/reagent_containers/RG = attacking_item
if (istype(RG))
if(!user.Adjacent(src)) return
if(RG.loc != user && !isrobot(user)) return
@@ -89,6 +128,7 @@
RG.standard_pour_into(user,src)
else
to_chat(user,SPAN_NOTICE("The inlet cap on \the [src] is wrenched on tight!"))
update_icon()
if (attacking_item.tool_behaviour == TOOL_WRENCH)
if(use_check(user, USE_DISALLOW_SPECIALS))
@@ -121,6 +161,7 @@
var/splash_amount = min(amount_per_transfer_from_this,60) //Hard limit of 60 per process
reagents.trans_to_turf(get_turf(src),splash_amount)
update_icon()
/obj/structure/reagent_dispensers/on_death(damage, damage_flags, damage_type, armor_penetration, obj/weapon)
if(!should_use_health)
@@ -139,6 +180,7 @@
icon_state = "extinguisher_tank"
amount_per_transfer_from_this = 150 // Same volume as extinguisher refillers, quality of life value
reagents_to_add = list(/singleton/reagent/toxin/fertilizer/monoammoniumphosphate = 1000)
has_fill_levels = TRUE
is_persistent = TRUE
// Tanks
@@ -148,6 +190,7 @@
icon_state = "watertank"
amount_per_transfer_from_this = 300
reagents_to_add = list(/singleton/reagent/water = 1000)
has_fill_levels = TRUE
is_persistent = TRUE
/obj/structure/reagent_dispensers/lube
@@ -155,6 +198,7 @@
desc = "A tank filled with a silly amount of lube."
icon_state = "lubetank"
amount_per_transfer_from_this = 30
has_fill_levels = TRUE
reagents_to_add = list(/singleton/reagent/lube = 1000)
/obj/structure/reagent_dispensers/fueltank
@@ -167,6 +211,7 @@
var/armed = 0
var/obj/item/assembly_holder/rig = null
reagents_to_add = list(/singleton/reagent/fuel = 1000)
has_fill_levels = TRUE
is_persistent = TRUE
/obj/structure/reagent_dispensers/fueltank/feedback_hints(mob/user, distance, is_adjacent)
@@ -474,6 +519,8 @@
amount_per_transfer_from_this = 120
capacity = 1000
reagents_to_add = list(/singleton/reagent/nutriment/triglyceride/oil/corn = 1000)
has_fill_levels = TRUE
is_persistent = TRUE
/obj/structure/reagent_dispensers/cookingoil/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit)
. = ..()