Skip to content

Commit

Permalink
Adds defines for atom levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Fall authored and comma committed Sep 30, 2023
1 parent d326d28 commit 6e719ee
Show file tree
Hide file tree
Showing 37 changed files with 77 additions and 72 deletions.
5 changes: 4 additions & 1 deletion code/__defines/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,7 @@
#define DEFAULT_APPEARANCE_FLAGS (PIXEL_SCALE)

///Formats exceptions into a readable string with all the details.
#define EXCEPTION_TEXT(E) "'[E.name]' ('[E.type]'): '[E.file]':[E.line]:\n'[E.desc]'"
#define EXCEPTION_TEXT(E) "'[E.name]' ('[E.type]'): '[E.file]':[E.line]:\n'[E.desc]'"

#define LEVEL_BELOW_PLATING 1
#define LEVEL_ABOVE_PLATING 2
4 changes: 2 additions & 2 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/atom
/// (1 | 2) Determines if this atom is below `1` or above `2` plating. TODO: Use defines.
var/level = 2
/// (DEFINE) Determines where this atom sits in terms of turf plating. See misc.dm
var/level = LEVEL_ABOVE_PLATING
/// (BITFLAG) See flags.dm
var/atom_flags = ATOM_FLAG_NO_TEMP_CHANGE
/// (FLOAT) The world.time that this atom last bumped another. Used mostly by mobs.
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/Beacon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
icon_state = "floor_beaconf"
name = "tracking beacon"
desc = "A device that uses zero-point energy to create a permanent tracking beacon."
level = 1 // underfloor
level = LEVEL_BELOW_PLATING
anchored = TRUE
idle_power_usage = 0
var/obj/item/radio/beacon/beacon
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/magnet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var/global/list/magnetic_modules = list()
icon_state = "floor_magnet-f"
name = "Electromagnetic Generator"
desc = "A device that uses powernet to create points of magnetic energy."
level = 1 // underfloor
level = LEVEL_BELOW_PLATING
layer = ABOVE_WIRE_LAYER
anchored = TRUE
idle_power_usage = 50
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/navbeacon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var/global/list/navbeacons = list()
icon_state = "navbeacon0-f"
name = "navigation beacon"
desc = "A radio beacon used for bot navigation."
level = 1
level = LEVEL_BELOW_PLATING
layer = ABOVE_WIRE_LAYER
anchored = TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/pipe/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Buildable meters
randpixel = 5
item_state = "buildpipe"
w_class = ITEM_SIZE_NORMAL
level = 2
level = LEVEL_ABOVE_PLATING
obj_flags = OBJ_FLAG_ROTATABLE
dir = SOUTH
material = /decl/material/solid/metal/steel
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/t_scanner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
continue

for(var/obj/O in T.contents)
if(O.level != 1)
if(O.level != LEVEL_BELOW_PLATING)
continue
if(!O.invisibility)
continue //if it's already visible don't need an overlay for it
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
/obj/item/storage/backpack/satchel/flat
name = "smuggler's satchel"
desc = "A very slim satchel that can easily fit into tight spaces."
level = 1
level = LEVEL_BELOW_PLATING
w_class = ITEM_SIZE_NORMAL //Can fit in backpacks itself.
storage_slots = 5
max_w_class = ITEM_SIZE_NORMAL
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
set_invisibility(hide ? INVISIBILITY_MAXIMUM : initial(invisibility))

/obj/proc/hides_under_flooring()
return level == 1
return level == LEVEL_BELOW_PLATING

/obj/proc/hear_talk(mob/M, text, verb, decl/language/speaking)
if(talking_atom)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/safe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ FLOOR SAFES
name = "floor safe"
icon_state = "floorsafe"
density = FALSE
level = 1 //underfloor
level = LEVEL_BELOW_PLATING
layer = BELOW_OBJ_LAYER

/obj/structure/safe/floor/Initialize()
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/simulated/floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
return flooring?.get_movement_delay(travel_dir, mover) || ..()

/turf/simulated/floor/protects_atom(var/atom/A)
return (A.level <= 1 && !is_plating()) || ..()
return (A.level <= LEVEL_BELOW_PLATING && !is_plating()) || ..()

/turf/simulated/floor/Initialize(var/ml, var/floortype)
. = ..(ml)
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/turf
icon = 'icons/turf/floors.dmi'
level = 1
level = LEVEL_BELOW_PLATING
abstract_type = /turf
is_spawnable_type = TRUE
layer = TURF_LAYER
Expand Down
8 changes: 4 additions & 4 deletions code/modules/atmospherics/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ Pipelines + Other Objects -> Pipe network
return nodes_to_networks[node]

