Library stargate

Stargate library for interfacing with the Carter's Addon Pack.

Functions

accessList( gate, list ) Restricts access to a gate to players/Steam IDs in the given list.
active( gate ) Gets whether the gate or ring base is active.
address( gate ) Gets the gate or ring base address if it is visible.
addressList( gate ) Gets a list of diallable addresses from the gate.
asuranBeam( gate ) Gets whether an Asuran weapon is firing through the gate.
blocked( gate ) Gets the gate's blocked state (shows as red in the dialling menu).
canDial( gate, target ) Gets whether the given gate can dial the given target gate.
cfdEnable( cfd, enable ) Enables or disables a Call Forwarding Device.
cfdEnabled( cfd ) Returns whether a Call Forwarding Device is enabled.
chevron( gate ) Gets the gate's currently dialled chevron number.
chevrons( gate ) Gets the gate's currently activated chevrons as a string.
close( gate ) Closes the given Stargate.
destination( transporter ) Returns the Atlantis transporter's destination.
dhd( gate ) Gets the DHD on the gate if it has one.
dhdPressButton( dhd, button ) Emulates a button press on the given DHD.
dial( gate, target, mode ) Dials the given gate to another.
enableTracking( ship, track ) Enables projectile tracking on a puddle jumper or F-302.
gateRing( gate ) Gets the ring entity on SG1, infinity, movie and universe gates.
getAllJumpers( filter ) Returns an array of all puddle jumpers on the map.
getAllRings( filter ) Returns an array of all ring bases on the map.
getAllStargates( filter ) Returns an array of all Stargates on the map.
getAllTransporters( filter ) Returns an array of all Atlantis transporters on the map.
getSignal( gate ) Gets the currently received signal from the given Stargate.
group( gate ) Gets the gate's group, if it is visible.
inbound( gate ) Gets whether the gate has an inbound connection.
iris( gate ) Gets the iris on the gate, if it has one.
irisActive( iris ) Returns whether the given iris is active.
irisToggle( iris ) Toggles the given iris.
isInVehicle( ply ) Returns whether the given player is in a vehicle.
listen( callback, gate ) Adds a listener function to the gate network.
listenForCode( callback, gate ) Adds a listener function for an iris code received.
listenForRingTeleport( callback, ringBase ) Adds a listener function for entities teleporting through a ring base.
listenForTeleport( callback, gate ) Adds a listener function for an entity teleporting through a Stargate.
localgate( gate ) Gets the gate's local mode state.
locationJammed( location, player ) Determines if the given location is jammed.
name( gate ) Gets the gate or Atlantis transporter's name, if it is visible.
open( gate ) Gets whether the gate is open.
overloadPercent( gate ) Gets the percentage the given gate has been overloaded.
overloadTime( gate ) Gets the time remaining before overloading.
overloading( gate ) Gets whether the gate is being overloaded.
private( gate ) Gets the gate or Atlantis transporter's private state.
radius( transporter ) Returns the set radius of the given Asgard transporter.
range( ring ) Gets the range of a ring base.
setAddress( gate, address ) Sets the address of the given gate.
setBlocked( gate, blocked ) Sets the blocked state of the given Stargate.
setDestination( transporter, destination ) Sets an Atlantis transporter's destination name.
setGroup( gate, group ) Sets the group of the given Stargate.
setLocal( gate, local ) Sets the local state of the Stargate.
setName( gate, name ) Sets the name of the given Stargate.
setPrivate( gate, private ) Sets the private state of the Stargate.
setRadius( transporter, radius ) Sets the radius on an Asgard transporter.
setRange( ring, range ) Sets the range of a ring base.
setSGC( gate, sgc ) Sets the SGC mode of the given Stargate.
setTrackTarget( ship, pos ) Sets the tracking target on a puddle jumper or F-302.
setUsable( ring, usable ) Sets the usability of a ring base.
sgc( gate ) Gets the gate's SGC mode state (applicable to milky-way gates only).
stop( function, gate ) Removes a gate network listener.
stopCodeListen( function, gate ) Removes a listener for iris codes.
stopTeleListen( function, gate ) Removes a listener for teleporting entities.
target( gate ) Gets the gate connected to the given gate.
teleport( transporter, origin, dest, sendAll ) Teleports using either an Asgard or Atlantis transporter.
transmit( gate, data ) Transmits the given string data through the given Stargate's connection.
unstable( gate ) Gets whether the Stargate's event horizon is currently unstable.
usable( ring ) Gets the usability of a ring base.

