Files
DevilutionX/Source/lua/modules/dev/level/map.cpp
T
Gleb Mazovetskiy a2b94cc03c Lua: Migrate and organize the rest of debug cmds
Fully migrates debug commands to Lua and organizes them into logical
groups.

The CLI `+` syntax now runs Lua, e.g.:

```bash
build/devilutionx '+dev.player.trn.plr("infra")'
```

Chat hotkeys run Lua code if they start with `/lua`, e.g.:

```ini
[NetMsg]
QuickMessage1=/lua message(dev.player.info())
```
2023-11-07 22:27:48 +00:00

42 lines
918 B
C++

#ifdef _DEBUG
#include "lua/modules/dev/level/map.hpp"
#include <string>
#include <sol/sol.hpp>
#include "automap.h"
#include "lua/metadoc.hpp"
namespace devilution {
namespace {
std::string DebugCmdMapReveal()
{
for (int x = 0; x < DMAXX; x++)
for (int y = 0; y < DMAXY; y++)
UpdateAutomapExplorer({ x, y }, MAP_EXP_SHRINE);
return "Automap fully explored.";
}
std::string DebugCmdMapHide()
{
for (int x = 0; x < DMAXX; x++)
for (int y = 0; y < DMAXY; y++)
AutomapView[x][y] = MAP_EXP_NONE;
return "Automap exploration removed.";
}
} // namespace
sol::table LuaDevLevelMapModule(sol::state_view &lua)
{
sol::table table = lua.create_table();
SetDocumented(table, "hide", "()", "Hide the map.", &DebugCmdMapHide);
SetDocumented(table, "reveal", "()", "Reveal the map.", &DebugCmdMapReveal);
return table;
}
} // namespace devilution
#endif // _DEBUG