Exosuit Voice Commands: Toggle Power and Maintenance (#20481)

- Toggle maintenance protocol can now be done by anyone if no pilot in
an exosuit and with no link(allowing for species such as bulwarks to be
able to do more with exosuits)
- New command to toggle power (self-explanatory), minor refactor of
toggle power code for exosuit to permit this.

---------

Co-authored-by: Ben10083 <Ben10083@users.noreply.github.com>
This commit is contained in:
Ben
2025-02-20 11:50:47 +00:00
committed by GitHub
co-authored by Ben10083
parent bcf56bcb71
commit 2ea694c5b6
5 changed files with 109 additions and 13 deletions
@@ -236,9 +236,9 @@
maptext_x = 1
maptext_y = 11
/atom/movable/screen/mecha/toggle/power_control/toggled()
/atom/movable/screen/mecha/toggle/power_control/toggled(var/remote = FALSE)
toggled = !toggled
owner.toggle_power(usr)
owner.toggle_power(usr, remote)
var/main_color = toggled ? "#d1d1d1" : "#525252"
maptext = "<span style=\"font-family: 'Small Fonts'; color: [main_color]; -dm-text-outline: 1 #242424; font-size: 6px;\">POWER</span>"
+17 -6
View File
@@ -38,18 +38,29 @@
/mob/living/heavy_vehicle/proc/toggle_maintenance_protocols()
var/atom/movable/screen/mecha/toggle/maint/M = locate() in hud_elements
M.toggled()
return TRUE
if(M)
M.toggled()
return TRUE
/mob/living/heavy_vehicle/proc/toggle_hatch()
var/atom/movable/screen/mecha/toggle/hatch_open/H = locate() in hud_elements
H.toggled()
return TRUE
if(H)
H.toggled()
return TRUE
/// Called by voice command
/// Ensures the hud element for power is updated, and sends special condition to have messages not be sent to the user
/mob/living/heavy_vehicle/proc/toggle_power_remote()
var/atom/movable/screen/mecha/toggle/power_control/P = locate() in hud_elements
if(P)
P.toggled(TRUE)
return TRUE
/mob/living/heavy_vehicle/proc/toggle_lock()
var/atom/movable/screen/mecha/toggle/hatch/L = locate() in hud_elements
L.toggled()
return TRUE
if(L)
L.toggled()
return TRUE
/mob/living/heavy_vehicle/proc/can_listen()
return TRUE
@@ -628,6 +628,13 @@ GLOBAL_DATUM_INIT(mech_state, /datum/ui_state/default, new())
// Checking whether we have a leader or not
if(!leader)
if(findtext(text, "toggle maintenance protocols")) // Allow for engaging maintenance protocols if no pilot
if(pilots)
say("Unlinked toggling of maintenance protocols requires no active pilots.")
return
if(toggle_maintenance_protocols())
say("Maintenance protocols toggled [maintenance_protocols ? "on" : "off"].")
return
if(!maintenance_protocols) // don't select a leader unless we have maintenance protocols set
say("Maintenance protocols must be enabled to link.")
return
@@ -684,6 +691,18 @@ GLOBAL_DATUM_INIT(mech_state, /datum/ui_state/default, new())
say("Hatch [hatch_closed ? "closed" : "opened"].")
return
// simply toggle on or off the power
if(findtext(text, "toggle power"))
if(power == MECH_POWER_TRANSITION)
say("Power transition in progress. Please wait.")
return
else if(power == MECH_POWER_OFF && !get_cell(TRUE))
say("Insufficent power to power systems.")
return
if(toggle_power_remote())
say("Systems [power == MECH_POWER_ON ? "online" : "offline"].")
return
// simply toggle the lock status
if(findtext(text, "toggle lock"))
if(!hatch_closed)
+12 -5
View File
@@ -250,9 +250,16 @@
/mob/living/heavy_vehicle/GetIdCard()
return access_card
/mob/living/heavy_vehicle/proc/toggle_power(var/mob/user)
/// Checks if mech can be powered on/off, sends message to pilot if failed
/// `var/remote` can be set to TRUE to have proc adjust where messages and hud elements are presented
/// If `remote` is TRUE, messages and other hud elements are called on the exosuit itself to prevent wierdness, and errors are handled in `handle_hear_say()`
/mob/living/heavy_vehicle/proc/toggle_power(var/mob/user, var/remote = FALSE)
// if remotely called, send these messages to the exosuit, not the person calling this proc
var/reciever = user
if(remote)
reciever = src
if(power == MECH_POWER_TRANSITION)
to_chat(user, SPAN_NOTICE("Power transition in progress. Please wait."))
to_chat(reciever, SPAN_NOTICE("Power transition in progress. Please wait."))
else if(power == MECH_POWER_ON) //Turning it off is instant
playsound(src, 'sound/mecha/mech-shutdown.ogg', 100, 0)
power = MECH_POWER_OFF
@@ -260,15 +267,15 @@
//Start power up sequence
power = MECH_POWER_TRANSITION
playsound(src, 'sound/mecha/powerup.ogg', 50, 0)
if(do_after(user, 1.5 SECONDS) && power == MECH_POWER_TRANSITION)
if(do_after(reciever, 1.5 SECONDS) && power == MECH_POWER_TRANSITION)
playsound(src, 'sound/mecha/nominal.ogg', 50, 0)
power = MECH_POWER_ON
else
to_chat(user, SPAN_WARNING("You abort the powerup sequence."))
to_chat(reciever, SPAN_WARNING("You abort the powerup sequence."))
power = MECH_POWER_OFF
hud_power_control?.queue_icon_update()
else
to_chat(user, SPAN_WARNING("Error: No power cell was detected."))
to_chat(reciever, SPAN_WARNING("Error: No power cell was detected."))
/obj/item/device/radio/exosuit
name = "exosuit radio"
@@ -0,0 +1,59 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################
# Your name.
author: Ben10083
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "New voice command for exosuits: toggle power."
- qol: "Exosuits with no pilot and no link can be given a command to toggle maintenance protocols, allowing the exosuit to be linked without needing to enter the exosuit."