Fields

DIAL_MODE_SLOW Slow dialling mode (for use with Stargate:dial()).
DIAL_MODE_FAST Fast dialling mode (for use with Stargate:dial()).
DIAL_MODE_NOX Nox dialling mode (for use with Stargate:dial()).


Functions

stargate.accessList( gate, list )
Restricts access to a gate to players/Steam IDs in the given list.

Environment:

Server

Parameters:

  • gate: The stargate to restrict access to.
  • list: A table of players and/or Steam IDs to allow. Anyone else is blocked.

Return values:

  1. (boolean) True if the access list is applied.
  2. (string) If the access list is not applied, the reason why.
stargate.active( gate )
Gets whether the gate or ring base is active.

Environment:

Server

Parameters:

  • gate: Stargate or ring base.

Return value:

    (boolean) True if the gate or ring base is currently active, false otherwise.
stargate.address( gate )
Gets the gate or ring base address if it is visible.

Environment:

Shared

Parameters:

  • gate: Stargate or ring base to get the address from.

Return value:

    (string) The address of the gate or ring base, if it is visible. Otherwise an empty string.
stargate.addressList( gate )
Gets a list of diallable addresses from the gate.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (table) A table containing a list of gate addresses that are available to dial.
stargate.asuranBeam( gate )
Gets whether an Asuran weapon is firing through the gate.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if an Asuran weapon is being fired through the gate, false otherwise.
stargate.blocked( gate )
Gets the gate's blocked state (shows as red in the dialling menu).

Environment:

Shared

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate is set to be blocked, false otherwise.
stargate.canDial( gate, target )
Gets whether the given gate can dial the given target gate.

Environment:

Server

Parameters:

  • gate: The gate that will dial.
  • target: The gate being dialled.

Return values:

  1. (boolean) True if it can be dialled, false otherwise.
  2. (string) If the target cannot be dialled, the reason why.
stargate.cfdEnable( cfd, enable )
Enables or disables a Call Forwarding Device.

Environment:

Server

Parameters:

  • cfd: CFD entity.
  • enable: Boolean enable.

Return values:

  1. (boolean) True if the CFD was enabled/disabled, false otherwise.
  2. (string) If the CFD was not enabled/disabled, the reason why.
stargate.cfdEnabled( cfd )
Returns whether a Call Forwarding Device is enabled.

Environment:

Server

Parameters:

  • cfd: CFD entity.

Return value:

    (boolean) True if the CFD is enabled, false otherwise.
stargate.chevron( gate )
Gets the gate's currently dialled chevron number.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (number) The currently dialled chevron number (between 0 to 9).
stargate.chevrons( gate )
Gets the gate's currently activated chevrons as a string. Emulates the "Chevrons [STRING]" output.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (string) A string containing the currently active chevrons.
stargate.close( gate )
Closes the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.

Return values:

  1. (boolean) True if the gate was closed, false otherwise.
  2. (string) If the gate was not closed, the reason why.
stargate.destination( transporter )
Returns the Atlantis transporter's destination.

Environment:

Server

Parameters:

  • transporter: Atlantis Transporter.

Return value:

    (string) The name of the transporter that is set as the destination.
stargate.dhd( gate )
Gets the DHD on the gate if it has one.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (Entity | nil) The DHD associated with the gate, if it exists.
stargate.dhdPressButton( dhd, button )
Emulates a button press on the given DHD. Note that DHDs have a delay between button presses, this function cannot be used to instantly dial a gate.

Environment:

Server

