Create: Computing AgesBrass Docs
Devices

Create Aeronautics blocks

Throttle lever, lasers, redstone timers, physics assembler, rope winch, springs, steering wheel, engine, potato cannon, wheels and drill of Create Aeronautics, read and driven by a computer.

Needs Create Aeronautics

These blocks come with Create Aeronautics; most of them belong to Create Simulated and Offroad, two mods it bundles. Without it, there is no such block, and peripheral.find("steering_wheel") returns nil.

Besides its sensors and engines, Create Aeronautics brings the blocks that build, tie and steer its vehicles: a Throttle Lever and a Steering Wheel, lasers, redstone timers, the Physics Assembler that turns a build into a vehicle, ropes and springs, wheels, an engine, a cannon and a drill. A computer reads each of them exactly, and drives what a player would: it sets a lever or a wheel to a precise value, assembles a vehicle, changes the length of a spring. Enough for an autopilot, a laser tripwire, a crane that stops at the right length or a drill that knows it is full.

Block (in game)peripheral typewhat it reads or sets
Throttle Leverthrottle_leverits redstone signal, which it can set
Laser Pointerlaser_pointerits beam: power, length, colour, what it hits
Laser Sensorlaser_sensorthe beam it receives, and how far its pointer is
Redstone Accumulatorredstone_accumulatorits count, which it can set, and its delay
Redstone Inductorredstone_inductorits output and its delay
Physics Assemblerphysics_assemblerassembles a vehicle and takes it apart
Rope Winchrope_winchthe length of its rope and how fast it reels
Springspringthe length it holds, which it can change
Steering Wheelsteering_wheelits angle, which it can set
Analog Transmissionanalog_transmissionthe speed of its cogwheel
Portable Engineportable_engineits fuel and the way it turns
Mounted Potato Cannonmounted_potato_cannonits charge and its ammo
Wheel Mountwheel_mountits suspension, its steering and its tire
Borehead Bearingborehead_bearingwhether it digs; assembles and stops it

The sensors, the burners and the propellers have their own pages: Create Aeronautics sensors, Hot Air Burner and Propellers.

Reaching a block. Against the computer, a block is called by its side ("left", "top"...); on a Data Cable (Minicomputer and newer) it gets a name such as steering_wheel@12,64,-30. peripheral.find looks for one by type. A computer reaches the blocks of a vehicle from on board: glue it to the vehicle, often as a Microcontroller.

Brass
local lever = peripheral.find("throttle_lever")
local wheel = peripheral.find("steering_wheel")
print("throttle " .. lever.signal() .. ", wheel at " .. wheel.angle() .. " degrees")

Every reading at once. Like the sensors, every block of this page has read() (see sensor.read()): one call returns a table of all its readings, under the names of the methods that only read (every method below without set_ in its name, apart from assemble and disassemble). A Laser Pointer gives power, on, range, color and distance; a reading that is nil is missing from the table.

What comes back. Numbers are rounded to 3 decimals, and each call reads the block again. A change (set_..., assemble, disassemble) is made at the end of the program's tick, as a player's click would be, unless the method says otherwise: a reading in the same tick still gives the old value. When something is wrong, the call stops the program with an error you can catch with pcall:

errorwhen
steering wheel removedthe block was broken or replaced since peripheral.wrap (its type, with spaces)
peripheral is not loadedthe chunk of the block is not loaded
bad argument #1 to 'set_signal' (number has no integer representation)a wrong argument: here 7.5 where a whole number is needed
this version of Create Aeronautics has no getStateyour version of the mod lacks what the method reads (the name at the end is the one missing)
Create Aeronautics error: ...the block itself failed while answering

Also kinetic blocks and inventories. The blocks that turn (Rope Winch, Steering Wheel, Analog Transmission, Portable Engine, Mounted Potato Cannon, Wheel Mount, Borehead Bearing) also have the methods of Create kinetic blocks, such as speed(), the speed of their shaft. The Portable Engine (its fuel), the Mounted Potato Cannon (its ammo), the Wheel Mount (its tire) and the Borehead Bearing (the storage of its drill, while assembled) also have those of Inventories. No method of this page hides one of them: on the Analog Transmission, speed() is the shaft's and analog_transmission.cog_speed() the cogwheel's.

