forked from MagicBane/Server
Compare commits
4 Commits
master
..
549a381174
| Author | SHA1 | Date | |
|---|---|---|---|
| 549a381174 | |||
| 43563aeb14 | |||
| 7a4c2fe72a | |||
| 24cc6af147 |
@@ -24,3 +24,7 @@
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
*.idea/
|
||||||
|
Server.iml
|
||||||
|
*.gitignore
|
||||||
|
prestonbane.iml
|
||||||
@@ -174,6 +174,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
private boolean isTeleporting = false;
|
private boolean isTeleporting = false;
|
||||||
private boolean dirtyLoad = true;
|
private boolean dirtyLoad = true;
|
||||||
private final ReadWriteLock dirtyLock = new ReentrantReadWriteLock(true);
|
private final ReadWriteLock dirtyLock = new ReentrantReadWriteLock(true);
|
||||||
|
private Bounds playerBounds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
@@ -206,6 +207,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
this.guildStatus = new AtomicInteger(0);
|
this.guildStatus = new AtomicInteger(0);
|
||||||
this.bindBuildingID = -1;
|
this.bindBuildingID = -1;
|
||||||
|
|
||||||
|
this.playerBounds = Bounds.borrow();
|
||||||
|
playerBounds.setBounds(this.getLoc());
|
||||||
|
this.playerBounds.setBounds(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,11 +274,40 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
this.hash = rs.getString("hash");
|
this.hash = rs.getString("hash");
|
||||||
|
|
||||||
|
this.playerBounds = Bounds.borrow();
|
||||||
|
playerBounds.setBounds(this.getLoc());
|
||||||
|
this.playerBounds.setBounds(this);
|
||||||
|
|
||||||
|
|
||||||
// For debugging skills
|
// For debugging skills
|
||||||
// CharacterSkill.printSkills(this);
|
// CharacterSkill.printSkills(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateBounds() {
|
||||||
|
this.playerBounds.setBounds(this);
|
||||||
|
this.checkCollisionsWithOtherPlayers();
|
||||||
|
// This is a test to see if it will push to the docker container
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkCollisionsWithOtherPlayers() {
|
||||||
|
HashSet<AbstractWorldObject> nearbyObjects = WorldGrid.getObjectsInRangePartial(this, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||||
|
for (AbstractWorldObject obj : nearbyObjects) {
|
||||||
|
if (obj instanceof PlayerCharacter && obj != this) {
|
||||||
|
PlayerCharacter otherPlayer = (PlayerCharacter) obj;
|
||||||
|
if (Bounds.collide(this.getBounds(), otherPlayer.getBounds(), 0.1f)) {
|
||||||
|
// Handle collision with other player
|
||||||
|
handleCollisionWithPlayer(otherPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCollisionWithPlayer(PlayerCharacter otherPlayer) {
|
||||||
|
// Implement collision response here
|
||||||
|
System.out.println("Collision detected with player: " + otherPlayer.getFirstName());
|
||||||
|
ChatManager.chatSystemInfo(otherPlayer, "Has Collided with YOU");
|
||||||
|
}
|
||||||
|
|
||||||
public static Building getUpdatedBindBuilding(PlayerCharacter player) {
|
public static Building getUpdatedBindBuilding(PlayerCharacter player) {
|
||||||
Building returnBuilding = null;
|
Building returnBuilding = null;
|
||||||
|
|
||||||
@@ -4882,6 +4916,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
@Override
|
@Override
|
||||||
public void updateLocation() {
|
public void updateLocation() {
|
||||||
|
|
||||||
|
this.updateBounds();
|
||||||
|
|
||||||
if (!this.isMoving())
|
if (!this.isMoving())
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user