Parameters:

  • (Entity) dhd: DHD entity.
  • (string) button: String button to press, e.g "A". Use "DIAL" (case-insensitive) to dial the gate.

Return values:

  1. (boolean) True if the button was pressed, false otherwise.
  2. (string) If the button was not pressed, the reason why.
stargate.dial( gate, target, mode )
Dials the given gate to another.

Environment:

Server

Parameters:

  • gate: Stargate to dial from.
  • target: String address to dial to.
  • mode: The mode with which to dial. One of the stargate.DIAL_MODE_* enum values.

Return values:

  1. (boolean) True if the gate was dialled, false otherwise.
  2. (string) If the gate was not dialled, the reason why.
stargate.enableTracking( ship, track )
Enables projectile tracking on a puddle jumper or F-302.

Environment:

Server

Parameters:

  • ship: Jumper or F-302 entity.
  • track: Boolean track.

Return values:

  1. (boolean) True if tracking was enabled, false otherwise.
  2. (string) If tracking was not enabled, the reason why.
stargate.gateRing( gate )
Gets the ring entity on SG1, infinity, movie and universe gates.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (Entity | nil) The entity that represents the ring on the gate, if it exists.
stargate.getAllJumpers( filter )
Returns an array of all puddle jumpers on the map.

Environment:

Server

Parameters:

  • filter: (Optional) Filter function to filter the results.

Return value:

    (table) A table containing a list of all puddle jumpers on the map.
stargate.getAllRings( filter )
Returns an array of all ring bases on the map.

Environment:

Server

Parameters:

  • filter: (Optional) Filter function to filter the results.

Return value:

    (table) A table containing a list of all ring bases on the map.
stargate.getAllStargates( filter )
Returns an array of all Stargates on the map.

Environment:

Server

Parameters:

  • filter: (Optional) Filter function to filter the results.

Return value:

    (table) A table containing a list of all Stargates on the map.
stargate.getAllTransporters( filter )
Returns an array of all Atlantis transporters on the map.

Environment:

Server

Parameters:

  • filter: (Optional) Filter function to filter the results.

Return value:

    (table) A table containing a list of all Atlantis transporters on the map.
stargate.getSignal( gate )
Gets the currently received signal from the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (string) The string value for the signal receieved.
stargate.group( gate )
Gets the gate's group, if it is visible.

Environment:

Shared

Parameters:

  • gate: Stargate to get the group from.

Return value:

    (string) The gate's group, if visible. Otherwise an empty string.
stargate.inbound( gate )
Gets whether the gate has an inbound connection.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate currently has an inbound connection, false otherwise.
stargate.iris( gate )
Gets the iris on the gate, if it has one.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (Entity | nil) The iris on the gate, if it exists.
stargate.irisActive( iris )
Returns whether the given iris is active.

Environment:

Server

Parameters:

  • iris: Iris entity.

Return value:

    (boolean) True if the iris is active, false otherwise.
stargate.irisToggle( iris )
Toggles the given iris.

Environment:

Server

Parameters:

  • iris: Iris entity.

Return values:

  1. (boolean) True if the iris was toggled, false otherwise.
  2. (string) If the iris was not toggled, the reason why.
stargate.isInVehicle( ply )
Returns whether the given player is in a vehicle.

Environment:

Server

Parameters:

  • ply: Player to check.

Return values:

  1. (boolean) True if the player is in a vehicle, false otherwise.
  2. (Entity | nil) If the player is in a vehicle, the entity they are currently in.
stargate.listen( callback, gate )
Adds a listener function to the gate network. This is ran when a gate opens with an inbound connection, it passes the dialled gate.

Environment:

Server

Parameters:

  • callback: Function to run when a gate opens. It's passed the opening gate.
  • gate: Optional Stargate to listen for specifically.
stargate.listenForCode( callback, gate )
Adds a listener function for an iris code received.

Environment:

Server

Parameters:

  • callback: Function to run when the code is received. It's passed the given code.
  • gate: Stargate to listen for codes received.
