Merge pull request #13522 from silicons/async

Fixes the intermittent master controller lockups
This commit is contained in:
BlackMajor
2020-10-11 18:48:37 +13:00
committed by GitHub
8 changed files with 47 additions and 26 deletions
+6 -6
View File
@@ -64,10 +64,10 @@ SUBSYSTEM_DEF(input)
// Misc
macroset_classic_input["Tab"] = "\".winset \\\"mainwindow.macro=[SKIN_MACROSET_CLASSIC_HOTKEYS] map.focus=true input.background-color=[COLOR_INPUT_DISABLED]\\\"\""
macroset_classic_input["Escape"] = "\".winset \\\"input.text=\\\"\\\"\\\"\""
// FINALLY, WE CAN DO SOMETHING MORE NORMAL FOR THE SNOWFLAKE-BUT-LESS KEYSET.
// HAHA - SIKE. Because of BYOND weirdness (tl;dr not specifically binding this way results in potentially duplicate chatboxes when
// HAHA - SIKE. Because of BYOND weirdness (tl;dr not specifically binding this way results in potentially duplicate chatboxes when
// conflicts occur with something like say indicator vs say), we're going to snowflake this anyways
var/list/hard_binds = list(
"O" = "ooc",
@@ -80,7 +80,7 @@ SUBSYSTEM_DEF(input)
for(var/key in hard_binds)
for(var/modifier in anti_collision_modifiers)
hard_bind_anti_collision["[modifier]+[key]"] = ".NONSENSICAL_VERB_THAT_DOES_NOTHING"
macroset_classic_hotkey = list(
"Any" = "\"KeyDown \[\[*\]\]\"",
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
@@ -88,7 +88,7 @@ SUBSYSTEM_DEF(input)
"Escape" = "\".winset \\\"input.text=\\\"\\\"\\\"\"",
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"",
)
macroset_classic_hotkey |= hard_binds
macroset_classic_hotkey |= hard_bind_anti_collision
@@ -100,7 +100,7 @@ SUBSYSTEM_DEF(input)
"Escape" = "\".winset \\\"input.text=\\\"\\\"\\\"\"",
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"",
)
macroset_hotkey |= hard_binds
macroset_hotkey |= hard_bind_anti_collision
+21 -8
View File
@@ -5,6 +5,10 @@ SUBSYSTEM_DEF(npcpool)
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list()
/// catches sleeping
var/invoking = FALSE
/// Invoke start time
var/invoke_start = 0
/datum/controller/subsystem/npcpool/stat_entry(msg)
var/list/activelist = GLOB.simple_animals[AI_ON]
@@ -12,7 +16,6 @@ SUBSYSTEM_DEF(npcpool)
return ..()
/datum/controller/subsystem/npcpool/fire(resumed = FALSE)
if (!resumed)
var/list/activelist = GLOB.simple_animals[AI_ON]
src.currentrun = activelist.Copy()
@@ -24,12 +27,22 @@ SUBSYSTEM_DEF(npcpool)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
--currentrun.len
if(!SA.ckey && !SA.mob_transforming)
if(SA.stat != DEAD)
SA.handle_automated_movement()
if(SA.stat != DEAD)
SA.handle_automated_action()
if(SA.stat != DEAD)
SA.handle_automated_speech()
invoking = TRUE
invoke_start = world.time
INVOKE_ASYNC(src, .proc/invoke_process, SA)
if(invoking)
stack_trace("WARNING: [SA] ([SA.type]) slept during NPCPool processing.")
invoking = FALSE
if (MC_TICK_CHECK)
return
/datum/controller/subsystem/npcpool/proc/invoke_process(mob/living/simple_animal/SA)
if(!SA.ckey && !SA.mob_transforming)
if(SA.stat != DEAD)
SA.handle_automated_movement()
if(SA.stat != DEAD)
SA.handle_automated_action()
if(SA.stat != DEAD)
SA.handle_automated_speech()
invoking = FALSE