Browse Source

attempted invis character sync fix

lakebane
FatBoy-DOTC 3 weeks ago
parent
commit
dd2707f6fb
  1. 40
      src/engine/gameManager/CombatManager.java
  2. 12
      src/engine/gameManager/SimulationManager.java
  3. 14
      src/engine/objects/PlayerCharacter.java
  4. 2
      src/engine/workthreads/UpdateThread.java

40
src/engine/gameManager/CombatManager.java

@ -470,25 +470,27 @@ public enum CombatManager {
//Range check. //Range check.
if(abstractCharacter.isMoving()){ //if(abstractCharacter.isMoving()){
range += (abstractCharacter.getSpeed() * 0.1f); // add movement vector offset for moving attacker // range += (abstractCharacter.getSpeed() * 0.1f); // add movement vector offset for moving attacker
} //}
if(AbstractWorldObject.IsAbstractCharacter(target)) { //if(AbstractWorldObject.IsAbstractCharacter(target)) {
AbstractCharacter tarAc = (AbstractCharacter) target; // AbstractCharacter tarAc = (AbstractCharacter) target;
if(tarAc != null && tarAc.isMoving()){ // if(tarAc != null && tarAc.isMoving()){
range += (tarAc.getSpeed() * 0.1f); // add movement vector offset for moving target // range += (tarAc.getSpeed() * 0.1f); // add movement vector offset for moving target
} // }
} //}
float attackerHitBox = abstractCharacter.calcHitBox(); // add attacker hitbox //float attackerHitBox = abstractCharacter.calcHitBox(); // add attacker hitbox
float targetHitBox = 0.0f; //float targetHitBox = 0.0f;
if(AbstractCharacter.IsAbstractCharacter(target)){ //if(AbstractCharacter.IsAbstractCharacter(target)){
AbstractCharacter targetCharacter = (AbstractCharacter)target; // AbstractCharacter targetCharacter = (AbstractCharacter)target;
targetHitBox = targetCharacter.calcHitBox(); // add target hitbox // targetHitBox = targetCharacter.calcHitBox(); // add target hitbox
} //}
range += attackerHitBox + targetHitBox + 2.5f; // offset standard range to sync where client tries to stop //range += attackerHitBox + targetHitBox + 2.5f; // offset standard range to sync where client tries to stop
range += 2; //sync offset
if (NotInRange(abstractCharacter, target, range)) { if (NotInRange(abstractCharacter, target, range)) {

12
src/engine/gameManager/SimulationManager.java

@ -91,13 +91,13 @@ public enum SimulationManager {
"Fatal error in City Pulse: DISABLED. Error Message : " "Fatal error in City Pulse: DISABLED. Error Message : "
+ e.getMessage()); + e.getMessage());
} }
try { //try {
if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime)) // if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime))
pulseUpdate(); // pulseUpdate();
} catch (Exception e) { //} catch (Exception e) {
Logger.error("Fatal error in Update Pulse: DISABLED"); // Logger.error("Fatal error in Update Pulse: DISABLED");
} //}
try { try {
if ((_runegatePulseTime != 0) if ((_runegatePulseTime != 0)

14
src/engine/objects/PlayerCharacter.java

@ -5155,13 +5155,13 @@ public class PlayerCharacter extends AbstractCharacter {
if (this.updateLock.writeLock().tryLock()) { if (this.updateLock.writeLock().tryLock()) {
if(!this.timestamps.containsKey("SetDirty")){ //if(!this.timestamps.containsKey("SetDirty")){
this.timestamps.put("SetDirty", System.currentTimeMillis()); // this.timestamps.put("SetDirty", System.currentTimeMillis());
}else if (this.timestamps.get("SetDirty") + 5000L < System.currentTimeMillis()){ //}else if (this.timestamps.get("SetDirty") + 5000L < System.currentTimeMillis()){
InterestManager.setObjectDirty(this); // InterestManager.setObjectDirty(this);
InterestManager.reloadCharacter(this,false); // InterestManager.reloadCharacter(this,false);
this.timestamps.put("SetDirty", System.currentTimeMillis()); // this.timestamps.put("SetDirty", System.currentTimeMillis());
} //}
try { try {

2
src/engine/workthreads/UpdateThread.java

@ -47,7 +47,7 @@ public class UpdateThread implements Runnable {
while (true) { while (true) {
try { try {
this.processPlayerUpdate(); this.processPlayerUpdate();
Thread.sleep(100); // Pause for 100ms to reduce CPU usage Thread.sleep(1000); // Pause for 1000ms to reduce CPU usage
} catch (InterruptedException e) { } catch (InterruptedException e) {
Logger.error("Thread interrupted", e); Logger.error("Thread interrupted", e);
} }

Loading…
Cancel
Save