Skip to content

Commit

Permalink
fixes underfloor + atmos pipe placement (#6542)
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons committed Jun 29, 2024
1 parent dc73fa7 commit f117ff7
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 19 deletions.
12 changes: 6 additions & 6 deletions code/__DEFINES/objects/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#define OBJ_UNDERFLOOR_ALWAYS "always"
/// automatic
///
/// * gets set to UNDERFLOOR_NONE if we were made while the floor is intact
/// * gets set to UNDERFLOOR_NEVER if we were made while the floor is intact
/// * gets set to UNDERFLOOR_ALWAYS if we were made while the floor isn't intact
#define OBJ_UNDERFLOOR_IF_COVERED "initially-covered"
#define OBJ_UNDERFLOOR_IF_CREATED_UNCOVERED "initially-covered"
/// automatic
///
/// * DEPENDS_ON_CREATION, but always underfloor if made in mapload
#define OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP "initially-underfloor"
/// * IF_CREATED_UNCOVERED, but always underfloor if made in mapload
#define OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP "initially-underfloor"

DEFINE_ENUM("obj_hides_underfloor", list(
/obj = list(
Expand All @@ -29,6 +29,6 @@ DEFINE_ENUM("obj_hides_underfloor", list(
"Disabled" = OBJ_UNDERFLOOR_DISABLED,
"Never" = OBJ_UNDERFLOOR_NEVER,
"Always" = OBJ_UNDERFLOOR_ALWAYS,
"If Covered (Init Only)" = OBJ_UNDERFLOOR_IF_COVERED,
"If Created On Floor (Init Only)" = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP,
"If Created Uncovered (Init Only)" = OBJ_UNDERFLOOR_IF_CREATED_UNCOVERED,
"If Created Uncovered Or In Mapload (Init Only)" = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP,
))
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 = "Bluespace Gigabeacon"
desc = "A device that draws power from bluespace and creates a permanent tracking beacon."
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP
hides_underfloor_update_icon = TRUE
layer = UNDER_JUNK_LAYER
anchored = TRUE
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 @@ -13,7 +13,7 @@
anchored = TRUE
use_power = USE_POWER_IDLE
idle_power_usage = 50
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP
hides_underfloor_update_icon = TRUE

/// Radio frequency.
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 @@ -9,7 +9,7 @@ var/global/list/navbeacons = list() // no I don't like putting this in, but it w
name = "navigation beacon"
desc = "A beacon used for bot navigation."
plane = TURF_PLANE
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP
hides_underfloor_update_icon = TRUE
anchored = TRUE
/// TRUE if cover is open.
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/radio/beacon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ GLOBAL_LIST_BOILERPLATE(all_beacons, /obj/item/radio/beacon)
desc = "A beacon used by a teleporter. This one appears to be bolted to the ground."
anchored = TRUE
w_class = WEIGHT_CLASS_HUGE
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP

var/repair_fail_chance = 35

Expand Down
14 changes: 9 additions & 5 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
*/
/obj/proc/set_hides_underfloor(new_value, mapload)
switch(new_value)
if(OBJ_UNDERFLOOR_IF_COVERED, OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP)
if(OBJ_UNDERFLOOR_IF_CREATED_UNCOVERED, OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP)
var/turf/where_we_are = loc
if(istype(where_we_are) && where_we_are.hides_underfloor_objects())
new_value = OBJ_UNDERFLOOR_ALWAYS
Expand Down Expand Up @@ -946,15 +946,19 @@

/**
* called at init
*
* todo: should this be called from obj init? we can probably shave a few centiseconds off init if it was on turf
* as we wouldn't need to keep calling hides_underfloor_objects()
*/
/obj/proc/initialize_hiding_underfloor(mapload)
switch(hides_underfloor)
if(OBJ_UNDERFLOOR_IF_COVERED, OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP)
if(OBJ_UNDERFLOOR_IF_CREATED_UNCOVERED, OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP)
var/turf/where_we_are = loc
var/hide_anyways = (hides_underfloor == OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP) && mapload
if(istype(where_we_are) && (hide_anyways || where_we_are.hides_underfloor_objects()))
var/hide_anyways = (hides_underfloor == OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP) && mapload
var/we_are_hidden = where_we_are?.hides_underfloor_objects()
if(istype(where_we_are) && (hide_anyways || !we_are_hidden))
hides_underfloor = OBJ_UNDERFLOOR_ALWAYS
if(!mapload)
if(!mapload && we_are_hidden)
update_hiding_underfloor(TRUE)
else
hides_underfloor = OBJ_UNDERFLOOR_NEVER
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 @@ -171,7 +171,7 @@ FLOOR SAFES
density = 0
plane = TURF_PLANE
layer = BELOW_TURF_LAYER
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP

/obj/structure/safe/floor/Initialize(mapload)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/machinery/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Pipelines + Other Objects -> Pipe network
atom_colouration_system = FALSE
climb_allowed = FALSE
depth_projected = FALSE
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP
hides_underfloor_defaulting = FALSE

//* Underfloor *//
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/machinery/pipes/pipe_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/obj/machinery/atmospherics/pipe/Initialize(mapload, newdir)
// pipes are always underfloor if inside a wall
// we just check for loc.density 'cause speed lmao
if(loc.density)
if(loc?.density)
hides_underfloor = OBJ_UNDERFLOOR_ALWAYS
return ..()

Expand Down
1 change: 1 addition & 0 deletions code/modules/atmospherics/machinery/pipes/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
pipe_flags = PIPING_DEFAULT_LAYER_ONLY
density = TRUE
hides_underfloor_underlays = TRUE
hides_underfloor_defaulting = FALSE

var/start_pressure = 75*ONE_ATMOSPHERE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/shieldgen/shield_diffuser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
active_power_usage = 500 // Previously 2000
anchored = TRUE
density = FALSE
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_CREATED_ONTOP
hides_underfloor = OBJ_UNDERFLOOR_UNLESS_PLACED_ONTOP
hides_underfloor_update_icon = TRUE
var/alarm = FALSE
var/enabled = TRUE
Expand Down

0 comments on commit f117ff7

Please sign in to comment.