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

tram

Tram specific variant of the generic linear transport controller.

Hierarchy The sstransport subsystem manages a list of controllers, A controller manages a list of transport modules (individual tiles) which together make up a transport unit (in this case a tram)

Vars

base_speed_limiterversion of speed_limiter that gets set in init and is considered our base speed if our lift gets slowed down
collision_lethalitymultiplier on how much damage/force the tram imparts on things it hits
controller_activewhether this controller is active (any state we don't accept new orders, not nessecarily moving)
controller_operationalwhether all required parts of the tram are considered operational
destination_platformreference to the destination landmark we consider ourselves travelling towards.
home_controllerthe home controller located in telecoms
idle_platformreference to the landmark we consider ourself stationary at.
malf_activeif the tram's next stop will be the tram malfunction event sequence
nav_beaconreference to the navigation landmark associated with this tram. since we potentially span multiple z levels we dont actually know where on us this platform is. as long as we know THAT its on us we can just move the distance and direction between this and the destination landmark.
paired_cabinetthe controller cabinet located on the tram
recovery_activate_counthow many times we moved while costing more than SStransport.max_time milliseconds per movement. if this exceeds SStransport.max_exceeding_moves
recovery_clear_counthow many times we moved while costing less than 0.5 * SStransport.max_time milliseconds per movement
recovery_modewhether we have been slowed down automatically
scheduled_movethe world.time we should next move at. in case our speed is set to less than 1 movement per tick
speed_limiterdecisecond delay between horizontal movement. cannot make the tram move faster than 1 movement per world.tick_lag.
tram_historyprevious trams that have been destroyed
tram_registrationfluff information of the tram, such as ongoing kill count and age
travel_directionif we're travelling, what direction are we going
travel_remainingif we're travelling, how far do we have to go
travel_trip_lengthhow far in total we'll be travelling

Procs

NewMake sure all modules have matching speed limiter vars, pull save data from persistence
add_transport_modulesRegister transport modules to the controller
calculate_routeCalculate the journey details to the requested platform
check_for_landmarksThe mapper should have placed the tram at one of the stations, the controller will search for a landmark within its control area and set it as its idle position.
check_starting_landmarkVerify tram is in a valid starting location, start the subsystem.
closest_nav_in_travel_dirReturns the closest tram nav beacon to an atom
crash_fxTram crash sound and visuals
cycle_doorsCycle all the doors on the tram.
degraded_stopTram comes to an in-station degraded stop, throwing the players. Caused by power loss or tram malfunction event.
dispatch_transportHandles moving the tram
end_malf_eventRemove effects of tram malfunction event.
gracefully_breakThe tram explodes if it hits a few types of objects.
halt_and_catch_fireTram comes to an emergency stop without completing its trip. Caused by emergency stop button or some catastrophic tram failure.
normal_stopTram stops normally, performs post-trip actions and updates the tram registration.
processTram processing loop
reset_positionPerforms a reset of the tram's position data by finding a predetermined reference landmark, then driving to it.
rod_collisionMoves the tram when hit by an immovable rod
set_activeSets the active status for the controller and sends a signal to listeners.
set_status_codeSets the controller status bitfield
start_malf_eventTram malfunction random event. Set comm error, requiring engineering or AI intervention.
unlock_controlsHandles unlocking the tram controls for use after moving
update_statusPart of the pre-departure list, checks the status of the doors on the tram
vv_edit_varIf someone VVs the base speed limiter of the tram, copy it to the current active speed limiter.

Var Details

base_speed_limiter

version of speed_limiter that gets set in init and is considered our base speed if our lift gets slowed down

collision_lethality

multiplier on how much damage/force the tram imparts on things it hits

controller_active

whether this controller is active (any state we don't accept new orders, not nessecarily moving)

controller_operational

whether all required parts of the tram are considered operational

destination_platform

reference to the destination landmark we consider ourselves travelling towards.

home_controller

the home controller located in telecoms

idle_platform

reference to the landmark we consider ourself stationary at.

malf_active

if the tram's next stop will be the tram malfunction event sequence

nav_beacon

reference to the navigation landmark associated with this tram. since we potentially span multiple z levels we dont actually know where on us this platform is. as long as we know THAT its on us we can just move the distance and direction between this and the destination landmark.

paired_cabinet

the controller cabinet located on the tram

recovery_activate_count

how many times we moved while costing more than SStransport.max_time milliseconds per movement. if this exceeds SStransport.max_exceeding_moves

recovery_clear_count

how many times we moved while costing less than 0.5 * SStransport.max_time milliseconds per movement

recovery_mode

whether we have been slowed down automatically

scheduled_move

the world.time we should next move at. in case our speed is set to less than 1 movement per tick

speed_limiter

decisecond delay between horizontal movement. cannot make the tram move faster than 1 movement per world.tick_lag.

tram_history

previous trams that have been destroyed

tram_registration

fluff information of the tram, such as ongoing kill count and age

travel_direction

if we're travelling, what direction are we going

travel_remaining

if we're travelling, how far do we have to go

travel_trip_length

how far in total we'll be travelling

Proc Details

New

Make sure all modules have matching speed limiter vars, pull save data from persistence

We track a few stats about it, and keep a small historical record on the information plate inside the tram.

add_transport_modules

Register transport modules to the controller

Spreads out searching neighbouring tiles for additional transport modules, to combine into one full tram. We register to every module's signal that it's collided with something, be it mob, structure, etc.

calculate_route

Calculate the journey details to the requested platform

These will eventually be passed to the transport modules as args telling them where to move. We do some sanity checking in case of discrepencany between where the subsystem thinks the tram is and where the tram actually is. (For example, moving the landmarks after round start.)

check_for_landmarks

The mapper should have placed the tram at one of the stations, the controller will search for a landmark within its control area and set it as its idle position.

check_starting_landmark

Verify tram is in a valid starting location, start the subsystem.

Throw an error if someone mapped a tram with no landmarks available for it to register. The processing subsystem starts off because not all maps have elevators/transports. Now that the tram is aware of its surroundings, we start the subsystem.

closest_nav_in_travel_dir

Returns the closest tram nav beacon to an atom

Creates a list of nav beacons in the requested direction and returns the closest to be passed to the industrial_lift

Arguments: source: the starting point to find a beacon travel_dir: travel direction in tram form, INBOUND or OUTBOUND beacon_type: what list of beacons we pull from

crash_fx

Tram crash sound and visuals

cycle_doors

Cycle all the doors on the tram.

degraded_stop

Tram comes to an in-station degraded stop, throwing the players. Caused by power loss or tram malfunction event.

dispatch_transport

Handles moving the tram

Called by the subsystem, the controller tells the individual tram parts where to actually go and has extra safety checks incase multiple inputs get through, preventing conflicting directions and the tram literally ripping itself apart. All of the actual movement is handled by SStransport.

If we're this far all the PRE_DEPARTURE checks should have passed, so we leave the PRE_DEPARTURE status and actually move. We send a signal to anything registered that cares about the physical movement of the tram.

Arguments:

end_malf_event

Remove effects of tram malfunction event.

If engineers didn't already repair the tram by the end of the event, automagically reset it remotely.

gracefully_break

The tram explodes if it hits a few types of objects.

Signal for when the tram runs into a field of which it cannot go through. Stops the train's travel fully, sends a message, and destroys the train. Arguments:

halt_and_catch_fire

Tram comes to an emergency stop without completing its trip. Caused by emergency stop button or some catastrophic tram failure.

normal_stop

Tram stops normally, performs post-trip actions and updates the tram registration.

process

Tram processing loop

Moves the tram to its set destination. When it arrives at its destination perform callback to the post-arrival procs like controls and lights. We update the odometer and kill the process until we need to move again.

If the status is EMERGENCY_STOP the tram should immediately come to a stop regardless of the travel_remaining. Some extra things happen in an emergency stop (throwing the passengers) and when reset will run a recovery procedure to head to the nearest platform and sync logical and physical location data (idle_platform and nav_beacon) once the issue is resolved.

reset_position

Performs a reset of the tram's position data by finding a predetermined reference landmark, then driving to it.

rod_collision

Moves the tram when hit by an immovable rod

Tells the individual tram parts where to actually go and has an extra safety checks incase multiple inputs get through, preventing conflicting directions and the tram literally ripping itself apart. all of the actual movement is handled by SStramprocess

Arguments: collided_rod (the immovable rod that hit the tram) Return: push_destination (the landmark /obj/effect/landmark/tram/nav that the tram is being pushed to due to the rod's trajectory)

set_active

Sets the active status for the controller and sends a signal to listeners.

The main signal used by most components, it has the active status, the bitfield of the controller's status, its direction, and set destination.

Arguments: new_status - The active status of the controller (whether it's busy doing something and not taking commands right now)

set_status_code

Sets the controller status bitfield

This status var is used by various components like lights, crossing signals, signs Sent via signal the listening components will perform required actions based on the status codes.

Arguments:

start_malf_event

Tram malfunction random event. Set comm error, requiring engineering or AI intervention.

unlock_controls

Handles unlocking the tram controls for use after moving

More safety checks to make sure the tram has actually docked properly at a location before users are allowed to interact with the tram console again. Tram finds its location at this point before fully unlocking controls to the user.

update_status

Part of the pre-departure list, checks the status of the doors on the tram

Checks if all doors are closed, and updates the status code accordingly.

TODO: this is probably better renamed check_door_status()

vv_edit_var

If someone VVs the base speed limiter of the tram, copy it to the current active speed limiter.