Update SSOverlays (ported from Baystation) (#19051)

Our SSOverlays system is outdated, and is likely the cause of many of
the issues seen in #18895. It has also been linked to a massive server
performance decrease.

This brings an updated system from Baystation, hopefully with speed
increases.

Should be testmerged, ideally with #18895.

---------

Co-authored-by: Cody Brittain <cbrittain10@live.com>
This commit is contained in:
Cody Brittain
2024-05-01 07:46:27 +00:00
committed by GitHub
co-authored by Cody Brittain
parent 405a05b819
commit 9983fca311
350 changed files with 1626 additions and 1498 deletions
+2 -2
View File
@@ -38,7 +38,7 @@
return
/obj/item/clipboard/update_icon()
cut_overlays()
ClearOverlays()
var/list/to_add = list()
if(toppaper)
to_add += toppaper.icon_state
@@ -48,7 +48,7 @@
if(haspen)
to_add += "clipboard_pen"
to_add += "clipboard_over"
add_overlay(to_add)
AddOverlays(to_add)
/obj/item/clipboard/attackby(obj/item/attacking_item, mob/user)
+2 -2
View File
@@ -34,9 +34,9 @@
icon_state = "folder_purple"
/obj/item/folder/update_icon()
cut_overlays()
ClearOverlays()
if(contents.len)
add_overlay("folder_paper")
AddOverlays("folder_paper")
return
/obj/item/folder/attackby(obj/item/attacking_item, mob/user)
+4 -4
View File
@@ -26,16 +26,16 @@
return ..()
/obj/item/journal/update_icon()
cut_overlays()
ClearOverlays()
if(!open)
icon_state = "[initial(icon_state)]_closed"
add_overlay(overlay_image(icon, "closed", flags=RESET_COLOR))
AddOverlays(overlay_image(icon, "closed", flags=RESET_COLOR))
else if(LAZYLEN(indices))
icon_state = initial(icon_state)
add_overlay(overlay_image(icon, "writing", flags=RESET_COLOR))
AddOverlays(overlay_image(icon, "writing", flags=RESET_COLOR))
else
icon_state = initial(icon_state)
add_overlay(overlay_image(icon, "blank", flags=RESET_COLOR))
AddOverlays(overlay_image(icon, "blank", flags=RESET_COLOR))
if(closed_desc)
desc = open ? initial(desc) + closed_desc : initial(desc)
+5 -5
View File
@@ -178,7 +178,7 @@
throw_range = 8
old_name = name
name = "paper plane"
cut_overlays() //Removes stamp icons
ClearOverlays() //Removes stamp icons
return
if (user.a_intent == I_DISARM && icon_state != "scrap" && can_fold)
@@ -191,7 +191,7 @@
icon_state = "paper_swan"
old_name = name
name = "origami swan"
cut_overlays() //Removes stamp icons
ClearOverlays() //Removes stamp icons
return
if (user.a_intent == I_HELP && old_name && (icon_state == "paper_plane" || icon_state == "paper_swan"))
@@ -285,7 +285,7 @@
stamps = null
free_space = MAX_PAPER_MESSAGE_LEN
stamped = list()
cut_overlays()
ClearOverlays()
updateinfolinks()
update_icon()
@@ -420,7 +420,7 @@
var/image/S = image('icons/obj/bureaucracy.dmi', ico[i])
S.pixel_x = offset_x[i]
S.pixel_y = offset_y[i]
add_overlay(S)
AddOverlays(S)
/**
* Takes the paper's info variable, a user, and parses language markers that exist
* in it. It returns an HTML string which represents the languages properly.
@@ -677,7 +677,7 @@
if(!stamped)
stamped = new
stamped += attacking_item.type
add_overlay(stampoverlay)
AddOverlays(stampoverlay)
playsound(src, 'sound/bureaucracy/stamp.ogg', 50, 1)
to_chat(user, SPAN_NOTICE("You stamp the paper with \the [attacking_item]."))
+3 -3
View File
@@ -263,7 +263,7 @@
/obj/item/paper_bundle/update_icon()
var/obj/item/paper/P = pages[1]
icon_state = P.icon_state
copy_overlays(P, TRUE)
CopyOverlays(P, TRUE)
underlays = 0
var/i = 0
var/photo
@@ -279,11 +279,11 @@
else if(istype(O, /obj/item/photo))
var/obj/item/photo/Ph = O
photo = 1
add_overlay(Ph.tiny)
AddOverlays(Ph.tiny)
if(i>1)
desc = "[i] papers clipped to each other."
else
desc = "A single sheet of paper."
if(photo)
desc += "\nThere is a photo attached to it."
add_overlay("clip")
AddOverlays("clip")
+6 -6
View File
@@ -116,18 +116,18 @@
return new /obj/item/shreddedp(get_turf(src))
/obj/machinery/papershredder/update_icon() //makes it show how full the papershredder is while covering up the animation. Seemsgood - Wezzy
cut_overlays()
ClearOverlays()
switch(paperamount)
if(2 to 3)
add_overlay("papershredder1")
AddOverlays("papershredder1")
if(4 to 5)
add_overlay("papershredder2")
AddOverlays("papershredder2")
if(6 to 7)
add_overlay("papershredder3")
AddOverlays("papershredder3")
if(8 to 9)
add_overlay("papershredder4")
AddOverlays("papershredder4")
if(10)
add_overlay("papershredder5")
AddOverlays("papershredder5")
/obj/item/shreddedp/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/flame/lighter))
+1 -1
View File
@@ -205,7 +205,7 @@
img = image('icons/obj/bureaucracy.dmi', "paper_stamp-dots")
img.pixel_x = copy.offset_x[j]
img.pixel_y = copy.offset_y[j]
c.add_overlay(img)
c.AddOverlays(img)
if(!toner)
target.visible_message(SPAN_NOTICE("A red light on \the [target] flashes, indicating that it is out of toner."))