Files
Bubberstation/code/modules/bitrunning/objects/byteforge.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

68 lines
1.9 KiB
Plaintext

/obj/machinery/byteforge
name = "byteforge"
circuit = /obj/item/circuitboard/machine/byteforge
desc = "A machine used by the quantum server. Quantum code converges here, materializing decrypted assets from the virtual abyss."
icon = 'icons/obj/machines/bitrunning.dmi'
icon_state = "byteforge"
obj_flags = BLOCKS_CONSTRUCTION | CAN_BE_HIT
/// Idle particles
var/mutable_appearance/byteforge_particles
/obj/machinery/byteforge/Initialize(mapload)
. = ..()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/byteforge/post_machine_initialize()
. = ..()
setup_particles()
/obj/machinery/byteforge/update_appearance(updates)
. = ..()
setup_particles()
/// Does some sparks after it's done
/obj/machinery/byteforge/proc/flash(atom/movable/thing)
playsound(src, 'sound/magic/blink.ogg', 50, TRUE)
var/datum/effect_system/spark_spread/quantum/sparks = new()
sparks.set_up(5, 1, loc)
sparks.start()
set_light(l_on = FALSE)
/// Forge begins to process
/obj/machinery/byteforge/proc/flicker(angry = FALSE)
var/mutable_appearance/lighting = mutable_appearance(initial(icon), "on_overlay[angry ? "_angry" : ""]")
flick_overlay_view(lighting, 1 SECONDS)
set_light(l_range = 2, l_power = 1.5, l_color = angry ? LIGHT_COLOR_BUBBLEGUM : LIGHT_COLOR_BABY_BLUE, l_on = TRUE)
/// Adds the particle overlays to the byteforge
/obj/machinery/byteforge/proc/setup_particles(angry = FALSE)
cut_overlay(byteforge_particles)
byteforge_particles = mutable_appearance(initial(icon), "on_particles[angry ? "_angry" : ""]", ABOVE_MOB_LAYER)
if(is_operational)
add_overlay(byteforge_particles)
/// Forge is done processing
/obj/machinery/byteforge/proc/spawn_cache(obj/cache)
if(QDELETED(cache))
return
flash()
cache.forceMove(loc)
/// Timed flash
/obj/machinery/byteforge/proc/start_to_spawn(obj/cache)
flicker()
addtimer(CALLBACK(src, PROC_REF(spawn_cache), cache), 1 SECONDS)