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

reflection

A simple-ish component that reflects the icons of movables on the parent like a mirror. Sadly, there's no easy way to make the SOUTH dir reflection flip the visual so that you can see the back NORTH dir of a target while it's facing SOUTH beside adding the VIS_INHERIT_DIR flag to the target movable, which I'm not doing to spare eventual issues with other vis overlays in the future.

Vars

alphathe transparency channel value of the reflection holder.
can_reflectA callback used check to know which movables should be reflected and which not.
check_reflect_signalsList of signals registered on reflected atoms to update their reflections.
reflected_dirThe direction from which the component gets its visual overlays. The visuals are also flipped horizontally or vertically based on it.
reflected_movablesA lazy assoc list that keeps track of all movables in range that either could be reflected or are reflected.
reflection_filterthe filter data added to reflection holder.
reflection_holderthe movable which the reflected movables are attached to, in turn added to the vis contents of the parent.
reflection_matrixthe base matrix used by reflections
update_signalsA list of signals that when sent to the parent, will force the comp to recalculate the reflected movables.

Procs

InitializeInit Args
check_can_reflectChecks if the target movable can be reflected or not.
copy_appearance_to_reflectionHandles updating the appearance of the reflection to match the target movable.
get_reflection_targetsUnsets the old reflected movables and sets it with new ones.
on_dir_changeCalled when the parent changes its direction.
on_movable_entered_or_initializedCalled when a movable enters a turf within the connected range
on_movable_exitedCalled when a movable exits a turf within the connected range
set_reflectionTurns the allowed reflected direction alongside the parent's dir. then calls get_reflection_targets.
update_reflectionCalled when the target movable changes its appearance or dir.

Var Details

alpha

the transparency channel value of the reflection holder.

can_reflect

A callback used check to know which movables should be reflected and which not.

check_reflect_signals

List of signals registered on reflected atoms to update their reflections.

reflected_dir

The direction from which the component gets its visual overlays. The visuals are also flipped horizontally or vertically based on it.

reflected_movables

A lazy assoc list that keeps track of all movables in range that either could be reflected or are reflected.

The key is the movable, and the value is the reflection object (or null - the reflection object is also lazy loaded).

reflection_filter

the filter data added to reflection holder.

reflection_holder

the movable which the reflected movables are attached to, in turn added to the vis contents of the parent.

reflection_matrix

the base matrix used by reflections

update_signals

A list of signals that when sent to the parent, will force the comp to recalculate the reflected movables.

Proc Details

Initialize

Init Args

check_can_reflect

Checks if the target movable can be reflected or not.

copy_appearance_to_reflection

Handles updating the appearance of the reflection to match the target movable.

get_reflection_targets

Unsets the old reflected movables and sets it with new ones.

on_dir_change

Called when the parent changes its direction.

on_movable_entered_or_initialized

Called when a movable enters a turf within the connected range

on_movable_exited

Called when a movable exits a turf within the connected range

set_reflection

Turns the allowed reflected direction alongside the parent's dir. then calls get_reflection_targets.

update_reflection

Called when the target movable changes its appearance or dir.