Create: Computing AgesBrass Docs
Devices

Create: Connected blocks

The blocks of Create: Connected driven by a computer: the Kinetic Battery's charge, the clutches, the Sequenced Pulse Generator's program, the Dashboard's lines, the linked levers and buttons, the Kinetic Bridge.

Needs Create: Connected

Everything on this page exists only when Create: Connected is installed. Without it, there is no such block, and peripheral.find("kinetic_battery") returns nil.

Create: Connected adds small blocks between kinetics and redstone. A computer connected to them reads what Engineer's Goggles and their screens show, and sets what a player sets by hand: how charged a Kinetic Battery is and when it gives its rotation back, when a clutch couples, the program of a Sequenced Pulse Generator, the lines a seated player sees from a Dashboard, and levers and buttons that transmit on a Redstone Link frequency.

Block (in game)peripheral typewhat it reads or sets
Kinetic Batterykinetic_batteryits charge in SU-hours, and the way it turns while discharging
Overstress Clutchoverstress_clutchits state and its delay; couples it again like a wrench
Centrifugal Clutchcentrifugal_clutchwhether it is coupled, its speed threshold and its mode
Freewheel Clutchfreewheel_clutchwhether it is coupled, and the way it lets through
Sequenced Pulse Generatorsequenced_pulse_generatorits program, the step it runs, its input and output
Dashboarddashboardits 4 lines of text and their colour
Linked Leverlinked_leverits frequency and position; pulls it
Linked Button (of any wood or stone)linked_buttonits frequency; presses it
Linked Analog Leverlinked_analog_leverits frequency and signal; turns it
Linked Throttle Lever (with Create Simulated)linked_throttle_leverits frequency and signal; moves it
Kinetic Bridgekinetic_bridgethe stress it passes from one network to the other

The four linked blocks share their methods, written linked_transmitter below: each method says which of them has it. Create: Connected has no ComputerCraft peripherals of its own: these methods are this mod's, and they do what the value boxes, the screens and a player's hand do.

Reaching a block. Against the computer a block is called by its side ("left"...); on a Data Cable (Minicomputer and newer) it gets a name such as kinetic_battery@12,64,-30. peripheral.find takes the first one of a type.

Brass
local bat = peripheral.find("kinetic_battery")
print(bat.charge() .. " / " .. bat.max_charge() .. " SU-hours, " .. bat.status())

Each call reads the block again, so a wrapped block never goes stale. Every method that changes a block acts at the end of the program's tick, like a player's click, with the last value asked in that tick: read the block again after a sleep to see the change. When something is wrong, the call stops the program with an error you can catch with pcall:

errorwhen
kinetic battery 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_delay' (...)a wrong argument: the text in parentheses says what is expected
this version of Create: Connected has no getBatteryLevelyour version of Create: Connected lacks what the method uses (the name at the end)
Create: Connected error: ...the block itself failed while answering

Also kinetic blocks. The battery, the three clutches and the bridge turn: they also have the methods of Create kinetic blocks (speed(), stress(), capacity(), overstressed()), and none of theirs has one of these names. On a clutch, speed() is the speed of the clutch itself, on the side the rotation comes from: whether the other side turns, coupled() or state() says. The other blocks of Create: Connected (its gearboxes, the Brass Chute, the Item Silo, the Fluid Vessel...) have no type of their own: Create kinetic blocks, Inventories and Tanks cover them.

