From 32563e3f5f29328220205b47a52b5aa3cfebe01b Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 11 Mar 2025 19:39:04 -0500 Subject: [PATCH] mele / player location sync --- src/engine/gameManager/CombatManager.java | 12 ++++++++++++ src/engine/objects/PlayerCharacter.java | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 6fbb4f2e..86d1254f 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -481,6 +481,18 @@ public enum CombatManager { } } + float attackerHitBox = abstractCharacter.calcHitBox(); + float targetHitBox = 0.0f; + if(AbstractCharacter.IsAbstractCharacter(target)){ + AbstractCharacter targetCharacter = (AbstractCharacter)target; + targetHitBox = targetCharacter.calcHitBox(); + }else if(target.getObjectType().equals(GameObjectType.Building)){ + Building targetBuilding = (Building)target; + targetHitBox = targetBuilding.getBounds().getHalfExtents().x; + } + + range += attackerHitBox + targetHitBox; + if (NotInRange(abstractCharacter, target, range)) { //target is in stealth and can't be seen by source diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 6f11ab6c..740a7388 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -5144,17 +5144,23 @@ public class PlayerCharacter extends AbstractCharacter { @Override public void update(Boolean newSystem) { - if(!newSystem) - this.updateLocation(); - - this.updateMovementState(); - if(!newSystem) return; try { if (this.updateLock.writeLock().tryLock()) { + + this.updateMovementState(); + this.updateLocation(); + + if(!this.timestamps.containsKey("SetDirty")){ + this.timestamps.put("SetDirty", System.currentTimeMillis()); + }else if (this.timestamps.get("SetDirty") + 5000L < System.currentTimeMillis()){ + InterestManager.setObjectDirty(this); + this.timestamps.put("SetDirty", System.currentTimeMillis()); + } + try { if (this.isAlive() && this.isActive && this.enteredWorld) { @@ -5197,8 +5203,7 @@ public class PlayerCharacter extends AbstractCharacter { } } - if (this.isBoxed){// && !this.containsEffect(1672601862)) { - //PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); + if (this.isBoxed){ if(!this.title.equals(CharacterTitle.PVE)){ this.title = CharacterTitle.PVE; InterestManager.setObjectDirty(this);