Files
Bubberstation/code/modules/lighting/emissive_blocker.dm
SkyratBot 2c682cf83e [MIRROR] Things that love the station may no longer leave the station, even when Dr. Anomaly says they should. (#8254)
* Things that love the station may no longer leave the station, even when Dr. Anomaly says they should. (#61335)

Bluespace anomalies detonating Move() things. When something is Move()d, none of the logic in forceMove() or doMove() is called, and thus stationloving things can't tell when they've left the z-level (since that's where the logic for it is).

There are a number of approaches I could have taken: Refactoring anomalies to use different movement code. Refactoring Movement code to send more signals in various scenarios. Refactoring the stationloving component.

I settled on two steps. First, refactoring the component to bring it up to modern code standards. Second, moving the logic for COMSIG_MOVABLE_Z_CHANGED to Moved() so the signal always fires regardless of if Move() or forceMove() or doMove() is used, with an optional var for whether the z-change is communicated to contents. This means the ore box was changed to actually send the signal instead of just returning with no parent call or signal sent. Stationloving ore boxes when?

stationloving procs no longer call SIGNAL_HANDLERs directly. Var names are now more descriptive. Things are renamed and documented. At least for the parts of the code I know.

Probably some other code cleanups.

* Things that love the station may no longer leave the station, even when Dr. Anomaly says they should.

Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
2021-09-18 21:45:42 +01:00

47 lines
1.6 KiB
Plaintext

/**
* Internal atom that copies an appearance on to the blocker plane
*
* Copies an appearance vis render_target and render_source on to the emissive blocking plane.
* This means that the atom in question will block any emissive sprites.
* This should only be used internally. If you are directly creating more of these, you're
* almost guaranteed to be doing something wrong.
*/
/atom/movable/emissive_blocker
name = "emissive blocker"
plane = EMISSIVE_PLANE
layer = FLOAT_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
//Why?
//render_targets copy the transform of the target as well, but vis_contents also applies the transform
//to what's in it. Applying RESET_TRANSFORM here makes vis_contents not apply the transform.
//Since only render_target handles transform we don't get any applied transform "stacking"
appearance_flags = EMISSIVE_APPEARANCE_FLAGS
/atom/movable/emissive_blocker/Initialize(mapload, source)
. = ..()
verbs.Cut() //Cargo culting from lighting object, this maybe affects memory usage?
render_source = source
color = GLOB.em_block_color
/atom/movable/emissive_blocker/ex_act(severity)
return FALSE
/atom/movable/emissive_blocker/singularity_act()
return
/atom/movable/emissive_blocker/singularity_pull()
return
/atom/movable/emissive_blocker/blob_act()
return
/atom/movable/emissive_blocker/on_changed_z_level(turf/old_turf, turf/new_turf)
return
//Prevents people from moving these after creation, because they shouldn't be.
/atom/movable/emissive_blocker/forceMove(atom/destination, no_tp=FALSE, harderforce = FALSE)
if(harderforce)
return ..()