Courage.World#
require("Courage.World") exposes the C CrWorldApi to Luau. The same table is available as require("Courage.Game").world.
API#
| Function | Returns | Description |
|---|---|---|
World.current_stage() | string? | Current start stage name (dComIfGp_getStartStageName) |
World.current_layer() | number | Current stage layer (dComIfG_play_c::getLayerNo(0)) |
World.warp(stage, spawn, room, layer?) | (none) | Calls dComIfGp_setNextStage. Optional layer parameter (defaults to -1). |
World.project(x, y, z) | sx, sy, sz, visible | Project 3D world position to 2D screen space. visible is true when the point is in front of the camera. |
World.viewport() | width, height | Current viewport dimensions in pixels. |
World.has_control() | boolean | true when the player has full game control (not paused, no event, no stage transition). |
World.project(x, y, z) -> sx, sy, sz, visible#
Projects a 3D world-space position to 2D screen-space coordinates using the current view matrix. Returns four values: the projected X, Y, Z coordinates plus a boolean that is true when the point is in front of the camera (viewspace Z < 0).
World.viewport() -> width, height#
Returns the current viewport dimensions in pixels as two numbers.
World.has_control() -> boolean#
Returns true when the game is in normal play: not paused, no menu open, no stage transition, no cutscene running.
For accurate per-frame stage tracking during gameplay (chest lookups, region checks), prefer Courage.Hooks.trackStageName, which hooks daAlink_c::checkStageName.
Stage codes such as F_SP103 are on the Maps and Exits tabs of the TP Ultimate Spreadsheet.