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

Parent class representing mountable items such as Turret and ForceFieldProjector.

Inheritance diagram for EngineeredItem:
Item BfObject ForceFieldProjector Turret

Member Functions

getCaptureZone()
 Returns capture zone holding the item.
 
getDisabledThreshold()
 Gets the health threshold below which the item becomes disabled. [details]
 
getEngineered()
 Get whether the item can be totally destroyed. [details]
 
getGeom()
 Returns an object's geometry. [details]
 
getHealRate()
 Gets the item's healRate. [details]
 
getHealth()
 Returns health of the item. [details]
 
getId()
 Gets an object's user assigned id. [details]
 
getMountAngle()
 Gets the angle (in radians) at which the item is mounted. [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]
 
getRad()
 Returns the radius of an item. [details]
 
getShip()
 Returns the ship where the item is mounted. [details]
 
getTeamIndex()
 Gets the index of the object's team. [details]
 
isActive()
 Determine if the item is active (i.e. its health is above the disbaledThreshold). [details]
 
isInCaptureZone()
 Is item in a capture zone? [details]
 
isSelected()
 Determine if an object is selected in the editor. [details]
 
removeFromGame()
 Removes the object from the current game or editor session. [details]
 
setEngineered(engineered)
 Sets whether the item can be destroyed when its health reaches zero. [details]
 
setGeom(geometry)
 Sets an object's geometry. [details]
 
setHealRate(healRate)
 Sets the item's heal rate. [details]
 
setHealth(health)
 Set the current health of the item. [details]
 
setId(id)
 Sets an object's user assigned id. [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

Parent class representing mountable items such as Turret and ForceFieldProjector.

EngineeredItem is a container class for wall-mountable items. Currently, all EngineeredItems can be constructed with the Engineering module, can be destroyed by enemy fire, and can be healed (and sometimes captured) with the Repair module. All EngineeredItems have a health value that ranges from 0 to 1, where 0 is completely dead and 1 is fully healthy. When health falls below a certain threshold (see getDisabledThrehold()), the item becomes inactive and must be repaired or regenerate itself to be functional again.

If an EngineeredItem has a heal rate greater than zero, it will slowly repair damage to iteself. For more info see setHealRate()

Member Function Documentation

◆ 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.

◆ getDisabledThreshold()

returns num

Gets the health threshold below which the item becomes disabled.

The value will always be between 0 and 1. This value is constant and will be the same for all EngineeredItems.

Returns
Health threshold below which the item will be disabled.

◆ getEngineered()

returns bool

Get whether the item can be totally destroyed.

Returns
true if the item can be destroyed.

◆ getGeom()

Returns an object's geometry.

Returns
A geometry as described on the Geom page

◆ getHealRate()

returns int

Gets the item's healRate.

The specified heal rate will be the time, in seconds, it takes for the item to repair itself by 10. If an EngineeredItem is assigned to the neutral team, it will not heal itself.

Returns
The item's heal rate

◆ getHealth()

returns num

Returns health of the item.

Health is specified as a number between 0 and 1 where 0 is completely dead and 1 is totally healthy.

Returns
Returns a value between 0 and 1 indicating the health of the item.

◆ 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.

◆ getMountAngle()

returns num

Gets the angle (in radians) at which the item is mounted.

Returns
Returns the mount angle, in radians.

◆ 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.

◆ getRad()

returns num
inherited from Item

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()

Returns the ship where the item is mounted.

Most objects cannot be mounted. For those, this function will always return nil.

Returns
Ship where the item is mounted. Returns nil if the item is not mounted.

◆ 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.

◆ isActive()

returns bool

Determine if the item is active (i.e. its health is above the disbaledThreshold).

A player can activate an inactive item by repairing it. To set whether an EngineeredItem as active or disabled, use setHealth()

Returns
Returns true if the item is active, or false if it is disabled

◆ isInCaptureZone()

returns bool
inherited from Item

Is item in a capture zone?

Returns
true if item is held in a capture zone, 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()

returns nothing
inherited from BfObject

Removes the object from the current game or editor session.

May not be implemented for all objects.

◆ setEngineered(engineered)

Arg types: engineered: bool  |  returns nothing

Sets whether the item can be destroyed when its health reaches zero.

Parameters
engineeredtrue to make the item destructible, false to make it permanent

◆ 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.

◆ setHealRate(healRate)

Arg types: healRate: int  |  returns nothing

Sets the item's heal rate.

The specified healRate will be the time, in seconds, it takes for the item to repair itself by 10. In practice, a heal rate of 1 makes an item effectively unkillable. If the item is assigned to the neutral team, it will not heal itself. Passing a negative value will generate an error.

Parameters
healRateThe new heal rate. Specify 0 to disable healing.

◆ setHealth(health)

Arg types: health: num  |  returns nothing

Set the current health of the item.

Health is specified as a number between 0 and 1 where 0 is completely dead and 1 is totally healthy. Values outside this range will be clamped to the valid range.

Parameters
healthThe item's new health, between 0 and 1.

◆ 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 #.

◆ 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.