Refactor /turf/var/intact (#62331)

Turfs have a variable, intact, which conflates three meanings:

    Determining whether there's something that can be pried out, such as directly with a crowbar or indirectly with a tile stack and a crowbar off-hand.
    Determining whether underfloor pieces are visible.
    Determining whether underfloor pieces can be interacted with - by players with tools, through interaction with effects like chemical acid, or foam.

When plating is hit with a stack of tiles, /turf/open/floor/attackby checks whether the turf is intact, and if so, ends the attack chain regardless of whether or not the attempt to hotswap a turf (with a crowbar) is successful or not. However, turfs which want the underfloor to be visible - such as catwalks and glass - set the intact variable to FALSE, and so can be repeatedly placed over one another, as if they were the first tile to be placed over the plating.

This refactors /turf/var/intact into two distinct variables:

    /turf/var/overfloor_placed, for whether or not there is something over plating.
    /turf/var/underfloor_visible, for whether or not the various underfloor pieces should be invisible, visible, or both visible and interactable.

All references to /turf/var/intact have been replaced with an equivalent overfloor_placed or underfloor_visible reference, depending on which check is appropriate. underfloor_accessibility can take one of UNDERFLOOR_HIDDEN, UNDERFLOOR_VISIBLE, or UNDERFLOOR_INTERACTABLE. This prevents cases such as acid foam or tools phasing through glass floors to affect the underfloor pieces underneath, and covers all kinds of unusual, not-wiring-visiblity usage such as Holodeck completeness, Revenant interaction, or station integrity checking.
This commit is contained in:
esainane
2021-10-28 19:14:40 -03:00
committed by GitHub
parent 2343a73dba
commit d521116acf
29 changed files with 58 additions and 46 deletions
+7 -5
View File
@@ -25,6 +25,9 @@ and clear when youre done! if you dont i will use :newspaper2: on you
#define HOLODECK_CD 2 SECONDS
#define HOLODECK_DMG_CD 5 SECONDS
/// typecache for turfs that should be considered ok during floorchecks.
/// A linked turf being anything not in this typecache will cause the holodeck to perform an emergency shutdown.
GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf/open/floor/holofloor, /turf/closed)))
/obj/machinery/computer/holodeck
name = "holodeck control console"
@@ -365,13 +368,12 @@ and clear when youre done! if you dont i will use :newspaper2: on you
active = FALSE
load_program(offline_program, TRUE)
///returns TRUE if the entire floor of the holodeck is intact, returns FALSE if any are broken
///returns TRUE if all floors of the holodeck are present, returns FALSE if any are broken or removed
/obj/machinery/computer/holodeck/proc/floorcheck()
for(var/turf/holo_floor in linked)
if(isspaceturf(holo_floor))
return FALSE
if(!holo_floor.intact)
return FALSE
if (is_type_in_typecache(holo_floor, GLOB.typecache_holodeck_linked_floorcheck_ok))
continue
return FALSE
return TRUE
///changes all weapons in the holodeck to do stamina damage if set