Skip to content

1.12.2 functions

Clément Vandendaelen edited this page Apr 23, 2020 · 2 revisions

ComputerCraft

For this example we will take this situation :

m = peripheral.wrap("left")

Returns a table of functions, allowing you to call peripheral methods as if they were normal Lua functions. If no peripheral is connected, returns nil. (http://computercraft.info/wiki/Peripheral.wrap)

Here's a working example : https://gist.github.com/LotuxPunk/6a45b7076c05d1bb15c690a9c4a38623

OpenComputers

For this example we will take this situation :

component = require("component")
m = component.tardisinterface

Now you can do what ever you want !

Get TARDIS Location

local x, y, z = m.getTardisPos()

Returns the 3 coordinate of your TARDIS Location (x, y, z)

Set TARDIS Destination

m.setTardisDestination(x,y,z,[dimensionID])

To set the destination at 0,0 at the height 64 in OverWorld m.setTardisPos(0,64,0,0)

The dimensionID is optionnal since the 1.12.2-1.2.5.1

Get TARDIS Destination

local x, y, z, dimensionID = m.getTardisDestination()

Start Flight

m.startFlight()

Set the doors open/close

m.setDoors(boolean) -> m.setDoors(false) //to close the doors

Get is in flight

local booleanValue = m.isInFlight()

Returns a boolean value depending if is in flight.

Get fuel level

local artronUnits= m.getArtron()

Returns the Artron units

Set fueling mode

m.setFueling(boolean)

Is doors opened ?

local booleanValue = m.isDoorsOpened()

Your TARDIS is able to fly ?

local booleanValue = m.canFly()

Get the travel time (in seconds)

local timeInSecond = m.getTravelTime()

Get a TARDIS waypoint

local x, y, z, dim, name = m.getWaypoint(waypointID)

Beware, TARDIS can only save 15 waypoints (0 to 14).

Set a TARDIS waypoint

local booleanValue = m.setWaypoint(waypointID,x,y,z,dimensionID, name)

Get the health of a system

local doubleValue = m.getHealthComponent(componentID)

Get the dimensions ID of the Minecraft save

local arrayOfInt = m.getDimensionsID()

Get the dimension name

local stringValue = m.getDimensionName(dimensionID)

Set the target dimension

m.setDimensionPos(dimensionID)

Set a relative destination

m.setRelativePos(x,y,z)

Get the current dimension of the TARDIS

local dimensionID = m.getDimension()

Get the target dimension

local dimensionID = m.getTargetDimension()

You can also get the target dimension ID with getTardisDestination.

Get the Force Field status

local boolean = m.getField()

Set the Force Field status

m.setField(boolean)

Get the system name

local stringValue= m.getSystemName(componentID)

Get Stealth mode status

local boolean = m.getStealth()

Set Stealth mode status

m.setStealth(boolean)

Set Stabilizers status

m.setStabilizers(boolean)

Get Stabilizers status

local boolean = m.getStabilizers()