stargate.listenForRingTeleport( callback, ringBase )
Adds a listener function for entities teleporting through a ring base.

Environment:

Server

Parameters:

  • callback: Function to run when entities teleport to the ring base. It's passed the source ring base entity, the destination ring base entity, and a table of entities that were teleported.
  • ringBase: The ring base entity to listen for entities teleporting to.

Usage:

    stargate.listenForRingTeleport( function( SourceRings, DestinationRings, Entities ) 
    	print( SourceRings, "teleported the following entities to", DestinationRings, ":" ) 
    	for i = 1, #Entities do 
    		print( Entities[ i ] ) 
    	end 
    end, RingBase )
stargate.listenForTeleport( callback, gate )
Adds a listener function for an entity teleporting through a Stargate.

Environment:

Server

Parameters:

  • callback: Function to run when an entity teleports to the gate. It's passed the entity.
  • gate: Stargate to listen for entities teleporting to.
stargate.localgate( gate )
Gets the gate's local mode state.

Environment:

Shared

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate is set to local-only mode. False otherwise.
stargate.locationJammed( location, player )
Determines if the given location is jammed.

Environment:

Server

Parameters:

  • location: Vector location to check.
  • player: (Optional) Player to check jamming against. Pass false to ignore any immunity.

Return value:

    (boolean) True if the given location is jammed, false otherwise.
stargate.name( gate )
Gets the gate or Atlantis transporter's name, if it is visible.

Environment:

Server

Parameters:

  • gate: Stargate or Atlantis transporter.

Return value:

    (string) The name of the gate/transporter, if it is visible. Otherwise an empty string.
stargate.open( gate )
Gets whether the gate is open.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate is open, false otherwise.
stargate.overloadPercent( gate )
Gets the percentage the given gate has been overloaded.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (number) A number between 0 and 100 indicating how much the gate has been overloaded.
stargate.overloadTime( gate )
Gets the time remaining before overloading.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (number) The time in seconds until the gate will overload.
stargate.overloading( gate )
Gets whether the gate is being overloaded.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate is being overloaded, false otherwise.
stargate.private( gate )
Gets the gate or Atlantis transporter's private state.

Environment:

Server

Parameters:

  • gate: or Atlantis transporter.

Return value:

    (boolean) True if the gate/transporter is private (and thus the address/group/name is hidden if not the owner), false otherwise.
stargate.radius( transporter )
Returns the set radius of the given Asgard transporter.

Environment:

Server

Parameters:

  • transporter: The Asgard transporter entity.

Return value:

    (number) The radius in Hammer units for the given transporter.
stargate.range( ring )
Gets the range of a ring base.

Environment:

Server

Parameters:

  • ring: Ring base.

Return value:

    (number) The ring base's range in Hammer units.
stargate.setAddress( gate, address )
Sets the address of the given gate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • address: Address to set.

Return values:

  1. (boolean) True if the address was set, false otherwise.
  2. (string) If the address was not set, the reason why.
stargate.setBlocked( gate, blocked )
Sets the blocked state of the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • blocked: Boolean blocked.

Return values:

  1. (boolean) True if the blocked state was set, false otherwise.
  2. (string) If the blocked state was not set, the reason why.
stargate.setDestination( transporter, destination )
Sets an Atlantis transporter's destination name.

Environment:

Server

Parameters:

  • transporter: Atlantis Transporter.
  • destination: String destination name.

Return values:

  1. (boolean) True if the destination was set, false otherwise.
  2. (string) If the destination was not set, the reason why.
stargate.setGroup( gate, group )
Sets the group of the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • group: Group to set.

Return values:

  1. (boolean) True if the group was set, false otherwise.
  2. (string) If the group was not set, the reason why.
stargate.setLocal( gate, local )
Sets the local state of the Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • local: Boolean local.

Return values:

  1. (boolean) True if the local state was set, false otherwise.
  2. (string) If the local state was not set, the reason why.
stargate.setName( gate, name )
Sets the name of the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • name: Name to set.

