Entity: Difference between revisions

From SkyCorp Global
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Static Public Methods ==
== Static Public Methods ==


=== static generate(entityName:String):Entity ===
=== static Entity generate(string entityName) ===
Generate a new entity of the given type based on the entity type string.  Null if unknown entity.
Generate a new entity of the given type based on the [[Types of Entities|entity type string]].  Null if unknown entity.


== Public Methods ==
== Public Methods ==


string getName()
=== string getName() ===
 
Gets name of entity
Gets name of entity


string getLookDesc()
=== string getLookDesc() ===
 
Gets look description(the text displayed when looking at item)
Gets look description(the text displayed when looking at item)


boolean isExaminable()
=== boolean isExaminable() ===
 
Allow player to examine object?  If so, the item is shown in the room item listOtherwise, the object is invisible
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()
=== boolean isAttackable() ===
Is player allowed to (attempt) to do an attack on this object -- shown when looking at object


Location getLocation()
=== boolean isUseable() ===
Is player shown a use button on this object -- shown when looking at object


Returns null if entity is in inventory, or otherwise not in world.
=== boolean isPickupable() ===
Should object display a pick-up option if not yet in inventory?  May or may not *actually* be pickupable.  To do / attempt to do a pickup, use the [[Player]] class.


        /**
=== boolean isDropable()    ===
Should object display a drop item button if is in inventory?   May or may not *actually* be dropable.  Use [[Player]] class to make the actual attempt.


         * 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 deleteEntity() ===
Removes entity from either the inventory or room that it exists in.


         */
=== boolean isPlayerHere() ===
If entity is in world, is the player in this same room?


void moveEntity(string newMapName:String, int newRoomID)
=== int isPlayerAdjacent() ===
If entity is in the world, is the player in a room adjacent to the one entity is in?  If so, which room ID?


        /**
If not, room ID is 0.  If player is in the same room, then room ID 0 is also returned.


         * Move entity from wherever it is (including inventory) into the same room as the player is in.
=== [[Location]] getLocation() ===
Gets location of this entity.  Returns null if entity is in inventory, or otherwise not in world.


         */
=== void moveEntity(string newMapName:String, int newRoomID) ===
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 moveEntityToSameRoomAsPlayer()
=== void moveEntityToSameRoomAsPlayer() ===
Move entity from wherever it is (including inventory) into the same room as the player is in.
[[Category:LUA Class Reference]]
[[Category:LUA Class Reference]]

Revision as of 22:44, 29 December 2017

Static Public Methods

static Entity generate(string entityName)

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?  If so, the item is shown in the room item list. Otherwise, the object is invisible

boolean isAttackable()

Is player allowed to (attempt) to do an attack on this object -- shown when looking at object

boolean isUseable()

Is player shown a use button on this object -- shown when looking at object

boolean isPickupable()

Should object display a pick-up option if not yet in inventory?  May or may not *actually* be pickupable. To do / attempt to do a pickup, use the Player class.

boolean isDropable()    

Should object display a drop item button if is in inventory?   May or may not *actually* be dropable. Use Player class to make the actual attempt.

void deleteEntity()

Removes entity from either the inventory or room that it exists in.

boolean isPlayerHere()

If entity is in world, is the player in this same room?

int isPlayerAdjacent()

If entity is in the world, is the player in a room adjacent to the one entity is in?  If so, which room ID?

If not, room ID is 0.  If player is in the same room, then room ID 0 is also returned.

Location getLocation()

Gets location of this entity. Returns null if entity is in inventory, or otherwise not in world.

void moveEntity(string newMapName:String, int newRoomID)

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

Move entity from wherever it is (including inventory) into the same room as the player is in.