Files
Hatterhat 15baf7873a Offsite Deathrattle Implants and Repathed Kheiral Cuffs (#94209)
## About The Pull Request

Updates subdermal implants so that they have `implant_info` and
`implant_lore` variables instead of one unchanging `get_info()`. Also
rewrites/updates/tweaks/etc. lore for every implant that had get_info()
blocks.

Makes beacon implants (the ones you teleport onto) turn off (hide
themselves on prisoner management consoles) after ten minutes, matching
the tracking implant's functionality.

Deathrattle implants are now `allow_multiple = TRUE`, so you can have
multiple deathrattles implanted.

Reworked the implant pad's UI to have collapsible sections for implant
info, implant lore, and also have buttons for configuring deathrattle
implants.

Adds a box of expeditionary deathrattle implants to the mining vendor.
For 900 points (585 points if delivered), you receive a box containing 5
expeditionary deathrattle implants, which **ONLY ALERT TO DEATHS IN
MINING WASTELAND AREAS (e.g. not ruins, not space, not station) (this is
important)**, an implanter, and an implant pad.

The intended workflow is that you initialize one deathrattle implant,
use that network for all the other deathrattles, and implant yourself,
your mining buddies, your QM, and a paramedic, maybe. However since they
start unset you could theoretically make one really big deathrattle
network. Good luck getting people to volunteer for implanting, though,
and as above, it only really works if you die outside of the station.

Also, repaths kheiral cuffs to be accessories, so you can attach them to
uniforms. They're still functional as suit sensor extenders and GPSes
(when off-station).

<details><summary>Screenshots</summary>

<img width="469" height="91" alt="image"
src="https://github.com/user-attachments/assets/2c88b151-e5ab-415a-8c41-0f166f439315"
/><br>
<img width="300" height="350" alt="image"
src="https://github.com/user-attachments/assets/0764983a-1160-48ab-aa6a-d1aaf08a682e"
/><br>
<img width="300" height="350" alt="image"
src="https://github.com/user-attachments/assets/98e84368-300b-453a-89a4-d922c80628e8"
/>

</details>

## Why It's Good For The Game

Deathrattle implants are cool. Being able to know that your coworker
exploded, after a non-negligible amount of setup and wrangling your
fellow spaceman to let you implant them, is probably a good thing.
Introduces a cooperative avenue of "Wait, my coworker just died" instead
of "Hey, they haven't yelled something on comms, did they roll antag?
(No. They died.)"

Kheiral cuffs being uniform attachments is because having to sacrifice
glove slot for them annoyed me a lot.

## Changelog

🆑
add: Nanotrasen has begun rolling out (unconfigured) expeditionary
deathrattle implant kits for their mining teams for 900 points (585
points, if manually delivered). These only alert for deaths on raw
mining wasteland, and will not work in space, ruins, or on-station.
balance: Kheiral cuffs can now be attached to uniforms as accessories.
They retain their suit sensor extension/GPS functionality (still only
when off station Z-levels, though).
fix: Beacon implants now turn off (hide themselves on prisoner
management consoles) after ten minutes, matching the tracking implant's
functionality.
qol: Made the implant pad UI a little nicer to look at, with dropdowns
and demarcated sections.
code: Implants now have separated "immediately useful" information and
"extended lore tidbits" information as variables instead of one
unchangeable get_info() block.
/🆑

---------

Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
2026-01-04 16:55:09 +00:00

243 lines
7.3 KiB
Plaintext

///Global GPS_list. All GPS components get saved in here for easy reference.
GLOBAL_LIST_EMPTY(GPS_list)
///GPS component. Atoms that have this show up on gps. Pretty simple stuff.
/datum/component/gps
var/gpstag = "COM0"
var/tracking = TRUE
var/emped = FALSE
var/list/turf/tagged
/datum/component/gps/Initialize(_gpstag = "COM0", _tracking = TRUE)
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
gpstag = _gpstag
tracking = _tracking
GLOB.GPS_list += src
/datum/component/gps/Destroy()
GLOB.GPS_list -= src
return ..()
/datum/component/gps/kheiral_cuffs
/datum/component/gps/kheiral_cuffs/Initialize(_gpstag = "COM0")
. = ..()
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(deactivate_kheiral_cuffs))
RegisterSignal(parent, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(deactivate_if_station))
/datum/component/gps/kheiral_cuffs/proc/deactivate_kheiral_cuffs(datum/source)
SIGNAL_HANDLER
qdel(src)
/datum/component/gps/kheiral_cuffs/proc/deactivate_if_station(atom/movable/moved_atom, turf/old_turf, turf/new_turf)
SIGNAL_HANDLER
if(!isturf(new_turf))
return
if(is_station_level(new_turf.z))
qdel(src)
return
///GPS component subtype. Only gps/item's can be used to open the UI.
/datum/component/gps/item
var/updating = TRUE //Automatic updating of GPS list. Can be set to manual by user.
var/global_mode = TRUE //If disabled, only GPS signals of the same Z level are shown
/// UI state of GPS, altering when it can be used.
var/datum/ui_state/state = null
var/debug_mode = FALSE
/datum/component/gps/item/Initialize(_gpstag = "COM0", _tracking = TRUE, emp_proof = FALSE, state = null, overlay_state = "working", debug = FALSE)
. = ..()
if(. == COMPONENT_INCOMPATIBLE || !isitem(parent))
return COMPONENT_INCOMPATIBLE
if(isnull(state))
state = GLOB.default_state
src.state = state
debug_mode = debug
var/atom/A = parent
if(overlay_state)
A.add_overlay(overlay_state)
A.name = "[initial(A.name)] ([gpstag])"
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(interact))
if(debug_mode && tracking)
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(tag_the_floor))
if(!emp_proof)
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp_act))
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(parent, COMSIG_CLICK_ALT, PROC_REF(on_click_alt))
/datum/component/gps/item/Destroy()
if(tagged)
clear()
return ..()
///Called on COMSIG_ITEM_ATTACK_SELF
/datum/component/gps/item/proc/interact(datum/source, mob/user)
SIGNAL_HANDLER
if(user)
INVOKE_ASYNC(src, PROC_REF(ui_interact), user)
///Called on COMSIG_MOVABLE_MOVED
/datum/component/gps/item/proc/tag_the_floor(atom/movable/mover, turf/old_loc)
SIGNAL_HANDLER
if(!debug_mode)
return
var/turf/tagged_turf = get_turf(mover)
if(tagged_turf)
tagged_turf.color = RANDOM_COLOUR
tagged_turf.maptext = MAPTEXT("[tagged_turf.x],[tagged_turf.y],[tagged_turf.z]")
LAZYOR(tagged, tagged_turf)
///Called on COMSIG_MOVABLE_MOVED
/datum/component/gps/item/proc/clear()
SIGNAL_HANDLER
while(tagged.len)
var/turf/tagged_turf = pop(tagged)
tagged_turf.color = initial(tagged_turf.color)
tagged_turf.maptext = initial(tagged_turf.maptext)
LAZYNULL(tagged)
///Called on COMSIG_ATOM_EXAMINE
/datum/component/gps/item/proc/on_examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
examine_list += span_notice("Alt-click to switch it [tracking ? "off":"on"].")
///Called on COMSIG_ATOM_EMP_ACT
/datum/component/gps/item/proc/on_emp_act(datum/source, severity, protection)
SIGNAL_HANDLER
if(protection & EMP_PROTECT_SELF)
return
emped = TRUE
var/atom/A = parent
A.cut_overlay("working")
A.add_overlay("emp")
addtimer(CALLBACK(src, PROC_REF(reboot)), 300, TIMER_UNIQUE|TIMER_OVERRIDE) //if a new EMP happens, remove the old timer so it doesn't reactivate early
SStgui.close_uis(src) //Close the UI control if it is open.
///Restarts the GPS after getting turned off by an EMP.
/datum/component/gps/item/proc/reboot()
emped = FALSE
var/atom/A = parent
A.cut_overlay("emp")
A.add_overlay("working")
///Calls toggletracking
/datum/component/gps/item/proc/on_click_alt(datum/source, mob/user)
SIGNAL_HANDLER
toggletracking(user)
return CLICK_ACTION_SUCCESS
///Toggles the tracking for the gps
/datum/component/gps/item/proc/toggletracking(mob/user)
if(!user.can_perform_action(parent, ALLOW_RESTING | ALLOW_PAI))
return //user not valid to use gps
if(emped)
to_chat(user, span_warning("It's busted!"))
return
var/atom/A = parent
if(tracking)
A.cut_overlay("working")
to_chat(user, span_notice("[parent] is no longer tracking, or visible to other GPS devices."))
tracking = FALSE
else
A.add_overlay("working")
to_chat(user, span_notice("[parent] is now tracking, and visible to other GPS devices."))
tracking = TRUE
if(debug_mode)
if(tracking)
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(tag_the_floor))
else
UnregisterSignal(parent, COMSIG_MOVABLE_MOVED)
clear()
/datum/component/gps/item/ui_interact(mob/user, datum/tgui/ui)
if(emped)
to_chat(user, span_hear("[parent] fizzles weakly."))
return
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Gps")
ui.open()
ui.set_autoupdate(updating)
/datum/component/gps/item/ui_state(mob/user)
return state
/datum/component/gps/item/ui_data(mob/user)
var/list/data = list()
data["power"] = tracking
data["tag"] = gpstag
data["updating"] = updating
data["globalmode"] = global_mode
if(!tracking || emped) //Do not bother scanning if the GPS is off or EMPed
return data
var/turf/curr = get_turf(parent)
data["currentArea"] = "[get_area_name(curr, TRUE)]"
data["currentCoords"] = "[curr.x], [curr.y], [curr.z]"
var/list/signals = list()
data["signals"] = list()
for(var/datum/component/gps/gps as anything in GLOB.GPS_list)
if(gps == src || gps.emped || !gps.tracking)
continue
var/turf/pos = get_turf(gps.parent)
if(!pos || (!global_mode && pos.z != curr.z))
continue
var/list/signal = list()
signal["entrytag"] = gps.gpstag //Name or 'tag' of the GPS
signal["coords"] = "[pos.x], [pos.y], [pos.z]"
// Distance is calculated for the same z-level only, and direction is calculated for crosslinked/neighboring and same z-levels.
if(pos.z == curr.z)
signal["dist"] = max(get_dist(curr, pos), 0) //Distance between the src and remote GPS turfs
signal["degrees"] = round(get_angle(curr, pos)) //0-360 degree directional bearing, for more precision.
else
var/angle = get_linked_z_angle(curr.z, pos.z)
if(!isnull(angle))
signal["degrees"] = angle
signals += list(signal) //Add this signal to the list of signals
data["signals"] = signals
return data
/datum/component/gps/item/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("rename")
var/atom/parentasatom = parent
var/a = tgui_input_text(usr, "Enter the desired tag", "GPS Tag", gpstag, max_length = 20)
if (QDELETED(ui) || ui.status != UI_INTERACTIVE)
return
if (!a)
return
gpstag = a
. = TRUE
usr.log_message("renamed [parentasatom] to \"[initial(parentasatom.name)] ([gpstag])\".", LOG_GAME)
parentasatom.name = "[initial(parentasatom.name)] ([gpstag])"
if("power")
toggletracking(usr)
. = TRUE
if("updating")
updating = !updating
. = TRUE
if("globalmode")
global_mode = !global_mode
. = TRUE