/tg/ Station 13 - Modules - TypesVar Details - Proc Details

lift_master

coordinate and control movement across linked industrial_lift's. allows moving large single multitile platforms and many 1 tile platforms. also is capable of linking platforms across linked z levels

Vars

controls_lockedif true, the lift cannot be manually moved.
create_multitile_platformtaken 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_smashthroughsTypepath list of what to ignore smashing through, controls all lifts
lift_idlift_id taken from our base lift platform, used to put us into GLOB.active_lifts_by_type
lift_platformsthe lift platforms we consider as part of this lift. ordered in order of lowest z level to highest z level after init. (the sorting algorithm sucks btw)
multitile_platformwhether the lift handled by this lift_master datum is multitile as opposed to nxm platforms per z level
specific_lift_idoverridable ID string to link control units to this specific lift_master datum. created by placing a lift 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
z_sortedlift platforms have already been sorted in order of z level.

Procs

Check_lift_moveCheck destination turfs
Rebuild_lift_plaformCollect all bordered platforms via a simple floodfill algorithm. allows multiz trams because its funny
check_for_landmarkscheck for any landmarks placed inside the locs of the given lift_platform
create_multitile_platform_for_z_levelgoes through all platforms in the given list and finds the one in the lower left corner
finish_simple_move_wrapperWrap everything up from simple_move_wrapper finishing its movement
get_platforms_on_levelreturns all industrial_lifts associated with this tram on the given z level or given atoms z level
get_zs_we_are_onReturns a list of all the z-levels our lift is currently on.
move_after_delayMoves the lift after a passed delay.
move_lift_horizontallyMoves the lift, 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.
move_lift_verticallyMoves the lift UP or DOWN, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of the lift moves SANELY.
move_to_zlevelMoves the lift to the passed z-level.
open_lift_doors_callbackHelper used in callbacks to open all the doors our lift is on
order_platforms_by_z_levelorders the lift platforms in order of lowest z level to highest z level.
reset_lift_contentsresets the contents of all platforms to their original state in case someone put a bunch of shit onto the tram. intended to be called by admins. passes all arguments to reset_contents() for each of our platforms.
return_closest_platform_toreturns the closest lift to the specified atom, prioritizing lifts on the same z level. used for comparing distance
return_closest_platform_to_zReturns a lift platform on the z-level which is vertically closest to the passed target_z
set_controlsSets all lift parts's controls_locked variable. Used to prevent moving mid movement, or cooldowns.
set_info_from_id_landmarkset vars and such given an overriding lift_id landmark
simple_move_wrapperSimple wrapper for checking if we can move 1 zlevel, and if we can, do said move. Locks controls, closes all doors, then moves the lift and re-opens the doors afterwards.
update_lift_doorsUpdates all blast doors and shutters that share an ID with our lift.

Var Details

controls_locked

if true, the lift cannot be manually moved.

create_multitile_platform

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

lift_id

lift_id taken from our base lift platform, used to put us into GLOB.active_lifts_by_type

lift_platforms

the lift platforms we consider as part of this lift. ordered in order of lowest z level to highest z level after init. (the sorting algorithm sucks btw)

multitile_platform

whether the lift handled by this lift_master datum is multitile as opposed to nxm platforms per z level

specific_lift_id

overridable ID string to link control units to this specific lift_master datum. created by placing a lift 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

z_sorted

lift platforms have already been sorted in order of z level.

Proc Details

Check_lift_move

Check destination turfs

Rebuild_lift_plaform

Collect all bordered platforms via a simple floodfill algorithm. allows multiz trams because its funny

check_for_landmarks

check for any landmarks placed inside the locs of the given lift_platform

create_multitile_platform_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 industrial_lifts associated with this tram on the given z level or given atoms z level

get_zs_we_are_on

Returns a list of all the z-levels our lift is currently on.

move_after_delay

Moves the lift after a passed delay.

This is a more "user friendly" or "realistic" lift move. It includes things like:

Arguments: duration - required, how long do we wait to move the lift? 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_horizontally

Moves the lift, 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.

move_lift_vertically

Moves the lift UP or DOWN, this is what users invoke with their hand. This is a SAFE proc, ensuring every part of the lift moves SANELY.

Arguments: going - UP or DOWN directions, where the lift 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 lift movement.

move_to_zlevel

Moves the lift 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 lift 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 l oop that allows the move to cancel. user - optional, who started the move

open_lift_doors_callback

Helper used in callbacks to open all the doors our lift 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 tram. intended to be called by admins. passes all arguments to reset_contents() for each of our platforms.

Arguments:

return_closest_platform_to

returns the closest lift to the specified atom, prioritizing lifts on the same z level. used for comparing distance

return_closest_platform_to_z

Returns a lift platform on the z-level which is vertically closest to the passed target_z

set_controls

Sets all lift parts's controls_locked variable. Used to prevent moving mid movement, or cooldowns.

set_info_from_id_landmark

set vars and such given an overriding lift_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 lift 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? OPEN_DOORS to make them open, CLOSE_DOORS to make them shut