Files
moocowswag a4d5c97f63 Adds Modular shield consoles, boards, and tech, lets monkeys mash their keyboards (#91189)
## About The Pull Request
(had to cut off the video cause of github file size limit)


https://github.com/user-attachments/assets/f6a51d28-dc35-41ad-93ac-099c48215013


Adds modular shield generator consoles to the game, boards are available
through holographics tech

Simply multitool buffer a generator and then use the buffer on a
console.

The console can see the current shield health status of every generator
that is linked to it and can toggle the generators on
and off, but cannot change radius or any other settings.

The console can also rename generators for convenience



And should a monkey manage to slip past your defenses via ventcrawl it
will be able to randomly toggle your shields.


https://github.com/user-attachments/assets/94435d15-e52f-45c7-a2e6-135228e7bc08


## Why It's Good For The Game

Helps engineers keep track of their generators for primarily PVE content
(mainly when they are trying to protect the station against meteors)
## Changelog
🆑
add: You can now remotely monitor and control modular shield generators
using modular shield generator consoles.
/🆑

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2025-06-21 22:26:31 -04:00

75 lines
2.8 KiB
Plaintext

/obj/machinery/computer/modular_shield
name = "modular shield control console"
desc = "Used to remotely monitor and toggle modular shield generators."
circuit = /obj/item/circuitboard/computer/modular_shield_console
///the list of generators that are linked to us
var/list/obj/machinery/modular_shield_generator/generators = list()
//lets monkeys randomly mash buttons to toggle the generators
/obj/machinery/computer/modular_shield/attack_paw(mob/user, list/modifiers)
balloon_alert(user, "mashing buttons")
if(!do_after(user, 4 SECONDS, target = src))
return
for(var/obj/machinery/modular_shield_generator/generator as anything in generators)
if(prob(50))
generator.toggle_shields()
/obj/machinery/computer/modular_shield/multitool_act(mob/living/user, obj/item/multitool/tool)
. = NONE
if(!istype(tool.buffer, /obj/machinery/modular_shield_generator))
return
generators |= tool.buffer
RegisterSignal(tool.buffer, COMSIG_QDELETING, PROC_REF(generator_deleted))
tool.set_buffer(null)
to_chat(user, span_notice("You upload the data from the [tool] buffer."))
return ITEM_INTERACT_SUCCESS
///checks if all connected generators exist
/obj/machinery/computer/modular_shield/proc/generator_deleted(obj/machinery/modular_shield_generator/generator)
SIGNAL_HANDLER
generators -= generator
/obj/machinery/computer/modular_shield/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "ModularShieldConsole")
ui.open()
/obj/machinery/computer/modular_shield/ui_data(mob/user)
var/list/data = list()
var/list/generator_list = list()
for(var/i in 1 to LAZYLEN(generators))
var/obj/machinery/modular_shield_generator/generator = generators[i]
var/list/this_generator = list()
this_generator["name"] = generator.display_name
this_generator["id"] = i
this_generator["max_strength"] = generator.max_strength
this_generator["current_strength"] = generator.stored_strength
this_generator["generator_name"] = generator.display_name
this_generator["active"] = generator.active
this_generator["recovering"] = generator.recovering || generator.initiating
this_generator["current_regeneration"] = generator.current_regeneration
if(generator.machine_stat & NOPOWER)
this_generator["inactive"] = TRUE
generator_list += list(this_generator)
data["generators"] = generator_list
return data
/obj/machinery/computer/modular_shield/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
var/obj/machinery/modular_shield_generator/selected_generator = generators[(params["id"])]
if(QDELETED(selected_generator))
return
switch(action)
if("toggle_shields")
selected_generator.toggle_shields()
return TRUE
if("rename")
selected_generator.display_name = params["name"]
return TRUE