mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
test mobs
This commit is contained in:
parent
c06636053d
commit
88641e032a
5 changed files with 142 additions and 79 deletions
|
|
@ -49,7 +49,7 @@ static int l_make_route(lua::State* L) {
|
|||
auto start = lua::tovec3(L, 2);
|
||||
auto target = lua::tovec3(L, 3);
|
||||
agent->state = {};
|
||||
agent->start = start;
|
||||
agent->start = glm::floor(start);
|
||||
agent->target = target;
|
||||
auto route = level->pathfinding->perform(*agent);
|
||||
if (!route.found) {
|
||||
|
|
@ -65,7 +65,7 @@ static int l_make_route_async(lua::State* L) {
|
|||
auto start = lua::tovec3(L, 2);
|
||||
auto target = lua::tovec3(L, 3);
|
||||
agent->state = {};
|
||||
agent->start = start;
|
||||
agent->start = glm::floor(start);
|
||||
agent->target = target;
|
||||
level->pathfinding->perform(*agent, 0);
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ static int l_pull_route(lua::State* L) {
|
|||
if (!agent->state.finished) {
|
||||
return 0;
|
||||
}
|
||||
if (!route.found) {
|
||||
if (!route.found && !agent->mayBeIncomplete) {
|
||||
return lua::createtable(L, 0, 0);
|
||||
}
|
||||
return push_route(L, route);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ struct GraphicsSettings {
|
|||
|
||||
struct PathfindingSettings {
|
||||
/// @brief Max visited blocks by an agent per async tick
|
||||
IntegerSetting stepsPerAsyncAgent {256, 1, 2048};
|
||||
IntegerSetting stepsPerAsyncAgent {128, 1, 2048};
|
||||
};
|
||||
|
||||
struct DebugSettings {
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ Route Pathfinding::perform(Agent& agent, int maxVisited) {
|
|||
}
|
||||
state.finished = true;
|
||||
agent.state = std::move(state);
|
||||
return {};
|
||||
return finish_route(agent, std::move(agent.state));
|
||||
}
|
||||
|
||||
Agent* Pathfinding::getAgent(int id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue