add pathfinding.set_height

This commit is contained in:
MihailRis 2026-11-01 18:41:40 +03:00
parent 98cd85f4f6
commit 3ec03738b4
2 changed files with 9 additions and 0 deletions

View file

@ -9,6 +9,7 @@ local size = body:get_size()
agent = pathfinding.create_agent()
pathfinding.set_max_visited(agent, 1e3)
pathfinding.set_width(agent, math.max(size[1], size[3]))
pathfinding.set_height(agent, math.ceil(size[2]))
pathfinding.avoid_tag(agent, "core:liquid", 8)
function set_target(new_target)

View file

@ -107,6 +107,13 @@ static int l_set_width(lua::State* L) {
return 0;
}
static int l_set_height(lua::State* L) {
if (auto agent = get_agent(L)) {
agent->height = lua::touinteger(L, 2);
}
return 0;
}
static int l_avoid_tag(lua::State* L) {
if (auto agent = get_agent(L)) {
int index =
@ -133,6 +140,7 @@ const luaL_Reg pathfindinglib[] = {
{"set_max_visited", lua::wrap<l_set_max_visited_blocks>},
{"set_jump_height", lua::wrap<l_set_jump_height>},
{"set_width", lua::wrap<l_set_width>},
{"set_height", lua::wrap<l_set_height>},
{"avoid_tag", lua::wrap<l_avoid_tag>},
{nullptr, nullptr}
};