Bitfighter  021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
NexusZone Class Reference

Players return flags to a NexusZone in a Nexus game.

Inheritance diagram for NexusZone:
Zone BfObject

Member Functions

NexusZone()
 Constructor.
 
NexusZone(polyGeom)
 Constructor. [details]
 
containsPoint(p)
 Check whether p lies inside of this Zone. [details]
 
getGeom()
 Returns an object's geometry. [details]
 
getId()
 Gets an object's user assigned id. [details]
 
getObjType()
 Gets an object's ObjType. [details]
 
getOwner()
 Gets an object's owner as a PlayerInfo. [details]
 
getPos()
 Gets an object's position. [details]
 
getTeamIndex()
 Gets the index of the object's team. [details]
 
isOpen()
 
isSelected()
 Determine if an object is selected in the editor. [details]
 
removeFromGame()
 Removes the object from the current game or editor session. [details]
 
setClosedTime(seconds)
 Set the time (in seconds) that the Nexus will remain closed. [details]
 
setGeom(geometry)
 Sets an object's geometry. [details]
 
setId(id)
 Sets an object's user assigned id. [details]
 
setOpen(open)
 Set whether the Nexus is open or close. [details]
 
setOpenTime(seconds)
 Set the time (in seconds) that the Nexus should remain open. [details]
 
setOwner(playerName)
 Sets the owner of the object. [details]
 
setPos(pos)
 Set the object's position. [details]
 
setSelected(selected)
 Set whether an object is selected in the editor. [details]
 
setTeam(teamIndex)
 Assigns the object to a team. [details]
 

Detailed Description

Players return flags to a NexusZone in a Nexus game.

NexusZone represents a flag return area in a Nexus game. It plays no role in any other game type. Nexus opening and closing times are actually game parameters, so these methods serve only as a convenient and intuitive way to access those parameters. Therefore, modifying the opening/closing schedule or status of any NexusZone will have the same effect on all NexusZones in the game.

Constructor Documentation

◆ NexusZone.new()[1/2]

returns NexusZone

Constructor.

Example:

nexuszone = NexusZone.new()
...
levelgen:addItem(nexuszone)
Players return flags to a NexusZone in a Nexus game.
Definition: NexusGame__cpp.h:7

◆ NexusZone.new(polyGeom)[2/2]

Arg types: polyGeom: Geom  |  returns NexusZone

Constructor.

Example:

nexuszone = NexusZone.new(polyGeom)
...
levelgen:addItem(nexuszone)

Member Function Documentation

◆ containsPoint(p)

Arg types: p: point  |  returns bool
inherited from Zone

Check whether p lies inside of this Zone.

Determines if p is contained by this zone, according to the winding number algorithm. Points which lie on boundary of the polygon are considered inside of it. If a polygon is self-intersecting, this method will return true as long as p lies within some non-self-intersection subpolygon.

Parameters
pThe point to check.
Returns
true if p lies within the zone, false otherwise

◆ getGeom()

Returns an object's geometry.

Returns
A geometry as described on the Geom page

◆ getId()

Gets an object's user assigned id.

Users can assign an id to elements in the editor with the ! or # keys. Use this function to obtain this id. If the user has not assigned an object an id, getId() will return a negative id that will remain consistent throught the game.

Returns
The object's id.

◆ getObjType()

Gets an object's ObjType.

obj = TestItem.new()
print(obj:getObjType() == ObjType.TestItem) -- prints 'true'
ObjType getObjType()
Gets an object's ObjType.
Definition: BfObject__cpp.h:9
Large bouncy ball type item.
Definition: moveObject__cpp.h:41

See ObjType for a list of possible return values.

Returns
The object's ObjType.

◆ getOwner()

Gets an object's owner as a PlayerInfo.

Some objects (like projectiles) have an owning player associated. This method returns a PlayerInfo object if there is an owner. Otherwise, returns nil.

This method is intended to be used with bullets and other projectiles, not with game objects like zones.

