Fix last_pos of new LivingEntity (#777)

* Use pos as last_pos

* Passing tests

---------

Co-authored-by: FewBlue04 <matthew.dietsch04@gmail.com>
This commit is contained in:
akashbeh
2025-04-26 23:36:27 -07:00
committed by GitHub
parent 785f47f0d4
commit 66919c0c63

View File

@@ -42,9 +42,10 @@ pub struct LivingEntity {
} }
impl LivingEntity { impl LivingEntity {
pub fn new(entity: Entity) -> Self { pub fn new(entity: Entity) -> Self {
let pos = entity.pos.load();
Self { Self {
entity, entity,
last_pos: AtomicCell::new(Vector3::new(0.0, 0.0, 0.0)), last_pos: AtomicCell::new(pos),
time_until_regen: AtomicI32::new(0), time_until_regen: AtomicI32::new(0),
last_damage_taken: AtomicCell::new(0.0), last_damage_taken: AtomicCell::new(0.0),
health: AtomicCell::new(20.0), health: AtomicCell::new(20.0),