Return values:

  1. (boolean) True if the name was set, false otherwise.
  2. (string) If the name was not set, the reason why.
stargate.setPrivate( gate, private )
Sets the private state of the Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • private: Boolean private.

Return values:

  1. (boolean) True if the private state was set, false otherwise.
  2. (string) If the private state was not set, the reason why.
stargate.setRadius( transporter, radius )
Sets the radius on an Asgard transporter.

Environment:

Server

Parameters:

  • transporter: The Asgard transporter entity.
  • radius: The radius within which entities should be transported.

Return values:

  1. (boolean) True if the radius was set, false otherwise.
  2. (string) If the radius was not set, the reason why.
stargate.setRange( ring, range )
Sets the range of a ring base.

Environment:

Server

Parameters:

  • ring: Ring base.
  • range: Range to set.

Return values:

  1. (boolean) True if the range was set, false otherwise.
  2. (string) If the range was not set, the reason why.
stargate.setSGC( gate, sgc )
Sets the SGC mode of the given Stargate.

Environment:

Server

Parameters:

  • gate: Stargate.
  • sgc: Boolean SGC mode.

Return values:

  1. (boolean) True if the SGC mode was set, false otherwise.
  2. (string) If the SGC mode was not set, the reason why.
stargate.setTrackTarget( ship, pos )
Sets the tracking target on a puddle jumper or F-302.

Environment:

Server

Parameters:

  • ship: Jumper or F-302 entity.
  • pos: Position.

Return values:

  1. (boolean) True if the track target was set, false otherwise.
  2. (string) If the track target was not set, the reason why.
stargate.setUsable( ring, usable )
Sets the usability of a ring base.

Environment:

Server

Parameters:

  • ring: Ring base.
  • usable: Boolean usable.

Return values:

  1. (boolean) True if the usability was set, false otherwise.
  2. (string) If the usability was not set, the reason why.
stargate.sgc( gate )
Gets the gate's SGC mode state (applicable to milky-way gates only).

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the gate is set to use SGC dialling mode, false otherwise.
stargate.stop( function, gate )
Removes a gate network listener.

Environment:

Server

Parameters:

  • function: Function to remove.
  • gate: Stargate to stop listening to if one was set.
stargate.stopCodeListen( function, gate )
Removes a listener for iris codes.

Environment:

Server

Parameters:

  • function: Function to remove.
  • gate: Stargate to stop listening to.
stargate.stopTeleListen( function, gate )
Removes a listener for teleporting entities.

Environment:

Server

Parameters:

  • function: Function to remove.
  • gate: Stargate to stop listening to.
stargate.target( gate )
Gets the gate connected to the given gate.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (Stargate) The gate that is connected to the given gate (either inbound or outbound).
stargate.teleport( transporter, origin, dest, sendAll )
Teleports using either an Asgard or Atlantis transporter. Functionality is different for each.

Environment:

Server

Parameters:

  • transporter: The transporter entity to use.
  • origin: If using an Asgard transporter, the origin vector to teleport from.
  • dest: If using an Asgard transporter, the destination vector to teleport to.
  • sendAll: If using an Asgard transporter, boolean flag to send objects as well as players.

Return values:

  1. (boolean) True if the teleport was successfully triggered, false otherwise.
  2. (string) If the teleport was not triggered, the reason why.
stargate.transmit( gate, data )
Transmits the given string data through the given Stargate's connection.

Environment:

Server

Parameters:

  • gate: Stargate.
  • data: String data to send through.

Return values:

  1. (boolean) True if the data was transimitted, false otherwise.
  2. (string) If the data was not transmitted, the reason why.
stargate.unstable( gate )
Gets whether the Stargate's event horizon is currently unstable.

Environment:

Server

Parameters:

  • gate: Stargate.

Return value:

    (boolean) True if the event horizon is unstable, false otherwise.
stargate.usable( ring )
Gets the usability of a ring base.

Environment:

Server

Parameters:

  • ring: Ring base.

Return value:

    (boolean) True if the ring base is usable, false otherwise.

Valid XHTML 1.0!