Skip to content

Commit

Permalink
refactors / brsuhes up a lot of update_icon calls, fixes mineral wall…
Browse files Browse the repository at this point in the history
… icon updates, replaces mat scanners with meson scanners (#6963)
  • Loading branch information
silicons authored Jan 16, 2025
1 parent 639c0a3 commit 794d9aa
Show file tree
Hide file tree
Showing 161 changed files with 492 additions and 364 deletions.
11 changes: 5 additions & 6 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@
#include "code\game\atoms\atom-defense.dm"
#include "code\game\atoms\atom-examine.dm"
#include "code\game\atoms\atom-logging.dm"
#include "code\game\atoms\atom_vv.dm"
#include "code\game\atoms\atom-vv.dm"
#include "code\game\atoms\atoms_initializing_EXPENSIVE.dm"
#include "code\game\atoms\buckling.dm"
#include "code\game\atoms\defense_old.dm"
Expand Down Expand Up @@ -2480,10 +2480,10 @@
#include "code\modules\atmospherics\machinery\portable\powered.dm"
#include "code\modules\atmospherics\machinery\portable\pump.dm"
#include "code\modules\atmospherics\machinery\portable\scrubber.dm"
#include "code\modules\automata\__automata.dm"
#include "code\modules\automata\_wave.dm"
#include "code\modules\automata\explosion.dm"
#include "code\modules\automata\sonar.dm"
#include "code\modules\automata\automata.dm"
#include "code\modules\automata\types\explosion.dm"
#include "code\modules\automata\types\sonar.dm"
#include "code\modules\automata\types\wave.dm"
#include "code\modules\awaymissions\bluespaceartillery.dm"
#include "code\modules\awaymissions\corpse.dm"
#include "code\modules\awaymissions\exile.dm"
Expand Down Expand Up @@ -3567,7 +3567,6 @@
#include "code\modules\mining\drilling\drill.dm"
#include "code\modules\mining\drilling\scanner.dm"
#include "code\modules\mining\excavation\mine_outcrops.dm"
#include "code\modules\mining\excavation\mineral_effect.dm"
#include "code\modules\mining\machinery\machine_input_output_plates.dm"
#include "code\modules\mining\machinery\machine_processing.dm"
#include "code\modules\mining\machinery\machine_stacking.dm"
Expand Down
1 change: 0 additions & 1 deletion code/__DEFINES/icon_smoothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ DEFINE_BITFIELD(smoothing_flags, list(
#define QUEUE_SMOOTH(thing_to_queue) if(IS_SMOOTH(thing_to_queue)) {SSicon_smooth.add_to_queue(thing_to_queue)}
#define QUEUE_SMOOTH_NEIGHBORS(thing_to_queue) for(var/neighbor in orange(1, thing_to_queue)) {var/atom/atom_neighbor = neighbor; QUEUE_SMOOTH(atom_neighbor)}


//! Smoothing Internals

#define NORTH_JUNCTION (1<<0) // NORTH
Expand Down
6 changes: 6 additions & 0 deletions code/controllers/subsystem/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ SUBSYSTEM_DEF(lighting)
while (lq_idex <= curr_lights.len)
var/datum/light_source/L = curr_lights[lq_idex++]

// citadel edit: light source can be deleted before update, if that happens, skip
// check QDELING, light sources are LETMELIVE so shouldn't be being
// harddel'd
if(QDELING(L))
continue

if (L.needs_update != LIGHTING_NO_UPDATE)
total_ss_updates += 1
L.update_corners()
Expand Down
7 changes: 6 additions & 1 deletion code/game/atoms/appearance.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// todo: rethink everything about how to do signals for these.
// todo: rethink everything about how to do signals for these, and general proc hierarchy
// * update icon overrides are getting silly
// * update flag is also kinda weird; most of the time you can't predict how things will react to not updating states / overlays together
// * should name/desc really be their own proc??
// * signals being able to block these things are also silly in most contexts, as a signal listener shouldn't have to know about
// the implementation details of the sender?

/**
* Updates the appearence of the icon
Expand Down
8 changes: 8 additions & 0 deletions code/game/atoms/atom_vv.dm → code/game/atoms/atom-vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,11 @@
else
return debug_variable(NAMEOF(src, base_layer), base_layer, 0, src)
return ..()

/**
* VV wrapper, do not use.
*/
/atom/proc/vv_queue_smooth()
PRIVATE_PROC(TRUE)
QUEUE_SMOOTH(src)
QUEUE_SMOOTH_NEIGHBORS(src)
1 change: 1 addition & 0 deletions code/game/click/telekinesis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,6 @@ var/const/tk_maxrange = 15

/obj/item/tk_grab/update_icon()
cut_overlays()
. = ..()
if(focus && focus.icon && focus.icon_state)
add_overlay(image(focus.icon,focus.icon_state))
1 change: 1 addition & 0 deletions code/game/gamemodes/technomancer/spells/illusion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
// Makes a tiny overlay of the thing the player has copied, so they can easily tell what they currently have.
/obj/item/spell/illusion/update_icon()
cut_overlays()
. = ..()
if(copied)
var/image/temp_image = image(copied)
var/matrix/M = matrix()
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@
else
toggle_pump()

/obj/machinery/sleeper/update_icon()
/obj/machinery/sleeper/update_icon_state()
icon_state = "sleeper_[occupant ? TRUE : FALSE]"
return ..()

/obj/machinery/sleeper/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/grab))
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/adv_med.dm
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@
return incoming

/obj/machinery/bodyscanner/update_icon()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
icon_state = "scanner_off"
set_light(0)
Expand Down Expand Up @@ -657,6 +658,7 @@
console.update_icon(h_ratio)

/obj/machinery/body_scanconsole/update_icon(var/h_ratio)
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
icon_state = "scanner_terminal_off"
set_light(0)
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/ai_slipper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
..()
update_icon()

/obj/machinery/ai_slipper/update_icon()
/obj/machinery/ai_slipper/update_icon_state()
if(machine_stat & (NOPOWER|BROKEN))
icon_state = "motion0"
else
icon_state = disabled ? "motion0" : "motion3"
return ..()

/obj/machinery/ai_slipper/proc/setState(var/enabled, var/uses)
disabled = disabled
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/atm_ret_field.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
. = ..()
generate_field()

/obj/machinery/atmospheric_field_generator/update_icon()
/obj/machinery/atmospheric_field_generator/update_icon_state()
if(machine_stat & BROKEN)
icon_state = "arfg_broken"
else if(hatch_open && wires_intact)
Expand All @@ -94,6 +94,7 @@
icon_state = "arfg_on"
else
icon_state = "arfg_off"
return ..()

/obj/machinery/atmospheric_field_generator/power_change()
var/oldstat
Expand Down Expand Up @@ -192,6 +193,7 @@

/obj/structure/atmospheric_retention_field/update_icon()
cut_overlays()
. = ..()
var/list/dirs = list()
for(var/obj/structure/atmospheric_retention_field/F in orange(src,1))
dirs += get_dir(src, F)
Expand All @@ -203,8 +205,6 @@
var/image/I = image(icon, "[basestate][connections[i]]", dir = 1<<(i-1))
add_overlay(I)

return

/obj/structure/atmospheric_retention_field/Initialize(mapload)
. = ..()
update_nearby_tiles() //Force ZAS update
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/atmo_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

var/datum/radio_frequency/radio_connection

/obj/machinery/air_sensor/update_icon()
/obj/machinery/air_sensor/update_icon_state()
icon_state = "gsensor[on]"
return ..()

/obj/machinery/air_sensor/process(delta_time)
if(on)
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/biogenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@

/obj/machinery/biogenerator/update_icon()
cut_overlays()
. = ..()
if(beaker)
add_overlay("[base_icon_state]-standby")
if(processing)
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/bomb_tester.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

/obj/machinery/bomb_tester/update_icon()
cut_overlays()
. = ..()
var/list/overlays_to_add = list()
if(tank1)
overlays_to_add += image(icon, "[icon_name]-tank1")
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,14 @@ CREATE_WALL_MOUNTING_TYPES(/obj/machinery/camera)
if(isXRay())
P.SetSight(SEE_TURFS | SEE_MOBS | SEE_OBJS)

/obj/machinery/camera/update_icon()
/obj/machinery/camera/update_icon_state()
if (!status || (machine_stat & BROKEN))
icon_state = "[initial(icon_state)]1"
else if (machine_stat & EMPED)
icon_state = "[initial(icon_state)]emp"
else
icon_state = initial(icon_state)
return ..()

/obj/machinery/camera/proc/triggerCameraAlarm(duration = 0)
alarm_on = 1
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/camera/camera_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@

..()

/obj/item/camera_assembly/update_icon()
/obj/item/camera_assembly/update_icon_state()
if(anchored)
icon_state = "camera1"
else
icon_state = "cameracase"
return ..()

/obj/item/camera_assembly/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!anchored)
Expand Down
14 changes: 3 additions & 11 deletions code/game/machinery/cell_charger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@
circuit = /obj/item/circuitboard/cell_charger

