mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Omni device tweaks
- Better mapping support (mapping icons and can now set mixer concentration) - Trimmed overlay lists - Utilized existing procs for icon generation - Changed filter icon color to better contrast the output color
This commit is contained in:
@@ -21,7 +21,7 @@ var/global/list/omni_icons[]
|
||||
var/icon/omni = new('icons/obj/atmospherics/omni_devices.dmi')
|
||||
|
||||
for(var/state in omni.IconStates())
|
||||
if(!state)
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
|
||||
var/image/I = image('icons/obj/atmospherics/omni_devices.dmi', icon_state = state)
|
||||
@@ -49,7 +49,7 @@ var/global/list/omni_icons[]
|
||||
var/dir
|
||||
var/update = 1
|
||||
var/mode = 0
|
||||
var/concentration = 1
|
||||
var/concentration = 0
|
||||
var/con_lock = 0
|
||||
var/transfer_moles = 0
|
||||
var/datum/gas_mixture/air
|
||||
@@ -92,28 +92,39 @@ var/global/list/omni_icons[]
|
||||
|
||||
var/global/list/pipe_colors = list("grey" = null, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE)
|
||||
|
||||
/proc/dir_name(var/dir = 0)
|
||||
|
||||
//returns a text string based on the direction flag input
|
||||
// if capitalize is true, it will return the string capitalized
|
||||
// otherwise it will return the direction string in lower case
|
||||
/proc/dir_name(var/dir, var/capitalize = 0)
|
||||
var/string = null
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
return "North"
|
||||
string = "North"
|
||||
if(SOUTH)
|
||||
return "South"
|
||||
string = "South"
|
||||
if(EAST)
|
||||
return "East"
|
||||
string = "East"
|
||||
if(WEST)
|
||||
return "West"
|
||||
else
|
||||
return "None"
|
||||
string = "West"
|
||||
|
||||
if(!capitalize && string)
|
||||
string = lowertext(string)
|
||||
|
||||
return string
|
||||
|
||||
/proc/dir_flag(var/dir = "None")
|
||||
//returns a direction flag based on the string passed to it
|
||||
// case insensitive
|
||||
/proc/dir_flag(var/dir)
|
||||
dir = lowertext(dir)
|
||||
switch(dir)
|
||||
if("North")
|
||||
if("north")
|
||||
return NORTH
|
||||
if("South")
|
||||
if("south")
|
||||
return SOUTH
|
||||
if("East")
|
||||
if("east")
|
||||
return EAST
|
||||
if("West")
|
||||
if("west")
|
||||
return WEST
|
||||
else
|
||||
return 0
|
||||
@@ -3,8 +3,7 @@
|
||||
//--------------------------------------------
|
||||
/obj/machinery/atmospherics/omni/filter
|
||||
name = "omni gas filter"
|
||||
icon = 'icons/obj/atmospherics/omni_devices.dmi'
|
||||
icon_state = ""
|
||||
icon_state = "map_filter"
|
||||
|
||||
var/list/filters = new()
|
||||
var/datum/omni_port/input
|
||||
@@ -153,7 +152,7 @@
|
||||
if(ATM_O2 to ATM_N2O)
|
||||
f_type = mode_send_switch(P.mode)
|
||||
|
||||
portData[++portData.len] = list("dir" = dir_name(P.dir), \
|
||||
portData[++portData.len] = list("dir" = dir_name(P.dir, capitalize = 1), \
|
||||
"input" = input, \
|
||||
"output" = output, \
|
||||
"filter" = filter, \
|
||||
|
||||
@@ -3,11 +3,35 @@
|
||||
//--------------------------------------------
|
||||
/obj/machinery/atmospherics/omni/mixer
|
||||
name = "omni gas mixer"
|
||||
icon = 'icons/obj/atmospherics/omni_devices.dmi'
|
||||
icon_state = "map_mixer"
|
||||
|
||||
var/list/inputs = new()
|
||||
var/datum/omni_port/output
|
||||
|
||||
//setup tags for initial concentration values (must be decimal)
|
||||
var/tag_north_con
|
||||
var/tag_south_con
|
||||
var/tag_east_con
|
||||
var/tag_west_con
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/New()
|
||||
..()
|
||||
if(mapper_set())
|
||||
for(var/datum/omni_port/P in ports)
|
||||
switch(P.dir)
|
||||
if(NORTH)
|
||||
if(tag_north_con)
|
||||
P.concentration = tag_north_con
|
||||
if(SOUTH)
|
||||
if(tag_south_con)
|
||||
P.concentration = tag_south_con
|
||||
if(EAST)
|
||||
if(tag_east_con)
|
||||
P.concentration = tag_east_con
|
||||
if(WEST)
|
||||
if(tag_west_con)
|
||||
P.concentration = tag_west_con
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/Del()
|
||||
inputs.Cut()
|
||||
output = null
|
||||
@@ -28,13 +52,17 @@
|
||||
if(ATM_OUTPUT)
|
||||
output = P
|
||||
|
||||
for(var/datum/omni_port/P in inputs)
|
||||
P.concentration = 1 / inputs.len
|
||||
if(!mapper_set())
|
||||
for(var/datum/omni_port/P in inputs)
|
||||
P.concentration = 1 / max(1, inputs.len)
|
||||
|
||||
if(output)
|
||||
output.air.volume *= 0.75 * inputs.len
|
||||
output.concentration = 1
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/proc/mapper_set()
|
||||
return (tag_north_con || tag_south_con || tag_east_con || tag_west_con)
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/error_check()
|
||||
if(!output || !inputs)
|
||||
return 1
|
||||
@@ -131,7 +159,7 @@
|
||||
if(ATM_OUTPUT)
|
||||
output = 1
|
||||
|
||||
portData[++portData.len] = list("dir" = dir_name(P.dir), \
|
||||
portData[++portData.len] = list("dir" = dir_name(P.dir, capitalize = 1), \
|
||||
"concentration" = P.concentration, \
|
||||
"input" = input, \
|
||||
"output" = output, \
|
||||
@@ -215,6 +243,11 @@
|
||||
update_ports()
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/proc/change_concentration(var/port = NORTH)
|
||||
tag_north_con = null
|
||||
tag_south_con = null
|
||||
tag_east_con = null
|
||||
tag_west_con = null
|
||||
|
||||
var/old_con = 0
|
||||
var/non_locked = 0
|
||||
var/remain_con = 1
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//--------------------------------------------
|
||||
/obj/machinery/atmospherics/omni
|
||||
name = "omni device"
|
||||
icon_state = ""
|
||||
dir = SOUTH
|
||||
icon = 'icons/obj/atmospherics/omni_devices.dmi'
|
||||
icon_state = "base"
|
||||
use_power = 1
|
||||
initialize_directions = 0
|
||||
|
||||
@@ -12,19 +12,15 @@
|
||||
var/configuring = 0
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
var/icon/icon_on
|
||||
var/icon/icon_off
|
||||
var/icon/icon_error
|
||||
|
||||
var/tag_north = ATM_NONE
|
||||
var/tag_south = ATM_NONE
|
||||
var/tag_east = ATM_NONE
|
||||
var/tag_west = ATM_NONE
|
||||
|
||||
var/overlays_on[8]
|
||||
var/overlays_off[8]
|
||||
var/overlays_on[5]
|
||||
var/overlays_off[5]
|
||||
var/overlays_error[2]
|
||||
var/underlays_current[8]
|
||||
var/underlays_current[4]
|
||||
|
||||
var/list/ports = new()
|
||||
|
||||
@@ -83,6 +79,14 @@
|
||||
if(!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
|
||||
var/int_pressure = 0
|
||||
for(var/datum/omni_port/P in ports)
|
||||
int_pressure += P.air.return_pressure()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_pressure - env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "<span class='warning'>You cannot unwrench [src], it is too exerted due to internal pressure.</span>"
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
if(do_after(user, 40))
|
||||
@@ -113,10 +117,10 @@
|
||||
else
|
||||
return
|
||||
|
||||
//directional icons are layers 1,2,4,8, so the core icon is layer 3
|
||||
//directional icons are layers 1-4, with the core icon on layer 5
|
||||
if(core_icon)
|
||||
overlays_off[3] = omni_icons[core_icon]
|
||||
overlays_on[3] = omni_icons[core_icon + "_glow"]
|
||||
overlays_off[5] = omni_icons[core_icon]
|
||||
overlays_on[5] = omni_icons[core_icon + "_glow"]
|
||||
|
||||
overlays_error[1] = omni_icons[core_icon]
|
||||
overlays_error[2] = omni_icons["error"]
|
||||
@@ -126,18 +130,32 @@
|
||||
/obj/machinery/atmospherics/omni/proc/update_port_icons()
|
||||
for(var/datum/omni_port/P in ports)
|
||||
if(P.update)
|
||||
var/ref_layer = 0
|
||||
switch(P.dir)
|
||||
if(NORTH)
|
||||
ref_layer = 1
|
||||
if(SOUTH)
|
||||
ref_layer = 2
|
||||
if(EAST)
|
||||
ref_layer = 3
|
||||
if(WEST)
|
||||
ref_layer = 4
|
||||
|
||||
if(!ref_layer)
|
||||
continue
|
||||
|
||||
var/list/port_icons = select_port_icons(P)
|
||||
if(port_icons)
|
||||
if(P.node)
|
||||
underlays_current[P.dir] = omni_icons[port_icons["pipe_icon"]]
|
||||
underlays_current[ref_layer] = omni_icons[port_icons["pipe_icon"]]
|
||||
else
|
||||
underlays_current[P.dir] = null
|
||||
overlays_off[P.dir] = omni_icons[port_icons["off_icon"]]
|
||||
overlays_on[P.dir] = omni_icons[port_icons["on_icon"]]
|
||||
underlays_current[ref_layer] = null
|
||||
overlays_off[ref_layer] = omni_icons[port_icons["off_icon"]]
|
||||
overlays_on[ref_layer] = omni_icons[port_icons["on_icon"]]
|
||||
else
|
||||
underlays_current[P.dir] = null
|
||||
overlays_off[P.dir] = null
|
||||
overlays_on[P.dir] = null
|
||||
underlays_current[ref_layer] = null
|
||||
overlays_off[ref_layer] = null
|
||||
overlays_on[ref_layer] = null
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -146,36 +164,26 @@
|
||||
return
|
||||
|
||||
if(P.mode > 0)
|
||||
var/ic_dir = null
|
||||
switch(P.dir)
|
||||
if(NORTH)
|
||||
ic_dir = "north"
|
||||
if(SOUTH)
|
||||
ic_dir = "south"
|
||||
if(EAST)
|
||||
ic_dir = "east"
|
||||
if(WEST)
|
||||
ic_dir = "west"
|
||||
|
||||
var/ic_on = null
|
||||
var/ic_off = null
|
||||
var/ic_dir = dir_name(P.dir)
|
||||
var/ic_on = ic_dir
|
||||
var/ic_off = ic_dir
|
||||
switch(P.mode)
|
||||
if(ATM_INPUT)
|
||||
ic_on = "_in_glow"
|
||||
ic_off = "_in"
|
||||
ic_on += "_in_glow"
|
||||
ic_off += "_in"
|
||||
if(ATM_OUTPUT)
|
||||
ic_on = "_out_glow"
|
||||
ic_off = "_out"
|
||||
ic_on += "_out_glow"
|
||||
ic_off += "_out"
|
||||
if(ATM_O2 to ATM_N2O)
|
||||
ic_on = "_filter"
|
||||
ic_off = "_out"
|
||||
ic_on += "_filter"
|
||||
ic_off += "_out"
|
||||
|
||||
var/pipe_state = ic_dir + "_pipe"
|
||||
if(P.node)
|
||||
if(P.node.color)
|
||||
pipe_state += "_[P.node.color]"
|
||||
|
||||
return list("on_icon" = ic_dir + ic_on, "off_icon" = ic_dir + ic_off, "pipe_icon" = pipe_state)
|
||||
return list("on_icon" = ic_on, "off_icon" = ic_off, "pipe_icon" = pipe_state)
|
||||
|
||||
/obj/machinery/atmospherics/omni/proc/update_ports()
|
||||
sort_ports()
|
||||
|
||||
Reference in New Issue
Block a user