Skip to content

Commit

Permalink
Revert aeeeb78
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Aug 24, 2024
1 parent ef48c8b commit 39589a1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
6 changes: 3 additions & 3 deletions code/__HELPERS/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@

// First, we cut away a constant amount
var/cut_away = (alpha_to_leave - 1) / 255
var/atom/movable/render_step/color/alpha_threshold_down = new(null, make_blocker, list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,-cut_away))
var/atom/movable/render_step/color/alpha_threshold_down = new(make_blocker, make_blocker.render_target, list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,-cut_away))
alpha_threshold_down.render_target = "*emissive_block_alpha_down_[uid]"
// Then we multiply what remains by the amount we took away
var/atom/movable/render_step/color/alpha_threshold_up = new(null, alpha_threshold_down, list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,alpha_to_leave, 0,0,0,0))
var/atom/movable/render_step/color/alpha_threshold_up = new(make_blocker, alpha_threshold_down.render_target, list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,alpha_to_leave, 0,0,0,0))
alpha_threshold_up.render_target = "*emissive_block_alpha_up_[uid]"
// Now we just feed that into an emissive blocker
var/atom/movable/render_step/emissive_blocker/em_block = new(null, alpha_threshold_up)
var/atom/movable/render_step/emissive_blocker/em_block = new(make_blocker, alpha_threshold_up.render_target)
var/list/hand_back = list()
hand_back += alpha_threshold_down
hand_back += alpha_threshold_up
Expand Down
16 changes: 5 additions & 11 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
if (blocks_emissive)
if (blocks_emissive == EMISSIVE_BLOCK_UNIQUE)
render_target = ref(src)
em_block = new(null, src)
em_block = new(src, render_target)
overlays += em_block
if(managed_overlays)
if(islist(managed_overlays))
Expand Down Expand Up @@ -211,7 +211,7 @@
move_packet = null

if(spatial_grid_key)
SSspatial_grid.force_remove_from_grid(src)
SSspatial_grid.force_remove_from_cell(src)

LAZYCLEARLIST(client_mobs_in_contents)

Expand Down Expand Up @@ -243,11 +243,9 @@
// This saves several hundred milliseconds of init time.
if (blocks_emissive)
if (blocks_emissive == EMISSIVE_BLOCK_UNIQUE)
if(em_block)
SET_PLANE(em_block, EMISSIVE_PLANE, src)
else if(!QDELETED(src))
if(!em_block && !QDELETED(src))
render_target = ref(src)
em_block = new(null, src)
em_block = new(src, render_target)
return em_block
// Implied else if (blocks_emissive == EMISSIVE_BLOCK_NONE) -> return
// EMISSIVE_BLOCK_GENERIC == 0
Expand All @@ -263,7 +261,7 @@
SET_PLANE(underlay_appearance, PLANE_SPACE, generate_for)
if(!generate_for.render_target)
generate_for.render_target = ref(generate_for)
var/atom/movable/render_step/emissive_blocker/em_block = new(null, generate_for)
var/atom/movable/render_step/emissive_blocker/em_block = new(null, generate_for.render_target)
underlay_appearance.overlays += em_block
// We used it because it's convienient and easy, but it's gotta go now or it'll hang refs
QDEL_NULL(em_block)
Expand Down Expand Up @@ -1473,10 +1471,6 @@

/// Gets or creates the relevant language holder. For mindless atoms, gets the local one. For atom with mind, gets the mind one.
/atom/movable/proc/get_language_holder(get_minds = TRUE)
if(QDELING(src))
CRASH("get_language_holder() called on a QDELing atom, \
this will try to re-instantiate the language holder that's about to be deleted, which is bad.")

if(!language_holder)
language_holder = new initial_language_holder(src)
return language_holder
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
render_target = "holoray#[uid]"
uid++
// Let's GLOW BROTHER! (Doing it like this is the most robust option compared to duped overlays)
glow = new(null, src)
glow = new(src, render_target)
// We need to counteract the pixel offset to ensure we don't double offset (I hate byond)
glow.pixel_x = 32
glow.pixel_y = 32
Expand Down
21 changes: 5 additions & 16 deletions code/modules/visuals/render_steps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@
//we'll display using that, so we gotta reset
appearance_flags = KEEP_APART|KEEP_TOGETHER|RESET_TRANSFORM

/atom/movable/render_step/Initialize(mapload, atom/source)
/atom/movable/render_step/Initialize(mapload, source)
. = ..()
verbs.Cut() //Cargo cultttttt

if(!source)
return

render_source = source.render_target
SET_PLANE_EXPLICIT(src, initial(plane), source)
RegisterSignal(source, COMSIG_QDELETING, PROC_REF(on_source_deleting))
render_source = source

/atom/movable/render_step/ex_act(severity)
return FALSE
Expand All @@ -40,12 +34,6 @@
if(harderforce)
return ..()

/atom/movable/render_step/proc/on_source_deleting(atom/source)
SIGNAL_HANDLER

if(!QDELING(src))
qdel(src)

/**
* Render step that modfies an atom's color
* Useful for creating coherent emissive blockers out of things like glass floors by lowering alpha statically using matrixes
Expand All @@ -56,7 +44,7 @@
//RESET_COLOR is obvious I hope
appearance_flags = KEEP_APART|KEEP_TOGETHER|RESET_COLOR|RESET_TRANSFORM

/atom/movable/render_step/color/Initialize(mapload, atom/source, color)
/atom/movable/render_step/color/Initialize(mapload, source, color)
. = ..()
src.color = color

Expand All @@ -73,10 +61,11 @@
plane = EMISSIVE_PLANE
appearance_flags = EMISSIVE_APPEARANCE_FLAGS|RESET_TRANSFORM

/atom/movable/render_step/emissive_blocker/Initialize(mapload, atom/source)
/atom/movable/render_step/emissive_blocker/Initialize(mapload, source)
. = ..()
src.color = GLOB.em_block_color


/**
* Render step that makes the passed in render source GLOW
*
Expand Down

0 comments on commit 39589a1

Please sign in to comment.