seclite_attachable
Component which allows you to attach a seclight to an item, be it a piece of clothing or a tool.
Vars | |
is_light_removable | Whether we can remove the light with a screwdriver or not. |
---|---|
light | A reference to the actual light that's attached. |
light_icon_state | If passed, we wil simply update our item's icon_state when a light is attached. Formatted as parent_base_state-[light_icon-state]-"on" |
light_overlay | The state to take from the light overlay icon if supplied. |
light_overlay_icon | If passed, we will add overlays to the item when a light is attached. This is the icon file it grabs the overlay from. |
overlay_x | The X offset of our overlay if supplied. |
overlay_y | The Y offset of our overlay if supplied. |
toggle_action_ref | A weakref to the item action we add with the light. |
valid_lights | Static typecache of all lights we consider seclites (all lights we can attach). |
Procs | |
add_light | Sets a new light as our current light for our parent. |
on_action_click | Signal proc for COMSIG_ITEM_UI_ACTION_CLICK that toggles our light on and off if our action button is clicked. |
on_attackby | Signal proc for COMSIG_PARENT_ATTACKBY that allows a user to attach a seclite by hitting our parent with it. |
on_examine | Signal proc for COMSIG_PARENT_EXAMINE that shows our item can have / does have a seclite attached. |
on_light_exit | Signal proc for COMSIG_ATOM_EXITED that handles our light being removed or deleted from our parent. |
on_parent_deconstructed | Signal proc for COMSIG_OBJ_DECONSTRUCT that drops our light to the ground if our parent is deconstructed. |
on_parent_deleted | Signal proc for COMSIG_PARENT_QDELETING that deletes our light if our parent is deleted. |
on_screwdriver | Signal proc for COMSIG_ATOM_TOOL_ACT via [TOOL_SCREWDRIVER] that removes any attached seclite. |
on_update_icon_state | Signal proc for COMSIG_ATOM_UPDATE_ICON_STATE that updates our parent's icon state, if we have one. |
on_update_overlays | Signal proc for COMSIG_ATOM_UPDATE_OVERLAYS that updates our parent with our seclite overlays, if we have some. |
remove_light | Removes the current light from our parent. |
toggle_light | Toggles the light within on or off. Returns TRUE if there is a light inside, FALSE otherwise. |
unscrew_light | Invoked asyncronously from [proc/on_screwdriver]. Handles removing the light from our parent. |
update_light | Called after the a light is added, removed, or toggles. Ensures all of our appearances look correct for the new light state. |
Var Details
is_light_removable
Whether we can remove the light with a screwdriver or not.
light
A reference to the actual light that's attached.
light_icon_state
If passed, we wil simply update our item's icon_state when a light is attached. Formatted as parent_base_state-[light_icon-state]-"on"
light_overlay
The state to take from the light overlay icon if supplied.
light_overlay_icon
If passed, we will add overlays to the item when a light is attached. This is the icon file it grabs the overlay from.
overlay_x
The X offset of our overlay if supplied.
overlay_y
The Y offset of our overlay if supplied.
toggle_action_ref
A weakref to the item action we add with the light.
valid_lights
Static typecache of all lights we consider seclites (all lights we can attach).
Proc Details
add_light
Sets a new light as our current light for our parent.
on_action_click
Signal proc for COMSIG_ITEM_UI_ACTION_CLICK that toggles our light on and off if our action button is clicked.
on_attackby
Signal proc for COMSIG_PARENT_ATTACKBY that allows a user to attach a seclite by hitting our parent with it.
on_examine
Signal proc for COMSIG_PARENT_EXAMINE that shows our item can have / does have a seclite attached.
on_light_exit
Signal proc for COMSIG_ATOM_EXITED that handles our light being removed or deleted from our parent.
on_parent_deconstructed
Signal proc for COMSIG_OBJ_DECONSTRUCT that drops our light to the ground if our parent is deconstructed.
on_parent_deleted
Signal proc for COMSIG_PARENT_QDELETING that deletes our light if our parent is deleted.
on_screwdriver
Signal proc for COMSIG_ATOM_TOOL_ACT via [TOOL_SCREWDRIVER] that removes any attached seclite.
on_update_icon_state
Signal proc for COMSIG_ATOM_UPDATE_ICON_STATE that updates our parent's icon state, if we have one.
on_update_overlays
Signal proc for COMSIG_ATOM_UPDATE_OVERLAYS that updates our parent with our seclite overlays, if we have some.
remove_light
Removes the current light from our parent.
toggle_light
Toggles the light within on or off. Returns TRUE if there is a light inside, FALSE otherwise.
unscrew_light
Invoked asyncronously from [proc/on_screwdriver]. Handles removing the light from our parent.
update_light
Called after the a light is added, removed, or toggles. Ensures all of our appearances look correct for the new light state.