Skip to content

Commit ead9e47

Browse files
out-of-phazecomma
authored andcommitted
Unify floor turf reagent handling
1 parent 210eefd commit ead9e47

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

code/game/turfs/floors/_floor.dm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
if(floortype)
4545
set_flooring(GET_DECL(floortype), skip_update = TRUE)
4646

47-
if(fill_reagent_type && get_physical_height() < 0)
48-
add_to_reagents(fill_reagent_type, abs(height), phase = MAT_PHASE_LIQUID)
47+
fill_to_zero_height() // try to refill turfs that act as fluid sources
4948

5049
if(floor_material || get_topmost_flooring())
5150
if(ml)
@@ -71,6 +70,12 @@
7170
STOP_PROCESSING(SSobj, src)
7271
return ..()
7372

73+
/turf/floor/proc/fill_to_zero_height()
74+
var/my_height = get_physical_height()
75+
if(fill_reagent_type && my_height < 0 && (!reagents || !QDELING(reagents)) && reagents?.total_volume < abs(my_height))
76+
var/reagents_to_add = abs(my_height) - reagents?.total_volume
77+
add_to_reagents(fill_reagent_type, reagents_to_add, phase = MAT_PHASE_LIQUID)
78+
7479
/turf/floor/can_climb_from_below(var/mob/climber)
7580
return TRUE
7681

@@ -92,9 +97,9 @@
9297

9398
/turf/floor/on_reagent_change()
9499
. = ..()
95-
var/my_height = get_physical_height()
96-
if(!QDELETED(src) && fill_reagent_type && my_height < 0 && !QDELETED(reagents) && reagents.total_volume < abs(my_height))
97-
add_to_reagents(fill_reagent_type, abs(my_height) - reagents.total_volume)
100+
if(!QDELETED(src))
101+
fill_to_zero_height()
102+
update_floor_strings()
98103

99104
/turf/floor/proc/set_base_flooring(new_base_flooring, skip_update)
100105
if(ispath(new_base_flooring, /decl/flooring))

0 commit comments

Comments
 (0)