(Hopefully) Lessens preferences and manifest injection lag (#30596)

* first step to fixing a potential problem is identifying it

* woops

* kk

* mso is already doing this kek

* yeah lets do that too.

* replicated code

* wups

* wups

* better

* gibe the merge b0ss

* cyberboss

* Update dummy.dm
This commit is contained in:
kevinz000
2017-09-15 12:14:28 -07:00
committed by Jordan Brown
parent 59989bbe69
commit efe3bc3162
8 changed files with 57 additions and 19 deletions
@@ -34,7 +34,7 @@
return
// Set up the dummy for its photoshoot
var/mob/living/carbon/human/dummy/mannequin = new()
var/mob/living/carbon/human/dummy/mannequin = generate_or_wait_for_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES)
copy_to(mannequin)
// Determine what job is marked as 'High' priority, and dress them up as such.
@@ -82,4 +82,4 @@
CHECK_TICK
preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.
CHECK_TICK
qdel(mannequin)
unset_busy_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES)
@@ -0,0 +1,43 @@
/mob/living/carbon/human/dummy
real_name = "Test Dummy"
status_flags = GODMODE|CANPUSH
var/in_use = FALSE
INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
/mob/living/carbon/human/dummy/Destroy()
in_use = FALSE
return ..()
/mob/living/carbon/human/dummy/Life()
return
/mob/living/carbon/human/dummy/proc/wipe_state()
QDEL_LIST(contents)
cut_overlays(TRUE)
//Inefficient pooling/caching way.
GLOBAL_LIST_EMPTY(human_dummy_list)
/proc/generate_or_wait_for_human_dummy(slotkey)
if(!slotkey)
return new /mob/living/carbon/human/dummy
var/mob/living/carbon/human/dummy/D = GLOB.human_dummy_list[slotkey]
if(istype(D))
UNTIL(!D.in_use)
else
pass()
if(QDELETED(D))
D = new
GLOB.human_dummy_list[slotkey] = D
D.in_use = TRUE
return D
/proc/unset_busy_human_dummy(slotnumber)
if(!slotnumber)
return
var/mob/living/carbon/human/dummy/D = GLOB.human_dummy_list[slotnumber]
if(istype(D))
D.wipe_state()
D.in_use = FALSE
@@ -5,15 +5,6 @@
icon = 'icons/mob/human.dmi'
icon_state = "caucasian_m"
/mob/living/carbon/human/dummy
real_name = "Test Dummy"
status_flags = GODMODE|CANPUSH
INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
/mob/living/carbon/human/dummy/Life()
return
/mob/living/carbon/human/Initialize()
verbs += /mob/living/proc/mob_sleep
verbs += /mob/living/proc/lay_down