Methods
throttle.signal()The signal the lever gives now, from 0 to 15, inverted or not.
throttle.set_signal(power)Moves the lever, with its click, to the position that gives this signal (an inverted lever takes the position that gives it too). The lever moves at the end of the tick, and the blocks it powers see the new signal two ticks later. Returns nothing. Values outside 0 to 15 are kept within; a number with decimals stops the program (math.floor it).
throttle.inverted()true when a Wrench inverted the lever: its positions count the other way, and the one that gave 3 now gives 12. signal and set_signal already take it into account.
laser.power()The strongest redstone signal around the pointer, from 0 (off) to 15; on an inverted pointer, 15 minus that signal. It is also the power a Laser Sensor receives from the beam.
laser.on()true while the pointer casts its beam, that is while its power is above 0.
laser.range()The length set on the pointer's value box ("Max Casting Distance"), in blocks: from 1 to the server maximum (100 by default, server config laser_pointer_max_range). A new pointer starts at the maximum.
laser.set_range(blocks)Sets the length of the beam, like turning the value box, and returns the value kept. Unlike most changes, it takes effect at once.
laser.color()The colour of the beam: the name of the dye that gave it ("red", "light_blue"...), "amethyst" (the colour of a new pointer) or "rainbow".
laser.set_color(color)Gives the beam a colour, as a dye, an Amethyst Shard or a Nether Star used on the pointer would. The dye names are those of Minecraft: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black (grey works too). Any other name stops the program with an error that lists them. Applied at the end of the tick; returns nothing.
laser.distance()How far the beam goes before a block stops it, in blocks, from the front of the pointer. nil while the pointer is off, or when the beam reaches its full length without meeting a block. Players and mobs do not count, only blocks.
sensor.power()The power of the strongest beam that reaches the front of the sensor and passes its filter, from 0 (none) to 15: the redstone signal the sensor gives.
sensor.distance()How far the nearest pointer whose beam reaches the sensor is, in blocks, from the front of that pointer to where its beam hits the sensor. nil while no beam reaches it.
sensor.filter()The item in the sensor's filter, as an id: a dye ("minecraft:red_dye"), an Amethyst Shard ("minecraft:amethyst_shard") or a Nether Star ("minecraft:nether_star"). nil when the filter is empty: the sensor then sees every beam. With a dye or a shard it only sees the beams of that colour; with a Nether Star, only rainbow beams, which in turn light no sensor filtered with a dye or a shard.
acc.count()The count the accumulator holds, from 0 to 15: what it gives while it is not inverted.
acc.output()The signal the accumulator gives from its front: its count, or 15 minus its count when it is inverted.
acc.set_count(n)Sets the count, kept from 0 to 15, at the end of the tick; the accumulator goes on counting from there. Returns nothing. A timer the computer resets:
acc.delay()How many ticks the accumulator waits between two steps, from 2 to 72000.
acc.set_delay(ticks)Sets the delay, like the value box, at the end of the tick, and returns the value kept.
acc.inverted()true when a click inverted the accumulator: it gives 15 minus its count.
ind.output()The signal the inductor gives from its front, from 0 to 15, inverted or not.
ind.delay()How many ticks the inductor waits between two steps, from 0 (it copies its input) to 72000.
ind.set_delay(ticks)Sets the delay, like the value box, at the end of the tick, and returns the value kept.
ind.inverted()true when a click inverted the inductor: it gives 15 minus the signal it has reached.
pa.assembled()true while the assembler is on a physics vehicle, the one it assembled or any other.
pa.disassembling()true after a disassemble() (or a pull of the lever) while the vehicle turns and moves to line up on the block grid, before it lands its blocks.
pa.error()The reason the mod gives for the last refusal, in English, such as "Moving too fast to disassemble!". nil when nothing failed (a successful assembly clears it). With the default settings, a vehicle is not taken apart while it moves faster than 5 blocks per second, far from any ground, out of the world's height, or when it cannot line up within 5 seconds.
pa.assemble()Turns the block the assembler sticks to, and all that is glued to it, into a vehicle, as a pull of its lever does. The assembly happens at the end of the tick; when it fails, physics_assembler.error() says why.
pa.disassemble()Puts the vehicle back as blocks, as a pull of the lever does on a vehicle. At the end of the tick the vehicle starts to line up (physics_assembler.disassembling() is then true), and lands its blocks once it is in place. A refusal leaves the vehicle as it is, with the reason in physics_assembler.error(). For a computer on board:
winch.attached()true while a rope is tied to the winch.
winch.length()The length of the rope now, in blocks, measured along it. nil without rope.
winch.max_length()The longest the winch pays its rope out, in blocks: 40 by default (server config max_rope_range).
winch.reel_speed()How fast the shaft makes the winch pay the rope out, in blocks per second: RPM / 25.6, at most 9.8. Negative while it reels in, 0 when it stands still. It is what the shaft asks for: a stretched rope does not come in, and a rope at its longest does not go out.
winch.stretched()true while the load pulls the rope more than 25 % past its length: the winch then refuses to reel in. Lighten the load, or pay some rope out.
spring.length()The length the pair pulls or pushes towards, in blocks, from 1 to 9 in quarters. Both springs of a pair read the same.
spring.distance()How far apart the two springs of the pair are now, in blocks, centre to centre, wherever their vehicles are. Compared with spring.length(), it tells whether the spring is stretched or squeezed.
spring.size()The size of the spring, which a Wrench changes: "small", "medium" or "large". The bigger, the stronger.
spring.paired()true while the other spring of the pair is in place and loaded.
spring.set_length(blocks)Changes the length of the pair, as clicks of the Spring item do: kept from 1 to 9 and rounded to a quarter of a block. It takes effect at once, on both springs, and returns the length kept. The spring refuses a length too far from where it is, and returns why instead: "too_stretched" when shortening a pair already more than about twice the new length apart, "too_compressed" when lengthening one less than about half of it apart.
wheel.angle()The angle the wheel is turned to now, in degrees: 0 in the middle, up to its limit either way. It moves at 96 degrees per second towards steering_wheel.target_angle().
wheel.target_angle()The angle the wheel heads for: the last one set by the program or by a player.
wheel.limit()How far the wheel turns either way, in degrees, as set on its value box.
wheel.held()true while a player holds the wheel. Their moves then win over the program's: wait for them to let go.
wheel.set_target_angle(degrees)Turns the wheel to that angle, kept within its limit, and returns the angle kept. The wheel takes it at the end of the tick, then turns its network by the difference, at 96 degrees per second.
wheel.set_limit(degrees)Sets how far the wheel may turn either way, like its value box, at the end of the tick. Returns nothing. The number must be whole; values outside 1 to 360 are kept within.
t.cog_speed()The speed of the cogwheel side, in RPM, negative when it turns the other way. speed() (kinetic.speed()) gives the shaft's.
t.too_fast()true when the transmission, driven through its cogwheel, refuses because its shaft would turn faster than Create allows: lower the signal or the input speed.
engine.burn_time()Seconds left on the fuel item burning now (a piece of coal lasts 80), 0 when it is out.
engine.total_burn_time()Seconds of fuel in all: what is left of the item burning now, plus the stack waiting in its slot.
engine.burning()true while the engine burns, and so turns its shaft.
engine.superheated()true while the engine burns a superheating fuel and turns at 64 RPM.
engine.infinite()true with a fuel that never runs out (a Creative Blaze Cake): the burn times then mean nothing.
engine.direction()The way the engine turns its shaft, as on its value box.
engine.set_direction(way)Sets the way the engine turns, like its value box, at the end of the tick. Returns nothing. Any other text stops the program. An engine that lights up on a network already turning the other way switches to that way by itself.
pc.state()Where the cannon is in its cycle: "charging", "charged" (ready to fire) or "firing" (a few ticks, before it charges again).
pc.charge()How charged the cannon is, from 0 to 1. It does not move without ammo or without rotation.
pc.loaded()true when the cannon holds ammo, an item a Potato Cannon can shoot.
pc.blocked()true while a block stands right in front of the barrel: the cannon does not fire.
mount.strength()The strength of the suspension, from its value box: from 5 to 180, 10 for a new mount.
mount.set_strength(n)Sets the strength of the suspension, like the value box, at the end of the tick, and returns the value kept.
mount.steering()The angle the wheel is steered to, in degrees, up to 30 either way; 0 when it goes straight. It follows the redstone on the sides of the mount, and swings there in a few ticks.
mount.tire()The item on the mount, as an id ("offroad:tire", "offroad:large_tire"...); nil without a tire.
bore.running()true while the drill head is assembled and turned by the bearing.
bore.active()true while the drill digs: assembled, turning, neither stalled nor slowing down.
bore.stalled()true while the drill stalls because its storage has no room for what it breaks, and for half a second after it has room again.
bore.stopping()true while the drill head slows down, after a disassemble() or a click, before it is put back as blocks.
bore.error()The reason the last assembly failed, as a sentence in English (no Rock Cutting Wheel, no storage block...); nil when nothing failed.
bore.assemble()Assembles the drill head at the bearing's next tick, like a click. It only assembles while its shaft turns: on a bearing standing still, it does nothing and returns false. When it fails, borehead_bearing.error() says why.
bore.disassemble()Slows the drill head down, then puts it back as blocks, like a click. borehead_bearing.stopping() is true meanwhile.

