@@ -1,23 +1,41 @@
|
||||
//node2, air2, network2 correspond to input
|
||||
//node1, air1, network1 correspond to output
|
||||
|
||||
#define CIRCULATOR_COLD 0
|
||||
#define CIRCULATOR_HOT 1
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator
|
||||
name = "circulator/heat exchanger"
|
||||
desc = "A gas circulator pump and heat exchanger."
|
||||
icon_state = "circ1-off"
|
||||
icon_state = "circ-off"
|
||||
|
||||
var/side = CIRC_LEFT
|
||||
var/status = 0
|
||||
var/active = FALSE
|
||||
|
||||
var/last_pressure_delta = 0
|
||||
pipe_flags = PIPING_ONE_PER_TURF
|
||||
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
|
||||
|
||||
density = TRUE
|
||||
|
||||
var/global/const/CIRC_LEFT = 1
|
||||
var/global/const/CIRC_RIGHT = 2
|
||||
|
||||
var/flipped = 0
|
||||
var/mode = CIRCULATOR_HOT
|
||||
var/obj/machinery/power/generator/generator
|
||||
|
||||
//default cold circ for mappers
|
||||
/obj/machinery/atmospherics/components/binary/circulator/cold
|
||||
mode = CIRCULATOR_COLD
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
|
||||
.=..()
|
||||
component_parts = list(new /obj/item/circuitboard/machine/circulator)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/Destroy()
|
||||
if(generator)
|
||||
disconnectFromGenerator()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air()
|
||||
|
||||
@@ -56,11 +74,115 @@
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/update_icon()
|
||||
if(!is_operational())
|
||||
icon_state = "circ[side]-p"
|
||||
icon_state = "circ-p-[flipped]"
|
||||
else if(last_pressure_delta > 0)
|
||||
if(last_pressure_delta > ONE_ATMOSPHERE)
|
||||
icon_state = "circ[side]-run"
|
||||
icon_state = "circ-run-[flipped]"
|
||||
else
|
||||
icon_state = "circ[side]-slow"
|
||||
icon_state = "circ-slow-[flipped]"
|
||||
else
|
||||
icon_state = "circ[side]-off"
|
||||
icon_state = "circ-off-[flipped]"
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I)
|
||||
if(!panel_open)
|
||||
return
|
||||
anchored = !anchored
|
||||
I.play_tool_sound(src)
|
||||
if(generator)
|
||||
disconnectFromGenerator()
|
||||
to_chat(user, "<span class='notice'>You [anchored?"secure":"unsecure"] [src].</span>")
|
||||
|
||||
|
||||
var/obj/machinery/atmospherics/node1 = nodes[1]
|
||||
var/obj/machinery/atmospherics/node2 = nodes[2]
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
nodes[1] = null
|
||||
nullifyPipenet(parents[1])
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
nodes[2] = null
|
||||
nullifyPipenet(parents[2])
|
||||
|
||||
if(anchored)
|
||||
SetInitDirections()
|
||||
atmosinit()
|
||||
node1 = nodes[1]
|
||||
if(node1)
|
||||
node1.atmosinit()
|
||||
node1.addMember(src)
|
||||
node2 = nodes[2]
|
||||
if(node2)
|
||||
node2.atmosinit()
|
||||
node2.addMember(src)
|
||||
build_network()
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/SetInitDirections()
|
||||
switch(dir)
|
||||
if(NORTH, SOUTH)
|
||||
initialize_directions = EAST|WEST
|
||||
if(EAST, WEST)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/getNodeConnects()
|
||||
if(flipped)
|
||||
return list(turn(dir, 270), turn(dir, 90))
|
||||
return list(turn(dir, 90), turn(dir, 270))
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/can_be_node(obj/machinery/atmospherics/target)
|
||||
if(anchored)
|
||||
return ..(target)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/multitool_act(mob/living/user, obj/item/I)
|
||||
if(generator)
|
||||
disconnectFromGenerator()
|
||||
mode = !mode
|
||||
to_chat(user, "<span class='notice'>You set [src] to [mode?"cold":"hot"] mode.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/screwdriver_act(mob/user, obj/item/I)
|
||||
panel_open = !panel_open
|
||||
I.play_tool_sound(src)
|
||||
to_chat(user, "<span class='notice'>You [panel_open?"open":"close"] the panel on [src].</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/crowbar_act(mob/user, obj/item/I)
|
||||
default_deconstruction_crowbar(I)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction()
|
||||
if(generator)
|
||||
disconnectFromGenerator()
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/proc/disconnectFromGenerator()
|
||||
if(mode)
|
||||
generator.cold_circ = null
|
||||
else
|
||||
generator.hot_circ = null
|
||||
generator.update_icon()
|
||||
generator = null
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/setPipingLayer(new_layer)
|
||||
..()
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/circulator/verb/circulator_flip()
|
||||
set name = "Flip"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!ishuman(usr))
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "<span class='danger'>[src] is anchored!</span>")
|
||||
return
|
||||
|
||||
flipped = !flipped
|
||||
to_chat(usr, "<span class='notice'>You flip [src].</span>")
|
||||
update_icon()
|
||||
Reference in New Issue
Block a user