Skip to content

Ore Processing QOLs #4789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/structure/brine_chamber
name = "brine chamber"
desc = "Converts water into brine."
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."
icon = 'monkestation/code/modules/factory_type_beat/icons/mining_machines.dmi'
icon_state = "brine_chamber"
density = TRUE
Expand Down Expand Up @@ -77,6 +77,21 @@
. = ..()
repack(TRUE)

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

/obj/structure/brine_chamber/controller/process(seconds_per_tick)
if(process_count < 10)
process_count++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
/obj/machinery/bouldertech/screwdriver_act(mob/living/user, obj/item/tool)
. = ..()
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool))
//update_appearance(UPDATE_ICON_STATE)
//Icon changes need to be changed. Do this last.
return TOOL_ACT_TOOLTYPE_SUCCESS

/obj/machinery/bouldertech/crowbar_act(mob/living/user, obj/item/tool)
Expand Down Expand Up @@ -163,7 +165,7 @@

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

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

/**
* Accepts a boulder into the machinery, then converts it into minerals.
Expand Down Expand Up @@ -324,7 +328,7 @@
boulders_contained += boulder
if(length(return_extras()))
boulders_contained |= return_extras()
return boulders_contained.len
return length(boulders_contained)

/obj/machinery/bouldertech/proc/return_extras()
return list()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/bouldertech/chemical_washer
name = "chemical washer"
desc = "Crushes clumps of ore into dirty dust which needs to be enriched."
desc = "Uses water to flush out non-dissolvable materials leaving a clean slurry solution."
icon_state = "washer"
allows_boulders = FALSE
holds_minerals = TRUE
Expand Down Expand Up @@ -30,6 +30,21 @@
AddComponent(/datum/component/plumbing/chemical_washer)
AddComponent(/datum/component/plumbing/chemical_washer_water)

/obj/machinery/bouldertech/chemical_washer/examine(mob/user)
. = ..()
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
if(length(possible_pipes))
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
for(var/datum/component/plumbing/pipes in possible_pipes)
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
var/output_pipe = initial(pipes.supply_connects)
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
if(istype(pipes, /datum/component/plumbing/chemical_washer))
. += span_nicegreen("Dirty Slurry supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with RED pipes on the [layer_name]")
. += span_nicegreen("Clean Slurry export connects to the [dir2text(turn(output_pipe, cur_ang_offset))] with BLUE pipes on the [layer_name]")
if(istype(pipes, /datum/component/plumbing/chemical_washer_water))
. += span_nicegreen("Water supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with BLUE pipes on the [layer_name]")

/obj/machinery/bouldertech/chemical_washer/process()
if(!anchored)
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/obj/machinery/bouldertech/chemical_injector
name = "chemical injector"
desc = "Crushes shards when infused with brine."
desc = "Crushes shards, and boulders when infused with brine. Amalgams will slow down the injector."
icon_state = "chemical_injection"
allows_boulders = FALSE
allows_boulders = TRUE
holds_minerals = TRUE
process_string = "Brine"
process_string = "Brine, Ore Crystals, Ore Amalgams"
processable_materials = list(
/datum/material/iron,
/datum/material/titanium,
Expand Down Expand Up @@ -37,6 +37,18 @@
if(crystal_inside)
. += mutable_appearance(icon, "chemical_injection-crystal")

/obj/machinery/bouldertech/chemical_injector/attackby(obj/item/attacking_item, mob/user, params)
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
var/obj/item/processing/my_dust = attacking_item
update_boulder_count()
if(!accept_boulder(my_dust))
balloon_alert_to_viewers("full!")
return
balloon_alert_to_viewers("accepted")
START_PROCESSING(SSmachines, src)
return TRUE
return ..()

/obj/machinery/bouldertech/chemical_injector/Initialize(mapload)
. = ..()
create_reagents(maximum_volume, TRANSPARENT)
Expand All @@ -61,6 +73,7 @@

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

if(QDELETED(potential_boulder))
Expand Down Expand Up @@ -95,6 +108,16 @@
playsound(src.loc, 'sound/machines/ping.ogg', 50, FALSE)
return PROCESS_KILL

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

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

/obj/machinery/bouldertech/chemical_injector/accept_boulder(obj/item/boulder/new_boulder) // Should allow processing amalgams and their cooldown debuff.
if(isnull(new_boulder))
return FALSE
if(boulders_contained.len >= boulders_held_max) //Full already
return FALSE
if(!istype(new_boulder) && !check_extras(new_boulder)) //Can't be processed
return FALSE
if(!istype(new_boulder, /obj/item/processing/amalgam) && !new_boulder.custom_materials) //Shouldn't happen, but just in case.
qdel(new_boulder)
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
return FALSE
new_boulder.forceMove(src)
boulders_contained += new_boulder
SSore_generation.available_boulders -= new_boulder
START_PROCESSING(SSmachines, src) //Starts processing if we aren't already.
return TRUE

/obj/machinery/bouldertech/chemical_injector/return_extras()
var/list/boulders_contained = list()
for(var/obj/item/processing/crystals/boulder in contents)
Expand Down Expand Up @@ -150,6 +190,12 @@
dust.forceMove(get_step(src, export_side))

reagents.remove_all(brine_per_use)
if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
var/obj/item/boulder/artifact/artboulder = boulder
if(artboulder.artifact_inside)
artboulder.artifact_inside.forceMove(drop_location())
artboulder.artifact_inside = null

qdel(boulder)
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_boulder_count()
Expand Down
16 changes: 14 additions & 2 deletions monkestation/code/modules/factory_type_beat/processing/crusher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
icon_state = "crusher"
allows_boulders = FALSE
holds_minerals = TRUE
process_string = "Clumps"
process_string = "Ore Clumps"
processable_materials = list(
/datum/material/iron,
/datum/material/titanium,
Expand Down Expand Up @@ -51,12 +51,24 @@
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_boulder_count()

/obj/machinery/bouldertech/crusher/attackby(obj/item/attacking_item, mob/user, params)
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
var/obj/item/processing/clumps/clumps = attacking_item
update_boulder_count()
if(!accept_boulder(clumps))
balloon_alert_to_viewers("full!")
return
balloon_alert_to_viewers("accepted")
START_PROCESSING(SSmachines, src)
return TRUE
return ..()

/obj/machinery/bouldertech/crusher/CanAllowThrough(atom/movable/mover, border_dir)
if(!anchored)
return FALSE
if(boulders_contained.len >= boulders_held_max)
return FALSE
if(istype(mover, /obj/item/processing/clumps))
if(check_extras(mover))
return TRUE
return ..()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/bouldertech/crystalizer
name = "crystalizer"
desc = "Crushes clumps of ore into dirty dust which needs to be enriched."
desc = "Uses electro-chemical processes to grow relatively pure ore crystals from clean slurry. Sometimes useless amalgams are made."
icon_state = "crystalizer"
allows_boulders = FALSE
holds_minerals = TRUE
Expand Down Expand Up @@ -39,6 +39,17 @@
. += mutable_appearance(icon, "crystalizer-crystal", layer, src)
. += mutable_appearance(icon, "crystalizer-[processes_left]")

/obj/machinery/bouldertech/crystalizer/examine(mob/user)
. = ..()
var/list/possible_pipes = src.GetComponents(/datum/component/plumbing)
if(length(possible_pipes))
var/cur_ang_offset = 180 - dir2angle(src.dir) // Parent machine rotation offsets everything else. 180 is default pointed south offset.
for(var/datum/component/plumbing/pipes in possible_pipes)
var/input_pipe = initial(pipes.demand_connects) // Call for the initial position then use turn to get its current direction.
var/layer_name = (pipes.ducting_layer == THIRD_DUCT_LAYER) ? "Third Layer" : GLOB.plumbing_layer_names["[pipes.ducting_layer]"]
if(istype(pipes, /datum/component/plumbing/material_crystalizer))
. += span_nicegreen("Clean Slurry supply connects to the [dir2text(turn(input_pipe, cur_ang_offset))] with RED pipes on the [layer_name]")

/obj/machinery/bouldertech/crystalizer/process()
if(!anchored)
return
Expand Down Expand Up @@ -74,7 +85,8 @@
dust.set_colors()
dust.forceMove(get_step(src, export_side))
if(prob(15))
new /obj/item/processing/amalgam(get_step(src, export_side))
var/obj/item/processing/amalgam/trash = new(get_turf(src))
trash.forceMove(get_step(src, export_side))

playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_boulder_count()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/bouldertech/dissolution_chamber
name = "dissolution chamber"
desc = "Crushes shards when infused with brine."
desc = "Breaks down boulders into a dirty slurry using sulfuric acid."
icon_state = "dissolution"
holds_minerals = TRUE
process_string = "Sulfuric Acid"
Expand Down Expand Up @@ -77,10 +77,30 @@
material_data["materials"] = data
reagents.add_reagent(/datum/reagent/processing/dirty_slurry, 250, material_data)

if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
var/obj/item/boulder/artifact/artboulder = boulder
if(artboulder.artifact_inside)
artboulder.artifact_inside.forceMove(drop_location())
artboulder.artifact_inside = null

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

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

/datum/component/plumbing/dissolution_chamber
demand_connects = SOUTH
demand_color = COLOR_YELLOW
Expand Down
23 changes: 21 additions & 2 deletions monkestation/code/modules/factory_type_beat/processing/enricher.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/bouldertech/enricher
name = "enrichment chamber"
desc = "enriches boulders into dust which can then de smelted at a smelter for double the materials."
desc = "Enriches boulders and dirty dust into dust which can then de smelted at a smelter for double the materials."
icon_state = "enricher"
holds_minerals = TRUE
process_string = "Dirty Dust"
Expand Down Expand Up @@ -67,6 +67,13 @@
dust.custom_materials[material] = quantity
dust.set_colors()
dust.forceMove(get_step(src, export_side))

if(istype(boulder, /obj/item/boulder/artifact)) // If we are breaking an artifact boulder drop the artifact before deletion.
var/obj/item/boulder/artifact/artboulder = boulder
if(artboulder.artifact_inside)
artboulder.artifact_inside.forceMove(drop_location())
artboulder.artifact_inside = null

qdel(boulder)
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_boulder_count()
Expand All @@ -84,12 +91,24 @@
playsound(loc, 'sound/weapons/drill.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_boulder_count()

/obj/machinery/bouldertech/enricher/attackby(obj/item/attacking_item, mob/user, params)
if(holds_minerals && check_extras(attacking_item)) // Checking for extra items it can refine.
var/obj/item/processing/dirty_dust/dirty_dust = attacking_item
update_boulder_count()
if(!accept_boulder(dirty_dust))
balloon_alert_to_viewers("full!")
return
balloon_alert_to_viewers("accepted")
START_PROCESSING(SSmachines, src)
return TRUE
return ..()

/obj/machinery/bouldertech/enricher/CanAllowThrough(atom/movable/mover, border_dir)
if(!anchored)
return FALSE
if(boulders_contained.len >= boulders_held_max)
return FALSE
if(istype(mover, /obj/item/processing/dirty_dust))
if(check_extras(mover))
return TRUE
return ..()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
name = "refined dust"
desc = "After being enriched it has turned into some dust."

/// Cooldown used to prevents boulders from getting processed back into a machine immediately after being processed.
COOLDOWN_DECLARE(processing_cooldown)

/**
* Handles the dust's processing cooldown to check if it's ready to be processed again.
*/
/obj/item/processing/refined_dust/proc/can_get_processed()
return COOLDOWN_FINISHED(src, processing_cooldown)

/**
* Starts the dust's processing cooldown.
*/
/obj/item/processing/refined_dust/proc/restart_processing_cooldown()
COOLDOWN_START(src, processing_cooldown, 2 SECONDS)

/obj/item/processing/dirty_dust
name = "dirty dust"
desc = "After crushing some clumps we are left with this."
Expand Down
Loading
Loading