/obj/machinery/atmospherics/hide(var/do_hide)
if(do_hide && level == 1)
if(do_hide && level == LEVEL_BELOW_PLATING)
layer = PIPE_LAYER
else
reset_plane_and_layer()

/obj/machinery/atmospherics/proc/add_underlay(var/turf/T, var/obj/machinery/atmospherics/node, var/direction, var/icon_connect_type, var/default_state = "exposed")
var/state = default_state
if(node)
if(!T.is_plating() && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
if(!T.is_plating() && node.level == LEVEL_BELOW_PLATING && istype(node, /obj/machinery/atmospherics/pipe))
state = "down"
else
state = "intact"
Expand All @@ -107,7 +107,7 @@ Pipelines + Other Objects -> Pipe network
for(var/obj/machinery/atmospherics/node as anything in nodes_to_networks)
var/node_dir = get_dir(src, node)
disconnected_directions &= ~node_dir
if(hide_hidden_pipes && !T.is_plating() && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
if(hide_hidden_pipes && !T.is_plating() && node.level == LEVEL_BELOW_PLATING && istype(node, /obj/machinery/atmospherics/pipe))
continue
else
add_underlay(T, node, node_dir, node.icon_connect_type)
Expand Down Expand Up @@ -237,7 +237,7 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/proc/set_initial_level()
var/turf/T = get_turf(src)
if(T)
level = (!T.is_plating() ? 2 : 1)
level = (T.is_plating() ? LEVEL_BELOW_PLATING : LEVEL_ABOVE_PLATING)

/obj/machinery/atmospherics/proc/deconstruction_pressure_check()
return TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/obj/machinery/atmospherics/binary/passive_gate
icon = 'icons/atmos/passive_gate.dmi'
icon_state = "map_off"
level = 1
level = LEVEL_BELOW_PLATING

name = "pressure regulator"
desc = "A one-way air valve that can be used to regulate input or output pressure, and flow rate. Does not require power."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump
icon = 'icons/atmos/pump.dmi'
icon_state = "map_off"
level = 1
level = LEVEL_BELOW_PLATING

name = "gas pump"
desc = "A pump."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/binary/pump/high_power
icon = 'icons/atmos/volume_pump.dmi'
icon_state = "map_off"
level = 1
level = LEVEL_BELOW_PLATING

name = "high power gas pump"
desc = "A pump. Has double the power rating of the standard gas pump."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
icon = 'icons/atmos/omni_devices.dmi'
icon_state = "base"
initialize_directions = 0
level = 1
level = LEVEL_BELOW_PLATING
var/core_icon

var/configuring = 0
Expand Down Expand Up @@ -213,7 +213,7 @@
if(!istype(T))
return
var/obj/machinery/atmospherics/node = LAZYACCESS(P.nodes, 1)
if(!T.is_plating() && istype(node, /obj/machinery/atmospherics/pipe) && node.level == 1 )
if(!T.is_plating() && istype(node, /obj/machinery/atmospherics/pipe) && node.level == LEVEL_BELOW_PLATING)
pipe_state_key = "down"
else
pipe_state_key = "intact"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
frame_type = /obj/item/pipe
construct_state = /decl/machine_construction/pipe

level = 1
level = LEVEL_BELOW_PLATING

connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_FUEL
build_icon_state = "connector"
Expand Down
6 changes: 3 additions & 3 deletions code/modules/atmospherics/components/shutoff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var/global/list/shutoff_valves = list()
name = "automatic shutoff valve"
desc = "An automatic valve with control circuitry and pipe integrity sensor, capable of automatically isolating damaged segments of the pipe network."
var/close_on_leaks = TRUE // If false it will be always open
level = 1
level = LEVEL_BELOW_PLATING
connect_types = CONNECT_TYPE_SCRUBBER | CONNECT_TYPE_SUPPLY | CONNECT_TYPE_REGULAR | CONNECT_TYPE_FUEL
build_icon_state = "svalve"
base_type = /obj/machinery/atmospherics/valve/shutoff/buildable
Expand Down Expand Up @@ -41,9 +41,9 @@ var/global/list/shutoff_valves = list()

/obj/machinery/atmospherics/valve/shutoff/hide(var/do_hide)
if(do_hide)
if(level == 1)
if(level == LEVEL_BELOW_PLATING)
layer = PIPE_LAYER
else if(level == 2)
else if(level == LEVEL_ABOVE_PLATING)
..()
else
reset_plane_and_layer()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/components/tvalve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name = "manual switching valve"
desc = "A pipe valve."

level = 1
level = LEVEL_BELOW_PLATING
dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@
/obj/machinery/atmospherics/unary/heat_exchanger/cannot_transition_to(state_path, mob/user)
if(state_path == /decl/machine_construction/default/deconstructed)
var/turf/T = get_turf(src)
if (level==1 && isturf(T) && !T.is_plating())
if (level == LEVEL_BELOW_PLATING && isturf(T) && !T.is_plating())
return SPAN_WARNING("You must remove the plating first.")
return ..()
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

var/volume_rate = 50 //flow rate limit

level = 1
level = LEVEL_BELOW_PLATING

connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_FUEL

Expand Down
8 changes: 5 additions & 3 deletions code/modules/atmospherics/components/unary/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var/start_pressure = 25 ATM
var/filling // list of gas ratios to use.

level = 1
level = LEVEL_BELOW_PLATING
dir = SOUTH
initialize_directions = 2
density = TRUE
Expand Down Expand Up @@ -37,7 +37,9 @@
update_icon()

/obj/machinery/atmospherics/unary/tank/set_initial_level()
level = 1 // Always on top, apparently.
// This effectively does nothing, it's ignored due to hide() being overwritten
// and probably needs to be reworked.
level = LEVEL_BELOW_PLATING

/obj/machinery/atmospherics/unary/tank/on_update_icon()
build_device_underlays(FALSE)
Expand Down Expand Up @@ -92,7 +94,7 @@
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_REGULAR|CONNECT_TYPE_SCRUBBER|CONNECT_TYPE_FUEL
w_class = ITEM_SIZE_STRUCTURE
density = TRUE
level = 1
level = LEVEL_BELOW_PLATING
dir = SOUTH
constructed_path = /obj/machinery/atmospherics/unary/tank
pipe_class = PIPE_CLASS_UNARY
4 changes: 2 additions & 2 deletions code/modules/atmospherics/components/unary/vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
power_rating = 30000 // 30000 W ~ 40 HP

connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_FUEL //connects to regular, supply pipes, and fuel pipes
level = 1
level = LEVEL_BELOW_PLATING
identifier = "AVP"

var/hibernate = 0 //Do we even process?
Expand Down Expand Up @@ -338,7 +338,7 @@
var/turf/T = src.loc
var/hidden_pipe_check = FALSE
for(var/obj/machinery/atmospherics/node as anything in nodes_to_networks)
if(node.level)
if(node.level == LEVEL_BELOW_PLATING)
hidden_pipe_check = TRUE
break
if (hidden_pipe_check && isturf(T) && !T.is_plating())
Expand Down
4 changes: 2 additions & 2 deletions code/modules/atmospherics/components/unary/vent_scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SCRUBBER //connects to regular and scrubber pipes
identifier = "AScr"

level = 1
level = LEVEL_BELOW_PLATING

var/hibernate = 0 //Do we even process?
var/scrubbing = SCRUBBER_EXCHANGE
Expand Down Expand Up @@ -193,7 +193,7 @@
var/turf/T = get_turf(src)
var/hidden_pipe_check = FALSE
for(var/obj/machinery/atmospherics/node as anything in nodes_to_networks)
if(node.level)
if(node.level == LEVEL_BELOW_PLATING)
hidden_pipe_check = TRUE
break
if (hidden_pipe_check && isturf(T) && !T.is_plating())
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/components/valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name = "manual valve"
desc = "A pipe valve."

level = 1
level = LEVEL_BELOW_PLATING
dir = SOUTH
initialize_directions = SOUTH|NORTH

Expand Down
4 changes: 2 additions & 2 deletions code/modules/atmospherics/he_pipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
icon = 'icons/atmos/heat.dmi'
icon_state = "11"
color = "#404040"
level = 2
level = LEVEL_ABOVE_PLATING
connect_types = CONNECT_TYPE_HE
interact_offline = TRUE //Needs to be set so that pipes don't say they lack power in their description
var/initialize_directions_he
Expand Down Expand Up @@ -111,7 +111,7 @@
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
icon = 'icons/atmos/junction.dmi'
icon_state = "11"
level = 2
level = LEVEL_ABOVE_PLATING
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_HE|CONNECT_TYPE_FUEL
build_icon_state = "junction"
rotate_class = PIPE_ROTATE_STANDARD
Expand Down
Loading

0 comments on commit 6e719ee

Please sign in to comment.