Files
Bubberstation/code/modules/bitrunning/objects/hololadder.dm
Jeremiah 550ec9b1d9 Cleans up signal use in bitrunning [NO GBP] (#79426)
## About The Pull Request
Atomized #78997
Broke up duplicate signal usage - though they do the same thing, this is
convention & it makes it easier to debug
Removed custom alert subtypes in favor of just setting values directly
Removed some unnecessary vars like the console ref from the server
Since I'm just copying this over, it has added exam text for net pods,
which fixes an issue reported to me in Discord
## Why It's Good For The Game
Code improvement
## Changelog
🆑
add: Added some clarity to the range of netpods (4 tiles) in their exam
text.
/🆑
2023-11-02 13:23:48 +00:00

52 lines
1.3 KiB
Plaintext

/obj/structure/hololadder
name = "hololadder"
anchored = TRUE
desc = "An abstract representation of the means to disconnect from the virtual domain."
icon = 'icons/obj/structures.dmi'
icon_state = "ladder11"
obj_flags = BLOCK_Z_OUT_DOWN
/// Time req to disconnect properly
var/travel_time = 3 SECONDS
/obj/structure/hololadder/Initialize(mapload)
. = ..()
RegisterSignal(loc, COMSIG_ATOM_ENTERED, PROC_REF(on_enter))
/obj/structure/hololadder/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
if(!in_range(src, user) || DOING_INTERACTION(user, DOAFTER_SOURCE_CLIMBING_LADDER))
return
disconnect(user)
/// If there's a pilot ref- send the disconnect signal
/obj/structure/hololadder/proc/disconnect(mob/user)
if(isnull(user.mind))
return
if(!HAS_TRAIT(user, TRAIT_TEMPORARY_BODY))
balloon_alert(user, "no connection detected.")
return
balloon_alert(user, "disconnecting...")
if(do_after(user, travel_time, src))
SEND_SIGNAL(user, COMSIG_BITRUNNER_LADDER_SEVER)
/// Helper for times when you dont have hands (gondola??)
/obj/structure/hololadder/proc/on_enter(datum/source, atom/movable/arrived, turf/old_loc)
SIGNAL_HANDLER
if(!isliving(arrived))
return
var/mob/living/user = arrived
if(isnull(user.mind))
return
INVOKE_ASYNC(src, PROC_REF(disconnect), user)