Skip to content

Commit

Permalink
fix(assorted): fixes Doorsciglass again, fixes broken doors overlays,…
Browse files Browse the repository at this point in the history
… caches a fuckton of stuff

PR #11059
  • Loading branch information
TobyThorne authored Nov 26, 2023
1 parent c624532 commit 98fb79e
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 45 deletions.
13 changes: 6 additions & 7 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -259,26 +259,25 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/on_update_icon(keep_light = 0)
if(!keep_light)
set_light(0)
overlays?.Cut()
ClearOverlays()
if(density)
if(locked && lights && arePowerSystemsOn())
icon_state = "door_locked"
set_light(0.35, 0.9, 1.5, 3, COLOR_RED_LIGHT)
else
icon_state = "door_closed"
if(p_open || welded)
ClearOverlays()
if(p_open)
AddOverlays(image(icon, "panel_open"))
AddOverlays(OVERLAY(icon, "panel_open"))
if(!(stat & NOPOWER))
if(stat & BROKEN)
AddOverlays(image(icon, "sparks_broken"))
AddOverlays(OVERLAY(icon, "sparks_broken"))
else if(health < maxhealth * 0.75)
AddOverlays(image(icon, "sparks_damaged"))
AddOverlays(OVERLAY(icon, "sparks_damaged"))
if(welded)
AddOverlays(image(icon, "welded"))
AddOverlays(OVERLAY(icon, "welded"))
else if(health < maxhealth * 0.75 && !(stat & NOPOWER))
AddOverlays(image(icon, "sparks_damaged"))
AddOverlays(OVERLAY(icon, "sparks_damaged"))
else
icon_state = "door_open"
if(arePowerSystemsOn() && !p_open) // Doors with opened panels have no green lights on their icons
Expand Down
20 changes: 10 additions & 10 deletions code/game/objects/structures/window_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@
layer = WINDOW_FRAME_LAYER

if(frame_state == FRAME_ELECTRIC || frame_state == FRAME_RELECTRIC)
var/image/I = image(icon, "[icon_base]_cable")
var/image/I = OVERLAY(icon, "[icon_base]_cable")
I.color = cable_color
AddOverlays(I)

if(signaler)
AddOverlays(image(icon, "winframe_signaler"))
AddOverlays(OVERLAY(icon, "winframe_signaler"))

if(inner_pane)
var/list/dirs = list()
Expand All @@ -366,18 +366,18 @@
var/list/connections = dirs_to_corner_states(dirs)

for(var/i = 1 to 4)
var/image/I = image(icon, "[inner_pane.icon_base][connections[i]]", dir = 1<<(i-1))
var/image/I = OVERLAY(icon, "[inner_pane.icon_base][connections[i]]", dir = 1<<(i-1))
I.layer = WINDOW_INNER_LAYER
AddOverlays(I)

if(inner_pane.tinted)
new_opacity = TRUE
var/image/I = image(icon, "winframe_tint")
var/image/I = OVERLAY(icon, "winframe_tint")
I.layer = WINDOW_INNER_LAYER
AddOverlays(I)

if(inner_pane.damage_state)
var/image/I = image(icon, "winframe_damage[inner_pane.damage_state]")
var/image/I = OVERLAY(icon, "winframe_damage[inner_pane.damage_state]")
I.layer = WINDOW_INNER_LAYER
AddOverlays(I)

Expand All @@ -386,7 +386,7 @@

if(outer_pane)
if(outer_pane.reinforced)
underlays += image(icon, "winframe_shadow")
underlays += OVERLAY(icon, "winframe_shadow")

var/list/dirs = list()
if(outer_pane.state >= 2)
Expand All @@ -397,18 +397,18 @@
var/list/connections = dirs_to_corner_states(dirs)

for(var/i = 1 to 4)
var/image/I = image(icon, "[outer_pane.icon_base][connections[i]]", dir = 1<<(i-1))
var/image/I = OVERLAY(icon, "[outer_pane.icon_base][connections[i]]", dir = 1<<(i-1))
I.layer = WINDOW_OUTER_LAYER
AddOverlays(I)

if(outer_pane.tinted)
new_opacity = TRUE
var/image/I = image(icon, "winframe_tint")
var/image/I = OVERLAY(icon, "winframe_tint")
I.layer = WINDOW_OUTER_LAYER
AddOverlays(I)

