Action system
A simple base for an modular behavior attached to atom or datum.
Vars | |
background_icon | This is the file for the BACKGROUND underlay icon of the button |
---|---|
background_icon_state | This is the icon state state for the BACKGROUND underlay icon of the button (If set to ACTION_BUTTON_DEFAULT_BACKGROUND, uses the hud's default background) |
button_icon | This is the file for the icon that appears on the button |
button_icon_state | This is the icon state for the icon that appears on the button |
buttontooltipstyle | The style the button's tooltips appear to be |
check_flags | Flags that will determine of the owner / user of the action can... use the action |
default_button_position | Where any buttons we create should be by default. Accepts screen_loc and location defines |
desc | The description of what the action does, shown in button tooltips |
name | The name of the action |
overlay_icon | This is the file for any FOREGROUND overlay icons on the button (such as borders) |
overlay_icon_state | This is the icon state for any FOREGROUND overlay icons on the button (such as borders) |
owner | This is who currently owns the action, and most often, this is who is using the action if it is triggered This can be the same as "target" but is not ALWAYS the same - this is set and unset with Grant() and Remove() |
owner_has_control | If False, the owner of this action does not get a hud and cannot activate it on their own |
show_to_observers | If TRUE, this action button will be shown to observers / other mobs who view from this action's owner's eyes. Used in /mob/proc/show_other_mob_action_buttons |
target | The target the action is attached to. If the target datum is deleted, the action is as well. Set in New() via the proc link_to(). PLEASE set a target if you're making an action |
transparent_when_unavailable | Whether the button becomes transparent when it can't be used, or just reddened |
viewers | List of all mobs that are viewing our action button -> A unique movable for them to view. |
Procs | |
GiveAction | Gives our action to the passed viewer. Puts our action in their actions list and shows them the button. |
Grant | Grants the action to the passed mob, making it the owner |
HideFrom | Removes our action from the passed viewer. |
IsAvailable | Whether our action is currently available to use or not |
Remove | Remove the passed mob from being owner of our action |
ShowTo | Adds our action button to the screen of the passed viewer. |
Trigger | Actually triggers the effects of the action. Called when the on-screen button is clicked, for example. |
apply_button_background | Creates the background underlay for the button |
apply_button_icon | Applies our button icon and icon state to the button |
apply_button_overlay | Applies any overlays to our button |
build_all_button_icons | Builds / updates all buttons we have shared or given out |
build_button_icon | Builds the icon of the button. |
clear_ref | Signal proc that clears any references based on the owner or target deleting If the owner's deleted, we will simply remove from them, but if the target's deleted, we will self-delete |
create_button | Creates an action button movable for the passed mob, and returns it. |
is_action_active | Checks if our action is actively selected. Used for selecting icons primarily. |
link_to | Links the passed target to our action, registering any relevant signals |
on_target_icon_update | Updates our buttons if our target's icon was updated |
on_target_mind_swapped | Signal proc for COMSIG_MIND_TRANSFERRED - for minds, transfers our action to our new mob on mind transfer |
update_button_name | Updates the name and description of the button to match our action name and discription. |
update_button_status | Any other miscellaneous "status" updates within the action button is handled here, such as redding out when unavailable or modifying maptext. |
update_status_on_signal | A general use signal proc that reacts to an event and updates JUST our button's status |
Var Details
background_icon
This is the file for the BACKGROUND underlay icon of the button
background_icon_state
This is the icon state state for the BACKGROUND underlay icon of the button (If set to ACTION_BUTTON_DEFAULT_BACKGROUND, uses the hud's default background)
button_icon
This is the file for the icon that appears on the button
button_icon_state
This is the icon state for the icon that appears on the button
buttontooltipstyle
The style the button's tooltips appear to be
check_flags
Flags that will determine of the owner / user of the action can... use the action
default_button_position
Where any buttons we create should be by default. Accepts screen_loc and location defines
desc
The description of what the action does, shown in button tooltips
name
The name of the action
overlay_icon
This is the file for any FOREGROUND overlay icons on the button (such as borders)
overlay_icon_state
This is the icon state for any FOREGROUND overlay icons on the button (such as borders)
owner
This is who currently owns the action, and most often, this is who is using the action if it is triggered This can be the same as "target" but is not ALWAYS the same - this is set and unset with Grant() and Remove()
owner_has_control
If False, the owner of this action does not get a hud and cannot activate it on their own
show_to_observers
If TRUE, this action button will be shown to observers / other mobs who view from this action's owner's eyes. Used in /mob/proc/show_other_mob_action_buttons
target
The target the action is attached to. If the target datum is deleted, the action is as well. Set in New() via the proc link_to(). PLEASE set a target if you're making an action
transparent_when_unavailable
Whether the button becomes transparent when it can't be used, or just reddened
viewers
List of all mobs that are viewing our action button -> A unique movable for them to view.
Proc Details
GiveAction
Gives our action to the passed viewer. Puts our action in their actions list and shows them the button.
Grant
Grants the action to the passed mob, making it the owner
HideFrom
Removes our action from the passed viewer.
IsAvailable
Whether our action is currently available to use or not
- feedback - If true this is being called to check if we have any messages to show to the owner
Remove
Remove the passed mob from being owner of our action
ShowTo
Adds our action button to the screen of the passed viewer.
Trigger
Actually triggers the effects of the action. Called when the on-screen button is clicked, for example.
apply_button_background
Creates the background underlay for the button
current_button - what button are we editing? force - whether an update is forced regardless of existing status
apply_button_icon
Applies our button icon and icon state to the button
current_button - what button are we editing? force - whether an update is forced regardless of existing status
apply_button_overlay
Applies any overlays to our button
current_button - what button are we editing? force - whether an update is forced regardless of existing status
build_all_button_icons
Builds / updates all buttons we have shared or given out
build_button_icon
Builds the icon of the button.
Concept:
- Underlay (Background icon)
- Icon (button icon)
- Maptext
- Overlay (Background border)
button - which button we are modifying the icon of force - whether we're forcing a full update
clear_ref
Signal proc that clears any references based on the owner or target deleting If the owner's deleted, we will simply remove from them, but if the target's deleted, we will self-delete
create_button
Creates an action button movable for the passed mob, and returns it.
is_action_active
Checks if our action is actively selected. Used for selecting icons primarily.
link_to
Links the passed target to our action, registering any relevant signals
on_target_icon_update
Updates our buttons if our target's icon was updated
on_target_mind_swapped
Signal proc for COMSIG_MIND_TRANSFERRED - for minds, transfers our action to our new mob on mind transfer
update_button_name
Updates the name and description of the button to match our action name and discription.
current_button - what button are we editing? force - whether an update is forced regardless of existing status
update_button_status
Any other miscellaneous "status" updates within the action button is handled here, such as redding out when unavailable or modifying maptext.
current_button - what button are we editing? force - whether an update is forced regardless of existing status
update_status_on_signal
A general use signal proc that reacts to an event and updates JUST our button's status