Bitfighter
021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
|
Main class for holding global methods accessible by all script runners.
Member Functions | |
addItem(obj) | |
Add a BfObject to the game or editor. Any object constructed in a levelgen will not appear in the game world or editor until this method is called on it. | |
findAllObjects(objType,...) | |
Returns a table containing a list of objects of the specified type anywhere on the level. [details] | |
findAllObjectsInArea(point1, point2, objType,...) | |
Finds all items of the specified type(s) in a given search area. [details] | |
findObjectById(id) | |
Returns an object with the given id, or nil if none exists. [details] | |
getGameInfo() | |
Returns the GameInfo object. [details] | |
getPlayerCount() | |
pointCanSeePoint(point1, point2) | |
Returns true if the two specified points can see one another. [details] | |
subscribe(event) | |
Manually subscribe to notifications when the specified event. occurs. [details] | |
unsubscribe(event) | |
Manually unsubscribe to the specified Event. [details] | |
Main class for holding global methods accessible by all script runners.
Script runners include levelgens, robots, and editor plugins. The methods here can be called from all three. However, some may be disabled for a particular script runner.
In a levelgen script, there is an object magically available called 'levelgen' that gives you access to these methods.
Arg types: obj: BfObject | returns nothing |
Arg types: objType: ObjType, ...: | returns table |
Returns a table containing a list of objects of the specified type anywhere on the level.
Can specify multiple object types.
If no object types are provided, this function will return every object on the level (warning, may be slow).
objType | ObjTypes specifying what types of objects to find. |
Finds all items of the specified type(s) in a given search area.
Multiple object types can be specified. A search rectangle will be constructed from the two points given, with each point positioned at opposite corners.
point1 | One corner of a search rectangle. |
point2 | Another corner of a search rectangle diagonally opposite to the first. |
objType | The ObjType to look for. Multiple can be specified. |
Arg types: id: num | returns BfObject |
Returns an object with the given id, or nil if none exists.
Finds an object with the specified user-assigned id. If there are multiple objects with the same id (shouldn't happen, but could, especially if the passed id is 0), this method will return the first object it finds with the given id. Currently, all objects that have not been explicitly assigned an id have an id of 0.
Note that ids can be assigned in the editor using the ! or # keys.
id | id to search for. |
nil
if no objects with the specified id could be found. returns GameInfo |
returns num |
Returns true
if the two specified points can see one another.
point1 | First point. |
point2 | Second point. |
true
if objects have a line of sight from one to the other, false
otherwise. Arg types: event: Event | returns nothing |