[MIRROR] Removes sleeping from the code in more places (#10611)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-04-09 16:13:00 -07:00
committed by GitHub
parent 174fb57a2c
commit de641ab6f8
20 changed files with 123 additions and 120 deletions

View File

@@ -28,6 +28,8 @@ Pipelines + Other Objects -> Pipe network
var/construction_type = null // Type path of the pipe item when this is deconstructed.
var/pipe_state // icon_state as a pipe item
var/being_loaded = FALSE //If the atmos machinery is currently being loaded via a map_template
var/initialize_directions = 0
var/pipe_color
@@ -121,6 +123,8 @@ Pipelines + Other Objects -> Pipe network
return node.pipe_color
/obj/machinery/atmospherics/process()
if(being_loaded) //If we're being maploaded, don't build the network just yet.
return
last_flow_rate = 0
last_power_draw = 0

View File

@@ -66,7 +66,7 @@
if(query_sound)
SEND_SOUND(C, sound(query_sound))
tgui_alert_async(D, question, "[role_name] request", list("Yes", "No", "Never for this round"), CALLBACK(src, PROC_REF(get_reply)), wait_time SECONDS)
tgui_alert_async(D, question, "[role_name] request", list("Yes", "No", "Never for this round"), CALLBACK(src, PROC_REF(get_reply)), wait_time)
/// Process an async alert response
/datum/ghost_query/proc/get_reply(response)

View File

@@ -72,7 +72,7 @@
INVOKE_ASYNC(src, PROC_REF(toggle_all), FALSE)
. = TRUE
if("scan")
scanscrubbers(ui.user)
scanscrubbers_user(ui.user)
. = TRUE
add_fingerprint(ui.user)
@@ -92,7 +92,7 @@
return FALSE
return TRUE
/obj/machinery/computer/area_atmos/proc/scanscrubbers(mob/user)
/obj/machinery/computer/area_atmos/proc/scanscrubbers()
connectedscrubbers = list()
var/found = 0
@@ -103,6 +103,8 @@
if(!found)
status = "ERROR: No scrubber found!"
/obj/machinery/computer/area_atmos/proc/scanscrubbers_user(mob/user) //Used when the user is in the UI and scans for scrubbers.
scanscrubbers()
updateUsrDialog(user)
// The one that only works in the same map area
@@ -121,6 +123,8 @@
if(!found)
status = "ERROR: No scrubber found!"
/obj/machinery/computer/area_atmos/area/scanscrubbers_user(mob/user) //Used when the user is in the UI and scans for scrubbers.
scanscrubbers()
updateUsrDialog(user)
/obj/machinery/computer/area_atmos/area/validscrubber(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber)

View File

@@ -26,12 +26,12 @@
/obj/machinery/vr_sleeper/alien/process()
if(stat & (BROKEN))
if(occupant)
go_out()
perform_exit()
visible_message(span_infoplain(span_bold("\The [src]") + " emits a low droning sound, before the pod door clicks open."))
return
else if(eject_dead && occupant && occupant.stat == DEAD)
visible_message(span_warning("\The [src] sounds an alarm, swinging its hatch open."))
go_out()
perform_exit()
/obj/machinery/vr_sleeper/alien/attackby(var/obj/item/I, var/mob/user)
add_fingerprint(user)
@@ -47,19 +47,17 @@
if(usr.incapacitated())
return
var/forced = FALSE
if(stat & (BROKEN) || (eject_dead && occupant && occupant.stat == DEAD))
forced = TRUE
go_out(forced)
perform_exit()
else
go_out()
add_fingerprint(usr)
/obj/machinery/vr_sleeper/alien/go_out(var/forced = TRUE)
/obj/machinery/vr_sleeper/alien/go_out()
if(!occupant)
return
if(!forced && avatar)
if(avatar)
if(tgui_alert(avatar, "Someone wants to remove you from virtual reality. Do you want to leave?", "Leave VR?", list("Yes", "No")) != "Yes")
return
@@ -103,7 +101,7 @@
to_chat(occupant,span_alien("\The [src] begins to [pick("whir","hum","pulse")] as a screen appears in front of you."))
if(tgui_alert(occupant, "This pod is already linked. Are you certain you wish to engage?", "Commmit?", list("Yes", "No")) != "Yes")
visible_message(span_alien("\The [src] pulses!"))
go_out(TRUE)
perform_exit()
return
to_chat(occupant,span_alien("Your mind blurs as information bombards you."))

View File

@@ -56,12 +56,12 @@
/obj/machinery/vr_sleeper/process()
if(stat & (NOPOWER|BROKEN))
if(occupant)
go_out()
occupant.exit_vr(FALSE)
visible_message(span_infoplain(span_bold("\The [src]") + " emits a low droning sound, before the pod door clicks open."))
return
else if(eject_dead && occupant && occupant.stat == DEAD) // If someone dies somehow while inside, spit them out.
visible_message(span_warning("\The [src] sounds an alarm, swinging its hatch open."))
go_out()
occupant.exit_vr(FALSE)
/obj/machinery/vr_sleeper/update_icon()
icon_state = "[base_state][occupant ? "1" : "0"]"
@@ -99,7 +99,7 @@
if(occupant && avatar)
avatar.exit_vr()
avatar = null
go_out()
perform_exit()
return
@@ -132,7 +132,7 @@
visible_message(span_danger("\The [src]'s internal lighting flashes rapidly, before the hatch swings open with a cloud of smoke."))
smoke.set_up(severity, 0, src)
smoke.start("#202020")
go_out()
perform_exit()
..(severity)
@@ -144,12 +144,10 @@
if(usr.incapacitated())
return
var/forced = FALSE
if(stat & (BROKEN|NOPOWER) || occupant && occupant.stat == DEAD)
forced = TRUE
go_out(forced)
perform_exit()
else
go_out()
add_fingerprint(usr)
/obj/machinery/vr_sleeper/verb/climb_in()
@@ -165,7 +163,7 @@
/obj/machinery/vr_sleeper/relaymove(mob/user as mob)
if(user.incapacitated())
return 0 //maybe they should be able to get out with cuffs, but whatever
go_out(TRUE)
perform_exit()
/obj/machinery/vr_sleeper/proc/go_in(var/mob/M, var/mob/user)
if(!M)
@@ -204,16 +202,26 @@
to_chat(user, span_warning("\The [src] rejects [M] with a sharp beep."))
return
/obj/machinery/vr_sleeper/proc/go_out(var/forced = TRUE)
/obj/machinery/vr_sleeper/proc/go_out()
if(!occupant)
return
if(!forced && avatar)
if(avatar)
if(tgui_alert(avatar, "Someone wants to remove you from virtual reality. Do you want to leave?", "Leave VR?", list("Yes", "No")) != "Yes")
return
perform_exit()
//The actual bulk of the exit code.
/obj/machinery/vr_sleeper/proc/perform_exit()
if(!occupant)
return
avatar = null
if(occupant.vr_link)
occupant.vr_link.exit_vr(FALSE)
if(occupant.client)
occupant.client.eye = occupant.client.mob
occupant.client.perspective = MOB_PERSPECTIVE
@@ -249,6 +257,8 @@
// If they've already enterred VR, and are reconnecting, prompt if they want a new body
if(avatar && tgui_alert(occupant, "You already have a [avatar.stat == DEAD ? "" : "deceased "]Virtual Reality avatar. Would you like to use it?", "New avatar", list("Yes", "No")) != "Yes")
// Delink the mob
if(!occupant) //We can walk out of this before we give a prompt...A TGUI state won't help here sadly.
return
occupant.vr_link = null
avatar = null
@@ -266,7 +276,7 @@
var/tf = null
if(tgui_alert(occupant, "Would you like to play as a different creature?", "Join as a mob?", list("Yes", "No")) == "Yes")
var/k = tgui_input_list(occupant, "Please select a creature:", "Mob list", vr_mob_tf_options)
if(!k)
if(!k || !occupant) //Our occupant can walk out.
return 0
tf = vr_mob_tf_options[k]

View File

@@ -55,4 +55,7 @@
/obj/structure/ghost_pod/ghost_activated/Initialize(mapload)
. = ..()
if(!mapload)
return INITIALIZE_HINT_LATELOAD
/obj/structure/ghost_pod/ghost_activated/LateInitialize()
ghostpod_startup(spawn_active)

View File

@@ -26,16 +26,27 @@
var/species = SPECIES_HUMAN //defaults to generic-ass humans
var/random_species = FALSE //flip to TRUE to randomize species from the list below
var/list/random_species_list = list(SPECIES_HUMAN,SPECIES_TAJARAN,SPECIES_UNATHI,SPECIES_SKRELL) //preset list that can be overriden downstream. only includes common humanoids for voidsuit compatibility's sake.
var/mob/living/carbon/human/spawned_corpse = null //The corpse we have just spawned.
// var/random_appearance = FALSE //TODO: make this work
// var/cause_of_death = null //TODO: set up a cause-of-death system. needs to support both damage types and actual wound types, so a body can have been bitten/stabbed/clawed/shot/burned/lasered/etc. to death
delete_me = TRUE
delete_me = FALSE //We don't do delete_me, we do our deletion in late_init
/obj/effect/landmark/corpse/Initialize(mapload)
. = ..()
createCorpse()
return INITIALIZE_HINT_LATELOAD
/obj/effect/landmark/corpse/LateInitialize()
createCorpse() //This is done because
spawned_corpse.death(1)
qdel(src)
/obj/effect/landmark/corpse/Destroy(force)
spawned_corpse = null
. = ..()
/obj/effect/landmark/corpse/proc/createCorpse() //Creates a mob and checks for gear in each slot before attempting to equip it.
var/mob/living/carbon/human/M = new /mob/living/carbon/human (src.loc)
spawned_corpse = M
M.low_sorting_priority = TRUE
if(random_species)
var/random_pick = pick(random_species_list)
@@ -45,7 +56,6 @@
M.set_species(species)
//TODO: insert appearance randomization, needs to be species-based
M.real_name = src.name
M.death(1) //Kills the new mob
//TODO: insert cause of death handling/wound simulation here
if(src.corpseuniform)
M.equip_to_slot_or_del(new src.corpseuniform(M), slot_w_uniform)

View File

@@ -19,6 +19,7 @@ var/list/blob_cores = list()
var/point_rate = 2
var/ai_controlled = TRUE
var/datum/ghost_query/Q //This is used so we can unregister ourself.
var/client/controller = null //Whoever is set to be controlling the blob. Used when the blob is created.
// Spawn this if you want a ghost to be able to play as the blob.
/obj/structure/blob/core/player
@@ -101,11 +102,16 @@ var/list/blob_cores = list()
blob_cores += src
START_PROCESSING(SSobj, src)
update_icon() //so it atleast appears
point_rate = new_rate
controller = new_overmind
if(!placed && !overmind)
create_overmind(new_overmind)
return INITIALIZE_HINT_LATELOAD
/obj/structure/blob/core/LateInitialize()
create_overmind(controller)
if(overmind)
update_icon()
point_rate = new_rate
/obj/structure/blob/core/Destroy()
var/turf/T = get_turf(src)
@@ -148,6 +154,7 @@ var/list/blob_cores = list()
if(prob(5))
B.change_to(/obj/structure/blob/shield/core, overmind)
if(overmind) //Doing this as we might be alive for a bit before a ghost possesses us.
overmind.blob_type.on_core_process(src)
/obj/structure/blob/core/proc/create_overmind(client/new_overmind, override_delay)
@@ -179,6 +186,7 @@ var/list/blob_cores = list()
else
C = new_overmind
overmind_creation(C)
controller = null //Controller has been set. Let's null it now.
/obj/structure/blob/core/proc/get_winner()
if(Q && Q.candidates.len) //Q should NEVER get deleted but...whatever, sanity.

View File

@@ -38,7 +38,7 @@
var/prev_shuttle_queue_state = SSshuttles.block_init_queue
SSshuttles.block_init_queue = TRUE
var/machinery_was_awake = SSmachines.suspend() // Suspend machinery (if it was not already suspended)
//var/machinery_was_awake = SSmachines.suspend() // Suspend machinery (if it was not already suspended) //Old way to keep atmos machines from processing while being loaded. This killed ALL machines in the world...not good.
var/list/atom/atoms = list()
var/list/area/areas = list()
@@ -55,6 +55,8 @@
else if(istype(A, /obj/machinery/atmospherics))
atmos_machines += A
atoms |= areas
for(var/obj/machinery/atmospherics/atmos_to_reenable as anything in atmos_machines)
atmos_to_reenable.being_loaded = TRUE
admin_notice(span_danger("Initializing newly created atom(s) in submap."), R_DEBUG)
SSatoms.InitializeAtoms(areas + turfs + atoms)
@@ -69,8 +71,13 @@
for(var/area/A as anything in areas)
A.power_change()
for(var/obj/machinery/atmospherics/atmos_to_reenable as anything in atmos_machines)
atmos_to_reenable.being_loaded = FALSE
/*//Old way to keep atmos machines from processing while being loaded. This killed ALL machines in the world...not good.
if(machinery_was_awake)
SSmachines.wake() // Wake only if it was awake before we tried to suspended it.
*///Old way to keep atmos machines from processing while being loaded. This killed ALL machines in the world...not good.
SSshuttles.block_init_queue = prev_shuttle_queue_state
SSshuttles.process_init_queues() // We will flush the queue unless there were other blockers, in which case they will do it.

View File

@@ -8,7 +8,6 @@
low_sorting_priority = TRUE
var/generate_species = SPECIES_HUMAN
var/generate_dead = FALSE
var/generate_gender = FALSE
var/generate_id_gender = FALSE
@@ -110,9 +109,6 @@
W.registered_name = real_name
equip_to_slot_or_del(W, slot_wear_id)
if(generate_dead)
death()
/*
* Subtypes.
*/

View File

@@ -222,11 +222,7 @@
return ..()
/mob/living/simple_mob/slime/promethean/death(gibbed, deathmessage = "rapidly loses cohesion, splattering across the ground...")
if(humanform)
humanform.death(gibbed, deathmessage)
else
animate(src, alpha = 0, time = 2 SECONDS)
sleep(2 SECONDS)
if(!QDELETED(src)) // Human's handle death should have taken us, but maybe we were adminspawned or something without a human counterpart
qdel(src)

View File

@@ -322,11 +322,7 @@
return ..()
/mob/living/simple_mob/protean_blob/death(gibbed, deathmessage = "Coalesces inwards, retreating into their core componants")
if(humanform)
humanform.death(gibbed, deathmessage)
else
animate(src, alpha = 0, time = 2 SECONDS)
sleep(2 SECONDS)
/mob/living/simple_mob/protean_blob/Life()
. = ..()

View File

@@ -85,7 +85,7 @@
to_chat(avatar, span_notice(" You black out for a moment, and wake to find yourself in a new body in virtual reality.")) // So this is what VR feels like?
// exit_vr is called on the vr mob, and puts the mind back into the original mob
/mob/living/carbon/human/proc/exit_vr()
/mob/living/carbon/human/proc/exit_vr(player_initated = TRUE)
set name = "Exit Virtual Reality"
set category = "Abilities.VR"
@@ -120,9 +120,9 @@
vr_holder.vr_link = src
vr_holder.teleop = null
if(istype(vr_holder.loc, /obj/machinery/vr_sleeper))
if(player_initated && istype(vr_holder.loc, /obj/machinery/vr_sleeper))
var/obj/machinery/vr_sleeper/V = vr_holder.loc
V.go_out(TRUE)
V.perform_exit()
if(died_in_vr)
addtimer(CALLBACK(src, PROC_REF(cleanup_vr)), 3000, TIMER_DELETE_ME) //Delete the body after 5 minutes

View File

@@ -208,6 +208,7 @@
/mob/living/silicon/robot/LateInitialize()
. = ..()
pick_module()
update_icon()
/mob/living/silicon/robot/rejuvenate()

View File

@@ -82,7 +82,6 @@ var/global/list/robot_modules = list(
R.radio.recalculateChannels()
R.set_default_module_icon()
R.pick_module()
if(!R.client)
R.icon_selected = FALSE // It wasnt a player selecting icon? Let them do it later!

View File

@@ -184,6 +184,8 @@
//vars for vore_icons toggle control
var/vore_icons_cache = null // null by default. Going from ON to OFF should store vore_icons val here, OFF to ON reset as null
var/obj/movement_target //Used by some mobs to hunt down food. Mainly noodle and Ian.
//no stripping of simplemobs
strip_pref = FALSE
@@ -226,6 +228,7 @@
friends.Cut()
languages.Cut()
movement_target = null
if(has_eye_glow)
remove_eyes()
@@ -316,6 +319,24 @@
icon_state = icon_living
update_icon()
/mob/living/simple_mob/proc/chase_target(ticker)
if(QDELETED(movement_target))
movement_target = null
return
if(ticker < 10 && (get_dist(src, movement_target) > 1)) //We only chase our target for 10 tiles or until we are next to them.
step_to(src,movement_target,1)
addtimer(CALLBACK(src, PROC_REF(chase_target), ++ticker), 3, TIMER_DELETE_ME)
return
face_atom(movement_target)
if(isturf(movement_target.loc))
UnarmedAttack(movement_target)
else if(ishuman(movement_target.loc) && prob(20))
visible_emote("stares at the [movement_target] that [movement_target.loc] has with an unknowable gaze.")
movement_target = null
/mob/living/simple_mob/say_quote(var/message, var/datum/language/speaking = null)
if(speak_emote.len)
@@ -337,18 +358,16 @@
hud_list[LIFE_HUD] = gen_hud_image(buildmode_hud, src, "ais_1", plane = PLANE_BUILDMODE)
add_overlay(hud_list)
//VOREStation Add Start Makes it so that simplemobs can understand galcomm without being able to speak it.
//Makes it so that simplemobs can understand galcomm without being able to speak it.
/mob/living/simple_mob/say_understands(var/mob/other, var/datum/language/speaking = null)
if(understands_common && (speaking?.name == LANGUAGE_GALCOM || !speaking))
return TRUE
return ..()
//Vorestation Add End
/decl/mob_organ_names
var/list/hit_zones = list("body") //When in doubt, it's probably got a body.
/*
* VOREStation Add
* How injured are we? Returns a number that is then added to movement cooldown and firing/melee delay respectively.
* Called by movement_delay and our firing/melee delay checks
*/
@@ -365,8 +384,6 @@
get_injury_level() // We check how injured we are, then actually update the mob on how hurt we are.
. = ..() // Calling parent here, actually updating our mob on how hurt we are.
// VOREStation Add End
/mob/living/simple_mob/proc/ColorMate()
set name = "Recolour"
set category = "Abilities.Settings"

View File

@@ -64,11 +64,13 @@
add_verb(src, /mob/living/proc/hide)
true_name = "[pick("Primary","Secondary","Tertiary","Quaternary")] [rand(1000,9999)]"
..()
if(!roundstart && antag)
request_player()
return INITIALIZE_HINT_LATELOAD
return ..()
/mob/living/simple_mob/animal/borer/LateInitialize()
request_player()
/mob/living/simple_mob/animal/borer/handle_special()
if(host && !stat && !host.stat)
@@ -195,14 +197,13 @@
qdel_null(Q) //get rid of the query
/mob/living/simple_mob/animal/borer/proc/transfer_personality(mob/candidate)
if(!candidate || !candidate.mind)
if(!candidate)
return
src.mind = candidate.mind
candidate.mind.current = src
ckey = candidate.ckey
if(mind)
if(candidate.mind)
src.mind = candidate.mind
candidate.mind.current = src
mind.assigned_role = JOB_CORTICAL_BORER
mind.special_role = JOB_CORTICAL_BORER

View File

@@ -128,7 +128,6 @@
gender = MALE
desc = "It's a corgi."
var/turns_since_scan = 0
var/obj/movement_target
makes_dirt = FALSE //VOREStation edit: no more dirt
holder_type = /obj/item/holder/corgi
@@ -144,35 +143,14 @@
turns_since_scan = 0
if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) ))
movement_target = null
if( !movement_target || !(movement_target.loc in oview(src, 3)) )
if(!movement_target || !(movement_target.loc in oview(src, 7)) )
movement_target = null
for(var/obj/item/reagent_containers/food/snacks/S in oview(src,3))
for(var/obj/item/reagent_containers/food/snacks/S in oview(src,7))
if(isturf(S.loc) || ishuman(S.loc))
movement_target = S
break
if(movement_target)
step_to(src,movement_target,1)
sleep(3)
step_to(src,movement_target,1)
sleep(3)
step_to(src,movement_target,1)
if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds
if (movement_target.loc.x < src.x)
set_dir(WEST)
else if (movement_target.loc.x > src.x)
set_dir(EAST)
else if (movement_target.loc.y < src.y)
set_dir(SOUTH)
else if (movement_target.loc.y > src.y)
set_dir(NORTH)
else
set_dir(SOUTH)
if(isturf(movement_target.loc) )
UnarmedAttack(movement_target)
else if(ishuman(movement_target.loc) && prob(20))
visible_emote("stares at the [movement_target] that [movement_target.loc] has with sad puppy eyes.")
chase_target()
if(prob(1))
visible_emote(pick("dances around","chases their tail"))

