mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-18 14:12:20 +00:00
redo behavior of ssoverlays and atom overlay procs
This commit is contained in:
@@ -29,7 +29,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
|
|||||||
#define OPENCONTAINER (1<<4) // Is an open container for chemistry purposes.
|
#define OPENCONTAINER (1<<4) // Is an open container for chemistry purposes.
|
||||||
#define PHORONGUARD (1<<5) // Does not get contaminated by phoron.
|
#define PHORONGUARD (1<<5) // Does not get contaminated by phoron.
|
||||||
#define NOREACT (1<<6) // Reagents don't react inside this container.
|
#define NOREACT (1<<6) // Reagents don't react inside this container.
|
||||||
#define OVERLAY_QUEUED (1<<7)// Atom queued to SSoverlay for COMPILE_OVERLAYS
|
#define OVERLAY_QUEUED (1<<7) // Atom is queued for an overlay update
|
||||||
|
|
||||||
//Flags for items (equipment) - Used in /obj/item/var/item_flags
|
//Flags for items (equipment) - Used in /obj/item/var/item_flags
|
||||||
#define THICKMATERIAL (1<<0) // Prevents syringes, parapens and hyposprays if equipped to slot_suit or slot_head.
|
#define THICKMATERIAL (1<<0) // Prevents syringes, parapens and hyposprays if equipped to slot_suit or slot_head.
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
//
|
|
||||||
// Defines used for advanced performance profiling of subsystems.
|
|
||||||
// Currently used only by SSoverlays (2018-02-24 ~Leshana)
|
|
||||||
//
|
|
||||||
#define STAT_ENTRY_TIME 1
|
|
||||||
#define STAT_ENTRY_COUNT 2
|
|
||||||
#define STAT_ENTRY_LENGTH 2
|
|
||||||
|
|
||||||
#define STAT_START_STOPWATCH var/STAT_STOP_WATCH = TICK_USAGE
|
|
||||||
#define STAT_STOP_STOPWATCH var/STAT_TIME = TICK_USAGE_TO_MS(STAT_STOP_WATCH)
|
|
||||||
#define STAT_LOG_ENTRY(entrylist, entryname) \
|
|
||||||
var/list/STAT_ENTRY = entrylist[entryname] || (entrylist[entryname] = new /list(STAT_ENTRY_LENGTH));\
|
|
||||||
STAT_ENTRY[STAT_ENTRY_TIME] += STAT_TIME;\
|
|
||||||
var/STAT_INCR_AMOUNT = min(1, 2**round((STAT_ENTRY[STAT_ENTRY_COUNT] || 0)/SHORT_REAL_LIMIT));\
|
|
||||||
if (STAT_INCR_AMOUNT == 1 || prob(100/STAT_INCR_AMOUNT)) {\
|
|
||||||
STAT_ENTRY[STAT_ENTRY_COUNT] += STAT_INCR_AMOUNT;\
|
|
||||||
};\
|
|
||||||
@@ -108,26 +108,3 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
|||||||
#define FIRE_PRIORITY_PROJECTILES 150
|
#define FIRE_PRIORITY_PROJECTILES 150
|
||||||
#define FIRE_PRIORITY_CHAT 400
|
#define FIRE_PRIORITY_CHAT 400
|
||||||
#define FIRE_PRIORITY_OVERLAYS 500
|
#define FIRE_PRIORITY_OVERLAYS 500
|
||||||
|
|
||||||
// Macro defining the actual code applying our overlays lists to the BYOND overlays list. (I guess a macro for speed)
|
|
||||||
// TODO - I don't really like the location of this macro define. Consider it. ~Leshana
|
|
||||||
#define COMPILE_OVERLAYS(A)\
|
|
||||||
do {\
|
|
||||||
var/list/oo = A.our_overlays;\
|
|
||||||
var/list/po = A.priority_overlays;\
|
|
||||||
if(LAZYLEN(po)){\
|
|
||||||
if(LAZYLEN(oo)){\
|
|
||||||
A.overlays = oo + po;\
|
|
||||||
}\
|
|
||||||
else{\
|
|
||||||
A.overlays = po;\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
else if(LAZYLEN(oo)){\
|
|
||||||
A.overlays = oo;\
|
|
||||||
}\
|
|
||||||
else{\
|
|
||||||
A.overlays.Cut();\
|
|
||||||
}\
|
|
||||||
A.flags &= ~OVERLAY_QUEUED;\
|
|
||||||
} while (FALSE)
|
|
||||||
|
|||||||
26
code/_helpers/image.dm
Normal file
26
code/_helpers/image.dm
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/image/proc/add_overlay(x)
|
||||||
|
overlays += x
|
||||||
|
|
||||||
|
|
||||||
|
/image/proc/cut_overlay(x)
|
||||||
|
overlays -= x
|
||||||
|
|
||||||
|
|
||||||
|
/image/proc/cut_overlays(x)
|
||||||
|
overlays.Cut()
|
||||||
|
|
||||||
|
|
||||||
|
/image/proc/copy_overlays(atom/other, cut_old)
|
||||||
|
if(!other)
|
||||||
|
if(cut_old)
|
||||||
|
cut_overlays()
|
||||||
|
return
|
||||||
|
|
||||||
|
var/list/cached_other = other.our_overlays
|
||||||
|
if(cached_other)
|
||||||
|
if(cut_old || !overlays.len)
|
||||||
|
overlays = cached_other.Copy()
|
||||||
|
else
|
||||||
|
overlays |= cached_other
|
||||||
|
else if(cut_old)
|
||||||
|
cut_overlays()
|
||||||
@@ -51,11 +51,6 @@
|
|||||||
if(. == 0) // If they have the same var, then sort by name.
|
if(. == 0) // If they have the same var, then sort by name.
|
||||||
. = sorttext(b.name, a.name)
|
. = sorttext(b.name, a.name)
|
||||||
|
|
||||||
// Sorts entries in a performance stats list.
|
|
||||||
/proc/cmp_generic_stat_item_time(list/A, list/B)
|
|
||||||
. = B[STAT_ENTRY_TIME] - A[STAT_ENTRY_TIME]
|
|
||||||
if (!.)
|
|
||||||
. = B[STAT_ENTRY_COUNT] - A[STAT_ENTRY_COUNT]
|
|
||||||
|
|
||||||
/proc/cmp_typepaths_asc(A, B)
|
/proc/cmp_typepaths_asc(A, B)
|
||||||
return sorttext("[B]","[A]")
|
return sorttext("[B]","[A]")
|
||||||
|
|||||||
@@ -5,166 +5,148 @@ SUBSYSTEM_DEF(overlays)
|
|||||||
priority = FIRE_PRIORITY_OVERLAYS
|
priority = FIRE_PRIORITY_OVERLAYS
|
||||||
init_order = INIT_ORDER_OVERLAY
|
init_order = INIT_ORDER_OVERLAY
|
||||||
|
|
||||||
var/list/queue // Queue of atoms needing overlay compiling (TODO-VERIFY!)
|
/// The queue of atoms that need overlay updates.
|
||||||
var/list/stats
|
var/static/tmp/list/queue = list()
|
||||||
var/list/overlay_icon_state_caches // Cache thing
|
|
||||||
var/list/overlay_icon_cache // Cache thing
|
|
||||||
|
|
||||||
var/global/image/stringbro = new() // Temporarily super-global because of BYOND init order dumbness.
|
/// An image used to create appearances to be cached.
|
||||||
var/global/image/iconbro = new() // Temporarily super-global because of BYOND init order dumbness.
|
var/static/tmp/image/renderer = new
|
||||||
var/global/image/appearance_bro = new() // Temporarily super-global because of BYOND init order dumbness.
|
|
||||||
|
/// A list([icon] = list([state] = [appearance], ...), ...) cache of appearances.
|
||||||
|
var/static/tmp/list/state_cache = list()
|
||||||
|
|
||||||
|
/// A list([icon] = [appearance], ...) cache of appearances.
|
||||||
|
var/static/tmp/list/icon_cache = list()
|
||||||
|
|
||||||
|
/// The number of appearances currently cached.
|
||||||
|
var/static/tmp/cache_size = 0
|
||||||
|
|
||||||
|
|
||||||
|
/datum/controller/subsystem/overlays/Recover()
|
||||||
|
queue.Cut()
|
||||||
|
renderer = new
|
||||||
|
state_cache.Cut()
|
||||||
|
icon_cache.Cut()
|
||||||
|
cache_size = 0
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/OnNew()
|
|
||||||
overlay_icon_state_caches = list()
|
|
||||||
overlay_icon_cache = list()
|
|
||||||
queue = list()
|
|
||||||
stats = list()
|
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/Initialize(timeofday)
|
/datum/controller/subsystem/overlays/Initialize(timeofday)
|
||||||
fire(FALSE, TRUE)
|
fire(FALSE, TRUE)
|
||||||
|
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/stat_entry()
|
/datum/controller/subsystem/overlays/stat_entry()
|
||||||
..("Ov:[length(queue)]")
|
..("Queued Atoms: [queue.len], Cache Size: [cache_size]")
|
||||||
|
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/Shutdown()
|
|
||||||
text2file(render_stats(stats), "[log_path]-overlay.log")
|
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/Recover()
|
|
||||||
overlay_icon_state_caches = SSoverlays.overlay_icon_state_caches
|
|
||||||
overlay_icon_cache = SSoverlays.overlay_icon_cache
|
|
||||||
queue = SSoverlays.queue
|
|
||||||
|
|
||||||
|
|
||||||
/datum/controller/subsystem/overlays/fire(resumed, no_mc_tick)
|
/datum/controller/subsystem/overlays/fire(resumed, no_mc_tick)
|
||||||
var/list/queue = src.queue
|
var/count = 1
|
||||||
var/static/count = 0
|
for (var/atom/atom as anything in queue)
|
||||||
if (count)
|
++count
|
||||||
var/c = count
|
atom?.UpdateOverlays()
|
||||||
count = 0 //so if we runtime on the Cut, we don't try again.
|
|
||||||
queue.Cut(1,c+1)
|
|
||||||
|
|
||||||
for (var/thing in queue)
|
|
||||||
count++
|
|
||||||
if(thing)
|
|
||||||
STAT_START_STOPWATCH
|
|
||||||
var/atom/A = thing
|
|
||||||
COMPILE_OVERLAYS(A)
|
|
||||||
STAT_STOP_STOPWATCH
|
|
||||||
STAT_LOG_ENTRY(stats, A.type)
|
|
||||||
if (no_mc_tick)
|
if (no_mc_tick)
|
||||||
CHECK_TICK
|
CHECK_TICK
|
||||||
else if (MC_TICK_CHECK)
|
else if (MC_TICK_CHECK)
|
||||||
break
|
queue.Cut(count)
|
||||||
|
|
||||||
if (count)
|
|
||||||
queue.Cut(1,count+1)
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
/proc/iconstate2appearance(icon, iconstate)
|
|
||||||
// var/static/image/stringbro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
|
||||||
var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches
|
|
||||||
var/list/cached_icon = icon_states_cache[icon]
|
|
||||||
if (cached_icon)
|
|
||||||
var/cached_appearance = cached_icon["[iconstate]"]
|
|
||||||
if (cached_appearance)
|
|
||||||
return cached_appearance
|
|
||||||
stringbro.icon = icon
|
|
||||||
stringbro.icon_state = iconstate
|
|
||||||
if (!cached_icon) //not using the macro to save an associated lookup
|
|
||||||
cached_icon = list()
|
|
||||||
icon_states_cache[icon] = cached_icon
|
|
||||||
var/cached_appearance = stringbro.appearance
|
|
||||||
cached_icon["[iconstate]"] = cached_appearance
|
|
||||||
return cached_appearance
|
|
||||||
|
|
||||||
/proc/icon2appearance(icon)
|
|
||||||
// var/static/image/iconbro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
|
||||||
var/list/icon_cache = SSoverlays.overlay_icon_cache
|
|
||||||
. = icon_cache[icon]
|
|
||||||
if (!.)
|
|
||||||
iconbro.icon = icon
|
|
||||||
. = iconbro.appearance
|
|
||||||
icon_cache[icon] = .
|
|
||||||
|
|
||||||
/atom/proc/build_appearance_list(old_overlays)
|
|
||||||
// var/static/image/appearance_bro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
|
||||||
var/list/new_overlays = list()
|
|
||||||
if (!islist(old_overlays))
|
|
||||||
old_overlays = list(old_overlays)
|
|
||||||
for (var/overlay in old_overlays)
|
|
||||||
if(!overlay)
|
|
||||||
continue
|
|
||||||
if (istext(overlay))
|
|
||||||
new_overlays += iconstate2appearance(icon, overlay)
|
|
||||||
else if(isicon(overlay))
|
|
||||||
new_overlays += icon2appearance(overlay)
|
|
||||||
else
|
|
||||||
if(isloc(overlay))
|
|
||||||
var/atom/A = overlay
|
|
||||||
if (A.flags & OVERLAY_QUEUED)
|
|
||||||
COMPILE_OVERLAYS(A)
|
|
||||||
appearance_bro.appearance = overlay //this works for images and atoms too!
|
|
||||||
if(!ispath(overlay))
|
|
||||||
var/image/I = overlay
|
|
||||||
appearance_bro.dir = I.dir
|
|
||||||
new_overlays += appearance_bro.appearance
|
|
||||||
return new_overlays
|
|
||||||
|
|
||||||
#define NOT_QUEUED_ALREADY (!(flags & OVERLAY_QUEUED))
|
|
||||||
#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.queue += src;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cut all of atom's normal overlays. Usually leaves "priority" overlays untouched.
|
|
||||||
*
|
|
||||||
* @param priority If true, also will cut priority overlays.
|
|
||||||
*/
|
|
||||||
/atom/proc/cut_overlays(priority = FALSE)
|
|
||||||
var/list/cached_overlays = our_overlays
|
|
||||||
var/list/cached_priority = priority_overlays
|
|
||||||
|
|
||||||
var/need_compile = FALSE
|
|
||||||
|
|
||||||
if(LAZYLEN(cached_overlays)) //don't queue empty lists, don't cut priority overlays
|
|
||||||
cached_overlays.Cut() //clear regular overlays
|
|
||||||
need_compile = TRUE
|
|
||||||
|
|
||||||
if(priority && LAZYLEN(cached_priority))
|
|
||||||
cached_priority.Cut()
|
|
||||||
need_compile = TRUE
|
|
||||||
|
|
||||||
if(NOT_QUEUED_ALREADY && need_compile)
|
|
||||||
QUEUE_FOR_COMPILE
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes specific overlay(s) from the atom. Usually does not remove them from "priority" overlays.
|
|
||||||
*
|
|
||||||
* @param overlays The overlays to removed, type can be anything that is allowed for add_overlay().
|
|
||||||
* @param priority If true, also will remove them from the "priority" overlays.
|
|
||||||
*/
|
|
||||||
/atom/proc/cut_overlay(list/overlays, priority)
|
|
||||||
if(!overlays)
|
|
||||||
return
|
return
|
||||||
|
queue.Cut()
|
||||||
|
|
||||||
overlays = build_appearance_list(overlays)
|
|
||||||
|
|
||||||
var/list/cached_overlays = our_overlays //sanic
|
/datum/controller/subsystem/overlays/proc/GetStateAppearance(icon, state)
|
||||||
var/list/cached_priority = priority_overlays
|
var/list/subcache = state_cache[icon]
|
||||||
var/init_o_len = LAZYLEN(cached_overlays)
|
if (!subcache)
|
||||||
var/init_p_len = LAZYLEN(cached_priority) //starter pokemon
|
subcache = list()
|
||||||
|
state_cache[icon] = subcache
|
||||||
|
if (!subcache[state])
|
||||||
|
renderer.icon = icon
|
||||||
|
renderer.icon_state = state
|
||||||
|
subcache[state] = renderer.appearance
|
||||||
|
++cache_size
|
||||||
|
return subcache[state]
|
||||||
|
|
||||||
LAZYREMOVE(cached_overlays, overlays)
|
|
||||||
if(priority)
|
|
||||||
LAZYREMOVE(cached_priority, overlays)
|
|
||||||
|
|
||||||
if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_overlays)) || (init_p_len != LAZYLEN(cached_priority))))
|
/datum/controller/subsystem/overlays/proc/GetIconAppearance(icon)
|
||||||
QUEUE_FOR_COMPILE
|
if (!icon_cache[icon])
|
||||||
|
renderer.icon = icon
|
||||||
|
icon_cache[icon] = renderer.appearance
|
||||||
|
++cache_size
|
||||||
|
return icon_cache[icon]
|
||||||
|
|
||||||
|
|
||||||
|
/datum/controller/subsystem/overlays/proc/GetAppearanceList(atom/subject, list/sources)
|
||||||
|
if (!sources)
|
||||||
|
return list()
|
||||||
|
if (!islist(sources))
|
||||||
|
sources = list(sources)
|
||||||
|
var/image/image
|
||||||
|
var/list/result = list()
|
||||||
|
var/icon/icon = subject.icon
|
||||||
|
for (var/atom/entry as anything in sources)
|
||||||
|
if (!entry)
|
||||||
|
continue
|
||||||
|
else if (istext(entry))
|
||||||
|
result += GetStateAppearance(icon, entry)
|
||||||
|
else if (isicon(entry))
|
||||||
|
result += GetIconAppearance(entry)
|
||||||
|
else
|
||||||
|
if (isloc(entry))
|
||||||
|
if (entry.flags & OVERLAY_QUEUED)
|
||||||
|
entry.ImmediateOverlayUpdate()
|
||||||
|
renderer.appearance = entry
|
||||||
|
if (!ispath(entry))
|
||||||
|
image = entry
|
||||||
|
renderer.dir = image.dir
|
||||||
|
result += renderer.appearance
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
/// Enqueues the atom for an overlay update if not already queued
|
||||||
|
/atom/proc/QueueOverlayUpdate()
|
||||||
|
if (flags & OVERLAY_QUEUED)
|
||||||
|
return
|
||||||
|
SSoverlays.queue += src
|
||||||
|
flags |= OVERLAY_QUEUED
|
||||||
|
|
||||||
|
|
||||||
|
/// Builds the atom's overlay state from caches
|
||||||
|
/atom/proc/UpdateOverlays()
|
||||||
|
if (gc_destroyed)
|
||||||
|
if (length(overlays))
|
||||||
|
overlays.Cut()
|
||||||
|
return
|
||||||
|
flags &= ~OVERLAY_QUEUED
|
||||||
|
if (length(priority_overlays))
|
||||||
|
if (length(our_overlays))
|
||||||
|
overlays = priority_overlays + our_overlays
|
||||||
|
else
|
||||||
|
overlays = priority_overlays
|
||||||
|
else if (length(our_overlays))
|
||||||
|
overlays = our_overlays
|
||||||
|
else
|
||||||
|
overlays.Cut()
|
||||||
|
|
||||||
|
|
||||||
|
/// Immediately runs an overlay update and dequeues the atom
|
||||||
|
/atom/proc/ImmediateOverlayUpdate()
|
||||||
|
SSoverlays.queue -= src
|
||||||
|
UpdateOverlays()
|
||||||
|
|
||||||
|
|
||||||
|
/// Clears the atom's overlay cache(s) and queues an update if needed
|
||||||
|
/atom/proc/cut_overlays(priority)
|
||||||
|
if (priority)
|
||||||
|
if (!length(priority_overlays))
|
||||||
|
return
|
||||||
|
priority_overlays.Cut()
|
||||||
|
QueueOverlayUpdate()
|
||||||
|
else if (length(our_overlays))
|
||||||
|
our_overlays.Cut()
|
||||||
|
QueueOverlayUpdate()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds specific overlay(s) to the atom.
|
* Adds specific overlay(s) to the atom.
|
||||||
* It is designed so any of the types allowed to be added to /atom/overlays can be added here too. More details below.
|
* It is designed so any of the types allowed to be added to /atom/overlays can be added here too. More details below.
|
||||||
*
|
*
|
||||||
* @param overlays The overlay(s) to add. These may be
|
* @param add The overlay(s) to add. These may be
|
||||||
* - A string: In which case it is treated as an icon_state of the atom's icon.
|
* - A string: In which case it is treated as an icon_state of the atom's icon.
|
||||||
* - An icon: It is treated as an icon.
|
* - An icon: It is treated as an icon.
|
||||||
* - An atom: Its own overlays are compiled and then it's appearance is added. (Meaning its current apperance is frozen).
|
* - An atom: Its own overlays are compiled and then it's appearance is added. (Meaning its current apperance is frozen).
|
||||||
@@ -173,30 +155,46 @@ var/global/image/appearance_bro = new() // Temporarily super-global because of B
|
|||||||
* - Or a list containing any of the above.
|
* - Or a list containing any of the above.
|
||||||
* @param priority The overlays are added to the "priority" list istead of the normal one.
|
* @param priority The overlays are added to the "priority" list istead of the normal one.
|
||||||
*/
|
*/
|
||||||
/atom/proc/add_overlay(list/overlays, priority = FALSE)
|
/atom/proc/add_overlay(list/add, priority)
|
||||||
if(!overlays)
|
if (!add)
|
||||||
return
|
return
|
||||||
|
add = SSoverlays.GetAppearanceList(src, add)
|
||||||
overlays = build_appearance_list(overlays)
|
if (!length(add))
|
||||||
|
return
|
||||||
LAZYINITLIST(our_overlays) //always initialized after this point
|
if (priority)
|
||||||
LAZYINITLIST(priority_overlays)
|
if (priority_overlays)
|
||||||
|
priority_overlays += add
|
||||||
var/list/cached_overlays = our_overlays //sanic
|
|
||||||
var/list/cached_priority = priority_overlays
|
|
||||||
var/init_o_len = cached_overlays.len
|
|
||||||
var/init_p_len = cached_priority.len //starter pokemon
|
|
||||||
var/need_compile
|
|
||||||
|
|
||||||
if(priority)
|
|
||||||
cached_priority += overlays //or in the image. Can we use [image] = image?
|
|
||||||
need_compile = init_p_len != cached_priority.len
|
|
||||||
else
|
else
|
||||||
cached_overlays += overlays
|
priority_overlays = add
|
||||||
need_compile = init_o_len != cached_overlays.len
|
else if (our_overlays)
|
||||||
|
our_overlays += add
|
||||||
|
else
|
||||||
|
our_overlays = add
|
||||||
|
QueueOverlayUpdate()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes specific overlay(s) from the atom. Usually does not remove them from "priority" overlays.
|
||||||
|
*
|
||||||
|
* @param overlays The overlays to removed, type can be anything that is allowed for add_overlay().
|
||||||
|
* @param priority If true, also will remove them from the "priority" overlays.
|
||||||
|
*/
|
||||||
|
/atom/proc/cut_overlay(list/cut, priority)
|
||||||
|
if (!cut)
|
||||||
|
return
|
||||||
|
cut = SSoverlays.GetAppearanceList(src, cut)
|
||||||
|
if (!length(cut))
|
||||||
|
return
|
||||||
|
var/update
|
||||||
|
if (priority && length(priority_overlays))
|
||||||
|
priority_overlays -= cut
|
||||||
|
update = TRUE
|
||||||
|
if (length(our_overlays))
|
||||||
|
our_overlays -= cut
|
||||||
|
update = TRUE
|
||||||
|
if (update)
|
||||||
|
QueueOverlayUpdate()
|
||||||
|
|
||||||
if(NOT_QUEUED_ALREADY && need_compile) //have we caught more pokemon?
|
|
||||||
QUEUE_FOR_COMPILE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the overlays from another atom, either replacing all of ours or appending to our existing overlays.
|
* Copy the overlays from another atom, either replacing all of ours or appending to our existing overlays.
|
||||||
@@ -205,22 +203,21 @@ var/global/image/appearance_bro = new() // Temporarily super-global because of B
|
|||||||
* @param other The atom to copy overlays from.
|
* @param other The atom to copy overlays from.
|
||||||
* @param cut_old If true, all of our overlays will be *replaced* by the other's. If other is null, that means cutting all ours.
|
* @param cut_old If true, all of our overlays will be *replaced* by the other's. If other is null, that means cutting all ours.
|
||||||
*/
|
*/
|
||||||
/atom/proc/copy_overlays(atom/other, cut_old) //copys our_overlays from another atom
|
/atom/proc/copy_overlays(atom/other, cut)
|
||||||
if(!other)
|
if (!other)
|
||||||
if(cut_old)
|
if (cut)
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
return
|
return
|
||||||
|
if (!length(other.our_overlays))
|
||||||
var/list/cached_other = other.our_overlays
|
if (cut)
|
||||||
if(cached_other)
|
|
||||||
if(cut_old || !LAZYLEN(our_overlays))
|
|
||||||
our_overlays = cached_other.Copy()
|
|
||||||
else
|
|
||||||
our_overlays |= cached_other
|
|
||||||
if(NOT_QUEUED_ALREADY)
|
|
||||||
QUEUE_FOR_COMPILE
|
|
||||||
else if(cut_old)
|
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
|
return
|
||||||
|
if (cut || !length(our_overlays))
|
||||||
|
our_overlays = other.our_overlays.Copy()
|
||||||
|
else
|
||||||
|
our_overlays |= other.our_overlays
|
||||||
|
QueueOverlayUpdate()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of overlays that the target atom has
|
* Returns a list of overlays that the target atom has
|
||||||
@@ -230,48 +227,16 @@ var/global/image/appearance_bro = new() // Temporarily super-global because of B
|
|||||||
*/
|
*/
|
||||||
/proc/get_overlays(atom/other, priority, special)
|
/proc/get_overlays(atom/other, priority, special)
|
||||||
var/list/including = list()
|
var/list/including = list()
|
||||||
if(!other)
|
if (!other)
|
||||||
return including
|
return including
|
||||||
|
for (var/image/I as anything in other.our_overlays)
|
||||||
for(var/image/I as anything in other.our_overlays)
|
if (!special && I.plane > 0)
|
||||||
if(!special && I.plane > 0)
|
|
||||||
continue
|
continue
|
||||||
including += I
|
including += I
|
||||||
|
if (!priority)
|
||||||
if(!priority)
|
|
||||||
return including
|
return including
|
||||||
|
for (var/image/I as anything in other.priority_overlays)
|
||||||
for(var/image/I as anything in other.priority_overlays)
|
if (!special && I.plane > 0)
|
||||||
if(!special && I.plane > 0)
|
|
||||||
continue
|
continue
|
||||||
including += I
|
including += I
|
||||||
|
|
||||||
return including
|
return including
|
||||||
|
|
||||||
#undef NOT_QUEUED_ALREADY
|
|
||||||
#undef QUEUE_FOR_COMPILE
|
|
||||||
|
|
||||||
//TODO: Better solution for these?
|
|
||||||
/image/proc/add_overlay(x)
|
|
||||||
overlays += x
|
|
||||||
|
|
||||||
/image/proc/cut_overlay(x)
|
|
||||||
overlays -= x
|
|
||||||
|
|
||||||
/image/proc/cut_overlays(x)
|
|
||||||
overlays.Cut()
|
|
||||||
|
|
||||||
/image/proc/copy_overlays(atom/other, cut_old)
|
|
||||||
if(!other)
|
|
||||||
if(cut_old)
|
|
||||||
cut_overlays()
|
|
||||||
return
|
|
||||||
|
|
||||||
var/list/cached_other = other.our_overlays
|
|
||||||
if(cached_other)
|
|
||||||
if(cut_old || !overlays.len)
|
|
||||||
overlays = cached_other.Copy()
|
|
||||||
else
|
|
||||||
overlays |= cached_other
|
|
||||||
else if(cut_old)
|
|
||||||
cut_overlays()
|
|
||||||
|
|||||||
@@ -324,19 +324,7 @@ var/global/list/PDA_Manifest = list()
|
|||||||
var/hidden
|
var/hidden
|
||||||
var/datum/job/J = SSjob.get_job(H.mind.assigned_role)
|
var/datum/job/J = SSjob.get_job(H.mind.assigned_role)
|
||||||
hidden = J?.offmap_spawn
|
hidden = J?.offmap_spawn
|
||||||
|
H.ImmediateOverlayUpdate()
|
||||||
/* Note: Due to cached_character_icon, a number of emergent properties occur due to the initialization
|
|
||||||
* order of readied-up vs latejoiners. Namely, latejoiners will get a uniform in their datacore picture, but readied-up will
|
|
||||||
* not. This is due to the fact that SSticker calls data_core.manifest_inject() inside of ticker/proc/create_characters(),
|
|
||||||
* but does not equip them until ticker/proc/equip_characters(), which is called later. So, this proc is literally called before
|
|
||||||
* they ever get their equipment, and so it can't get a picture of them in their equipment.
|
|
||||||
* Latejoiners do not have this problem, because /mob/new_player/proc/AttemptLateSpawn calls EquipRank() before it calls
|
|
||||||
* this proc, which means that they're already clothed by the time they get their picture taken here.
|
|
||||||
* The COMPILE_OVERLAYS() here is just to bypass SSoverlays taking for-fucking-ever to update the mob, since we're about to
|
|
||||||
* take a picture of them, we want all the overlays.
|
|
||||||
*/
|
|
||||||
COMPILE_OVERLAYS(H)
|
|
||||||
SSoverlays.queue -= H
|
|
||||||
|
|
||||||
var/id = generate_record_id()
|
var/id = generate_record_id()
|
||||||
//General Record
|
//General Record
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin("#job_icon")
|
var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin("#job_icon")
|
||||||
dress_mannequin(mannequin)
|
dress_mannequin(mannequin)
|
||||||
mannequin.dir = SOUTH
|
mannequin.dir = SOUTH
|
||||||
COMPILE_OVERLAYS(mannequin)
|
mannequin.ImmediateOverlayUpdate()
|
||||||
var/icon/preview_icon = getFlatIcon(mannequin)
|
var/icon/preview_icon = getFlatIcon(mannequin)
|
||||||
|
|
||||||
preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.
|
preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser.
|
||||||
|
|||||||
@@ -52,9 +52,8 @@
|
|||||||
/obj/item/card/id/proc/update_name()
|
/obj/item/card/id/proc/update_name()
|
||||||
name = "[src.registered_name]'s ID Card ([src.assignment])"
|
name = "[src.registered_name]'s ID Card ([src.assignment])"
|
||||||
|
|
||||||
/obj/item/card/id/proc/set_id_photo(var/mob/M)
|
/obj/item/card/id/proc/set_id_photo(mob/M)
|
||||||
COMPILE_OVERLAYS(M)
|
M.ImmediateOverlayUpdate()
|
||||||
SSoverlays.queue -= M
|
|
||||||
var/icon/F = getFlatIcon(M, defdir = SOUTH, no_anim = TRUE)
|
var/icon/F = getFlatIcon(M, defdir = SOUTH, no_anim = TRUE)
|
||||||
front = "'data:image/png;base64,[icon2base64(F)]'"
|
front = "'data:image/png;base64,[icon2base64(F)]'"
|
||||||
|
|
||||||
|
|||||||
@@ -22,19 +22,19 @@
|
|||||||
|
|
||||||
icon = 'icons/obj/smoothlattice.dmi'
|
icon = 'icons/obj/smoothlattice.dmi'
|
||||||
icon_state = "latticeblank"
|
icon_state = "latticeblank"
|
||||||
updateOverlays()
|
ImmediateOverlayUpdate()
|
||||||
for (var/dir in cardinal)
|
for (var/dir in cardinal)
|
||||||
var/obj/structure/lattice/L
|
var/obj/structure/lattice/L
|
||||||
if(locate(/obj/structure/lattice, get_step(src, dir)))
|
if(locate(/obj/structure/lattice, get_step(src, dir)))
|
||||||
L = locate(/obj/structure/lattice, get_step(src, dir))
|
L = locate(/obj/structure/lattice, get_step(src, dir))
|
||||||
L.updateOverlays()
|
L.UpdateAdjacentLattices()
|
||||||
|
|
||||||
/obj/structure/lattice/Destroy()
|
/obj/structure/lattice/Destroy()
|
||||||
for (var/dir in cardinal)
|
for (var/dir in cardinal)
|
||||||
var/obj/structure/lattice/L
|
var/obj/structure/lattice/L
|
||||||
if(locate(/obj/structure/lattice, get_step(src, dir)))
|
if(locate(/obj/structure/lattice, get_step(src, dir)))
|
||||||
L = locate(/obj/structure/lattice, get_step(src, dir))
|
L = locate(/obj/structure/lattice, get_step(src, dir))
|
||||||
L.updateOverlays(src.loc)
|
L.UpdateAdjacentLattices()
|
||||||
if(istype(loc, /turf/simulated/open))
|
if(istype(loc, /turf/simulated/open))
|
||||||
var/turf/simulated/open/O = loc
|
var/turf/simulated/open/O = loc
|
||||||
spawn(1)
|
spawn(1)
|
||||||
@@ -80,20 +80,14 @@
|
|||||||
return
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/structure/lattice/proc/updateOverlays()
|
/obj/structure/lattice/proc/UpdateAdjacentLattices()
|
||||||
//if(!(istype(src.loc, /turf/space)))
|
|
||||||
// qdel(src)
|
|
||||||
spawn(1)
|
spawn(1)
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
|
|
||||||
var/dir_sum = 0
|
var/dir_sum = 0
|
||||||
|
|
||||||
for (var/direction in cardinal)
|
for (var/direction in cardinal)
|
||||||
if(locate(/obj/structure/lattice, get_step(src, direction)))
|
if(locate(/obj/structure/lattice, get_step(src, direction)))
|
||||||
dir_sum += direction
|
dir_sum += direction
|
||||||
else
|
else
|
||||||
if(!(istype(get_step(src, direction), /turf/space)))
|
if(!(istype(get_step(src, direction), /turf/space)))
|
||||||
dir_sum += direction
|
dir_sum += direction
|
||||||
|
|
||||||
icon_state = "lattice[dir_sum]"
|
icon_state = "lattice[dir_sum]"
|
||||||
return
|
|
||||||
|
|||||||
@@ -206,7 +206,6 @@ var/list/admin_verbs_debug = list(
|
|||||||
/client/proc/cmd_debug_tog_aliens,
|
/client/proc/cmd_debug_tog_aliens,
|
||||||
/client/proc/cmd_display_del_log,
|
/client/proc/cmd_display_del_log,
|
||||||
/client/proc/cmd_display_init_log,
|
/client/proc/cmd_display_init_log,
|
||||||
/client/proc/cmd_display_overlay_log,
|
|
||||||
/client/proc/air_report,
|
/client/proc/air_report,
|
||||||
/client/proc/reload_admins,
|
/client/proc/reload_admins,
|
||||||
/client/proc/reload_eventMs,
|
/client/proc/reload_eventMs,
|
||||||
|
|||||||
@@ -245,27 +245,6 @@
|
|||||||
if(!check_rights(R_DEBUG)) return
|
if(!check_rights(R_DEBUG)) return
|
||||||
src << browse(replacetext(SSatoms.InitLog(), "\n", "<br>"), "window=initlog")
|
src << browse(replacetext(SSatoms.InitLog(), "\n", "<br>"), "window=initlog")
|
||||||
|
|
||||||
/client/proc/cmd_display_overlay_log()
|
|
||||||
set category = "Debug"
|
|
||||||
set name = "Display overlay Log"
|
|
||||||
set desc = "Display SSoverlays log of everything that's passed through it."
|
|
||||||
|
|
||||||
if(!check_rights(R_DEBUG)) return
|
|
||||||
render_stats(SSoverlays.stats, src)
|
|
||||||
|
|
||||||
// Render stats list for round-end statistics.
|
|
||||||
/proc/render_stats(list/stats, user, sort = /proc/cmp_generic_stat_item_time)
|
|
||||||
sortTim(stats, sort, TRUE)
|
|
||||||
|
|
||||||
var/list/lines = list()
|
|
||||||
for (var/entry in stats)
|
|
||||||
var/list/data = stats[entry]
|
|
||||||
lines += "[entry] => [num2text(data[STAT_ENTRY_TIME], 10)]ms ([data[STAT_ENTRY_COUNT]]) (avg:[num2text(data[STAT_ENTRY_TIME]/(data[STAT_ENTRY_COUNT] || 1), 99)])"
|
|
||||||
|
|
||||||
if (user)
|
|
||||||
user << browse("<ol><li>[lines.Join("</li><li>")]</li></ol>", "window=[url_encode("stats:\ref[stats]")]")
|
|
||||||
else
|
|
||||||
. = lines.Join("\n")
|
|
||||||
|
|
||||||
/client/proc/cmd_admin_grantfullaccess(var/mob/M in mob_list)
|
/client/proc/cmd_admin_grantfullaccess(var/mob/M in mob_list)
|
||||||
set category = "Admin"
|
set category = "Admin"
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
mannequin.toggle_tail(setting = TRUE)
|
mannequin.toggle_tail(setting = TRUE)
|
||||||
mannequin.toggle_wing(setting = TRUE)
|
mannequin.toggle_wing(setting = TRUE)
|
||||||
mannequin.update_tail_showing()
|
mannequin.update_tail_showing()
|
||||||
COMPILE_OVERLAYS(mannequin)
|
mannequin.ImmediateOverlayUpdate()
|
||||||
|
|
||||||
update_character_previews(new /mutable_appearance(mannequin))
|
update_character_previews(new /mutable_appearance(mannequin))
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@
|
|||||||
#include "code\__defines\spaceman_dmm.dm"
|
#include "code\__defines\spaceman_dmm.dm"
|
||||||
#include "code\__defines\species_languages.dm"
|
#include "code\__defines\species_languages.dm"
|
||||||
#include "code\__defines\sqlite_defines.dm"
|
#include "code\__defines\sqlite_defines.dm"
|
||||||
#include "code\__defines\stat_tracking.dm"
|
|
||||||
#include "code\__defines\subsystems.dm"
|
#include "code\__defines\subsystems.dm"
|
||||||
#include "code\__defines\supply.dm"
|
#include "code\__defines\supply.dm"
|
||||||
#include "code\__defines\targeting.dm"
|
#include "code\__defines\targeting.dm"
|
||||||
@@ -103,6 +102,7 @@
|
|||||||
#include "code\_helpers\game.dm"
|
#include "code\_helpers\game.dm"
|
||||||
#include "code\_helpers\global_lists.dm"
|
#include "code\_helpers\global_lists.dm"
|
||||||
#include "code\_helpers\icons.dm"
|
#include "code\_helpers\icons.dm"
|
||||||
|
#include "code\_helpers\image.dm"
|
||||||
#include "code\_helpers\logging.dm"
|
#include "code\_helpers\logging.dm"
|
||||||
#include "code\_helpers\matrices.dm"
|
#include "code\_helpers\matrices.dm"
|
||||||
#include "code\_helpers\mobs.dm"
|
#include "code\_helpers\mobs.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user