Difference between revisions of "Map (Class)"

From SkyCorp Global
Line 2: Line 2:
 
== Public Methods ==
 
== Public Methods ==
  
=== boolean addItem(Entity entity, int roomID) ===
+
=== boolean addItem([[Entity]] entity, int roomID) ===
 
Attempt adding entity to roomID.
 
Attempt adding entity to roomID.
  
Line 9: Line 9:
 
Called during drop item, could also be used to drop new items/loot/etc
 
Called during drop item, could also be used to drop new items/loot/etc
  
=== boolean deleteItem(Entity entity) ===
+
=== boolean deleteItem([[Entity]] entity) ===
 
Attempt removing an item from anywhere in the map  
 
Attempt removing an item from anywhere in the map  
  
Line 17: Line 17:
 
Gets name of room.  If no such room, returns "INVALID ROOM"
 
Gets name of room.  If no such room, returns "INVALID ROOM"
  
=== Entity getNamedEntityInRoom(string entityName, int roomID) ===
+
=== [[Entity]] getNamedEntityInRoom(string entityName, int roomID) ===
 
If the map has the named entity in the given roomID, return it.  Else null.
 
If the map has the named entity in the given roomID, return it.  Else null.
  
=== Entity getEntityInRoomByType(class entityClass, int roomID) ===
+
=== [[Entity]] getEntityInRoomByType(class entityClass, int roomID) ===
 
TODO - not yet hooked up, need to figure out how to best pass class information between AS3/LUA.
 
TODO - not yet hooked up, need to figure out how to best pass class information between AS3/LUA.
  
Line 38: Line 38:
 
Gets a boolean tag for a certain room.  False if room or tag does not exist, or is set to false.  True if it exists and is set to true.
 
Gets a boolean tag for a certain room.  False if room or tag does not exist, or is set to false.  True if it exists and is set to true.
  
=== int getRoomIDOfEntity(Entity entity) ===
+
=== int getRoomIDOfEntity([[Entity]] entity) ===
 
Which room is a particular entity in?  If not found, then 0
 
Which room is a particular entity in?  If not found, then 0
  

Revision as of 05:29, 29 December 2017

Public Methods

boolean addItem(Entity entity, int roomID)

Attempt adding entity to roomID.

More performant to use entity's

Called during drop item, could also be used to drop new items/loot/etc

boolean deleteItem(Entity entity)

Attempt removing an item from anywhere in the map

Called from pickup.  Could also be used to destroy an item in a room.

string getRoomName(int roomID)

Gets name of room. If no such room, returns "INVALID ROOM"

Entity getNamedEntityInRoom(string entityName, int roomID)

If the map has the named entity in the given roomID, return it.  Else null.

Entity getEntityInRoomByType(class entityClass, int roomID)

TODO - not yet hooked up, need to figure out how to best pass class information between AS3/LUA.

void setTagBoolean(int roomID, string tag, boolean enabled)

Sets a tag for a room which can be useful for classifying rooms or applying special properties.

This version will set the tag to be either True or False (this system could be expanded in future to allow for string or other object storage inside tags)

Tags are used in a number of game locations to keep track of types of places. For instance, in the strip club, it is used to tag rooms where the patrons can see the player.

Parameters:

  • roomID: room to change
  • tag: tag name to change
  • enabled: what to set tag state to (true/false)  (false is same as unset)

boolean getTagBoolean(int roomID, string tag)

Gets a boolean tag for a certain room.  False if room or tag does not exist, or is set to false. True if it exists and is set to true.

int getRoomIDOfEntity(Entity entity)

Which room is a particular entity in?  If not found, then 0

string getName()

Name of the map