mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
[CSM] Add function to set minimap shape (#5569)
* [CSM] Add function to set minimap shape Also deprecates `toggle_shape`. * Oh fish, I messed that one up! * Fix Style * Sorry, I missed something I still had the `luamethod` call in there! * Add getters * Remove extra line * Remove useless variable Please review again @nerzhul . Thanks! * Satisfy nerzhul
This commit is contained in:
parent
6f641df8a5
commit
e80a83d1cb
6 changed files with 49 additions and 6 deletions
|
@ -108,12 +108,23 @@ int LuaMinimap::l_set_mode(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int LuaMinimap::l_toggle_shape(lua_State *L)
|
||||
int LuaMinimap::l_set_shape(lua_State *L)
|
||||
{
|
||||
LuaMinimap *ref = checkobject(L, 1);
|
||||
Minimap *m = getobject(ref);
|
||||
if (!lua_isnumber(L, 2))
|
||||
return 0;
|
||||
|
||||
m->setMinimapShape((MinimapShape)lua_tonumber(L, 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaMinimap::l_get_shape(lua_State *L)
|
||||
{
|
||||
LuaMinimap *ref = checkobject(L, 1);
|
||||
Minimap *m = getobject(ref);
|
||||
|
||||
m->toggleMinimapShape();
|
||||
lua_pushnumber(L, (int)m->getMinimapShape());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -210,6 +221,7 @@ const luaL_Reg LuaMinimap::methods[] = {
|
|||
luamethod(LuaMinimap, set_angle),
|
||||
luamethod(LuaMinimap, get_mode),
|
||||
luamethod(LuaMinimap, set_mode),
|
||||
luamethod(LuaMinimap, toggle_shape),
|
||||
luamethod(LuaMinimap, set_shape),
|
||||
luamethod(LuaMinimap, get_shape),
|
||||
{0,0}
|
||||
};
|
||||
|
|
|
@ -45,7 +45,8 @@ private:
|
|||
static int l_show(lua_State *L);
|
||||
static int l_hide(lua_State *L);
|
||||
|
||||
static int l_toggle_shape(lua_State *L);
|
||||
static int l_set_shape(lua_State *L);
|
||||
static int l_get_shape(lua_State *L);
|
||||
|
||||
Minimap *m_minimap;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue