Browse Source

mele / player location sync

lakebane
FatBoy-DOTC 3 weeks ago
parent
commit
32563e3f5f
  1. 12
      src/engine/gameManager/CombatManager.java
  2. 19
      src/engine/objects/PlayerCharacter.java

12
src/engine/gameManager/CombatManager.java

@ -481,6 +481,18 @@ public enum CombatManager { @@ -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

19
src/engine/objects/PlayerCharacter.java

@ -5144,17 +5144,23 @@ public class PlayerCharacter extends AbstractCharacter { @@ -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 { @@ -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);

Loading…
Cancel
Save