if(outer_pane.damage_state)
var/image/I = image(icon, "winframe_damage[outer_pane.damage_state]")
var/image/I = OVERLAY(icon, "winframe_damage[outer_pane.damage_state]")
I.layer = WINDOW_OUTER_LAYER
AddOverlays(I)

Expand All @@ -424,7 +424,7 @@
var/list/connections = dirs_to_corner_states(dirs)

for(var/i = 1 to 4)
var/image/I = image(icon, "[icon_border][connections[i]]", dir = 1<<(i-1))
var/image/I = OVERLAY(icon, "[icon_border][connections[i]]", dir = 1<<(i-1))
I.layer = WINDOW_BORDER_LAYER
AddOverlays(I)

Expand Down
16 changes: 9 additions & 7 deletions code/game/turfs/simulated/wall_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,32 @@
var/image/I

if(!density)
I = image(masks_icon, "[material.icon_base]fwall_open")
I = OVERLAY(masks_icon, "[material.icon_base]fwall_open")
I.color = material.icon_colour
AddOverlays(I)
return

for(var/i = 1 to 4)
I = image(masks_icon, "[material.icon_base][wall_connections[i]]", dir = 1<<(i-1))
I = OVERLAY(masks_icon, "[material.icon_base][wall_connections[i]]", dir = 1<<(i-1))
I.color = material.icon_colour
AddOverlays(I)

if(reinf_material)
if(construction_stage != null && construction_stage < 6)
I = image(masks_icon, "reinf_construct-[construction_stage]")
I = OVERLAY(masks_icon, "reinf_construct-[construction_stage]")
I.color = reinf_material.icon_colour
AddOverlays(I)
else
if("[reinf_material.icon_reinf]0" in icon_states(masks_icon))
if(!mask_overlay_states[masks_icon]) // Lets just cache them instead of calling icon_states() every damn time.
mask_overlay_states[masks_icon] = icon_states(masks_icon)
if("[reinf_material.icon_reinf]0" in mask_overlay_states[masks_icon])
// Directional icon
for(var/i = 1 to 4)
I = image(masks_icon, "[reinf_material.icon_reinf][wall_connections[i]]", dir = 1<<(i-1))
I = OVERLAY(masks_icon, "[reinf_material.icon_reinf][wall_connections[i]]", dir = 1<<(i-1))
I.color = reinf_material.icon_colour
AddOverlays(I)
else
I = image(masks_icon, reinf_material.icon_reinf)
I = OVERLAY(masks_icon, reinf_material.icon_reinf)
I.color = reinf_material.icon_colour
AddOverlays(I)

Expand All @@ -88,7 +90,7 @@
var/alpha_inc = 256 / damage_overlays.len

for(var/i = 1; i <= damage_overlays.len; i++)
var/image/img = image(icon = 'icons/turf/walls.dmi', icon_state = "overlay_damage")
var/image/img = image('icons/turf/walls.dmi', "overlay_damage") // Don't use OVERLAY here, we don't need all this garbage in the global cache
img.blend_mode = BLEND_MULTIPLY
img.alpha = (i * alpha_inc) - 1
damage_overlays[i] = img
Expand Down
1 change: 1 addition & 0 deletions code/game/turfs/simulated/walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
var/list/wall_connections = list("0", "0", "0", "0")
var/floor_type = /turf/simulated/floor/plating //turf it leaves after destruction
var/masks_icon = 'icons/turf/wall_masks.dmi'
var/static/list/mask_overlay_states = list()

/turf/simulated/wall/New(newloc, materialtype, rmaterialtype)
..(newloc)
Expand Down
5 changes: 3 additions & 2 deletions code/modules/integrated_electronics/core/assemblies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,15 @@
to_chat(user, SPAN_WARNING("You can't seem to add the '[IC]', since the case doesn't support the circuit type."))
return FALSE

if(!IC.forceMove(src))
if(IC.loc == user && !user.drop(IC, src))
return FALSE
else if(!IC.forceMove(src))
return FALSE