Throttle Lever

The Throttle Lever is a compact redstone source with 16 positions: a player holds right-click and drags it, notch by notch, and it gives that signal, from 0 to 15. A Wrench inverts it: each position then gives 15 minus its signal. The computer reads the signal and moves the lever itself, so a pilot and an autopilot can share one lever.

#

throttle.signal()

→ number

The signal the lever gives now, from 0 to 15, inverted or not.

Returns
number
the redstone signal the lever gives, from 0 to 15
Brass
local throttle = peripheral.find("throttle_lever")
print("throttle at " .. math.floor(throttle.signal() / 15 * 100) .. " %")

See also throttle_lever.set_signal() throttle_lever.inverted()

#

throttle.set_signal(power)

Moves the lever, with its click, to the position that gives this signal (an inverted lever takes the position that gives it too). The lever moves at the end of the tick, and the blocks it powers see the new signal two ticks later. Returns nothing. Values outside 0 to 15 are kept within; a number with decimals stops the program (math.floor it).

Parameters
power number
the signal to give, a whole number from 0 to 15
Brass
local throttle = peripheral.find("throttle_lever")
throttle.set_signal(10)

See also throttle_lever.signal()

#

throttle.inverted()

→ boolean

true when a Wrench inverted the lever: its positions count the other way, and the one that gave 3 now gives 12. signal and set_signal already take it into account.

Returns
boolean
true when a Wrench inverted the lever

Lasers

A Laser Pointer casts a beam while redstone powers it, as far as its range (the value box on its back) or until a block stops it. A dye used on it gives the beam its colour; an Amethyst Shard brings back the amethyst colour it starts with, and a Nether Star makes it rainbow. A Wrench on its front or back inverts it: it then shines at full power without redstone, and goes out with a signal of 15.

A Laser Sensor lit on its front by a beam gives the power of that beam as redstone. With an item in its filter (a dye, an Amethyst Shard or a Nether Star), it only sees the beams of that colour. A player or a mob standing in the beam stops it before the sensor: a beam across a doorway is a tripwire.

#

laser.power()

→ number

The strongest redstone signal around the pointer, from 0 (off) to 15; on an inverted pointer, 15 minus that signal. It is also the power a Laser Sensor receives from the beam.

Returns
number
the redstone power that lights the pointer, from 0 to 15
Brass
local laser = peripheral.find("laser_pointer")
print(laser.power(), laser.on())

A pointer touching the computer is lit by the computer: rs.set("left", 15) when it is on the left.

See also laser_pointer.on() laser_sensor.power()

#

laser.on()

→ boolean

true while the pointer casts its beam, that is while its power is above 0.

Returns
boolean
true while the beam shines
#

laser.range()

→ number

The length set on the pointer's value box ("Max Casting Distance"), in blocks: from 1 to the server maximum (100 by default, server config laser_pointer_max_range). A new pointer starts at the maximum.

Returns
number
the longest the beam goes, in blocks

See also laser_pointer.set_range() laser_pointer.distance()

#

laser.set_range(blocks)

→ number

Sets the length of the beam, like turning the value box, and returns the value kept. Unlike most changes, it takes effect at once.

