diff --git a/src/main/java/cactusServer/entities/Instance.java b/src/main/java/cactusServer/entities/Instance.java index 3688f12..51cad77 100644 --- a/src/main/java/cactusServer/entities/Instance.java +++ b/src/main/java/cactusServer/entities/Instance.java @@ -183,6 +183,26 @@ setState(state); return this; } + + public Character updateCharacter(String characterId, Position3D position, Quaternion3D angle, int modelID) { + Character character = characterMap.get(characterId); + if (character != null) { + character.update(position, angle, modelID); + } + return character; + } + + public Bullet updateBullet(String playerId, String bulletId, Position3D position, Quaternion3D angle) { + HashMap map = bulletMap.get(playerId); + if (map != null) { + Bullet bullet = map.get(bulletId); + if (bullet != null) { + bullet.update(position, angle); + } + return bullet; + } + return null; + } public Character destroyCharacter(String characterId) { return characterMap.remove(characterId); @@ -195,6 +215,16 @@ public Object destroyObject(String objId) { return objMap.remove(objId); } + + public Bullet destroyBullet(String playerId, String bulletId) { + HashMap map = bulletMap.get(playerId); + if (map != null) { + Bullet removedBullet = map.remove(bulletId); + universe.displace(removedBullet.getPlaceable()); + return removedBullet; + } + return null; + } public static enum State { AVAILABLE, MAINTENANCE;