Skip to content

Commit 1c50ca6

Browse files
authored
Scrubber overflows now use liquids (#2915)
* Scrubber overflows now use liquids * +50 to all reagent amounts (suggestion from borbop) * Overflows always evaporate * wtf??? * Buff evaporation rate
1 parent 6b632f8 commit 1c50ca6

File tree

6 files changed

+137
-78
lines changed

6 files changed

+137
-78
lines changed

code/__DEFINES/liquids.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@
8282

8383
GLOBAL_LIST_INIT(liquid_blacklist, list(
8484
/datum/reagent/sorium,
85-
/datum/reagent/liquid_dark_matter
85+
/datum/reagent/liquid_dark_matter,
86+
/datum/reagent/hydrogen_peroxide, // no instahusk pools please
8687
))

code/modules/events/scrubber_overflow.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
/datum/round_event/scrubber_overflow/proc/get_overflowing_reagent(dangerous)
106106
return dangerous ? get_random_reagent_id() : pick(safer_chems)
107107

108+
/* monkestation edit: replaced in [monkestation/code/modules/events/scrubber_overflow.dm]
108109
/datum/round_event/scrubber_overflow/start()
109110
for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/vent as anything in scrubbers)
110111
if(!vent.loc)
@@ -124,6 +125,7 @@
124125
dispensed_reagent.create_foam(/datum/effect_system/fluid_spread/foam/short, reagents_amount)
125126
126127
CHECK_TICK
128+
monkestation end */
127129

128130
/datum/round_event_control/scrubber_overflow/threatening
129131
name = "Scrubber Overflow: Threatening"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
1+
#define BASE_EVAPORATION_MULTIPLIER 10
2+
13
/datum/round_event_control/scrubber_overflow
24
shared_occurence_type = SHARED_SCRUBBERS
5+
6+
/datum/round_event/scrubber_overflow
7+
reagents_amount = 100
8+
var/evaporation_multiplier = BASE_EVAPORATION_MULTIPLIER
9+
10+
/datum/round_event/scrubber_overflow/start()
11+
for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/vent as anything in scrubbers)
12+
if(QDELETED(vent) || vent.welded) // in case it was welded after setup() but before we got to it here
13+
continue
14+
var/turf/vent_turf = get_turf(vent)
15+
if(!isopenturf(vent_turf) || QDELING(vent_turf))
16+
continue
17+
var/dangerous = prob(danger_chance)
18+
var/reagent_type = forced_reagent_type || get_overflowing_reagent(dangerous)
19+
if(dangerous)
20+
new /mob/living/basic/cockroach(vent_turf)
21+
new /mob/living/basic/cockroach(vent_turf)
22+
vent_turf.add_liquid(reagent_type, reagents_amount, no_react = TRUE)
23+
if(vent_turf.liquids?.liquid_group)
24+
vent_turf.liquids.liquid_group.always_evaporates = TRUE
25+
vent_turf.liquids.liquid_group.evaporation_multiplier += evaporation_multiplier
26+
CHECK_TICK
27+
28+
/datum/round_event/scrubber_overflow/threatening
29+
reagents_amount = 150
30+
evaporation_multiplier = BASE_EVAPORATION_MULTIPLIER * 1.5
31+
32+
/datum/round_event/scrubber_overflow/catastrophic
33+
reagents_amount = 200
34+
evaporation_multiplier = BASE_EVAPORATION_MULTIPLIER * 2
35+
36+
/datum/round_event/scrubber_overflow/every_vent
37+
reagents_amount = 150
38+
evaporation_multiplier = BASE_EVAPORATION_MULTIPLIER * 1.5
39+
40+
#undef BASE_EVAPORATION_MULTIPLIER

monkestation/code/modules/liquids/liquid_controller.dm

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SUBSYSTEM_DEF(liquids)
8989
group_process_work_queue -= liquid_group
9090
continue
9191
liquid_group.process_group(TRUE)
92-
if(populate_evaporation && (liquid_group.expected_turf_height < LIQUID_STATE_ANKLES) && liquid_group.evaporates)
92+
if(populate_evaporation && (liquid_group.always_evaporates || liquid_group.expected_turf_height < LIQUID_STATE_ANKLES) && liquid_group.evaporates)
9393
for(var/turf/listed_turf as anything in liquid_group.members)
9494
if(QDELETED(listed_turf))
9595
continue
@@ -184,6 +184,7 @@ SUBSYSTEM_DEF(liquids)
184184
list_clear_nulls(active_turf_group_queue)
185185

