mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
[MIRROR] Makes emsisive blockers like, work [MDB IGNORE] (#20698)
* Makes emsisive blockers like, work (#74887) ## About The Pull Request We assumed 0 meant no emissive blocker, but moth changed that a while back, so post /atom/movable/Initialize generic emissive blockers just.. didn't work Let's uh, fix that Oh also makes pipes update their icon BEFORE they call update_icon parent, so their emissive blockers look right ## Why It's Good For The Game  Closes #74905 ## Changelog 🆑 fix: Things that block glow will now like, do that again /🆑 * Makes emsisive blockers like, work --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
co-authored by
LemonInTheDark
parent
339ab3fd4f
commit
2d265f2bbb
@@ -225,15 +225,23 @@
|
||||
vis_contents.Cut()
|
||||
|
||||
/atom/movable/proc/update_emissive_block()
|
||||
if(!blocks_emissive)
|
||||
return
|
||||
else if (blocks_emissive == EMISSIVE_BLOCK_GENERIC)
|
||||
// This one is incredible.
|
||||
// `if (x) else { /* code */ }` is surprisingly fast, and it's faster than a switch, which is seemingly not a jump table.
|
||||
// From what I can tell, a switch case checks every single branch individually, although sane, is slow in a hot proc like this.
|
||||
// So, we make the most common `blocks_emissive` value, EMISSIVE_BLOCK_GENERIC, 0, getting to the fast else branch quickly.
|
||||
// If it fails, then we can check over every value it can be (here, EMISSIVE_BLOCK_UNIQUE is the only one that matters).
|
||||
// This saves several hundred milliseconds of init time.
|
||||
if (blocks_emissive)
|
||||
if (blocks_emissive == EMISSIVE_BLOCK_UNIQUE)
|
||||
if(!em_block && !QDELETED(src))
|
||||
render_target = ref(src)
|
||||
em_block = new(src, render_target)
|
||||
return em_block
|
||||
// Implied else if (blocks_emissive == EMISSIVE_BLOCK_NONE) -> return
|
||||
// EMISSIVE_BLOCK_GENERIC == 0
|
||||
else
|
||||
return fast_emissive_blocker(src)
|
||||
else if(blocks_emissive == EMISSIVE_BLOCK_UNIQUE)
|
||||
if(!em_block && !QDELETED(src))
|
||||
render_target = ref(src)
|
||||
em_block = new(src, render_target)
|
||||
return em_block
|
||||
|
||||
|
||||
/// Generates a space underlay for a turf
|
||||
/// This provides proper lighting support alongside just looking nice
|
||||
|
||||
@@ -105,9 +105,9 @@
|
||||
icon_state = "[bitfield]_[piping_layer]"
|
||||
|
||||
/obj/machinery/atmospherics/pipe/update_icon()
|
||||
. = ..()
|
||||
update_pipe_icon()
|
||||
update_layer()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/proc/update_node_icon()
|
||||
for(var/i in 1 to device_type)
|
||||
|
||||
Reference in New Issue
Block a user