Parameters
blocks number
the new length, a whole number of blocks
Returns
number
the length kept, from 1 to the server maximum
Brass
local laser = peripheral.find("laser_pointer")
print(laser.set_range(20))
print(laser.set_range(100000))

With the default settings, this prints 20, then 100, the server maximum.

See also laser_pointer.range()

#

laser.color()

→ string

The colour of the beam: the name of the dye that gave it ("red", "light_blue"...), "amethyst" (the colour of a new pointer) or "rainbow".

Returns
string
a dye name such as "red" or "light_blue", "amethyst" or "rainbow"

See also laser_pointer.set_color() laser_sensor.filter()

#

laser.set_color(color)

Gives the beam a colour, as a dye, an Amethyst Shard or a Nether Star used on the pointer would. The dye names are those of Minecraft: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black (grey works too). Any other name stops the program with an error that lists them. Applied at the end of the tick; returns nothing.

Parameters
color string
a dye name, "amethyst" or "rainbow"

With a filter on each Laser Sensor, the colour picks which sensors one pointer lights:

Brass
local laser = peripheral.find("laser_pointer")
laser.set_color("red")    -- now only the sensors filtered with red dye (or unfiltered) see it

See also laser_pointer.color()

#

laser.distance()

→ number|nil

How far the beam goes before a block stops it, in blocks, from the front of the pointer. nil while the pointer is off, or when the beam reaches its full length without meeting a block. Players and mobs do not count, only blocks.

Returns
number|nil
the distance to the first block the beam hits, in blocks; nil when it hits none or is off

A rangefinder: a lit pointer under a ship, facing down, reads the height above the ground.

Brass
local laser = peripheral.find("laser_pointer")
local d = laser.distance()
if d then
  print(string.format("ground %.1f blocks below", d))
else
  print("nothing within " .. laser.range() .. " blocks")
end

See also laser_pointer.range()

#

sensor.power()

→ number

The power of the strongest beam that reaches the front of the sensor and passes its filter, from 0 (none) to 15: the redstone signal the sensor gives.

Returns
number
the power of the strongest beam the sensor receives, from 0 to 15
Brass
local sensor = peripheral.find("laser_sensor")
if sensor.power() == 0 then
  print("beam cut!")
end

See also laser_pointer.power()

#

sensor.distance()

→ number|nil

How far the nearest pointer whose beam reaches the sensor is, in blocks, from the front of that pointer to where its beam hits the sensor. nil while no beam reaches it.

Returns
number|nil
the distance to the nearest pointer whose beam reaches the sensor, in blocks; nil without beam

A pointer on a ship and a sensor on its landing pad tell how close the ship is:

Brass
local sensor = peripheral.find("laser_sensor")
local d = sensor.distance()
if d then
  print(string.format("ship %.1f blocks away", d))
end
#

sensor.filter()

→ string|nil

The item in the sensor's filter, as an id: a dye ("minecraft:red_dye"), an Amethyst Shard ("minecraft:amethyst_shard") or a Nether Star ("minecraft:nether_star"). nil when the filter is empty: the sensor then sees every beam. With a dye or a shard it only sees the beams of that colour; with a Nether Star, only rainbow beams, which in turn light no sensor filtered with a dye or a shard.

Returns
string|nil
the id of the item in the sensor's filter, nil when it is empty

See also laser_pointer.color()

Redstone Accumulator and Inductor

Two redstone timers, each with a delay on its value box, in ticks (20 per second).

The Redstone Accumulator stores a signal from 0 to 15, its count: powered from the back, it counts up one step per delay; powered from a side, it counts down; powered from both, it holds. Its delay goes from 2 ticks to an hour (72000 ticks), 10 for a new one. It gives its count from the front; a click inverts it, and it then gives 15 minus its count.

The Redstone Inductor follows the signal on its back, one step per delay: its output climbs or falls towards its input. With a delay of 0 ("Copy" on its value box), it takes its input within a few ticks. A click inverts it, and it then gives 15 minus that output.

#

acc.count()

→ number

The count the accumulator holds, from 0 to 15: what it gives while it is not inverted.

Returns
number
the count of the accumulator, from 0 to 15
Brass
local acc = peripheral.find("redstone_accumulator")
print(acc.count(), acc.output())

See also redstone_accumulator.output() redstone_accumulator.set_count()

#

acc.output()

→ number

The signal the accumulator gives from its front: its count, or 15 minus its count when it is inverted.

Returns
number
the signal the accumulator gives, from 0 to 15
#

acc.set_count(n)

Sets the count, kept from 0 to 15, at the end of the tick; the accumulator goes on counting from there. Returns nothing. A timer the computer resets:

Parameters
n number
the new count, a whole number from 0 to 15
Brass
local acc = peripheral.find("redstone_accumulator")
acc.set_count(0)

See also redstone_accumulator.count()

#

acc.delay()

→ number

How many ticks the accumulator waits between two steps, from 2 to 72000.

Returns
number
the delay of the accumulator, in ticks per step

See also redstone_accumulator.set_delay()

#

acc.set_delay(ticks)

→ number

Sets the delay, like the value box, at the end of the tick, and returns the value kept.

Parameters
ticks number
the new delay, a whole number of ticks
Returns
number
the delay kept, from 2 to 72000
Brass
local acc = peripheral.find("redstone_accumulator")
acc.set_delay(20)   -- one step per second
#

acc.inverted()

→ boolean

true when a click inverted the accumulator: it gives 15 minus its count.

Returns
boolean
true when the accumulator gives 15 minus its count
#

ind.output()

→ number

