This commit is contained in:
aozhiwei 2023-04-05 18:34:54 +08:00
parent 9386f56abd
commit b5eb72aade
3 changed files with 13 additions and 6 deletions

View File

@ -2346,6 +2346,7 @@ void Creature::SpecDirMove(glm::vec3 dir, float distance)
room->map_instance->CheckTerrain(this, same_polys_flags, spec_polys);
}
AdjustPos();
room->grid_service->MoveCreature(this);
GetMovement()->ClearPath();
}
@ -3233,3 +3234,13 @@ bool Creature::CanShot(bool try_reload)
}
return true;
}
void Creature::AdjustPos()
{
if (GetPos().GetX() < 0) {
GetMutablePos().SetX(0);
}
if (GetPos().GetZ() < 0) {
GetMutablePos().SetZ(0);
}
}

View File

@ -348,6 +348,7 @@ class Creature : public MoveableEntity
const mt::Equip* weapon_meta,
const mt::Equip* bullet_meta);
bool CanShot(bool try_reload);
void AdjustPos();
protected:
virtual void OnBuffRemove(Buff& buff);

View File

@ -42,12 +42,7 @@ bool Movement::UpdatePosition()
next_point.dir.z = dir.z;
}
}
if (owner_->GetPos().GetX() < 0) {
owner_->GetMutablePos().SetX(0);
}
if (owner_->GetPos().GetZ() < 0) {
owner_->GetMutablePos().SetZ(0);
}
owner_->AdjustPos();
#if 0
if (owner_->GetPos().GetX() < 0 ||
owner_->GetPos().GetZ() < 0) {