Merge pull request #1123 from noudess/amphibious

Allow amphibious mobs underwater to follow los and not fall to water bottom when pathing
This commit is contained in:
JJ 2020-10-05 20:17:37 -04:00 committed by GitHub
commit 4ac62a2ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1088,6 +1088,17 @@ void MobMovementManager::UpdatePath(Mob *who, float x, float y, float z, MobMove
PushFlyTo(ent.second, x, y, z, mob_movement_mode);
PushStopMoving(ent.second);
}
// Below for npcs that can traverse land or water so they don't sink
else if (who->GetFlyMode() == GravityBehavior::Water &&
zone->watermap->InLiquid(who->GetPosition()) &&
zone->watermap->InLiquid(glm::vec3(x, y, z)) &&
zone->zonemap->CheckLoS(who->GetPosition(), glm::vec3(x, y, z))) {
auto iter = _impl->Entries.find(who);
auto &ent = (*iter);
PushSwimTo(ent.second, x, y, z, mob_movement_mode);
PushStopMoving(ent.second);
}
else {
UpdatePathGround(who, x, y, z, mob_movement_mode);
}