186186
if(member_counter > REQUIRED_MEMBER_PROCESSES)
187+
list_clear_nulls(cached_exposures)
187188
if(!length(cached_exposures))
188189
for(var/datum/liquid_group/liquid_group as anything in active_turf_group_queue)
189190
if(MC_TICK_CHECK)
@@ -195,30 +196,26 @@ SUBSYSTEM_DEF(liquids)
195196
active_turf_group_queue -= liquid_group
196197
if(!liquid_group.exposure)
197198
continue
198-
for(var/turf/member as anything in liquid_group.members)
199-
cached_exposures += liquid_group.members
199+
cached_exposures |= liquid_group.members
200200

201201
var/process_count = 0
202202
var/list/groups_we_rebuilt = list()
203203
while((process_count <= 500) && length(cached_exposures))
204204
process_count++
205205
var/turf/member = pick_n_take(cached_exposures)
206-
if(!member)
207-
break
208-
if(MC_TICK_CHECK)
209-
return
210-
206+
if(QDELETED(member) || QDELETED(member.liquids) || QDELETED(member.liquids.liquid_group))
207+
continue
211208
var/datum/liquid_group/liquid_group = member.liquids.liquid_group
212209
if(!(liquid_group in groups_we_rebuilt))
213210
groups_we_rebuilt |= liquid_group
214211
liquid_group.build_turf_reagent()
215212

216-
cached_exposures -= member
217213
if(!istype(member) || QDELING(member))
218214
liquid_group.members -= member
219215
continue
220216
liquid_group.process_member(member)
221-
217+
if(MC_TICK_CHECK)
218+
return
222219
member_counter = 0
223220
run_type = SSLIQUIDS_RUN_TYPE_CACHED_EDGES
224221

monkestation/code/modules/liquids/liquid_effect.dm

Lines changed: 52 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,68 @@
4242

4343
var/temporary_split_key
4444

45+
/obj/effect/abstract/liquid_turf/Initialize(mapload, datum/liquid_group/group_to_add)
46+
. = ..()
47+
if(!small_fire)
48+
small_fire = new
49+
if(!medium_fire)
50+
medium_fire = new
51+
if(!big_fire)
52+
big_fire = new
53+
54+
my_turf ||= loc
55+
56+
if(QDELETED(my_turf.liquids))
57+
my_turf.liquids = src
58+
59+
if(!QDELETED(group_to_add))
60+
group_to_add.add_to_group(my_turf)
61+
set_new_liquid_state(liquid_group.group_overlay_state)
62+
63+
if(QDELETED(liquid_group) && QDELETED(group_to_add))
64+
liquid_group = new(1, src)
65+
66+
if(!SSliquids)
67+
CRASH("Liquid Turf created with the liquids sybsystem not yet initialized!")
68+
RegisterSignal(my_turf, COMSIG_ATOM_ENTERED, PROC_REF(movable_entered))
69+
RegisterSignal(my_turf, COMSIG_TURF_MOB_FALL, PROC_REF(mob_fall))
70+
RegisterSignal(my_turf, COMSIG_ATOM_EXAMINE, PROC_REF(examine_turf))
71+
72+
if(SEND_SIGNAL(my_turf, COMSIG_TURF_LIQUIDS_CREATION, src) & BLOCK_LIQUID_CREATION)
73+
return INITIALIZE_HINT_QDEL
74+
75+
if(z)
76+
QUEUE_SMOOTH(src)
77+
QUEUE_SMOOTH_NEIGHBORS(src)
78+
79+
/obj/effect/abstract/liquid_turf/Destroy(force)
80+
UnregisterSignal(my_turf, list(COMSIG_ATOM_ENTERED, COMSIG_TURF_MOB_FALL, COMSIG_ATOM_EXAMINE))
81+
if(!isnull(my_turf))
82+
liquid_group?.remove_from_group(my_turf)
83+
SSliquids.evaporation_queue -= my_turf
84+
SSliquids.burning_turfs -= my_turf
85+
SSliquids.cached_exposures -= my_turf
86+
my_turf.liquids = null
87+
liquid_group = null
88+
my_turf = null
89+
QUEUE_SMOOTH_NEIGHBORS(src)
90+
return ..()
4591

4692
/obj/effect/abstract/liquid_turf/proc/process_evaporation()
47-
if(liquid_group.expected_turf_height > LIQUID_ANKLES_LEVEL_HEIGHT)
93+
if(!liquid_group.always_evaporates && (liquid_group.expected_turf_height > LIQUID_ANKLES_LEVEL_HEIGHT))
4894
SSliquids.evaporation_queue -= my_turf
4995
return
5096

