/tg/ Station 13 - Modules - TypesVar Details - Proc Details

immerse

A visual element that makes movables entering the attached turfs look immersed into that turf.

Abandon all hope, ye who read forth, for this immerse works on mind-numbing workarounds,

Vars

attached_turfs_and_movablesAn association list of turfs that have this element attached and their affected contents.
generated_immerse_iconsA list of icons generated from a target and a mask, later used as appearances for the overlays.
generated_visual_overlaysA list of instances of /atom/movable/immerse_overlay then used as visual overlays for the immersed movables.
immersed_movablesAn association list of movables as key and overlays as assoc.

Procs

add_immerse_overlayThe main proc, which adds a visual overlay to the movable that has entered the turf to make it look immersed. It's kind of iffy but basically, we want the overlay to cover as much area as needed to avoid the movable's icon from spilling horizontally or below. Also, while these visual overlays are mainly cached movables, for certain movables, such as living mobs, we want them to have their own unique vis overlay with additional signals registered. This allows the vis overlay to look more or less unchanged while its owner is spinning or resting without otherwise affecting other movables with identical overlays.
clear_overlay_refsWe need to make sure to remove hard refs from the element when deleted.
generate_vis_overlayInitializes and caches a new visual overlay given parameters such as width, height and whether it should appear fully underwater.
on_atom_exitedCalled when a movable exits the turf. If its new location is not in the list of turfs with this element, Remove the movable from the element.
on_init_or_enteredIf the movable is within the right layers and planes, not in the list of movable types to ignore, or already affected by the element for that matter, Signals will be registered and, unless the movable (or whatever it's buckled to) is flying, it'll appear as if immersed in that water.
on_move_flag_disabledReadds the overlay to the mob and bucklees if no longer flying.
on_move_flag_enabledRemoves the overlay from mob and bucklees is flying.
on_spin_animationSpin the overlay in the opposite direction so it doesn't look like it's spinning at all.
on_throwWorks just like on_move_flag_enabled, except it only has to check that movable isn't flying
on_throw_landedWorks just like on_move_flag_disabled, except it only has to check that movable isn't flying
on_update_transformA band-aid to keep the (unique) visual overlay from scaling and rotating along with its owner. I'm sorry.
remove_from_elementRemove any signal, overlay, trait given to the movable and reference to it within the element.
remove_immerse_overlayThis proc removes the vis_overlay, the keep together trait and some signals from the movable.
start_immersionMakes the element start affecting the turf and its contents. Called on Attach() or when TRAIT_IMMERSE_STOPPED is removed.
stop_immersionStops the element from affecting on the turf and its contents. Called on Detach() or when TRAIT_IMMERSE_STOPPED is added.
try_immerseCalled by init_or_entered() and on_set_buckled(). This applies the overlay if neither the movable or whatever is buckled to (exclusive to living mobs) are flying as well as movetype signals when the movable isn't buckled.
try_unimmerseCalled by on_set_buckled() and remove_from_element(). This removes the filter and signals from the movable unless it doesn't have them.

Var Details

attached_turfs_and_movables

An association list of turfs that have this element attached and their affected contents.

generated_immerse_icons

A list of icons generated from a target and a mask, later used as appearances for the overlays.

generated_visual_overlays

A list of instances of /atom/movable/immerse_overlay then used as visual overlays for the immersed movables.

immersed_movables

An association list of movables as key and overlays as assoc.

Proc Details

add_immerse_overlay

The main proc, which adds a visual overlay to the movable that has entered the turf to make it look immersed. It's kind of iffy but basically, we want the overlay to cover as much area as needed to avoid the movable's icon from spilling horizontally or below. Also, while these visual overlays are mainly cached movables, for certain movables, such as living mobs, we want them to have their own unique vis overlay with additional signals registered. This allows the vis overlay to look more or less unchanged while its owner is spinning or resting without otherwise affecting other movables with identical overlays.

clear_overlay_refs

We need to make sure to remove hard refs from the element when deleted.

generate_vis_overlay

Initializes and caches a new visual overlay given parameters such as width, height and whether it should appear fully underwater.

on_atom_exited

Called when a movable exits the turf. If its new location is not in the list of turfs with this element, Remove the movable from the element.

on_init_or_entered

If the movable is within the right layers and planes, not in the list of movable types to ignore, or already affected by the element for that matter, Signals will be registered and, unless the movable (or whatever it's buckled to) is flying, it'll appear as if immersed in that water.

on_move_flag_disabled

Readds the overlay to the mob and bucklees if no longer flying.

on_move_flag_enabled

Removes the overlay from mob and bucklees is flying.

on_spin_animation

Spin the overlay in the opposite direction so it doesn't look like it's spinning at all.

on_throw

Works just like on_move_flag_enabled, except it only has to check that movable isn't flying

on_throw_landed

Works just like on_move_flag_disabled, except it only has to check that movable isn't flying

on_update_transform

A band-aid to keep the (unique) visual overlay from scaling and rotating along with its owner. I'm sorry.

remove_from_element

Remove any signal, overlay, trait given to the movable and reference to it within the element.

remove_immerse_overlay

This proc removes the vis_overlay, the keep together trait and some signals from the movable.

start_immersion

Makes the element start affecting the turf and its contents. Called on Attach() or when TRAIT_IMMERSE_STOPPED is removed.

stop_immersion

Stops the element from affecting on the turf and its contents. Called on Detach() or when TRAIT_IMMERSE_STOPPED is added.

try_immerse

Called by init_or_entered() and on_set_buckled(). This applies the overlay if neither the movable or whatever is buckled to (exclusive to living mobs) are flying as well as movetype signals when the movable isn't buckled.

try_unimmerse

Called by on_set_buckled() and remove_from_element(). This removes the filter and signals from the movable unless it doesn't have them.