mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 07:20:09 +01:00
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:
co-authored by
Cody Brittain
parent
405a05b819
commit
9983fca311
@@ -104,10 +104,10 @@
|
||||
. = TRUE
|
||||
|
||||
/obj/item/aicard/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
if(carded_ai)
|
||||
if (!carded_ai.control_disabled)
|
||||
add_overlay("aicard-on")
|
||||
AddOverlays("aicard-on")
|
||||
if(carded_ai.stat)
|
||||
icon_state = "aicard-404"
|
||||
else
|
||||
|
||||
@@ -65,35 +65,35 @@
|
||||
var/c_state = "battery[battery_level][contained_sprite ? slot_str_to_contained_flag(slot) : ""]"
|
||||
var/image/battery_overlay = image(c_icon, c_state)
|
||||
battery_overlay.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(battery_overlay)
|
||||
I.AddOverlays(battery_overlay)
|
||||
if(breath_mask)
|
||||
var/c_state = "mask_[mask_on ? "worn" : "idle"][contained_sprite ? slot_str_to_contained_flag(slot) : ""]"
|
||||
var/image/mask_overlay = image(c_icon, c_state)
|
||||
mask_overlay.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(mask_overlay)
|
||||
I.AddOverlays(mask_overlay)
|
||||
if(tank)
|
||||
if(tank_level)
|
||||
var/c_state = "tank_indicator[tank_level][contained_sprite ? slot_str_to_contained_flag(slot) : ""]"
|
||||
var/image/tank_level_overlay = image(c_icon, c_state)
|
||||
tank_level_overlay.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(tank_level_overlay)
|
||||
I.AddOverlays(tank_level_overlay)
|
||||
var/c_state = "tank_[tank_type][contained_sprite ? slot_str_to_contained_flag(slot) : ""]"
|
||||
var/image/tank_overlay = image(c_icon, c_state)
|
||||
tank_overlay.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(tank_overlay)
|
||||
I.AddOverlays(tank_overlay)
|
||||
if(epp_active)
|
||||
var/c_state = "epp_active[cpr_mode ? "_cpr" : ""][contained_sprite ? slot_str_to_contained_flag(slot) : ""]"
|
||||
var/image/epp_overlay = image(c_icon, c_state)
|
||||
epp_overlay.appearance_flags = RESET_ALPHA
|
||||
I.add_overlay(epp_overlay)
|
||||
I.AddOverlays(epp_overlay)
|
||||
return I
|
||||
|
||||
/obj/item/auto_cpr/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
item_state = "[cpr_mode ? "med_harness_cpr" : "[initial(item_state)]"]"
|
||||
|
||||
if(breath_mask)
|
||||
add_overlay("mask_[mask_on ? "worn" : "idle"]")
|
||||
AddOverlays("mask_[mask_on ? "worn" : "idle"]")
|
||||
if(battery)
|
||||
switch(battery.percent())
|
||||
if(90 to INFINITY) battery_level = 6
|
||||
@@ -103,7 +103,7 @@
|
||||
if(20 to 39) battery_level = 2
|
||||
if(05 to 19) battery_level = 1
|
||||
if(-INFINITY to 4) battery_level = 0
|
||||
add_overlay("battery[battery_level]")
|
||||
AddOverlays("battery[battery_level]")
|
||||
if(tank)
|
||||
switch(tank.percent())
|
||||
if(90 to INFINITY) tank_level = 6
|
||||
@@ -113,7 +113,7 @@
|
||||
if(20 to 39) tank_level = 2
|
||||
if(05 to 19) tank_level = 1
|
||||
if(-INFINITY to 4) tank_level = 0
|
||||
add_overlay("tank_indicator[tank_level]")
|
||||
AddOverlays("tank_indicator[tank_level]")
|
||||
|
||||
if(istype(tank, /obj/item/tank/emergency_oxygen/engi))
|
||||
tank_type = "engi"
|
||||
@@ -121,11 +121,11 @@
|
||||
tank_type = "oxy"
|
||||
else
|
||||
tank_type = "other"
|
||||
add_overlay("tank_[tank_type]")
|
||||
AddOverlays("tank_[tank_type]")
|
||||
if(epp_active)
|
||||
add_overlay("epp_active")
|
||||
AddOverlays("epp_active")
|
||||
if(panel_open)
|
||||
add_overlay("panel_open[battery ? "_battery" : ""]")
|
||||
AddOverlays("panel_open[battery ? "_battery" : ""]")
|
||||
|
||||
/obj/item/auto_cpr/mob_can_equip(mob/living/carbon/human/H, slot, disable_warning = 0, force = 0)
|
||||
. = ..()
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
else if(on)
|
||||
var/image/I = overlay_image(icon, "glowstick-overlay", color)
|
||||
I.blend_mode = BLEND_ADD
|
||||
add_overlay(I)
|
||||
AddOverlays(I)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
item_state = "[initial(icon_state)]-on"
|
||||
set_light(brightness_on, flashlight_power, light_color)
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
set_light(brightness_on, flashlight_power, light_color)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
var/image/I = image(icon = icon, icon_state = "lavalamp-[on ? "on" : "off"]")
|
||||
I.color = light_color
|
||||
add_overlay(I)
|
||||
AddOverlays(I)
|
||||
|
||||
/obj/item/device/flashlight/lamp/lava/red
|
||||
light_color = COLOR_RED
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
/obj/item/device/lightreplacer/update_icon()
|
||||
if(emagged)
|
||||
add_overlay("emagged")
|
||||
AddOverlays("emagged")
|
||||
|
||||
|
||||
/obj/item/device/lightreplacer/proc/Use(var/mob/user)
|
||||
|
||||
@@ -167,15 +167,15 @@
|
||||
if (WT.use(2, user))
|
||||
user.visible_message(SPAN_NOTICE("[user] starts welding the metal shell of [src]."), SPAN_NOTICE("You start [hacked ? "repairing" : "welding open"] the metal covering of [src]."))
|
||||
playsound(loc, 'sound/items/Welder.ogg', 50, 1)
|
||||
add_overlay("overlay_welding")
|
||||
AddOverlays("overlay_welding")
|
||||
if(WT.use_tool(src, user, 25, volume = 50))
|
||||
to_chat(user, SPAN_NOTICE("You are able to [hacked ? "repair" : "weld through"] the metal shell of [src]."))
|
||||
if (hacked) locked = 1
|
||||
else locked = 0
|
||||
hacked = !hacked
|
||||
cut_overlay("overlay_welding")
|
||||
CutOverlays("overlay_welding")
|
||||
else
|
||||
cut_overlay("overlay_welding")
|
||||
CutOverlays("overlay_welding")
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
@@ -402,7 +402,7 @@
|
||||
update_overlays()
|
||||
|
||||
/obj/item/device/magnetic_lock/proc/update_overlays()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
switch (status)
|
||||
if (STATUS_BROKEN)
|
||||
icon_state = "broken"
|
||||
@@ -410,16 +410,16 @@
|
||||
|
||||
if (STATUS_INACTIVE to STATUS_ACTIVE)
|
||||
if (hacked)
|
||||
add_overlay("overlay_hacked")
|
||||
AddOverlays("overlay_hacked")
|
||||
else if (locked)
|
||||
add_overlay("overlay_locked")
|
||||
AddOverlays("overlay_locked")
|
||||
else
|
||||
add_overlay("overlay_unlocked")
|
||||
AddOverlays("overlay_unlocked")
|
||||
switch (constructionstate)
|
||||
if (0)
|
||||
return
|
||||
if (1 to 4)
|
||||
add_overlay("overlay_deconstruct_[constructionstate]")
|
||||
AddOverlays("overlay_deconstruct_[constructionstate]")
|
||||
|
||||
/obj/item/device/magnetic_lock/proc/takedamage(var/damage)
|
||||
if(invincible)
|
||||
@@ -453,7 +453,7 @@
|
||||
switch (status)
|
||||
if (STATUS_INACTIVE to STATUS_ACTIVE)
|
||||
if(istype(src, /obj/item/device/magnetic_lock/keypad))
|
||||
add_overlay("overlay_keypad")
|
||||
AddOverlays("overlay_keypad")
|
||||
|
||||
/obj/item/device/magnetic_lock/keypad/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/memorywiper/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
if(anchored)
|
||||
icon_state = "[initial(icon_state)]_opened"
|
||||
if(attached)
|
||||
add_overlay("wireout")
|
||||
AddOverlays("wireout")
|
||||
if(wiping)
|
||||
add_overlay("screen")
|
||||
AddOverlays("screen")
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
if(tracking_apc)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
apc_indicator = mutable_appearance(icon, "lost")
|
||||
add_overlay(apc_indicator)
|
||||
AddOverlays(apc_indicator)
|
||||
else
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
QDEL_NULL(apc_indicator)
|
||||
@@ -169,7 +169,7 @@
|
||||
apc_indicator.icon_state = "medium"
|
||||
if(16 to INFINITY)
|
||||
apc_indicator.icon_state = "far"
|
||||
set_overlays(apc_indicator)
|
||||
SetOverlays(apc_indicator)
|
||||
|
||||
/obj/item/device/multitool/proc/wire(datum/integrated_io/io, mob/user)
|
||||
if(!io.holder.assembly)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
/obj/item/device/paicard/Initialize()
|
||||
. = ..()
|
||||
add_overlay("pai_off")
|
||||
AddOverlays("pai_off")
|
||||
SSpai.all_pai_devices += src
|
||||
update_light()
|
||||
|
||||
@@ -389,19 +389,19 @@
|
||||
|
||||
/obj/item/device/paicard/proc/setPersonality(mob/living/silicon/pai/personality)
|
||||
src.pai = personality
|
||||
add_overlay("pai-happy")
|
||||
AddOverlays("pai-happy")
|
||||
playsound(src, 'sound/effects/pai/pai_restore.ogg', 75)
|
||||
|
||||
/obj/item/device/paicard/proc/removePersonality()
|
||||
src.pai = null
|
||||
cut_overlays()
|
||||
add_overlay("pai-off")
|
||||
ClearOverlays()
|
||||
AddOverlays("pai-off")
|
||||
|
||||
/obj/item/device/paicard
|
||||
var/current_emotion = 1
|
||||
/obj/item/device/paicard/proc/setEmotion(var/emotion)
|
||||
if(pai)
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
var/new_state
|
||||
switch(emotion)
|
||||
if(1) new_state = "pai-happy"
|
||||
@@ -420,7 +420,7 @@
|
||||
if(14) new_state = "pai-exclamation"
|
||||
if(15) new_state = "pai-question"
|
||||
if (new_state)
|
||||
add_overlay(new_state)
|
||||
AddOverlays(new_state)
|
||||
current_emotion = emotion
|
||||
|
||||
/obj/item/device/paicard/proc/alertUpdate()
|
||||
|
||||
@@ -431,19 +431,19 @@ pixel_x = 8;
|
||||
..(dest)
|
||||
|
||||
/obj/item/device/radio/intercom/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
if(!on)
|
||||
icon_state = initial(icon_state)
|
||||
set_light(FALSE)
|
||||
return
|
||||
else
|
||||
add_overlay(screen_overlays["intercom_screen"])
|
||||
add_overlay(screen_overlays["intercom_scanline"])
|
||||
AddOverlays(screen_overlays["intercom_screen"])
|
||||
AddOverlays(screen_overlays["intercom_scanline"])
|
||||
set_light(1.4, 1.3, COLOR_CYAN)
|
||||
if(broadcasting)
|
||||
add_overlay(screen_overlays["intercom_b"])
|
||||
AddOverlays(screen_overlays["intercom_b"])
|
||||
if(listening)
|
||||
add_overlay(screen_overlays["intercom_l"])
|
||||
AddOverlays(screen_overlays["intercom_l"])
|
||||
|
||||
/obj/item/device/radio/intercom/broadcasting/Initialize()
|
||||
SHOULD_CALL_PARENT(FALSE)
|
||||
|
||||
@@ -472,10 +472,10 @@ BREATH ANALYZER
|
||||
origin_tech = list(TECH_MAGNET = 4, TECH_BIO = 2)
|
||||
|
||||
/obj/item/device/mass_spectrometer/adv/clear_blood_overlay()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
|
||||
/obj/item/device/mass_spectrometer/adv/add_blood_overlay(var/image/I)
|
||||
add_overlay(I)
|
||||
AddOverlays(I)
|
||||
|
||||
/obj/item/device/reagent_scanner
|
||||
name = "reagent scanner"
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
if(!istype(I))
|
||||
qdel(src)
|
||||
return
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
var/mutable_appearance/MA = new(I)
|
||||
MA.plane = EFFECTS_ABOVE_LIGHTING_PLANE
|
||||
MA.appearance_flags = RESET_ALPHA
|
||||
@@ -202,6 +202,6 @@
|
||||
if(!istype(P))
|
||||
qdel(src)
|
||||
return
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
if(P.info)
|
||||
icon_state = "text[rand(1,3)]"
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/device/suit_cooling_unit/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
if(cover_open)
|
||||
if(cell)
|
||||
icon_state = "suitcooler1"
|
||||
@@ -202,7 +202,7 @@
|
||||
if(-INFINITY to 17)
|
||||
battery_level = 5
|
||||
|
||||
add_overlay("battery-[battery_level]")
|
||||
AddOverlays("battery-[battery_level]")
|
||||
item_state = "coolingpack[battery_level]"
|
||||
|
||||
if(ismob(loc))
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
toggle = 1
|
||||
|
||||
/obj/item/device/transfer_valve/update_icon()
|
||||
cut_overlays()
|
||||
ClearOverlays()
|
||||
underlays = null
|
||||
|
||||
if(!tank_one && !tank_two && !attached_device)
|
||||
@@ -126,13 +126,13 @@
|
||||
icon_state = "valve"
|
||||
|
||||
if(tank_one)
|
||||
add_overlay("[tank_one.icon_state]")
|
||||
AddOverlays("[tank_one.icon_state]")
|
||||
if(tank_two)
|
||||
var/icon/J = new(icon, icon_state = "[tank_two.icon_state]")
|
||||
J.Shift(WEST, 13)
|
||||
underlays += J
|
||||
if(attached_device)
|
||||
add_overlay("device")
|
||||
AddOverlays("device")
|
||||
|
||||
/obj/item/device/transfer_valve/proc/remove_tank(obj/item/tank/T, mob/user)
|
||||
if(tank_one == T)
|
||||
|
||||
Reference in New Issue
Block a user