Minor dialogue and UI bug fixing
This commit is contained in:
1 parent
fff5a9d4aa
commit
db456bde09
11 files changed
+2350
-21
No files matched your search
+19
-4
@@ -379,7 +379,7 @@ namespace ZL
|
||||
|
||||
const auto addCharacter = [&](const Character* other) {
|
||||
if (!other || other == self) return;
|
||||
if (other->hp <= 0.f || !other->enabled) return;
|
||||
if (other->getHp() <= 0.f || !other->enabled) return;
|
||||
if (other->isMoving()) return;
|
||||
|
||||
if (distancePointToSegmentXZ(other->position, start, end) > kDynamicObstacleInfluenceDist) {
|
||||
@@ -533,7 +533,7 @@ namespace ZL
|
||||
//std::cout << "[RAYCAST_NPC] Starting raycast with " << npcs.size() << " npcs" << std::endl;
|
||||
|
||||
for (auto& npc : npcs) {
|
||||
if (npc->hp <= 0.f) {
|
||||
if (npc->getHp() <= 0.f) {
|
||||
//std::cout << "[RAYCAST_NPC] " << npc->npcId << " is dead, skipping" << std::endl;
|
||||
continue;
|
||||
}
|
||||
@@ -1248,7 +1248,7 @@ namespace ZL
|
||||
Character* a = characters[i];
|
||||
Character* b = characters[j];
|
||||
if (!a || !b) continue;
|
||||
if (a->hp <= 0.f || b->hp <= 0.f || !a->enabled || !b->enabled) continue;
|
||||
if (a->getHp() <= 0.f || b->getHp() <= 0.f || !a->enabled || !b->enabled) continue;
|
||||
|
||||
const float minDist = a->collisionRadius + b->collisionRadius;
|
||||
if (minDist <= 0.f) continue;
|
||||
@@ -1322,6 +1322,8 @@ namespace ZL
|
||||
static constexpr float kMovedEps = 0.05f;
|
||||
static constexpr float kReplanTriggerDist = 1.8f;
|
||||
static constexpr int64_t kReplanCooldownMs = 500;
|
||||
static constexpr float kStuckMovementThreshold = 0.02f;
|
||||
static constexpr int kStuckFrameThreshold = 4;
|
||||
|
||||
for (auto it = replanCooldownRemainingMs.begin(); it != replanCooldownRemainingMs.end();) {
|
||||
it->second -= deltaMs;
|
||||
@@ -1355,6 +1357,19 @@ namespace ZL
|
||||
if (moved > kMovedEps) {
|
||||
movers.push_back(c);
|
||||
}
|
||||
|
||||
if (c->isMoving()) {
|
||||
if (moved < kStuckMovementThreshold) {
|
||||
if (++stuckFrameCounts[c] >= kStuckFrameThreshold) {
|
||||
c->forceReplan();
|
||||
stuckFrameCounts[c] = 0;
|
||||
}
|
||||
} else {
|
||||
stuckFrameCounts[c] = 0;
|
||||
}
|
||||
} else {
|
||||
stuckFrameCounts[c] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (movers.empty()) {
|
||||
@@ -1366,7 +1381,7 @@ namespace ZL
|
||||
|
||||
for (Character* walker : characters) {
|
||||
if (!walker || walker == mover) continue;
|
||||
if (walker->hp <= 0.f || !walker->enabled) continue;
|
||||
if (walker->getHp() <= 0.f || !walker->enabled) continue;
|
||||
if (!walker->isMoving()) continue;
|
||||
|
||||
if (replanCooldownRemainingMs.find(walker) != replanCooldownRemainingMs.end()) {
|
||||
|
||||
Reference in new issue
Block a user