/obj/machinery/cell_charger/update_icon()
cut_overlays()
icon_state = "ccharger[charging ? 1 : 0]"
. = ..()

if(charging && !(machine_stat & (BROKEN|NOPOWER)))

var/newlevel = round(charging.percent() * 4.0 / 99)
//to_chat(world, "nl: [newlevel]")

if(chargelevel != newlevel)

cut_overlays()
add_overlay("ccharger-o[newlevel]")

chargelevel = newlevel
else
cut_overlays()
add_overlay("ccharger-o[newlevel]")

/obj/machinery/cell_charger/examine(mob/user, dist)
. = ..()
Expand Down
13 changes: 7 additions & 6 deletions code/game/machinery/computer/aifixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,19 @@
if(oldstat != occupier.stat)
update_icon()

/obj/machinery/computer/aifixer/update_icon()
. = ..()
/obj/machinery/computer/aifixer/make_legacy_overlays()
var/list/to_add_overlays = list()
if(machine_stat & (NOPOWER|BROKEN))
return

if(restoring)
. += "ai-fixer-on"
to_add_overlays += "ai-fixer-on"
if (occupier)
switch (occupier.stat)
if (CONSCIOUS)
. += "ai-fixer-full"
to_add_overlays += "ai-fixer-full"
if (UNCONSCIOUS)
. += "ai-fixer-404"
to_add_overlays += "ai-fixer-404"
else
. += "ai-fixer-empty"
to_add_overlays += "ai-fixer-empty"
add_overlay(to_add_overlays)
32 changes: 20 additions & 12 deletions code/game/machinery/computer/computer.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Base /computer machinery type.
*
* Has the following responsibilities:
* * Smoothly connect to adjacent computers visually as needed.
* * Have default construction/deconstruction steps for computer instead of default for machine
* * Render screen overlay and a standard light source + emissive
*/
/obj/machinery/computer
name = "computer"
icon = 'icons/obj/computer.dmi'
Expand Down Expand Up @@ -39,8 +47,11 @@

