mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-17 02:54:44 +01:00
(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:
@@ -450,3 +450,7 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
|
||||
#define SECURITY_SAFE 1
|
||||
#define SECURITY_ULTRASAFE 2
|
||||
#define SECURITY_TRUSTED 3
|
||||
|
||||
//Dummy mob reserve slots
|
||||
#define DUMMY_HUMAN_SLOT_PREFERENCES "dummy_preference_preview"
|
||||
#define DUMMY_HUMAN_SLOT_MANIFEST "dummy_manifest_generation"
|
||||
|
||||
@@ -926,10 +926,10 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
|
||||
return 0
|
||||
|
||||
//For creating consistent icons for human looking simple animals
|
||||
/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs)
|
||||
/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs, dummy_key)
|
||||
var/static/list/humanoid_icon_cache = list()
|
||||
if(!icon_id || !humanoid_icon_cache[icon_id])
|
||||
var/mob/living/carbon/human/dummy/body = new()
|
||||
var/mob/living/carbon/human/dummy/body = generate_or_wait_for_human_dummy(dummy_key)
|
||||
|
||||
if(prefs)
|
||||
prefs.copy_to(body)
|
||||
@@ -956,14 +956,12 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
|
||||
partial = getFlatIcon(body)
|
||||
out_icon.Insert(partial,dir=EAST)
|
||||
|
||||
qdel(body)
|
||||
|
||||
humanoid_icon_cache[icon_id] = out_icon
|
||||
dummy_key? unset_busy_human_dummy(dummy_key) : qdel(body)
|
||||
return out_icon
|
||||
else
|
||||
return humanoid_icon_cache[icon_id]
|
||||
|
||||
|
||||
//Hook, override to run code on- wait this is images
|
||||
//Images have dir without being an atom, so they get their own definition.
|
||||
//Lame.
|
||||
|
||||
@@ -236,10 +236,10 @@ SUBSYSTEM_DEF(ticker)
|
||||
|
||||
PostSetup()
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/PostSetup()
|
||||
set waitfor = 0
|
||||
set waitfor = FALSE
|
||||
mode.post_setup()
|
||||
GLOB.start_state = new /datum/station_state()
|
||||
GLOB.start_state.count(1)
|
||||
|
||||
@@ -196,6 +196,7 @@
|
||||
|
||||
|
||||
/datum/datacore/proc/manifest_inject(mob/living/carbon/human/H, client/C)
|
||||
set waitfor = FALSE
|
||||
if(H.mind && (H.mind.assigned_role != H.mind.special_role))
|
||||
var/assignment
|
||||
if(H.mind.assigned_role)
|
||||
@@ -284,4 +285,4 @@
|
||||
C = H.client
|
||||
if(C)
|
||||
P = C.prefs
|
||||
return get_flat_human_icon(null, J, P)
|
||||
return get_flat_human_icon(null, J, P, DUMMY_HUMAN_SLOT_MANIFEST)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1579,6 +1579,7 @@
|
||||
#include "code\modules\mob\living\carbon\alien\special\facehugger.dm"
|
||||
#include "code\modules\mob\living\carbon\human\damage_procs.dm"
|
||||
#include "code\modules\mob\living\carbon\human\death.dm"
|
||||
#include "code\modules\mob\living\carbon\human\dummy.dm"
|
||||
#include "code\modules\mob\living\carbon\human\emote.dm"
|
||||
#include "code\modules\mob\living\carbon\human\examine.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human.dm"
|
||||
|
||||
Reference in New Issue
Block a user