Files
DevilutionX/Source/lua/modules/player.cpp
T
Gleb Mazovetskiy 32f9cc9ad9 Lua: Add basic APIs for walking to a towner
This may not be how we'll eventually expose towners
but it's good enough for now.
2025-01-26 21:05:09 +00:00

23 lines
515 B
C++

#include "lua/modules/player.hpp"
#include <sol/sol.hpp>
#include "engine/point.hpp"
#include "lua/metadoc.hpp"
#include "player.h"
namespace devilution {
sol::table LuaPlayerModule(sol::state_view &lua)
{
sol::table table = lua.create_table();
SetDocumented(table, "walk_to", "(x: integer, y: integer)",
"Walk to the given coordinates",
[](int x, int y) {
NetSendCmdLoc(MyPlayerId, true, CMD_WALKXY, Point { x, y });
});
return table;
}
} // namespace devilution