-
Notifications
You must be signed in to change notification settings - Fork 20
OpenComputers integration
Inception
OpenComputers is a mod about computers(duh). It adds fancy-style, modular screens, PCs, servers and much more.
AUNIS is compatible with these computers(as of version 1.5) and provides SGC-style dialing by them.
Check out this gist.
List of methods some TileEntites support
-
getGateType()
Returns:gateType
Can be one of: [MILKYWAY
,Not yet...,PEGASUS
UNIVERSE
] -
getGateStatus()
Returns:gateStatus
Can be one of: [not_merged
,open
,idle
,dialing
,dialing_computer
,unstable
,failing
]openState
WhengateStatus
isopen
this parameter istrue
for the initiating gate andfalse
on the receiving one.dialing
is when therebis a delay after pressing the Glyph on the DHD and the actual chevron locking.dialing_computer
is when you spin the gate/ring with a computer, and it returns to idle after the spin finishes. -
getEnergyRequiredToDial(symbols... or symbols:array)
Gets the energy required to dial specified gate. From Aunis 1.9.6.
Parameters:symbols...
Symbols as subsequent parameters,symbols:array
Symbols as an array.
Point of Origin is added automatically if not present
Returns:not_merged
Gate's not merged (duh), oraddress_malformed
(No such gate, address contains less than 7 symbols), orenergyMap
Map (aka array in Lua) with 3 indexes: [open
(open cost, in RF),keepAlive
(sustain cost, in RF/t),canOpen
(if the stored power is enough to open the wormhole, boolean)] -
engageSymbol(symbolName:string or symbolIndex:number): table
Spins the ring to the given symbol and engages/locks it.
Parameters:symbolName
is the name of the symbol to be engaged.symbolIndex
is the index of the symbol to be engaged. See: Mliky Way Symbols , Pegasus Symbols, Universe Symbols.
Returns:status
If null, command failed, otherwise "stargate_spin".stargate_failure_*
Name of the failure (busy, full, contains, not_merged).description
description of the failure. -
engageGate()
Tries to open the gate.
Returns:status
If null, command failed, otherwise "stargate_engage".stargate_failure_*
Name of the failure (busy, opening, not_merged).description
description of the failure.gateState
State after theengageGate
command. (BUSY [Source gate], NOT_ENOUGH_POWER, ADDRESS_MALFORMED [could mean that the target gate is busy]). -
disengageGate()
Tries to close the gate.
Returns:status
If null, command failed, otherwise "stargate_disengage".stargate_failure_*
can be one of: (wrong_end, not_open, not_merged).description
description of the failure. -
getEnergyStored()
Gets the amount of energy stored by the Gate.
Returns:energy
Amount of energy stored, in RF. -
getMaxEnergyStored()
Gets the electrical capacity of the Gate.
Returns:maxEnergy
Amount of energy that can be stored i.e. capacity, in RF. -
getCapacitorsInstalled()
Gets the amount of Capacitor Banks installed in the Gate.
Returns:capacitorCount
Capacitor count, 0-3.
-
isInGrid()
Checks if the Rings are in grid(i.e. have name and address).
Returns:isInGrid
boolean value -
getAddress()
Returns the address of attached rings.
Returns:address
integer address orNOT_IN_GRID
-
getName()
Returns the name of attached rings.
Returns:name
string name orNOT_IN_GRID
-
setAddress(address:number)
Sets the address for the attached rings. Can only be used when the rings are in a grid. Otherwise usesetAddressAndName
Returns:result
OK
orDUPLICATE_ADDRESS
-
setName(name:string)
Sets the name for the attached rings. Can only be used when the rings are in a grid. Otherwise usesetAddressAndName
-
setAddressAndName(address:number, name:string)
Sets the address and the name for the attached rings and puts them in grid.
Returns:result
OK
orDUPLICATE_ADDRESS
-
getAvailableRings()
Gets the rings to which attached platform can connect.
Returns:map
address to name mapping -
getAvailableRingsAddresses()
Gets the rings to which attached platform can connect(only addresses).
Returns:list
list of addresses -
attemptTransportTo(address:number)
Attempts to transport the player to given address.
Returns:result
can be one of: [OK
,BUSY
,BUSY_TARGET
,OBSTRUCTED
,OBSTRUCTED_TARGET
,NO_SUCH_ADDRESS
]
-
isActive()
Checks if the Beamer is active(i.e. the beam is rendered)
Returns:isActive
boolean value -
setActive(isActive:boolean)
Sets the Beamer active flag. Only effective when Redstone Control is set to Ignore. Changing the Redstone Mode clears this flag.
Parameters:isActive
boolean value -
start()
Equivalent to callingsetActive(true)
-
stop()
Equivalent to callingsetActive(false)
-
getBeamerMode()
Returns:beamerMode
i.e. the type of crystal that is installed. Can be one of [power
,fluid
,items
,none
] -
getBeamerRole()
Returns:beamerRole
Can be one of [transmit
,receive
,disabled
]. -
setBeamerRole(beamerRole: string)
Parameters:beamerRole
Can be one of [transmit
,receive
,disabled
]. -
getBeamerRedstoneMode()
Returns:redstoneMode
Can be one of [auto
,on_high
,on_low
,ignored
]. -
setBeamerRedstoneMode(redstoneMode: string)
Parameters:redstoneMode
Can be one of [auto
,on_high
,on_low
,ignored
]. -
toggleBeamerRole()
Toggles between Transmit and Receive. Returns an error when the beamer is disabled.
Returns:beamerRole
Role after the change. Can be one of [transmit
,receive
,err_beamer_disabled
]. -
getBeamerStatus()
Returns:beamerStatus
See BeamerStatusEnum. -
getBufferStored()
The result is depending on the current Mode being set.
Returns:-
POWER
:energyStored
, -
FLUID
:fluidAmount
,fluidName
, -
ITEMS
: Array of Name-Amount mappings, -
NONE
: "no_mode_set".
-
-
getBufferCapacity()
The result is depending on the current Mode being set.
Returns:-
POWER
:maxEnergyStored
, -
FLUID
:capacity
, -
ITEMS
: Array of Name-MaxStackSize mappings, -
NONE
: "no_mode_set".
-
Some of AUNIS blocks generate signals. Most of methods are aimed to be non-blocking, so you'll need callbacks to be able to properly drive a Stargate for example. Here is the list of blocks and signals they emit.
All signals received by your computer will have at least 2 parameters:
address
is the OpenComputers network address of the Stargate component.
caller
true if the event was triggered by the action originated from this computer. If action don't originate from the user, caller
is always false.
-
stargate_spin_start(address: string, caller: boolean, symbolCount: number, lock: boolean, symbolName: string)
Emmited when Stargate started to spin after succesfulengageSymbol
call.
Parameters:symbolCount
is the index of chevron to be locked/engaged.lock
true
if the 7th/8th chevron is locking.symbolName
name of the symbol to lock. -
stargate_spin_chevron_engaged(address: string, caller: boolean, symbolCount: number, lock: boolean, symbolName: string)
Emmited when Stargate finished engaging/locking the symbol after succesfulengageSymbol
call.
Parameters:symbolCount
is the index of chevron to be locked/engaged.lock
true
if the 7th/8th chevron is locking.symbolName
name of the symbol to lock. -
stargate_dhd_chevron_engaged(address: string, caller: boolean, symbolCount: number, lock: boolean, symbolName: string)
Emmited when a glyph is pressed on a DHD while the computer is attached to the Gate.
Parameters:symbolCount
is the index of chevron to be locked/engaged.lock
true
if the 7th/8th chevron is locking.symbolName
name of the symbol to lock. -
stargate_incoming_wormhole(address: string, caller: boolean, dialedAddressSize: number)
Emmited when Stargate was dialed from another Gate but hasn't been engaged yet(i.e. BRB not pressed).
Parameters:dialedAddressSize
how many symbols dialing site pressed on the DHD (or computer). -
stargate_open(address: string, caller: boolean, isInitiating: boolean)
Emmited when Stargate starts to open, but isn't stable yet (seestargate_wormhole_stabilized
).
Parameters:isInitiating
if the gate is being opened from this end. -
stargate_close(address: string, caller: boolean, reason: string)
Emmited when Stargate starts to close, but isn't fully closed yet (seestargate_wormhole_closed_fully
).
Parameters:reason
the reason why the gate closed. Can be one of [requested
,connection_lost
,out_of_power
,command
]. -
stargate_wormhole_stabilized(address: string, caller: boolean, isInitiating: boolean)
Emmited when Stargate wormhole is stable and can transport players/entities/OC messages.
Parameters:isInitiating
if the gate is being opened from this end. -
stargate_wormhole_closed_fully(address: string, caller: boolean, isInitiating: boolean)
Emmited when Stargate wormhole disappears completely.
Parameters:isInitiating
if the gate is being opened from this end. -
stargate_failed(address: string, caller: boolean, reason: string)
Emmited when Stargate fails to open, either onengageGate
or BRB press.
Parameters:reason
the reason why the gate failed. Can be one of [not_enough_power
,address_malformed
,aborted
(Universe Dialer)]. -
stargate_traveler(address: string, caller: boolean, inbound: boolean, isPlayer: boolean, entityClass: string)
Emmited when Stargate receives on transmits matter.
Parameters:inbound
the Entity is travelling from the other end.isPlayer
the Entity is a EntityPlayerMP rather than: item, animal, minecart, arrow...entityClass
the Entity's class name. For ex.EntityPlayerMP
,EntityItem
,EntityTippedArrow
.
-
transportrings_teleport_start(address: string, caller: boolean, initiating: boolean)
Emmited when Rings start the teleport animation.
Parameters:initiating
true if attached platform initiated the connection. -
transportrings_teleport_finished(address: string, caller: boolean, initiating: boolean)
Emmited when Rings finish the teleport animation.
Parameters:initiating
true if attached platform initiated the connection.
-
beamer_started
Emmited when the Beamer starts being active. -
beamer_stopped
Emmited when the Beamer stops being active. -
beamer_transfers
(since1.9.12
)
Emmited every second (configurable) when the Beamer transfers something. It returns an associative array of key(power
or fluid/item display name) and value(number of things transferred). See this gist for a simple program counting all transfers.