mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-17 20:24:21 +00:00
feat: enemy npc pathing
they live 🎉 tested that enemies path all around the world should they have a path configured. tested that the admiral in gf (at the first camp) paths now. fixes #1546
This commit is contained in:
@@ -101,15 +101,23 @@ void Zone::LoadZoneIntoMemory() {
|
||||
m_Paths.reserve(pathCount);
|
||||
for (uint32_t i = 0; i < pathCount; ++i) LoadPath(file);
|
||||
|
||||
for (Path path : m_Paths) {
|
||||
for (const Path& path : m_Paths) {
|
||||
if (path.pathType != PathType::Spawner) continue;
|
||||
SpawnerInfo info = SpawnerInfo();
|
||||
for (PathWaypoint waypoint : path.pathWaypoints) {
|
||||
SpawnerInfo info{};
|
||||
for (int i = 0; i < path.pathWaypoints.size(); i++) {
|
||||
const auto& waypoint = path.pathWaypoints[i];
|
||||
SpawnerNode* node = new SpawnerNode();
|
||||
node->position = waypoint.position;
|
||||
node->rotation = waypoint.rotation;
|
||||
node->nodeID = 0;
|
||||
node->config = waypoint.config;
|
||||
node->config = path.pathWaypoints[0].config;
|
||||
// All spawner waypoints get the config data of the first waypoint, but then we
|
||||
// overwrite settings on this waypoint if we have another one defined of the same name
|
||||
if (i != 0) {
|
||||
for (const auto& [key, value] : waypoint.config) {
|
||||
node->config.ParseInsert(value->GetString());
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& data : waypoint.config | std::views::values) {
|
||||
if (!data) continue;
|
||||
|
||||
Reference in New Issue
Block a user