Files
Paradise/datum/move_manager.html

138 lines
24 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../"><link rel="stylesheet" href="dmdoc.css"><title>/datum/move_manager - 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/move_manager.html#proc">Proc Details</a></header><main><h1>move_manager <aside>/<a href="datum.html">datum</a>/<a href="datum/move_manager.html">move_manager</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/datums/move_manager.dm#L23"><img src="git.png" width="16" height="16" title="code/datums/move_manager.dm 23"></a></h1><p>Acts as a namespace for movement packet/type related procs</p>
<p>Exists to provide an in code implementation of movement looping
Replaces things like walk() or walk_to(), among others</p>
<p>Because we're doing things in engine, we have a lot more control over how different operations are performed
We also get more say in when things happen, so we can subject movements to the whims of the master controller
Rather then using a fuck ton of cpu just moving mobs or meteors</p>
<p>The goal is to keep the loops themselves reasonably barebone, and implement more advanced behavior and control via the signals</p>
<p>This may be bypassed in cases where snowflakes are nessesary, or where performance is important. S not a hard and fast thing</p>
<p>Every atom can have a movement packet, which contains information and behavior about currently active loops, and queuing info
Loops control how movement actually happens. So there's a &quot;move in this direction&quot; loop, a &quot;move randomly&quot; loop</p>
<p>You can find the logic for this control in this file</p>
<p>Specifics of how different loops operate can be found in the movement_types.dm file, alongside the <a href="datum/move_manager.html#proc/add_to_loop" title="/datum/move_manager">add to loop</a> helper procs that use them</p><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="datum/move_manager.html#proc/add_to_loop">add_to_loop</a></th><td>Adds a movable thing to a movement subsystem. Returns TRUE if it all worked, FALSE if it failed somehow</td></tr><tr><th><a href="datum/move_manager.html#proc/astar_move">astar_move</a></th><td>Used for following A* defined paths.</td></tr><tr><th><a href="datum/move_manager.html#proc/freeze">freeze</a></th><td>Assigns a target to a move loop that immediately freezes for a set duration of time.</td></tr><tr><th><a href="datum/move_manager.html#proc/home_onto">home_onto</a></th><td>Helper proc for homing onto something with move_towards</td></tr><tr><th><a href="datum/move_manager.html#proc/jps_move">jps_move</a></th><td>Used for following jps defined paths. The proc signature here's a bit long, I'm sorry</td></tr><tr><th><a href="datum/move_manager.html#proc/move">move</a></th><td>Replacement for walk()</td></tr><tr><th><a href="datum/move_manager.html#proc/move_away">move_away</a></th><td>Wrapper around GLOB.move_manager.move_away()</td></tr><tr><th><a href="datum/move_manager.html#proc/move_rand">move_rand</a></th><td>Helper proc for the move_rand datum</td></tr><tr><th><a href="datum/move_manager.html#proc/move_to">move_to</a></th><td>Wrapper around walk_to()</td></tr><tr><th><a href="datum/move_manager.html#proc/move_to_rand">move_to_rand</a></th><td>Wrapper around walk_rand(), doesn't actually result in a random walk, it's more like moving to random places in viewish</td></tr><tr><th><a href="datum/move_manager.html#proc/move_towards">move_towards</a></th><td>Helper proc for the move_towards datum</td></tr><tr><th><a href="datum/move_manager.html#proc/move_towards_legacy">move_towards_legacy</a></th><td>Alternative to GLOB.move_manager.home_onto. Not reccomended, as it ends up putting a kink in the movement path if it's not directly along one of the 8 directions.</td></tr><tr><th><a href="datum/move_manager.html#proc/processing_on">processing_on</a></th><td>Returns the subsystem's loop if we're processing on it, null otherwise</td></tr><tr><th><a href="datum/move_manager.html#proc/stop_looping">stop_looping</a></th><td>Removes the atom from some movement subsystem. Defaults to SSmovement</td></tr><tr><th><a href="datum/move_manager.html#proc/ventcrawl">ventcrawl</a></th><td>Used for getting to a vent in a connected pipeline when ventcrawling.</td></tr></table><h2 id="proc">Proc Details</h2><h3 id="proc/add_to_loop"><aside class="declaration">proc </aside>add_to_loop<aside>(/<a href="atom.html">atom</a>/<a href="atom/movable.html">movable</a>/thing_to_add, /<a href="datum.html">datum</a>/<a href="datum/controller.html">controller</a>/<a href="datum/controller/subsystem.html">subsystem</a>/<a href="datum/controller/subsystem/movement.html">movement</a>/subsystem, /<a href="datum.html">datum</a>/<a href="datum/move_loop.html">move_loop</a>/loop_type, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/datums/move_manager.dm#L28"><img src="git.png" width="16" height="16" title="code/datums/move_manager.dm 28"></a></aside></h3><p>Adds a movable thing to a movement subsystem. Returns TRUE if it all worked, FALSE if it failed somehow</p><h3 id="proc/astar_move"><aside class="declaration">proc </aside>astar_move<aside>(moving, chasing, delay, timeout, repath_delay, max_path_length, minimum_distance, /list/access, simulated_only, /<a href="turf.html">turf</a>/avoid, skip_first, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info, initial_path, use_diagonals, /<a href="datum.html">datum</a>/callback/heuristic) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L432"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 432"></a></aside></h3><p>Used for following A* defined paths.</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
repath_delay - How often we're allowed to recalculate our path
max_path_length - The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
miminum_distance - Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example
id - An ID card representing what access we have and what doors we can open
simulated_only - Whether we consider turfs without atmos simulation (AKA do we want to ignore space)
avoid - If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
skip_first - Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break things
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check _DEFINES/movement.dm</p><h3 id="proc/freeze"><aside class="declaration">proc </aside>freeze<aside>(moving, halted_turf, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L931"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 931"></a></aside></h3><p>Assigns a target to a move loop that immediately freezes for a set duration of time.</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
halted_turf - The turf we want to freeze on. This should typically be the loc of moving.
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. This should be considered extremely non-optional as it will completely stun out the movement loop <i>forever</i> if unset.
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/home_onto"><aside class="declaration">proc </aside>home_onto<aside>(moving, chasing, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L758"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 758"></a></aside></h3><p>Helper proc for homing onto something with move_towards</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
home - Should we move towards the object at all times? Or launch towards them, but allow walls and such to take us off track. Defaults to FALSE
timeout - Time in deci-seconds until the moveloop self expires. Defaults to INFINITY
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/jps_move"><aside class="declaration">proc </aside>jps_move<aside>(moving, chasing, delay, timeout, repath_delay, max_path_length, minimum_distance, /list/access, simulated_only, /<a href="turf.html">turf</a>/avoid, skip_first, subsystem, diagonal_handling, priority, flags, /<a href="datum.html">datum</a>/extra_info, initial_path) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L269"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 269"></a></aside></h3><p>Used for following jps defined paths. The proc signature here's a bit long, I'm sorry</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
repath_delay - How often we're allowed to recalculate our path
max_path_length - The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
miminum_distance - Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example
access - A list representing what access we have and what doors we can open
simulated_only - Whether we consider turfs without atmos simulation (AKA do we want to ignore space)
avoid - If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
skip_first - Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break things
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move"><aside class="declaration">proc </aside>move<aside>(moving, direction, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L189"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 189"></a></aside></h3><p>Replacement for walk()</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
direction - The direction we want to move in
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_away"><aside class="declaration">proc </aside>move_away<aside>(moving, chasing, max_dist, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L701"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 701"></a></aside></h3><p>Wrapper around GLOB.move_manager.move_away()</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
max_dist - the furthest away from the target we're allowed to get
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_rand"><aside class="declaration">proc </aside>move_rand<aside>(moving, directions, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L955"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 955"></a></aside></h3><p>Helper proc for the move_rand datum</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
directions - A list of acceptable directions to try and move in. Defaults to GLOB.alldirs
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_to"><aside class="declaration">proc </aside>move_to<aside>(moving, chasing, min_dist, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L664"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 664"></a></aside></h3><p>Wrapper around walk_to()</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
min_dist - the closest we're allower to get to the target
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_to_rand"><aside class="declaration">proc </aside>move_to_rand<aside>(moving, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L1010"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 1010"></a></aside></h3><p>Wrapper around walk_rand(), doesn't actually result in a random walk, it's more like moving to random places in viewish</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_towards"><aside class="declaration">proc </aside>move_towards<aside>(moving, chasing, delay, home, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L739"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 739"></a></aside></h3><p>Helper proc for the move_towards datum</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
home - Should we move towards the object at all times? Or launch towards them, but allow walls and such to take us off track. Defaults to FALSE
timeout - Time in deci-seconds until the moveloop self expires. Defaults to INFINITY
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/move_towards_legacy"><aside class="declaration">proc </aside>move_towards_legacy<aside>(moving, chasing, delay, timeout, subsystem, priority, flags, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L902"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 902"></a></aside></h3><p>Alternative to GLOB.move_manager.home_onto. Not reccomended, as it ends up putting a kink in the movement path if it's not directly along one of the 8 directions.</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p><h3 id="proc/processing_on"><aside class="declaration">proc </aside>processing_on<aside>(/<a href="atom.html">atom</a>/<a href="atom/movable.html">movable</a>/packet_owner, /<a href="datum.html">datum</a>/<a href="datum/controller.html">controller</a>/<a href="datum/controller/subsystem.html">subsystem</a>/<a href="datum/controller/subsystem/movement.html">movement</a>/subsystem) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/datums/move_manager.dm#L37"><img src="git.png" width="16" height="16" title="code/datums/move_manager.dm 37"></a></aside></h3><p>Returns the subsystem's loop if we're processing on it, null otherwise</p><h3 id="proc/stop_looping"><aside class="declaration">proc </aside>stop_looping<aside>(/<a href="atom.html">atom</a>/<a href="atom/movable.html">movable</a>/moving, /<a href="datum.html">datum</a>/<a href="datum/controller.html">controller</a>/<a href="datum/controller/subsystem.html">subsystem</a>/<a href="datum/controller/subsystem/movement.html">movement</a>/subsystem) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L168"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 168"></a></aside></h3><p>Removes the atom from some movement subsystem. Defaults to SSmovement</p><h3 id="proc/ventcrawl"><aside class="declaration">proc </aside>ventcrawl<aside>(moving, chasing, delay, timeout, subsystem, priority, flags, skip_first, /<a href="datum.html">datum</a>/extra_info) <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/controllers/subsystem/movement/movement_types.dm#L1041"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/movement/movement_types.dm 1041"></a></aside></h3><p>Used for getting to a vent in a connected pipeline when ventcrawling.</p>
<p>Returns TRUE if the loop sucessfully started, or FALSE if it failed</p>
<p>Arguments:
moving - The atom we want to move
chasing - The atom we want to move towards
min_dist - the closest we're allower to get to the target
delay - How many deci-seconds to wait between fires. Defaults to the lowest value, 0.1
timeout - Time in deci-seconds until the moveloop self expires. Defaults to infinity
subsystem - The movement subsystem to use. Defaults to SSmovement. Only one loop can exist for any one subsystem
priority - Defines how different move loops override each other. Lower numbers beat higher numbers, equal defaults to what currently exists. Defaults to MOVEMENT_DEFAULT_PRIORITY
flags - Set of bitflags that effect move loop behavior in some way. Check __DEFINES/movement_defines.dm</p></main><footer>paradise.dme <a href="https://github.com/ParadiseSS13/Paradise/tree/edee60476d21ee840643bd1abe7f6003a8c65773">edee604</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.11.0</a></footer></body></html>