mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
* 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. * Refactor /turf/var/intact * Thank Co-authored-by: esainane <esainane+github@gmail.com> Co-authored-by: Funce <funce.973@gmail.com>
72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
// the underfloor wiring terminal for the APC
|
|
// autogenerated when an APC is placed
|
|
// all conduit connects go to this object instead of the APC
|
|
// using this solves the problem of having the APC in a wall yet also inside an area
|
|
|
|
/obj/machinery/power/terminal
|
|
name = "terminal"
|
|
icon_state = "term"
|
|
desc = "It's an underfloor wiring terminal for power equipment."
|
|
layer = WIRE_TERMINAL_LAYER //a bit above wires
|
|
var/obj/machinery/power/master = null
|
|
|
|
|
|
/obj/machinery/power/terminal/Initialize(mapload)
|
|
. = ..()
|
|
|
|
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE, use_alpha = TRUE)
|
|
|
|
/obj/machinery/power/terminal/Destroy()
|
|
if(master)
|
|
master.disconnect_terminal()
|
|
master = null
|
|
return ..()
|
|
|
|
/obj/machinery/power/terminal/should_have_node()
|
|
return TRUE
|
|
|
|
/obj/machinery/power/proc/can_terminal_dismantle()
|
|
. = FALSE
|
|
|
|
/obj/machinery/power/apc/can_terminal_dismantle()
|
|
. = FALSE
|
|
if(opened)
|
|
. = TRUE
|
|
|
|
/obj/machinery/power/smes/can_terminal_dismantle()
|
|
. = FALSE
|
|
if(panel_open)
|
|
. = TRUE
|
|
|
|
|
|
/obj/machinery/power/terminal/proc/dismantle(mob/living/user, obj/item/I)
|
|
if(isturf(loc))
|
|
var/turf/T = loc
|
|
if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE)
|
|
to_chat(user, span_warning("You must first expose the power terminal!"))
|
|
return
|
|
|
|
if(master && !master.can_terminal_dismantle())
|
|
return
|
|
|
|
user.visible_message(span_notice("[user.name] dismantles the power terminal from [master]."),
|
|
span_notice("You begin to cut the cables..."))
|
|
|
|
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
|
if(I.use_tool(src, user, 50))
|
|
if(master && !master.can_terminal_dismantle())
|
|
return
|
|
|
|
if(prob(50) && electrocute_mob(user, powernet, src, 1, TRUE))
|
|
do_sparks(5, TRUE, master)
|
|
return
|
|
|
|
new /obj/item/stack/cable_coil(drop_location(), 10)
|
|
to_chat(user, span_notice("You cut the cables and dismantle the power terminal."))
|
|
qdel(src)
|
|
|
|
/obj/machinery/power/terminal/wirecutter_act(mob/living/user, obj/item/I)
|
|
..()
|
|
dismantle(user, I)
|
|
return TRUE
|