Files
Bubberstation/code/game/objects/structures/broken_flooring.dm
John Willard fa31403353 LateInitialize is not allowed to call parent anymore (#82540)
## About The Pull Request

I've seen a few cases in the past where LateInitialize is done cause of
the init return value being set to do so for no real reason, I thought I
should try to avoid that by ensuring LateInitialize isn't ever called
without overriding.

This fixes a ton of machine's LateInitialize not calling parent
(mechpad, door buttons, message monitor, a lot of tram machines,
abductor console, holodeck computer & disposal bin), avoiding having to
set itself up to be connected to power. If they were intended to not
connect to power, they should be using ``NO_POWER_USE`` instead.

Also removes a ton of returns to LateInit when it's already getting it
from parent regardless (many cases of that in machine code).

## Why It's Good For The Game

I think this is better for coding standard reasons as well as just
making sure we're not calling this proc on things that does absolutely
nothing with them. A machine not using power can be seen evidently not
using power with ``NO_POWER_USE``, not so much if it's LateInitialize
not calling parent.

## Changelog

🆑
fix: Mech pads, door buttons, message monitors, tram machines, abductor
consoles & holodeck computers now use power.
/🆑
2024-04-08 22:15:07 -06:00

76 lines
2.5 KiB
Plaintext

/obj/structure/broken_flooring
name = "broken tiling"
desc = "A segment of broken flooring."
icon = 'icons/obj/fluff/brokentiling.dmi'
icon_state = "corner"
anchored = TRUE
density = FALSE
opacity = FALSE
plane = FLOOR_PLANE
layer = CATWALK_LAYER
/// do we always have FLOOR_PLANE even if we arent on plating?
var/always_floorplane = FALSE
/obj/structure/broken_flooring/Initialize(mapload)
. = ..()
return INITIALIZE_HINT_LATELOAD
/obj/structure/broken_flooring/LateInitialize()
var/turf/turf = get_turf(src)
if(!isplatingturf(turf) && !always_floorplane) // Render as trash if not on plating
plane = GAME_PLANE
layer = LOW_OBJ_LAYER
return
for(var/obj/object in turf)
if(object.flags_1 & INITIALIZED_1)
SEND_SIGNAL(object, COMSIG_OBJ_HIDE, UNDERFLOOR_VISIBLE)
CHECK_TICK
/obj/structure/broken_flooring/crowbar_act(mob/living/user, obj/item/I)
I.play_tool_sound(src, 80)
balloon_alert(user, "tile reclaimed")
new /obj/item/stack/tile/iron(get_turf(src))
qdel(src)
return ITEM_INTERACT_SUCCESS
/obj/structure/broken_flooring/singular
icon_state = "singular"
/obj/structure/broken_flooring/singular/always_floorplane
always_floorplane = TRUE
/obj/structure/broken_flooring/pile
icon_state = "pile"
/obj/structure/broken_flooring/pile/always_floorplane
always_floorplane = TRUE
/obj/structure/broken_flooring/side
icon_state = "side"
/obj/structure/broken_flooring/side/always_floorplane
always_floorplane = TRUE
/obj/structure/broken_flooring/corner
icon_state = "corner"
/obj/structure/broken_flooring/corner/always_floorplane
always_floorplane = TRUE
/obj/structure/broken_flooring/plating
icon_state = "plating"
/obj/structure/broken_flooring/plating/always_floorplane
always_floorplane = TRUE
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/singular, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/pile, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/side, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/corner, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/plating, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/singular/always_floorplane, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/pile/always_floorplane, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/side/always_floorplane, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/corner/always_floorplane, 0)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/broken_flooring/plating/always_floorplane, 0)