PneumaticCraft Wiki – ComputerCraft Support

When having ComputerCraft installed along with PneumaticCraft, you’ll be able to interact with almost every PneumaticCraft machine, and Drones. Any of the following mentioned machines can be interacted with as ComputerCraft peripherals. In Lua, you can type “m = peripheral.wrap(<side>)”, with <side> being the side of the computer the peripheral is connected to (top, bottom, left, right, back, front). After this, you can use any of the mentioned functions by doing “m.<functionName>”.
Anywhere in the following functions where a ‘<side>’ appears as one of the arguments, ‘up’, ‘down’, ‘north’, ‘south’, ‘east’, ‘west’ are valid arguments.
If there are still some functions you’d like to have exposed after reading this, don’t hesitate to put up a suggestion.

Every machine running on compressed air
You can get the following info from any PneumaticCraft block that runs on compressed air (including the Air Compressor, Pressure Tube):
-getPressure(), getPressure(<side>) – Will get the pressure in the block. The side parameter is an optional parameter, and is currently only useful when getting the pressure from a Vacuum Pump, as it contains two different pressures.
-getDangerPressure() – This is a constant, it’ll be 5 bar for tier one machines, and 20 for tier two.
-getCriticalPressure() – This is a constant, it’ll be 7 bar for tier two machines, and 25 for tier two.

Air Cannon
Apart from the methods that apply to any pneumatic machine, you can also use the following functions on Air Cannons:
-setExternalControl(<true/false>) – When parsed true, this will disable the Cannon to be rotated with normal methods (GPS Tool insertion, change in range upgrades..)
-setTargetLocation(<x>,<y>,<z>) – Makes the Air Cannon target the given location. This normally would be the location stored in a GPS Tool.
-setRotationAngle(<angle>) – Makes the Air Cannon rotate its vertical axis to the angle specified.
-setHeightAngle(<angle>) – Makes the Air Cannon rotate the height angle to the angle specified.
-isDoneRotating() – Returns true when the cannon is done turning.
-getMinWorkingPressure() – Returns the minimal pressure needed to fire the cannon (the yellow to green threshold in the GUI).
-fire() – Will fire the Air Cannon, provided that there’s enough pressure to do so, and when there are items inserted. Returns true if successful.

Elevator (Base)
Apart from the methods that apply to any pneumatic machine, you can also use the following functions when connected to any Elevator Base:
-setExternalControl(<true/false>) – When parsed true, this will set the Elevator’s ‘redstone mode’ to ‘Elevator Caller’ mode, which is also applicable for ComputerCraft control. You don’t have to set it prior to calling setTargetHeight though: The mode will be changed to external control automatically.
-getMinWorkingPressure() – Returns the minimal pressure needed to extend the Elevator (the yellow to green threshold in the GUI). Making the Elevator go down is free.
-setTargetHeight(<height>) – Sets the Elevator’s target height to the height parsed (in meters/blocks).

Universal Sensor
Apart from the methods that apply to any pneumatic machine, you can also use the following functions when connected to any Universal Sensor:
-getSensorNames() – Will return a table of all sensor names.
-setSensor(<sensorName>), setSensor(<index>), setSensor() – Will set the current selected sensor the the sensor provided. The sensor name should be one of the names returned by getSensorNames(). The index should be an index on the returned table from getSensorNames(), so if you want to select the second sensor, do setSensor(2). This function will return true if the sensor is possible with the currently inserted upgrades. When using setSensor(), the Universal Sensor will select no sensor (therefore using no air).
-getSensor() – Returns the name of the current selected sensor.
-setTextField(<text>) – Some sensors use a text field to specify additional options (like the Entity in range accepts ‘@player’ to select players only). You can specify the desired text in here.
-getTextField() – Returns the current text field stored in the Universal Sensor
-isSensorEventBased() – There are two categories of sensors: Event based, and polling sensors. Event based sensors wait for an occurence to happen (player attacks, item pickups). Polling sensors check the state of the sensor once in a while (entities in range, world time, rain sensor). This function returns true if the current selected sensor is event based.
-getSensorValue() – When the current sensor is a poll sensor, this will return the (non-inverted) redstone signal it would output. This is equal to getting the redstone signal using ComputerCraft. Keep in mind that setting the sensor and immeadiately getting the output is not reliable, as many polling sensors are polling lazily to improve performance. The advantage of using getSensorValue() is that a pull-event will be triggered. When there’s no polling sensor selected an exception will be thrown.
-getMinWorkingPressure() – Returns the minimal pressure needed to make the Universal Sensor work (the yellow to green threshold in the GUI).
-setGPSToolCoordinate(<slotIndex>,<x>,<y>,<z>) Sets the location stored in the GPS Tool located in the given slot (starting with 1) to the provided location. This is useful for sensors that use a location.

