mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-07-20 19:42:34 +01:00
741e02407a
* Added "Display Initialize() Log" admin debug command so you can see it mid-round. * Ported the core of the overlays management subsystem from /tg - Added SSoverlays subsystem for compiling overlay lists and applying them to atoms in a controlled anti-lag subsystem. - Added vars and procs to atom which should eventually replace all direct interaction with BYOND's /atom/overlays var outside the subsystem. - Added OVERLAY_QUEUED flag to var/atom/flags bitfield. - Added small framework for subsystem performance tracking. So far used only by SSoverlays - Added admin debug command "Display overlay Log" to see performance stats mid-round. * Fix runtime on universal pipe adaptor update_icons * Workaround for appearance_bro not initialized Unfortuantely BYOND's initialization order is strange, and the appearance_bro var is only half initialized when map starts to load, causing errors. We temporarily fix by moving it to be a global-scoped global. * Convert fire alarms to use add_overlay() A good first test. * Convert turfs to use add_overlays(), eliminating the turf_overlay_holder! - Converted as much as I could find about turf overlays to use add_overlay(). - This should be enough to stop BYOND from crashing, so we can eliminate the turf_overlay_holder hack. - This also lets us remove the anti-corruption hacks from walls and open space. - ZAS gas overlays can use priority overlays, so this also fixes the gas-goes-away-when-crowbarring-plating issue. - Stuff like that * Convert turf overlay interactions to use add_overlay. Note: This is a plain and simple conversion of existing code to use SSoverlays. However I look at the line changed, and note that that line likely never fully worked as intended, as it has no way of re-applying itself. I would make it use a priority overlay, but there is no code present for *removing* said overlay from neighbors when it is no longer required. That code should be implemented by original author.
122 lines
3.6 KiB
Plaintext
122 lines
3.6 KiB
Plaintext
/turf/simulated/wall/proc/update_material()
|
|
|
|
if(!material)
|
|
return
|
|
|
|
if(reinf_material)
|
|
construction_stage = 6
|
|
else
|
|
construction_stage = null
|
|
if(!material)
|
|
material = get_material_by_name(DEFAULT_WALL_MATERIAL)
|
|
if(material)
|
|
explosion_resistance = material.explosion_resistance
|
|
if(reinf_material && reinf_material.explosion_resistance > explosion_resistance)
|
|
explosion_resistance = reinf_material.explosion_resistance
|
|
|
|
if(reinf_material)
|
|
name = "reinforced [material.display_name] wall"
|
|
desc = "It seems to be a section of hull reinforced with [reinf_material.display_name] and plated with [material.display_name]."
|
|
else
|
|
name = "[material.display_name] wall"
|
|
desc = "It seems to be a section of hull plated with [material.display_name]."
|
|
|
|
if(material.opacity > 0.5 && !opacity)
|
|
set_light(1)
|
|
else if(material.opacity < 0.5 && opacity)
|
|
set_light(0)
|
|
|
|
radiation_repository.resistance_cache.Remove(src)
|
|
update_connections(1)
|
|
update_icon()
|
|
|
|
|
|
/turf/simulated/wall/proc/set_material(var/material/newmaterial, var/material/newrmaterial, var/material/newgmaterial)
|
|
material = newmaterial
|
|
reinf_material = newrmaterial
|
|
if(!newgmaterial)
|
|
girder_material = DEFAULT_WALL_MATERIAL
|
|
else
|
|
girder_material = newgmaterial
|
|
update_material()
|
|
|
|
/turf/simulated/wall/update_icon()
|
|
if(!material)
|
|
return
|
|
|
|
if(!damage_overlays[1]) //list hasn't been populated
|
|
generate_overlays()
|
|
|
|
cut_overlays()
|
|
var/image/I
|
|
|
|
if(!density)
|
|
I = image('icons/turf/wall_masks.dmi', "[material.icon_base]fwall_open")
|
|
I.color = material.icon_colour
|
|
add_overlay(I)
|
|
return
|
|
|
|
for(var/i = 1 to 4)
|
|
I = image('icons/turf/wall_masks.dmi', "[material.icon_base][wall_connections[i]]", dir = 1<<(i-1))
|
|
I.color = material.icon_colour
|
|
add_overlay(I)
|
|
|
|
if(reinf_material)
|
|
if(construction_stage != null && construction_stage < 6)
|
|
I = image('icons/turf/wall_masks.dmi', "reinf_construct-[construction_stage]")
|
|
I.color = reinf_material.icon_colour
|
|
add_overlay(I)
|
|
else
|
|
if("[reinf_material.icon_reinf]0" in icon_states('icons/turf/wall_masks.dmi'))
|
|
// Directional icon
|
|
for(var/i = 1 to 4)
|
|
I = image('icons/turf/wall_masks.dmi', "[reinf_material.icon_reinf][wall_connections[i]]", dir = 1<<(i-1))
|
|
I.color = reinf_material.icon_colour
|
|
add_overlay(I)
|
|
else
|
|
I = image('icons/turf/wall_masks.dmi', reinf_material.icon_reinf)
|
|
I.color = reinf_material.icon_colour
|
|
add_overlay(I)
|
|
|
|
if(damage != 0)
|
|
var/integrity = material.integrity
|
|
if(reinf_material)
|
|
integrity += reinf_material.integrity
|
|
|
|
var/overlay = round(damage / integrity * damage_overlays.len) + 1
|
|
if(overlay > damage_overlays.len)
|
|
overlay = damage_overlays.len
|
|
|
|
add_overlay(damage_overlays[overlay])
|
|
return
|
|
|
|
/turf/simulated/wall/proc/generate_overlays()
|
|
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")
|
|
img.blend_mode = BLEND_MULTIPLY
|
|
img.alpha = (i * alpha_inc) - 1
|
|
damage_overlays[i] = img
|
|
|
|
|
|
/turf/simulated/wall/proc/update_connections(propagate = 0)
|
|
if(!material)
|
|
return
|
|
var/list/dirs = list()
|
|
for(var/turf/simulated/wall/W in orange(src, 1))
|
|
if(!W.material)
|
|
continue
|
|
if(propagate)
|
|
W.update_connections()
|
|
W.update_icon()
|
|
if(can_join_with(W))
|
|
dirs += get_dir(src, W)
|
|
|
|
wall_connections = dirs_to_corner_states(dirs)
|
|
|
|
/turf/simulated/wall/proc/can_join_with(var/turf/simulated/wall/W)
|
|
if(material && W.material && material.icon_base == W.material.icon_base)
|
|
return 1
|
|
return 0
|