mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
add pathfinding.set_height
This commit is contained in:
parent
98cd85f4f6
commit
3ec03738b4
2 changed files with 9 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue