Map (Class): Difference between revisions
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== 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 == | == 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 13: | ||
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 21: | ||
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 42: | ||
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 | ||
=== string getName() === | === string getName() === | ||
Name of the map | 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) | |||
[[Category:LUA Class Reference]] | [[Category:LUA Class Reference]] |
Latest revision as of 04:47, 6 March 2018
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)