forked from Mirrorlandia_minetest/minetest
parent
0891975ad6
commit
7b74f04a61
@ -49,8 +49,8 @@ core.register_chatcommand("test_node", {
|
|||||||
|
|
||||||
local function preview_minimap()
|
local function preview_minimap()
|
||||||
local minimap = core.ui.minimap
|
local minimap = core.ui.minimap
|
||||||
minimap:show()
|
|
||||||
minimap:set_mode(4)
|
minimap:set_mode(4)
|
||||||
|
minimap:show()
|
||||||
minimap:set_pos({x=5, y=50, z=5})
|
minimap:set_pos({x=5, y=50, z=5})
|
||||||
minimap:toggle_shape()
|
minimap:toggle_shape()
|
||||||
|
|
||||||
@ -61,9 +61,13 @@ end
|
|||||||
|
|
||||||
core.after(2, function()
|
core.after(2, function()
|
||||||
print("[PREVIEW] loaded " .. modname .. " mod")
|
print("[PREVIEW] loaded " .. modname .. " mod")
|
||||||
preview_minimap()
|
|
||||||
modstorage:set_string("current_mod", modname)
|
modstorage:set_string("current_mod", modname)
|
||||||
print(modstorage:get_string("current_mod"))
|
print(modstorage:get_string("current_mod"))
|
||||||
|
preview_minimap()
|
||||||
|
end)
|
||||||
|
|
||||||
|
core.after(5, function()
|
||||||
|
core.ui.minimap:show()
|
||||||
|
|
||||||
print("[PREVIEW] Day count: " .. core.get_day_count() ..
|
print("[PREVIEW] Day count: " .. core.get_day_count() ..
|
||||||
" time of day " .. core.get_timeofday())
|
" time of day " .. core.get_timeofday())
|
||||||
|
@ -224,7 +224,6 @@ Client::Client(
|
|||||||
m_device(device),
|
m_device(device),
|
||||||
m_camera(NULL),
|
m_camera(NULL),
|
||||||
m_minimap_disabled_by_server(false),
|
m_minimap_disabled_by_server(false),
|
||||||
m_minimap_shown_by_mod(false),
|
|
||||||
m_server_ser_ver(SER_FMT_VER_INVALID),
|
m_server_ser_ver(SER_FMT_VER_INVALID),
|
||||||
m_proto_ver(0),
|
m_proto_ver(0),
|
||||||
m_playeritem(0),
|
m_playeritem(0),
|
||||||
@ -1933,11 +1932,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
|||||||
|
|
||||||
bool Client::shouldShowMinimap() const
|
bool Client::shouldShowMinimap() const
|
||||||
{
|
{
|
||||||
if (m_minimap_disabled_by_server) {
|
return !m_minimap_disabled_by_server;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_minimap_shown_by_mod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IGameDef interface
|
// IGameDef interface
|
||||||
|
@ -532,7 +532,6 @@ public:
|
|||||||
{ return m_camera; }
|
{ return m_camera; }
|
||||||
|
|
||||||
bool shouldShowMinimap() const;
|
bool shouldShowMinimap() const;
|
||||||
void setMinimapShownByMod(bool state) { m_minimap_shown_by_mod = state; }
|
|
||||||
|
|
||||||
// IGameDef interface
|
// IGameDef interface
|
||||||
virtual IItemDefManager* getItemDefManager();
|
virtual IItemDefManager* getItemDefManager();
|
||||||
@ -634,7 +633,6 @@ private:
|
|||||||
Camera *m_camera;
|
Camera *m_camera;
|
||||||
Minimap *m_minimap;
|
Minimap *m_minimap;
|
||||||
bool m_minimap_disabled_by_server;
|
bool m_minimap_disabled_by_server;
|
||||||
bool m_minimap_shown_by_mod;
|
|
||||||
// Server serialization version
|
// Server serialization version
|
||||||
u8 m_server_ser_ver;
|
u8 m_server_ser_ver;
|
||||||
|
|
||||||
|
@ -1769,7 +1769,7 @@ void Game::run()
|
|||||||
updateProfilerGraphs(&graph);
|
updateProfilerGraphs(&graph);
|
||||||
|
|
||||||
// Update if minimap has been disabled by the server
|
// Update if minimap has been disabled by the server
|
||||||
flags.show_minimap = client->shouldShowMinimap();
|
flags.show_minimap &= client->shouldShowMinimap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,17 +118,21 @@ int LuaMinimap::l_toggle_shape(lua_State *L)
|
|||||||
|
|
||||||
int LuaMinimap::l_show(lua_State *L)
|
int LuaMinimap::l_show(lua_State *L)
|
||||||
{
|
{
|
||||||
Client *client = getClient(L);
|
LuaMinimap *ref = checkobject(L, 1);
|
||||||
assert(client);
|
Minimap *m = getobject(ref);
|
||||||
client->setMinimapShownByMod(true);
|
|
||||||
|
if (m->getMinimapMode() == MINIMAP_MODE_OFF)
|
||||||
|
m->setMinimapMode(MINIMAP_MODE_SURFACEx1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaMinimap::l_hide(lua_State *L)
|
int LuaMinimap::l_hide(lua_State *L)
|
||||||
{
|
{
|
||||||
Client *client = getClient(L);
|
LuaMinimap *ref = checkobject(L, 1);
|
||||||
assert(client);
|
Minimap *m = getobject(ref);
|
||||||
client->setMinimapShownByMod(false);
|
|
||||||
|
if (m->getMinimapMode() != MINIMAP_MODE_OFF)
|
||||||
|
m->setMinimapMode(MINIMAP_MODE_OFF);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user