mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
109 lines
43 KiB
HTML
109 lines
43 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../"><link rel="stylesheet" href="dmdoc.css"><title>/datum/ai_controller - Space Station 13</title></head><body><header><a href="index.html">Space Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a> — <a href="datum/ai_controller.html#var">Var Details</a> - <a href="datum/ai_controller.html#proc">Proc Details</a></header><main><h1>ai_controller <aside>/<a href="datum.html">datum</a>/<a href="datum/ai_controller.html">ai_controller</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L10"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 10"></a></h1><p>AI controllers are a datumized form of AI that simulates the input a player
|
||
would otherwise give to a atom. What this means is that these datums have
|
||
ways of interacting with a specific atom and control it. They posses a
|
||
"blackboard" with the information the AI knows and has, and will plan actions
|
||
it will try to perform through multiple modular subtrees with behaviors.</p><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="datum/ai_controller.html#var/able_to_plan">able_to_plan</a></th><td>are we even able to plan?</td></tr><tr><th><a href="datum/ai_controller.html#var/able_to_run">able_to_run</a></th><td>TRUE if we're able to run, FALSE if we aren't
|
||
Should not be set manually, override get_able_to_run() instead
|
||
Make sure you hook update_able_to_run() in setup_able_to_run() to whatever parameters changing that you added
|
||
Otherwise we will not pay attention to them changing</td></tr><tr><th><a href="datum/ai_controller.html#var/ai_movement">ai_movement</a></th><td>Reference to the movement datum we use. Is a type on initialize but becomes a ref afterwards.</td></tr><tr><th><a href="datum/ai_controller.html#var/ai_status">ai_status</a></th><td>Current status of AI (OFF/ON)</td></tr><tr><th><a href="datum/ai_controller.html#var/ai_traits">ai_traits</a></th><td>Bitfield of traits for this AI to handle extra behavior.</td></tr><tr><th><a href="datum/ai_controller.html#var/behavior_args">behavior_args</a></th><td>Stored arguments for behaviors given during their initial creation</td></tr><tr><th><a href="datum/ai_controller.html#var/behavior_cooldowns">behavior_cooldowns</a></th><td>Current actions and their respective last time ran as an assoc list.</td></tr><tr><th><a href="datum/ai_controller.html#var/blackboard">blackboard</a></th><td>This is a list of variables the AI uses and can be mutated by actions.</td></tr><tr><th><a href="datum/ai_controller.html#var/can_idle">can_idle</a></th><td>Can this AI idle?</td></tr><tr><th><a href="datum/ai_controller.html#var/consecutive_pathing_attempts">consecutive_pathing_attempts</a></th><td>Tracks recent pathing attempts, if we fail too many in a row we fail our current plans.</td></tr><tr><th><a href="datum/ai_controller.html#var/continue_processing_when_client">continue_processing_when_client</a></th><td>Can the AI remain in control if there is a client?</td></tr><tr><th><a href="datum/ai_controller.html#var/current_behaviors">current_behaviors</a></th><td>Current actions being performed by the AI.</td></tr><tr><th><a href="datum/ai_controller.html#var/current_movement_target">current_movement_target</a></th><td>Current movement target of the AI, generally set by decision making.</td></tr><tr><th><a href="datum/ai_controller.html#var/failed_planning_cooldown">failed_planning_cooldown</a></th><td>Cooldown for new plans, to prevent AI from going nuts if it can't think of new plans and looping on end</td></tr><tr><th><a href="datum/ai_controller.html#var/idle_behavior">idle_behavior</a></th><td>The idle behavior this AI performs when it has no actions.</td></tr><tr><th><a href="datum/ai_controller.html#var/interesting_dist">interesting_dist</a></th><td>What distance should we be checking for interesting things when considering idling/deidling? Defaults to AI_DEFAULT_INTERESTING_DIST</td></tr><tr><th><a href="datum/ai_controller.html#var/max_target_distance">max_target_distance</a></th><td>Distance to give up on target.</td></tr><tr><th><a href="datum/ai_controller.html#var/movement_delay">movement_delay</a></th><td>Delay between movements. This is on the controller so we can keep the movement datum singleton</td></tr><tr><th><a href="datum/ai_controller.html#var/movement_target_source">movement_target_source</a></th><td>Identifier for what last touched our movement target, so it can be cleared conditionally</td></tr><tr><th><a href="datum/ai_controller.html#var/on_failed_planning_timeout">on_failed_planning_timeout</a></th><td>are we currently on failed planning timeout?</td></tr><tr><th><a href="datum/ai_controller.html#var/our_cells">our_cells</a></th><td>Our current cell grid.</td></tr><tr><th><a href="datum/ai_controller.html#var/paused_until">paused_until</a></th><td>AI paused time</td></tr><tr><th><a href="datum/ai_controller.html#var/pawn">pawn</a></th><td>The atom this controller is controlling.</td></tr><tr><th><a href="datum/ai_controller.html#var/planned_behaviors">planned_behaviors</a></th><td>Current actions planned to be performed by the AI in the upcoming plan.</td></tr><tr><th><a href="datum/ai_controller.html#var/planning_subtrees">planning_subtrees</a></th><td>All subtrees this AI has available. Will run them in order, so make sure
|
||
they're in the order you want them to run. On initialization of this
|
||
type, it will start as a typepath(s) and get converted to references of
|
||
ai_subtrees found in SSai_controllers when init_subtrees() is called</td></tr><tr><th><a href="datum/ai_controller.html#var/target_search_radius">target_search_radius</a></th><td>The search radius when looking for interesting things.</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="datum/ai_controller.html#proc/add_blackboard_key">add_blackboard_key</a></th><td>Adds the passed "thing" to the associated key</td></tr><tr><th><a href="datum/ai_controller.html#proc/add_blackboard_key_assoc">add_blackboard_key_assoc</a></th><td>Adds the value to the inner list at key with the inner key set to "thing"
|
||
Throws an error if the key is not a list already, intended only for use with lists</td></tr><tr><th><a href="datum/ai_controller.html#proc/add_blackboard_key_assoc_lazylist">add_blackboard_key_assoc_lazylist</a></th><td>Similar to [proc/add_blackboard_key_assoc], assuming key is intended to be a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</td></tr><tr><th><a href="datum/ai_controller.html#proc/add_blackboard_key_lazylist">add_blackboard_key_lazylist</a></th><td>Adds the passed "thing" to the associated key, assuming key is intended to be a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</td></tr><tr><th><a href="datum/ai_controller.html#proc/ai_interact">ai_interact</a></th><td>Interact with objects</td></tr><tr><th><a href="datum/ai_controller.html#proc/blackboard_key_exists">blackboard_key_exists</a></th><td>Returns true if we have a blackboard key with the provided key and it is not qdeleting.</td></tr><tr><th><a href="datum/ai_controller.html#proc/change_ai_movement_type">change_ai_movement_type</a></th><td>Overrides the current ai_movement of this controller with a new one</td></tr><tr><th><a href="datum/ai_controller.html#proc/clear_blackboard_key">clear_blackboard_key</a></th><td>Clears the passed key, resetting it to null</td></tr><tr><th><a href="datum/ai_controller.html#proc/get_able_to_run">get_able_to_run</a></th><td>Returns TRUE if the ai controller can actually run at the moment, FALSE otherwise</td></tr><tr><th><a href="datum/ai_controller.html#proc/get_access">get_access</a></th><td>Use this proc to define how your controller defines what access the pawn has for the sake of pathfinding.
|
||
Return the access list you want to use.</td></tr><tr><th><a href="datum/ai_controller.html#proc/get_expected_ai_status">get_expected_ai_status</a></th><td>Gets the AI status we expect the AI controller to be on at this current
|
||
moment. Returns<code> AI_STATUS_OFF</code> if it's inhabited by a client and shouldn't be,
|
||
if it's dead and cannot act while dead, or is on a z level without clients.
|
||
Returns AI_STATUS_ON otherwise.</td></tr><tr><th><a href="datum/ai_controller.html#proc/get_minimum_distance">get_minimum_distance</a></th><td>Returns the minimum required distance to preform one of our current behaviors.
|
||
Honestly this should just be cached or something but fuck you</td></tr><tr><th><a href="datum/ai_controller.html#proc/init_subtrees">init_subtrees</a></th><td>Loops over the subtrees in planning_subtrees and looks at the ai_controllers to grab a reference
|
||
Ensure planning_subtrees are typepaths and not instances/references before executing this!</td></tr><tr><th><a href="datum/ai_controller.html#proc/insert_blackboard_key">insert_blackboard_key</a></th><td>Similar to [proc/add_blackboard_key], but performs an insertion rather than an add
|
||
Throws an error if the key is not a list already, intended only for use with lists</td></tr><tr><th><a href="datum/ai_controller.html#proc/insert_blackboard_key_lazylist">insert_blackboard_key_lazylist</a></th><td>Similar to [proc/insert_blackboard_key_lazylist], but performs an insertion / or rather than an add</td></tr><tr><th><a href="datum/ai_controller.html#proc/on_changed_z_level">on_changed_z_level</a></th><td>Called when the AI controller pawn changes z levels.
|
||
We check if there's any clients on the new one and wake up the AI if there is.</td></tr><tr><th><a href="datum/ai_controller.html#proc/on_pawn_qdeleted">on_pawn_qdeleted</a></th><td>Turn the controller off if the pawn has been qdeleted.</td></tr><tr><th><a href="datum/ai_controller.html#proc/on_stat_changed">on_stat_changed</a></th><td>Turn the controller on or off based on if you're alive.
|
||
We only register to this if the flag is present so don't need to check again.</td></tr><tr><th><a href="datum/ai_controller.html#proc/override_blackboard_key">override_blackboard_key</a></th><td>Helper to force a key to be a certain thing no matter what's already there</td></tr><tr><th><a href="datum/ai_controller.html#proc/possess_pawn">possess_pawn</a></th><td>Proc to move from one pawn to another. This will destroy the target's existing controller.</td></tr><tr><th><a href="datum/ai_controller.html#proc/post_blackboard_key_set">post_blackboard_key_set</a></th><td>Called after we set a blackboard key, forwards signal information.</td></tr><tr><th><a href="datum/ai_controller.html#proc/process">process</a></th><td>Runs any actions that are currently running</td></tr><tr><th><a href="datum/ai_controller.html#proc/queue_behavior">queue_behavior</a></th><td>Call this to add a behavior to the stack.</td></tr><tr><th><a href="datum/ai_controller.html#proc/remove_from_blackboard_lazylist_key">remove_from_blackboard_lazylist_key</a></th><td>Removes a tracked object from a lazylist.</td></tr><tr><th><a href="datum/ai_controller.html#proc/remove_thing_from_blackboard_key">remove_thing_from_blackboard_key</a></th><td>Remove the passed thing from the associated blackboard key</td></tr><tr><th><a href="datum/ai_controller.html#proc/replace_planning_subtrees">replace_planning_subtrees</a></th><td>Completely replaces the planning_subtrees with a new set based on argument provided.
|
||
List provided must contain specifically typepaths</td></tr><tr><th><a href="datum/ai_controller.html#proc/reset_ai_status">reset_ai_status</a></th><td>Sets the AI on or off based on current conditions, call to reset after you've manually disabled it somewhere</td></tr><tr><th><a href="datum/ai_controller.html#proc/select_behaviors">select_behaviors</a></th><td>This is where you decide what actions are taken by the AI.</td></tr><tr><th><a href="datum/ai_controller.html#proc/set_ai_status">set_ai_status</a></th><td>This proc handles changing AI status, and starts/stops processing if required.</td></tr><tr><th><a href="datum/ai_controller.html#proc/set_blackboard_key">set_blackboard_key</a></th><td>Sets the key to the passed "thing".</td></tr><tr><th><a href="datum/ai_controller.html#proc/set_blackboard_key_assoc">set_blackboard_key_assoc</a></th><td>Sets the key at index thing to the passed value</td></tr><tr><th><a href="datum/ai_controller.html#proc/set_blackboard_key_assoc_lazylist">set_blackboard_key_assoc_lazylist</a></th><td>Similar to [proc/set_blackboard_key_assoc] but operates under the assumption the key is a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</td></tr><tr><th><a href="datum/ai_controller.html#proc/set_movement_target">set_movement_target</a></th><td>Sets the current movement target, with an optional param to override the movement behavior</td></tr><tr><th><a href="datum/ai_controller.html#proc/sig_remove_from_blackboard">sig_remove_from_blackboard</a></th><td>Signal proc to go through every key and remove the datum from all keys it finds.</td></tr><tr><th><a href="datum/ai_controller.html#proc/try_possess_pawn">try_possess_pawn</a></th><td>Abstract proc for initializing the pawn to the new controller</td></tr><tr><th><a href="datum/ai_controller.html#proc/unpossess_pawn">unpossess_pawn</a></th><td>Proc for deinitializing the pawn to the old controller</td></tr></table><h2 id="var">Var Details</h2><h3 id="var/able_to_plan"><aside class="declaration">var </aside>able_to_plan <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L83"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 83"></a></h3><p>are we even able to plan?</p><h3 id="var/able_to_run"><aside class="declaration">var </aside>able_to_run <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L81"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 81"></a></h3><p>TRUE if we're able to run, FALSE if we aren't
|
||
Should not be set manually, override get_able_to_run() instead
|
||
Make sure you hook update_able_to_run() in setup_able_to_run() to whatever parameters changing that you added
|
||
Otherwise we will not pay attention to them changing</p><h3 id="var/ai_movement"><aside class="declaration">var </aside>ai_movement <aside>– /<a href="datum.html">datum</a>/<a href="datum/ai_movement.html">ai_movement</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L65"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 65"></a></h3><p>Reference to the movement datum we use. Is a type on initialize but becomes a ref afterwards.</p><h3 id="var/ai_status"><aside class="declaration">var </aside>ai_status <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L35"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 35"></a></h3><p>Current status of AI (OFF/ON)</p><h3 id="var/ai_traits"><aside class="declaration">var </aside>ai_traits <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L27"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 27"></a></h3><p>Bitfield of traits for this AI to handle extra behavior.</p><h3 id="var/behavior_args"><aside class="declaration">var </aside>behavior_args <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L41"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 41"></a></h3><p>Stored arguments for behaviors given during their initial creation</p><h3 id="var/behavior_cooldowns"><aside class="declaration">var </aside>behavior_cooldowns <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L33"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 33"></a></h3><p>Current actions and their respective last time ran as an assoc list.</p><h3 id="var/blackboard"><aside class="declaration">var </aside>blackboard <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L24"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 24"></a></h3><p>This is a list of variables the AI uses and can be mutated by actions.</p>
|
||
<p>When an action is performed you pass this list and any relevant keys for
|
||
the variables it can mutate.</p>
|
||
<p>DO NOT set values in the blackboard directly, and especially not if
|
||
you're adding a datum reference to this! Use the setters, this is
|
||
important for reference handing.</p><h3 id="var/can_idle"><aside class="declaration">var </aside>can_idle <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L74"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 74"></a></h3><p>Can this AI idle?</p><h3 id="var/consecutive_pathing_attempts"><aside class="declaration">var </aside>consecutive_pathing_attempts <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L43"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 43"></a></h3><p>Tracks recent pathing attempts, if we fail too many in a row we fail our current plans.</p><h3 id="var/continue_processing_when_client"><aside class="declaration">var </aside>continue_processing_when_client <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L45"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 45"></a></h3><p>Can the AI remain in control if there is a client?</p><h3 id="var/current_behaviors"><aside class="declaration">var </aside>current_behaviors <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L31"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 31"></a></h3><p>Current actions being performed by the AI.</p><h3 id="var/current_movement_target"><aside class="declaration">var </aside>current_movement_target <aside>– /<a href="atom.html">atom</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L37"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 37"></a></h3><p>Current movement target of the AI, generally set by decision making.</p><h3 id="var/failed_planning_cooldown"><aside class="declaration">var </aside>failed_planning_cooldown <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L51"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 51"></a></h3><p>Cooldown for new plans, to prevent AI from going nuts if it can't think of new plans and looping on end</p><h3 id="var/idle_behavior"><aside class="declaration">var </aside>idle_behavior <aside>– /<a href="datum.html">datum</a>/idle_behavior</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L59"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 59"></a></h3><p>The idle behavior this AI performs when it has no actions.</p><h3 id="var/interesting_dist"><aside class="declaration">var </aside>interesting_dist <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L76"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 76"></a></h3><p>What distance should we be checking for interesting things when considering idling/deidling? Defaults to AI_DEFAULT_INTERESTING_DIST</p><h3 id="var/max_target_distance"><aside class="declaration">var </aside>max_target_distance <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L47"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 47"></a></h3><p>Distance to give up on target.</p><h3 id="var/movement_delay"><aside class="declaration">var </aside>movement_delay <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L67"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 67"></a></h3><p>Delay between movements. This is on the controller so we can keep the movement datum singleton</p><h3 id="var/movement_target_source"><aside class="declaration">var </aside>movement_target_source <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L39"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 39"></a></h3><p>Identifier for what last touched our movement target, so it can be cleared conditionally</p><h3 id="var/on_failed_planning_timeout"><aside class="declaration">var </aside>on_failed_planning_timeout <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L85"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 85"></a></h3><p>are we currently on failed planning timeout?</p><h3 id="var/our_cells"><aside class="declaration">var </aside>our_cells <aside>– /<a href="datum.html">datum</a>/<a href="datum/cell_tracker.html">cell_tracker</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L61"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 61"></a></h3><p>Our current cell grid.</p><h3 id="var/paused_until"><aside class="declaration">var </aside>paused_until <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L72"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 72"></a></h3><p>AI paused time</p><h3 id="var/pawn"><aside class="declaration">var </aside>pawn <aside>– /<a href="atom.html">atom</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L12"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 12"></a></h3><p>The atom this controller is controlling.</p><h3 id="var/planned_behaviors"><aside class="declaration">var </aside>planned_behaviors <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L29"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 29"></a></h3><p>Current actions planned to be performed by the AI in the upcoming plan.</p><h3 id="var/planning_subtrees"><aside class="declaration">var </aside>planning_subtrees <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L56"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 56"></a></h3><p>All subtrees this AI has available. Will run them in order, so make sure
|
||
they're in the order you want them to run. On initialization of this
|
||
type, it will start as a typepath(s) and get converted to references of
|
||
ai_subtrees found in SSai_controllers when init_subtrees() is called</p><h3 id="var/target_search_radius"><aside class="declaration">var </aside>target_search_radius <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L49"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 49"></a></h3><p>The search radius when looking for interesting things.</p><h2 id="proc">Proc Details</h2><h3 id="proc/add_blackboard_key"><aside class="declaration">proc </aside>add_blackboard_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L809"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 809"></a></aside></h3><p>Adds the passed "thing" to the associated key</p>
|
||
<p>Works with lists or numbers, but not lazylists.</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/add_blackboard_key_assoc"><aside class="declaration">proc </aside>add_blackboard_key_assoc<aside>(key, thing, value) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L857"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 857"></a></aside></h3><p>Adds the value to the inner list at key with the inner key set to "thing"
|
||
Throws an error if the key is not a list already, intended only for use with lists</p>
|
||
<ul>
|
||
<li>key - A blackboard key, with its value set to a list</li>
|
||
<li>thing - a value which becomes the inner list value's key</li>
|
||
<li>value - what to set the inner list's value to</li>
|
||
</ul><h3 id="proc/add_blackboard_key_assoc_lazylist"><aside class="declaration">proc </aside>add_blackboard_key_assoc_lazylist<aside>(key, thing, value) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L872"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 872"></a></aside></h3><p>Similar to [proc/add_blackboard_key_assoc], assuming key is intended to be a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</p>
|
||
<ul>
|
||
<li>key - A blackboard key, with its value set to a list</li>
|
||
<li>thing - a value which becomes the inner list value's key</li>
|
||
<li>value - what to set the inner list's value to</li>
|
||
</ul><h3 id="proc/add_blackboard_key_lazylist"><aside class="declaration">proc </aside>add_blackboard_key_lazylist<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L833"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 833"></a></aside></h3><p>Adds the passed "thing" to the associated key, assuming key is intended to be a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/ai_interact"><aside class="declaration">proc </aside>ai_interact<aside>(target, intent, /list/modifiers) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L379"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 379"></a></aside></h3><p>Interact with objects</p><h3 id="proc/blackboard_key_exists"><aside class="declaration">proc </aside>blackboard_key_exists<aside>(key) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L669"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 669"></a></aside></h3><p>Returns true if we have a blackboard key with the provided key and it is not qdeleting.</p><h3 id="proc/change_ai_movement_type"><aside class="declaration">proc </aside>change_ai_movement_type<aside>(/<a href="datum.html">datum</a>/<a href="datum/ai_movement.html">ai_movement</a>/new_movement) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L131"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 131"></a></aside></h3><p>Overrides the current ai_movement of this controller with a new one</p><h3 id="proc/clear_blackboard_key"><aside class="declaration">proc </aside>clear_blackboard_key<aside>(key) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L885"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 885"></a></aside></h3><p>Clears the passed key, resetting it to null</p>
|
||
<p>Not intended for use with list keys - use [proc/remove_thing_from_blackboard_key] if you are removing a value from a list at a key</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
</ul><h3 id="proc/get_able_to_run"><aside class="declaration">proc </aside>get_able_to_run<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L367"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 367"></a></aside></h3><p>Returns TRUE if the ai controller can actually run at the moment, FALSE otherwise</p><h3 id="proc/get_access"><aside class="declaration">proc </aside>get_access<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L644"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 644"></a></aside></h3><p>Use this proc to define how your controller defines what access the pawn has for the sake of pathfinding.
|
||
Return the access list you want to use.</p><h3 id="proc/get_expected_ai_status"><aside class="declaration">proc </aside>get_expected_ai_status<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L281"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 281"></a></aside></h3><p>Gets the AI status we expect the AI controller to be on at this current
|
||
moment. Returns<code> AI_STATUS_OFF</code> if it's inhabited by a client and shouldn't be,
|
||
if it's dead and cannot act while dead, or is on a z level without clients.
|
||
Returns AI_STATUS_ON otherwise.</p><h3 id="proc/get_minimum_distance"><aside class="declaration">proc </aside>get_minimum_distance<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L649"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 649"></a></aside></h3><p>Returns the minimum required distance to preform one of our current behaviors.
|
||
Honestly this should just be cached or something but fuck you</p><h3 id="proc/init_subtrees"><aside class="declaration">proc </aside>init_subtrees<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L142"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 142"></a></aside></h3><p>Loops over the subtrees in planning_subtrees and looks at the ai_controllers to grab a reference
|
||
Ensure planning_subtrees are typepaths and not instances/references before executing this!</p><h3 id="proc/insert_blackboard_key"><aside class="declaration">proc </aside>insert_blackboard_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L820"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 820"></a></aside></h3><p>Similar to [proc/add_blackboard_key], but performs an insertion rather than an add
|
||
Throws an error if the key is not a list already, intended only for use with lists</p>
|
||
<ul>
|
||
<li>key - A blackboard key, with its value set to a list</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/insert_blackboard_key_lazylist"><aside class="declaration">proc </aside>insert_blackboard_key_lazylist<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L844"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 844"></a></aside></h3><p>Similar to [proc/insert_blackboard_key_lazylist], but performs an insertion / or rather than an add</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/on_changed_z_level"><aside class="declaration">proc </aside>on_changed_z_level<aside>(/<a href="atom.html">atom</a>/source, /<a href="turf.html">turf</a>/old_turf, /<a href="turf.html">turf</a>/new_turf, same_z_layer, notify_contents) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L311"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 311"></a></aside></h3><p>Called when the AI controller pawn changes z levels.
|
||
We check if there's any clients on the new one and wake up the AI if there is.</p><h3 id="proc/on_pawn_qdeleted"><aside class="declaration">proc </aside>on_pawn_qdeleted<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L635"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 635"></a></aside></h3><p>Turn the controller off if the pawn has been qdeleted.</p><h3 id="proc/on_stat_changed"><aside class="declaration">proc </aside>on_stat_changed<aside>(/<a href="mob.html">mob</a>/<a href="mob/living.html">living</a>/source, new_stat) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L609"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 609"></a></aside></h3><p>Turn the controller on or off based on if you're alive.
|
||
We only register to this if the flag is present so don't need to check again.</p><h3 id="proc/override_blackboard_key"><aside class="declaration">proc </aside>override_blackboard_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L746"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 746"></a></aside></h3><p>Helper to force a key to be a certain thing no matter what's already there</p>
|
||
<p>Useful for if you're overriding a list with a new list entirely,
|
||
as otherwise it would throw a runtime error from trying to override a list</p>
|
||
<p>Not necessary to use if you aren't dealing with lists, as set_blackboard_key will clear the existing value
|
||
in that case already, but may be useful for clarity.</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/possess_pawn"><aside class="declaration">proc </aside>possess_pawn<aside>(/<a href="atom.html">atom</a>/new_pawn) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L153"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 153"></a></aside></h3><p>Proc to move from one pawn to another. This will destroy the target's existing controller.</p><h3 id="proc/post_blackboard_key_set"><aside class="declaration">proc </aside>post_blackboard_key_set<aside>(key) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L796"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 796"></a></aside></h3><p>Called after we set a blackboard key, forwards signal information.</p><h3 id="proc/process">process<aside>(seconds_per_tick) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L400"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 400"></a></aside></h3><p>Runs any actions that are currently running</p><h3 id="proc/queue_behavior"><aside class="declaration">proc </aside>queue_behavior<aside>(behavior_type, ...) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L520"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 520"></a></aside></h3><p>Call this to add a behavior to the stack.</p><h3 id="proc/remove_from_blackboard_lazylist_key"><aside class="declaration">proc </aside>remove_from_blackboard_lazylist_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L931"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 931"></a></aside></h3><p>Removes a tracked object from a lazylist.</p><h3 id="proc/remove_thing_from_blackboard_key"><aside class="declaration">proc </aside>remove_thing_from_blackboard_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L904"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 904"></a></aside></h3><p>Remove the passed thing from the associated blackboard key</p>
|
||
<p>Intended for use with lists, if you're just clearing a reference from a key use [proc/clear_blackboard_key]</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/replace_planning_subtrees"><aside class="declaration">proc </aside>replace_planning_subtrees<aside>(/list/typepaths_of_new_subtrees) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L136"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 136"></a></aside></h3><p>Completely replaces the planning_subtrees with a new set based on argument provided.
|
||
List provided must contain specifically typepaths</p><h3 id="proc/reset_ai_status"><aside class="declaration">proc </aside>reset_ai_status<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L272"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 272"></a></aside></h3><p>Sets the AI on or off based on current conditions, call to reset after you've manually disabled it somewhere</p><h3 id="proc/select_behaviors"><aside class="declaration">proc </aside>select_behaviors<aside>(seconds_per_tick) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L445"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 445"></a></aside></h3><p>This is where you decide what actions are taken by the AI.</p><h3 id="proc/set_ai_status"><aside class="declaration">proc </aside>set_ai_status<aside>(new_ai_status, additional_flags) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L464"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 464"></a></aside></h3><p>This proc handles changing AI status, and starts/stops processing if required.</p><h3 id="proc/set_blackboard_key"><aside class="declaration">proc </aside>set_blackboard_key<aside>(key, thing) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L718"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 718"></a></aside></h3><p>Sets the key to the passed "thing".</p>
|
||
<ul>
|
||
<li>key - A blackboard key</li>
|
||
<li>thing - a value to set the blackboard key to.</li>
|
||
</ul><h3 id="proc/set_blackboard_key_assoc"><aside class="declaration">proc </aside>set_blackboard_key_assoc<aside>(key, thing, value) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L762"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 762"></a></aside></h3><p>Sets the key at index thing to the passed value</p>
|
||
<p>Assumes the key value is already a list, if not throws an error.</p>
|
||
<ul>
|
||
<li>key - A blackboard key, with its value set to a list</li>
|
||
<li>thing - a value which becomes the inner list value's key</li>
|
||
<li>value - what to set the inner list's value to</li>
|
||
</ul><h3 id="proc/set_blackboard_key_assoc_lazylist"><aside class="declaration">proc </aside>set_blackboard_key_assoc_lazylist<aside>(key, thing, value) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L782"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 782"></a></aside></h3><p>Similar to [proc/set_blackboard_key_assoc] but operates under the assumption the key is a lazylist (so it will create a list)
|
||
More dangerous / easier to override values, only use when you want to use a lazylist</p>
|
||
<ul>
|
||
<li>key - A blackboard key, with its value set to a list</li>
|
||
<li>thing - a value which becomes the inner list value's key</li>
|
||
<li>value - what to set the inner list's value to</li>
|
||
</ul><h3 id="proc/set_movement_target"><aside class="declaration">proc </aside>set_movement_target<aside>(source, /<a href="atom.html">atom</a>/target, /<a href="datum.html">datum</a>/<a href="datum/ai_movement.html">ai_movement</a>/new_movement) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L115"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 115"></a></aside></h3><p>Sets the current movement target, with an optional param to override the movement behavior</p><h3 id="proc/sig_remove_from_blackboard"><aside class="declaration">proc </aside>sig_remove_from_blackboard<aside>(/<a href="datum.html">datum</a>/source) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L944"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 944"></a></aside></h3><p>Signal proc to go through every key and remove the datum from all keys it finds.</p><h3 id="proc/try_possess_pawn"><aside class="declaration">proc </aside>try_possess_pawn<aside>(/<a href="atom.html">atom</a>/new_pawn) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L325"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 325"></a></aside></h3><p>Abstract proc for initializing the pawn to the new controller</p><h3 id="proc/unpossess_pawn"><aside class="declaration">proc </aside>unpossess_pawn<aside>(destroy) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/datums/ai/ai_controller.dm#L329"><img src="git.png" width="16" height="16" title="code/datums/ai/ai_controller.dm 329"></a></aside></h3><p>Proc for deinitializing the pawn to the old controller</p></main><footer>paradise.dme <a href="https://github.com/ParadiseSS13/Paradise/tree/8a8a00a2a9bec485351e5f219982b7315d3504fa">8a8a00a</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.11.0</a></footer></body></html> |