Polyphase Game Engine
Loading...
Searching...
No Matches
TileMap2d_Lua.h
Go to the documentation of this file.
1#pragma once
2
3#include "EngineTypes.h"
4#include "Log.h"
5#include "Engine.h"
6
8
11
12#if LUA_ENABLED
13
14#define TILEMAP_2D_LUA_NAME "TileMap2D"
15#define TILEMAP_2D_LUA_FLAG "cfTileMap2D"
16#define CHECK_TILEMAP_2D(L, arg) static_cast<TileMap2D*>(CheckNodeLuaType(L, arg, TILEMAP_2D_LUA_NAME, TILEMAP_2D_LUA_FLAG));
17
18struct TileMap2D_Lua
19{
20 // Coordinate helpers
21 static int WorldToCell(lua_State* L);
22 static int CellToWorld(lua_State* L);
23 static int CellCenterToWorld(lua_State* L);
24
25 // Cell queries / mutation
26 static int GetTile(lua_State* L);
27 static int SetTile(lua_State* L);
28 static int ClearTile(lua_State* L);
29 static int GetCell(lua_State* L);
30 static int IsCellOccupied(lua_State* L);
31
32 // Tile-definition queries (forwarded to the bound TileSet)
33 static int GetTileTags(lua_State* L);
34 static int HasTileTag(lua_State* L);
35 static int GetTileAtlasCoord(lua_State* L);
36
37 // Region search helpers
38 static int FindAllTilesWithTag(lua_State* L);
39 static int FindAllTiles(lua_State* L);
40 static int GetUsedBounds(lua_State* L);
41
42 // Collision helpers (custom 2D AABB list, no Bullet)
43 static int IsSolidAt(lua_State* L);
44 static int IsSolidCell(lua_State* L);
45
46 // Bulk editing helpers
47 static int FillRect(lua_State* L);
48 static int ClearRect(lua_State* L);
49
50 // Phase 3 region & neighbor helpers
51 static int GetCellsInRect(lua_State* L);
52 static int GetClosestTile(lua_State* L);
53 static int GetClosestTilesWithTag(lua_State* L);
54 static int GetClosestTilesOfType(lua_State* L);
55 static int GetNeighborCells(lua_State* L);
56 static int GetCollisionAt(lua_State* L);
57
58 // Phase 3 bulk replace
59 static int ReplaceTile(lua_State* L);
60 static int ReplaceTilesWithTag(lua_State* L);
61 static int CountTileUses(lua_State* L);
62
63 // Phase 4 nav helpers
64 static int RaycastTiles(lua_State* L);
65 static int GetReachableCells(lua_State* L);
66
67 static void Bind();
68};
69
70#endif