ComputerCraft - Povstalec/StargateJourney GitHub Wiki

Technology from Stargate Journey (mainly Stargates) can be controlled with computers from ComputerCraft. This is achieved through the use of Interfaces, which, as the name suggests, interface with alien technology and enable you to control it.

Interfaces

Interfaces are used not only for control, but also for powering the technology they're connected to.
At first, your control over the alien technology will be fairly limited, but as you upgrade to better Interfaces, you will also gain more control.

Energy Target

Due to the incredibly high energy capacity some alien technology has, the Interfaces will by default only push energy into it up until a targeted level of energy is reached within the technology.

For example: The Stargate can hold several billion FE units, however, by default, the Interface will stop pushing energy inside it once it reaches 200 000 FE (even though the Stargate is nowhere near full capacity) in order to not prevent the Stargate from draining all of your energy early on.

Interface Types

Currently there are 3 types of Interfaces:

  • Basic Interface (Peripheral name: basic_interface)
  • Crystal Interface (Peripheral name: crystal_interface)
  • Advanced Crystal Interface (Peripheral name: advanced_crystal_interface)

Interface tutorial

A very basic tutorial on how to use the Basic Interface can be found here: https://www.youtube.com/watch?v=qNi9NUAmOJM

Interface Functions

The available Interface Functions will be different based on what they are connected to (If they aren't connected to anything, only the most basic functions will be available)

General Interface Functions

These are the functions every Interface has available at all times.

Type Availability

Different Interface types may have access to different functions. To make it easier to tell which Interface types can access a function, each function will be marked with corresponding Interfaces (B = Basic Interface, C = Crystal Interface, A = Advanced Crystal Interface).
For example, a function that can only be used by the Crystal Interface and Advanced Interface will be marked as [-CA], while a function that can be used by all 3 Interfaces will be marked as [BCA].

  • getEnergy() [BCA]
    Returns the energy stored within the Interface

  • getEnergyTarget() [BCA]
    Returns the current Energy Target

  • setEnergyTarget(long targetEnergy) [BCA]
    Sets the Energy Target to the amount specified by targetEnergy

  • addressToString(int[] address) [BCA]
    Converts the array specified by address to a form used elsewhere in the mod (e.g. -26-6-14-31-11-29-).

Interface Functions (Connected to a Stargate)

These functions will be available on all Stargate types, provided you have the correct Interface type to use them.

  • getStargateGeneration() [BCA]
    Returns the generation of the Stargate.

  • getStargateType() [BCA]
    Returns the registry ID of the Stargate (For example: "sgjourney:milky_way_stargate").

  • getStargateEnergy() [BCA]
    Returns the energy (in FE) the Stargate has stored.

  • disconnectStargate() [BCA]
    If the Stargate is connected, the command disconnects it. If it isn't connected, the Stargate will be reset.

  • getChevronsEngaged() [BCA]
    Returns the number of chevrons that have been engaged.

  • getOpenTime() BCA(https://github.com/Povstalec/StargateJourney/wiki/ComputerCraft#type-availability)
    Returns the number of Ticks the Stargate has been active for, returns 0 if it's inactive.

  • isStargateConnected() [BCA]
    Returns true if the Stargate is currently connected, otherwise returns false.

  • isStargateDialingOut() [BCA]
    Returns true if the Stargate is currently dialing out, otherwise (if Stargate isn't connected or the connection is incoming) returns false.

  • isWormholeOpen() [BCA]
    Returns true if the wormhole has formed.

  • getRecentFeedback() [BCA]
    Returns the most recent Stargate Feedback.
    (NOTE: The Basic Interface will only return Stargate Feedback as an integer code, as opposed to the two Crystal Interfaces, which will return both the code and a text name of the Feedback)

  • sendStargateMessage(String message) [BCA]
    Sends a message through the current Stargate Connection, which can be received by the stargate_message_received event. Returns true if message was sent, false if not. Basic and Crystal Interfaces can only send messages after the wormhole has fully formed, Advanced Crystal Interfaces can send messages as soon as a connection with another gate is established.

  • engageSymbol(int symbol) [-CA]
    Directly encodes the symbol specified by symbol.

  • getDialedAddress() [-CA]
    Returns the currently dialed address.
    (NOTE: The currently dialed address is different from the currently connected address: It is the address the local Stargate has dialed, meaning if it's an incoming connection, the currently dialed address will be empty)

  • getConnectedAddress() [--A]
    Returns the currently connected address (the address on the other side of the connection).

  • setChevronConfiguration(int[] configuration) [-CA]
    Causes the chevrons to engage in the order specified by configuration. This configuration resets every time a Stargate is reset.

  • getLocalAddress() [--A]
    Returns the 9-chevron address of the Stargate.

  • getNetwork() [--A]
    Returns the (numerical) ID of the network the Stargate is a part of.

  • setNetwork(int network) [--A]
    Sets the Stargate's network to the one specified by network.

  • isNetworkRestricted() [--A]
    Returns true if the Stargate is set to decline connections from foreign networks, otherwise false.

  • restrictNetwork(boolean shouldRestrictNetwork) [--A]
    Sets the Stargate to enable or disable declining of connections from foreign networks.

Connected to a Milky Way Stargate

  • rotateAntiClockwise(int symbol) [BCA]
    Rotates the Stargate to the desired symbol anti-clockwise (will stop if the Basic Interface is destroyed). Will rotate indefinitely if symbol is -1.

  • rotateClockwise(int symbol) [BCA]
    Rotates the Stargate to the desired symbol clockwise (will stop if the Basic Interface is destroyed). Will rotate indefinitely if symbol is -1.

  • endRotation() [BCA]
    If the Stargate is rotating, it will stop (producing a stop sound).

  • getRotation() [BCA]
    Returns current rotation in degrees.

  • getCurrentSymbol() [BCA]
    Returns the current symbol.

  • isCurrentSymbol(int symbol) [BCA]
    Returns true if the current Symbol is the same as symbol.

  • openChevron() [BCA]
    Opens the chevron if it can be opened (can't be opened if it's already opened or if the current Symbol has already been encoded).

  • closeChevron() [BCA]
    Closes the chevron if it can be closed (can't be closed if it's not open).

  • encodeChevron() [BCA]
    Encodes current symbol if the chevron is open without closing the chevron (Primary chevron can't be encoded).

Connected to a Pegasus Stargate

  • dynamicSymbols(boolean useDynamicSymbols) [--A]
    Either enables or disables the ability of the Pegasus Stargate to use symbols dynamically based on where they are placed, or always keep the same symbols.

  • overrideSymbols(String symbols) [--A]
    Will set the symbols the Pegasus Stargate uses to those specified by symbols.
    (NOTE: These symbols will be reset once the Pegasus Stargate is loaded unless dynamicSymbols is set to false)

  • overridePointOfOrigin(String pointOfOrigin) [--A]
    Will set the point of origin the Pegasus Stargate uses to those specified by pointOfOrigin.
    (NOTE: This point of origin will be reset once the Pegasus Stargate is loaded unless dynamicSymbols is set to false)

Events

stargate_chevron_engaged Chevron Engaged, Symbol Encoded, Incoming

Fired whenever a Chevron is engaged

  1. Chevron Engaged - Int value of the Chevron that was engaged
  2. Symbol Encoded - Int value of the Symbol that was encoded
  3. Incoming - Boolean value whether or not the Chevron was engaged during an incoming Connection

stargate_incoming_wormhole Dialing Address

Fired whenever an incoming Wormhole forms (right as the Kawoosh starts)

  1. Dialing Address - Int array of the address that dialed the Stargate

stargate_outgoing_wormhole Dialed Address

Fired whenever an outgoing Wormhole forms (right as the Kawoosh starts)

  1. Dialed Address - Int array of the address the Stargate is dialing to

stargate_disconnected Feedback Code, Feedback Message

Fired whenever a Connection is ended

  1. Feedback Code - Int value of the Feedback Code with the details of how the Connection was ended
  2. Feedback Message - String value of the Feedback Code with the details of how the Connection was ended (Only returned by Crystal Interface and Advanced Crystal Interface)

stargate_deconstructing_entity Traveler Type, Display Name, UUID, Disintegrated

Fired whenever an Entity enters the Wormhole

  1. Traveler Type - String type of the deconstructed Entity (e.g., "minecraft:pig")
  2. Display Name - String name of the deconstructed Entity, can be a Player name, Nametag name or a default Mob name
  3. UUID - String UUID of the deconstructed Entity
  4. Disintegrated - Boolean value wether or not the entity was destroyed when passing through (by stepping through the wrong end)

stargate_reconstructing_entity Traveler Type, Display Name, UUID

Fired whenever an entity exits the Wormhole

  1. Traveler Type - String type of the deconstructed Entity (e.g., "minecraft:pig")
  2. Display Name - String name of the deconstructed Entity, can be a Player name, Nametag name or a default Mob name
  3. UUID - String UUID of the deconstructed Entity

stargate_reset Feedback Code, Feedback Message

Fired whenever a Stargate resets

  1. Feedback Code - Int value of the Feedback Code with the details of how the Connection was ended
  2. Feedback Message - String value of the Feedback Code with the details of how the Connection was ended (Only returned by Crystal Interface and Advanced Crystal Interface)

stargate_message_received Message

Fired whenever a Stargate receives a message sent by the sendStargateMessage() function

  1. Message - String message that was sent from another interface connected to a Stargate on the other end of the connection.