Class of items that can be mounted on ships (such as FlagsItems and ResourceItems).
Class of items that can be mounted on ships (such as FlagsItems and ResourceItems).
◆ getAngle()
Get the items's angle in radians.
- Returns
- The object's rotation angle in radians
◆ getCaptureZone()
Returns capture zone holding the item.
Many games do not feature capture zones. For those games, this function will always return nil. Currently only FlagItems can be captured.
- Returns
- Zone where the item has been captured. Returns nil if the item is not in a capture zone.
◆ 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.
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.
◆ getRad()
Returns the radius of an item.
- Returns
- The radius of the item. For a Teleporter, this is the radius of the entrance. For a ForceFieldProjector, this is the radius of the base.
◆ getShip()
Get the ship carrying this item, if any.
- Returns
- The ship this item is mounted to, or nil if item is unmounted.
◆ 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.
◆ getVel()
Get the items's velocity.
- Returns
- The velocity as an axis-aligned vector.
◆ isInCaptureZone()
Is item in a capture zone?
- Returns
true
if item is held in a capture zone, false
if it is not.
◆ isOnShip()
Is item mounted on a ship?
- Returns
true
if item is mounted on a ship, false
if it is not.
◆ 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()
Removes the object from the current game or editor session.
May not be implemented for all objects.
◆ setAngle(angle)
Sets the item's rotation angle.
Set the rotation angle (in radians) of this MoveObject
- Parameters
-
angle | A rotation angle in radians |
◆ setGeom(geometry)
Sets an object's geometry.
- Parameters
-
geometry | The object's new geometry. |
Note that not all objects support changing geometry if the object has already been added to a game.
◆ setId(id)
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 #.
◆ setOwner(playerName)
Sets the owner of the object.
- Parameters
-
playerName | Name 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)
Set the object's position.
To set the full geometry of a more complex object, see the setGeom() method.
- Parameters
-
pos | The new position of the object. |
◆ setSelected(selected)
Set whether an object is selected in the editor.
This is useful for editor plugins only.
- Parameters
-
selected | true to select the object, false to deselect it. |
◆ setTeam(teamIndex)
Assigns the object to a team.
- Parameters
-
teamIndex | Index 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
.
◆ setVel(vel)
Sets the item's velocity.
As with other functions that take a point as an input, you can also specify the x and y components as numeric arguments.
- Parameters
-
vel | A point representing item's velocity. |