Methods
bat.charge()How much the battery holds, in SU-hours, rounded to 3 decimals: the first number Engineer's Goggles show under "Charge".
bat.max_charge()The capacity of a battery, in SU-hours: 512 unless the server changed batteryCapacity. Every battery has the same.
bat.discharging()true while the battery gets redstone, on one of its faces or from a battery of its chain: it then gives rotation instead of taking it, as long as it has charge. false in charging mode.
bat.status()The "Battery status" of the goggles. Without redstone, "charging", then "full" once full; with redstone, "discharging", then "empty" once empty. "charging" means the battery is ready to take rotation, not that rotation reaches it: watch charge() grow to be sure.
bat.consumption()What the battery spends now, in SU per tick, the "Charge Consumption" of the goggles: the stress the network uses beyond what its other sources give, shared among its discharging batteries; 0 when they give enough. With no other load, a battery that drives belts still spends 1 SU per tick (server config batteryMinDischarge). Read it while the battery discharges: the goggles only show it then.
bat.direction()The way the battery turns while discharging, as its value box ("Rotation direction during discharge") says.
bat.set_direction(way)Sets the value box, at the end of the tick: a discharging battery turns the other way at once. Another word stops the program with bad argument #1 to 'set_direction' ("clockwise" or "counter_clockwise").
clutch.state()Where the clutch is. A comparator against it reads 0 when it is uncoupled, 15 otherwise.
clutch.delay()The value box "Uncouple Delay", in ticks (20 per second), from 1 to 72000 (one hour). A new clutch waits 1 tick.
clutch.set_delay(ticks)Sets the delay, kept between 1 and 72000, at the end of the tick. Any whole number of ticks works, where the value box counts in ticks, seconds or minutes. A delay shorter than a countdown under way shortens it too. A number with decimals stops the program with bad argument #1 to 'set_delay' (number has no integer representation).
clutch.countdown()While the state is "uncoupling", how many ticks remain before the clutch uncouples; 0 in the two other states.
clutch.reset()Couples the clutch again, like a wrench, at the end of the tick. Returns false, and does nothing, when the clutch was not uncoupled. Like the wrench, it has no effect while the clutch's own network is still overstressed, and if the overload comes back once coupled, the countdown starts again.
cc.coupled()true while the clutch passes its rotation on, false while it is uncoupled.
cc.threshold()The speed of the value box, in RPM, whatever the mode.
cc.mode()Which row of the value box is chosen: "min" is "Minimum Speed" (≥), "max" is "Maximum Speed" (≤).
cc.set_threshold(rpm)Sets the threshold, kept between 1 and 256, and keeps the mode; at the end of the tick. A number with decimals stops the program with bad argument #1 to 'set_threshold' (number has no integer representation).
cc.set_mode(mode)Switches the mode and keeps the threshold, at the end of the tick. Another word stops the program with bad argument #1 to 'set_mode' (min, max).
fw.coupled()true while the input turns the right way and the clutch passes it on.
fw.direction()The way of its value box ("Rotation Direction").
fw.set_direction(way)Sets the value box, at the end of the tick; the clutch couples or uncouples at once if its input now turns the right or the wrong way. Another word stops the program with bad argument #1 to 'set_direction' ("clockwise" or "counter_clockwise").
gen.running()true from the pulse that starts the program until it ends or is stopped.
gen.output()The strength at its front now: the signal of the instruction it runs, 0 when idle.
gen.input()The strength arriving at its back: the one that starts it, and the one the wait_for, loop_if and transform instructions read.
gen.step()Which instruction runs now, counted from 1 like the rows of the screen and the list of instructions(); nil while the generator waits for a pulse.
gen.instructions()The program, as its screen shows it, with its end. value is missing for loop and end, and signal for the loops and end, which have none.
gen.set_instructions(list)Replaces the program and stops the generator, at the end of the tick: its output goes to 0, and the new program waits for the next pulse at its back. The list is checked as the screen checks it:
gen.stop()Stops the program and sets the output to 0, like a signal on one of its sides, at the end of the tick. The program stays; the next pulse at its back runs it again from the start.
dash.lines()The text of the 4 lines, whoever wrote it (a player, a Display Link, a computer).
dash.set_line(n, text)Writes one line, at the end of the tick; the other three stay. A text longer than 64 characters is cut. The block itself shows about 15 characters per line, the action bar the whole line. Another line number stops the program with bad argument #1 to 'set_line' (line 1 to 4). To empty one line, write "".
dash.clear()Empties the 4 lines, like a click with an empty hand, at the end of the tick.
dash.color()The dye of the text, like "white" (a new dashboard) or "light_blue".
dash.set_color(color)Dyes the text, at the end of the tick, on the block and in the action bar. "grey" works for "gray"; another word stops the program with an error listing the 16 names. A glowing text stays glowing.
dash.open()true while the dashboard sends its text to the player seated in front of it; false once a wrench has switched that off. The block shows its text either way, and a program writes it either way.
lever.frequency()The frequency it transmits on, as item ids; "minecraft:air" for an empty slot. All four linked blocks have it.
lever.powered()true while the lever is on, and transmits 15. Linked Lever only.
lever.set_powered(on)Pulls the lever like a player, at the end of the tick, when it is not already that way: it clicks, powers the blocks around it and transmits. Linked Lever only. Anything but a boolean stops the program with bad argument #1 to 'set_powered' (boolean expected, got number).
button.pressed()true while the button is in, and transmits 15. Linked Button only.
button.press()Presses the button like a player, at the end of the tick: it transmits until it pops back out, after 1 second for a stone button and 1.5 seconds for a wooden one. Returns false, and does nothing, while the button is already in. Linked Button only.
lever.signal()Where the lever stands, from 0 to 15: the signal it gives and transmits. Linked Analog Lever and Linked Throttle Lever.
lever.set_signal(power)Moves the lever to that signal, kept between 0 and 15, at the end of the tick. Linked Analog Lever and Linked Throttle Lever. An Analog Lever turns notch by notch, as under a player's hand: signal() gives the new position at once, but its output and what it transmits follow 15 ticks (0.75 s) after the last notch. A Throttle Lever transmits the new signal at once, and gives the signal asked even when a wrench has inverted it.
bridge.stress_impact()The value box, in SU per RPM, rounded to 3 decimals: below 16 the steps have decimals (1.072, 1.149...), from 16 up they are whole numbers.
bridge.set_stress_impact(su)Takes the nearest step of the value box, between 1 and 65536, at the end of the tick, and returns it at once.