to_chat(user, SPAN_NOTICE("You slide [IC] inside [src]."))
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
add_allowed_scanner(user.ckey)
investigate_log("had [IC]([IC.type]) inserted by [key_name(user)].", INVESTIGATE_CIRCUIT)
user.drop(IC)
add_component(IC)
IC.create_moved_event()
return TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@
var/image/eye_overlay = eye_overlays[eye_icon_state]
if(!eye_overlay)
eye_overlays[eye_icon_state] = image(icon, eye_icon_state)
eye_overlays["[eye_icon_state]+ea"] = emissive_appearance(icon, eye_icon_state)
eye_overlays["[eye_icon_state]+ea"] = emissive_appearance(icon, eye_icon_state, cache = FALSE)
AddOverlays(eye_overlay)
AddOverlays("[eye_icon_state]+ea")

Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/simple_animal/hostile/mimic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ var/global/list/protected_objects = list(
if(istype(copy_of, /obj/structure/bed))
copy_of.set_dir(dir)
copy_of.update_icon()
copy_of.ImmediateOverlayUpdate()
appearance = copy_of

/mob/living/simple_animal/hostile/mimic/proc/_update_inactive_time()
Expand Down Expand Up @@ -485,6 +486,7 @@ var/global/list/protected_objects = list(

C.opened = state
C.update_icon()
C.ImmediateOverlayUpdate()
appearance = C

/mob/living/simple_animal/hostile/mimic/proc/_activate_trap(mob/victim)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/internal/lungs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
//exposure to extreme pressures can rupture lungs
if(breath_pressure < species.hazard_low_pressure || breath_pressure > species.hazard_high_pressure)
var/datum/gas_mixture/environment = loc.return_air_for_internal_lifeform()
var/env_pressure = envienvironment? environment.return_pressure() : 0
var/env_pressure = environment? environment.return_pressure() : 0
var/lung_damage_prob = BP_IS_ROBOTIC(src) ? prob(2.5) : prob(5) //Robotic lungs are less likely to rupture.
if(env_pressure < species.hazard_low_pressure || env_pressure > species.hazard_high_pressure)
if(lung_damage_prob)
Expand Down
17 changes: 9 additions & 8 deletions code/modules/tables/tables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,28 +329,29 @@

// Base frame shape. Mostly done for glass/diamond tables, where this is visible.
for(var/i = 1 to 4)
I = image(icon, dir = 1<<(i-1), icon_state = connections[i])
I = OVERLAY(icon, connections[i], dir = 1<<(i-1))
AddOverlays(I)

// Standard table image
if(material)
for(var/i = 1 to 4)
I = image(icon, "[material.table_icon_base]_[connections[i]]", dir = 1<<(i-1))
if(material.icon_colour) I.color = material.icon_colour
I = OVERLAY(icon, "[material.table_icon_base]_[connections[i]]", dir = 1<<(i-1))
if(material.icon_colour)
I.color = material.icon_colour
I.alpha = 255 * material.opacity
AddOverlays(I)

// Reinforcements
if(reinforced)
for(var/i = 1 to 4)
I = image(icon, "[reinforced.table_reinf]_[connections[i]]", dir = 1<<(i-1))
I = OVERLAY(icon, "[reinforced.table_reinf]_[connections[i]]", dir = 1<<(i-1))
I.color = reinforced.icon_colour
I.alpha = 255 * reinforced.opacity
AddOverlays(I)

if(carpeted)
for(var/i = 1 to 4)
I = image(icon, "carpet_[connections[i]]", dir = 1<<(i-1))
I = OVERLAY(icon, "carpet_[connections[i]]", dir = 1<<(i-1))
AddOverlays(I)
else
ClearOverlays()
Expand All @@ -371,7 +372,7 @@

icon_state = "flip[type]"
if(material)
var/image/I = image(icon, "[material.table_icon_base]_flip[type]")
var/image/I = OVERLAY(icon, "[material.table_icon_base]_flip[type]")
I.color = material.icon_colour
I.alpha = 255 * material.opacity
AddOverlays(I)
Expand All @@ -380,13 +381,13 @@
name = "table frame"

if(reinforced)
var/image/I = image(icon, "[reinforced.table_reinf]_flip[type]")
var/image/I = OVERLAY(icon, "[reinforced.table_reinf]_flip[type]")
I.color = reinforced.icon_colour
I.alpha = 255 * reinforced.opacity
AddOverlays(I)

if(carpeted)
AddOverlays("carpet_flip[type]")
AddOverlays(OVERLAY(icon, "carpet_flip[type]"))

/obj/structure/table/proc/can_connect()
return TRUE
Expand Down
Loading

0 comments on commit 98fb79e

Please sign in to comment.