Rideable vehicles from the Prop Builder. What This Module Does
Aboard a vehicle ($gamePlayer._vehicleType === "reactor") on a 3D map the
player is moved freely: a place, a heading and a speed, stepped once per
logic tick by ReactorVehicles.Drive.tick. The vehicle's event copies the
player.
Classes & Namespaces
Design Notes from the Source Code
Aboard a vehicle ($gamePlayer._vehicleType === "reactor") on a 3D map the
player is moved freely: a place, a heading and a speed, stepped once per
logic tick by ReactorVehicles.Drive.tick. The vehicle's event copies the
player.
One saved flag, _rrFree, on a character says "its _realX, _realY are
where it is; nothing glides it": 1 it stands where it is (the player while
riding and during the two hops, a vehicle parked by the mover), 2 it is
carried (the ridden vehicle's event). The flag is data; the behavior is on
the prototypes below, so a loaded save rides on.
The tick: the keys and the pad as throttle, brake and steering (in the
fixed views a held direction is driven toward) -> the handling step
(Reactor3D.Vehicles.step) -> the turn, taken only where both axles'
circles may swing to where it puts them -> the travel, tried whole and
then on feelers turned to each side, so a wall is slid along -> each tile
entered, in order: the party's walk, touch triggers, the encounter count
-> the ground under the two axles and the middle: height, pitch, air,
landing, water -> what is drawn (heading, pitch, lean, steering, travel),
written to the vehicle's event.
The body is three circles on its center line: one at each axle, one at its middle. What stops it: the map's border; ground more than a step over the ground its leading circle is on (a wall, a rock, a ledge), at three points of that circle's rim and under each circle's middle; a slope too steep to walk, at its foot; a big bush; anything built that stands between its bumper and its rider's head, as it is drawn; tiles RPG Maker's flags close; an event's body. Water stops nothing: it is ridden into. The circles behind the leading one, and both axles' circles in a turn, meet what is built, bushes and bodies as it does.
Where it rests: on both wheels while the ground under its middle is about
on the line between them; with a wheel over a drop, on the ground under
its middle, the wheel hanging. So it is never drawn under the ground its
middle is over, and a wheel swung or ridden over an edge or over water
takes nothing down with it. A drop is ridden off: it is in the air once
its middle is over the drop, until it meets the ground, and nobody is
hurt. In water deeper than its wade, ridden into or come down in, the ride
is over: its rider is in the water on foot and it goes down to the bed and
stays there (ReactorVehicles.sink). Boarded there (flooded) it is walked
along the bed, and runs again out of the water. Refused both ways with a key held, it
is put back on the last place it could stand on and leave; stuck again
soon after, on the one before, then where it was boarded.
A forced move route on the riding player runs as tile steps from its first movement command; any RPG Maker mover on a parked vehicle gives it back to the grid. A transfer to another map parks the vehicle and lands the party on foot; one on the same map brings it along where it fits.
Nothing is created per tick. On foot every wrapper here is one test of
_rrFree on its own character.
View reactor_vehicles_drive.js on GitHub · Hide internal (_) functions