From b5ea4fc2d20d094ab02f04fecf0db8d429bc0288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sat, 7 Dec 2013 05:24:00 -0800 Subject: [PATCH] Created Component/Redstone (markdown) --- Component-Redstone.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Component-Redstone.md diff --git a/Component-Redstone.md b/Component-Redstone.md new file mode 100644 index 0000000..22cf8fd --- /dev/null +++ b/Component-Redstone.md @@ -0,0 +1,25 @@ +This component represents a [[Redstone card|Items]]. Note that the functions for bundled input/output are only available if a mod providing bundled Redstone (RedLogic, MineFactory Reloaded) is installed. + +Component name: `redstone`. +Callbacks: +- `getInput(side: number): number` + Gets the current ingoing redstone signal from the specified [[side|API/Sides]]. Note that the side is relative to the computer's orientation, i.e. `sides.south` is *in front of the computer*, not south in the world. Likewise, `sides.left` is to the left of the computer, so when you look at the computer's front, it'll be to your right. + If you use mods such as RedLogic the input may exceed the vanilla values of [0, 15]. +- `getOutput(side: number): number` + Gets the currently set output on the specified side. +- `setOutput(side: number, value: number): number` + Sets the strength of the redstone signal to emit on the specified side. Returns the new value. + This can be an arbitrarily large number for mods that support this. For vanilla interaction it is clamped to the interval [0, 15]. +- `getBundledInput(side: number, color: number): number` + Like `getInput`, but for bundled input, reading the value for the channel with the specified [[color|API/Colors]]. +- `getBundledOutput(side: number, color: number): number` + Like `getOutput`, but for bundled output, getting the value for the channel with the specified [[color|API/Colors]]. +- `setBundledOutput(side: number, color: number, value: number): number` + Like `setOutput`, but for bundled output, setting the value for the channel with the specified [[color|API/Colors]]. + +Example use: +```lua +local rs = component.redstone -- get primary redstone component +print(rs.getInput(sides.back)) +rs.setBundledOutput(sides.bottom, colors.green, rs.getBundledInput(sides.top, colors.red)) +``` \ No newline at end of file