mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
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. /🆑
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
balloon_alert(user, "disconnecting...")
|
||||
if(do_after(user, travel_time, src))
|
||||
SEND_SIGNAL(user, COMSIG_BITRUNNER_SAFE_DISCONNECT)
|
||||
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)
|
||||
|
||||
@@ -121,11 +121,6 @@
|
||||
if(!state_open && gone == occupant)
|
||||
container_resist_act(gone)
|
||||
|
||||
/obj/machinery/netpod/Exited(atom/movable/gone, direction)
|
||||
. = ..()
|
||||
if(!state_open && gone == occupant)
|
||||
container_resist_act(gone)
|
||||
|
||||
/obj/machinery/netpod/relaymove(mob/living/user, direction)
|
||||
if(!state_open)
|
||||
container_resist_act(user)
|
||||
@@ -176,7 +171,7 @@
|
||||
|
||||
if(do_after(pryer, 15 SECONDS, src))
|
||||
if(!state_open)
|
||||
SEND_SIGNAL(src, COMSIG_BITRUNNER_SEVER_AVATAR)
|
||||
sever_connection()
|
||||
open_machine()
|
||||
|
||||
return TRUE
|
||||
@@ -246,7 +241,7 @@
|
||||
open_machine()
|
||||
|
||||
/// Handles occupant post-disconnection effects like damage, sounds, etc
|
||||
/obj/machinery/netpod/proc/disconnect_occupant(forced = FALSE)
|
||||
/obj/machinery/netpod/proc/disconnect_occupant(cause_damage = FALSE)
|
||||
connected = FALSE
|
||||
|
||||
var/mob/living/mob_occupant = occupant
|
||||
@@ -268,7 +263,7 @@
|
||||
heal_time = (mob_occupant.stat + 2) * 5
|
||||
addtimer(CALLBACK(src, PROC_REF(auto_disconnect)), heal_time SECONDS, TIMER_UNIQUE|TIMER_STOPPABLE|TIMER_DELETE_ME)
|
||||
|
||||
if(!forced)
|
||||
if(!cause_damage)
|
||||
return
|
||||
|
||||
mob_occupant.flash_act(override_blindness_check = TRUE, visual = TRUE)
|
||||
@@ -339,7 +334,7 @@
|
||||
return
|
||||
|
||||
server_ref = WEAKREF(server)
|
||||
RegisterSignal(server, COMSIG_BITRUNNER_SERVER_UPGRADED, PROC_REF(on_server_upgraded))
|
||||
RegisterSignal(server, COMSIG_MACHINERY_REFRESH_PARTS, PROC_REF(on_server_upgraded))
|
||||
RegisterSignal(server, COMSIG_BITRUNNER_DOMAIN_COMPLETE, PROC_REF(on_domain_complete))
|
||||
RegisterSignal(server, COMSIG_BITRUNNER_DOMAIN_SCRUBBED, PROC_REF(on_domain_scrubbed))
|
||||
|
||||
@@ -352,14 +347,12 @@
|
||||
"outfits" = list()
|
||||
)
|
||||
|
||||
for(var/path as anything in outfit_list)
|
||||
var/datum/outfit/outfit = path
|
||||
|
||||
for(var/datum/outfit/outfit as anything in outfit_list)
|
||||
var/outfit_name = initial(outfit.name)
|
||||
if(findtext(outfit_name, "(") != 0 || findtext(outfit_name, "-") != 0) // No special variants please
|
||||
continue
|
||||
|
||||
collection["outfits"] += list(list("path" = path, "name" = outfit_name))
|
||||
collection["outfits"] += list(list("path" = outfit, "name" = outfit_name))
|
||||
|
||||
return list(collection)
|
||||
|
||||
@@ -367,10 +360,7 @@
|
||||
/obj/machinery/netpod/proc/on_broken(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(isnull(occupant) || !connected)
|
||||
return
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_BITRUNNER_SEVER_AVATAR)
|
||||
sever_connection()
|
||||
|
||||
/// Checks the integrity, alerts occupants
|
||||
/obj/machinery/netpod/proc/on_damage_taken(datum/source, damage_amount)
|
||||
@@ -415,6 +405,11 @@
|
||||
/obj/machinery/netpod/proc/on_examine(datum/source, mob/examiner, list/examine_text)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(isnull(server_ref?.resolve()))
|
||||
examine_text += span_infoplain("It's not connected to anything.")
|
||||
examine_text += span_infoplain("Netpods must be built within 4 tiles of a server.")
|
||||
return
|
||||
|
||||
examine_text += span_infoplain("Drag yourself into the pod to engage the link.")
|
||||
examine_text += span_infoplain("It has limited resuscitation capabilities. Remaining in the pod can heal some injuries.")
|
||||
examine_text += span_infoplain("It has a security system that will alert the occupant if it is tampered with.")
|
||||
@@ -438,13 +433,13 @@
|
||||
open_machine()
|
||||
return
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_BITRUNNER_SEVER_AVATAR)
|
||||
sever_connection()
|
||||
|
||||
/// When the server is upgraded, drops brain damage a little
|
||||
/obj/machinery/netpod/proc/on_server_upgraded(datum/source, servo_rating)
|
||||
/obj/machinery/netpod/proc/on_server_upgraded(obj/machinery/quantum_server/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
disconnect_damage = BASE_DISCONNECT_DAMAGE * (1 - servo_rating)
|
||||
disconnect_damage = BASE_DISCONNECT_DAMAGE * (1 - source.servo_bonus)
|
||||
|
||||
/// Resolves a path to an outfit.
|
||||
/obj/machinery/netpod/proc/resolve_outfit(text)
|
||||
@@ -452,6 +447,13 @@
|
||||
if(ispath(path, /datum/outfit))
|
||||
return path
|
||||
|
||||
/// Severs the connection with the current avatar
|
||||
/obj/machinery/netpod/proc/sever_connection()
|
||||
if(isnull(occupant) || !connected)
|
||||
return
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_BITRUNNER_NETPOD_SEVER)
|
||||
|
||||
/// Closes the machine without shoving in an occupant
|
||||
/obj/machinery/netpod/proc/shut_pod()
|
||||
state_open = FALSE
|
||||
|
||||
@@ -104,5 +104,4 @@
|
||||
var/obj/machinery/quantum_server/nearby_server = locate(/obj/machinery/quantum_server, get_step(src, direction))
|
||||
if(nearby_server)
|
||||
server_ref = WEAKREF(nearby_server)
|
||||
nearby_server.console_ref = WEAKREF(src)
|
||||
return nearby_server
|
||||
|
||||
Reference in New Issue
Block a user