move clientSceneWrapper to clientState
This commit is contained in:
parent
9edae4055c
commit
295c94f392
@ -1805,6 +1805,7 @@ Create ClientState global
|
|||||||
Properly reset ClientState
|
Properly reset ClientState
|
||||||
Move clientWorldData to clientState
|
Move clientWorldData to clientState
|
||||||
Move clientScene to clientState
|
Move clientScene to clientState
|
||||||
|
Move clientSceneWrapper to clientState
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package electrosphere.client;
|
package electrosphere.client;
|
||||||
|
|
||||||
|
import electrosphere.client.scene.ClientSceneWrapper;
|
||||||
import electrosphere.client.scene.ClientWorldData;
|
import electrosphere.client.scene.ClientWorldData;
|
||||||
import electrosphere.entity.scene.Scene;
|
import electrosphere.entity.scene.Scene;
|
||||||
|
|
||||||
@ -18,4 +19,9 @@ public class ClientState {
|
|||||||
*/
|
*/
|
||||||
public Scene clientScene;
|
public Scene clientScene;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client scene wrapper
|
||||||
|
*/
|
||||||
|
public ClientSceneWrapper clientSceneWrapper;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class CameraEntityUtils {
|
|||||||
public static void initCamera(){
|
public static void initCamera(){
|
||||||
//destroy if it already exists
|
//destroy if it already exists
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.playerCamera != null){
|
||||||
Globals.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
|
||||||
}
|
}
|
||||||
//create
|
//create
|
||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class DebugVisualizerUtils {
|
|||||||
callback.accept(rVal);
|
callback.accept(rVal);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(updateTree);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(updateTree);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class ParticleUtils {
|
|||||||
// ClientParticleTree particleTree = new ClientParticleTree(rVal, 10, new Vector3f(0,0,0), 0, 0, false);
|
// ClientParticleTree particleTree = new ClientParticleTree(rVal, 10, new Vector3f(0,0,0), 0, 0, false);
|
||||||
// rVal.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, particleTree);
|
// rVal.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, particleTree);
|
||||||
// rVal.putData(EntityDataStrings.IS_PARTICLE, true);
|
// rVal.putData(EntityDataStrings.IS_PARTICLE, true);
|
||||||
// Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
|
// Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
|
||||||
// return rVal;
|
// return rVal;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class ParticleUtils {
|
|||||||
//behavior tree attachments
|
//behavior tree attachments
|
||||||
ClientParticleTree.attachTree(rVal, data, destination);
|
ClientParticleTree.attachTree(rVal, data, destination);
|
||||||
rVal.putData(EntityDataStrings.IS_PARTICLE, true);
|
rVal.putData(EntityDataStrings.IS_PARTICLE, true);
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class FluidCell {
|
|||||||
* Destroys a drawcell including its physics
|
* Destroys a drawcell including its physics
|
||||||
*/
|
*/
|
||||||
public void destroy(){
|
public void destroy(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
if(modelEntity != null){
|
if(modelEntity != null){
|
||||||
collisionEngine.destroyPhysics(modelEntity);
|
collisionEngine.destroyPhysics(modelEntity);
|
||||||
ClientEntityUtils.destroyEntity(modelEntity);
|
ClientEntityUtils.destroyEntity(modelEntity);
|
||||||
|
|||||||
@ -55,11 +55,11 @@ public class ButtonInteraction {
|
|||||||
WindowUtils.openInteractionMenu(interactionData.getWindowTarget(), interactionData.getWindowData());
|
WindowUtils.openInteractionMenu(interactionData.getWindowTarget(), interactionData.getWindowData());
|
||||||
} break;
|
} break;
|
||||||
case InteractionData.ON_INTERACT_HARVEST: {
|
case InteractionData.ON_INTERACT_HARVEST: {
|
||||||
int serverEntityId = Globals.clientSceneWrapper.mapClientToServerId(target.getId());
|
int serverEntityId = Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId());
|
||||||
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_HARVEST));
|
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_HARVEST));
|
||||||
} break;
|
} break;
|
||||||
case InteractionData.ON_INTERACT_DOOR: {
|
case InteractionData.ON_INTERACT_DOOR: {
|
||||||
int serverEntityId = Globals.clientSceneWrapper.mapClientToServerId(target.getId());
|
int serverEntityId = Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId());
|
||||||
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_DOOR));
|
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_DOOR));
|
||||||
} break;
|
} break;
|
||||||
case InteractionData.ON_INTERACT_DIALOG: {
|
case InteractionData.ON_INTERACT_DIALOG: {
|
||||||
@ -69,7 +69,7 @@ public class ButtonInteraction {
|
|||||||
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
|
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
|
||||||
InventoryMainWindow.viewInventory(target);
|
InventoryMainWindow.viewInventory(target);
|
||||||
InventoryMainWindow.viewInventory(Globals.playerEntity);
|
InventoryMainWindow.viewInventory(Globals.playerEntity);
|
||||||
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientSceneWrapper.mapClientToServerId(target.getId())));
|
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId())));
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
throw new Error("Unhandled interaction signal " + interactionData.getOnInteract());
|
throw new Error("Unhandled interaction signal " + interactionData.getOnInteract());
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public class ClientInteractionEngine {
|
|||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCylinderBody(
|
rigidBody = CollisionBodyCreation.createCylinderBody(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension1(),
|
||||||
physicsTemplate.getDimension2(),
|
physicsTemplate.getDimension2(),
|
||||||
categoryBit
|
categoryBit
|
||||||
@ -68,7 +68,7 @@ public class ClientInteractionEngine {
|
|||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -88,13 +88,13 @@ public class ClientInteractionEngine {
|
|||||||
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
||||||
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
} break;
|
} break;
|
||||||
case "CUBE": {
|
case "CUBE": {
|
||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCubeBody(
|
rigidBody = CollisionBodyCreation.createCubeBody(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
||||||
categoryBit
|
categoryBit
|
||||||
);
|
);
|
||||||
@ -102,7 +102,7 @@ public class ClientInteractionEngine {
|
|||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -123,13 +123,13 @@ public class ClientInteractionEngine {
|
|||||||
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
||||||
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
} break;
|
} break;
|
||||||
case "CAPSULE": {
|
case "CAPSULE": {
|
||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCapsuleBody(
|
rigidBody = CollisionBodyCreation.createCapsuleBody(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
physicsTemplate.getDimension2(),
|
physicsTemplate.getDimension2(),
|
||||||
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
|
||||||
categoryBit
|
categoryBit
|
||||||
@ -138,7 +138,7 @@ public class ClientInteractionEngine {
|
|||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getInteractionEngine(),
|
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -159,7 +159,7 @@ public class ClientInteractionEngine {
|
|||||||
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
|
||||||
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
throw new Error("Unsupported shape type! " + physicsTemplate.getType());
|
throw new Error("Unsupported shape type! " + physicsTemplate.getType());
|
||||||
@ -174,7 +174,7 @@ public class ClientInteractionEngine {
|
|||||||
*/
|
*/
|
||||||
public static void destroyCollidableTemplate(Entity rVal){
|
public static void destroyCollidableTemplate(Entity rVal){
|
||||||
lock.lock();
|
lock.lock();
|
||||||
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
|
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
|
||||||
DBody body = null;
|
DBody body = null;
|
||||||
Collidable collidable = null;
|
Collidable collidable = null;
|
||||||
if(rVal.containsKey(EntityDataStrings.INTERACTION_BODY)){
|
if(rVal.containsKey(EntityDataStrings.INTERACTION_BODY)){
|
||||||
@ -198,7 +198,7 @@ public class ClientInteractionEngine {
|
|||||||
*/
|
*/
|
||||||
private static void updateInteractableTransforms(){
|
private static void updateInteractableTransforms(){
|
||||||
lock.lock();
|
lock.lock();
|
||||||
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
|
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
|
||||||
for(Entity entity : interactables){
|
for(Entity entity : interactables){
|
||||||
if(entity != null){
|
if(entity != null){
|
||||||
Vector3d entityPosition = EntityUtils.getPosition(entity);
|
Vector3d entityPosition = EntityUtils.getPosition(entity);
|
||||||
@ -216,7 +216,7 @@ public class ClientInteractionEngine {
|
|||||||
*/
|
*/
|
||||||
public static Entity rayCast(Vector3d centerPos, Vector3d eyePos){
|
public static Entity rayCast(Vector3d centerPos, Vector3d eyePos){
|
||||||
lock.lock();
|
lock.lock();
|
||||||
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
|
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
|
||||||
//update position of all interactables
|
//update position of all interactables
|
||||||
ClientInteractionEngine.updateInteractableTransforms();
|
ClientInteractionEngine.updateInteractableTransforms();
|
||||||
//ray cast
|
//ray cast
|
||||||
@ -244,7 +244,7 @@ public class ClientInteractionEngine {
|
|||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
if(!set){
|
if(!set){
|
||||||
target = Globals.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
target = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(target != null){
|
if(target != null){
|
||||||
EntityType type = CommonEntityUtils.getEntityType(target);
|
EntityType type = CommonEntityUtils.getEntityType(target);
|
||||||
if(type == null){
|
if(type == null){
|
||||||
@ -270,7 +270,7 @@ public class ClientInteractionEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!set){
|
if(!set){
|
||||||
Vector3d collisionPosition = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d collisionPosition = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(
|
if(
|
||||||
collisionPosition != null &&
|
collisionPosition != null &&
|
||||||
collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
|
collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
|
||||||
@ -353,7 +353,7 @@ public class ClientInteractionEngine {
|
|||||||
*/
|
*/
|
||||||
public static int getCollidablesCount(){
|
public static int getCollidablesCount(){
|
||||||
lock.lock();
|
lock.lock();
|
||||||
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
|
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
|
||||||
int rVal = interactionEngine.getCollidables().size();
|
int rVal = interactionEngine.getCollidables().size();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
return rVal;
|
return rVal;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -115,7 +115,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -140,7 +140,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -173,7 +173,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -225,7 +225,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -277,7 +277,7 @@ public class ItemActions {
|
|||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
}
|
}
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
*/
|
*/
|
||||||
@Export
|
@Export
|
||||||
public static void applyEdit(){
|
public static void applyEdit(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
@ -66,7 +66,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
*/
|
*/
|
||||||
@Export
|
@Export
|
||||||
public static void spawnWater(){
|
public static void spawnWater(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
@ -102,7 +102,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
*/
|
*/
|
||||||
@Export
|
@Export
|
||||||
public static void dig(){
|
public static void dig(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
|
|||||||
@ -57,13 +57,13 @@ public class ClientSimulation {
|
|||||||
//
|
//
|
||||||
//simulate bullet physics engine step
|
//simulate bullet physics engine step
|
||||||
if(Globals.RUN_PHYSICS){
|
if(Globals.RUN_PHYSICS){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().updateDynamicObjectTransforms();
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().updateDynamicObjectTransforms();
|
||||||
}
|
}
|
||||||
|
|
||||||
//update actor animations
|
//update actor animations
|
||||||
Globals.profiler.beginCpuSample("update actor animations");
|
Globals.profiler.beginCpuSample("update actor animations");
|
||||||
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
|
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
if(currentActor.isPlayingAnimation()){
|
if(currentActor.isPlayingAnimation()){
|
||||||
currentActor.incrementAnimationTime((float)Globals.timekeeper.getSimFrameTime());
|
currentActor.incrementAnimationTime((float)Globals.timekeeper.getSimFrameTime());
|
||||||
@ -73,7 +73,7 @@ public class ClientSimulation {
|
|||||||
//
|
//
|
||||||
//make items play idle animation
|
//make items play idle animation
|
||||||
Globals.profiler.beginCpuSample("item animations");
|
Globals.profiler.beginCpuSample("item animations");
|
||||||
for(Entity item : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM)){
|
for(Entity item : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM)){
|
||||||
ItemUtils.updateItemActorAnimation(item);
|
ItemUtils.updateItemActorAnimation(item);
|
||||||
}
|
}
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
@ -84,7 +84,7 @@ public class ClientSimulation {
|
|||||||
//
|
//
|
||||||
//Hitbox stuff
|
//Hitbox stuff
|
||||||
Globals.profiler.beginCpuSample("update hitboxes");
|
Globals.profiler.beginCpuSample("update hitboxes");
|
||||||
Globals.clientSceneWrapper.getHitboxManager().simulate();
|
Globals.clientState.clientSceneWrapper.getHitboxManager().simulate();
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
//
|
//
|
||||||
//update foliage
|
//update foliage
|
||||||
@ -99,17 +99,17 @@ public class ClientSimulation {
|
|||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
//
|
//
|
||||||
//simulate behavior trees
|
//simulate behavior trees
|
||||||
Globals.clientSceneWrapper.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime());
|
Globals.clientState.clientSceneWrapper.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime());
|
||||||
//
|
//
|
||||||
//sum collidable impulses
|
//sum collidable impulses
|
||||||
Globals.profiler.beginCpuSample("collidable logic");
|
Globals.profiler.beginCpuSample("collidable logic");
|
||||||
for(Entity collidable : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
|
for(Entity collidable : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
|
||||||
ClientCollidableTree.getClientCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());
|
ClientCollidableTree.getClientCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//clear collidable impulse lists
|
//clear collidable impulse lists
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().clearCollidableImpulseLists();
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().clearCollidableImpulseLists();
|
||||||
Globals.clientSceneWrapper.getChemistryEngine().clearCollidableImpulseLists();
|
Globals.clientState.clientSceneWrapper.getChemistryEngine().clearCollidableImpulseLists();
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -127,7 +127,7 @@ public class ClientSimulation {
|
|||||||
ClientTerrainManager.generateTerrainChunkGeometry();
|
ClientTerrainManager.generateTerrainChunkGeometry();
|
||||||
ClientFluidManager.generateFluidChunkGeometry();
|
ClientFluidManager.generateFluidChunkGeometry();
|
||||||
this.updateSkyboxPos();
|
this.updateSkyboxPos();
|
||||||
Globals.clientSceneWrapper.destroyEntitiesOutsideSimRange();
|
Globals.clientState.clientSceneWrapper.destroyEntitiesOutsideSimRange();
|
||||||
InstanceUpdater.updateInstancedActorPriority();
|
InstanceUpdater.updateInstancedActorPriority();
|
||||||
Globals.cameraHandler.updateGlobalCamera();
|
Globals.cameraHandler.updateGlobalCamera();
|
||||||
this.updateFirstPersonAttachments();
|
this.updateFirstPersonAttachments();
|
||||||
|
|||||||
@ -306,15 +306,15 @@ public class FoliageModel {
|
|||||||
float heightMultiplier = foliageType.getGrassData().getMaxHeight() - foliageType.getGrassData().getMinHeight();
|
float heightMultiplier = foliageType.getGrassData().getMaxHeight() - foliageType.getGrassData().getMinHeight();
|
||||||
|
|
||||||
//construct simple grid to place foliage on
|
//construct simple grid to place foliage on
|
||||||
// Vector3d sample_00 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_00 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_01 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_01 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_02 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_02 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_10 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_10 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_11 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_11 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_12 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_12 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_20 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_20 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_21 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_21 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
// Vector3d sample_22 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
// Vector3d sample_22 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
|
||||||
|
|
||||||
boolean sample_11 = true;
|
boolean sample_11 = true;
|
||||||
boolean sample_12 = true;
|
boolean sample_12 = true;
|
||||||
|
|||||||
@ -135,10 +135,10 @@ public class NaturalInventoryPanel {
|
|||||||
panel = ItemIconPanel.createEmptyItemPanel(() -> {
|
panel = ItemIconPanel.createEmptyItemPanel(() -> {
|
||||||
if(Globals.draggedItem != null){
|
if(Globals.draggedItem != null){
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
|
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(entity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(entity.getId()),
|
||||||
InventoryProtocol.INVENTORY_TYPE_NATURAL,
|
InventoryProtocol.INVENTORY_TYPE_NATURAL,
|
||||||
0 + "",
|
0 + "",
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
|
||||||
);
|
);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,10 +146,10 @@ public class ToolbarInventoryPanel {
|
|||||||
int slotId = i;
|
int slotId = i;
|
||||||
panel = ItemIconPanel.createEmptyItemPanel(() -> {
|
panel = ItemIconPanel.createEmptyItemPanel(() -> {
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
|
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(entity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(entity.getId()),
|
||||||
InventoryProtocol.INVENTORY_TYPE_TOOLBAR,
|
InventoryProtocol.INVENTORY_TYPE_TOOLBAR,
|
||||||
slotId + "",
|
slotId + "",
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
|
||||||
);
|
);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class ImGuiPlayerEntity {
|
|||||||
ImGui.sameLine();
|
ImGui.sameLine();
|
||||||
|
|
||||||
if(ImGui.button("Server Details")){
|
if(ImGui.button("Server Details")){
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
ImGuiEntityMacros.showEntity(serverPlayerEntity);
|
ImGuiEntityMacros.showEntity(serverPlayerEntity);
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public class ImGuiPlayerEntity {
|
|||||||
*/
|
*/
|
||||||
private static void drawSynchronizationData(){
|
private static void drawSynchronizationData(){
|
||||||
//server pos
|
//server pos
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
if(serverPlayerEntity != null){
|
if(serverPlayerEntity != null){
|
||||||
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));
|
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public class ImGuiEntityMacros {
|
|||||||
if(ImGui.checkbox("Filter to Terrain", filterToTerrain)){
|
if(ImGui.checkbox("Filter to Terrain", filterToTerrain)){
|
||||||
filterToTerrain = !filterToTerrain;
|
filterToTerrain = !filterToTerrain;
|
||||||
}
|
}
|
||||||
for(Entity entity : Globals.clientSceneWrapper.getScene().getEntityList()){
|
for(Entity entity : Globals.clientState.clientSceneWrapper.getScene().getEntityList()){
|
||||||
//filters
|
//filters
|
||||||
if(filterToCreatures && !CreatureUtils.isCreature(entity)){
|
if(filterToCreatures && !CreatureUtils.isCreature(entity)){
|
||||||
continue;
|
continue;
|
||||||
@ -191,7 +191,7 @@ public class ImGuiEntityMacros {
|
|||||||
AttachUtils.getParent(detailViewEntity) != null ||
|
AttachUtils.getParent(detailViewEntity) != null ||
|
||||||
detailViewEntity == Globals.firstPersonEntity ||
|
detailViewEntity == Globals.firstPersonEntity ||
|
||||||
detailViewEntity == Globals.playerEntity ||
|
detailViewEntity == Globals.playerEntity ||
|
||||||
Globals.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
||||||
) &&
|
) &&
|
||||||
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
|
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
|
||||||
){
|
){
|
||||||
@ -371,7 +371,7 @@ public class ImGuiEntityMacros {
|
|||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.playerEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.playerEntity));
|
||||||
});
|
});
|
||||||
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
|
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
|
||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
|
||||||
@ -518,19 +518,19 @@ public class ImGuiEntityMacros {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())){
|
if(Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())){
|
||||||
//detailViewEntity is a client entity
|
//detailViewEntity is a client entity
|
||||||
//get server entity
|
//get server entity
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
|
||||||
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
if(serverEntity != null && ImGui.button("Server Entity")){
|
if(serverEntity != null && ImGui.button("Server Entity")){
|
||||||
ImGuiEntityMacros.showEntity(serverEntity);
|
ImGuiEntityMacros.showEntity(serverEntity);
|
||||||
}
|
}
|
||||||
} else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
} else if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
||||||
//detailViewEntity is a server entity
|
//detailViewEntity is a server entity
|
||||||
//get client entity
|
//get client entity
|
||||||
int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
|
int clientId = Globals.clientState.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
|
||||||
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId);
|
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(clientId);
|
||||||
if(clientEntity != null && ImGui.button("Client Entity")){
|
if(clientEntity != null && ImGui.button("Client Entity")){
|
||||||
ImGuiEntityMacros.showEntity(clientEntity);
|
ImGuiEntityMacros.showEntity(clientEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class ImGuiEntityDebugActions {
|
|||||||
if(detailViewEntity != null){
|
if(detailViewEntity != null){
|
||||||
|
|
||||||
if(ImGui.button("Teleport to player")){
|
if(ImGui.button("Teleport to player")){
|
||||||
if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
||||||
ServerEntityUtils.repositionEntity(detailViewEntity, EntityUtils.getPosition(Globals.playerEntity));
|
ServerEntityUtils.repositionEntity(detailViewEntity, EntityUtils.getPosition(Globals.playerEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,12 +40,12 @@ public class ImGuiEntityPhysicsTab {
|
|||||||
}
|
}
|
||||||
//synchronized data
|
//synchronized data
|
||||||
if(
|
if(
|
||||||
Globals.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null &&
|
Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null &&
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId()) != -1
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId()) != -1
|
||||||
){
|
){
|
||||||
//detailViewEntity is a client entity
|
//detailViewEntity is a client entity
|
||||||
//get server entity
|
//get server entity
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
|
||||||
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
DBody serverPhysicsBody = PhysicsEntityUtils.getDBody(serverEntity);
|
DBody serverPhysicsBody = PhysicsEntityUtils.getDBody(serverEntity);
|
||||||
if(serverPhysicsBody != null){
|
if(serverPhysicsBody != null){
|
||||||
@ -62,11 +62,11 @@ public class ImGuiEntityPhysicsTab {
|
|||||||
ImGui.text("Enabled: " + serverPhysicsBody.isEnabled());
|
ImGui.text("Enabled: " + serverPhysicsBody.isEnabled());
|
||||||
ImGui.text("Kinematic: " + serverPhysicsBody.isKinematic());
|
ImGui.text("Kinematic: " + serverPhysicsBody.isKinematic());
|
||||||
}
|
}
|
||||||
} else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
} else if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
||||||
//detailViewEntity is a server entity
|
//detailViewEntity is a server entity
|
||||||
//get client entity
|
//get client entity
|
||||||
int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
|
int clientId = Globals.clientState.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
|
||||||
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId);
|
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(clientId);
|
||||||
DBody clientPhysicsBody = PhysicsEntityUtils.getDBody(clientEntity);
|
DBody clientPhysicsBody = PhysicsEntityUtils.getDBody(clientEntity);
|
||||||
if(clientPhysicsBody != null){
|
if(clientPhysicsBody != null){
|
||||||
ImGui.newLine();
|
ImGui.newLine();
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ImGuiAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui.collapsingHeader("Debug Player AI")){
|
if(ImGui.collapsingHeader("Debug Player AI")){
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
AI playerAi = AI.getAI(serverPlayerEntity);
|
AI playerAi = AI.getAI(serverPlayerEntity);
|
||||||
Vector3d playerTargetPos = null;
|
Vector3d playerTargetPos = null;
|
||||||
|
|||||||
@ -59,14 +59,14 @@ public class CraftingWindow {
|
|||||||
(RecipeData recipe) -> {
|
(RecipeData recipe) -> {
|
||||||
if(Globals.interactionTarget != null){
|
if(Globals.interactionTarget != null){
|
||||||
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.interactionTarget.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.interactionTarget.getId()),
|
||||||
recipe.getId()
|
recipe.getId()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
||||||
recipe.getId()
|
recipe.getId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
CreatureUtils.serverSpawnBasicCreature(realm, cursorPos, data.getId(), null);
|
CreatureUtils.serverSpawnBasicCreature(realm, cursorPos, data.getId(), null);
|
||||||
}));
|
}));
|
||||||
@ -202,7 +202,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -235,7 +235,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, data.getId());
|
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, data.getId());
|
||||||
}));
|
}));
|
||||||
@ -264,7 +264,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
ItemUtils.serverSpawnBasicItem(realm, cursorPos, item.getId());
|
ItemUtils.serverSpawnBasicItem(realm, cursorPos, item.getId());
|
||||||
}));
|
}));
|
||||||
@ -294,7 +294,7 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
CommonEntityUtils.serverSpawnBasicObject(realm, cursorPos, object.getId());
|
CommonEntityUtils.serverSpawnBasicObject(realm, cursorPos, object.getId());
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -49,7 +49,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -61,7 +61,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -73,7 +73,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
@ -91,7 +91,7 @@ public class ScriptLevelEditorUtils {
|
|||||||
public static void inspectEntity(){
|
public static void inspectEntity(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Entity target = clientCollisionEngine.rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Entity target = clientCollisionEngine.rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
//show detail view here
|
//show detail view here
|
||||||
if(target != null){
|
if(target != null){
|
||||||
|
|||||||
@ -74,14 +74,14 @@ public class PhysicsEntityUtils {
|
|||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCylinderBody(
|
rigidBody = CollisionBodyCreation.createCylinderBody(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension1(),
|
||||||
physicsTemplate.getDimension2(),
|
physicsTemplate.getDimension2(),
|
||||||
categoryBit
|
categoryBit
|
||||||
);
|
);
|
||||||
if(physicsTemplate.getMass() != null){
|
if(physicsTemplate.getMass() != null){
|
||||||
CollisionBodyCreation.setCylinderMass(
|
CollisionBodyCreation.setCylinderMass(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
mass,
|
mass,
|
||||||
physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension1(),
|
||||||
@ -90,12 +90,12 @@ public class PhysicsEntityUtils {
|
|||||||
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
||||||
|
|
||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -119,10 +119,10 @@ public class PhysicsEntityUtils {
|
|||||||
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW() //rotate
|
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW() //rotate
|
||||||
);
|
);
|
||||||
if(physicsTemplate.isAngularlyStatic()){
|
if(physicsTemplate.isAngularlyStatic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -132,20 +132,20 @@ public class PhysicsEntityUtils {
|
|||||||
|
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||||
} break;
|
} break;
|
||||||
case "CUBE": {
|
case "CUBE": {
|
||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCubeBody(
|
rigidBody = CollisionBodyCreation.createCubeBody(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
||||||
categoryBit
|
categoryBit
|
||||||
);
|
);
|
||||||
if(physicsTemplate.getMass() != null){
|
if(physicsTemplate.getMass() != null){
|
||||||
CollisionBodyCreation.setBoxMass(
|
CollisionBodyCreation.setBoxMass(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
mass,
|
mass,
|
||||||
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
|
||||||
@ -153,12 +153,12 @@ public class PhysicsEntityUtils {
|
|||||||
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
||||||
|
|
||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -183,10 +183,10 @@ public class PhysicsEntityUtils {
|
|||||||
1, 1, 1 //scale
|
1, 1, 1 //scale
|
||||||
);
|
);
|
||||||
if(physicsTemplate.isAngularlyStatic()){
|
if(physicsTemplate.isAngularlyStatic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -196,21 +196,21 @@ public class PhysicsEntityUtils {
|
|||||||
|
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||||
} break;
|
} break;
|
||||||
case "CAPSULE": {
|
case "CAPSULE": {
|
||||||
//
|
//
|
||||||
//create dbody
|
//create dbody
|
||||||
rigidBody = CollisionBodyCreation.createCapsuleBody(
|
rigidBody = CollisionBodyCreation.createCapsuleBody(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
physicsTemplate.getDimension2(),
|
physicsTemplate.getDimension2(),
|
||||||
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
|
||||||
categoryBit
|
categoryBit
|
||||||
);
|
);
|
||||||
if(physicsTemplate.getMass() != null){
|
if(physicsTemplate.getMass() != null){
|
||||||
CollisionBodyCreation.setCapsuleMass(
|
CollisionBodyCreation.setCapsuleMass(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
mass,
|
mass,
|
||||||
physicsTemplate.getDimension1(),
|
physicsTemplate.getDimension1(),
|
||||||
@ -219,12 +219,12 @@ public class PhysicsEntityUtils {
|
|||||||
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
||||||
|
|
||||||
//
|
//
|
||||||
//set offset from center of entity position
|
//set offset from center of entity position
|
||||||
CollisionBodyCreation.setOffsetPosition(
|
CollisionBodyCreation.setOffsetPosition(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
rigidBody,
|
rigidBody,
|
||||||
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
|
||||||
);
|
);
|
||||||
@ -249,10 +249,10 @@ public class PhysicsEntityUtils {
|
|||||||
1, 1, 1 //scale
|
1, 1, 1 //scale
|
||||||
);
|
);
|
||||||
if(physicsTemplate.isAngularlyStatic()){
|
if(physicsTemplate.isAngularlyStatic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -262,7 +262,7 @@ public class PhysicsEntityUtils {
|
|||||||
|
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ public class PhysicsEntityUtils {
|
|||||||
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -409,7 +409,7 @@ public class PhysicsEntityUtils {
|
|||||||
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -475,7 +475,7 @@ public class PhysicsEntityUtils {
|
|||||||
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
|
||||||
}
|
}
|
||||||
if(physicsTemplate.getKinematic()){
|
if(physicsTemplate.getKinematic()){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
|
||||||
rigidBody.disable();
|
rigidBody.disable();
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
|
||||||
@ -503,10 +503,10 @@ public class PhysicsEntityUtils {
|
|||||||
* @return The rigid body created (note, attachment has already been performed)
|
* @return The rigid body created (note, attachment has already been performed)
|
||||||
*/
|
*/
|
||||||
public static void clientAttachTriGeomRigidBody(Entity terrain, TriGeomData data){
|
public static void clientAttachTriGeomRigidBody(Entity terrain, TriGeomData data){
|
||||||
DBody terrainBody = CollisionBodyCreation.generateBodyFromTerrainData(Globals.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
|
DBody terrainBody = CollisionBodyCreation.generateBodyFromTerrainData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
|
||||||
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
||||||
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
|
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
|
||||||
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
||||||
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
||||||
}
|
}
|
||||||
@ -518,10 +518,10 @@ public class PhysicsEntityUtils {
|
|||||||
* @return The rigid body created (note, attachment has already been performed)
|
* @return The rigid body created (note, attachment has already been performed)
|
||||||
*/
|
*/
|
||||||
public static void clientAttachMultiShapeTriGeomRigidBody(Entity terrain, MultiShapeTriGeomData data){
|
public static void clientAttachMultiShapeTriGeomRigidBody(Entity terrain, MultiShapeTriGeomData data){
|
||||||
DBody terrainBody = CollisionBodyCreation.generateBodyFromMultiShapeMeshData(Globals.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
|
DBody terrainBody = CollisionBodyCreation.generateBodyFromMultiShapeMeshData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
|
||||||
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
|
||||||
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
|
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
|
||||||
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
||||||
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ public class CameraHandler {
|
|||||||
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.playerEntity != null){
|
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.playerEntity != null){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructupdateEntityViewDirMessage(
|
EntityMessage.constructupdateEntityViewDirMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
perspectiveVal,
|
perspectiveVal,
|
||||||
yaw,
|
yaw,
|
||||||
|
|||||||
@ -140,7 +140,7 @@ public class CursorState {
|
|||||||
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
|
||||||
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
|
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's block cursor
|
//player's block cursor
|
||||||
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -149,7 +149,7 @@ public class CursorState {
|
|||||||
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
|
||||||
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's area cursor
|
//player's area cursor
|
||||||
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -158,7 +158,7 @@ public class CursorState {
|
|||||||
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
|
||||||
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's fab cursor
|
//player's fab cursor
|
||||||
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -166,7 +166,7 @@ public class CursorState {
|
|||||||
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
|
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
|
||||||
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(playerFabCursor);
|
DrawableUtils.makeEntityTransparent(playerFabCursor);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's grid-aligned cursor
|
//player's grid-aligned cursor
|
||||||
playerGridAlignedCursor = EntityCreationUtils.createClientSpatialEntity();
|
playerGridAlignedCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -174,14 +174,14 @@ public class CursorState {
|
|||||||
Actor gridAlignedCursorActor = EntityUtils.getActor(playerGridAlignedCursor);
|
Actor gridAlignedCursorActor = EntityUtils.getActor(playerGridAlignedCursor);
|
||||||
gridAlignedCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
gridAlignedCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(playerGridAlignedCursor);
|
DrawableUtils.makeEntityTransparent(playerGridAlignedCursor);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerGridAlignedCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(playerGridAlignedCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the position of the player's in world cursor
|
* Updates the position of the player's in world cursor
|
||||||
*/
|
*/
|
||||||
public void updatePlayerCursor(){
|
public void updatePlayerCursor(){
|
||||||
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
@ -216,7 +216,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void makeRealVisible(){
|
public static void makeRealVisible(){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +226,7 @@ public class CursorState {
|
|||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
||||||
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,7 +234,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void makeAreaVisible(){
|
public static void makeAreaVisible(){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,7 +243,7 @@ public class CursorState {
|
|||||||
public static void makeFabVisible(){
|
public static void makeFabVisible(){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.cursorState.setClampToExistingBlock(false);
|
Globals.cursorState.setClampToExistingBlock(false);
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
||||||
Globals.cursorState.fabCursorRotation = 0;
|
Globals.cursorState.fabCursorRotation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ public class CursorState {
|
|||||||
public static void makeGridAlignedVisible(String modelPath){
|
public static void makeGridAlignedVisible(String modelPath){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.cursorState.setClampToExistingBlock(true);
|
Globals.cursorState.setClampToExistingBlock(true);
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
||||||
EntityCreationUtils.makeEntityDrawable(playerGridAlignedCursor, modelPath);
|
EntityCreationUtils.makeEntityDrawable(playerGridAlignedCursor, modelPath);
|
||||||
Globals.cursorState.fabCursorRotation = 0;
|
Globals.cursorState.fabCursorRotation = 0;
|
||||||
}
|
}
|
||||||
@ -262,11 +262,11 @@ public class CursorState {
|
|||||||
* Hides the cursor
|
* Hides the cursor
|
||||||
*/
|
*/
|
||||||
public static void hide(){
|
public static void hide(){
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -557,7 +557,7 @@ public class CursorState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(clearBlockCursor){
|
if(clearBlockCursor){
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,9 +567,9 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public void hintShowBlockCursor(){
|
public void hintShowBlockCursor(){
|
||||||
if(
|
if(
|
||||||
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
|
||||||
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor) &&
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor) &&
|
||||||
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)
|
||||||
){
|
){
|
||||||
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
||||||
}
|
}
|
||||||
@ -604,19 +604,19 @@ public class CursorState {
|
|||||||
* @return The position if a cursor is visible, null otherwise
|
* @return The position if a cursor is visible, null otherwise
|
||||||
*/
|
*/
|
||||||
public Vector3d getCursorPosition(){
|
public Vector3d getCursorPosition(){
|
||||||
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerCursor);
|
return EntityUtils.getPosition(Globals.playerCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerBlockCursor);
|
return EntityUtils.getPosition(Globals.playerBlockCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerAreaCursor);
|
return EntityUtils.getPosition(Globals.playerAreaCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
|
||||||
return EntityUtils.getPosition(CursorState.playerFabCursor);
|
return EntityUtils.getPosition(CursorState.playerFabCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerGridAlignedCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerGridAlignedCursor)){
|
||||||
return EntityUtils.getPosition(CursorState.playerGridAlignedCursor);
|
return EntityUtils.getPosition(CursorState.playerGridAlignedCursor);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -338,7 +338,6 @@ public class Globals {
|
|||||||
public static MainThreadSignalService mainThreadSignalService;
|
public static MainThreadSignalService mainThreadSignalService;
|
||||||
|
|
||||||
//client scene management
|
//client scene management
|
||||||
public static ClientSceneWrapper clientSceneWrapper;
|
|
||||||
public static ClientSimulation clientSimulation;
|
public static ClientSimulation clientSimulation;
|
||||||
public static ClientSynchronizationManager clientSynchronizationManager;
|
public static ClientSynchronizationManager clientSynchronizationManager;
|
||||||
|
|
||||||
@ -506,7 +505,7 @@ public class Globals {
|
|||||||
shaderOptionMap.debug();
|
shaderOptionMap.debug();
|
||||||
//client scene wrapper
|
//client scene wrapper
|
||||||
Globals.clientState.clientScene = new Scene();
|
Globals.clientState.clientScene = new Scene();
|
||||||
clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||||
//temporary hold for skybox colors
|
//temporary hold for skybox colors
|
||||||
skyboxColors = new ArrayList<Vector3f>();
|
skyboxColors = new ArrayList<Vector3f>();
|
||||||
//load asset manager
|
//load asset manager
|
||||||
@ -724,7 +723,7 @@ public class Globals {
|
|||||||
Globals.clientPlayer = null;
|
Globals.clientPlayer = null;
|
||||||
Globals.playerManager = new PlayerManager();
|
Globals.playerManager = new PlayerManager();
|
||||||
Globals.clientState.clientScene = new Scene();
|
Globals.clientState.clientScene = new Scene();
|
||||||
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||||
Globals.clientState = new ClientState();
|
Globals.clientState = new ClientState();
|
||||||
Globals.clientSynchronizationManager = new ClientSynchronizationManager();
|
Globals.clientSynchronizationManager = new ClientSynchronizationManager();
|
||||||
Globals.server = null;
|
Globals.server = null;
|
||||||
@ -752,7 +751,6 @@ public class Globals {
|
|||||||
Globals.assetManager = null;
|
Globals.assetManager = null;
|
||||||
Globals.elementService = null;
|
Globals.elementService = null;
|
||||||
Globals.realmManager = null;
|
Globals.realmManager = null;
|
||||||
Globals.clientSceneWrapper = null;
|
|
||||||
Globals.clientState = null;
|
Globals.clientState = null;
|
||||||
Globals.audioEngine = null;
|
Globals.audioEngine = null;
|
||||||
Globals.renderingEngine = null;
|
Globals.renderingEngine = null;
|
||||||
|
|||||||
@ -71,11 +71,11 @@ public class ClientEntityUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(Globals.clientSceneWrapper != null){
|
if(Globals.clientState.clientSceneWrapper != null){
|
||||||
Globals.clientSceneWrapper.getScene().deregisterEntity(entity);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(entity);
|
||||||
Globals.clientSceneWrapper.deregisterTranslationMapping(entity);
|
Globals.clientState.clientSceneWrapper.deregisterTranslationMapping(entity);
|
||||||
if(Globals.clientSceneWrapper.getCollisionEngine() != null){
|
if(Globals.clientState.clientSceneWrapper.getCollisionEngine() != null){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(entity);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Globals.clientState.clientScene != null){
|
if(Globals.clientState.clientScene != null){
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class EntityCreationUtils {
|
|||||||
*/
|
*/
|
||||||
public static Entity createClientSpatialEntity(){
|
public static Entity createClientSpatialEntity(){
|
||||||
Entity rVal = EntityCreationUtils.spawnSpatialEntity();
|
Entity rVal = EntityCreationUtils.spawnSpatialEntity();
|
||||||
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class EntityCreationUtils {
|
|||||||
*/
|
*/
|
||||||
public static Entity createClientNonSpatialEntity(){
|
public static Entity createClientNonSpatialEntity(){
|
||||||
Entity rVal = new Entity();
|
Entity rVal = new Entity();
|
||||||
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,9 +34,9 @@ public class EntityUtils {
|
|||||||
*/
|
*/
|
||||||
protected static void cleanUpEntity(Entity e){
|
protected static void cleanUpEntity(Entity e){
|
||||||
//remove from client
|
//remove from client
|
||||||
if(Globals.clientSceneWrapper != null){
|
if(Globals.clientState.clientSceneWrapper != null){
|
||||||
Globals.clientSceneWrapper.getScene().deregisterEntity(e);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(e);
|
||||||
Globals.clientSceneWrapper.deregisterTranslationMapping(e);
|
Globals.clientState.clientSceneWrapper.deregisterTranslationMapping(e);
|
||||||
}
|
}
|
||||||
//remove from all server classes
|
//remove from all server classes
|
||||||
if(Globals.realmManager != null){
|
if(Globals.realmManager != null){
|
||||||
|
|||||||
@ -54,9 +54,9 @@ public class StateTransitionUtil {
|
|||||||
StateTransitionUtil rVal = new StateTransitionUtil(entity,isServer,states);
|
StateTransitionUtil rVal = new StateTransitionUtil(entity,isServer,states);
|
||||||
|
|
||||||
//error checking
|
//error checking
|
||||||
if(!isServer && Globals.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){
|
if(!isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){
|
||||||
throw new IllegalArgumentException("Tried to create state transition util with isServer=false and passed in a server entity");
|
throw new IllegalArgumentException("Tried to create state transition util with isServer=false and passed in a server entity");
|
||||||
} else if(isServer && Globals.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){
|
} else if(isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){
|
||||||
throw new IllegalArgumentException("Tried to create state transition util with isServer=true and passed in a client entity");
|
throw new IllegalArgumentException("Tried to create state transition util with isServer=true and passed in a client entity");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -173,7 +173,7 @@ public class AttachUtils {
|
|||||||
private static void clientUpdateBoneAttachments(){
|
private static void clientUpdateBoneAttachments(){
|
||||||
Globals.profiler.beginCpuSample("AttachUtils.clientUpdateBoneAttachments");
|
Globals.profiler.beginCpuSample("AttachUtils.clientUpdateBoneAttachments");
|
||||||
//update entities attached to bones of other entities
|
//update entities attached to bones of other entities
|
||||||
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.BONE_ATTACHED)){
|
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.BONE_ATTACHED)){
|
||||||
Entity parent;
|
Entity parent;
|
||||||
if(currentEntity == null){
|
if(currentEntity == null){
|
||||||
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Trying to update client bone attachment where null entity is registered!"));
|
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Trying to update client bone attachment where null entity is registered!"));
|
||||||
@ -230,7 +230,7 @@ public class AttachUtils {
|
|||||||
Entity parent;
|
Entity parent;
|
||||||
Matrix4d transform;
|
Matrix4d transform;
|
||||||
//update entities attached to centerpoint + transform of other entities
|
//update entities attached to centerpoint + transform of other entities
|
||||||
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
||||||
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
||||||
if((transform = AttachUtils.getTransformOffset(currentEntity))!=null){
|
if((transform = AttachUtils.getTransformOffset(currentEntity))!=null){
|
||||||
//parent objects
|
//parent objects
|
||||||
@ -466,7 +466,7 @@ public class AttachUtils {
|
|||||||
* @param rotation The rotation applied
|
* @param rotation The rotation applied
|
||||||
*/
|
*/
|
||||||
public static void clientAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Vector3d offset, Quaterniond rotation){
|
public static void clientAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Vector3d offset, Quaterniond rotation){
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName);
|
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName);
|
||||||
@ -493,7 +493,7 @@ public class AttachUtils {
|
|||||||
Vector3d parentPosition = EntityUtils.getPosition(parent);
|
Vector3d parentPosition = EntityUtils.getPosition(parent);
|
||||||
Vector3d childPosition = EntityUtils.getPosition(toAttach);
|
Vector3d childPosition = EntityUtils.getPosition(toAttach);
|
||||||
Vector3d offset = new Vector3d(childPosition).sub(parentPosition);
|
Vector3d offset = new Vector3d(childPosition).sub(parentPosition);
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
|
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
|
||||||
@ -514,7 +514,7 @@ public class AttachUtils {
|
|||||||
* @param transform The transform
|
* @param transform The transform
|
||||||
*/
|
*/
|
||||||
public static void clientAttachEntityAtTransform(Entity parent, Entity toAttach, Matrix4d transform){
|
public static void clientAttachEntityAtTransform(Entity parent, Entity toAttach, Matrix4d transform){
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
|
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
|
||||||
@ -614,7 +614,7 @@ public class AttachUtils {
|
|||||||
*/
|
*/
|
||||||
public static String clientDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
public static String clientDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
|
||||||
String bone = getTargetBone(toAttach);
|
String bone = getTargetBone(toAttach);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
|
||||||
toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE);
|
toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE);
|
||||||
|
|||||||
@ -636,7 +636,7 @@ public class ClientAttackTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTATTACKTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTATTACKTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,7 +202,7 @@ public class ClientBlockTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTBLOCKTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTBLOCKTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTBLOCKTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTBLOCKTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public class ClientParticleEmitterComponent implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLEEMITTERSTATE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLEEMITTERSTATE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,7 @@ public class ClientParticleTree implements BehaviorTree {
|
|||||||
lifeCurrent--;
|
lifeCurrent--;
|
||||||
if(lifeCurrent <= 0){
|
if(lifeCurrent <= 0){
|
||||||
ClientEntityUtils.destroyEntity(parent);
|
ClientEntityUtils.destroyEntity(parent);
|
||||||
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ public class ClientParticleTree implements BehaviorTree {
|
|||||||
public static ClientParticleTree attachTree(Entity parent, Object ... params){
|
public static ClientParticleTree attachTree(Entity parent, Object ... params){
|
||||||
ClientParticleTree rVal = new ClientParticleTree(parent,params);
|
ClientParticleTree rVal = new ClientParticleTree(parent,params);
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public class ClientCollidableTree implements BehaviorTree {
|
|||||||
newPosition.z = Globals.clientState.clientWorldData.getWorldBoundMin().z;
|
newPosition.z = Globals.clientState.clientWorldData.getWorldBoundMin().z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);
|
PhysicsUtils.setRigidBodyTransform(Globals.clientState.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
if(!hasEquipped && targetIsItem && itemIsInPointWhitelist){
|
if(!hasEquipped && targetIsItem && itemIsInPointWhitelist){
|
||||||
//send packet to server requesting to equip
|
//send packet to server requesting to equip
|
||||||
String pointName = point.getEquipPointId();
|
String pointName = point.getEquipPointId();
|
||||||
int serverSideID = Globals.clientSceneWrapper.mapClientToServerId(toEquip.getId());
|
int serverSideID = Globals.clientState.clientSceneWrapper.mapClientToServerId(toEquip.getId());
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestEquipItemMessage(pointName, serverSideID);
|
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestEquipItemMessage(pointName, serverSideID);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
}
|
}
|
||||||
@ -155,10 +155,10 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
//make uncollidable
|
//make uncollidable
|
||||||
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
}
|
}
|
||||||
//make untargetable
|
//make untargetable
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,9 +192,9 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
}
|
}
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
||||||
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTEQUIPSTATE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTEQUIPSTATE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEQUIPSTATE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEQUIPSTATE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
*/
|
*/
|
||||||
public void attemptAddToToolbar(Entity item, int toolbarSlot){
|
public void attemptAddToToolbar(Entity item, int toolbarSlot){
|
||||||
if(item != null){
|
if(item != null){
|
||||||
NetworkMessage requestUnequipMessage = InventoryMessage.constructclientRequestAddToolbarMessage(Globals.clientSceneWrapper.mapClientToServerId(item.getId()), toolbarSlot);
|
NetworkMessage requestUnequipMessage = InventoryMessage.constructclientRequestAddToolbarMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()), toolbarSlot);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestUnequipMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestUnequipMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,10 +140,10 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
//make uncollidable
|
//make uncollidable
|
||||||
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
}
|
}
|
||||||
//make untargetable
|
//make untargetable
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,9 +176,9 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
|
||||||
}
|
}
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
|
||||||
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
GravityUtils.clientAttemptDeactivateGravity(toEquip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,10 +269,10 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Globals.playerCursor != null){
|
if(Globals.playerCursor != null){
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
if(Globals.playerBlockCursor != null){
|
if(Globals.playerBlockCursor != null){
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//hide cursors
|
//hide cursors
|
||||||
@ -329,7 +329,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTTOOLBARSTATE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTTOOLBARSTATE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTTOOLBARSTATE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTTOOLBARSTATE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class AmbientFoliage implements BehaviorTree {
|
|||||||
public static void attachAmbientFoliageTree(Entity parent, float growthLevel, float growthRate){
|
public static void attachAmbientFoliageTree(Entity parent, float growthLevel, float growthRate){
|
||||||
AmbientFoliage tree = new AmbientFoliage(parent, growthLevel, growthRate);
|
AmbientFoliage tree = new AmbientFoliage(parent, growthLevel, growthRate);
|
||||||
parent.putData(EntityDataStrings.FOLIAGE_AMBIENT_TREE, tree);
|
parent.putData(EntityDataStrings.FOLIAGE_AMBIENT_TREE, tree);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -92,7 +92,7 @@ public class ClientDoorState implements BehaviorTree {
|
|||||||
doorData.getOpening(),
|
doorData.getOpening(),
|
||||||
() -> {
|
() -> {
|
||||||
this.setState(DoorState.OPEN);
|
this.setState(DoorState.OPEN);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(this.parent);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(this.parent);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
StateTransitionUtilItem.create(
|
StateTransitionUtilItem.create(
|
||||||
@ -133,7 +133,7 @@ public class ClientDoorState implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTDOOR, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTDOOR, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTDOOR_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTDOOR_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,7 +166,7 @@ public class ClientGravityTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTGRAVITY, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTGRAVITY, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGRAVITY_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGRAVITY_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class ClientGrowthComponent implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTGROWTH, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTGROWTH, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROWTH_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROWTH_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -631,7 +631,7 @@ public class HitboxCollectionState {
|
|||||||
engine = realm.getHitboxManager().getCollisionEngine();
|
engine = realm.getHitboxManager().getCollisionEngine();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
engine = Globals.clientSceneWrapper.getHitboxManager().getCollisionEngine();
|
engine = Globals.clientState.clientSceneWrapper.getHitboxManager().getCollisionEngine();
|
||||||
}
|
}
|
||||||
if(engine != null && body != null){
|
if(engine != null && body != null){
|
||||||
PhysicsUtils.destroyBody(engine, body);
|
PhysicsUtils.destroyBody(engine, body);
|
||||||
|
|||||||
@ -140,7 +140,7 @@ public class ClientIdleTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_IDLE, rVal);
|
parent.putData(EntityDataStrings.TREE_IDLE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_IDLE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_IDLE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
public static ClientInventoryState clientCreateInventoryState(Entity parent){
|
public static ClientInventoryState clientCreateInventoryState(Entity parent){
|
||||||
ClientInventoryState rVal = new ClientInventoryState();
|
ClientInventoryState rVal = new ClientInventoryState();
|
||||||
rVal.parent = parent;
|
rVal.parent = parent;
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,15 +62,15 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
networkMessageQueue.remove(message);
|
networkMessageQueue.remove(message);
|
||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case SERVERCOMMANDSTOREITEM: {
|
case SERVERCOMMANDSTOREITEM: {
|
||||||
Entity clientSideContainer = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
|
Entity clientSideContainer = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
|
||||||
Entity clientSideItem = null;
|
Entity clientSideItem = null;
|
||||||
if(Globals.clientSceneWrapper.containsServerId(message.getitemEntId())){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(message.getitemEntId())){
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client move item " + message.getitemEntId());
|
LoggerInterface.loggerNetworking.DEBUG("Client move item " + message.getitemEntId());
|
||||||
clientSideItem = Globals.clientSceneWrapper.getEntityFromServerId(message.getitemEntId());
|
clientSideItem = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getitemEntId());
|
||||||
} else {
|
} else {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client create item " + message.getitemEntId());
|
LoggerInterface.loggerNetworking.DEBUG("Client create item " + message.getitemEntId());
|
||||||
clientSideItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
|
clientSideItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
|
||||||
Globals.clientSceneWrapper.mapIdToId(clientSideItem.getId(), message.getitemEntId());
|
Globals.clientState.clientSceneWrapper.mapIdToId(clientSideItem.getId(), message.getitemEntId());
|
||||||
}
|
}
|
||||||
ClientInventoryState.moveItem(clientSideContainer, clientSideItem, message.getcontainerType(), message.getequipPointId());
|
ClientInventoryState.moveItem(clientSideContainer, clientSideItem, message.getcontainerType(), message.getequipPointId());
|
||||||
//attempt re-render ui
|
//attempt re-render ui
|
||||||
@ -78,19 +78,19 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
} break;
|
} break;
|
||||||
case ADDITEMTOINVENTORY: {
|
case ADDITEMTOINVENTORY: {
|
||||||
LoggerInterface.loggerNetworking.WARNING("Client create item " + message.getitemEntId());
|
LoggerInterface.loggerNetworking.WARNING("Client create item " + message.getitemEntId());
|
||||||
Entity clientSideContainer = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
|
Entity clientSideContainer = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
|
||||||
//the ID we get is of the in-inventory item
|
//the ID we get is of the in-inventory item
|
||||||
Entity inInventorySpawnedItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
|
Entity inInventorySpawnedItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
|
||||||
//map id
|
//map id
|
||||||
if(inInventorySpawnedItem != null){
|
if(inInventorySpawnedItem != null){
|
||||||
Globals.clientSceneWrapper.mapIdToId(inInventorySpawnedItem.getId(), message.getitemEntId());
|
Globals.clientState.clientSceneWrapper.mapIdToId(inInventorySpawnedItem.getId(), message.getitemEntId());
|
||||||
}
|
}
|
||||||
//attempt re-render ui
|
//attempt re-render ui
|
||||||
WindowUtils.attemptRedrawInventoryWindows();
|
WindowUtils.attemptRedrawInventoryWindows();
|
||||||
} break;
|
} break;
|
||||||
case REMOVEITEMFROMINVENTORY: {
|
case REMOVEITEMFROMINVENTORY: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client remove item from inventories " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("Client remove item from inventories " + message.getentityId());
|
||||||
Entity item = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
Entity item = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
if(item != null){
|
if(item != null){
|
||||||
ClientInventoryState.clientRemoveItemFromInventories(item);
|
ClientInventoryState.clientRemoveItemFromInventories(item);
|
||||||
//attempt re-render ui
|
//attempt re-render ui
|
||||||
@ -100,7 +100,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
case SERVERCOMMANDMOVEITEMCONTAINER: {
|
case SERVERCOMMANDMOVEITEMCONTAINER: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client move item container " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("Client move item container " + message.getentityId());
|
||||||
//this is a command to switch an item from one inventory to another (ie equip->natural or vice-versa)
|
//this is a command to switch an item from one inventory to another (ie equip->natural or vice-versa)
|
||||||
Entity itemEnt = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
Entity itemEnt = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
ClientInventoryState.moveItem(this.parent, itemEnt, message.getcontainerType(), message.getequipPointId());
|
ClientInventoryState.moveItem(this.parent, itemEnt, message.getcontainerType(), message.getequipPointId());
|
||||||
//once we've switched the items around, redraw the inventory to reflect the updated contents
|
//once we've switched the items around, redraw the inventory to reflect the updated contents
|
||||||
WindowUtils.attemptRedrawInventoryWindows();
|
WindowUtils.attemptRedrawInventoryWindows();
|
||||||
@ -132,12 +132,12 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
case SERVERCOMMANDEQUIPITEM: {
|
case SERVERCOMMANDEQUIPITEM: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client equip item " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("Client equip item " + message.getentityId());
|
||||||
//translate equipper id
|
//translate equipper id
|
||||||
Entity equipper = Globals.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
|
Entity equipper = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
|
||||||
//spawn in world id
|
//spawn in world id
|
||||||
Entity inWorldEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
Entity inWorldEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
if(inWorldEntity != null){
|
if(inWorldEntity != null){
|
||||||
//translate id
|
//translate id
|
||||||
Globals.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
|
Globals.clientState.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
|
||||||
switch(message.getcontainerType()){
|
switch(message.getcontainerType()){
|
||||||
case InventoryProtocol.INVENTORY_TYPE_NATURAL: {
|
case InventoryProtocol.INVENTORY_TYPE_NATURAL: {
|
||||||
throw new UnsupportedOperationException("unsupported!");
|
throw new UnsupportedOperationException("unsupported!");
|
||||||
@ -165,7 +165,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
} break;
|
} break;
|
||||||
case SERVERUPDATEITEMCHARGES: {
|
case SERVERUPDATEITEMCHARGES: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Client set item charges " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("Client set item charges " + message.getentityId());
|
||||||
Entity clientInventoryItem = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
Entity clientInventoryItem = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
ClientChargeState clientChargeState = ClientChargeState.getClientChargeState(clientInventoryItem);
|
ClientChargeState clientChargeState = ClientChargeState.getClientChargeState(clientInventoryItem);
|
||||||
clientChargeState.setCharges(message.getcharges());
|
clientChargeState.setCharges(message.getcharges());
|
||||||
} break;
|
} break;
|
||||||
@ -292,7 +292,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
public static void clientAddToNatural(Entity item){
|
public static void clientAddToNatural(Entity item){
|
||||||
//tell the server we want to try the transform
|
//tell the server we want to try the transform
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestAddNaturalMessage(
|
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestAddNaturalMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(item.getId())
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId())
|
||||||
);
|
);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
}
|
}
|
||||||
@ -305,8 +305,8 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
public static void clientAttemptStoreItem(Entity creature, Entity item){
|
public static void clientAttemptStoreItem(Entity creature, Entity item){
|
||||||
//tell the server we want to try the transform
|
//tell the server we want to try the transform
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructaddItemToInventoryMessage(
|
NetworkMessage requestPickupMessage = InventoryMessage.constructaddItemToInventoryMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(item.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()),
|
||||||
ItemUtils.getType(item)
|
ItemUtils.getType(item)
|
||||||
);
|
);
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
@ -351,7 +351,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
*/
|
*/
|
||||||
public static void clientAttemptEjectItem(Entity creature, Entity item){
|
public static void clientAttemptEjectItem(Entity creature, Entity item){
|
||||||
//if we're the client, tell the server we want to try the transform
|
//if we're the client, tell the server we want to try the transform
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructremoveItemFromInventoryMessage(Globals.clientSceneWrapper.mapClientToServerId(item.getId()));
|
NetworkMessage requestPickupMessage = InventoryMessage.constructremoveItemFromInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()));
|
||||||
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(item));
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(item));
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class ClientChargeState implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTCHARGESTATE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTCHARGESTATE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTCHARGESTATE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTCHARGESTATE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class ClientLifeTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTLIFETREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTLIFETREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTLIFETREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTLIFETREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class ClientPointLightComponent implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTLIGHTSTATE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTLIGHTSTATE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -142,7 +142,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.playerEntity){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
position.x,
|
position.x,
|
||||||
position.y,
|
position.y,
|
||||||
@ -172,7 +172,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.playerEntity){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
position.x,
|
position.x,
|
||||||
position.y,
|
position.y,
|
||||||
@ -195,7 +195,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
||||||
float maxNaturalVelocity = EDITOR_MAX_VELOCITY;
|
float maxNaturalVelocity = EDITOR_MAX_VELOCITY;
|
||||||
|
|
||||||
Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientSceneWrapper.mapClientToServerId(parent.getId()));
|
Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()));
|
||||||
|
|
||||||
//
|
//
|
||||||
//rotation update
|
//rotation update
|
||||||
@ -524,7 +524,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTEDITORMOVEMENTTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTEDITORMOVEMENTTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEDITORMOVEMENTTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEDITORMOVEMENTTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.playerEntity){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
position.x,
|
position.x,
|
||||||
position.y,
|
position.y,
|
||||||
@ -180,7 +180,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.playerEntity){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
position.x,
|
position.x,
|
||||||
position.y,
|
position.y,
|
||||||
@ -820,7 +820,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTGROUNDMOVEMENTTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTGROUNDMOVEMENTTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROUNDMOVEMENTTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROUNDMOVEMENTTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
public void start(){
|
public void start(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_START
|
ServerSynchronizationManager.SERVER_SYNC_START
|
||||||
)
|
)
|
||||||
@ -191,7 +191,7 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTJUMPTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTJUMPTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
public void interrupt(){
|
public void interrupt(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
||||||
)
|
)
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class ClientSprintTree implements BehaviorTree {
|
|||||||
public void start(){
|
public void start(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_START
|
ServerSynchronizationManager.SERVER_SYNC_START
|
||||||
)
|
)
|
||||||
@ -123,7 +123,7 @@ public class ClientSprintTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTSPRINTTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTSPRINTTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ public class ClientSprintTree implements BehaviorTree {
|
|||||||
public void interrupt(){
|
public void interrupt(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
||||||
)
|
)
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class ClientWalkTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTWALKTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTWALKTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class ClientWalkTree implements BehaviorTree {
|
|||||||
public void start(){
|
public void start(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_START
|
ServerSynchronizationManager.SERVER_SYNC_START
|
||||||
)
|
)
|
||||||
@ -161,7 +161,7 @@ public class ClientWalkTree implements BehaviorTree {
|
|||||||
public void interrupt(){
|
public void interrupt(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
||||||
)
|
)
|
||||||
|
|||||||
@ -72,7 +72,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
|
|||||||
//Synchronize data
|
//Synchronize data
|
||||||
EntityUtils.getPosition(parent).set(position);
|
EntityUtils.getPosition(parent).set(position);
|
||||||
EntityUtils.getRotation(parent).set(rotationFromServer);
|
EntityUtils.getRotation(parent).set(rotationFromServer);
|
||||||
PhysicsUtils.synchronizeData(Globals.clientSceneWrapper.getCollisionEngine(), body, position, rotationFromServer, linearVelocity, angularVelocity, linearForce, angularForce);
|
PhysicsUtils.synchronizeData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), body, position, rotationFromServer, linearVelocity, angularVelocity, linearForce, angularForce);
|
||||||
|
|
||||||
//
|
//
|
||||||
//update facing vector if relevant
|
//update facing vector if relevant
|
||||||
@ -110,7 +110,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTPHYSICSSYNCTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTPHYSICSSYNCTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class ClientAlwaysUprightTree implements BehaviorTree {
|
|||||||
|
|
||||||
EntityUtils.getPosition(parent).set(position);
|
EntityUtils.getPosition(parent).set(position);
|
||||||
EntityUtils.getRotation(parent).set(sourceRotation);
|
EntityUtils.getRotation(parent).set(sourceRotation);
|
||||||
PhysicsUtils.synchronizeData(Globals.clientSceneWrapper.getCollisionEngine(), body, position, sourceRotation, linearVelocity, angularVelocity, linearForce, angularForce);
|
PhysicsUtils.synchronizeData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), body, position, sourceRotation, linearVelocity, angularVelocity, linearForce, angularForce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class ClientAlwaysUprightTree implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTALWAYSUPRIGHTTREE, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTALWAYSUPRIGHTTREE, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public class ClientStanceComponent implements BehaviorTree {
|
|||||||
//!!WARNING!! from here below should not be touched
|
//!!WARNING!! from here below should not be touched
|
||||||
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
|
||||||
parent.putData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT, rVal);
|
parent.putData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT, rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
|
||||||
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID);
|
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ public class ClientStanceComponent implements BehaviorTree {
|
|||||||
public void start(){
|
public void start(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_START
|
ServerSynchronizationManager.SERVER_SYNC_START
|
||||||
)
|
)
|
||||||
@ -127,7 +127,7 @@ public class ClientStanceComponent implements BehaviorTree {
|
|||||||
public void interrupt(){
|
public void interrupt(){
|
||||||
Globals.clientConnection.queueOutgoingMessage(
|
Globals.clientConnection.queueOutgoingMessage(
|
||||||
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
SynchronizationMessage.constructClientRequestBTreeActionMessage(
|
||||||
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
|
||||||
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
|
||||||
)
|
)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class CollisionObjUtils {
|
|||||||
Vector3d position = EntityUtils.getPosition(entity);
|
Vector3d position = EntityUtils.getPosition(entity);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(entity);
|
Quaterniond rotation = EntityUtils.getRotation(entity);
|
||||||
Collidable collidable = new Collidable(entity, collidableType, true);
|
Collidable collidable = new Collidable(entity, collidableType, true);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(collisionObject, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(collisionObject, collidable);
|
||||||
|
|
||||||
PhysicsEntityUtils.setDBody(entity, collisionObject);
|
PhysicsEntityUtils.setDBody(entity, collisionObject);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public class CollisionObjUtils {
|
|||||||
EntityUtils.getPosition(e).set(position);
|
EntityUtils.getPosition(e).set(position);
|
||||||
DBody body = PhysicsEntityUtils.getDBody(e);
|
DBody body = PhysicsEntityUtils.getDBody(e);
|
||||||
if(body != null){
|
if(body != null){
|
||||||
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), position, rotation, body);
|
PhysicsUtils.setRigidBodyTransform(Globals.clientState.clientSceneWrapper.getCollisionEngine(), position, rotation, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,21 +134,21 @@ public class CommonEntityUtils {
|
|||||||
for(String token : rawType.getTokens()){
|
for(String token : rawType.getTokens()){
|
||||||
switch(token){
|
switch(token){
|
||||||
case "GENERATE_COLLISION_OBJECT": {
|
case "GENERATE_COLLISION_OBJECT": {
|
||||||
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
|
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
|
||||||
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
|
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
|
||||||
if(collisionObject != null){
|
if(collisionObject != null){
|
||||||
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
||||||
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT);
|
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
} break;
|
} break;
|
||||||
case "GENERATE_COLLISION_TERRAIN": {
|
case "GENERATE_COLLISION_TERRAIN": {
|
||||||
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
|
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
|
||||||
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
|
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
|
||||||
if(collisionObject != null){
|
if(collisionObject != null){
|
||||||
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
|
||||||
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_STATIC);
|
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_STATIC);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
@ -205,7 +205,7 @@ public class CommonEntityUtils {
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
if(rawType.getHitboxes() != null){
|
if(rawType.getHitboxes() != null){
|
||||||
HitboxCollectionState.attachHitboxState(Globals.clientSceneWrapper.getHitboxManager(), false, entity, rawType.getHitboxes());
|
HitboxCollectionState.attachHitboxState(Globals.clientState.clientSceneWrapper.getHitboxManager(), false, entity, rawType.getHitboxes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -170,7 +170,7 @@ public class CreatureUtils {
|
|||||||
clientToolbarState.attemptAddToToolbar(itemInInventory, Integer.parseInt(toolbarSlot));
|
clientToolbarState.attemptAddToToolbar(itemInInventory, Integer.parseInt(toolbarSlot));
|
||||||
|
|
||||||
//map the constructed item to its server id
|
//map the constructed item to its server id
|
||||||
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getToolbarId(toolbarSlot));
|
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getToolbarId(toolbarSlot));
|
||||||
}
|
}
|
||||||
for(Entry<String,EntitySerialization> equippedItem : inventoryData.getEquipItems()){
|
for(Entry<String,EntitySerialization> equippedItem : inventoryData.getEquipItems()){
|
||||||
EntitySerialization serialization = equippedItem.getValue();
|
EntitySerialization serialization = equippedItem.getValue();
|
||||||
@ -184,7 +184,7 @@ public class CreatureUtils {
|
|||||||
clientEquipState.attemptEquip(itemInInventory, clientEquipState.getEquipPoint(equipSlot));
|
clientEquipState.attemptEquip(itemInInventory, clientEquipState.getEquipPoint(equipSlot));
|
||||||
|
|
||||||
//map the constructed item to its server id
|
//map the constructed item to its server id
|
||||||
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getEquippedId(equipSlot));
|
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getEquippedId(equipSlot));
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(EntitySerialization naturalItem : inventoryData.getNaturalItems()){
|
for(EntitySerialization naturalItem : inventoryData.getNaturalItems()){
|
||||||
@ -192,7 +192,7 @@ public class CreatureUtils {
|
|||||||
Entity itemInInventory = ClientInventoryState.clientConstructInInventoryItem(creature,naturalItem.getSubtype());
|
Entity itemInInventory = ClientInventoryState.clientConstructInInventoryItem(creature,naturalItem.getSubtype());
|
||||||
|
|
||||||
//map the constructed item to its server id
|
//map the constructed item to its server id
|
||||||
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getNaturalId(i));
|
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getNaturalId(i));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class ItemUtils {
|
|||||||
rVal.putData(EntityDataStrings.ITEM_IS_WEAPON, true);
|
rVal.putData(EntityDataStrings.ITEM_IS_WEAPON, true);
|
||||||
WeaponData weaponData = item.getWeaponData();
|
WeaponData weaponData = item.getWeaponData();
|
||||||
if(weaponData.getHitboxes() != null){
|
if(weaponData.getHitboxes() != null){
|
||||||
HitboxCollectionState.attachHitboxState(Globals.clientSceneWrapper.getHitboxManager(), false, rVal, weaponData.getHitboxes());
|
HitboxCollectionState.attachHitboxState(Globals.clientState.clientSceneWrapper.getHitboxManager(), false, rVal, weaponData.getHitboxes());
|
||||||
}
|
}
|
||||||
rVal.putData(EntityDataStrings.ITEM_WEAPON_CLASS,weaponData.getWeaponClass());
|
rVal.putData(EntityDataStrings.ITEM_WEAPON_CLASS,weaponData.getWeaponClass());
|
||||||
rVal.putData(EntityDataStrings.ITEM_WEAPON_DATA_RAW,weaponData);
|
rVal.putData(EntityDataStrings.ITEM_WEAPON_DATA_RAW,weaponData);
|
||||||
@ -128,7 +128,7 @@ public class ItemUtils {
|
|||||||
ClientChargeState.attachTree(rVal, item.getMaxStack());
|
ClientChargeState.attachTree(rVal, item.getMaxStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,8 +530,8 @@ public class ItemUtils {
|
|||||||
rVal.putData(EntityDataStrings.ITEM_IS_IN_INVENTORY, true);
|
rVal.putData(EntityDataStrings.ITEM_IS_IN_INVENTORY, true);
|
||||||
ItemUtils.setContainingParent(rVal, containingParent);
|
ItemUtils.setContainingParent(rVal, containingParent);
|
||||||
CommonEntityUtils.setEntitySubtype(rVal, CommonEntityUtils.getEntitySubtype(item));
|
CommonEntityUtils.setEntitySubtype(rVal, CommonEntityUtils.getEntitySubtype(item));
|
||||||
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
|
||||||
return rVal;
|
return rVal;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@ -652,7 +652,7 @@ public class ItemUtils {
|
|||||||
if(PhysicsEntityUtils.containsDBody(item) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
if(PhysicsEntityUtils.containsDBody(item) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
|
||||||
//destroy physics
|
//destroy physics
|
||||||
//this deregisters from all four & unhooks rigid bodies from the physics runtime
|
//this deregisters from all four & unhooks rigid bodies from the physics runtime
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(item);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(item);
|
||||||
//destroy graphics
|
//destroy graphics
|
||||||
ClientEntityUtils.destroyEntity(item);
|
ClientEntityUtils.destroyEntity(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class ProjectileUtils {
|
|||||||
ProjectileTree tree = new ProjectileTree(rVal,maxLife,new Vector3d(initialVector),velocity);
|
ProjectileTree tree = new ProjectileTree(rVal,maxLife,new Vector3d(initialVector),velocity);
|
||||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||||
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class ProjectileUtils {
|
|||||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||||
//projectile behavior tree
|
//projectile behavior tree
|
||||||
ProjectileTree tree = new ProjectileTree(rVal,rawType.getMaxLife(),initialVector,rawType.getVelocity(), rawType.getDamage());
|
ProjectileTree tree = new ProjectileTree(rVal,rawType.getMaxLife(),initialVector,rawType.getVelocity(), rawType.getDamage());
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
||||||
ProjectileTree.setProjectileTree(rVal, tree);
|
ProjectileTree.setProjectileTree(rVal, tree);
|
||||||
//filter construction
|
//filter construction
|
||||||
List<Entity> filter = new LinkedList<Entity>();
|
List<Entity> filter = new LinkedList<Entity>();
|
||||||
@ -94,7 +94,7 @@ public class ProjectileUtils {
|
|||||||
//collidable
|
//collidable
|
||||||
HitboxData hitboxData = new HitboxData();
|
HitboxData hitboxData = new HitboxData();
|
||||||
hitboxData.setRadius(rawType.getHitboxRadius());
|
hitboxData.setRadius(rawType.getHitboxRadius());
|
||||||
HitboxCollectionState.attachHitboxStateWithCallback(Globals.clientSceneWrapper.getHitboxManager(), Globals.clientSceneWrapper.getCollisionEngine(), rVal, hitboxData,
|
HitboxCollectionState.attachHitboxStateWithCallback(Globals.clientState.clientSceneWrapper.getHitboxManager(), Globals.clientState.clientSceneWrapper.getCollisionEngine(), rVal, hitboxData,
|
||||||
new HitboxPositionCallback() {
|
new HitboxPositionCallback() {
|
||||||
public Vector3d getPosition(){
|
public Vector3d getPosition(){
|
||||||
return EntityUtils.getPosition(rVal);
|
return EntityUtils.getPosition(rVal);
|
||||||
|
|||||||
@ -125,13 +125,13 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//attach physics
|
//attach physics
|
||||||
DBody rigidBody = CollisionBodyCreation.createCylinderBody(
|
DBody rigidBody = CollisionBodyCreation.createCylinderBody(
|
||||||
Globals.clientSceneWrapper.getCollisionEngine(),
|
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
|
||||||
treeModel.getPhysicsBody().getDimension1(),
|
treeModel.getPhysicsBody().getDimension1(),
|
||||||
treeModel.getPhysicsBody().getDimension2(),
|
treeModel.getPhysicsBody().getDimension2(),
|
||||||
Collidable.TYPE_STATIC_BIT
|
Collidable.TYPE_STATIC_BIT
|
||||||
);
|
);
|
||||||
CollisionBodyCreation.setOffsetPosition(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, new Vector3d(0,treeModel.getPhysicsBody().getOffsetY(),0));
|
CollisionBodyCreation.setOffsetPosition(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, new Vector3d(0,treeModel.getPhysicsBody().getOffsetY(),0));
|
||||||
CollisionBodyCreation.setKinematic(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody);
|
CollisionBodyCreation.setKinematic(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody);
|
||||||
Collidable collidable = new Collidable(trunkChild, Collidable.TYPE_STATIC, true);
|
Collidable collidable = new Collidable(trunkChild, Collidable.TYPE_STATIC, true);
|
||||||
PhysicsEntityUtils.setDBody(trunkChild, rigidBody);
|
PhysicsEntityUtils.setDBody(trunkChild, rigidBody);
|
||||||
Matrix4d offsetTransform = new Matrix4d().translationRotateScale(
|
Matrix4d offsetTransform = new Matrix4d().translationRotateScale(
|
||||||
@ -144,7 +144,7 @@ public class ProceduralTree {
|
|||||||
trunkChild.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
trunkChild.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
||||||
trunkChild.putData(EntityDataStrings.PHYSICS_MASS, TREE_MASS);
|
trunkChild.putData(EntityDataStrings.PHYSICS_MASS, TREE_MASS);
|
||||||
|
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||||
|
|
||||||
|
|
||||||
//generate branches
|
//generate branches
|
||||||
@ -498,7 +498,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//add behavior tree to update all child branch attachment points to new point
|
//add behavior tree to update all child branch attachment points to new point
|
||||||
if(childBranches.size() > 0 && segment.scalar >= type.getMinimumScalarToGenerateSwayTree() && segment.scalar <= type.getMaximumScalarToGenerateSwayTree()){
|
if(childBranches.size() > 0 && segment.scalar >= type.getMinimumScalarToGenerateSwayTree() && segment.scalar <= type.getMaximumScalarToGenerateSwayTree()){
|
||||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BranchBehaviorTree(
|
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BranchBehaviorTree(
|
||||||
type,
|
type,
|
||||||
parent,
|
parent,
|
||||||
branch,
|
branch,
|
||||||
|
|||||||
@ -23,8 +23,8 @@ public class CombatProtocol implements ClientProtocolTemplate<CombatMessage> {
|
|||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case SERVERREPORTHITBOXCOLLISION: {
|
case SERVERREPORTHITBOXCOLLISION: {
|
||||||
Vector3d position = new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
Vector3d position = new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ());
|
||||||
Entity senderEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity senderEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
Entity receiverEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getreceiverEntityID());
|
Entity receiverEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getreceiverEntityID());
|
||||||
if(senderEntity != null && receiverEntity != null){
|
if(senderEntity != null && receiverEntity != null){
|
||||||
ClientNetworkHitboxCollision.handleHitboxCollision(senderEntity, receiverEntity, position, message.gethitboxType(), message.gethurtboxType());
|
ClientNetworkHitboxCollision.handleHitboxCollision(senderEntity, receiverEntity, position, message.gethitboxType(), message.gethurtboxType());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,10 +54,10 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//error check
|
//error check
|
||||||
if(Globals.clientState.clientScene != null && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
|
if(Globals.clientState.clientScene != null && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
|
||||||
LoggerInterface.loggerNetworking.WARNING("Client received packet for entity that is not in the client scene!");
|
LoggerInterface.loggerNetworking.WARNING("Client received packet for entity that is not in the client scene!");
|
||||||
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
|
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
|
||||||
Globals.clientSceneWrapper.dumpIdData(message.getentityID());
|
Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityID());
|
||||||
Entity serverEntity = EntityLookupUtils.getEntityById(message.getentityID());
|
Entity serverEntity = EntityLookupUtils.getEntityById(message.getentityID());
|
||||||
LoggerInterface.loggerNetworking.WARNING("Entity type: " + CommonEntityUtils.getEntityType(serverEntity));
|
LoggerInterface.loggerNetworking.WARNING("Entity type: " + CommonEntityUtils.getEntityType(serverEntity));
|
||||||
LoggerInterface.loggerNetworking.WARNING("Entity subtype: " + CommonEntityUtils.getEntitySubtype(serverEntity));
|
LoggerInterface.loggerNetworking.WARNING("Entity subtype: " + CommonEntityUtils.getEntitySubtype(serverEntity));
|
||||||
@ -104,7 +104,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
case SETPROPERTY: {
|
case SETPROPERTY: {
|
||||||
if(Globals.clientSceneWrapper.serverToClientMapContainsId(message.getentityID())){
|
if(Globals.clientState.clientSceneWrapper.serverToClientMapContainsId(message.getentityID())){
|
||||||
if(message.getpropertyType() == 0){
|
if(message.getpropertyType() == 0){
|
||||||
EntityProtocol.setPlayerEntity(message);
|
EntityProtocol.setPlayerEntity(message);
|
||||||
}
|
}
|
||||||
@ -115,8 +115,8 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
Globals.clientConnection.release(message);
|
Globals.clientConnection.release(message);
|
||||||
} break;
|
} break;
|
||||||
case ATTACHENTITYTOENTITY: {
|
case ATTACHENTITYTOENTITY: {
|
||||||
Entity child = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity child = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
Entity parent = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetID());
|
Entity parent = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetID());
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Attach " + message.getentityID() + " to " + message.gettargetID() + " on bone " + message.getbone());
|
LoggerInterface.loggerNetworking.DEBUG("Attach " + message.getentityID() + " to " + message.gettargetID() + " on bone " + message.getbone());
|
||||||
if(child != null && parent != null){
|
if(child != null && parent != null){
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
@ -130,7 +130,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
Globals.clientConnection.release(message);
|
Globals.clientConnection.release(message);
|
||||||
} break;
|
} break;
|
||||||
case MOVEUPDATE: {
|
case MOVEUPDATE: {
|
||||||
Entity target = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity target = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
if(target != null){
|
if(target != null){
|
||||||
CreatureUtils.clientAttachEntityMessageToMovementTree(target,message);
|
CreatureUtils.clientAttachEntityMessageToMovementTree(target,message);
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SYNCPHYSICS: {
|
case SYNCPHYSICS: {
|
||||||
Entity entity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity entity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
if(entity != null && ClientPhysicsSyncTree.hasTree(entity)){
|
if(entity != null && ClientPhysicsSyncTree.hasTree(entity)){
|
||||||
ClientPhysicsSyncTree.getTree(entity).setMessage(message);
|
ClientPhysicsSyncTree.getTree(entity).setMessage(message);
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
case DESTROY: {
|
case DESTROY: {
|
||||||
Entity entity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity entity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
if(entity != null){
|
if(entity != null){
|
||||||
ClientEntityUtils.destroyEntity(entity);
|
ClientEntityUtils.destroyEntity(entity);
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
* @param message the network message to parse
|
* @param message the network message to parse
|
||||||
*/
|
*/
|
||||||
static void setPlayerEntity(EntityMessage message){
|
static void setPlayerEntity(EntityMessage message){
|
||||||
Entity target = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
Entity target = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
|
||||||
if(target != null){
|
if(target != null){
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Set player entity id for entity: " + target.getId() + " to player: " + message.getpropertyValue());
|
LoggerInterface.loggerNetworking.DEBUG("Set player entity id for entity: " + target.getId() + " to player: " + message.getpropertyValue());
|
||||||
CreatureUtils.setControllerPlayerId(target, message.getpropertyValue());
|
CreatureUtils.setControllerPlayerId(target, message.getpropertyValue());
|
||||||
@ -202,7 +202,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LoggerInterface.loggerNetworking.WARNING("Tried to set player entity property on an entity that doesn't exist!");
|
LoggerInterface.loggerNetworking.WARNING("Tried to set player entity property on an entity that doesn't exist!");
|
||||||
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
|
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||||
);
|
);
|
||||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||||
//if the creature template includes an equip section, spawn all the equipped items
|
//if the creature template includes an equip section, spawn all the equipped items
|
||||||
CreatureUtils.clientApplyTemplate(newlySpawnedEntity, template);
|
CreatureUtils.clientApplyTemplate(newlySpawnedEntity, template);
|
||||||
//apply state synchronization if present
|
//apply state synchronization if present
|
||||||
@ -246,7 +246,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||||
);
|
);
|
||||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||||
return newlySpawnedEntity;
|
return newlySpawnedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||||
);
|
);
|
||||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||||
return newlySpawnedEntity;
|
return newlySpawnedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
|
||||||
);
|
);
|
||||||
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
|
||||||
return newlySpawnedEntity;
|
return newlySpawnedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
|
|||||||
),
|
),
|
||||||
message.getworldSizeDiscrete()
|
message.getworldSizeDiscrete()
|
||||||
);
|
);
|
||||||
Globals.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData());
|
Globals.clientState.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData());
|
||||||
Globals.clientConnection.getMessageProtocol().setHasReceivedWorld(true);
|
Globals.clientConnection.getMessageProtocol().setHasReceivedWorld(true);
|
||||||
break;
|
break;
|
||||||
case SPAWNPOSITION:
|
case SPAWNPOSITION:
|
||||||
|
|||||||
@ -92,7 +92,7 @@ public class ClientSynchronizationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//attempt to handle the message
|
//attempt to handle the message
|
||||||
if(Globals.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) != null){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId()) != null){
|
||||||
messagesToClear.add(message);
|
messagesToClear.add(message);
|
||||||
messageBounceCount.remove(message);
|
messageBounceCount.remove(message);
|
||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
@ -104,13 +104,13 @@ public class ClientSynchronizationManager {
|
|||||||
case UPDATECLIENTSTRINGSTATE:{
|
case UPDATECLIENTSTRINGSTATE:{
|
||||||
int bTreeId = message.getbTreeId();
|
int bTreeId = message.getbTreeId();
|
||||||
int entityId = message.getentityId();
|
int entityId = message.getentityId();
|
||||||
Entity targetEntity = Globals.clientSceneWrapper.getEntityFromServerId(entityId);
|
Entity targetEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(entityId);
|
||||||
this.updateEntityState(targetEntity,bTreeId,message);
|
this.updateEntityState(targetEntity,bTreeId,message);
|
||||||
} break;
|
} break;
|
||||||
case SERVERNOTIFYBTREETRANSITION: {
|
case SERVERNOTIFYBTREETRANSITION: {
|
||||||
int bTreeId = message.getbTreeId();
|
int bTreeId = message.getbTreeId();
|
||||||
int entityId = message.getentityId();
|
int entityId = message.getentityId();
|
||||||
Entity targetEntity = Globals.clientSceneWrapper.getEntityFromServerId(entityId);
|
Entity targetEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(entityId);
|
||||||
this.transitionBTree(targetEntity, bTreeId, message);
|
this.transitionBTree(targetEntity, bTreeId, message);
|
||||||
} break;
|
} break;
|
||||||
case ATTACHTREE:{
|
case ATTACHTREE:{
|
||||||
@ -131,26 +131,26 @@ public class ClientSynchronizationManager {
|
|||||||
//silently ignore
|
//silently ignore
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if(Globals.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
|
} else if(Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
|
||||||
String errorMessage =
|
String errorMessage =
|
||||||
"Client received synchronization packet for entity that does not exists on client!\n" +
|
"Client received synchronization packet for entity that does not exists on client!\n" +
|
||||||
"Specifically, the synchronization manager thinks this id is registered, but there is no entity at that key\n" +
|
"Specifically, the synchronization manager thinks this id is registered, but there is no entity at that key\n" +
|
||||||
"Entity id in network message: " + message.getentityId()
|
"Entity id in network message: " + message.getentityId()
|
||||||
;
|
;
|
||||||
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
|
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
|
||||||
Globals.clientSceneWrapper.dumpIdData(message.getentityId());
|
Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityId());
|
||||||
Globals.clientSceneWrapper.getScene().describeScene();
|
Globals.clientState.clientSceneWrapper.getScene().describeScene();
|
||||||
throw new IllegalStateException(errorMessage);
|
throw new IllegalStateException(errorMessage);
|
||||||
} else if(!Globals.clientSceneWrapper.containsServerId(message.getentityId()) && !Globals.clientSceneWrapper.hasBeenDeleted(message.getentityId())){
|
} else if(!Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && !Globals.clientState.clientSceneWrapper.hasBeenDeleted(message.getentityId())){
|
||||||
//TODO: have client send query to server to resend this entity
|
//TODO: have client send query to server to resend this entity
|
||||||
// String errorMessage =
|
// String errorMessage =
|
||||||
// "Client received synchronization packet for entity that does not exists on client!\n" +
|
// "Client received synchronization packet for entity that does not exists on client!\n" +
|
||||||
// "This ID was never created on the client, yet the client is receiving a synchronization packet for it!\n" +
|
// "This ID was never created on the client, yet the client is receiving a synchronization packet for it!\n" +
|
||||||
// "Entity id in network message: " + message.getentityId()
|
// "Entity id in network message: " + message.getentityId()
|
||||||
// ;
|
// ;
|
||||||
// Globals.clientSceneWrapper.dumpTranslationLayerStatus();
|
// Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
|
||||||
// Globals.clientSceneWrapper.dumpIdData(message.getentityId());
|
// Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityId());
|
||||||
// Globals.clientSceneWrapper.getScene().describeScene();
|
// Globals.clientState.clientSceneWrapper.getScene().describeScene();
|
||||||
// throw new IllegalStateException(errorMessage);
|
// throw new IllegalStateException(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +159,8 @@ public class ClientSynchronizationManager {
|
|||||||
|
|
||||||
//data from the message itself
|
//data from the message itself
|
||||||
int serverId = message.getentityId();
|
int serverId = message.getentityId();
|
||||||
String clientContainsServerId = "" + Globals.clientSceneWrapper.containsServerId(serverId);
|
String clientContainsServerId = "" + Globals.clientState.clientSceneWrapper.containsServerId(serverId);
|
||||||
String entityFromServerId = "" + Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
String entityFromServerId = "" + Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
|
||||||
|
|
||||||
//actual server entity
|
//actual server entity
|
||||||
Entity actualServerEntity = EntityLookupUtils.getEntityById(serverId);
|
Entity actualServerEntity = EntityLookupUtils.getEntityById(serverId);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
|
|
||||||
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient()){
|
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient()){
|
||||||
Model hitboxModel;
|
Model hitboxModel;
|
||||||
for(HitboxCollectionState hitboxState : Globals.clientSceneWrapper.getHitboxManager().getAllHitboxes()){
|
for(HitboxCollectionState hitboxState : Globals.clientState.clientSceneWrapper.getHitboxManager().getAllHitboxes()){
|
||||||
for(DGeom geom : hitboxState.getGeometries()){
|
for(DGeom geom : hitboxState.getGeometries()){
|
||||||
if(geom instanceof DSphere){
|
if(geom instanceof DSphere){
|
||||||
DSphere sphereView = (DSphere)geom;
|
DSphere sphereView = (DSphere)geom;
|
||||||
@ -129,7 +129,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
|
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
|
||||||
Model hitboxModel;
|
Model hitboxModel;
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
|
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
|
||||||
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());
|
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());
|
||||||
@ -186,7 +186,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
|
|
||||||
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
|
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
|
||||||
Model physicsGraphicsModel;
|
Model physicsGraphicsModel;
|
||||||
CollisionEngine engine = Globals.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
for(Collidable collidable : engine.getCollidables()){
|
for(Collidable collidable : engine.getCollidables()){
|
||||||
Entity physicsEntity = collidable.getParent();
|
Entity physicsEntity = collidable.getParent();
|
||||||
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){
|
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){
|
||||||
@ -238,7 +238,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
//Draw grid alignment data
|
//Draw grid alignment data
|
||||||
if(Globals.userSettings.getGraphicsDebugDrawGridAlignment()){
|
if(Globals.userSettings.getGraphicsDebugDrawGridAlignment()){
|
||||||
Model physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE);
|
Model physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE);
|
||||||
for(Entity entity : Globals.clientSceneWrapper.getScene().getEntityList()){
|
for(Entity entity : Globals.clientState.clientSceneWrapper.getScene().getEntityList()){
|
||||||
CommonEntityType data = CommonEntityUtils.getCommonData(entity);
|
CommonEntityType data = CommonEntityUtils.getCommonData(entity);
|
||||||
if(data == null){
|
if(data == null){
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class EntityLookupUtils {
|
|||||||
if(EntityLookupUtils.isServerEntity(clientEntity)){
|
if(EntityLookupUtils.isServerEntity(clientEntity)){
|
||||||
throw new Error("Trying to get server equivalent of a server entity!");
|
throw new Error("Trying to get server equivalent of a server entity!");
|
||||||
}
|
}
|
||||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
|
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
|
||||||
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
return serverEntity;
|
return serverEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class ClientCollidableTreeTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(3);
|
TestEngineUtils.simulateFrames(3);
|
||||||
|
|
||||||
//get client entity
|
//get client entity
|
||||||
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE).iterator().next();
|
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE).iterator().next();
|
||||||
|
|
||||||
//verify it was started on server
|
//verify it was started on server
|
||||||
assertEquals(false, ClientFallTree.getFallTree(clientEntity).isFalling());
|
assertEquals(false, ClientFallTree.getFallTree(clientEntity).isFalling());
|
||||||
|
|||||||
@ -50,9 +50,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(5);
|
TestEngineUtils.simulateFrames(5);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//equip
|
//equip
|
||||||
@ -64,9 +64,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab the item in particular
|
//grab the item in particular
|
||||||
@ -101,9 +101,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(5);
|
TestEngineUtils.simulateFrames(5);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//try to store item in inventory
|
//try to store item in inventory
|
||||||
@ -124,9 +124,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(5);
|
TestEngineUtils.simulateFrames(5);
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(2, clientSideItems.size());
|
assertEquals(2, clientSideItems.size());
|
||||||
|
|
||||||
//verify the equip state thinks it has something equipped
|
//verify the equip state thinks it has something equipped
|
||||||
|
|||||||
@ -38,9 +38,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab player entity
|
//grab player entity
|
||||||
@ -55,9 +55,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab the item in particular
|
//grab the item in particular
|
||||||
@ -91,9 +91,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab player entity
|
//grab player entity
|
||||||
@ -108,7 +108,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|
||||||
//attempt to eject
|
//attempt to eject
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
clientKatana = clientSideItems.iterator().next();
|
clientKatana = clientSideItems.iterator().next();
|
||||||
ClientInventoryState.clientAttemptEjectItem(clientCreature, clientKatana);
|
ClientInventoryState.clientAttemptEjectItem(clientCreature, clientKatana);
|
||||||
|
|
||||||
@ -116,9 +116,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab the item in particular
|
//grab the item in particular
|
||||||
@ -151,9 +151,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(0, clientSideItems.size());
|
assertEquals(0, clientSideItems.size());
|
||||||
|
|
||||||
//grab player entity
|
//grab player entity
|
||||||
@ -164,9 +164,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");
|
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab the item in particular
|
//grab the item in particular
|
||||||
|
|||||||
@ -38,9 +38,9 @@ public class ItemUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//verify the client got the extra entities
|
//verify the client got the extra entities
|
||||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(0, clientSideItems.size());
|
assertEquals(0, clientSideItems.size());
|
||||||
|
|
||||||
//get server equivalent of client entity
|
//get server equivalent of client entity
|
||||||
@ -58,9 +58,9 @@ public class ItemUtilsTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|
||||||
//verify we still have everything
|
//verify we still have everything
|
||||||
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||||
assertEquals(1, clientSideCreatures.size());
|
assertEquals(1, clientSideCreatures.size());
|
||||||
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||||
assertEquals(1, clientSideItems.size());
|
assertEquals(1, clientSideItems.size());
|
||||||
|
|
||||||
//grab the item in particular
|
//grab the item in particular
|
||||||
|
|||||||
@ -16,7 +16,6 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
|
|||||||
public void afterEach(ExtensionContext context) throws Exception {
|
public void afterEach(ExtensionContext context) throws Exception {
|
||||||
Object[] objectsToCheck = new Object[]{
|
Object[] objectsToCheck = new Object[]{
|
||||||
Globals.realmManager,
|
Globals.realmManager,
|
||||||
Globals.clientSceneWrapper,
|
|
||||||
Globals.signalSystem,
|
Globals.signalSystem,
|
||||||
Globals.threadManager,
|
Globals.threadManager,
|
||||||
Globals.renderingEngine,
|
Globals.renderingEngine,
|
||||||
|
|||||||
@ -58,11 +58,11 @@ public class TestEngineUtils {
|
|||||||
*/
|
*/
|
||||||
public static Entity getClientEquivalent(Entity serverEntity){
|
public static Entity getClientEquivalent(Entity serverEntity){
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
while(frames < MAX_FRAMES_TO_WAIT_FOR_CLIENT_PROPAGATION && !Globals.clientSceneWrapper.containsServerId(serverEntity.getId())){
|
while(frames < MAX_FRAMES_TO_WAIT_FOR_CLIENT_PROPAGATION && !Globals.clientState.clientSceneWrapper.containsServerId(serverEntity.getId())){
|
||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.containsServerId(serverEntity.getId())){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(serverEntity.getId())){
|
||||||
Entity rVal = Globals.clientSceneWrapper.getEntityFromServerId(serverEntity.getId());
|
Entity rVal = Globals.clientState.clientSceneWrapper.getEntityFromServerId(serverEntity.getId());
|
||||||
if(rVal == null){
|
if(rVal == null){
|
||||||
fail("Failed to find client entity at server id lookup for id: " + serverEntity.getId());
|
fail("Failed to find client entity at server id lookup for id: " + serverEntity.getId());
|
||||||
}
|
}
|
||||||
@ -81,10 +81,10 @@ public class TestEngineUtils {
|
|||||||
if(clientEntity == null){
|
if(clientEntity == null){
|
||||||
fail("Provided null entity to get server equivalent!");
|
fail("Provided null entity to get server equivalent!");
|
||||||
}
|
}
|
||||||
if(Globals.clientSceneWrapper.containsServerId(clientEntity.getId())){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(clientEntity.getId())){
|
||||||
fail("Provided server entity to getServerEquivalent");
|
fail("Provided server entity to getServerEquivalent");
|
||||||
}
|
}
|
||||||
int serverId = Globals.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
|
int serverId = Globals.clientState.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
|
||||||
Entity rVal = EntityLookupUtils.getEntityById(serverId);
|
Entity rVal = EntityLookupUtils.getEntityById(serverId);
|
||||||
if(rVal == null){
|
if(rVal == null){
|
||||||
fail("Failed to find client entity at server id lookup for id: " + clientEntity.getId());
|
fail("Failed to find client entity at server id lookup for id: " + clientEntity.getId());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user