Skip to content

Commit a19b3fd

Browse files
authored
Ore Processing QOLs (#4789)
* Refinery/Smelter UI dust info and click acceptance * Fixes tool tips, attackbyitem, dust deletion * Machines with pipes now display location and layer * All boulder breaking machines drop artifacts
1 parent 3353b59 commit a19b3fd

File tree

11 files changed

+225
-28
lines changed

11 files changed

+225
-28
lines changed

monkestation/code/modules/factory_type_beat/machinery/brine_chamber.dm

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/obj/structure/brine_chamber
22
name = "brine chamber"
3-
desc = "Converts water into brine."
3+
desc = "A large structure for a pool of water. Its large open surface area allows water to evaporate leaving behind, salts creating a very salty brine solution."
44
icon = 'monkestation/code/modules/factory_type_beat/icons/mining_machines.dmi'
55
icon_state = "brine_chamber"
66
density = TRUE
@@ -77,6 +77,21 @@
7777
. = ..()
7878
repack(TRUE)
7979

80+
/obj/structure/brine_chamber/controller/examine(mob/user)
81+
. = ..()
82+
. += span_boldwarning("The sticker on the side says: All pipe connections are located at the main controller.")
83+
if(length(walls) && length(turfs)) // Don't show pipe information if we are packed up.
84+
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
85+
if(length(possible_pipes))
86+
for(var/datum/component/plumbing/pipes in possible_pipes)
87+
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
88+
var/output_pipe = initial(pipes.supply_connects)
89+
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
90+
if(istype(pipes, /datum/component/plumbing/chemical_washer_water))
91+
. += span_nicegreen("Water supply connects to the [dir2text(input_pipe)] with BLUE pipes on the [layer_name]")
92+
if(istype(pipes, /datum/component/plumbing/brine_controller))
93+
. += span_nicegreen("Brine export connects to the [dir2text(output_pipe)] with GREEN pipes on the [layer_name]")
94+
8095
/obj/structure/brine_chamber/controller/process(seconds_per_tick)
8196
if(process_count < 10)
8297
process_count++

monkestation/code/modules/factory_type_beat/processing/bouldertech.dm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
/obj/machinery/bouldertech/screwdriver_act(mob/living/user, obj/item/tool)
9090
. = ..()
9191
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool))
92+
//update_appearance(UPDATE_ICON_STATE)
93+
//Icon changes need to be changed. Do this last.
9294
return TOOL_ACT_TOOLTYPE_SUCCESS
9395

9496
/obj/machinery/bouldertech/crowbar_act(mob/living/user, obj/item/tool)
@@ -163,7 +165,7 @@
163165

164166
if(!istype(potential_boulder, /obj/item/boulder))
165167
potential_boulder.forceMove(drop_location())
166-
CRASH("\The [src] had a non-boulder in it's boulders contained!")
168+
CRASH("\The [src] had a non-boulder in it's boulders container!")
167169

168170
var/obj/item/boulder/boulder = potential_boulder
169171
if(boulder.durability < 0)
@@ -201,6 +203,8 @@
201203
. = ..()
202204
if(holds_mining_points)
203205
. += span_notice("The machine reads that it has [span_bold("[points_held] mining points")] stored. Swipe an ID to claim them.")
206+
if(panel_open)
207+
. += span_warning("The maintenance panel is open.")
204208

