[MIRROR] Refinery mixing machine (#11424)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-15 09:02:15 -04:00
committed by GitHub
co-authored by Will
parent f2a416ae76
commit e2dd0e2696
19 changed files with 207 additions and 25 deletions
+5
View File
@@ -237,6 +237,11 @@ GLOBAL_LIST(construction_frame_floor)
icon_override = 'icons/obj/stock_parts_refinery.dmi'
frame_class = FRAME_CLASS_MACHINE
/datum/frame/frame_types/industrial_reagent_mixer
name = "Industrial Chemical Mixer"
icon_override = 'icons/obj/stock_parts_refinery.dmi'
frame_class = FRAME_CLASS_MACHINE
/datum/frame/frame_types/industrial_reagent_pipe
name = "Industrial Chemical Pipe"
icon_override = 'icons/obj/stock_parts_refinery.dmi'
@@ -349,6 +349,16 @@
/obj/item/stock_parts/motor = 1,
/obj/item/stack/material/glass/reinforced = 1)
/obj/item/circuitboard/industrial_reagent_mixer
name = T_BOARD("industrial chemical mixer")
build_path = /obj/machinery/reagent_refinery/mixer
board_type = new /datum/frame/frame_types/industrial_reagent_mixer
req_components = list(
/obj/item/stock_parts/motor = 2,
/obj/item/stock_parts/gear = 2,
/obj/item/stock_parts/scanning_module = 1,
/obj/item/stack/material/glass/reinforced = 1)
/obj/item/circuitboard/industrial_reagent_pipe
name = T_BOARD("industrial chemical pipe")
build_path = /obj/machinery/reagent_refinery/pipe
@@ -1776,6 +1776,10 @@
<h3>Pumps:</h3>
<p>Pumps allow for the high volume exchange of reagents from one machine to another, but they are also useful for their multiple hose connectors. Allowing you to pump reagents from any other hose connector equipped tool. With this feature, they can serve as the input connection for long distance fracking networks.</p>
<h3>Mixers:</h3>
<p>While not required for reagents to react together, a mixing vat will allow you to easily control the portion of reagents mixed. Mixers will take input from three directions, and output in the last direction. The mixing arm will stop at each input, and will not proceed until it has recieved the reagents.</p>
<p>Using a pump, the amount of reagents transfered can be configured much more finely compared to handling reactions in vats. A mixer will refuse to take inputs if it cannot fully empty itself on a complete rotation. The rotation direction may be swapped at any time.</p>
<h3>Fluid Pumps:</h3>
<p>While not directly a refinery machine, they serve a core function outside of the refinery. Fluid pumps will extract eroded ores from bodies of water near mineral rich deposits. Discussion of high value ores with an experienced miner is recommended. Ores must remain intact near a body of water to be collected by the pump.</p>
<p>Fluid pumps operate on an internal power cell, protected behind a water proof panel. A crowbar is handy for opening it. Hoses can be connected to a fluid pump, allowing it to connect to long distance tube networks.</p>
@@ -113,11 +113,11 @@
filter_side *= -1
update_icon()
/obj/machinery/reagent_refinery/filter/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/filter/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// pumps, furnaces and filters can only be FED in a straight line
if(source_forward_dir != dir)
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/filter/examine(mob/user, infix, suffix)
. = ..()
@@ -192,11 +192,11 @@
filter_side *= -1
update_icon()
/obj/machinery/reagent_refinery/furnace/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/furnace/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// pumps, furnaces and filters can only be FED in a straight line
if(source_forward_dir != dir)
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/furnace/examine(mob/user, infix, suffix)
. = ..()
@@ -143,6 +143,6 @@
. += "The meter shows [reagents.total_volume]u / [reagents.maximum_volume]u. It is pumping chemicals at a rate of [amount_per_transfer_from_this]u."
tutorial(REFINERY_TUTORIAL_NOINPUT, .)
/obj/machinery/reagent_refinery/grinder/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/grinder/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// Grinder forbids input
return 0
@@ -62,7 +62,7 @@
var/image/pipe = image(icon, icon_state = "hub_cons", dir = dir)
add_overlay(pipe)
/obj/machinery/reagent_refinery/hub/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/hub/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
if(istype(origin_machine,/obj/machinery/reagent_refinery/hub)) // Hubs cannot send into other hubs
return 0
if(dir != GLOB.reverse_dir[source_forward_dir] ) // The hub must be facing into its source to accept input, unlike others
@@ -74,10 +74,10 @@
return 0
// Don't call parent, we're transfering into the holding tank instead
if(filter_id == "")
return RT.trans_to_obj(tanker, amount_per_transfer_from_this)
return RT.trans_to_obj(tanker, transfer_rate)
else
// Split out reagent...
return RT.trans_id_to(tanker, filter_id, amount_per_transfer_from_this)
return RT.trans_id_to(tanker, filter_id, transfer_rate)
/obj/machinery/reagent_refinery/hub/examine(mob/user, infix, suffix)
. = ..()
@@ -100,19 +100,19 @@
return 0
if(!istype(target,/obj/machinery/reagent_refinery)) // cannot transfer into grinders anyway, so it's fine to do it this way.
return 0
var/transfered = target.handle_transfer(src,RT,source_forward_dir,filter_id)
var/transfered = target.handle_transfer(src,RT,source_forward_dir, amount_per_transfer_from_this, filter_id)
if(transfered > 0 && active_power_usage > 0)
use_power_oneoff(active_power_usage)
return transfered
/// Handles reagent recieving from transfer_tank(), returns how much reagent was transfered if successful. Overriden to prevent access from certain sides or for filtering.
/obj/machinery/reagent_refinery/proc/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "") // Handle transfers in an override, instead of one monster function that typechecks like transfer_tank() used to be
/obj/machinery/reagent_refinery/proc/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "") // Handle transfers in an override, instead of one monster function that typechecks like transfer_tank() used to be
// Transfer to target in amounts every process tick!
if(filter_id == "")
var/amount = RT.trans_to_obj(src, amount_per_transfer_from_this)
var/amount = RT.trans_to_obj(src, transfer_rate)
return amount
// Split out reagent...
return RT.trans_id_to(src, filter_id, amount_per_transfer_from_this, TRUE)
return RT.trans_id_to(src, filter_id, transfer_rate, TRUE)
/obj/machinery/reagent_refinery/proc/refinery_transfer()
if(amount_per_transfer_from_this <= 0 || reagents.total_volume <= 0)
@@ -122,9 +122,15 @@
var/obj/machinery/reagent_refinery/target = locate(/obj/machinery/reagent_refinery) in get_step(get_turf(src),dir)
if(!target)
return 0
if(reagents.total_volume < minimum_reagents_for_transfer(target))
return 0
return transfer_tank( reagents, target, dir)
/// Handle transfers that require a minimum amount of reagents to happen
/obj/machinery/reagent_refinery/proc/minimum_reagents_for_transfer(var/obj/machinery/reagent_refinery/target)
return 0
/obj/machinery/reagent_refinery/verb/rotate_clockwise()
set name = "Rotate Machine Clockwise"
set category = "Object"
@@ -0,0 +1,141 @@
/obj/machinery/reagent_refinery/mixer
name = "Industrial Chemical Mixer"
desc = "A large mixing machine. Each input is only fed into the mixer once during each rotation."
icon_state = "mixer"
density = TRUE
anchored = TRUE
use_power = USE_POWER_IDLE
idle_power_usage = 0
active_power_usage = 50
circuit = /obj/item/circuitboard/industrial_reagent_mixer
default_max_vol = 240 // Two large beakers of volume
var/mixer_angle = 0
var/mixer_rotation_rate = 45
var/got_input = FALSE
/obj/machinery/reagent_refinery/mixer/Initialize(mapload)
mixer_angle = dir2angle(dir)
. = ..()
default_apply_parts()
// Can't be set on these
src.verbs -= /obj/machinery/reagent_refinery/verb/set_APTFT
/obj/machinery/reagent_refinery/mixer/process()
if(!anchored)
return
power_change()
if(stat & (NOPOWER|BROKEN))
return
if(mixer_angle == dir2angle(dir))
// Drain it!
refinery_transfer()
got_input = FALSE
if(reagents.total_volume <= 0)
mixer_angle += mixer_rotation_rate
update_icon()
else
// Check if we were filled...
if(mixer_angle % 90 != 0) // Not cardinal, keep going
got_input = TRUE
else if(!(locate(/obj/machinery/reagent_refinery) in get_step(src,angle2dir(mixer_angle)))) // If nothing, keep rotating
got_input = TRUE
if(got_input)
mixer_angle += mixer_rotation_rate
got_input = FALSE
update_icon()
// Modulus for sanity
mixer_angle = (360 + mixer_angle) % 360
/obj/machinery/reagent_refinery/mixer/update_icon()
cut_overlays()
// GOOBY!
if(reagents && reagents.total_volume >= 5)
var/percent = (reagents.total_volume / reagents.maximum_volume) * 100
switch(percent)
if(5 to 20) percent = 2
if(20 to 40) percent = 4
if(40 to 60) percent = 6
if(60 to 80) percent = 8
if(80 to INFINITY) percent = 10
var/image/filling = image(icon, loc, "mixer_r_[percent]",dir = dir)
filling.color = reagents.get_color()
add_overlay(filling)
// Get main dir pipe
var/image/pipe = image(icon, icon_state = "mixer_cons", dir = dir)
add_overlay(pipe)
if(anchored)
if(!(stat & (NOPOWER|BROKEN)))
var/image/dot = image(icon, icon_state = "mixer_dot_[ got_input ? "on" : "off" ]")
add_overlay(dot)
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(get_turf(src),direction)
var/obj/machinery/other = locate(/obj/machinery/reagent_refinery) in T
if(other && other.anchored)
// Waste processors do not connect to anything as outgoing
if(istype(other,/obj/machinery/reagent_refinery/waste_processor))
continue
// weird handling for side connections... Otherwise, anything pointing into use gets connected back!
if(istype(other,/obj/machinery/reagent_refinery/filter))
var/obj/machinery/reagent_refinery/filter/filt = other
var/check_dir = 0
if(filt.get_filter_side() == 1)
check_dir = turn(filt.dir, 270)
else
check_dir = turn(filt.dir, 90)
if(check_dir == GLOB.reverse_dir[direction] && dir != direction)
var/image/intake = image(icon, icon_state = "mixer_intakes", dir = direction)
add_overlay(intake)
continue
if(other.dir == GLOB.reverse_dir[direction] && dir != direction)
var/image/intake = image(icon, icon_state = "mixer_intakes", dir = direction)
add_overlay(intake)
// Get mixer overlay
var/image/arm = image(icon, icon_state = "mixer_arm", dir = angle2dir(mixer_angle))
add_overlay(arm)
/obj/machinery/reagent_refinery/mixer/attack_hand(mob/user)
set_rotation()
/obj/machinery/reagent_refinery/mixer/verb/set_rotation()
PRIVATE_PROC(TRUE)
set name = "Set Mixer Rotation"
set category = "Object"
set src in view(1)
if (usr.stat || usr.restrained())
return
if(mixer_rotation_rate > 0)
mixer_rotation_rate = -45
to_chat(usr,span_notice("You set \the [src] to rotate counter clockwise."))
else
mixer_rotation_rate = 45
to_chat(usr,span_notice("You set \the [src] to rotate clockwise."))
/obj/machinery/reagent_refinery/mixer/examine(mob/user, infix, suffix)
. = ..()
. += "The meter shows [reagents.total_volume]u / [reagents.maximum_volume]u. It is pumping chemicals at a rate of [amount_per_transfer_from_this]u."
tutorial(REFINERY_TUTORIAL_SINGLEOUTPUT, .)
/obj/machinery/reagent_refinery/mixer/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// no back/forth, filters don't use just their forward, they send the side too!
if(mixer_angle % 90 != 0) // Only handle proper directions
return 0
if(got_input) // Only ONCE per direction
return 0
if(dir == GLOB.reverse_dir[source_forward_dir])
return 0
if(get_turf(origin_machine) != get_step(src,angle2dir(mixer_angle))) // Check if the mixer arm is pointing at the machine too!
return 0
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
// If we transfered anything, then inform process() of it!
if(.)
got_input = TRUE
update_icon()
@@ -55,11 +55,11 @@
var/image/intake = image(icon, icon_state = "pipe_intakes", dir = direction)
add_overlay(intake)
/obj/machinery/reagent_refinery/pipe/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/pipe/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// no back/forth, filters don't use just their forward, they send the side too!
if(dir == GLOB.reverse_dir[source_forward_dir])
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/pipe/examine(mob/user, infix, suffix)
. = ..()
@@ -33,6 +33,14 @@
refinery_transfer()
/obj/machinery/reagent_refinery/minimum_reagents_for_transfer(var/obj/machinery/reagent_refinery/target)
if(istype(target,/obj/machinery/reagent_refinery/mixer)) // Special handling for mixer. Don't pump unless we can pump at least our transfer amount!
var/obj/machinery/reagent_refinery/mixer/M = target
if(M.got_input)
return INFINITY // block em
return amount_per_transfer_from_this
return 0
/obj/machinery/reagent_refinery/pump/update_icon()
cut_overlays()
if(reagents && reagents.total_volume >= 5)
@@ -43,11 +51,11 @@
/obj/machinery/reagent_refinery/pump/attack_hand(mob/user)
set_APTFT()
/obj/machinery/reagent_refinery/pump/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/pump/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// pumps, furnaces and filters can only be FED in a straight line
if(source_forward_dir != dir)
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/pump/examine(mob/user, infix, suffix)
. = ..()
@@ -98,14 +98,14 @@
var/image/intake = image(icon, icon_state = "reactor_intakes", dir = direction)
add_overlay(intake)
/obj/machinery/reagent_refinery/reactor/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/reactor/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// no back/forth, filters don't use just their forward, they send the side too!
if(dir == GLOB.reverse_dir[source_forward_dir])
return 0
// locked until distilling mode
if(toggle_mode == REACTOR_MODE_OUTPUT)
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/reactor/examine(mob/user, infix, suffix)
. = ..()
@@ -1,6 +1,6 @@
/obj/machinery/reagent_refinery/vat
name = "Industrial Chemical Vat"
desc = "A large mixing vat for huge quantities of chemicals. Don't fall in!"
desc = "A large storage vat for huge quantities of chemicals. Don't fall in!"
icon_state = "vat"
density = TRUE
anchored = TRUE
@@ -82,11 +82,11 @@
. += "The meter shows [reagents.total_volume]u / [reagents.maximum_volume]u. It is pumping chemicals at a rate of [amount_per_transfer_from_this]u."
tutorial(REFINERY_TUTORIAL_SINGLEOUTPUT, .)
/obj/machinery/reagent_refinery/vat/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
/obj/machinery/reagent_refinery/vat/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/transfer_rate, var/filter_id = "")
// no back/forth, filters don't use just their forward, they send the side too!
if(dir == GLOB.reverse_dir[source_forward_dir])
return 0
. = ..(origin_machine, RT, source_forward_dir, filter_id)
. = ..(origin_machine, RT, source_forward_dir, transfer_rate, filter_id)
/obj/machinery/reagent_refinery/vat/MouseDrop_T(var/atom/movable/C, mob/user as mob)
if(user.buckled || user.stat || user.restrained() || !Adjacent(user) || !user.Adjacent(C) || !istype(C) || (user == C && !user.canmove))
@@ -59,10 +59,6 @@
var/image/intake = image(icon, icon_state = "waste_intakes", dir = direction)
add_overlay(intake)
/obj/machinery/reagent_refinery/waste_processor/handle_transfer(var/atom/origin_machine, var/datum/reagents/RT, var/source_forward_dir, var/filter_id = "")
// Waste tanks accept from all sides
. = ..(origin_machine, RT, source_forward_dir, filter_id)
/obj/machinery/reagent_refinery/waste_processor/examine(mob/user, infix, suffix)
. = ..()
. += "The meter shows [reagents.total_volume]u / [reagents.maximum_volume]u. It is pumping chemicals at a rate of [amount_per_transfer_from_this]u."
@@ -78,6 +78,16 @@
)
departmental_flags = DEPARTMENT_BITFLAG_ENGINEERING
/datum/design_techweb/board/industrial_reagent_mixer
name = "Industrial Reagent Mixer"
id = "industrial_reagent_mixer"
// req_tech = list(TECH_DATA = 1)
build_path = /obj/item/circuitboard/industrial_reagent_mixer
category = list(
RND_CATEGORY_MACHINE + RND_SUBCATEGORY_MACHINE_ENGINEERING
)
departmental_flags = DEPARTMENT_BITFLAG_ENGINEERING
/datum/design_techweb/board/industrial_reagent_waste_processor
name = "Industrial Reagent Waste Processor"
id = "industrial_reagent_waste_processor"
@@ -327,6 +327,7 @@
"industrial_reagent_pump",
"industrial_reagent_reactor",
"industrial_reagent_vat",
"industrial_reagent_mixer",
"industrial_reagent_waste_processor",
"smart_centrifuge",
"pump_relay",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

+1
View File
@@ -4423,6 +4423,7 @@
#include "code\modules\refinery\core\industrial_reagent_grinder.dm"
#include "code\modules\refinery\core\industrial_reagent_hub.dm"
#include "code\modules\refinery\core\industrial_reagent_machines.dm"
#include "code\modules\refinery\core\industrial_reagent_mixer.dm"
#include "code\modules\refinery\core\industrial_reagent_pipe.dm"
#include "code\modules\refinery\core\industrial_reagent_pump.dm"
#include "code\modules\refinery\core\industrial_reagent_reactor.dm"