View File

@@ -149,7 +149,6 @@
vore_default_mode = DM_HOLD
var/turns_since_scan = 0
var/obj/movement_target
/mob/living/simple_mob/animal/passive/snake/python/noodle/Life()
..()
@@ -163,36 +162,15 @@
turns_since_scan = 0
if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) ))
movement_target = null
if( !movement_target || !(movement_target.loc in oview(src, 3)) )
if(!movement_target || !(movement_target.loc in oview(src, 7)) )
movement_target = null
for(var/obj/item/reagent_containers/food/snacks/snakesnack/S in oview(src,3))
for(var/obj/item/reagent_containers/food/snacks/snakesnack/S in oview(src,7))
if(isturf(S.loc) || ishuman(S.loc))
movement_target = S
visible_emote("turns towards \the [movement_target] and slithers towards it.")
break
if(movement_target)
step_to(src,movement_target,1)
sleep(3)
step_to(src,movement_target,1)
sleep(3)
step_to(src,movement_target,1)
if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds
if (movement_target.loc.x < src.x)
set_dir(WEST)
else if (movement_target.loc.x > src.x)
set_dir(EAST)
else if (movement_target.loc.y < src.y)
set_dir(SOUTH)
else if (movement_target.loc.y > src.y)
set_dir(NORTH)
else
set_dir(SOUTH)
if(isturf(movement_target.loc) )
UnarmedAttack(movement_target)
else if(ishuman(movement_target.loc) && prob(20))
visible_emote("stares at the [movement_target] that [movement_target.loc] has with an unknowable reptilian gaze.")
chase_target()
/mob/living/simple_mob/animal/passive/snake/python/noodle/apply_melee_effects(var/atom/A)
if(ismouse(A))
@@ -206,6 +184,7 @@
/mob/living/simple_mob/animal/passive/snake/python/noodle/attackby(var/obj/item/O, var/mob/user)
if(istype(O, /obj/item/reagent_containers/food/snacks/snakesnack))
visible_message(span_notice("[user] feeds \the [O] to [src]."))
adjust_nutrition(100) //It's sugar!
qdel(O)
else
return ..()

View File

@@ -23,7 +23,6 @@
//Fired processing vars
var/fired = FALSE //Have we been fired yet
var/paused = FALSE //for suspending the projectile midair
var/last_projectile_move = 0
var/last_process = 0
var/time_offset = 0
@@ -195,9 +194,6 @@
var/safety = range * 3
record_hitscan_start(RETURN_POINT_VECTOR_INCREMENT(src, Angle, MUZZLE_EFFECT_PIXEL_INCREMENT, 1))
while(loc && !QDELETED(src))
if(paused)
stoplag(1)
continue
if(safety-- <= 0)
if(loc)
Bump(loc)
@@ -281,8 +277,8 @@
if(!loc || !fired || !trajectory)
fired = FALSE
return PROCESS_KILL
if(paused || !isturf(loc))
last_projectile_move += world.time - last_process //Compensates for pausing, so it doesn't become a hitscan projectile when unpaused from charged up ticks.
if(!isturf(loc))
last_projectile_move += world.time - last_process
return
var/elapsed_time_deciseconds = (world.time - last_projectile_move) + time_offset
time_offset = 0