The signal the inductor gives from its front, from 0 to 15, inverted or not.

Returns
number
the signal the inductor gives, from 0 to 15
Brass
local ind = peripheral.find("redstone_inductor")
print(ind.output())
#

ind.delay()

→ number

How many ticks the inductor waits between two steps, from 0 (it copies its input) to 72000.

Returns
number
the delay of the inductor, in ticks per step

See also redstone_inductor.set_delay()

#

ind.set_delay(ticks)

→ number

Sets the delay, like the value box, at the end of the tick, and returns the value kept.

Parameters
ticks number
the new delay, a whole number of ticks
Returns
number
the delay kept, from 0 to 72000
Brass
local ind = peripheral.find("redstone_inductor")
ind.set_delay(5)
#

ind.inverted()

→ boolean

true when a click inverted the inductor: it gives 15 minus the signal it has reached.

Returns
boolean
true when the inductor's output is inverted

Physics Assembler

The Physics Assembler turns a build into a vehicle of Create Aeronautics. It sticks to a block, and pulling its lever turns that block and every block glued to it (with Super Glue, or the Honey Glue of Simulated) into a vehicle that falls, floats and flies with real physics. Pulling the lever of any assembler on a vehicle puts it back as blocks: the vehicle first lines up on the block grid, turned to the nearest quarter turn, then lands its blocks.

Only these physics vehicles count (Simulated Contraptions, moved by the physics engine Sable): a block carried by a Create contraption, on a bearing or a train, is not on a vehicle.

The assembler leaves with its vehicle. The assembler is part of what it assembles: once the vehicle exists, the block is no longer where the computer saw it. Unless the computer is glued to the same vehicle, the peripheral is then gone, and the next call stops the program with physics assembler removed.

#

pa.assembled()

→ boolean

true while the assembler is on a physics vehicle, the one it assembled or any other.

Returns
boolean
true while the assembler is on a vehicle
Brass
local pa = peripheral.find("physics_assembler")
if not pa.assembled() then
  pa.assemble()
end

See also physics_assembler.assemble() physics_assembler.disassemble()

#

pa.disassembling()

→ boolean

true after a disassemble() (or a pull of the lever) while the vehicle turns and moves to line up on the block grid, before it lands its blocks.

Returns
boolean
true while the vehicle lines up to be put back as blocks
#

pa.error()

→ string|nil

The reason the mod gives for the last refusal, in English, such as "Moving too fast to disassemble!". nil when nothing failed (a successful assembly clears it). With the default settings, a vehicle is not taken apart while it moves faster than 5 blocks per second, far from any ground, out of the world's height, or when it cannot line up within 5 seconds.

Returns
string|nil
why the last assembly or disassembly failed, in English; nil when nothing failed
#

pa.assemble()

→ boolean

Turns the block the assembler sticks to, and all that is glued to it, into a vehicle, as a pull of its lever does. The assembly happens at the end of the tick; when it fails, physics_assembler.error() says why.

Returns
boolean
false when the assembler is already on a vehicle, true otherwise

From the ground, success is when the assembler is gone:

Brass
local pa = peripheral.find("physics_assembler")
if pa.assemble() then
  sleep(0.1)
  local r = pcall(pa.error)
  if not r.ok then
    print("assembled: the assembler left with its vehicle")
  elseif r.value then
    print("not assembled: " .. r.value)
  end
end

See also physics_assembler.error()

#

pa.disassemble()

→ boolean

Puts the vehicle back as blocks, as a pull of the lever does on a vehicle. At the end of the tick the vehicle starts to line up (physics_assembler.disassembling() is then true), and lands its blocks once it is in place. A refusal leaves the vehicle as it is, with the reason in physics_assembler.error(). For a computer on board:

Returns
boolean
false when the assembler is not on a vehicle, true otherwise
Brass
local pa = peripheral.find("physics_assembler")
if pa.assembled() then
  pa.disassemble()
end

See also physics_assembler.disassembling() physics_assembler.error()

Rope Winch

A Rope Winch reels a rope in and out. A Rope Coupling ties it to a Rope Connector (two winches do not connect), and the rope then holds or tows what it is tied to. Turned by a shaft, the winch pays the rope out or reels it in, depending on the way it turns, at RPM / 25.6 blocks per second (9.8 at most). The rope is at most 40 blocks long (server config max_rope_range). When the load pulls the rope more than 25 % past its length (server config max_rope_winch_stretch_allowed), the rope is stretched, and the winch no longer reels in.

The computer does not turn the winch itself: it sets the speed of its shaft, for example with a Rotation Speed Controller (kinetic.set_speed()).

#

winch.attached()

→ boolean

true while a rope is tied to the winch.

Returns
boolean
true while a rope is tied to the winch
Brass
local winch = peripheral.find("rope_winch")
print(winch.attached(), winch.length())
#

winch.length()

→ number|nil

The length of the rope now, in blocks, measured along it. nil without rope.

Returns
number|nil
the length of the rope now, in blocks; nil without rope

A crane that pays the rope out to 20 blocks, then stops. Its winch turns through a Rotation Speed Controller behind the computer; if the rope comes in instead, use -32.

Brass
local winch = peripheral.find("rope_winch")
local drive = peripheral.wrap("back")
drive.set_speed(32)
while true do
  local len = winch.length()
  if not len or len >= 20 then
    break
  end
  sleep(0.1)
end
drive.set_speed(0)

See also rope_winch.max_length()

#

winch.max_length()

→ number

The longest the winch pays its rope out, in blocks: 40 by default (server config max_rope_range).

Returns
number
the longest rope the winch pays out, in blocks
#

