mob
Vars | |
click_handlers | LAZYLIST (Instances of /datum/click_handler ). Click handlers for this mob that should intercept and handle click
calls. |
---|---|
client_colors | The set of /datum/client_color currently applied to the mob, if any. |
confused | Positive Integer. The mob's current confusion level. Ticks down every Fire() in SSMobs. See set_confused() , mod_confused() , clear_confused() , and is_confused() . |
do_unique_user_handle | Integer. Unique sequential ID from the do_after proc used to validate DO_USER_UNIQUE_ACT flag checks. |
logout_time | Integer or null. Stores the world.time value at the time of Logout() . If null , the mob is either considered logged in or has never logged out. |
rdr_by_type | A map of (type = instance) renderers in use by this mob. |
rdr_to_plane | Renderers on /mob We attach renderers to mobs for their lifespan. Only mobs with clients get renderers, and they are removed again when the mob loses its client. Mobs get their own unique renderer instances but it would not be inconceivable to share them globally. A map of (instance = plane) renderers in use by this mob. |
see_black | Sight Set Handling |
Procs | |
AddDefaultRenderers | Creates the mob's renderers on /Login() |
AddRenderer | Adds a non-main renderer to the mob by type if the mob doesn't already have it. |
AltClickOn | Called when the mob alt+clicks on an atom. By default, this calls the targeted atom's on_click/alt extension's on_click() proc, or the atom's AltClick() proc. |
AltShiftClickOn | Called when the mob alt+shift+clicks on an atom. By default, this calls the atom's AltShiftClick() proc. |
ClearRenderers | Removes the mob's renderers on /Logout() |
ClickOn | Handler for when a mob's client clicks on an atom. This is intended to be a general wrapper for sanity checks, then
calling relevant interaction procs down the line. resolve_attackby() , afterattack() , RangedAttack() ,
UnarmedAttack() , the various *ClickOn() , etc all originate here. |
CtrlAltClickOn | Called when the mob ctrl+alt+clicks on an atom. By default, this calls the atom's CtrlAltClick() proc or calls the mob's pointed() proc. |
CtrlAltShiftClickOn | Called when the mob ctrl+alt+shift+clicks on an atom. By default, this calls the atom's CtrlAltShiftClick() proc. |
CtrlClickOn | Called when the mob ctrl+clicks on an atom. By default, this calls the targeted atom's CtrlClick() proc. |
CtrlShiftClickOn | Called when the mob ctrl+shift+clicks on an atom. By default, calls the atom's CtrlShiftClick() proc. |
GetAllHeld | Fetches all held items of the given path. |
GetClickHandler | Returns the mob's currently active click handler. |
GetRenderer | Returns the renderer instance of_type if the mob has one and it is not shared. |
HandsEmpty | Whether or not the mob's hands or other holding slots are empty. Returns boolean. |
HasFreeHand | Whether or not the mob has any free hands/holding slots. |
IsHolding | Checks if a given item or path is in any of the mob's hands or other holding slots. |
MiddleClickOn | Called when a mob middle-clicks on an object. By default, this is used only as a hotkey to call swap_hand() . |
PushClickHandler | Pushes the given click handler to the top of the click_handlers list, making it the active handler. |
RangedAttack | Called when a mob attmepts to interact with an object that it is not adjacent to. For complex mobs, this includes interacting with an empty hand or empty module. |
RemoveClickHandler | Removes the given click handler from click_handlers . |
RemoveRenderer | Removes a non-main renderer to the mob by type. |
RestrainedClickOn | Called when a mob attempts to interact with an atom while handcuffed or otherwise restrained. Not currently used. |
ShiftClickOn | Called when the mob shift+clicks on an atom. By default, this calls the targeted atom's ShiftClick() proc. |
ShowMemories | Verbs |
UnarmedAttack | Called when the mob interacts with something it is adjacent to. For complex mobs, this includes interacting with an empty hand or empty module. Generally, this translates to attack_hand() , attack_robot() , etc. |
add_client_color | Adds an instance of color_type to the mob's client_colors list if one doesn't already exist. |
add_to_living_mob_list | Life Handling |
attack_empty_hand | Called when a mob attempts to use an empty hand on itself. |
blueswitch | Handles applying blueswitch effects to the mob and creating the clone. |
clear_client_colors | Clears the mobs client_colors list. |
clear_confused | Sets a mob's confused value to 0 . |
direct_machine_interface | Whether or not the mob can directly interact with the machine regardless of screen and input status. Checked in CanUseTopic() . |
do_skilled | Performs a do_after timer, with a modifier applied to the delay time based on the user's skill in the given skill path. |
drop_item | Drops the item in our active hand. TODO: rename this to drop_active_hand or something Make sure you are ABSOLUTELY CERTAIN you need to drop this and ignore unequip checks (For example, grabs can be "dropped" but only willingly) Else use unequip_item |
equip_to_appropriate_slot | Place I into the first slot it fits in the order of slots_by_priority, returning the slot or falsy. |
equip_to_slot | UNSAFELY place I into this mob's inventory at slot if existentially possible. Generally, use the _if_possible version. |
equip_to_slot_if_possible | Attempt to place I into this mob's inventory at slot. See TRYEQUIP_* flags for behavior modifiers. |
fetch_bans | Aliases to _find_bans_in_connections() with this mob's fetch_connections() result. |
fetch_connections | Aliases to _fetch_connections() with this mob's client, if present, or this mob's ckey/last ckey, last IP, and last CID. |
get_attack_speed | Used to get how fast a mob should attack, and influences click delay. This is just for inheritance. |
has_client_color | Checks whether the mob has an instance of color_type in its client_colors list. |
has_danger_grab | Checks if the target has a grab from the user |
isEquipped | Returns truthy when item is in the mobs inventory slots, or in slot if specified. |
is_confused | Whether or not the mob's confusion level is at the threshhold. |
is_species | Determine if the mob is the supplied species by text name, species path, or species instance name |
mod_confused | Modifies a mob's confused value by mod_amount . |
remove_client_color | Removes an instance of color_type from the mob's client_colors list, returning TRUE if one existed. |
remove_grabs_and_pulls | Remove all grabs applied to target mob. Useful when mob is entering a compartment where they're not supposed to be grabbed. |
set_confused | Sets a mob's confused value. |
set_see_in_dark | See In Dark Set Handling |
set_see_invisible | See Invisible Set Handling |
show_associated_bans | Aliases to _show_associated_bans() using this mob's fetch_bans() result, ckey, IP address, and CID. |
show_associated_connections | Aliases to _show_associated_connections() using this mob's fetch_connections() result, ckey, IP address, and CID. |
update_client_color | Resets the mob's client.color to null and then applies the client_colors list. |
use_sanity_check | Validates the mob can perform general interactions. Primarily intended for use after inputs, sleeps, timers, etc to ensure the action can still be completed. |
Var Details
click_handlers
LAZYLIST (Instances of /datum/click_handler
). Click handlers for this mob that should intercept and handle click
calls.
The 'topmost'/'active' click handler for the mob is the handler currently at index 1
. By default, this will be
/datum/click_handler/default
.
client_colors
The set of /datum/client_color currently applied to the mob, if any.
confused
Positive Integer. The mob's current confusion level. Ticks down every Fire()
in SSMobs. See set_confused()
, mod_confused()
, clear_confused()
, and is_confused()
.
do_unique_user_handle
Integer. Unique sequential ID from the do_after
proc used to validate DO_USER_UNIQUE_ACT
flag checks.
logout_time
Integer or null. Stores the world.time
value at the time of Logout()
. If null
, the mob is either considered logged in or has never logged out.
rdr_by_type
A map of (type = instance) renderers in use by this mob.
rdr_to_plane
Renderers on /mob We attach renderers to mobs for their lifespan. Only mobs with clients get renderers, and they are removed again when the mob loses its client. Mobs get their own unique renderer instances but it would not be inconceivable to share them globally. A map of (instance = plane) renderers in use by this mob.
see_black
Sight Set Handling
Proc Details
AddDefaultRenderers
Creates the mob's renderers on /Login()
AddRenderer
Adds a non-main renderer to the mob by type if the mob doesn't already have it.
AltClickOn
Called when the mob alt+clicks on an atom. By default, this calls the targeted atom's on_click/alt
extension's on_click()
proc, or the atom's AltClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean. Whether or not the interaction was handled.
AltShiftClickOn
Called when the mob alt+shift+clicks on an atom. By default, this calls the atom's AltShiftClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean - Whether or not the interaction was handled.
ClearRenderers
Removes the mob's renderers on /Logout()
ClickOn
Handler for when a mob's client clicks on an atom. This is intended to be a general wrapper for sanity checks, then
calling relevant interaction procs down the line. resolve_attackby()
, afterattack()
, RangedAttack()
,
UnarmedAttack()
, the various *ClickOn()
, etc all originate here.
Parameters:
A
- The atom that was clicked on.params
(String) - Click parameters presented by Byond in href format (name=value&name2=value2
)
Has no return value.
CtrlAltClickOn
Called when the mob ctrl+alt+clicks on an atom. By default, this calls the atom's CtrlAltClick()
proc or calls the mob's pointed()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean. Whether or not the interaction was handled.
CtrlAltShiftClickOn
Called when the mob ctrl+alt+shift+clicks on an atom. By default, this calls the atom's CtrlAltShiftClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean - Whether or not the interaction was handled.
CtrlClickOn
Called when the mob ctrl+clicks on an atom. By default, this calls the targeted atom's CtrlClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean - Whether or not the action was handled.
CtrlShiftClickOn
Called when the mob ctrl+shift+clicks on an atom. By default, calls the atom's CtrlShiftClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean. Whether or not the interaction was handled.
GetAllHeld
Fetches all held items of the given path.
If not passed any parameters, will simply fetch all held items.
Parameters:
item_path
(path) - Path to the item type to fetch. Must be a type of/obj/item
.
Returns list of found instances, or null.
GetClickHandler
Returns the mob's currently active click handler.
Parameters:
popped_handler
. Not used, should probably be removed?
GetRenderer
Returns the renderer instance of_type if the mob has one and it is not shared.
HandsEmpty
Whether or not the mob's hands or other holding slots are empty. Returns boolean.
HasFreeHand
Whether or not the mob has any free hands/holding slots.
IsHolding
Checks if a given item or path is in any of the mob's hands or other holding slots.
Parameters:
item
- The item to check for. Either a reference or a path. If a path, will check for any instance of path or its subtypes.
Returns instance of /obj/item
or null
. the item found in the mob's hands.
MiddleClickOn
Called when a mob middle-clicks on an object. By default, this is used only as a hotkey to call swap_hand()
.
Parameters:
A
- The atom that was clicked on.
Returns boolean. Whether or not the interaction was handled.
PushClickHandler
Pushes the given click handler to the top of the click_handlers
list, making it the active handler.
Parameters:
new_click_handler_type
(Type path - Type of/datum/click_handler
). The click handler to make active.
Returns boolean. If TRUE
, the click handler was successfully pushed to the top. Returns FALSE
if the handler was
already active.
RangedAttack
Called when a mob attmepts to interact with an object that it is not adjacent to. For complex mobs, this includes interacting with an empty hand or empty module.
Exception: Telekinesis will call UnarmedAttack([target], 0)
instead.
Parameters:
A
- The atom that was clicked on/interacted with.params
- List of click parameters. See BYOND'sCLick()
documentation.
Returns boolean - Whether or not the mob was able to perform the interaction.
RemoveClickHandler
Removes the given click handler from click_handlers
.
This will not remove the protected default handler.
Parameters:
click_handler
(Path or instance of/datum/click_handler
) - The handler to remove. If a path, finds the first matching instance of that type.
Returns boolean. Whether or not the click handler was found and removed.
RemoveRenderer
Removes a non-main renderer to the mob by type.
RestrainedClickOn
Called when a mob attempts to interact with an atom while handcuffed or otherwise restrained. Not currently used.
Parameters:
A
- The atom that was clicked on/interacted with.
ShiftClickOn
Called when the mob shift+clicks on an atom. By default, this calls the targeted atom's ShiftClick()
proc.
Parameters:
A
- The atom that was clicked on.
Returns boolean. Whether or not the interaction was handled.
ShowMemories
Verbs
UnarmedAttack
Called when the mob interacts with something it is adjacent to. For complex mobs, this includes interacting with an empty hand or empty module. Generally, this translates to attack_hand()
, attack_robot()
, etc.
Exception: This is also called when telekinesis is used, even if not adjacent to the target.
Parameters:
A
- The atom that was clicked on/interacted with.proximity_flag
- Whether or not the mob was at range from the targeted atom. Generally, this is always1
unless telekinesis was used, where this will be0
. This is not currently passed to attack_hand, and is instead used in human click code to allow glove touches only at melee range.
Returns boolean - Whether or not the mob was able to perform the interaction.
add_client_color
Adds an instance of color_type to the mob's client_colors list if one doesn't already exist.
add_to_living_mob_list
Life Handling
attack_empty_hand
Called when a mob attempts to use an empty hand on itself.
Parameters:
bp_hand
(string,BP_R_HAND
orBP_L_HAND
) - The targeted and used hand's bodypart slot.
blueswitch
Handles applying blueswitch effects to the mob and creating the clone.
Parameters:
ghost
- The bluespace ghost triggering the switch.
Returns instance of mob. The created bluespace clone, or null if no clone was created.
clear_client_colors
Clears the mobs client_colors list.
clear_confused
Sets a mob's confused value to 0
.
Returns integer. The new value of confused
.
direct_machine_interface
Whether or not the mob can directly interact with the machine regardless of screen and input status. Checked in CanUseTopic()
.
do_skilled
Performs a do_after timer, with a modifier applied to the delay time based on the user's skill in the given skill path.
Parameters
base_delay
Integer (Seconds) - Base delay for the timer. This is added to the final delay time.skill_path
Path or list of paths (Subtypes of/singleton/hierarchy/skill
; Any ofSKILL_*
) - The skill used to modify the delay time. If provided as a list, the skill that produces the smallest timer is used. Passed toskill_delay_mult()
.target
(Defaultnull
) - The atom being interacted with. Passed directly todo_after()
.factor
Float (Default0.3
) - Modifier factor used to modify the delay applied to the action. Passed toskill_delay_mult()
.do_flags
Bitflag (Any ofDO_*
; DefaultDO_PUBLIC_UNIQUE
) - Flags passed on todo_after()
.
Returns boolean. Whether or not the do after check passed.
drop_item
Drops the item in our active hand. TODO: rename this to drop_active_hand or something Make sure you are ABSOLUTELY CERTAIN you need to drop this and ignore unequip checks (For example, grabs can be "dropped" but only willingly) Else use unequip_item
equip_to_appropriate_slot
Place I into the first slot it fits in the order of slots_by_priority, returning the slot or falsy.
equip_to_slot
UNSAFELY place I into this mob's inventory at slot if existentially possible. Generally, use the _if_possible version.
equip_to_slot_if_possible
Attempt to place I into this mob's inventory at slot. See TRYEQUIP_* flags for behavior modifiers.
fetch_bans
Aliases to _find_bans_in_connections()
with this mob's fetch_connections()
result.
Returns list of lists.
fetch_connections
Aliases to _fetch_connections()
with this mob's client, if present, or this mob's ckey/last ckey, last IP, and last CID.
Returns list of lists.
get_attack_speed
Used to get how fast a mob should attack, and influences click delay. This is just for inheritance.
Parameters:
item
- The item being used in the attack, if any.
Returns a number indicating the determined attack cooldown/speed.
has_client_color
Checks whether the mob has an instance of color_type in its client_colors list.
has_danger_grab
Checks if the target has a grab from the user
isEquipped
Returns truthy when item is in the mobs inventory slots, or in slot if specified.
is_confused
Whether or not the mob's confusion level is at the threshhold.
Parameters:
threshhold
(Positive Integer, default1
) - The threshhold at which the mob should be considered confused.
Returns boolean.
is_species
Determine if the mob is the supplied species by text name, species path, or species instance name
mod_confused
Modifies a mob's confused value by mod_amount
.
Parameters:
mod_amount
(Integer) - The amount to modifyconfused
by. Allows negative values for subtraction. Decimal values are rounded.floor
(Positive Integer, default0
) - The minimum value to setconfused
to. Decimal values are rounded.ceiling
(Positive Integer, defaultCONFUSED_MAX
) - The maximum value to setconfused
to. Decimal values are rounded.
Returns integer. The new value of confused
.
remove_client_color
Removes an instance of color_type from the mob's client_colors list, returning TRUE if one existed.
remove_grabs_and_pulls
Remove all grabs applied to target mob. Useful when mob is entering a compartment where they're not supposed to be grabbed.
set_confused
Sets a mob's confused value.
Parameters:
amount
(Positive Int) - The confused value to set. Decimal values are rounded.limit
(Positive Int, defaultCONFUSED_MAX
) - The maximum valueconfused
can be set to. Decimal values are rounded.
Returns integer. The new value of confused
.
set_see_in_dark
See In Dark Set Handling
set_see_invisible
See Invisible Set Handling
show_associated_bans
Aliases to _show_associated_bans()
using this mob's fetch_bans()
result, ckey, IP address, and CID.
Has no return value.
show_associated_connections
Aliases to _show_associated_connections()
using this mob's fetch_connections()
result, ckey, IP address, and CID.
Has no return value.
update_client_color
Resets the mob's client.color to null and then applies the client_colors list.
use_sanity_check
Validates the mob can perform general interactions. Primarily intended for use after inputs, sleeps, timers, etc to ensure the action can still be completed.
Parameters:
target
- The atom being interacted with.tool
- The item being used to interact. Optional. Defaults toFALSE
to differentiate between a nulled reference and an empty parameter.flags
(Bitflag, any ofSANITY_CHECK_*
, defaultSANITY_CHECK_DEFAULT
) - Bitflags of additional settings. Seecode\__defines\misc.dm
.
Returns boolean.