linear
coordinate and control movement across linked transport_controllers. allows moving large single multitile platforms and many 1 tile platforms. also is capable of linking platforms across linked z levels
Vars | |
controller_status | bitfield of various transport states |
---|---|
create_modular_set | taken from our lift platforms. if true we go through each z level of platforms and attempt to make the lowest left corner platform into one giant multitile object the size of all other platforms on that z level. |
ignored_smashthroughs | Typepath list of what to ignore smashing through, controls all lifts |
modular_set | whether the lift handled by this transport_controller datum is multitile as opposed to nxm platforms per z level |
specific_transport_id | overridable ID string to link control units to this specific transport_controller datum. created by placing a transport id landmark object somewhere on the tram, if its anywhere on the tram we'll find it in init and set this to whatever it specifies |
throw_chance | probability of being thrown hard during an emergency stop |
transport_id | transport_id taken from our base lift platform, used to put us into SStransport.transports_by_type |
transport_modules | the lift platforms we consider as part of this transport. ordered in order of lowest z level to highest z level after init. (the sorting algorithm sucks btw) |
z_sorted | lift platforms have already been sorted in order of z level. |
Procs | |
Check_lift_move | Check destination turfs |
check_for_landmarks | check for any landmarks placed inside the locs of the given transport_module |
controls_lock | Sets transport controls_locked state. Used to prevent moving mid movement, or cooldowns. |
create_modular_set_for_z_level | goes through all platforms in the given list and finds the one in the lower left corner |
finish_simple_move_wrapper | Wrap everything up from simple_move_wrapper finishing its movement |
get_platforms_on_level | returns all transport modules associated with this transport on the given z level or given atoms z level |
get_zs_we_are_on | Returns a list of all the z-levels our transport is currently on. |
link_transport_modules | Collect all bordered platforms via a simple floodfill algorithm. allows multiz trams because its funny |
move_after_delay | Moves the platform after a passed delay. |
move_lift_vertically | Moves the platform UP or DOWN, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of it moves SANELY. |
move_to_zlevel | Moves the platform to the passed z-level. |
move_transport_horizontally | Moves the platform, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of the lift moves SANELY. It also locks controls for the (miniscule) duration of the movement, so the elevator cannot be broken by spamming. |
open_lift_doors_callback | Helper used in callbacks to open all the doors our platform is on |
order_platforms_by_z_level | orders the lift platforms in order of lowest z level to highest z level. |
reset_lift_contents | resets the contents of all platforms to their original state in case someone put a bunch of shit onto the platform. intended to be called by admins. passes all arguments to reset_contents() for each of our platforms. |
return_closest_platform_to | returns the closest transport to the specified atom, prioritizing transports on the same z level. used for comparing distance |
return_closest_platform_to_z | Returns a platform on the z-level which is vertically closest to the passed target_z |
set_info_from_id_landmark | set vars and such given an overriding transport_id landmark |
simple_move_wrapper | Simple wrapper for checking if we can move 1 zlevel, and if we can, do said move. Locks controls, closes all doors, then moves the platform and re-opens the doors afterwards. |
update_lift_doors | Updates all blast doors and shutters that share an ID with our lift. |
Var Details
controller_status
bitfield of various transport states
create_modular_set
taken from our lift platforms. if true we go through each z level of platforms and attempt to make the lowest left corner platform into one giant multitile object the size of all other platforms on that z level.
ignored_smashthroughs
Typepath list of what to ignore smashing through, controls all lifts
modular_set
whether the lift handled by this transport_controller datum is multitile as opposed to nxm platforms per z level
specific_transport_id
overridable ID string to link control units to this specific transport_controller datum. created by placing a transport id landmark object somewhere on the tram, if its anywhere on the tram we'll find it in init and set this to whatever it specifies
throw_chance
probability of being thrown hard during an emergency stop
transport_id
transport_id taken from our base lift platform, used to put us into SStransport.transports_by_type
transport_modules
the lift platforms we consider as part of this transport. ordered in order of lowest z level to highest z level after init. (the sorting algorithm sucks btw)
z_sorted
lift platforms have already been sorted in order of z level.
Proc Details
Check_lift_move
Check destination turfs
check_for_landmarks
check for any landmarks placed inside the locs of the given transport_module
controls_lock
Sets transport controls_locked state. Used to prevent moving mid movement, or cooldowns.
create_modular_set_for_z_level
goes through all platforms in the given list and finds the one in the lower left corner
finish_simple_move_wrapper
Wrap everything up from simple_move_wrapper finishing its movement
get_platforms_on_level
returns all transport modules associated with this transport on the given z level or given atoms z level
get_zs_we_are_on
Returns a list of all the z-levels our transport is currently on.
link_transport_modules
Collect all bordered platforms via a simple floodfill algorithm. allows multiz trams because its funny
move_after_delay
Moves the platform after a passed delay.
This is a more "user friendly" or "realistic" move. It includes things like:
- Allowing platform "travel time"
- Shutting elevator safety doors
- Sound effects while moving
- Safety warnings for anyone below the platform (while it's moving downwards)
Arguments: duration - required, how long do we wait to move the platform? door_duration - optional, how long should we wait to open the doors after arriving? If null, we won't open or close doors direction - which direction are we moving the lift? user - optional, who is moving the lift?
move_lift_vertically
Moves the platform UP or DOWN, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of it moves SANELY.
Arguments: going - UP or DOWN directions, where the platform should go. Keep in mind by this point checks of whether it should go up or down have already been done. user - Whomever made the movement.
move_to_zlevel
Moves the platform to the passed z-level.
Checks for validity of the move: Are we moving to the same z-level, can we actually move to that z-level? Does NOT check if the controls are currently locked.
Moves to the passed z-level by calling move_after_delay repeatedly until the passed z-level is reached. This proc sleeps as it moves.
Arguments: target_z - required, the Z we want to move to loop_callback - optional, an additional callback invoked during the loop that allows the move to cancel. user - optional, who started the move
move_transport_horizontally
Moves the platform, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of the lift moves SANELY. It also locks controls for the (miniscule) duration of the movement, so the elevator cannot be broken by spamming.
open_lift_doors_callback
Helper used in callbacks to open all the doors our platform is on
order_platforms_by_z_level
orders the lift platforms in order of lowest z level to highest z level.
reset_lift_contents
resets the contents of all platforms to their original state in case someone put a bunch of shit onto the platform. intended to be called by admins. passes all arguments to reset_contents() for each of our platforms.
Arguments:
- consider_anything_past - number. if > 0 our platforms will only handle foreign contents that exceed this number in each of their locs
- foreign_objects - bool. if true our platforms will consider /atom/movable's that arent mobs as part of foreign contents
- foreign_non_player_mobs - bool. if true our platforms consider mobs that dont have a mind to be foreign
- consider_player_mobs - bool. if true our platforms consider player mobs to be foreign. only works if foreign_non_player_mobs is true as well
return_closest_platform_to
returns the closest transport to the specified atom, prioritizing transports on the same z level. used for comparing distance
return_closest_platform_to_z
Returns a platform on the z-level which is vertically closest to the passed target_z
set_info_from_id_landmark
set vars and such given an overriding transport_id landmark
simple_move_wrapper
Simple wrapper for checking if we can move 1 zlevel, and if we can, do said move. Locks controls, closes all doors, then moves the platform and re-opens the doors afterwards.
Arguments: direction - which direction are we moving? lift_move_duration - how long does the move take? can be 0 or null for instant move. door_duration - how long does it take for the doors to open after a move? user - optional, who moved it?
update_lift_doors
Updates all blast doors and shutters that share an ID with our lift.
Arguments: on_z_level - optional, only open doors on this z-level or list of z-levels action - how do we update the doors? CYCLE_OPEN to make them open, CYCLE_CLOSED to make them shut