winch.reel_speed()

→ number

How fast the shaft makes the winch pay the rope out, in blocks per second: RPM / 25.6, at most 9.8. Negative while it reels in, 0 when it stands still. It is what the shaft asks for: a stretched rope does not come in, and a rope at its longest does not go out.

Returns
number
how fast the winch pays out, in blocks per second; negative while it reels in
Brass
local winch = peripheral.find("rope_winch")
print(string.format("%.2f blocks/s", winch.reel_speed()))

See also rope_winch.stretched()

#

winch.stretched()

→ boolean

true while the load pulls the rope more than 25 % past its length: the winch then refuses to reel in. Lighten the load, or pay some rope out.

Returns
boolean
true while the rope is stretched past what the winch allows

Spring

A Spring joins two blocks: click one, then the other, with a Spring item, and a spring block appears on each. The pair pulls or pushes to keep the two blocks at its length, from 1 to 9 blocks, when at least one of them is on a vehicle: a spring hangs a gondola under a balloon, or softens a landing. A player changes the length with the Spring item, a quarter of a block per click (sneaking to shorten it), and the strength with a Wrench: small, medium or large (the large one is 16 times as strong as the small one). Breaking one spring breaks the other, and a pair pulled farther than 4 times its length plus 2 blocks snaps within a second.

#

spring.length()

→ number

The length the pair pulls or pushes towards, in blocks, from 1 to 9 in quarters. Both springs of a pair read the same.

Returns
number
the length the pair holds, from 1 to 9 blocks
Brass
local spring = peripheral.find("spring")
print(spring.length(), spring.distance())

See also spring.set_length() spring.distance()

#

spring.distance()

→ number|nil

How far apart the two springs of the pair are now, in blocks, centre to centre, wherever their vehicles are. Compared with spring.length(), it tells whether the spring is stretched or squeezed.

Returns
number|nil
how far apart the two springs are now, in blocks; nil without partner
#

spring.size()

→ string

The size of the spring, which a Wrench changes: "small", "medium" or "large". The bigger, the stronger.

Returns
string
"small", "medium" or "large"
#

spring.paired()

→ boolean

true while the other spring of the pair is in place and loaded.

Returns
boolean
true while the other spring of the pair is there
#

spring.set_length(blocks)

→ number|string

Changes the length of the pair, as clicks of the Spring item do: kept from 1 to 9 and rounded to a quarter of a block. It takes effect at once, on both springs, and returns the length kept. The spring refuses a length too far from where it is, and returns why instead: "too_stretched" when shortening a pair already more than about twice the new length apart, "too_compressed" when lengthening one less than about half of it apart.

Parameters
blocks number
the new length, in blocks
Returns
number|string
the length kept, or why the spring refused ("too_stretched", "too_compressed")
Brass
local spring = peripheral.find("spring")
local r = spring.set_length(6)
if type(r) == "string" then
  print("refused: " .. r)
else
  print("length " .. r)
end

A spring changes once per tick: a second call on the same spring in the same tick stops the program with the spring already changed this tick: sleep(0) waits for the next.

See also spring.length()

Steering Wheel

A player grabs the Steering Wheel (hold right-click) and turns it with the mouse, up to its limit either way (a value box, from 1 to 360 degrees, 180 for a new wheel). The wheel is a rotation source: like a Sequenced Gearshift, it turns its network by exactly the angle it is turned, at its own pace of 16 RPM (96 degrees per second). A bearing it drives swings by that angle: the rudder of a ship, the front axle of a cart. A Mechanical Bearing must be set never to disassemble, or it falls apart each time the wheel stops.

The computer gives the wheel an angle to turn to, and the wheel turns its network by the difference, at its pace. If the angle changes while the wheel is still turning, it finishes its turn, then heads for the new angle. A player holding the wheel wins: each of their moves sets a new angle over the program's.

#

wheel.angle()

→ number

The angle the wheel is turned to now, in degrees: 0 in the middle, up to its limit either way. It moves at 96 degrees per second towards steering_wheel.target_angle().

Returns
number
the angle the wheel is turned to, in degrees
Brass
local wheel = peripheral.find("steering_wheel")
print(wheel.angle(), wheel.target_angle())

See also steering_wheel.target_angle()

#

wheel.target_angle()

→ number

The angle the wheel heads for: the last one set by the program or by a player.

Returns
number
the angle the wheel turns to, in degrees
#

wheel.limit()

→ number

How far the wheel turns either way, in degrees, as set on its value box.

Returns
number
how far the wheel turns either way, from 1 to 360 degrees

See also steering_wheel.set_limit()

#

wheel.held()

→ boolean

true while a player holds the wheel. Their moves then win over the program's: wait for them to let go.

Returns
boolean
true while a player holds the wheel
Brass
local wheel = peripheral.find("steering_wheel")
while wheel.held() do
  sleep(0.5)
end
#

wheel.set_target_angle(degrees)

→ number

Turns the wheel to that angle, kept within its limit, and returns the angle kept. The wheel takes it at the end of the tick, then turns its network by the difference, at 96 degrees per second.

Parameters
degrees number
the angle to turn to, negative for the other way
Returns
number
the angle kept, within the wheel's limit
Brass
local wheel = peripheral.find("steering_wheel")
print(wheel.set_target_angle(-45))
print(wheel.set_target_angle(1000))

For a new wheel, this prints -45, then 180, its limit.

See also steering_wheel.angle() steering_wheel.held()

#

wheel.set_limit(degrees)

Sets how far the wheel may turn either way, like its value box, at the end of the tick. Returns nothing. The number must be whole; values outside 1 to 360 are kept within.

