Modding:MapScene

From SkyCorp Global
Jump to navigation Jump to search

Map Scene is the view of the game that is seen when moving from room to room. Currently, it also houses a number of movement and action related logic functions that are not map specific (for those see the Map class).

Static Methods

static MapScene getInstance()

Get the instance of the MapScene class.

Public Methods

void setCurrentRoomID(string mapName, int newRoom)

Sets room player is currently in. No text / transition is shown to player, this is essentially an 'instant' warp with no further logic checks performed.

void teleportToRespawn()

Teleport player to a good respawn position (generally after they have died). The exact location is dependent on the player's form and other restrictions (map-specific respawn logic will be respected, if available).

bool teleportToMapSpecificRespawnIfAny()

Not typically called -- usually you would call teleportToRespawn() instead as there are also fallbacks to teleport the player to other locations. However, if you want to only use map specific logic, and otherwise not move the player, this function is good.

bool isInPublicOverworldRoom()

Checks if room player is currently in is in view of public (ex: public parts of Mulberry township, near guard outposts, etc)

void tickGame()

Essentially this performs one 'turn' of the game world -- all subsystem calculations will be called and player/monster states updated, etc. This will give monster a chance to attack the player, etc.

bool getInCombatCurrently()

Is player in combat currently (is there another mob in this room in ATTACK mode?

void readyForNextTurn()

This function 'resets' the map scene, such that the next time the map scene is shown, it will count as a new turn. If the player spent a long time in a submenu (ex: made an action that would take a notable amount of time, then it makes sense the world should update in the intervening time. This will give monster a chance to attack the player, etc. when the map scene is shown again.

Entity getPlayerAttacker()

Find a monster that is currently attacking the player (must be in same room). Nil if none.