mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Arcmining: Chemical Boosting (#95530)
This commit is contained in:
@@ -20,6 +20,11 @@
|
||||
/// Ex - if this was set to "3", our component would only request the first 3 reagents found, even if more are available
|
||||
var/distinct_reagent_cap = INFINITY
|
||||
|
||||
///Extra offset on supply pipe.
|
||||
var/supply_offset = 0
|
||||
///Extra offset on demand pipe.
|
||||
var/demand_offset = 0
|
||||
|
||||
/datum/component/plumbing/Initialize(ducting_layer)
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
@@ -168,9 +173,7 @@
|
||||
if(tile_covered)
|
||||
return
|
||||
|
||||
//Copied from ducts handle_layer()
|
||||
var/offset
|
||||
|
||||
switch(ducting_layer)
|
||||
if(FIRST_DUCT_LAYER)
|
||||
offset = -10
|
||||
@@ -183,16 +186,36 @@
|
||||
if(FIFTH_DUCT_LAYER)
|
||||
offset = 10
|
||||
|
||||
var/duct_x = offset - parent_movable.pixel_x - parent_movable.pixel_w
|
||||
var/duct_y = offset - parent_movable.pixel_y - parent_movable.pixel_z
|
||||
var/duct_layer = PLUMBING_PIPE_VISIBILE_LAYER + ducting_layer * 0.0003
|
||||
|
||||
for(var/direction in GLOB.cardinals)
|
||||
var/color
|
||||
var/duct_x = offset - parent_movable.pixel_x - parent_movable.pixel_w
|
||||
var/duct_y = offset - parent_movable.pixel_y - parent_movable.pixel_z
|
||||
if(direction & initial(demand_connects))
|
||||
color = demand_color
|
||||
if(demand_offset)
|
||||
switch(parent_movable.dir)
|
||||
if(NORTH)
|
||||
duct_y -= demand_offset
|
||||
if(SOUTH)
|
||||
duct_y += demand_offset
|
||||
if(EAST)
|
||||
duct_x -= demand_offset
|
||||
if(WEST)
|
||||
duct_x += demand_offset
|
||||
else if(direction & initial(supply_connects))
|
||||
color = supply_color
|
||||
if(supply_offset)
|
||||
switch(parent_movable.dir)
|
||||
if(NORTH)
|
||||
duct_y += supply_offset
|
||||
if(SOUTH)
|
||||
duct_y -= supply_offset
|
||||
if(EAST)
|
||||
duct_x += supply_offset
|
||||
if(WEST)
|
||||
duct_x -= supply_offset
|
||||
else
|
||||
continue
|
||||
|
||||
@@ -218,6 +241,7 @@
|
||||
new_supply_connects |= turn(direction, angle)
|
||||
demand_connects = new_demand_connects
|
||||
supply_connects = new_supply_connects
|
||||
parent_obj.update_appearance(UPDATE_OVERLAYS)
|
||||
|
||||
if(length(ducts))
|
||||
disable()
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* The boulder machines take in many types of chems, but should only ever eject "waste" chems,
|
||||
*/
|
||||
/datum/component/plumbing/boulder_reactions
|
||||
demand_connects = NORTH
|
||||
supply_connects = SOUTH
|
||||
supply_offset = 4
|
||||
demand_offset = 4
|
||||
|
||||
/datum/component/plumbing/boulder_reactions/Initialize(ducting_layer)
|
||||
if(!istype(parent, /obj/machinery/bouldertech/refinery))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
return ..()
|
||||
|
||||
/datum/component/plumbing/boulder_reactions/can_give(amount, reagent, datum/ductnet/net)
|
||||
if(amount <= 0 || !reagents.total_volume || !reagent)
|
||||
return FALSE
|
||||
|
||||
var/obj/machinery/bouldertech/refinery/the_refinery = parent
|
||||
var/list/datum/reagents/boosters = the_refinery.booster_list
|
||||
|
||||
if(istype(amount, the_refinery.waste_chemical))
|
||||
return TRUE //Always allow waste chemicals to leave.
|
||||
|
||||
if(!length(boosters))
|
||||
return ..()
|
||||
for(var/datum/chem as anything in boosters)
|
||||
if(chem.type == reagent) // Need to check strict subtype since most acids are subtypes of eachother.
|
||||
return FALSE
|
||||
return ..()
|
||||
Reference in New Issue
Block a user