5197
//See if any of our reagents evaporates
5298
var/any_change = FALSE
99+
var/always_evaporates = liquid_group.always_evaporates
100+
var/evaporation_multiplier = liquid_group.evaporation_multiplier
53101
var/datum/reagent/R //Faster declaration
54102
for(var/reagent_type in liquid_group.reagents.reagent_list)
55103
R = reagent_type
56104
//We evaporate. bye bye
57-
if(initial(R.evaporates))
58-
var/remove_amount = min((initial(R.evaporation_rate)), R.volume, (liquid_group.reagents_per_turf / length(liquid_group.reagents.reagent_list)))
105+
if(initial(R.evaporates) || always_evaporates)
106+
var/remove_amount = min((initial(R.evaporation_rate)) * evaporation_multiplier, R.volume, (liquid_group.reagents_per_turf / length(liquid_group.reagents.reagent_list)))
59107
liquid_group.remove_specific(src, remove_amount, R, TRUE)
60108
any_change = TRUE
61109
R.evaporate(src.loc, remove_amount)
@@ -64,7 +112,7 @@
64112
SSliquids.evaporation_queue -= my_turf
65113
return
66114

67-
/obj/effect/abstract/liquid_turf/forceMove(atom/destination, no_tp=FALSE, harderforce = FALSE)
115+
/obj/effect/abstract/liquid_turf/forceMove(atom/destination, no_tp = FALSE, harderforce = FALSE)
68116
if(harderforce)
69117
. = ..()
70118

@@ -171,56 +219,6 @@
171219
else
172220
to_chat(M, span_userdanger("You fall in the water!"))
173221

174-
/obj/effect/abstract/liquid_turf/Initialize(mapload, datum/liquid_group/group_to_add)
175-
. = ..()
176-
if(!small_fire)
177-
small_fire = new
178-
if(!medium_fire)
179-
medium_fire = new
180-
if(!big_fire)
181-
big_fire = new
182-
183-
if(!my_turf)
184-
my_turf = loc
185-
186-
if(!my_turf.liquids)
187-
my_turf.liquids = src
188-
189-
if(group_to_add)
190-
group_to_add.add_to_group(my_turf)
191-
set_new_liquid_state(liquid_group.group_overlay_state)
192-
193-
if(!liquid_group && !group_to_add)
194-
liquid_group = new(1, src)
195-
196-
if(!SSliquids)
197-
CRASH("Liquid Turf created with the liquids sybsystem not yet initialized!")
198-
my_turf = loc
199-
RegisterSignal(my_turf, COMSIG_ATOM_ENTERED, PROC_REF(movable_entered))
200-
RegisterSignal(my_turf, COMSIG_TURF_MOB_FALL, PROC_REF(mob_fall))
201-
RegisterSignal(my_turf, COMSIG_ATOM_EXAMINE, PROC_REF(examine_turf))
202-
203-
if(SEND_SIGNAL(my_turf, COMSIG_TURF_LIQUIDS_CREATION, src) & BLOCK_LIQUID_CREATION)
204-
return INITIALIZE_HINT_QDEL
205-
206-
if(z)
207-
QUEUE_SMOOTH(src)
208-
QUEUE_SMOOTH_NEIGHBORS(src)
209-
210-
211-
/obj/effect/abstract/liquid_turf/Destroy(force)
212-
UnregisterSignal(my_turf, list(COMSIG_ATOM_ENTERED, COMSIG_TURF_MOB_FALL, COMSIG_ATOM_EXAMINE))
213-
if(liquid_group)
214-
liquid_group.remove_from_group(my_turf)
215-
if(my_turf in SSliquids.evaporation_queue)
216-
SSliquids.evaporation_queue -= my_turf
217-
if(my_turf in SSliquids.burning_turfs)
218-
SSliquids.burning_turfs -= my_turf
219-
my_turf.liquids = null
220-
my_turf = null
221-
QUEUE_SMOOTH_NEIGHBORS(src)
222-
return ..()
223-
224222
/obj/effect/abstract/liquid_turf/proc/ChangeToNewTurf(turf/NewT)
225223
if(NewT.liquids)
226224
stack_trace("Liquids tried to change to a new turf, that already had liquids on it!")

