diff --git a/code/__DEFINES/turfs.dm b/code/__DEFINES/turfs.dm index 14911e1ddbd..b65eff683ac 100644 --- a/code/__DEFINES/turfs.dm +++ b/code/__DEFINES/turfs.dm @@ -22,3 +22,7 @@ #define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL)) #define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3])) + +#define UNDERFLOOR_HIDDEN 0 +#define UNDERFLOOR_VISIBLE 1 +#define UNDERFLOOR_INTERACTABLE 2 diff --git a/code/controllers/subsystem/minor_mapping.dm b/code/controllers/subsystem/minor_mapping.dm index 7ce2a6fd2ec..1d21bd9997c 100644 --- a/code/controllers/subsystem/minor_mapping.dm +++ b/code/controllers/subsystem/minor_mapping.dm @@ -41,7 +41,7 @@ SUBSYSTEM_DEF(minor_mapping) var/turf/T = pick_n_take(turfs) var/obj/item/storage/backpack/satchel/flat/F = new(T) - SEND_SIGNAL(F, COMSIG_OBJ_HIDE, T.intact) + SEND_SIGNAL(F, COMSIG_OBJ_HIDE, T.underfloor_accessibility < UNDERFLOOR_VISIBLE) amount-- /proc/find_exposed_wires() diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 7a01a4fe3fd..394e3824a31 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -294,10 +294,10 @@ net.add_plumber(src, dir) net.add_plumber(P, opposite_dir) -/datum/component/plumbing/proc/hide(atom/movable/AM, intact) +/datum/component/plumbing/proc/hide(atom/movable/AM, should_hide) SIGNAL_HANDLER - tile_covered = intact + tile_covered = should_hide AM.update_appearance() /datum/component/plumbing/proc/change_ducting_layer(obj/caller, obj/O, new_layer = DUCT_LAYER_DEFAULT) diff --git a/code/datums/station_integrity.dm b/code/datums/station_integrity.dm index 6f8062403b5..f38434c1fa5 100644 --- a/code/datums/station_integrity.dm +++ b/code/datums/station_integrity.dm @@ -38,15 +38,11 @@ floor += 2 if(iswallturf(T)) - var/turf/closed/wall/TW = T - if(TW.intact) - wall += 2 - else - wall += 1 + wall += 1 if(istype(T, /turf/closed/wall/r_wall)) var/turf/closed/wall/r_wall/TRW = T - if(TRW.intact) + if(TRW.d_state == INTACT) r_wall += 2 else r_wall += 1 diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 172b7157951..1f53d4f70f0 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -98,7 +98,7 @@ /obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params) var/turf/T = loc - if(T.intact) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) return // prevent intraction when T-scanner revealed if(I.tool_behaviour == TOOL_SCREWDRIVER) @@ -131,7 +131,7 @@ . = ..() var/ai = isAI(user) var/turf/T = loc - if(T.intact) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) return // prevent intraction when T-scanner revealed if(!open && !ai) // can't alter controls if not open, unless you're an AI diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index 263d88f88a7..7488420a3bc 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -142,7 +142,7 @@ if(!O.anchored) if(isturf(O.loc)) var/turf/T = O.loc - if(T.intact && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) continue var/mob/living/target = locate() in view(4,src) if(target && !target.stat) diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index a59d564d6c6..412eef18e22 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -144,7 +144,7 @@ continue if(isturf(O.loc)) var/turf/T = O.loc - if(T.intact && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) continue if(lifetime % reagent_divisor) reagents.expose(O, VAPOR, fraction) diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index da5ac24278f..543ebdbb28e 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -241,7 +241,7 @@ for(var/atom/movable/AM in T) if(AM.type == src.type) continue - if(T.intact && HAS_TRAIT(AM, TRAIT_T_RAY_VISIBLE)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(AM, TRAIT_T_RAY_VISIBLE)) continue reagents.expose(AM, TOUCH, fraction) diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index 44d110ab4b1..eaf2e7d478b 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -78,7 +78,7 @@ if(I.tool_behaviour == TOOL_WRENCH) if(mode == DISCONNECTED) var/turf/T = loc - if(isturf(T) && !T.intact) + if(isturf(T) && T.underfloor_accessibility >= UNDERFLOOR_INTERACTABLE) attached = locate() in T if(!attached) to_chat(user, span_warning("\The [src] must be placed over an exposed, powered cable node!")) diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index cf8f29def75..b4e1a3a0c52 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -45,7 +45,7 @@ return if(isturf(loc)) var/turf/T = loc - if(T.intact && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE)) return take_damage(400, BRUTE, MELEE, 0, get_dir(src, B)) @@ -127,7 +127,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e /obj/fire_act(exposed_temperature, exposed_volume) if(isturf(loc)) var/turf/T = loc - if(T.intact && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE)) return if(exposed_temperature && !(resistance_flags & FIRE_PROOF)) take_damage(clamp(0.02 * exposed_temperature, 0, 20), BURN, FIRE, 0) diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index dd61a6b94b9..5c2f775c3d5 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -18,9 +18,10 @@ thermal_conductivity = 0.04 heat_capacity = 10000 - intact = TRUE tiled_dirt = TRUE + overfloor_placed = TRUE + var/broken = FALSE var/burnt = FALSE var/floor_tile = null //tile that this floor drops @@ -166,7 +167,7 @@ . = ..() if(.) return . - if(intact && istype(object, /obj/item/stack/tile)) + if(overfloor_placed && istype(object, /obj/item/stack/tile)) try_replace_tile(object, user, params) return TRUE if(user.combat_mode && istype(object, /obj/item/stack/sheet)) @@ -175,7 +176,7 @@ return FALSE /turf/open/floor/crowbar_act(mob/living/user, obj/item/I) - if(intact && pry_tile(I, user)) + if(overfloor_placed && pry_tile(I, user)) return TRUE /turf/open/floor/proc/try_replace_tile(obj/item/stack/tile/T, mob/user, params) diff --git a/code/game/turfs/open/floor/catwalk_plating.dm b/code/game/turfs/open/floor/catwalk_plating.dm index c786937bc46..680f7d75d14 100644 --- a/code/game/turfs/open/floor/catwalk_plating.dm +++ b/code/game/turfs/open/floor/catwalk_plating.dm @@ -13,6 +13,7 @@ baseturfs = /turf/open/floor/plating floor_tile = /obj/item/stack/tile/catwalk_tile footstep = FOOTSTEP_CATWALK + overfloor_placed = TRUE var/covered = TRUE /turf/open/floor/plating/catwalk_floor/Initialize(mapload) diff --git a/code/game/turfs/open/floor/plating.dm b/code/game/turfs/open/floor/plating.dm index 99f4b875ef2..893436ced76 100644 --- a/code/game/turfs/open/floor/plating.dm +++ b/code/game/turfs/open/floor/plating.dm @@ -11,7 +11,8 @@ name = "plating" icon_state = "plating" base_icon_state = "plating" - intact = FALSE + overfloor_placed = FALSE + underfloor_accessibility = UNDERFLOOR_INTERACTABLE baseturfs = /turf/baseturf_bottom footstep = FOOTSTEP_PLATING barefootstep = FOOTSTEP_HARD_BAREFOOT diff --git a/code/game/turfs/open/glass.dm b/code/game/turfs/open/glass.dm index 81c4bfb2fdd..8e8b0913a51 100644 --- a/code/game/turfs/open/glass.dm +++ b/code/game/turfs/open/glass.dm @@ -5,7 +5,8 @@ icon_state = "glass-0" base_icon_state = "glass" baseturfs = /turf/open/openspace - intact = FALSE //this means wires go on top + overfloor_placed = FALSE // We can't tear this up, with tools, explosives, or other means. + underfloor_accessibility = UNDERFLOOR_VISIBLE smoothing_flags = SMOOTH_BITMASK smoothing_groups = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_FLOOR_TRANSPARENT_GLASS) canSmoothWith = list(SMOOTH_GROUP_FLOOR_TRANSPARENT_GLASS) diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index 7da35f864ea..68a95ac7629 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -18,7 +18,8 @@ GLOBAL_DATUM_INIT(openspace_backdrop_one_for_all, /atom/movable/openspace_backdr baseturfs = /turf/open/openspace can_atmos_pass_vertical = ATMOS_PASS_YES baseturfs = /turf/open/openspace - intact = FALSE //this means wires go on top + overfloor_placed = FALSE + underfloor_accessibility = UNDERFLOOR_INTERACTABLE mouse_opacity = MOUSE_OPACITY_TRANSPARENT var/can_cover_up = TRUE var/can_build_on = TRUE diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index 1c79a654e5c..024735b5af6 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -2,7 +2,8 @@ icon = 'icons/turf/space.dmi' icon_state = "0" name = "\proper space" - intact = 0 + overfloor_placed = FALSE + underfloor_accessibility = UNDERFLOOR_INTERACTABLE temperature = TCMB thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 9e250044003..683a6d13a1b 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -8,7 +8,11 @@ GLOBAL_LIST_EMPTY(station_turfs) /// Turf bitflags, see code/__DEFINES/flags.dm var/turf_flags = NONE - var/intact = 1 + + /// If there's a tile over a basic floor that can be ripped out + var/overfloor_placed = FALSE + /// How accessible underfloor pieces such as wires, pipes, etc are on this turf. Can be HIDDEN, VISIBLE, or INTERACTABLE. + var/underfloor_accessibility = UNDERFLOOR_HIDDEN // baseturfs can be either a list or a single turf type. // In class definition like here it should always be a single type. @@ -413,7 +417,7 @@ GLOBAL_LIST_EMPTY(station_turfs) /turf/proc/levelupdate() for(var/obj/O in src) if(O.flags_1 & INITIALIZED_1) - SEND_SIGNAL(O, COMSIG_OBJ_HIDE, intact) + SEND_SIGNAL(O, COMSIG_OBJ_HIDE, underfloor_accessibility < UNDERFLOOR_VISIBLE) // override for space turfs, since they should never hide anything /turf/open/space/levelupdate() @@ -464,7 +468,7 @@ GLOBAL_LIST_EMPTY(station_turfs) //////////////////////////////////////////////////// /turf/singularity_act() - if(intact) + if(underfloor_accessibility < UNDERFLOOR_INTERACTABLE) for(var/obj/O in contents) //this is for deleting things like wires contained in the turf if(HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) O.singularity_act() @@ -475,7 +479,7 @@ GLOBAL_LIST_EMPTY(station_turfs) return TRUE /turf/proc/can_lay_cable() - return can_have_cabling() & !intact + return can_have_cabling() && underfloor_accessibility >= UNDERFLOOR_INTERACTABLE /turf/proc/visibilityChanged() GLOB.cameranet.updateVisibility(src) @@ -550,7 +554,7 @@ GLOBAL_LIST_EMPTY(station_turfs) AddComponent(/datum/component/acid, acidpwr, acid_volume) for(var/obj/O in src) - if(intact && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) + if(underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(O, TRAIT_T_RAY_VISIBLE)) continue O.acid_act(acidpwr, acid_volume) diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index 5f95fd94487..d0441d5d42f 100644 --- a/code/modules/antagonists/revenant/revenant_abilities.dm +++ b/code/modules/antagonists/revenant/revenant_abilities.dm @@ -257,7 +257,7 @@ if(!isplatingturf(T) && !istype(T, /turf/open/floor/engine/cult) && isfloorturf(T) && prob(15)) var/turf/open/floor/floor = T - if(floor.intact && floor.floor_tile) + if(floor.overfloor_placed && floor.floor_tile) new floor.floor_tile(floor) floor.broken = 0 floor.burnt = 0 diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index 7e457775a90..55601fd2e7c 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -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 diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index 346376d5fac..e6df49e2a9f 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -148,7 +148,7 @@ /turf/open/floor/holofloor/carpet/update_icon(updates=ALL) . = ..() - if((updates & UPDATE_SMOOTHING) && intact && smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if((updates & UPDATE_SMOOTHING) && overfloor_placed && smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) /turf/open/floor/holofloor/wood diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index f005845b8be..1856c2faaf2 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -91,7 +91,7 @@ /mob/living/simple_animal/mouse/handle_automated_action() if(prob(chew_probability)) var/turf/open/floor/F = get_turf(src) - if(istype(F) && !F.intact) + if(istype(F) && F.underfloor_accessibility >= UNDERFLOOR_INTERACTABLE) var/obj/structure/cable/C = locate() in F if(C && prob(15)) var/powered = C.avail() diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index b8dabe892e6..c0d753cbcfd 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -292,7 +292,7 @@ . = ..() if(prob(40)) var/turf/open/floor/F = get_turf(src) - if(istype(F) && !F.intact) + if(istype(F) && F.underfloor_accessibility >= UNDERFLOOR_INTERACTABLE) var/obj/structure/cable/C = locate() in F if(C && prob(15)) if(C.avail()) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 387ac8b0eaa..f2093f2a9a9 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -636,7 +636,7 @@ var/turf/host_turf = get_turf(src) if(!host_turf) CRASH("attackby on APC when it's not on a turf") - if (host_turf.intact) + if (host_turf.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) to_chat(user, span_warning("You must remove the floor plating in front of the APC first!")) return else if (terminal) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 20ee76d7774..90c49d6839e 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -161,7 +161,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri /obj/structure/cable/proc/handlecable(obj/item/W, mob/user, params) var/turf/T = get_turf(src) - if(T.intact) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) return if(W.tool_behaviour == TOOL_WIRECUTTER) if (shock(user, 50)) @@ -567,7 +567,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri if(!isturf(user.loc)) return - if(!isturf(T) || T.intact || !T.can_have_cabling()) + if(!isturf(T) || T.underfloor_accessibility || !T.can_have_cabling()) to_chat(user, span_warning("You can only lay cables on catwalks and plating!")) return diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index fb198a67410..1c4b621da8c 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -210,7 +210,7 @@ if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/coil = W var/turf/T = user.loc - if(T.intact || !isfloorturf(T)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE || !isfloorturf(T)) return if(get_dist(src, user) > 1) return diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 781b2aeaee7..54500a352ee 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -116,7 +116,7 @@ return var/turf/T = get_turf(user) - if (T.intact) //is the floor plating removed ? + if (T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) //can we get to the underfloor? to_chat(user, span_warning("You must first remove the floor plating!")) return diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index c794e624963..1a3eeb8ae1d 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -42,7 +42,7 @@ /obj/machinery/power/terminal/proc/dismantle(mob/living/user, obj/item/I) if(isturf(loc)) var/turf/T = loc - if(T.intact) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE) to_chat(user, span_warning("You must first expose the power terminal!")) return diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index ccd505b64a1..9f09ee4ee72 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -116,7 +116,7 @@ var/ispipe = is_pipe() // Indicates if we should change the level of this pipe var/turf/T = get_turf(src) - if(T.intact && isfloorturf(T)) + if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && isfloorturf(T)) var/obj/item/crowbar/held_crowbar = user.is_holding_item_of_type(/obj/item/crowbar) if(!held_crowbar || !T.crowbar_act(user, held_crowbar)) to_chat(user, span_warning("You can only attach the [pipename] if the floor plating is removed!")) diff --git a/code/modules/recycling/disposal/pipe.dm b/code/modules/recycling/disposal/pipe.dm index 44c5e2de7aa..1988c928808 100644 --- a/code/modules/recycling/disposal/pipe.dm +++ b/code/modules/recycling/disposal/pipe.dm @@ -93,7 +93,7 @@ var/eject_range = 5 var/turf/open/floor/floorturf - if(isfloorturf(T) && T.intact) //intact floor, pop the tile + if(isfloorturf(T) && T.overfloor_placed) // pop the tile if present floorturf = T if(floorturf.floor_tile) new floorturf.floor_tile(T)