mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
cleans up ugliness in manual valves; moves the circulator's icons to binary_devices.dmi
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
/obj/machinery/atmospherics/binary/circulator
|
||||
name = "circulator/heat exchanger"
|
||||
desc = "A gas circulator pump and heat exchanger."
|
||||
icon = 'icons/obj/atmospherics/pipes/simple.dmi'
|
||||
icon_state = "circ1-off"
|
||||
|
||||
var/side = 1 // 1=left 2=right
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
Acts like a normal vent, but has an input AND output.
|
||||
*/
|
||||
#define EXT_BOUND 1
|
||||
#define INPUT_MIN 2
|
||||
#define OUTPUT_MAX 4
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump
|
||||
icon = 'icons/obj/atmospherics/unary_devices.dmi' //We reuse the normal vent icons!
|
||||
icon_state = "dpvent_map"
|
||||
@@ -20,10 +27,10 @@
|
||||
var/input_pressure_min = 0
|
||||
var/output_pressure_max = 0
|
||||
|
||||
var/pressure_checks = 1
|
||||
//1: Do not pass external_pressure_bound
|
||||
//2: Do not pass input_pressure_min
|
||||
//4: Do not pass output_pressure_max
|
||||
var/pressure_checks = EXT_BOUND
|
||||
//EXT_BOUND: Do not pass external_pressure_bound
|
||||
//INPUT_MIN: Do not pass input_pressure_min
|
||||
//OUTPUT_MAX: Do not pass output_pressure_max
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Destroy()
|
||||
if(radio_controller)
|
||||
@@ -65,9 +72,9 @@
|
||||
if(pump_direction) //input -> external
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(pressure_checks&1)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
if(pressure_checks&INPUT_MIN)
|
||||
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -84,9 +91,9 @@
|
||||
else //external -> output
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(pressure_checks&1)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&4)
|
||||
if(pressure_checks&INPUT_MIN)
|
||||
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -195,3 +202,7 @@
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
#undef EXT_BOUND
|
||||
#undef INPUT_MIN
|
||||
#undef OUTPUT_MAX
|
||||
@@ -1,37 +1,28 @@
|
||||
/*
|
||||
It's like a regular ol' straight pipe, but you can turn it on and off.
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve
|
||||
icon = 'icons/obj/atmospherics/binary_devices.dmi'
|
||||
icon_state = "mvalve_map"
|
||||
name = "manual valve"
|
||||
desc = "A pipe valve"
|
||||
|
||||
can_unwrench = 1
|
||||
var/open = 0
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
|
||||
var/open = 0
|
||||
var/type = "m" //lets us have a nice, clean, OOP update_icon_nopipes()
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/open
|
||||
open = 1
|
||||
|
||||
//Separate this because we don't need to update pipe icons if we just are going to crank the handle
|
||||
/obj/machinery/atmospherics/binary/valve/update_icon_nopipes(animation = 0)
|
||||
normalize_dir()
|
||||
icon_state = "mvalve_off"
|
||||
overlays.Cut()
|
||||
if(animation)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "mvalve_[open][!open]")
|
||||
else if(open)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "mvalve_on")
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/update_icon()
|
||||
update_icon_nopipes()
|
||||
var/connected = 0
|
||||
underlays.Cut()
|
||||
//Add non-broken pieces
|
||||
if(node1)
|
||||
connected = icon_addintact(node1, connected)
|
||||
if(node2)
|
||||
connected = icon_addintact(node2, connected)
|
||||
//Add broken pieces
|
||||
icon_addbroken(connected)
|
||||
flick("[type]valve_[open][!open]",src)
|
||||
icon_state = "[type]valve_[open?"on":"off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/open()
|
||||
open = 1
|
||||
@@ -40,19 +31,17 @@
|
||||
parent2.update = 0
|
||||
parent1.reconcile_air()
|
||||
investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos")
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/close()
|
||||
open = 0
|
||||
update_icon_nopipes()
|
||||
investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", "atmos")
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/normalize_dir()
|
||||
if(dir==2)
|
||||
dir = 1
|
||||
else if(dir==8)
|
||||
dir = 4
|
||||
if(dir==SOUTH)
|
||||
dir = NORTH
|
||||
else if(dir==WEST)
|
||||
dir = EAST
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/attack_ai(mob/user)
|
||||
return
|
||||
@@ -63,27 +52,21 @@
|
||||
sleep(10)
|
||||
if(open)
|
||||
close()
|
||||
else
|
||||
open()
|
||||
|
||||
return
|
||||
open()
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital // can be controlled by AI
|
||||
name = "digital valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon_state = "dvalve_map"
|
||||
type = "d"
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital/attack_ai(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital/update_icon_nopipes(animation)
|
||||
normalize_dir()
|
||||
if(stat & NOPOWER)
|
||||
normalize_dir()
|
||||
icon_state = "dvalve_nopower"
|
||||
overlays.Cut()
|
||||
return
|
||||
icon_state = "dvalve_off"
|
||||
overlays.Cut()
|
||||
if(animation)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "dvalve_[open][!open]")
|
||||
else if(open)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "dvalve_on")
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user