Parameters
degrees number
the new limit, a whole number of degrees from 1 to 360
Brass
local wheel = peripheral.find("steering_wheel")
wheel.set_limit(90)

Analog Transmission

The Analog Transmission is a shaft and a cogwheel in one block, set apart by redstone. Without redstone, both turn at the same speed, like an Encased Cogwheel. A signal from 1 to 14 slows the cogwheel down: it turns at (15 - signal) / 16 of the shaft's speed, half at a signal of 7. At 15, the two come apart and turn on their own. Driven through the cogwheel, it is the shaft that speeds up, by the inverse ratio; when the shaft would turn faster than Create allows (256 RPM by default), the transmission refuses ("Too Fast") and the shaft stops.

The computer sets the ratio with redstone, rs.set(side, signal) from the face against it, and reads the result.

#

t.cog_speed()

→ number

The speed of the cogwheel side, in RPM, negative when it turns the other way. speed() (kinetic.speed()) gives the shaft's.

Returns
number
the speed of the cogwheel side, in RPM
Brass
local t = peripheral.find("analog_transmission")
rs.set("left", 7)   -- the transmission is on the left of the computer
sleep(0.5)
print("shaft " .. t.speed() .. ", cogwheel " .. t.cog_speed() .. " RPM")

With the shaft at 64 RPM, the cogwheel turns at 32.

See also kinetic.speed()

#

t.too_fast()

→ boolean

true when the transmission, driven through its cogwheel, refuses because its shaft would turn faster than Create allows: lower the signal or the input speed.

Returns
boolean
true when the transmission refuses to turn its shaft too fast

Portable Engine

The Portable Engine burns furnace fuel to turn its shaft at 32 RPM; a superheating fuel (a Blaze Cake, as for a Blaze Burner) makes it turn twice as fast. It takes fuel by hand or by funnel, and eats a cake set in front of it, 5 seconds of fuel per bite; a Creative Blaze Cake makes it burn forever. Its value box picks the way it turns.

#

engine.burn_time()

→ number

Seconds left on the fuel item burning now (a piece of coal lasts 80), 0 when it is out.

Returns
number
the seconds left on the fuel burning now
Brass
local engine = peripheral.find("portable_engine")
print(engine.burn_time(), engine.total_burn_time())

See also portable_engine.total_burn_time()

#

engine.total_burn_time()

→ number

Seconds of fuel in all: what is left of the item burning now, plus the stack waiting in its slot.

Returns
number
the seconds of fuel in all, the waiting stack included
Brass
local engine = peripheral.find("portable_engine")
if not engine.infinite() and engine.total_burn_time() < 60 then
  print("Less than a minute of fuel left")
end
#

engine.burning()

→ boolean

true while the engine burns, and so turns its shaft.

Returns
boolean
true while the engine burns fuel
#

engine.superheated()

→ boolean

true while the engine burns a superheating fuel and turns at 64 RPM.

Returns
boolean
true while it burns a superheating fuel, at twice the speed
#

engine.infinite()

→ boolean

true with a fuel that never runs out (a Creative Blaze Cake): the burn times then mean nothing.

Returns
boolean
true when the fuel never runs out
#

engine.direction()

→ string

The way the engine turns its shaft, as on its value box.

Returns
string
"clockwise" or "counter_clockwise"

See also portable_engine.set_direction()

#

engine.set_direction(way)

Sets the way the engine turns, like its value box, at the end of the tick. Returns nothing. Any other text stops the program. An engine that lights up on a network already turning the other way switches to that way by itself.

Parameters
way string
"clockwise" or "counter_clockwise"
Brass
local engine = peripheral.find("portable_engine")
engine.set_direction("clockwise")

Mounted Potato Cannon

The Mounted Potato Cannon is Create's Potato Cannon as a block. It takes the same ammo (by hand or by funnel), and a shaft charges it: at 64 RPM it is ready in the reload time of its ammo, sooner when faster. Once charged, a redstone signal fires it, and a steady signal fires again each time it is charged. It does not fire while a block stands right in front of its barrel (a Mangrove Trapdoor excepted). On a vehicle, each shot kicks it backwards.

No method fires it: the computer gives it redstone, rs.set(side, true) from the face against it, or through a Redstone Link (link).

#

pc.state()

→ string

Where the cannon is in its cycle: "charging", "charged" (ready to fire) or "firing" (a few ticks, before it charges again).

Returns
string
"charging", "charged" or "firing"

A cannon on top of the computer, fired once it is ready:

Brass
local pc = peripheral.wrap("top")
if pc.loaded() and pc.state() == "charged" then
  rs.set("top", true)
  sleep(0.2)
  rs.set("top", false)
end

See also mounted_potato_cannon.charge()

#

pc.charge()

→ number

How charged the cannon is, from 0 to 1. It does not move without ammo or without rotation.

Returns
number
how charged the cannon is, from 0 to 1
#

pc.loaded()

→ boolean

true when the cannon holds ammo, an item a Potato Cannon can shoot.

Returns
boolean
true when the cannon holds ammo
#

pc.blocked()

→ boolean

true while a block stands right in front of the barrel: the cannon does not fire.

Returns
boolean
true while a block in front of the barrel keeps it from firing

Wheel Mount

The Wheel Mount carries a tire on its front (Tire, Small Tire, Large Tire or Monstrous Tire) and, on a vehicle, rolls it on the ground: its suspension holds the vehicle up, and its shaft drives the wheel. Redstone does the rest:

  • on a side, it steers the wheel towards that side, up to 30 degrees at a signal of 15 (the signals of the two sides subtract);
  • on top, it brakes, harder with a stronger signal; at 15, the shaft no longer drives the wheel.

