riding ![code/datums/components/riding/riding.dm 8](git.png)
This is the riding component, which is applied to a movable atom by the ridable element when a mob is successfully buckled to said movable.
This component lives for as long as at least one mob is buckled to the parent. Once all mobs are unbuckled, the component is deleted, until another mob is buckled in and we make a new riding component, so on and so forth until the sun explodes.
Vars | |
allowed_turf_typecache | allow typecache for only certain turfs, forbid to allow all but those. allow only certain turfs will take precedence. |
---|---|
can_force_unbuckle | can anyone other than the rider unbuckle the rider? |
directional_vehicle_layers | ["[DIRECTION]"] = layer. Don't set it for a direction for default, set a direction to null for no change. |
directional_vehicle_offsets | same as above but instead of layer you have a list(px, py) |
forbid_turf_typecache | allow typecache for only certain turfs, forbid to allow all but those. allow only certain turfs will take precedence. |
keytype | If the driver needs a certain item in hand (or inserted, for vehicles) to drive this. For vehicles, this must be duplicated on the actual vehicle object in their [/obj/vehicle/var/key_type] variable because the vehicle objects still have a few special checks/functions of their own I'm not porting over to the riding component quite yet. Make sure if you define it on the vehicle, you define it here too. |
message_cooldown | For telling someone they can't drive |
override_allow_spacemove | We don't need roads where we're going if this is TRUE, allow normal movement in space tiles |
ride_check_flags | Ride check flags defined for the specific riding component types, so we know if we need arms, legs, or whatever. Takes additional flags from the ridable element and the buckle proc (buckle_mob_flags) for riding cyborgs/humans in case we need to reserve arms |
riding_offsets | position_of_user = list(dir = list(px, py)), or RIDING_OFFSET_ALL for a generic one. |
vehicle_move_cooldown | For telling someone they can't drive |
vehicle_move_delay | Tick delay between movements, lower = faster, higher = slower |
Procs | |
driver_move | Every time the driver tries to move, this is called to see if they can actually drive and move the vehicle (via relaymove) |
handle_specials | This proc handles all of the proc calls to things like set_vehicle_dir_layer() that a type of riding datum needs to call on creation |
handle_vehicle_layer | Some ridable atoms may want to only show on top of the rider in certain directions, like wheelchairs |
keycheck | This proc is used to see if we have the appropriate key to drive this atom, if such a key is needed. Returns FALSE if we don't have what we need to drive. |
on_rider_try_pull | This proc is called when the rider attempts to grab something, preventing them from doing so. |
ride_check | Check to see if we have all of the necessary bodyparts and not-falling-over statuses we need to stay onboard. If not and if consequences is TRUE, well, there'll be consequences. |
unequip_buckle_inhands | currently replicated from ridable because we need this behavior here too, see if we can deal with that |
vehicle_bump | So we can check all occupants when we bump a door to see if anyone has access |
vehicle_mob_buckle | This proc is called when a rider buckles, allowing for offsets to be set properly |
vehicle_mob_unbuckle | This proc is called when a rider unbuckles, whether they chose to or not. If there's no more riders, this will be the riding component's death knell. |
vehicle_moved | This is called after the ridden atom is successfully moved and is used to handle icon stuff |
vehicle_turned | Turning is like moving |
Var Details
allowed_turf_typecache ![code/datums/components/riding/riding.dm 29](git.png)
allow typecache for only certain turfs, forbid to allow all but those. allow only certain turfs will take precedence.
can_force_unbuckle ![code/datums/components/riding/riding.dm 35](git.png)
can anyone other than the rider unbuckle the rider?
directional_vehicle_layers ![code/datums/components/riding/riding.dm 25](git.png)
["[DIRECTION]"] = layer. Don't set it for a direction for default, set a direction to null for no change.
directional_vehicle_offsets ![code/datums/components/riding/riding.dm 27](git.png)
same as above but instead of layer you have a list(px, py)
forbid_turf_typecache ![code/datums/components/riding/riding.dm 31](git.png)
allow typecache for only certain turfs, forbid to allow all but those. allow only certain turfs will take precedence.
keytype ![code/datums/components/riding/riding.dm 20](git.png)
If the driver needs a certain item in hand (or inserted, for vehicles) to drive this. For vehicles, this must be duplicated on the actual vehicle object in their [/obj/vehicle/var/key_type] variable because the vehicle objects still have a few special checks/functions of their own I'm not porting over to the riding component quite yet. Make sure if you define it on the vehicle, you define it here too.
message_cooldown ![code/datums/components/riding/riding.dm 43](git.png)
For telling someone they can't drive
override_allow_spacemove ![code/datums/components/riding/riding.dm 33](git.png)
We don't need roads where we're going if this is TRUE, allow normal movement in space tiles
ride_check_flags ![code/datums/components/riding/riding.dm 41](git.png)
Ride check flags defined for the specific riding component types, so we know if we need arms, legs, or whatever. Takes additional flags from the ridable element and the buckle proc (buckle_mob_flags) for riding cyborgs/humans in case we need to reserve arms
riding_offsets ![code/datums/components/riding/riding.dm 23](git.png)
position_of_user = list(dir = list(px, py)), or RIDING_OFFSET_ALL for a generic one.
vehicle_move_cooldown ![code/datums/components/riding/riding.dm 45](git.png)
For telling someone they can't drive
vehicle_move_delay ![code/datums/components/riding/riding.dm 13](git.png)
Tick delay between movements, lower = faster, higher = slower
Proc Details
driver_move
Every time the driver tries to move, this is called to see if they can actually drive and move the vehicle (via relaymove)
handle_specials
This proc handles all of the proc calls to things like set_vehicle_dir_layer() that a type of riding datum needs to call on creation
The original riding component had these procs all called from the ridden object itself through the use of GetComponent() and LoadComponent() This was obviously problematic for componentization, but while lots of the variables being set were able to be moved to component variables, the proc calls couldn't be. Thus, anything that has to do an initial proc call should be handled here.
handle_vehicle_layer
Some ridable atoms may want to only show on top of the rider in certain directions, like wheelchairs
keycheck
This proc is used to see if we have the appropriate key to drive this atom, if such a key is needed. Returns FALSE if we don't have what we need to drive.
Still needs to be neatened up and spruced up with proper OOP, as a result of vehicles having their own key handling from other ridable atoms
on_rider_try_pull
This proc is called when the rider attempts to grab something, preventing them from doing so.
ride_check
Check to see if we have all of the necessary bodyparts and not-falling-over statuses we need to stay onboard. If not and if consequences is TRUE, well, there'll be consequences.
unequip_buckle_inhands
currently replicated from ridable because we need this behavior here too, see if we can deal with that
vehicle_bump
So we can check all occupants when we bump a door to see if anyone has access
vehicle_mob_buckle
This proc is called when a rider buckles, allowing for offsets to be set properly
vehicle_mob_unbuckle
This proc is called when a rider unbuckles, whether they chose to or not. If there's no more riders, this will be the riding component's death knell.
vehicle_moved
This is called after the ridden atom is successfully moved and is used to handle icon stuff
vehicle_turned
Turning is like moving