Entity: Difference between revisions
(Created page with " == Public Methods == TODO Category:LUA Class Reference") |
No edit summary |
||
Line 1: | Line 1: | ||
== Static Public Methods == | |||
=== static generate(entityName:String):Entity === | |||
Generate a new entity of the given type based on the entity type string. Null if unknown entity. | |||
== Public Methods == | == Public Methods == | ||
string getName() | |||
Gets name of entity | |||
string getLookDesc() | |||
Gets look description(the text displayed when looking at item) | |||
boolean isExaminable() | |||
Allow player to examine object? Will then display relevant options such as pickup, drop, etc. Otherwise, the object is invisible | |||
/** | |||
* Allow player to do an attack on this object -- shown when looking at object | |||
*/ | |||
boolean isAttackable() | |||
/** | |||
* Allow player to do the use action on this object -- shown when looking at object | |||
*/ | |||
boolean isUseable() | |||
/** | |||
* Should object display a pick-up option if not yet in inventory? May or may not *actually* be pickupable | |||
*/ | |||
boolean isPickupable() | |||
/** | |||
* Should object display a drop item if is in inventory? May or may not *actually* be dropable | |||
*/ | |||
boolean isDropable() | |||
/** | |||
* Shortcut function -- removes entity from either the inventory or room that it exists in. | |||
*/ | |||
void deleteEntity() | |||
/** | |||
* If we are in the world, is the player in this same room? | |||
*/ | |||
boolean isPlayerHere() | |||
/** | |||
* If we are in the world, is the player in a room adjacent to this one? If so, which room? | |||
* If not, room ID is 0. If player is in the same room, then room ID 0 is also returned. | |||
*/ | |||
int isPlayerAdjacent() | |||
Location getLocation() | |||
Returns null if entity is in inventory, or otherwise not in world. | |||
/** | |||
* Moves entity from whereever it is (including inventory) into a particular location. If picking up the item, should use the functions on the Player class instead. | |||
*/ | |||
void moveEntity(string newMapName:String, int newRoomID) | |||
/** | |||
* Move entity from wherever it is (including inventory) into the same room as the player is in. | |||
*/ | |||
void moveEntityToSameRoomAsPlayer() | |||
[[Category:LUA Class Reference]] | [[Category:LUA Class Reference]] |
Revision as of 22:37, 29 December 2017
Static Public Methods
static generate(entityName:String):Entity
Generate a new entity of the given type based on the entity type string. Null if unknown entity.
Public Methods
string getName()
Gets name of entity
string getLookDesc()
Gets look description(the text displayed when looking at item)
boolean isExaminable()
Allow player to examine object? Will then display relevant options such as pickup, drop, etc. Otherwise, the object is invisible
/**
* Allow player to do an attack on this object -- shown when looking at object
*/
boolean isAttackable()
/**
* Allow player to do the use action on this object -- shown when looking at object
*/
boolean isUseable()
/**
* Should object display a pick-up option if not yet in inventory? May or may not *actually* be pickupable
*/
boolean isPickupable()
/**
* Should object display a drop item if is in inventory? May or may not *actually* be dropable
*/
boolean isDropable()
/**
* Shortcut function -- removes entity from either the inventory or room that it exists in.
*/
void deleteEntity()
/**
* If we are in the world, is the player in this same room?
*/
boolean isPlayerHere()
/**
* If we are in the world, is the player in a room adjacent to this one? If so, which room?
* If not, room ID is 0. If player is in the same room, then room ID 0 is also returned.
*/
int isPlayerAdjacent()
Location getLocation()
Returns null if entity is in inventory, or otherwise not in world.
/**
* Moves entity from whereever it is (including inventory) into a particular location. If picking up the item, should use the functions on the Player class instead.
*/
void moveEntity(string newMapName:String, int newRoomID)
/**
* Move entity from wherever it is (including inventory) into the same room as the player is in.
*/
void moveEntityToSameRoomAsPlayer()