/obj/machinery/computer/update_icon()
cut_overlays()
. = ..()
make_legacy_overlays()

. = list()
/obj/machinery/computer/proc/make_legacy_overlays()
var/list/to_add_overlays = list()

// Connecty //TODO: Use TG Smoothing.
if(initial(icon_state) == "computer")
Expand All @@ -59,27 +70,29 @@

if(icon_keyboard)
if(machine_stat & NOPOWER)
playsound(src, 'sound/machines/terminal_off.ogg', 50, 1)
return add_overlay("[icon_keyboard]_off")
. += icon_keyboard
to_add_overlays += "[icon_keyboard]_off"
else
to_add_overlays += icon_keyboard

// This whole block lets screens ignore lighting and be visible even in the darkest room
var/overlay_state = icon_screen
if(machine_stat & BROKEN)
overlay_state = "[icon_state]_broken"
. += overlay_state
else if(!(machine_stat & NOPOWER))
to_add_overlays += overlay_state
//. += emissive_appearance(icon, overlay_state)
playsound(src, 'sound/machines/terminal_on.ogg', 50, 1)

add_overlay(.)
add_overlay(to_add_overlays)

/obj/machinery/computer/power_change()
..()
update_icon()
if(machine_stat & NOPOWER)
set_light(0)
playsound(src, 'sound/machines/terminal_off.ogg', 50, 1)
else
set_light(light_range_on, light_power_on)
playsound(src, 'sound/machines/terminal_on.ogg', 50, 1)

/obj/machinery/computer/drop_products(method, atom/where)
. = ..()
Expand All @@ -95,11 +108,6 @@
machine_stat |= BROKEN
update_icon()

/obj/machinery/computer/proc/decode(text)
// Adds line breaks
text = replacetext(text, "\n", "<BR>")
return text

/obj/machinery/computer/attackby(obj/item/I, mob/living/user, params, clickchain_flags, damage_multiplier)
if(computer_deconstruction_screwdriver(user, I))
return
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/computer/timeclock_vr.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
card = null
. = ..()

/obj/machinery/computer/timeclock/update_icon()
/obj/machinery/computer/timeclock/update_icon_state()
if(inoperable())
icon_state = "[initial(icon_state)]_off"
else if(card)
icon_state = "[initial(icon_state)]_card"
else
icon_state = "[initial(icon_state)]"
return ..()

/obj/machinery/computer/timeclock/power_change()
var/old_stat = machine_stat
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/cryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
put_mob(target)

/obj/machinery/atmospherics/component/unary/cryo_cell/update_icon()
. = ..()
cut_overlay(fluid)
fluid.color = null
fluid.alpha = max(255 - air_contents.temperature, 50)
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@

/obj/machinery/cryopod/robot/door/gateway/update_icon()
cut_overlays()
. = ..()
if(occupant)
var/image/I = image(icon, src, "[base_icon_state]_active_overlay")
I.plane = ABOVE_LIGHTING_PLANE
Expand Down
Loading

0 comments on commit 794d9aa

Please sign in to comment.