diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 103865bee94..4d85cb3fdf6 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -922,7 +922,7 @@ log_admin("[key_name(usr)] has equipped [key_name(current)] as a wizard") message_admins("[key_name_admin(usr)] has equipped [key_name_admin(current)] as a wizard") if("name") - SSticker.mode.name_wizard(current) + INVOKE_ASYNC(SSticker.mode, /datum/game_mode/wizard.proc/name_wizard, current) log_admin("[key_name(usr)] has allowed wizard [key_name(current)] to name themselves") message_admins("[key_name_admin(usr)] has allowed wizard [key_name_admin(current)] to name themselves") if("autoobjectives") @@ -1509,7 +1509,7 @@ SSticker.mode.equip_wizard(current) for(var/obj/item/spellbook/S in current.contents) S.op = 0 - SSticker.mode.name_wizard(current) + INVOKE_ASYNC(SSticker.mode, /datum/game_mode/wizard.proc/name_wizard, current) SSticker.mode.forge_wizard_objectives(src) SSticker.mode.greet_wizard(src) SSticker.mode.update_wiz_icons_added(src) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index da80a6e775c..e78b5fba90b 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -438,7 +438,7 @@ /area/proc/prison_break() for(var/obj/machinery/power/apc/temp_apc in src) - temp_apc.overload_lighting(70) + INVOKE_ASYNC(temp_apc, /obj/machinery/power/apc.proc/overload_lighting, 70) for(var/obj/machinery/door/airlock/temp_airlock in src) temp_airlock.prison_open() for(var/obj/machinery/door/window/temp_windoor in src) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 776a2bccd12..73dcd14c7c8 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -231,7 +231,7 @@ /atom/proc/on_reagent_change() return -/atom/proc/Bumped(AM as mob|obj) +/atom/proc/Bumped(atom/movable/AM) return /// Convenience proc to see if a container is open for chemistry handling @@ -257,7 +257,7 @@ /atom/proc/CheckExit() return TRUE -/atom/proc/HasProximity(atom/movable/AM as mob|obj) +/atom/proc/HasProximity(atom/movable/AM) return /atom/proc/emp_act(severity) diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm index 0e96dd92062..2a135607862 100644 --- a/code/game/gamemodes/cult/cult_structures.dm +++ b/code/game/gamemodes/cult/cult_structures.dm @@ -270,14 +270,10 @@ GLOBAL_LIST_INIT(blacklisted_pylon_turfs, typecacheof(list( /obj/effect/gateway/singularity_pull() return -/obj/effect/gateway/Bumped(mob/M as mob|obj) - spawn(0) - return +/obj/effect/gateway/Bumped(atom/movable/AM) return -/obj/effect/gateway/Crossed(AM as mob|obj, oldloc) - spawn(0) - return +/obj/effect/gateway/Crossed(atom/movable/AM, oldloc) return diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 526a2c01083..3ea7f83f6bb 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -679,7 +679,7 @@ for(var/thing in GLOB.apcs) var/obj/machinery/power/apc/apc if(prob(30 * apc.overload)) - apc.overload_lighting() + INVOKE_ASYNC(apc, /obj/machinery/power/apc.proc/overload_lighting) else apc.overload++ to_chat(owner, "Overcurrent applied to the powernet.") diff --git a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm index 5fc5e1e78cc..83ca06fe4b7 100644 --- a/code/game/gamemodes/shadowling/special_shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/special_shadowling_abilities.dm @@ -163,7 +163,7 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u to_chat(M, "An immense pressure slams you onto the ground!") for(var/thing in GLOB.apcs) var/obj/machinery/power/apc/A = thing - A.overload_lighting() + INVOKE_ASYNC(A, /obj/machinery/power/apc.proc/overload_lighting) var/mob/living/simple_animal/ascendant_shadowling/A = new /mob/living/simple_animal/ascendant_shadowling(H.loc) A.announce("VYSHA NERADA YEKHEZET U'RUU!!", 5, 'sound/hallucinations/veryfar_noise.ogg') for(var/obj/effect/proc_holder/spell/S in H.mind.spell_list) diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index a0bb4c349af..77972b00880 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -45,9 +45,8 @@ for(var/datum/mind/wizard in wizards) log_game("[key_name(wizard)] has been selected as a Wizard") forge_wizard_objectives(wizard) - //learn_basic_spells(wizard.current) equip_wizard(wizard.current) - name_wizard(wizard.current) + INVOKE_ASYNC(src, .proc/name_wizard, wizard.current) greet_wizard(wizard) if(use_huds) update_wiz_icons_added(wizard) @@ -89,17 +88,15 @@ var/wizard_name_first = pick(GLOB.wizard_first) var/wizard_name_second = pick(GLOB.wizard_second) var/randomname = "[wizard_name_first] [wizard_name_second]" - spawn(0) - var/newname = sanitize(copytext(input(wizard_mob, "You are the Space Wizard. Would you like to change your name to something else?", "Name change", randomname) as null|text,1,MAX_NAME_LEN)) + var/newname = sanitize(copytext(input(wizard_mob, "You are the Space Wizard. Would you like to change your name to something else?", "Name change", randomname) as null|text,1,MAX_NAME_LEN)) - if(!newname) - newname = randomname + if(!newname) + newname = randomname - wizard_mob.real_name = newname - wizard_mob.name = newname - if(wizard_mob.mind) - wizard_mob.mind.name = newname - return + wizard_mob.real_name = newname + wizard_mob.name = newname + if(wizard_mob.mind) + wizard_mob.mind.name = newname /datum/game_mode/proc/greet_wizard(var/datum/mind/wizard, var/you_are=1) addtimer(CALLBACK(wizard.current, /mob/.proc/playsound_local, null, 'sound/ambience/antag/ragesmages.ogg', 100, 0), 30) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 42ff08ff00f..1d80d98f676 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1245,8 +1245,10 @@ About the new airlock wires panel: return 1 /obj/machinery/door/airlock/emp_act(severity) - ..() - if(prob(40/severity)) + . = ..() + if(prob(20 / severity)) + open() + if(prob(40 / severity)) var/duration = world.time + (30 / severity) SECONDS if(duration > electrified_until) electrify(duration) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 9970974e4ff..db3b0cb93aa 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -249,8 +249,7 @@ for(var/obj/machinery/door/window/brigdoor/door in targets) if(!door.density) continue - spawn(0) - door.open() + INVOKE_ASYNC(door, /obj/machinery/door/window/brigdoor.proc/open) for(var/obj/structure/closet/secure_closet/brig/C in targets) if(C.broken) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 2d6fac3bb81..4ed92910c5a 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -234,12 +234,6 @@ emagged = 1 return 1 -/obj/machinery/door/emp_act(severity) - if(prob(20/severity) && (istype(src,/obj/machinery/door/airlock) || istype(src,/obj/machinery/door/window)) ) - spawn(0) - open() - ..() - /obj/machinery/door/update_icon() if(density) icon_state = "door1" diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index e423f92683c..f27d4bf34a8 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -57,6 +57,11 @@ if(emagged) . += "Its access panel is smoking slightly." +/obj/machinery/door/window/emp_act(severity) + . = ..() + if(prob(20 / severity)) + open() + /obj/machinery/door/window/proc/open_and_close() open() if(check_access(null)) diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 1b31891e537..f35b877bc17 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -137,19 +137,7 @@ T.ex_act(3) CHECK_TICK - //--- THROW ITEMS AROUND --- -/* - if(throw_dist > 0) - var/throw_dir = get_dir(epicenter,T) - for(var/obj/item/I in T) - spawn(0) //Simultaneously not one at a time - if(I && !I.anchored) - var/throw_mult = 0.5 + (0.5 * rand()) // Between 0.5 and 1.0 - var/throw_range = round((throw_dist + 1) * throw_mult) // Roughly 50% to 100% of throw_dist - if(throw_range > 0) - var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range) - I.throw_at(throw_at, throw_range, 2, no_spin = 1) //Throw it at 2 speed, this is purely visual anyway; don't spin the thrown items, it's very costly. -*/ + var/took = stop_watch(watch) //You need to press the DebugGame verb to see these now....they were getting annoying and we've collected a fair bit of data. Just -test- changes to explosion code using this please so we can compare if(GLOB.debug2) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 5c63dbc709c..719916e8ea0 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -56,16 +56,13 @@ /obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location) - ..() + . = ..() if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src)))) - if(!ishuman(usr)) return - if(opened) return 0 - if(contents.len) return 0 - visible_message("[usr] folds up the [src.name]") + if(!ishuman(usr) || opened || length(contents)) + return FALSE + visible_message("[usr] folds up the [name]") new item_path(get_turf(src)) - spawn(0) - qdel(src) - return + qdel(src) /obj/structure/closet/body_bag/relaymove(mob/user as mob) if(user.stat) diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 9934ce1c0ab..bc8c4bc65df 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -42,26 +42,23 @@ create_reagents(5) -/obj/item/kitchen/utensil/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) - if(!istype(M)) +/obj/item/kitchen/utensil/attack(mob/living/carbon/C, mob/living/carbon/user) + if(!istype(C)) return ..() if(user.a_intent != INTENT_HELP) if(user.zone_selected == "head" || user.zone_selected == "eyes") if((CLUMSY in user.mutations) && prob(50)) - M = user - return eyestab(M,user) + C = user + return eyestab(C, user) else return ..() - if(contents.len) + if(length(contents)) var/obj/item/reagent_containers/food/snacks/toEat = contents[1] if(istype(toEat)) - if(M.eat(toEat, user)) - toEat.On_Consume(M, user) - spawn(0) - if(toEat) - qdel(toEat) + if(C.eat(toEat, user)) + toEat.On_Consume(C, user) overlays.Cut() return diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 7304469f408..17c697faf11 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -25,5 +25,5 @@ for(var/thing in epicentreList) var/obj/effect/landmark/epicentre = thing for(var/obj/machinery/power/apc/apc in range(epicentre, lightsoutRange)) - apc.overload_lighting() + INVOKE_ASYNC(apc, /obj/machinery/power/apc.proc/overload_lighting) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 8d0408a74fb..38e1acd550b 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -34,16 +34,15 @@ /obj/item/reagent_containers/food/snacks/proc/On_Consume(mob/M, mob/user) if(!user) return - spawn(0) - if(!reagents.total_volume) - if(M == user) - to_chat(user, "You finish eating \the [src].") - user.visible_message("[M] finishes eating \the [src].") - user.unEquip(src) //so icons update :[ - Post_Consume(M) - var/obj/item/trash_item = generate_trash(usr) - usr.put_in_hands(trash_item) - qdel(src) + if(!reagents.total_volume) + if(M == user) + to_chat(user, "You finish eating \the [src].") + user.visible_message("[M] finishes eating \the [src].") + user.unEquip(src) //so icons update :[ + Post_Consume(M) + var/obj/item/trash_item = generate_trash(usr) + usr.put_in_hands(trash_item) + qdel(src) return /obj/item/reagent_containers/food/snacks/proc/Post_Consume(mob/living/M) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 8e7adea666b..e8820dd4c88 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -38,8 +38,7 @@ O.rename_self("AI",1) - spawn() - qdel(src) + INVOKE_ASYNC(GLOBAL_PROC, .proc/qdel, src) // To prevent the proc from returning null. return O @@ -92,8 +91,7 @@ O.Namepick() - spawn(0)//To prevent the proc from returning null. - qdel(src) + INVOKE_ASYNC(GLOBAL_PROC, .proc/qdel, src) // To prevent the proc from returning null. return O //human -> alien @@ -125,9 +123,7 @@ to_chat(new_xeno, "You are now an alien.") new_xeno.update_pipe_vision() - spawn(0)//To prevent the proc from returning null. - qdel(src) - return + qdel(src) /mob/living/carbon/human/proc/slimeize(reproduce as num) if(notransform) @@ -180,9 +176,7 @@ to_chat(new_corgi, "You are now a Corgi. Yap Yap!") new_corgi.update_pipe_vision() - spawn(0)//To prevent the proc from returning null. - qdel(src) - return + qdel(src) /mob/living/carbon/human/Animalize() @@ -211,9 +205,7 @@ to_chat(new_mob, "You suddenly feel more... animalistic.") new_mob.update_pipe_vision() - spawn() - qdel(src) - return + qdel(src) /mob/proc/Animalize() @@ -254,9 +246,7 @@ to_chat(pai, "You have become a pAI! Your name is [pai.name].") pai.update_pipe_vision() - spawn(0)//To prevent the proc from returning null. - qdel(src) - return + qdel(src) /mob/proc/safe_respawn(var/MP) if(!MP) diff --git a/code/modules/pda/radio.dm b/code/modules/pda/radio.dm index f214e705268..cd549759c1c 100644 --- a/code/modules/pda/radio.dm +++ b/code/modules/pda/radio.dm @@ -70,26 +70,22 @@ switch(href_list["op"]) if("control") active = locate(href_list["bot"]) - spawn(0) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) if("scanbots") // find all bots botlist = null - spawn(0) - post_signal(control_freq, "command", "bot_status", s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status", s_filter = bot_filter) if("botlist") active = null if("stop", "go", "home") - spawn(0) - post_signal(control_freq, "command", href_list["op"], "active", active, s_filter = bot_filter) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", href_list["op"], "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) if("summon") - spawn(0) - post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(hostpda), "useraccess", hostpda.GetAccess(), "user", usr, s_filter = bot_filter) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(hostpda), "useraccess", hostpda.GetAccess(), "user", usr, s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) /obj/item/integrated_radio/proc/add_to_radio(bot_filter) //Master filter control for bots. Must be placed in the bot's local New() to support map spawned bots. if(SSradio) @@ -123,38 +119,30 @@ ..() switch(href_list["op"]) if("start") - spawn(0) - post_signal(control_freq, "command", "start", "active", active, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "start", "active", active, s_filter = RADIO_MULEBOT) if("unload") - spawn(0) - post_signal(control_freq, "command", "unload", "active", active, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "unload", "active", active, s_filter = RADIO_MULEBOT) if("setdest") if(GLOB.deliverybeacons) var/dest = input("Select Bot Destination", "Mulebot [active.suffix] Interlink", active.destination) as null|anything in GLOB.deliverybeacontags if(dest) - spawn(0) - post_signal(control_freq, "command", "target", "active", active, "destination", dest, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "target", "active", active, "destination", dest, s_filter = RADIO_MULEBOT) if("retoff") - spawn(0) - post_signal(control_freq, "command", "autoret", "active", active, "value", 0, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "autoret", "active", active, "value", 0, s_filter = RADIO_MULEBOT) if("reton") - spawn(0) - post_signal(control_freq, "command", "autoret", "active", active, "value", 1, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "autoret", "active", active, "value", 1, s_filter = RADIO_MULEBOT) if("pickoff") - spawn(0) - post_signal(control_freq, "command", "autopick", "active", active, "value", 0, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "autopick", "active", active, "value", 0, s_filter = RADIO_MULEBOT) if("pickon") - spawn(0) - post_signal(control_freq, "command", "autopick", "active", active, "value", 1, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "autopick", "active", active, "value", 1, s_filter = RADIO_MULEBOT) - spawn(10) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = RADIO_MULEBOT) + post_signal(control_freq, "command", "bot_status", "active", active, s_filter = RADIO_MULEBOT) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 409abe3d724..455c4409c18 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -984,7 +984,7 @@ else if(href_list["overload"]) if(issilicon(usr) && !aidisabled) - overload_lighting() + INVOKE_ASYNC(src, /obj/machinery/power/apc.proc/overload_lighting) else if(href_list["malfhack"]) if(get_malf_status(usr)) @@ -1344,11 +1344,10 @@ return if(cell && cell.charge >= 20) cell.use(20) - spawn(0) - for(var/obj/machinery/light/L in area) - if(prob(chance)) - L.break_light_tube(0, 1) - stoplag() + for(var/obj/machinery/light/L in area) + if(prob(chance)) + L.break_light_tube(0, 1) + stoplag() /obj/machinery/power/apc/proc/null_charge() for(var/obj/machinery/light/L in area) diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index f2740676314..79931a837be 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -164,8 +164,7 @@ /datum/chemical_reaction/blackpowder_explosion/on_reaction(datum/reagents/holder, created_volume) var/location = get_turf(holder.my_atom) do_sparks(2, 1, location) - spawn(rand(5, 15)) - blackpowder_detonate(holder, created_volume) + addtimer(CALLBACK(null, .proc/blackpowder_detonate, holder, created_volume), rand(5, 15)) /proc/blackpowder_detonate(datum/reagents/holder, created_volume) var/turf/T = get_turf(holder.my_atom) @@ -176,8 +175,7 @@ explosion(T, ex_severe, ex_heavy,ex_light, ex_flash, 1) // If this black powder is in a decal, remove the decal, because it just exploded if(istype(holder.my_atom, /obj/effect/decal/cleanable/dirt/blackpowder)) - spawn(0) - qdel(holder.my_atom) + qdel(holder.my_atom) /datum/chemical_reaction/flash_powder name = "Flash powder" diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index f6980c03620..831a3ddc44f 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -23,13 +23,12 @@ /obj/item/reagent_containers/food/pill/attack(mob/living/carbon/M, mob/user, def_zone) if(!istype(M)) - return 0 + return FALSE bitesize = reagents.total_volume if(M.eat(src, user)) - spawn(0) - qdel(src) - return 1 - return 0 + qdel(src) + return TRUE + return FALSE /obj/item/reagent_containers/food/pill/afterattack(obj/target, mob/user, proximity) if(!proximity) diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 8826efa5eb8..591661f0e2d 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -44,7 +44,7 @@ return var/contents_log = reagents.reagent_list.Join(", ") - spray(A) + INVOKE_ASYNC(src, .proc/spray, A) playsound(loc, 'sound/effects/spray2.ogg', 50, 1, -6) user.changeNext_move(CLICK_CD_RANGE*2) @@ -62,19 +62,19 @@ return -/obj/item/reagent_containers/spray/proc/spray(var/atom/A) +/obj/item/reagent_containers/spray/proc/spray(atom/A) var/obj/effect/decal/chempuff/D = new /obj/effect/decal/chempuff(get_turf(src)) D.create_reagents(amount_per_transfer_from_this) reagents.trans_to(D, amount_per_transfer_from_this, 1/spray_currentrange) D.icon += mix_color_from_reagents(D.reagents.reagent_list) - spawn(0) - for(var/i=0, i