Map (Class)

From SkyCorp Global
Revision as of 04:47, 6 March 2018 by SkyCorp (talk | contribs) (Location createLocation(int roomID))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Public Static Methods

static Map getMap(string mapName)

Gets map object from map name (string).  Returns null if map with that name can not be found.

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

Location createLocation(int roomID)

Returns the Location for a particular roomID on this map. Does not check the room ID actually exists.

(Introduced in r26)