Kinetic Battery

The Kinetic Battery stores rotation. Without redstone it charges: it is a load on the network at its front (64 SU per RPM with the default settings) and stores what it draws. With a redstone signal on any face it discharges: it turns its front at a fixed speed (64 RPM by default, Create: Connected's server config batteryDischargeRPM), the way its value box says, and gives up to 32 SU per RPM. A discharging battery spends only the stress the network uses beyond its other sources: when they are enough, it spends nothing. Batteries in a line, facing the same way, share their redstone: one powered battery makes the whole chain discharge.

The charge is counted in SU-hours, the unit Engineer's Goggles show: one SU-hour is what a load of 1 SU spends in an hour (72,000 ticks). A battery holds 512 SU-hours by default (server config batteryCapacity), so a load of 256 SU empties it in 2 hours. A computer makes it discharge by giving it redstone: rs.set when it touches the battery, a Redstone Link next to it otherwise (link).

#

bat.charge()

→ number

How much the battery holds, in SU-hours, rounded to 3 decimals: the first number Engineer's Goggles show under "Charge".

Returns
number
the charge it holds, in SU-hours
Brass
local bat = peripheral.find("kinetic_battery")
print(string.format("%.1f SU-hours", bat.charge()))

See also kinetic_battery.max_charge() kinetic_battery.consumption()

#

bat.max_charge()

→ number

The capacity of a battery, in SU-hours: 512 unless the server changed batteryCapacity. Every battery has the same.

Returns
number
the most it holds, in SU-hours
Brass
local bat = peripheral.find("kinetic_battery")
print(math.floor(bat.charge() / bat.max_charge() * 100) .. " %")

See also kinetic_battery.charge()

#

bat.discharging()

→ boolean

true while the battery gets redstone, on one of its faces or from a battery of its chain: it then gives rotation instead of taking it, as long as it has charge. false in charging mode.

Returns
boolean
true while redstone makes it discharge
Brass
local bat = peripheral.find("kinetic_battery")
if bat.discharging() then
  print("On battery")
end

See also kinetic_battery.status()

#

bat.status()

→ string

The "Battery status" of the goggles. Without redstone, "charging", then "full" once full; with redstone, "discharging", then "empty" once empty. "charging" means the battery is ready to take rotation, not that rotation reaches it: watch charge() grow to be sure.

Returns
string
"charging", "discharging", "full" or "empty"
Brass
local bat = peripheral.wrap("left")
if bat.status() == "empty" then
  rs.set("left", false)   -- back to charging
end

See also kinetic_battery.discharging()

#

bat.consumption()

→ number

What the battery spends now, in SU per tick, the "Charge Consumption" of the goggles: the stress the network uses beyond what its other sources give, shared among its discharging batteries; 0 when they give enough. With no other load, a battery that drives belts still spends 1 SU per tick (server config batteryMinDischarge). Read it while the battery discharges: the goggles only show it then.

Returns
number
the SU it takes from its charge each tick

Since the charge is in SU-hours, the charge divided by the consumption is the time left, in hours:

Brass
local bat = peripheral.find("kinetic_battery")
local use = bat.consumption()
if bat.discharging() and use > 0 then
  print(math.floor(bat.charge() / use * 60) .. " minutes left")
end

See also kinetic_battery.charge()

#

bat.direction()

→ string

The way the battery turns while discharging, as its value box ("Rotation direction during discharge") says.

Returns
string
"clockwise" or "counter_clockwise"
Brass
print(bat.direction())

See also kinetic_battery.set_direction()

#

bat.set_direction(way)

Sets the value box, at the end of the tick: a discharging battery turns the other way at once. Another word stops the program with bad argument #1 to 'set_direction' ("clockwise" or "counter_clockwise").

Parameters
way string
"clockwise" or "counter_clockwise"
Brass
bat.set_direction("counter_clockwise")

See also kinetic_battery.direction()

Overstress Clutch

The Overstress Clutch protects a network. When the network it is part of becomes overstressed, it counts down its delay, then uncouples: the rotation stops on its far side, and the rest of the network turns again. If the overload goes away during the countdown, it stays coupled. Once uncoupled, it stays so until it is reset by a wrench, a redstone pulse or reset(), and only once its own network is no longer overstressed. While it gets redstone, it never uncouples.

#

clutch.state()

→ string

Where the clutch is. A comparator against it reads 0 when it is uncoupled, 15 otherwise.

Returns
string
"coupled", "uncoupling" (counting down) or "uncoupled"
Brass
local clutch = peripheral.find("overstress_clutch")
print(clutch.state())

See also overstress_clutch.countdown() overstress_clutch.reset()

#

clutch.delay()

→ number

The value box "Uncouple Delay", in ticks (20 per second), from 1 to 72000 (one hour). A new clutch waits 1 tick.

Returns
number
the ticks it waits before uncoupling
Brass
print(clutch.delay() / 20 .. " seconds")

See also overstress_clutch.set_delay()

#

clutch.set_delay(ticks)

Sets the delay, kept between 1 and 72000, at the end of the tick. Any whole number of ticks works, where the value box counts in ticks, seconds or minutes. A delay shorter than a countdown under way shortens it too. A number with decimals stops the program with bad argument #1 to 'set_delay' (number has no integer representation).

Parameters
ticks number
the new delay, a whole number of ticks
Brass
clutch.set_delay(40) -- 2 seconds

See also overstress_clutch.delay()

#

clutch.countdown()

→ number

While the state is "uncoupling", how many ticks remain before the clutch uncouples; 0 in the two other states.

Returns
number
the ticks left before it uncouples, 0 when it is not counting down
Brass
if clutch.state() == "uncoupling" then
  print("uncoupling in " .. clutch.countdown() .. " ticks")
end

See also overstress_clutch.state()

#

clutch.reset()

→ boolean

Couples the clutch again, like a wrench, at the end of the tick. Returns false, and does nothing, when the clutch was not uncoupled. Like the wrench, it has no effect while the clutch's own network is still overstressed, and if the overload comes back once coupled, the countdown starts again.

Returns
boolean
true when the clutch was uncoupled

A clutch that tries again by itself every 30 seconds:

Brass
local clutch = peripheral.find("overstress_clutch")
while true do
  if clutch.reset() then
    print("clutch reset")
  end
  sleep(30)
end

See also overstress_clutch.state()

Centrifugal Clutch

The Centrifugal Clutch couples only at the right speed. In mode "min" (the "≥" row of its value box) it is coupled while its input turns at its threshold or faster; in mode "max" (the "≤" row), while its input turns at its threshold or slower. Stopped, it is always uncoupled, and it does not change while its network is overstressed. A new one couples from 64 RPM up.

#

cc.coupled()

→ boolean

true while the clutch passes its rotation on, false while it is uncoupled.

Returns
boolean
true while it lets rotation through
Brass
local cc = peripheral.find("centrifugal_clutch")
print(cc.coupled())

See also centrifugal_clutch.threshold()

#

cc.threshold()

→ number

The speed of the value box, in RPM, whatever the mode.

Returns
number
its speed threshold, from 1 to 256 RPM
Brass
print(cc.threshold() .. " RPM, mode " .. cc.mode())

See also centrifugal_clutch.mode() centrifugal_clutch.set_threshold()

#

cc.mode()

→ string

Which row of the value box is chosen: "min" is "Minimum Speed" (≥), "max" is "Maximum Speed" (≤).

Returns
string
"min" (couples at the threshold and faster) or "max" (at the threshold and slower)
Brass
print(cc.mode())

See also centrifugal_clutch.set_mode()

#

cc.set_threshold(rpm)

Sets the threshold, kept between 1 and 256, and keeps the mode; at the end of the tick. A number with decimals stops the program with bad argument #1 to 'set_threshold' (number has no integer representation).

Parameters
rpm number
the new threshold, a whole number of RPM
Brass
cc.set_threshold(128)

See also centrifugal_clutch.threshold()

#

cc.set_mode(mode)

Switches the mode and keeps the threshold, at the end of the tick. Another word stops the program with bad argument #1 to 'set_mode' (min, max).

Parameters
mode string
"min" or "max"
Brass
cc.set_mode("max") -- only up to the threshold: a speed limiter

See also centrifugal_clutch.mode()

Freewheel Clutch

The Freewheel Clutch lets rotation through one way only: it is coupled while its input turns the way its value box says, and uncoupled when it turns the other way or stands still. It does not change while its network is overstressed.

#

fw.coupled()

→ boolean

true while the input turns the right way and the clutch passes it on.

Returns
boolean
true while it lets rotation through
Brass
local fw = peripheral.find("freewheel_clutch")
print(fw.coupled())

See also freewheel_clutch.direction()

#

fw.direction()

→ string

The way of its value box ("Rotation Direction").

Returns
string
"clockwise" or "counter_clockwise", the way it lets through
Brass
print(fw.direction())

See also freewheel_clutch.set_direction()

#

fw.set_direction(way)

Sets the value box, at the end of the tick; the clutch couples or uncouples at once if its input now turns the right or the wrong way. Another word stops the program with bad argument #1 to 'set_direction' ("clockwise" or "counter_clockwise").

Parameters
way string
"clockwise" or "counter_clockwise"
Brass
fw.set_direction("clockwise")

See also freewheel_clutch.direction()

Sequenced Pulse Generator

The Sequenced Pulse Generator plays a little program of redstone signals. It sits on the ground like a repeater: its input is at its back, its output at its front, and a signal on one of its sides stops it at once. Idle, it waits; when the signal at its back rises (any change to a strength above 0), it runs its program from the first instruction, then sets its output back to 0 and waits for the next pulse. A comparator reads the step it is on.

A player writes the program in its screen (right-click); a computer reads it and replaces it. A computer starts it like a player does, with a pulse at its back: rs.set on the face that touches its back, or a Redstone Link receiver there.

The program is a list of 1 to 7 instructions, each a table {type=, value=, signal=}: the three columns of the screen. Times are in ticks (20 per second); the input is the signal at the generator's back. The default is what the screen gives a new instruction.

typein its screenvalue (default)signal (default)
outputOutputhow long, 1 to 600 ticks (10)the strength it outputs, 0 to 15 (15)
transformTransform until changethe formula, 0 to 9, see below (2)the constant C, 0 to 15 (15)
wait_forOutput until state1 waits for the input to turn on, 0 to turn off (1)the strength it outputs meanwhile (0)
wait_for_minOutput until min signalwaits for the input to rise to this or more, 0 to 15 (8)the same (0)
wait_for_maxOutput until max signalwaits for the input to fall to this or less, 0 to 15 (7)the same (0)
wait_for_exactOutput until exact signalwaits for the input to become exactly this, 0 to 15 (7)the same (0)
loop_forLoop forhow many times the instructions above it run in all, 1 to 100 (3)none
loop_ifLoop if state1 goes back to the top while the input is on, 0 while it is off (1)none
loop_if_minLoop if min signalback to the top while the input is this or more, 0 to 15 (8)none
loop_if_maxLoop if max signalback to the top while the input is this or less, 0 to 15 (7)none
loop_if_exactLoop if exact signalback to the top while the input is exactly this, 0 to 15 (7)none
loopLoopnone: back to the top, forevernone
endEndnone: the program ends, output 0none
  • The wait_for instructions wait for a change of the input: an input already at the target must leave it and come back. The loops look at the input as it is, and go on to the next instruction when they do not loop.
  • "The top" is the first instruction. loop and end close the program: nothing after them counts.
  • transform outputs a formula of the input I and the constant C, kept between 0 and 15, until the input changes: 0 I+C, 1 I-C, 2 C-I, 3 I×C, 4 I÷C (whole division, 0 when C is 0), 5 I&C, 6 I|C, 7 I^C (and, or, exclusive or, bit by bit), 8 I<<C, 9 I>>C (shifts, keeping 4 bits).
#

gen.running()

→ boolean

true from the pulse that starts the program until it ends or is stopped.

Returns
boolean
true while its program runs
Brass
local gen = peripheral.find("sequenced_pulse_generator")
print(gen.running(), gen.step())

See also sequenced_pulse_generator.step()

#

gen.output()

→ number

The strength at its front now: the signal of the instruction it runs, 0 when idle.

Returns
number
the signal it gives now, from 0 to 15
Brass
print(gen.output())

See also sequenced_pulse_generator.input()

#

gen.input()

→ number

The strength arriving at its back: the one that starts it, and the one the wait_for, loop_if and transform instructions read.

Returns
number
the signal at its back, from 0 to 15
Brass
print(gen.input())

See also sequenced_pulse_generator.output()

#

gen.step()

→ number|nil

Which instruction runs now, counted from 1 like the rows of the screen and the list of instructions(); nil while the generator waits for a pulse.

Returns
number|nil
the instruction it runs, from 1; nil when idle
Brass
local s = gen.step()
if s then
  print("step " .. s .. ": " .. gen.instructions()[s].type)
end

See also sequenced_pulse_generator.instructions()

#

gen.instructions()

→ table

The program, as its screen shows it, with its end. value is missing for loop and end, and signal for the loops and end, which have none.

Returns
table
its program, one {type=, value=, signal=} per instruction
Brass
for i, ins in ipairs(gen.instructions()) do
  print(i, ins.type, ins.value, ins.signal)
end

See also sequenced_pulse_generator.set_instructions()

#

gen.set_instructions(list)

Replaces the program and stops the generator, at the end of the tick: its output goes to 0, and the new program waits for the next pulse at its back. The list is checked as the screen checks it:

Parameters
list table
1 to 7 instructions, each {type=, value=, signal=}
  • 1 to 7 entries, or bad argument #1 to 'set_instructions' (1 to 7 instructions);
  • each entry a table with a known type (in lower case), or bad instruction #2 to 'set_instructions' (...), the text in parentheses saying what is wrong;
  • value and signal are rounded to whole numbers and kept within their bounds (the table above); a missing one takes its default, and one the type does not use is ignored;
  • nothing after the first end or loop is kept;
  • an end is added after the last instruction when there is room for it (fewer than 7), as the screen does.

A light that blinks one second on, one second off, until a signal on a side of the generator stops it. The generator is on the right of the computer, its back against it:

Brass
local gen = peripheral.wrap("right")
gen.set_instructions({
  {type = "output", value = 20, signal = 15},
  {type = "output", value = 20, signal = 0},
  {type = "loop"},
})
sleep(0.1)              -- the new program is in place
rs.set("right", true)   -- a pulse at its back starts it
sleep(0.1)
rs.set("right", false)

See also sequenced_pulse_generator.instructions() sequenced_pulse_generator.stop()

#

gen.stop()

Stops the program and sets the output to 0, like a signal on one of its sides, at the end of the tick. The program stays; the next pulse at its back runs it again from the start.

Brass
gen.stop()

See also sequenced_pulse_generator.running()

Dashboard

The Dashboard is a small screen of 4 lines. Its text shows on the block, and in the action bar (the line above the hotbar) of a player seated right in front of it, on a Seat for example: the lines that are not empty, side by side, in its colour. Several dashboards around the same seat take turns every 2 seconds. A wrench switches the action bar off and on again; the block keeps showing its text. Players write on it with a Clipboard, a Name Tag or a Display Link, dye it, and empty it with an empty hand: a computer writes, colours and empties it from a program.

#

dash.lines()

→ table

The text of the 4 lines, whoever wrote it (a player, a Display Link, a computer).

Returns
table
its 4 lines of text, "" for an empty one
Brass
local dash = peripheral.find("dashboard")
for i, line in ipairs(dash.lines()) do
  print(i, line)
end

See also dashboard.set_line()

#

dash.set_line(n, text)

Writes one line, at the end of the tick; the other three stay. A text longer than 64 characters is cut. The block itself shows about 15 characters per line, the action bar the whole line. Another line number stops the program with bad argument #1 to 'set_line' (line 1 to 4). To empty one line, write "".

Parameters
n number
the line, from 1 to 4
text string
what to write (a number is written as tostring writes it)

A Display Link aimed at the dashboard writes its lines too: the last one to write wins.

Brass
dash.set_line(1, "Speed: 64 RPM")

See also dashboard.lines() dashboard.clear()

#

dash.clear()

Empties the 4 lines, like a click with an empty hand, at the end of the tick.

Brass
dash.clear()

See also dashboard.set_line()

#

dash.color()

→ string

The dye of the text, like "white" (a new dashboard) or "light_blue".

Returns
string
the colour of its text, a dye name
Brass
print(dash.color())

See also dashboard.set_color()

#

dash.set_color(color)

Dyes the text, at the end of the tick, on the block and in the action bar. "grey" works for "gray"; another word stops the program with an error listing the 16 names. A glowing text stays glowing.

Parameters
color string
a dye name: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black
Brass
dash.set_color("lime")

See also dashboard.color()

#

dash.open()

→ boolean

true while the dashboard sends its text to the player seated in front of it; false once a wrench has switched that off. The block shows its text either way, and a program writes it either way.

Returns
boolean
true while it sends its text to the action bar of a seated player
Brass
if not dash.open() then
  print("the dashboard is off: use a wrench on it")
end

See also dashboard.lines()

Linked levers and buttons

A Linked Transmitter (an item of Create: Connected) used on a lever, a button or an Analog Lever makes it a linked one: it still works as before and powers the blocks around it, and it also transmits its signal on a Redstone Link frequency, set by the two items in its slots, to the receivers in range (see Redstone Link). With Create Simulated (it comes with Create Aeronautics), the transmitter also fits its Throttle Lever. A wrench takes the transmitter off: the block is a plain one again, and a call stops the program with linked lever removed.

A computer moves these blocks like a player, so the receivers follow, and reads their frequency, to listen to it with link. To transmit without any block, link.set is enough: a linked lever is for a frequency that a player also works by hand.

#

lever.frequency()

→ table

The frequency it transmits on, as item ids; "minecraft:air" for an empty slot. All four linked blocks have it.

Returns
table
{a=, b=}, the item ids in its two frequency slots
Brass
local lever = peripheral.find("linked_lever")
local f = lever.frequency()
print(f.a, f.b)
print("on the air: " .. link.get(f.a, f.b))

See also link.get() redstone_link.frequency()

#

lever.powered()

→ boolean

true while the lever is on, and transmits 15. Linked Lever only.

Returns
boolean
true while the lever is on
Brass
print(lever.powered())

See also linked_transmitter.set_powered()

#

lever.set_powered(on)

Pulls the lever like a player, at the end of the tick, when it is not already that way: it clicks, powers the blocks around it and transmits. Linked Lever only. Anything but a boolean stops the program with bad argument #1 to 'set_powered' (boolean expected, got number).

Parameters
on boolean
true to turn the lever on, false to turn it off
Brass
lever.set_powered(true)

See also linked_transmitter.powered()

#

button.pressed()

→ boolean

true while the button is in, and transmits 15. Linked Button only.

Returns
boolean
true while the button is pressed
Brass
local button = peripheral.find("linked_button")
print(button.pressed())

See also linked_transmitter.press()

#

button.press()

→ boolean

Presses the button like a player, at the end of the tick: it transmits until it pops back out, after 1 second for a stone button and 1.5 seconds for a wooden one. Returns false, and does nothing, while the button is already in. Linked Button only.

Returns
boolean
true when it pressed the button, false when it was already pressed
Brass
button.press()

See also linked_transmitter.pressed()

#

lever.signal()

→ number

Where the lever stands, from 0 to 15: the signal it gives and transmits. Linked Analog Lever and Linked Throttle Lever.

Returns
number
the signal of the lever, from 0 to 15
Brass
local lever = peripheral.find("linked_analog_lever")
print(lever.signal())

See also linked_transmitter.set_signal()

#

lever.set_signal(power)

Moves the lever to that signal, kept between 0 and 15, at the end of the tick. Linked Analog Lever and Linked Throttle Lever. An Analog Lever turns notch by notch, as under a player's hand: signal() gives the new position at once, but its output and what it transmits follow 15 ticks (0.75 s) after the last notch. A Throttle Lever transmits the new signal at once, and gives the signal asked even when a wrench has inverted it.

Parameters
power number
the signal wanted, a whole number from 0 to 15
Brass
lever.set_signal(8)

See also linked_transmitter.signal()

Kinetic Bridge

The Kinetic Bridge passes power from one network to another while keeping them apart. It is two blocks: the half with the value box takes the rotation and is the peripheral; it is a load of impact × RPM SU on its network. The other half turns at the same speed and gives the second network as much capacity, so an overload there does not stop the first network. When the first network is overstressed, the bridge passes nothing on. The value box, "Stress Impact per RPM", goes from 1 to 65536 in 160 steps, each about 7 % above the one before; a new bridge takes 16. The other half is only a Create kinetic blocks block.

#

bridge.stress_impact()

→ number

The value box, in SU per RPM, rounded to 3 decimals: below 16 the steps have decimals (1.072, 1.149...), from 16 up they are whole numbers.

Returns
number
the SU per RPM it takes, and gives at its other end
Brass
local bridge = peripheral.find("kinetic_bridge")
print(bridge.stress_impact() * math.abs(bridge.speed()) .. " SU passed on")

See also kinetic_bridge.set_stress_impact()

#

bridge.set_stress_impact(su)

→ number

Takes the nearest step of the value box, between 1 and 65536, at the end of the tick, and returns it at once.

Parameters
su number
the SU per RPM wanted
Returns
number
the impact kept, a step of the value box
Brass
print(bridge.set_stress_impact(16))
print(bridge.set_stress_impact(100))
print(bridge.set_stress_impact(1000))

This prints 16, then 97 and 1024, the steps nearest to 100 and 1000.

See also kinetic_bridge.stress_impact()

A battery with a reserve

A Kinetic Battery on the left of the computer, a lever behind it, a Dashboard in front of a seat, on the computer's Data Cable. The lever asks for battery power; the computer gives the battery redstone, but keeps a reserve: below 10 % it stops the discharge, and allows it again from 25 %. The dashboard shows the charge, the status and the time left to the seated player.

Brass
local bat = peripheral.wrap("left")
local dash = peripheral.find("dashboard")
local LOW, HIGH = 0.10, 0.25
local reserve = false

while true do
  local share = bat.charge() / bat.max_charge()
  if share <= LOW then
    reserve = true
  elseif share >= HIGH then
    reserve = false
  end
  local wanted = rs.get("back") > 0
  rs.set("left", wanted and not reserve)

  dash.set_line(1, "Battery " .. math.floor(share * 100) .. " %")
  dash.set_line(2, bat.status())
  local use = bat.consumption()
  if bat.discharging() and use > 0 then
    dash.set_line(3, math.floor(bat.charge() / use * 60) .. " min left")
  else
    dash.set_line(3, "")
  end
  if wanted and reserve then
    dash.set_line(4, "Reserve!")
  else
    dash.set_line(4, "")
  end
  dash.set_color(reserve and "red" or "lime")
  sleep(1)
end