mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 15:01:04 +01:00
Rework of wall damage visuals (#21032)
# Summary Wall damage visuals had two issue for a longer time. The first issue is that applied visual damage was permanent and non-revertable, additionally it was too overwhelming. The second issue was that the wall damage inspect descriptions ignored the added health of reinforcing materials, as a result, all wall types received the same damage descriptions even though their actual health was different. ## Changes This PR fixes both issues by fixing the stacking of damage overlays, refactoring the alpha calculation of said overlays, adding additional inspect-descriptions and lastly by adding the additional strength of walls to their inspect calculation. ## Additional notes Thanks to @Batrachophreno for assisting and suggesting to refactor visual damage layers calculation.
This commit is contained in:
@@ -103,6 +103,9 @@
|
||||
damage_image = damage_overlays[overlay]
|
||||
overlays_to_add += damage_image
|
||||
|
||||
// Remove the existing damage overlay entirely and replace it with the newly-calculated one.
|
||||
CutOverlays(damage_overlays)
|
||||
|
||||
AddOverlays(overlays_to_add)
|
||||
UNSETEMPTY(reinforcement_images)
|
||||
QUEUE_SMOOTH(src)
|
||||
@@ -110,10 +113,11 @@
|
||||
get_underlays(cached_adjacency)
|
||||
|
||||
/turf/simulated/wall/proc/generate_overlays()
|
||||
var/alpha_inc = 256 / damage_overlays.len
|
||||
for(var/damage_level = 1; damage_level <= damage_overlays.len; damage_level++) // Generate damage overlay for each placeholder (16 in array)
|
||||
var/image/damage_overlay = image(icon = 'icons/turf/walls.dmi', icon_state = "overlay_damage")
|
||||
damage_overlay.blend_mode = BLEND_MULTIPLY
|
||||
|
||||
for(var/i = 1; i <= damage_overlays.len; i++)
|
||||
var/image/img = image(icon = 'icons/turf/walls.dmi', icon_state = "overlay_damage")
|
||||
img.blend_mode = BLEND_MULTIPLY
|
||||
img.alpha = (i * alpha_inc) - 1
|
||||
damage_overlays[i] = img
|
||||
// The actual difference in each damage overlay is represented with a different alpha value, higher alpha = higher visible damage
|
||||
damage_overlay.alpha = damage_level * 18 + 32; // Linear scale with inital offset
|
||||
|
||||
damage_overlays[damage_level] = damage_overlay
|
||||
|
||||
@@ -54,13 +54,23 @@
|
||||
if(!damage)
|
||||
. += SPAN_NOTICE("It looks fully intact.")
|
||||
else
|
||||
var/dam = damage / material.integrity
|
||||
if(dam <= 0.3)
|
||||
. += SPAN_WARNING("It looks slightly damaged.")
|
||||
else if(dam <= 0.6)
|
||||
// Total damage is based of base material integrity and optionally, if reinforced, reinforcement material integrity on top
|
||||
var/integrity = material.integrity
|
||||
if(reinf_material)
|
||||
integrity += reinf_material.integrity
|
||||
|
||||
var/relative_damage = damage / integrity
|
||||
|
||||
if(relative_damage <= 0.25)
|
||||
. += SPAN_NOTICE("It looks slightly damaged.")
|
||||
else if(relative_damage <= 0.5)
|
||||
. += SPAN_WARNING("It looks damaged.")
|
||||
else if(relative_damage <= 0.75)
|
||||
. += SPAN_WARNING("It looks moderately damaged.")
|
||||
else
|
||||
else if(relative_damage <= 0.9)
|
||||
. += SPAN_DANGER("It looks heavily damaged.")
|
||||
else
|
||||
. += SPAN_DANGER("It looks critically damaged and on the verge of structural collapse.")
|
||||
|
||||
/turf/simulated/wall/mechanics_hints(mob/user, distance, is_adjacent)
|
||||
. += ..()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
author: FabianK3
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- bugfix: "Fixed permanently stuck wall damage overlays. Walls now properly display the correct damage visually according to their state and the damaged look vanishes when they get repaired."
|
||||
- rscadd: "Added new informative descriptions when inspecting damaged walls to get a better feeling for their state."
|
||||
- bugfix: "Fixed wall damage descriptions ignoring added strength of reinforced materials. Reinforced wall descriptions will now show damage later as their additional health is considered properly."
|
||||
- balance: "Changed levels of visual damage to walls to scale more linear. Thanks to Batrachophrenoboocosmomachia."
|
||||
Reference in New Issue
Block a user