mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
Enemies are moved along navmesh paths without collision, so a wall only stops them if their path stops at it. dpWorld now keeps a list of such walls, each with the collision filter it blocks with, and cuts a path where it first walks into one (a little short of the wall; a mover inside one can walk out). Which objects block comes from data (dpMovementBlockers::BlockingFilter): - navmesh carvers (navmesh_carver in the level config, which the client reads with add_to_navmesh and carver_only) block every mover; - solid objects whose collision group touches enemies and not players (group 18, e.g. "FV - Enemy Blocking Volume", "PR - Pet Blocker") block what that group touches. dpShapeBox gains SegmentEntry, a segment test against the rotated box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <vector>
|
|
|
|
#include "dpMovementBlockers.h"
|
|
|
|
class dNavMesh;
|
|
class dpEntity;
|
|
|
|
namespace dpWorld {
|
|
void Initialize(uint32_t zoneID, bool generateNewNavMesh = true);
|
|
void Shutdown();
|
|
void Reload();
|
|
|
|
bool ShouldUseSP(uint32_t zoneID);
|
|
bool IsLoaded();
|
|
|
|
void StepWorld(float deltaTime);
|
|
|
|
void AddEntity(dpEntity* entity);
|
|
void RemoveEntity(dpEntity* entity);
|
|
|
|
/**
|
|
* Takes an entity out of the world without deleting it, so it can be added back later (a volume switched off)
|
|
*/
|
|
void DetachEntity(dpEntity* entity);
|
|
|
|
dNavMesh* GetNavMesh();
|
|
|
|
/**
|
|
* A wall the server's movers (MovementAI) cannot walk through (see dpMovementBlocker). The entity stays owned by
|
|
* the caller, who removes it before deleting it; it is not stepped with the world.
|
|
*/
|
|
void AddMovementBlocker(const dpEntity* entity, uint32_t filter);
|
|
void RemoveMovementBlocker(const dpEntity* entity);
|
|
std::span<const dpMovementBlocker> GetMovementBlockers();
|
|
|
|
// A mover's path cut where it first walks into a movement blocker (dpMovementBlockers::ClampPath)
|
|
std::vector<NiPoint3> ClampPath(const NiPoint3& start, std::vector<NiPoint3> path, uint32_t moverFilter);
|
|
};
|