Returns
A PlayerInfo representing the object's owner, or nil.

◆ getPos()

Gets an object's position.

For objects that are not points (such as a LoadoutZone), will return the object's centroid.

Returns
A Point representing the object's position.

◆ getTeamIndex()

Gets the index of the object's team.

Many BfObjects (such as TestItems) are never part of any particular team. For these objects, this method will return Team.Neutral.

Note
Remember that in Lua, indices start with 1!
Returns
Team index of the object.

◆ isOpen()

returns bool
Returns
The current state of the Nexus. true for open, false for closed.
Note
Since all Nexus items open and close together, this method will return the same value for all Nexus zones in a game at any given time.

◆ isSelected()

Determine if an object is selected in the editor.

This is useful for editor plugins only.

Returns
Returns true if the object is selected, false if not.

◆ removeFromGame()

returns nothing
inherited from BfObject

Removes the object from the current game or editor session.

May not be implemented for all objects.

◆ setClosedTime(seconds)

Arg types: seconds: int  |  returns nothing

Set the time (in seconds) that the Nexus will remain closed.

Pass 0 if the Nexus should never open, causing the Nexus to remain closed permanently. Passing a negative time will generate an error.

Parameters
secondsTime in seconds that the Nexus should remain closed.
Note
Since all Nexus items open and close together, this method will affect all Nexus items in a game.

Also note that in a level file, closing times are specified in fractions of minutes, whereas this method works with seconds.

◆ setGeom(geometry)

Arg types: geometry: Geom  |  returns nothing
inherited from BfObject

Sets an object's geometry.

Parameters
geometryThe object's new geometry.

Note that not all objects support changing geometry if the object has already been added to a game.

◆ setId(id)

Arg types: id: int  |  returns nothing
inherited from BfObject

Sets an object's user assigned id.

Users can assign an id to elements in the editor with the ! or # keys. Use this function to set this id from Lua. When called from an editor plugin, the value passed will be displayed in the editor when the player presses ! or #.

◆ setOpen(open)

Arg types: open: bool  |  returns nothing

Set whether the Nexus is open or close.

Parameters
opentrue to open the Nexus, false to close it.
Note
Since all Nexus items open and close together, this method will affect all Nexus items in a game.

◆ setOpenTime(seconds)

Arg types: seconds: int  |  returns nothing

Set the time (in seconds) that the Nexus should remain open.

Pass 0 if the Nexus should never close, causing the Nexus to remain open permanently. Passing a negative time will generate an error.

Parameters
secondsTime in seconds that the Nexus should remain open.
Note
Since all Nexus items open and close together, this method will affect all Nexus items in a game.

◆ setOwner(playerName)

Arg types: playerName: string  |  returns nothing
inherited from BfObject

Sets the owner of the object.

Parameters
playerNameName of player as a string.
Note
This method only works if the item in question has already been added to the game via addItem(object). The owner cannot be set beforehand. Also, 'playerName' must exactly match a the name of a player already in the game (case-sensitive).

This method is intended to be used with bullets and other projectiles, not with game objects like zones.

◆ setPos(pos)

Arg types: pos: point  |  returns nothing
inherited from BfObject

Set the object's position.

To set the full geometry of a more complex object, see the setGeom() method.

Parameters
posThe new position of the object.

◆ setSelected(selected)

Arg types: selected: bool  |  returns nothing
inherited from BfObject

Set whether an object is selected in the editor.

This is useful for editor plugins only.

Parameters
selectedtrue to select the object, false to deselect it.

◆ setTeam(teamIndex)

Arg types: teamIndex: int  |  returns nothing
inherited from BfObject

Assigns the object to a team.

Parameters
teamIndexIndex of the team the object should be assigned to. (first team index is 1; there is no team 0)

Instead of a team index, you can use the special team enums Team.Neutral and Team.Hostile.

Limitations:

  • Will have no effect on items that are inherently teamless (such as a NexusZone).
  • Neither Ships nor Robots can be assigned to Team.Neutral or Team.Hostile.