No method steers or brakes: the computer gives redstone, with rs.set from the face against the mount, or through a Redstone Link next to it (link). It reads where the wheel is steered, and sets the strength of the suspension.

#

mount.strength()

→ number

The strength of the suspension, from its value box: from 5 to 180, 10 for a new mount.

Returns
number
the strength of the suspension, from 5 to 180
Brass
local mount = peripheral.find("wheel_mount")
print(mount.strength(), mount.steering(), mount.tire())

See also wheel_mount.set_strength()

#

mount.set_strength(n)

→ number

Sets the strength of the suspension, like the value box, at the end of the tick, and returns the value kept.

Parameters
n number
the new strength, a whole number from 5 to 180
Returns
number
the strength kept
Brass
local mount = peripheral.find("wheel_mount")
mount.set_strength(40)
#

mount.steering()

→ number

The angle the wheel is steered to, in degrees, up to 30 either way; 0 when it goes straight. It follows the redstone on the sides of the mount, and swings there in a few ticks.

Returns
number
the angle the wheel is steered to, in degrees, 0 when straight

A mount under the computer, braked and read:

Brass
local mount = peripheral.wrap("bottom")
rs.set("bottom", 15)   -- full brake
print("steered " .. mount.steering() .. " degrees")
#

mount.tire()

→ string|nil

The item on the mount, as an id ("offroad:tire", "offroad:large_tire"...); nil without a tire.

Returns
string|nil
the id of the tire on the mount, nil without one

Borehead Bearing

The Borehead Bearing is a drill. Like a Mechanical Bearing, it turns the structure in front of it, here a drill head with Rock Cutting Wheels and at least one storage block (a chest, an Item Vault...). It turns it at a quarter of its shaft's speed (server config borehead_bearing_rotation_divisor), every Rock Cutting Wheel breaks the blocks around itself, and the drops go into the storage. When the storage is full, the drill stalls until items are taken out (they can be pulled out through the bearing itself). A click with an empty hand assembles it while its shaft turns, or slows it down and takes it apart; it also assembles by itself when its shaft starts turning.

#

bore.running()

→ boolean

true while the drill head is assembled and turned by the bearing.

Returns
boolean
true while the drill head is assembled
Brass
local bore = peripheral.find("borehead_bearing")
print(bore.running(), bore.active())

See also borehead_bearing.active()

#

bore.active()

→ boolean

true while the drill digs: assembled, turning, neither stalled nor slowing down.

Returns
boolean
true while the drill digs
#

bore.stalled()

→ boolean

true while the drill stalls because its storage has no room for what it breaks, and for half a second after it has room again.

Returns
boolean
true while the drill stalls because its storage is full

A drill that stops when it is full, and tells it:

Brass
local bore = peripheral.find("borehead_bearing")
while not bore.stalled() do
  sleep(1)
end
bore.disassemble()
print("Storage full: drill stopped")
#

bore.stopping()

→ boolean

true while the drill head slows down, after a disassemble() or a click, before it is put back as blocks.

Returns
boolean
true while the drill slows down before it is taken apart
#

bore.error()

→ string|nil

The reason the last assembly failed, as a sentence in English (no Rock Cutting Wheel, no storage block...); nil when nothing failed.

Returns
string|nil
why the drill could not assemble, in English; nil when it could
#

bore.assemble()

→ boolean

Assembles the drill head at the bearing's next tick, like a click. It only assembles while its shaft turns: on a bearing standing still, it does nothing and returns false. When it fails, borehead_bearing.error() says why.

Returns
boolean
false when the drill is already assembled or its shaft does not turn, true otherwise

See also borehead_bearing.error()

#

bore.disassemble()

→ boolean

Slows the drill head down, then puts it back as blocks, like a click. borehead_bearing.stopping() is true meanwhile.

Returns
boolean
false when the drill is not assembled, true otherwise

See also borehead_bearing.stopping()

An autopilot at the wheel

A ship that holds its heading. A Microcontroller glued on board (or any computer that has vehicle) touches the Steering Wheel, which turns the bearing of the tail propeller or of a rudder. The program sets the wheel to an angle that grows with the gap to the course, and eases it off while the ship already turns (see vehicle.spin()). When a player takes the wheel, the program lets them steer, and takes over again when they let go. If the ship turns the wrong way, make GAIN and BRAKE negative.

Brass
local COURSE = 90    -- the heading to hold: 0 north, 90 east, 180 south, 270 west
local BOW = 0        -- where the bow pointed when the ship was assembled
local GAIN = 1.5     -- wheel degrees per degree off course
local BRAKE = 2      -- wheel degrees per degree per second of spin
local wheel = peripheral.find("steering_wheel")

local function turn(heading, target)
  return (target - heading + 540) % 360 - 180
end

if not vehicle.on_vehicle() then
  print("Glue me on the ship first.")
  return
end
wheel.set_limit(60)
while true do
  if wheel.held() then
    print("Pilot at the wheel")
    while wheel.held() do
      sleep(0.5)
    end
    print("Autopilot")
  end
  local heading = (BOW - vehicle.rotation().yaw) % 360
  local off = turn(heading, COURSE)   -- above 0: the course is to the right
  wheel.set_target_angle(off * GAIN + vehicle.spin().yaw * BRAKE)
  sleep(0.2)
end

The wheel keeps the angle within its limit (60 degrees here), and turns to it at its own pace. Tune it as in vehicle.spin(): a ship that swings past its course and back wants more BRAKE or less GAIN.