Merge pull request #15486 from SandPoot/kills-cache

Solves issues with overlays by updating the whole subsystem
This commit is contained in:
deathride58
2024-04-12 23:31:54 -04:00
committed by GitHub
36 changed files with 280 additions and 214 deletions
+15 -10
View File
@@ -43,18 +43,23 @@
/obj/machinery/computer/update_overlays()
. = ..()
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
if(stat & NOPOWER)
. += "[icon_keyboard]_off"
return
. += icon_keyboard
if(icon_keyboard)
if(stat & NOPOWER)
. += "[icon_keyboard]_off"
else
. += icon_keyboard
// This whole block lets screens ignore lighting and be visible even in the darkest room
// We can't do this for many things that emit light unfortunately because it layers over things that would be on top of it
var/overlay_state = icon_screen
if(stat & BROKEN)
overlay_state = "[icon_state]_broken"
. += mutable_appearance(icon, overlay_state)
. += emissive_appearance(icon, overlay_state)
. += mutable_appearance(icon, "[icon_state]_broken")
return // If we don't do this broken computers glow in the dark.
if(stat & NOPOWER) // Your screen can't be on if you've got no damn charge
return
// This lets screens ignore lighting and be visible even in the darkest room
if(icon_screen)
. += mutable_appearance(icon, icon_screen)
. += emissive_appearance(icon, icon_screen)
/obj/machinery/computer/power_change()
..()
+1 -1
View File
@@ -69,7 +69,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
name = "random arcade"
desc = "random arcade machine"
icon_state = "arcade"
icon_keyboard = "no_keyboard"
icon_keyboard = null
icon_screen = "invaders"
light_color = LIGHT_COLOR_GREEN
var/list/prize_override
+2 -1
View File
@@ -209,7 +209,7 @@
name = "security camera monitor"
desc = "An old TV hooked into the station's camera network."
icon_state = "television"
icon_keyboard = "no_keyboard"
icon_keyboard = null
icon_screen = "detective_tv"
pass_flags = PASSTABLE
@@ -252,6 +252,7 @@
desc = "Used for watching an empty arena."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "telescreen"
icon_keyboard = null
layer = SIGN_LAYER
network = list("thunder")
density = FALSE
+2 -2
View File
@@ -138,13 +138,13 @@
name = "\improper DoorMex control console"
icon_state = "oldcomp"
icon_screen = "library"
icon_keyboard = "no_keyboard"
icon_keyboard = null
// /obj/machinery/computer/pod/old/mass_driver_controller
// name = "\improper Mass Driver Controller"
// icon = 'icons/obj/airlock_machines.dmi'
// icon_state = "airlock_control_standby"
// icon_keyboard = "no_keyboard"
// icon_keyboard = null
// density = FALSE
// /obj/machinery/computer/pod/old/mass_driver_controller/toxinsdriver
+1
View File
@@ -19,6 +19,7 @@
desc = "Gambling for the antisocial."
icon = 'icons/obj/economy.dmi'
icon_state = "slots1"
icon_keyboard = null
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 50
+3 -2
View File
@@ -558,8 +558,9 @@ RLD
. = ..()
if(has_ammobar)
var/ratio = CEILING((matter / max_matter) * ammo_sections, 1)
cut_overlays() //To prevent infinite stacking of overlays
add_overlay("[icon_state]_charge[ratio]")
if(ratio)
cut_overlays() //To prevent infinite stacking of overlays
add_overlay("[icon_state]_charge[ratio]")
/obj/item/construction/rcd/Initialize(mapload)
. = ..()
+47 -17
View File
@@ -19,6 +19,8 @@
var/on = FALSE //if the paddles are equipped (1) or on the defib (0)
var/safety = TRUE //if you can zap people with the defibs on harm mode
var/powered = FALSE //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
/// If the cell can be removed via screwdriver
var/cell_removable = TRUE
var/obj/item/shockpaddles/paddles
var/obj/item/stock_parts/cell/cell
var/combat = FALSE //if true, revive through hardsuits, allow for combat shocking, and tint paddles syndicate colors
@@ -29,6 +31,16 @@
var/timedeath = 10
var/disarm_shock_time = 10
var/always_emagged = FALSE
/// The icon state for the paddle overlay, not applied if null
var/paddle_state = "defibunit-paddles"
/// The icon state for the powered on overlay, not applied if null
var/powered_state = "defibunit-powered"
/// The icon state for the charge bar overlay, not applied if null
var/charge_state = "defibunit-charge"
/// The icon state for the missing cell overlay, not applied if null
var/nocell_state = "defibunit-nocell"
/// The icon state for the emagged overlay, not applied if null
var/emagged_state = "defibunit-emagged"
/obj/item/defibrillator/get_cell()
return cell
@@ -56,18 +68,19 @@
/obj/item/defibrillator/update_overlays()
. = ..()
if(!on)
. += "[initial(icon_state)]-paddles"
if(powered)
. += "[initial(icon_state)]-powered"
if(!QDELETED(cell))
if(!on && paddle_state)
. += paddle_state
if(powered && powered_state)
. += powered_state
if(!QDELETED(cell) && charge_state)
var/ratio = cell.charge / cell.maxcharge
ratio = CEILING(ratio*4, 1) * 25
add_overlay("[initial(icon_state)]-charge[ratio]")
if(!cell)
. += "[initial(icon_state)]-nocell"
if(!safety)
. += "[initial(icon_state)]-emagged"
. += "[charge_state][ratio]"
if(!cell && nocell_state)
. += "[nocell_state]"
if(!safety && emagged_state)
. += emagged_state
/obj/item/defibrillator/CheckParts(list/parts_list)
..()
@@ -103,6 +116,18 @@
var/atom/movable/screen/inventory/hand/H = over_object
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
/obj/item/defibrillator/screwdriver_act(mob/living/user, obj/item/tool)
if(!cell || !cell_removable)
return FALSE
cell.update_appearance()
cell.forceMove(get_turf(src))
balloon_alert(user, "removed [cell]")
cell = null
tool.play_tool_sound(src, 50)
update_power()
return TRUE
/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
if(W == paddles)
toggle_paddles()
@@ -120,13 +145,6 @@
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_power()
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(cell)
cell.update_icon()
cell.forceMove(get_turf(src))
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_power()
else
return ..()
@@ -236,6 +254,11 @@
item_state = "defibcompact"
w_class = WEIGHT_CLASS_NORMAL
slot_flags = ITEM_SLOT_BELT
paddle_state = "defibcompact-paddles"
powered_state = "defibcompact-powered"
charge_state = "defibcompact-charge"
nocell_state = "defibcompact-nocell"
emagged_state = "defibcompact-emagged"
/obj/item/defibrillator/compact/item_action_slot_check(slot, mob/user, datum/action/A)
if(slot == user.getBeltSlot())
@@ -254,6 +277,13 @@
always_emagged = TRUE
disarm_shock_time = 0
cell = /obj/item/stock_parts/cell/infinite
paddles = /obj/item/shockpaddles/syndicate
paddle_state = "defibcombat-paddles"
powered_state = null
emagged_state = null
/obj/item/defibrillator/compact/combat/loaded
cell_removable = FALSE // Don't let people just have an infinite power cell
/obj/item/defibrillator/compact/combat/loaded/attackby(obj/item/W, mob/user, params)
if(W == paddles)
+1
View File
@@ -639,6 +639,7 @@
icon = 'icons/obj/cigarettes.dmi'
icon_state = "matchbox"
item_state = "zippo"
illustration = null
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
custom_price = PRICE_REALLY_CHEAP
@@ -76,7 +76,8 @@
. += "[icon_door_override ? icon_door : icon_state]_open"
return
. += "[icon_door || icon_state]_door"
if(icon_door)
. += "[icon_door || icon_state]_door"
if(welded)
. += icon_welded
@@ -3,6 +3,7 @@
name = "large cardboard box"
desc = "Just a box..."
icon_state = "cardboard"
icon_door = null
mob_storage_capacity = 1
resistance_flags = FLAMMABLE
max_integrity = 70