Entity: Difference between revisions

From SkyCorp Global
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 48: Line 48:


=== void makeCursed() ===
=== void makeCursed() ===
Marks this entity as cursed.  The default drop code will prevent the item from being removed unless purified. Intended to be called on start-up.
Marks this entity as cursed.  In order for this to have any effect, you should write a custom function for playerAttemptDropCheck.
 
Generally this would be called on start-up. Curse status can be modified by NPCs that can perform purification.
 
See [[Weight Pendant]] for an example of cursed items.
 
=== boolean getCursed() ===
Is this entity cursed?
[[Category:LUA Class Reference]]
[[Category:LUA Class Reference]]

Latest revision as of 04:11, 30 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.

void makeCursed()

Marks this entity as cursed. In order for this to have any effect, you should write a custom function for playerAttemptDropCheck.

Generally this would be called on start-up. Curse status can be modified by NPCs that can perform purification.

See Weight Pendant for an example of cursed items.

boolean getCursed()

Is this entity cursed?