mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
[MIRROR] Adds logging to overlay overflow errors [MDB IGNORE] (#14084)
* Adds logging to overlay overflow errors (#67497) So we've got this overlay cap of like 100 right? Prevents OOMs But right now if you overrun it we have no way of knowing how you got there, so we just end up with no info. This pr solves that, by adding a printout of icon-icon_state-dir = amount for each apperance. Note, we are basically cheating by typing these overlay members as mutable apperance, they can be just normal appearances, which we don't have an accessible type for. Fortunately we can cheat. Oh and if you overflow the limit you get the error overlay applied to you, for sniks * Adds logging to overlay overflow errors Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
co-authored by
LemonInTheDark
parent
e1fbc094a7
commit
1ec55ea9e6
@@ -43,17 +43,21 @@ SUBSYSTEM_DEF(overlays)
|
||||
count++
|
||||
if(!atom_to_compile)
|
||||
continue
|
||||
if(length(atom_to_compile.overlays) >= MAX_ATOM_OVERLAYS)
|
||||
//Break it real GOOD
|
||||
stack_trace("Too many overlays on [atom_to_compile.type] - [length(atom_to_compile.overlays)], refusing to update and cutting")
|
||||
atom_to_compile.overlays.Cut()
|
||||
continue
|
||||
STAT_START_STOPWATCH
|
||||
COMPILE_OVERLAYS(atom_to_compile)
|
||||
UNSETEMPTY(atom_to_compile.add_overlays)
|
||||
UNSETEMPTY(atom_to_compile.remove_overlays)
|
||||
STAT_STOP_STOPWATCH
|
||||
STAT_LOG_ENTRY(stats, atom_to_compile.type)
|
||||
if(length(atom_to_compile.overlays) >= MAX_ATOM_OVERLAYS)
|
||||
//Break it real GOOD
|
||||
var/text_lays = overlays2text(atom_to_compile.overlays)
|
||||
stack_trace("Too many overlays on [atom_to_compile.type] - [length(atom_to_compile.overlays)], refusing to update and cutting.\
|
||||
\n What follows is a printout of all existing overlays at the time of the overflow \n[text_lays]")
|
||||
atom_to_compile.overlays.Cut()
|
||||
//Let them know they fucked up
|
||||
atom_to_compile.add_overlay(mutable_appearance('icons/testing/greyscale_error.dmi'))
|
||||
continue
|
||||
if(mc_check)
|
||||
if(MC_TICK_CHECK)
|
||||
break
|
||||
@@ -63,6 +67,19 @@ SUBSYSTEM_DEF(overlays)
|
||||
queue.Cut(1,count+1)
|
||||
count = 0
|
||||
|
||||
/// Converts an overlay list into text for debug printing
|
||||
/// Of note: overlays aren't actually mutable appearances, they're just appearances
|
||||
/// Don't have access to that type tho, so this is the best you're gonna get
|
||||
/proc/overlays2text(list/overlays)
|
||||
var/list/unique_overlays = list()
|
||||
// As anything because we're basically doing type coerrsion, rather then actually filtering for mutable apperances
|
||||
for(var/mutable_appearance/overlay as anything in overlays)
|
||||
var/key = "[overlay.icon]-[overlay.icon_state]-[overlay.dir]"
|
||||
unique_overlays[key] += 1
|
||||
var/list/output_text = list()
|
||||
for(var/key in unique_overlays)
|
||||
output_text += "([key]) = [unique_overlays[key]]"
|
||||
return output_text.Join("\n")
|
||||
|
||||
/proc/iconstate2appearance(icon, iconstate)
|
||||
var/static/image/stringbro = new()
|
||||
|
||||
Reference in New Issue
Block a user