OpenComputers integration - MrJake222/AUNIS GitHub Wiki
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:gateTypeCan be one of: [MILKYWAY,Not yet...,PEGASUSUNIVERSE] -
getGateStatus()
Returns:gateStatusCan be one of: [not_merged,open,idle,dialing,dialing_computer,unstable,failing]openStateWhengateStatusisopenthis parameter istruefor the initiating gate andfalseon the receiving one.dialingis when therebis a delay after pressing the Glyph on the DHD and the actual chevron locking.dialing_computeris 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:arraySymbols as an array.
Point of Origin is added automatically if not present
Returns:not_mergedGate's not merged (duh), oraddress_malformed(No such gate, address contains less than 7 symbols), orenergyMapMap (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): tableSpins the ring to the given symbol and engages/locks it.
Parameters:symbolNameis the name of the symbol to be engaged.symbolIndexis the index of the symbol to be engaged. See: Mliky Way Symbols , Pegasus Symbols, Universe Symbols.
Returns:statusIf null, command failed, otherwise "stargate_spin".stargate_failure_*Name of the failure (busy, full, contains, not_merged).descriptiondescription of the failure. -
engageGate()Tries to open the gate.
Returns:statusIf null, command failed, otherwise "stargate_engage".stargate_failure_*Name of the failure (busy, opening, not_merged).descriptiondescription of the failure.gateStateState after theengageGatecommand. (BUSY [Source gate], NOT_ENOUGH_POWER, ADDRESS_MALFORMED [could mean that the target gate is busy]). -
disengageGate()Tries to close the gate.
Returns:statusIf null, command failed, otherwise "stargate_disengage".stargate_failure_*can be one of: (wrong_end, not_open, not_merged).descriptiondescription of the failure. -
getEnergyStored()Gets the amount of energy stored by the Gate.
Returns:energyAmount of energy stored, in RF. -
getMaxEnergyStored()Gets the electrical capacity of the Gate.
Returns:maxEnergyAmount of energy that can be stored i.e. capacity, in RF. -
getCapacitorsInstalled()Gets the amount of Capacitor Banks installed in the Gate.
Returns:capacitorCountCapacitor count, 0-3.
-
isInGrid()Checks if the Rings are in grid(i.e. have name and address).
Returns:isInGridboolean value -
getAddress()Returns the address of attached rings.
Returns:addressinteger address orNOT_IN_GRID -
getName()Returns the name of attached rings.
Returns:namestring 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:resultOKorDUPLICATE_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:resultOKorDUPLICATE_ADDRESS -
getAvailableRings()Gets the rings to which attached platform can connect.
Returns:mapaddress to name mapping -
getAvailableRingsAddresses()Gets the rings to which attached platform can connect(only addresses).
Returns:listlist of addresses -
attemptTransportTo(address:number)Attempts to transport the player to given address.
Returns:resultcan 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:isActiveboolean 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:isActiveboolean value -
start()Equivalent to callingsetActive(true) -
stop()Equivalent to callingsetActive(false) -
getBeamerMode()
Returns:beamerModei.e. the type of crystal that is installed. Can be one of [power,fluid,items,none] -
getBeamerRole()
Returns:beamerRoleCan be one of [transmit,receive,disabled]. -
setBeamerRole(beamerRole: string)
Parameters:beamerRoleCan be one of [transmit,receive,disabled]. -
getBeamerRedstoneMode()
Returns:redstoneModeCan be one of [auto,on_high,on_low,ignored]. -
setBeamerRedstoneMode(redstoneMode: string)
Parameters:redstoneModeCan be one of [auto,on_high,on_low,ignored]. -
toggleBeamerRole()Toggles between Transmit and Receive. Returns an error when the beamer is disabled.
Returns:beamerRoleRole after the change. Can be one of [transmit,receive,err_beamer_disabled]. -
getBeamerStatus()
Returns:beamerStatusSee 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 succesfulengageSymbolcall.
Parameters:symbolCountis the index of chevron to be locked/engaged.locktrueif the 7th/8th chevron is locking.symbolNamename 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 succesfulengageSymbolcall.
Parameters:symbolCountis the index of chevron to be locked/engaged.locktrueif the 7th/8th chevron is locking.symbolNamename 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:symbolCountis the index of chevron to be locked/engaged.locktrueif the 7th/8th chevron is locking.symbolNamename 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:dialedAddressSizehow 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:isInitiatingif 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:reasonthe 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:isInitiatingif 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:isInitiatingif the gate is being opened from this end. -
stargate_failed(address: string, caller: boolean, reason: string)
Emmited when Stargate fails to open, either onengageGateor BRB press.
Parameters:reasonthe 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:inboundthe Entity is travelling from the other end.isPlayerthe Entity is a EntityPlayerMP rather than: item, animal, minecart, arrow...entityClassthe 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:initiatingtrue if attached platform initiated the connection. -
transportrings_teleport_finished(address: string, caller: boolean, initiating: boolean)
Emmited when Rings finish the teleport animation.
Parameters:initiatingtrue 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(poweror fluid/item display name) and value(number of things transferred). See this gist for a simple program counting all transfers.