205209
/**
206210
* Accepts a boulder into the machinery, then converts it into minerals.
@@ -324,7 +328,7 @@
324328
boulders_contained += boulder
325329
if(length(return_extras()))
326330
boulders_contained |= return_extras()
327-
return boulders_contained.len
331+
return length(boulders_contained)
328332

329333
/obj/machinery/bouldertech/proc/return_extras()
330334
return list()

monkestation/code/modules/factory_type_beat/processing/checmial_washer.dm

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/obj/machinery/bouldertech/chemical_washer
22
name = "chemical washer"
3-
desc = "Crushes clumps of ore into dirty dust which needs to be enriched."
3+
desc = "Uses water to flush out non-dissolvable materials leaving a clean slurry solution."
44
icon_state = "washer"
55
allows_boulders = FALSE
66
holds_minerals = TRUE
@@ -30,6 +30,21 @@
3030
AddComponent(/datum/component/plumbing/chemical_washer)
3131
AddComponent(/datum/component/plumbing/chemical_washer_water)
3232

33+
/obj/machinery/bouldertech/chemical_washer/examine(mob/user)
34+
. = ..()
35+
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
36+
if(length(possible_pipes))
37+
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
38+
for(var/datum/component/plumbing/pipes in possible_pipes)
39+
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
40+
var/output_pipe = initial(pipes.supply_connects)
41+
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
42+
if(istype(pipes, /datum/component/plumbing/chemical_washer))
43+
. += span_nicegreen("Dirty Slurry supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with RED pipes on the [layer_name]")
44+
. += span_nicegreen("Clean Slurry export connects to the [dir2text(turn(output_pipe, cur_ang_offset))] with BLUE pipes on the [layer_name]")
45+
if(istype(pipes, /datum/component/plumbing/chemical_washer_water))
46+
. += span_nicegreen("Water supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with BLUE pipes on the [layer_name]")
47+
3348
/obj/machinery/bouldertech/chemical_washer/process()
3449
if(!anchored)
3550
return

monkestation/code/modules/factory_type_beat/processing/chemical_injector.dm

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/obj/machinery/bouldertech/chemical_injector
22
name = "chemical injector"
3-
desc = "Crushes shards when infused with brine."
3+
desc = "Crushes shards, and boulders when infused with brine. Amalgams will slow down the injector."
44
icon_state = "chemical_injection"
5-
allows_boulders = FALSE
5+
allows_boulders = TRUE
66
holds_minerals = TRUE
7-
process_string = "Brine"
7+
process_string = "Brine, Ore Crystals, Ore Amalgams"
88
processable_materials = list(
99
/datum/material/iron,
1010
/datum/material/titanium,
@@ -37,6 +37,18 @@
3737
if(crystal_inside)
3838
. += mutable_appearance(icon, "chemical_injection-crystal")
3939

40+
/obj/machinery/bouldertech/chemical_injector/attackby(obj/item/attacking_item, mob/user, params)
41+
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
42+
var/obj/item/processing/my_dust = attacking_item
43+
update_boulder_count()
44+
if(!accept_boulder(my_dust))
45+
balloon_alert_to_viewers("full!")
46+
return
47+
balloon_alert_to_viewers("accepted")
48+
START_PROCESSING(SSmachines, src)
49+
return TRUE
50+
return ..()
51+
4052
/obj/machinery/bouldertech/chemical_injector/Initialize(mapload)
4153
. = ..()
4254
create_reagents(maximum_volume, TRANSPARENT)
@@ -61,6 +73,7 @@
6173

6274
if(istype(potential_boulder, /obj/item/processing/amalgam))
6375
next_allowed_process = world.time + 30 SECONDS
76+
playsound(src.loc, 'sound/machines/scanbuzz.ogg', 50, FALSE)
6477
visible_message(span_danger("The machine gets clogged with [potential_boulder]! Disabling it for 30 Seconds."))
6578

6679
if(QDELETED(potential_boulder))
@@ -95,6 +108,16 @@
95108
playsound(src.loc, 'sound/machines/ping.ogg', 50, FALSE)
96109
return PROCESS_KILL
97110

111+
/obj/machinery/bouldertech/chemical_injector/examine(mob/user)
112+
. = ..()
113+
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
114+
if(length(possible_pipes))
115+
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
116+
for(var/datum/component/plumbing/pipes in possible_pipes)
117+
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
118+
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
119+
if(istype(pipes, /datum/component/plumbing/chemical_injector_brine))
120+
. += span_nicegreen("Brine supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with YELLOW pipes on the [layer_name]")
98121

99122
/obj/machinery/bouldertech/chemical_injector/proc/process_crystal(obj/item/processing/crystals/clump)
100123
for(var/datum/material/material as anything in clump.custom_materials)
@@ -123,6 +146,23 @@
123146
return TRUE
124147
return ..()
125148

149+
/obj/machinery/bouldertech/chemical_injector/accept_boulder(obj/item/boulder/new_boulder) // Should allow processing amalgams and their cooldown debuff.
150+
if(isnull(new_boulder))
151+
return FALSE
152+
if(boulders_contained.len >= boulders_held_max) //Full already
153+
return FALSE
154+
if(!istype(new_boulder) && !check_extras(new_boulder)) //Can't be processed
155+
return FALSE
156+
if(!istype(new_boulder, /obj/item/processing/amalgam) && !new_boulder.custom_materials) //Shouldn't happen, but just in case.
157+
qdel(new_boulder)
158+
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
159+
return FALSE
160+
new_boulder.forceMove(src)
161+
boulders_contained += new_boulder
162+
SSore_generation.available_boulders -= new_boulder
163+
START_PROCESSING(SSmachines, src) //Starts processing if we aren't already.
164+
return TRUE
165+
126166
/obj/machinery/bouldertech/chemical_injector/return_extras()
127167
var/list/boulders_contained = list()
128168
for(var/obj/item/processing/crystals/boulder in contents)
@@ -150,6 +190,12 @@
150190
dust.forceMove(get_step(src, export_side))
151191

152192
reagents.remove_all(brine_per_use)
193+
if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
194+
var/obj/item/boulder/artifact/artboulder = boulder
195+
if(artboulder.artifact_inside)
196+
artboulder.artifact_inside.forceMove(drop_location())
197+
artboulder.artifact_inside = null
198+
153199
qdel(boulder)
154200
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
155201
update_boulder_count()

monkestation/code/modules/factory_type_beat/processing/crusher.dm

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
icon_state = "crusher"
55
allows_boulders = FALSE
66
holds_minerals = TRUE
7-
process_string = "Clumps"
7+
process_string = "Ore Clumps"
88
processable_materials = list(
99
/datum/material/iron,
1010
/datum/material/titanium,
@@ -51,12 +51,24 @@
5151
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
5252
update_boulder_count()
5353

54+
/obj/machinery/bouldertech/crusher/attackby(obj/item/attacking_item, mob/user, params)
55+
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
56+
var/obj/item/processing/clumps/clumps = attacking_item
57+
update_boulder_count()
58+
if(!accept_boulder(clumps))
59+
balloon_alert_to_viewers("full!")
60+
return
61+
balloon_alert_to_viewers("accepted")
62+
START_PROCESSING(SSmachines, src)
63+
return TRUE
64+
return ..()
65+
5466
/obj/machinery/bouldertech/crusher/CanAllowThrough(atom/movable/mover, border_dir)
5567
if(!anchored)
5668
return FALSE
5769
if(boulders_contained.len >= boulders_held_max)
5870
return FALSE
59-
if(istype(mover, /obj/item/processing/clumps))
71+
if(check_extras(mover))
6072
return TRUE
6173
return ..()
6274

monkestation/code/modules/factory_type_beat/processing/crystalizer.dm

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/obj/machinery/bouldertech/crystalizer
22
name = "crystalizer"
3-
desc = "Crushes clumps of ore into dirty dust which needs to be enriched."
3+
desc = "Uses electro-chemical processes to grow relatively pure ore crystals from clean slurry. Sometimes useless amalgams are made."
44
icon_state = "crystalizer"
55
allows_boulders = FALSE
66
holds_minerals = TRUE
@@ -39,6 +39,17 @@
3939
. += mutable_appearance(icon, "crystalizer-crystal", layer, src)
4040
. += mutable_appearance(icon, "crystalizer-[processes_left]")
4141

42+
/obj/machinery/bouldertech/crystalizer/examine(mob/user)
43+
. = ..()
44+
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
45+
if(length(possible_pipes))
46+
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
47+
for(var/datum/component/plumbing/pipes in possible_pipes)
48+
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
49+
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
50+
if(istype(pipes, /datum/component/plumbing/material_crystalizer))
51+
. += span_nicegreen("Clean Slurry supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with RED pipes on the [layer_name]")
52+
4253
/obj/machinery/bouldertech/crystalizer/process()
4354
if(!anchored)
4455
return
@@ -74,7 +85,8 @@
7485
dust.set_colors()
7586
dust.forceMove(get_step(src, export_side))
7687
if(prob(15))
77-
new /obj/item/processing/amalgam(get_step(src, export_side))
88+
var/obj/item/processing/amalgam/trash = new(get_turf(src))
89+
trash.forceMove(get_step(src, export_side))
7890

7991
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
8092
update_boulder_count()

monkestation/code/modules/factory_type_beat/processing/dissolution_chamber.dm

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/obj/machinery/bouldertech/dissolution_chamber
22
name = "dissolution chamber"
3-
desc = "Crushes shards when infused with brine."
3+
desc = "Breaks down boulders into a dirty slurry using sulfuric acid."
44
icon_state = "dissolution"
55
holds_minerals = TRUE
66
process_string = "Sulfuric Acid"
@@ -77,10 +77,30 @@
7777
material_data["materials"] = data
7878
reagents.add_reagent(/datum/reagent/processing/dirty_slurry, 250, material_data)
7979

80+
if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
81+
var/obj/item/boulder/artifact/artboulder = boulder
82+
if(artboulder.artifact_inside)
83+
artboulder.artifact_inside.forceMove(drop_location())
84+
artboulder.artifact_inside = null
85+
8086
qdel(boulder)
8187
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
8288
update_boulder_count()
8389

90+
/obj/machinery/bouldertech/dissolution_chamber/examine(mob/user)
91+
. = ..()
92+
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
93+
if(length(possible_pipes))
94+
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
95+
for(var/datum/component/plumbing/pipes in possible_pipes)
96+
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
97+
var/output_pipe = initial(pipes.supply_connects)
98+
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
99+
if(istype(pipes, /datum/component/plumbing/dissolution_chamber))
100+
. += span_nicegreen("Sulfuric Acid supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with YELLOW pipes on the [layer_name]")
101+
if(istype(pipes, /datum/component/plumbing/dissolution_chamber_output))
102+
. += span_nicegreen("Dirty Slurry export connects to the [dir2text(turn(output_pipe, cur_ang_offset))] with BLUE pipes on the [layer_name]")
103+
84104
/datum/component/plumbing/dissolution_chamber
85105
demand_connects = SOUTH
86106
demand_color = COLOR_YELLOW

monkestation/code/modules/factory_type_beat/processing/enricher.dm

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/obj/machinery/bouldertech/enricher
22
name = "enrichment chamber"
3-
desc = "enriches boulders into dust which can then de smelted at a smelter for double the materials."
3+
desc = "Enriches boulders and dirty dust into dust which can then de smelted at a smelter for double the materials."
44
icon_state = "enricher"
55
holds_minerals = TRUE
66
process_string = "Dirty Dust"
@@ -67,6 +67,13 @@
6767
dust.custom_materials[material] = quantity
6868
dust.set_colors()
6969
dust.forceMove(get_step(src, export_side))
70+
71+
if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
72+
var/obj/item/boulder/artifact/artboulder = boulder
73+
if(artboulder.artifact_inside)
74+
artboulder.artifact_inside.forceMove(drop_location())
75+
artboulder.artifact_inside = null
76+
7077
qdel(boulder)
7178
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
7279
update_boulder_count()
@@ -84,12 +91,24 @@
8491
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
8592
update_boulder_count()
8693

94+
/obj/machinery/bouldertech/enricher/attackby(obj/item/attacking_item, mob/user, params)
95+
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
96+
var/obj/item/processing/dirty_dust/dirty_dust = attacking_item
97+
update_boulder_count()
98+
if(!accept_boulder(dirty_dust))
99+
balloon_alert_to_viewers("full!")
100+
return
101+
balloon_alert_to_viewers("accepted")
102+
START_PROCESSING(SSmachines, src)
103+
return TRUE
104+
return ..()
105+
87106
/obj/machinery/bouldertech/enricher/CanAllowThrough(atom/movable/mover, border_dir)
88107
if(!anchored)
89108
return FALSE
90109
if(boulders_contained.len >= boulders_held_max)
91110
return FALSE
92-
if(istype(mover, /obj/item/processing/dirty_dust))
111+
if(check_extras(mover))
93112
return TRUE
94113
return ..()
95114

monkestation/code/modules/factory_type_beat/processing/holding_types.dm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
name = "refined dust"
1414
desc = "After being enriched it has turned into some dust."
1515

16+
/// Cooldown used to prevents boulders from getting processed back into a machine immediately after being processed.
17+
COOLDOWN_DECLARE(processing_cooldown)
18+
19+
/**
20+
* Handles the dust's processing cooldown to check if it's ready to be processed again.
21+
*/
22+
/obj/item/processing/refined_dust/proc/can_get_processed()
23+
return COOLDOWN_FINISHED(src, processing_cooldown)
24+
25+
/**
26+
* Starts the dust's processing cooldown.
27+
*/
28+
/obj/item/processing/refined_dust/proc/restart_processing_cooldown()
29+
COOLDOWN_START(src, processing_cooldown, 2 SECONDS)
30+
1631
/obj/item/processing/dirty_dust
1732
name = "dirty dust"
1833
desc = "After crushing some clumps we are left with this."

0 commit comments

Comments
 (0)