[MIRROR] Reworks plumbing reaction chamber, purity support (#3763)

* Rework plumbing reaction chamber, purity support (#57071)

Currently does four things:

The reaction chamber now supports purity! It has a yellow (acid) and green (basic) input for buffers, aswell as a setting to automatically dispense either an acidic or alkalic buffer when above/below a certain pH! Now you can make a 100% pure meth factory! The buffer connects are on an alternate layer.

Probably going to be less loved, but I removed the reaction chambers ability to pick reagents from the net. Instead, it will pull untill a set volume is reached. Then it'll start reacting. While this means that players will have to be more creative and use a wider array of machinery.

Also new machine! Buffers! They fill the hole that reagent chambers left. They can be set with a threshold volume and will only start putting out chems when ALL of their neighbouring buffers also are also above this threshold. You might have a lot of one chem and have to wait for a more specialized chem to be produced, and with the cleverness of reaction chambers gone, bufferers can do just that: wait.

I also removed all but two layers. I want to make it obvious what layer the buffer connects are on. Also layers are basically unusable and I'm gonna give them a rework very soon. I'll put the things back in then when they actually have something to contribute

* Reworks plumbing reaction chamber, purity support

Co-authored-by: Time-Green <timkoster1@hotmail.com>
This commit is contained in:
SkyratBot
2021-03-02 19:12:11 +00:00
committed by GitHub
co-authored by Time-Green
parent a175be4500
commit 25092a85bb
11 changed files with 291 additions and 110 deletions
+33 -7
View File
@@ -21,9 +21,13 @@
var/recipient_reagents_holder
///How do we apply the new reagents to the receiver? Generally doesn't matter, but some stuff, like people, does care if its injected or whatevs
var/methods
///What color is our demand connect? Also it's not auto-colored so you'll have to make new sprites if its anything other than red, blue, yellow or green
var/demand_color = "red"
///What color is our supply connect? Also, refrain from pointlessly using non-standard colors unless it's really funny or something
var/supply_color = "blue"
///turn_connects is for wheter or not we spin with the object to change our pipes
/datum/component/plumbing/Initialize(start=TRUE, _turn_connects=TRUE, _ducting_layer)
/datum/component/plumbing/Initialize(start=TRUE, _turn_connects=TRUE, _ducting_layer, datum/reagents/custom_receiver)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
@@ -31,12 +35,16 @@
ducting_layer = ducting_layer
var/atom/movable/AM = parent
if(!AM.reagents)
if(!AM.reagents && !custom_receiver)
return COMPONENT_INCOMPATIBLE
reagents = AM.reagents
turn_connects = _turn_connects
recipient_reagents_holder = AM.reagents
if(custom_receiver)
recipient_reagents_holder = custom_receiver
else
recipient_reagents_holder = AM.reagents
RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED,COMSIG_PARENT_PREQDELETED), .proc/disable)
RegisterSignal(parent, list(COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH), .proc/toggle_active)
@@ -145,9 +153,9 @@
var/color
var/direction
if(D & initial(demand_connects))
color = "red" //red because red is mean and it takes
color = demand_color
else if(D & initial(supply_connects))
color = "blue" //blue is nice and gives
color = supply_color
else
continue
@@ -164,10 +172,10 @@
direction = "west"
if(turn_connects)
I = image('icons/obj/plumbing/plumbers.dmi', "[direction]-[color]", layer = AM.layer - 1)
I = image('icons/obj/plumbing/connects.dmi', "[direction]-[color]", layer = AM.layer - 1)
else
I = image('icons/obj/plumbing/plumbers.dmi', "[direction]-[color]-s", layer = AM.layer - 1) //color is not color as in the var, it's just the name of the icon_state
I = image('icons/obj/plumbing/connects.dmi', "[direction]-[color]-s", layer = AM.layer - 1) //color is not color as in the var, it's just the name of the icon_state
I.dir = D
I.pixel_x = duct_x
@@ -308,3 +316,21 @@
/datum/component/plumbing/tank
demand_connects = WEST
supply_connects = EAST
#define READY 2
///Baby component for the buffer plumbing machine
/datum/component/plumbing/buffer
demand_connects = WEST
supply_connects = EAST
/datum/component/plumbing/buffer/Initialize(start=TRUE, _turn_connects=TRUE, _ducting_layer, datum/reagents/custom_receiver)
if(!istype(parent, /obj/machinery/plumbing/buffer))
return COMPONENT_INCOMPATIBLE
return ..()
/datum/component/plumbing/buffer/can_give(amount, reagent, datum/ductnet/net)
var/obj/machinery/plumbing/buffer/buffer = parent
return (buffer.mode == READY) ? ..() : FALSE
#undef READY
@@ -1,6 +1,6 @@
/datum/component/plumbing/reaction_chamber
demand_connects = WEST
supply_connects = EAST
demand_connects = NORTH
supply_connects = SOUTH
/datum/component/plumbing/reaction_chamber/Initialize(start=TRUE, _turn_connects=TRUE)
. = ..()
@@ -10,25 +10,18 @@
/datum/component/plumbing/reaction_chamber/can_give(amount, reagent, datum/ductnet/net)
. = ..()
var/obj/machinery/plumbing/reaction_chamber/RC = parent
if(!. || !RC.emptying)
if(!. || !RC.emptying || reagents.is_reacting == TRUE)
return FALSE
/datum/component/plumbing/reaction_chamber/send_request(dir)
var/obj/machinery/plumbing/reaction_chamber/RC = parent
if(RC.emptying || !LAZYLEN(RC.required_reagents))
if(RC.emptying)
return
process_request(amount = min(MACHINE_REAGENT_TRANSFER, RC.target_volume - reagents.total_volume), dir = dir)
if(RC.target_volume > round(reagents.total_volume, CHEMICAL_VOLUME_ROUNDING)) //not enough yet
return
for(var/RT in RC.required_reagents)
var/has_reagent = FALSE
for(var/A in reagents.reagent_list)
var/datum/reagent/RD = A
if(RT == RD.type)
has_reagent = TRUE
if(RD.volume < RC.required_reagents[RT])
process_request(min(RC.required_reagents[RT] - RD.volume, MACHINE_REAGENT_TRANSFER) , RT, dir)
return
if(!has_reagent)
process_request(min(RC.required_reagents[RT], MACHINE_REAGENT_TRANSFER), RT, dir)
return
reagents.flags &= ~NO_REACT
reagents.handle_reactions()
@@ -37,8 +30,24 @@
//everything for every chemical removed, wich isn't a good option either.
RC.on_reagent_change(reagents) //We need to check it now, because some reactions leave nothing left.
///Special connect that we currently use for reaction chambers. Being used so we can keep certain inputs seperate, like into a special internal acid container
/datum/component/plumbing/acidic_input
demand_connects = WEST
demand_color = "yellow"
ducting_layer = SECOND_DUCT_LAYER
/datum/component/plumbing/acidic_input/send_request(dir)
process_request(amount = MACHINE_REAGENT_TRANSFER, reagent = /datum/reagent/reaction_agent/acidic_buffer, dir = dir)
///Special connect that we currently use for reaction chambers. Being used so we can keep certain inputs seperate, like into a special internal base container
/datum/component/plumbing/alkaline_input
demand_connects = EAST
demand_color = "green"
ducting_layer = SECOND_DUCT_LAYER
/datum/component/plumbing/alkaline_input/send_request(dir)
process_request(amount = MACHINE_REAGENT_TRANSFER, reagent = /datum/reagent/reaction_agent/basic_buffer, dir = dir)
/datum/component/plumbing/reaction_chamber/transfer_to(datum/component/plumbing/target, amount, reagent, datum/ductnet/net)
if(reagents.is_reacting == TRUE) //Let the thing react in peace
return
return ..()