Drone Interface
The Drone Interface is a block that only gets added when ComputerCraft is installed. It’s a peripheral that’s used to communicate with Drones. To do so, program a Drone with a ComputerCraft puzzle piece. You can combine it with other puzzle pieces. When the Drone gets to the ComputerCraft piece, it’ll try to connect to an available Drone Interface located within the selected area. Available, because a Drone Interface can connect to one Drone at a time only. The following functions apply:
-isConnectedToDrone() – Returns true if a Drone has connected with this Drone Interface (when the Drone’s program has arrived at the ComputerCraft piece and made a connection).
-getDronePressure() – Returns the pressure of the connected Drone.
-getDronePosition() – Returns a table of 3 double values containing the x,y and z position respectively of the Drone.
-exitPiece() – Stops the ComputerCraft piece in the Drone, and allows the Drone’s program to proceed to the next puzzle piece.
-getAllActions() – Returns a table of all the current selectable actions (like ‘dig’ or ‘place’).
-setBlockOrder(<closest/highToLow/lowToHigh>) – Sets the place/dig order of the Drone.
-getAreaTypes() – Returns a table of all the possible area types (filled, frame, sphere, ..).
-addArea(<x>,<y>,<z>), addArea(<x1>,<y1>,<z1>,<x2>,<y2>,<z2>,<areaType>) – Adds an area to the current stored area of the Drone. When using the latter method, x1, y1, and z1, represent the first point (which would be the first GPS Tool normally), and x2, y2, and z2 represent the second point.
-removeArea(<x>,<y>,<z>), removeArea(<x1>,<y1>,<z1>,<x2>,<y2>,<z2>,<areaType>) – Removes an area from the current stored area (like blacklisting).
-clearArea() – Clears the current stored area.
-showArea() – Will show the current stored area using the area renderer you are used to.
-addWhitelistItemFilter(<item/block name>, <damage/metadata>, <useMetadata>, <useNBT>, <useOreDictionary>, <useModSimilarity>) – Acts as you’ve put a Item Filter piece on the right of a piece (making it whitelisting). The item/block name is in Minecraft format, i.e. “minecraft:stone”, or “pneumaticcraft:pressureTube”. The ‘useXXX’ are all booleans that determine what filters will be used (same functionality as the check boxes in the Item Filter puzzle piece).
-addBlacklistItemFilter(<item/block name>, <damage/metadata>, <useMetadata>, <useNBT>, <useOreDictionary>, <useModSimilarity>) – Like the addWhitelistItemFilter(…), but to blacklist items.
-clearWhitelistItemFilter() – Clears all the whitelisted item filters stored.
-clearBlacklistItemFilter() – Clears all the blacklisted item filters stored.
-addWhitelistText(<text>) – Adds a text to the whitelisted texts. Used to specify a filter for the Entity Attack action for example.
-addBlacklistText(<text>) – Adds a text to the blacklisted texts. Used to specify a filter for the Entity Attack action for example.
-clearWhitelistText() – Clears the stored whitelisted texts.
-clearBlacklistText() – Clears the stored blacklisted texts.
-setSide(<side>, <accessible>) – Sets the specific side to be accessible or not. Used in the Inventory Im- and Export actions to set which side of the inventory the Drone can access. It is also used for the Place action to determine how to place the block.
-setSides(<down>, <up>, <north>, <south>, <east>, <west>) – Same as above, now in one function to set all sides at once (6x boolean).
-setAction(<action>) – String that represents the action. This should be one of the actions returned by getAllActions().
-abortAction() – Stops the current running action.
-isActionDone() – Returns true if the current action is done (goto has arrived at the target location, inventory import can’t import anymore, dig has dug every possible block, ..).

Anytime the Drone gets updated a ring will be shot out of the Drone Interface, indicating it was successful. The color of the ring is the same color as the puzzle piece it was associated with.

14 thoughts on “PneumaticCraft Wiki – ComputerCraft Support”

  1. MineMaarten, thanks very much for this documentation. Some mod peripherals are VERY hard to work with.

    One request? If your machines are compatible with CC wired modems, could you list the names used for each machine? It would be nice to be able to wrap them with a“machineType”).

    P.S. I’m playing through the mod again and loving the changes to plastic.

    1. There is no method called setMaxHeight() in the elevator obviously. IIRC to make the elevator go to a certain height call “setHeight”. Use the IGW-Mod to make sure.

  2. Could you possibly add a function to each machine to return a table of all of the functions said machine has available to be called?

  3. Is there any kind of interaction between the pneumatic helmet and computercrafts new pocket computers? If not this is definitely something that should be added :)

Leave a Reply to Markus Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Doing more with Minecraft!