Skip to content

Commit

Permalink
emissive blockers are now just an overlay (with kickass fucking graph…
Browse files Browse the repository at this point in the history
…s). FUCK YOU MAPTICK (tgstation#57934)

currently emissive blockers are objects added to the vis_contents of every item. however mutable appearances as overlays can serve this role perfectly well and according to my tests should cause less maptick per item. for mobs mutable appearances dont work for reasons i dont understand so instead this adds the em_block object to overlays instead of vis_contents. these both use atom/movable/update_icon() now

graphed test results in pr
  • Loading branch information
Kylerace committed Mar 26, 2021
1 parent 9c9a790 commit 0992c09
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,15 @@
. = ..()
switch(blocks_emissive)
if(EMISSIVE_BLOCK_GENERIC)
update_emissive_block()
var/mutable_appearance/gen_emissive_blocker = mutable_appearance(icon, icon_state, EMISSIVE_BLOCKER_LAYER, EMISSIVE_BLOCKER_PLANE)
gen_emissive_blocker.dir = dir
gen_emissive_blocker.alpha = alpha
gen_emissive_blocker.appearance_flags |= appearance_flags
add_overlay(list(gen_emissive_blocker))
if(EMISSIVE_BLOCK_UNIQUE)
render_target = ref(src)
em_block = new(src, render_target)
vis_contents += em_block
add_overlay(list(em_block))
if(opacity)
AddElement(/datum/element/light_blocking)
switch(light_system)
Expand Down Expand Up @@ -131,17 +135,24 @@

vis_contents.Cut()


/atom/movable/proc/update_emissive_block()
if(blocks_emissive != EMISSIVE_BLOCK_GENERIC)
if(!blocks_emissive)
return
if(length(managed_vis_overlays))
for(var/a in managed_vis_overlays)
var/obj/effect/overlay/vis/vs
if(vs.plane == EMISSIVE_BLOCKER_PLANE)
SSvis_overlays.remove_vis_overlay(src, list(vs))
break
SSvis_overlays.add_vis_overlay(src, icon, icon_state, EMISSIVE_BLOCKER_LAYER, EMISSIVE_BLOCKER_PLANE, dir)
else if (blocks_emissive == EMISSIVE_BLOCK_GENERIC)
var/mutable_appearance/gen_emissive_blocker = mutable_appearance(icon, icon_state, EMISSIVE_BLOCKER_LAYER, EMISSIVE_BLOCKER_PLANE)
gen_emissive_blocker.dir = dir
gen_emissive_blocker.alpha = alpha
gen_emissive_blocker.appearance_flags |= appearance_flags
return gen_emissive_blocker
else if(blocks_emissive == EMISSIVE_BLOCK_UNIQUE)
if(!em_block)
render_target = ref(src)
em_block = new(src, render_target)
return em_block

/atom/movable/update_overlays()
. = ..()
. += update_emissive_block()

/atom/movable/proc/can_zFall(turf/source, levels = 1, turf/target, direction)
if(!direction)
Expand Down

0 comments on commit 0992c09

Please sign in to comment.