monkestation/code/modules/liquids/liquid_groups.dm

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
5858
var/list/current_temperature_queue = list()
5959
///do we evaporate
6060
var/evaporates = TRUE
61+
/// Liquids in this group will always evaporate regardless of height
62+
var/always_evaporates = FALSE
63+
/// The multiplier added to the evaporation rate of all reagents in this group.
64+
var/evaporation_multiplier = 1
6165
///can we merge?
6266
var/can_merge = TRUE
6367
///number in decimal value that acts as a multiplier to the amount of liquids lost in applications
@@ -83,16 +87,26 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
8387
/datum/liquid_group/Destroy()
8488
UnregisterSignal(reagents, COMSIG_REAGENTS_DEL_REAGENT)
8589
SSliquids.active_groups -= src
86-
87-
if(src in SSliquids.arrayed_groups)
88-
SSliquids.arrayed_groups -= src /// Someone made a massive fucky wucky if this is happening
89-
90+
SSliquids.active_turf_group_queue -= src
91+
SSliquids.arrayed_groups -= src /// Someone made a massive fucky wucky if this is happening
9092
for(var/turf/member_turf as anything in members)
91-
member_turf?.liquids?.liquid_group = null
92-
members = list()
93+
if(member_turf?.liquids?.liquid_group == src)
94+
QDEL_NULL(member_turf.liquids)
95+
members = null
9396
burning_members = null
97+
cached_edge_turfs = null
98+
cached_fire_spreads = null
99+
cached_reagent_list = null
100+
current_temperature_queue = null
101+
splitting_array = null
94102
return ..()
95103

104+
/datum/liquid_group/proc/copy_properties(datum/liquid_group/from)
105+
if(isnull(from))
106+
return
107+
always_evaporates = from.always_evaporates
108+
evaporation_multiplier = from.evaporation_multiplier
109+
96110
/datum/liquid_group/proc/removed_reagent(datum/reagents/source, datum/reagent/modified)
97111
for(var/turf/member as anything in members)
98112
if(QDELETED(member.liquids))
@@ -122,19 +136,21 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
122136
process_group()
123137

124138
/datum/liquid_group/proc/remove_from_group(turf/T, should_reprocess = TRUE)
125-
126-
if(T in burning_members)
139+
if(isnull(T))
140+
return
141+
SSliquids.burning_turfs -= T
142+
if(burning_members)
127143
burning_members -= T
128-
129-
if(T in SSliquids.burning_turfs)
130-
SSliquids.burning_turfs -= T
131-
132-
members -= T
144+
if(members)
145+
members -= T
133146
T.liquids?.liquid_group = null
134147

135148
for(var/datum/reagent/reagent as anything in reagents.reagent_list)
136149
reagent.remove_from_member(T.liquids)
137150

151+
if(QDELING(src))
152+
return
153+
138154
if(!length(members))
139155
qdel(src)
140156
return
@@ -171,6 +187,8 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
171187

172188
total_reagent_volume = reagents.total_volume
173189
reagents_per_turf = total_reagent_volume / length(members)
190+
always_evaporates ||= otherg.always_evaporates
191+
evaporation_multiplier = (evaporation_multiplier + otherg.evaporation_multiplier) * 0.5 // average the evaporation multipliers
174192

175193
qdel(otherg)
176194
process_group()
@@ -392,6 +410,7 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
392410
/datum/liquid_group/proc/move_liquid_group(obj/effect/abstract/liquid_turf/member)
393411
remove_from_group(member.my_turf)
394412
member.liquid_group = new(1, member)
413+
member.liquid_group.copy_properties(src)
395414
var/remove_amount = reagents_per_turf / length(reagents.reagent_list)
396415
for(var/datum/reagent/reagent_type in reagents.reagent_list)
397416
member.liquid_group.reagents.add_reagent(reagent_type, remove_amount, no_react = TRUE)
@@ -694,6 +713,8 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
694713
passed_directions.Add(direction)
695714

696715
if(length(passed_directions))
716+
if(!islist(cached_edge_turfs)) // what the fuck???
717+
cached_edge_turfs = list()
697718
cached_edge_turfs |= checker
698719
cached_edge_turfs[checker] = passed_directions
699720

@@ -808,6 +829,7 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
808829
var/amount_to_transfer = length(connected_liquids) * reagents_per_turf
809830

810831
var/datum/liquid_group/new_group = new(1)
832+
new_group.copy_properties(src)
811833

812834
for(var/turf/connected_liquid in connected_liquids)
813835
new_group.check_edges(connected_liquid)
@@ -884,6 +906,7 @@ GLOBAL_VAR_INIT(liquid_debug_colors, FALSE)
884906
var/amount_to_transfer = length(connected_liquids) * reagents_per_turf
885907

886908
var/datum/liquid_group/new_group = new(1)
909+
new_group.copy_properties(src)
887910
if(!members)
888911
members = list()
889912
trans_to_seperate_group(new_group.reagents, amount_to_transfer)

0 commit comments

Comments
 (0)