testing work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-08-19 19:38:20 -04:00
parent 0d80214dc8
commit 5ed2263fc5
7 changed files with 43 additions and 40 deletions

View File

@ -1,7 +1,6 @@
{
"entities" : [],
"scriptPaths" : [],
"initScriptPath" : "/Scenes/testscene1/scene.ts",
"realmDescriptor" : {
"type" : "gridded",
"griddedRealmSize" : 2

View File

@ -1,16 +0,0 @@
import { Scene } from "/Scripts/types/scene";
/**
* The main scene interface
*/
const TestScene1: Scene = {
persistentValues: {},
hooks: [],
signalHookMap: {},
sceneHooks: []
}
/**
* The scene to export
*/
export default TestScene1

View File

@ -213,13 +213,23 @@ public class ClientLoading {
EntityUtils.getScale(Globals.playerCursor).set(30f);
}
static final int MAX_DRAW_CELL_WAIT = 1000;
static void initDrawCellManager(){
int iterations = 0;
while(Globals.clientWorldData == null || Globals.initialAssetLoadingThread.isLoading()){
try {
TimeUnit.MILLISECONDS.sleep(10);
iterations++;
} catch (InterruptedException ex) {
LoggerInterface.loggerEngine.ERROR(ex);
}
if(iterations > MAX_DRAW_CELL_WAIT){
String message = "Draw cell took too long to init!\n" +
Globals.clientWorldData + "\n" +
Globals.initialAssetLoadingThread.isLoading();
throw new IllegalStateException(message);
}
}
//initialize draw cell manager
Globals.drawCellManager = new DrawCellManager(Globals.clientTerrainManager, 0, 0, 0);

View File

@ -115,7 +115,7 @@ public class MessageProtocol {
public void handleSyncMessages(){
Globals.profiler.beginAggregateCpuSample("MessageProtocol(client).handleSyncMessages");
this.synchronousMessageLock.acquireUninterruptibly();
LoggerInterface.loggerNetworking.DEBUG_LOOP("HANDLE SYNC MESSAGE [Sync queue size: " + this.synchronousMessageQueue.size() + "]");
LoggerInterface.loggerNetworking.DEBUG_LOOP("[SERVER] HANDLE SYNC MESSAGE [Sync queue size: " + this.synchronousMessageQueue.size() + "]");
for(NetworkMessage message : synchronousMessageQueue){
switch(message.getType()){
case AUTH_MESSAGE:

View File

@ -402,7 +402,7 @@ public class ServerConnectionHandler implements Runnable {
*/
private void disconnect(){
//close socket
if(socket.isConnected()){
if(socket != null && socket.isConnected()){
try {
socket.close();
} catch (IOException e) {

View File

@ -25,17 +25,17 @@ public class ServerEquipStateTests extends EntityTestTemplate {
public void spawningWithEquippedItem(){
TestEngineUtils.simulateFrames(1);
//spawn entities
// CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
// Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate);
// Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "katana2H");
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate);
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "katana2H");
//equip
// Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana);
// ServerEquipState serverEquipState = ServerEquipState.getServerEquipState(creature);
// serverEquipState.commandAttemptEquip(inInventoryItem, serverEquipState.getEquipPoint("handsCombined"));
Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana);
ServerEquipState serverEquipState = ServerEquipState.getServerEquipState(creature);
serverEquipState.commandAttemptEquip(inInventoryItem, serverEquipState.getEquipPoint("handsCombined"));
// //verify was equipped
// assertNotNull(serverEquipState.getEquippedItemAtPoint("handsCombined"));
//verify was equipped
assertNotNull(serverEquipState.getEquippedItemAtPoint("handsCombined"));
}
}

View File

@ -1,9 +1,14 @@
package testutils;
import java.util.concurrent.TimeUnit;
import electrosphere.engine.Globals;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
import electrosphere.entity.scene.SceneFile;
import electrosphere.menu.mainmenu.MenuGeneratorsLevelEditor.LevelDescription;
import electrosphere.logger.LoggerInterface;
import electrosphere.logger.Logger.LogLevel;
import electrosphere.menu.WindowStrings;
import electrosphere.renderer.ui.elements.Window;
public class EngineInit {
@ -12,21 +17,26 @@ public class EngineInit {
*/
public static void setupConnectedTestScene(){
//
//create the scene
LevelDescription inFlightLevel = new LevelDescription();
SceneFile sceneFile = SceneFile.createSceneFile();
inFlightLevel.setSceneFile(sceneFile);
inFlightLevel.setName("testscene1");
sceneFile.setCreateSaveInstance(false);
sceneFile.getRealmDescriptor().setGriddedRealmSize(1);
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LEVEL_EDITOR, inFlightLevel);
loadingThread.run();
LoadingThread loadingThread = null;
//
//load the scene
loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1");
loadingThread.run();
loadingThread.start();
LoggerInterface.loggerNetworking.setLevel(LogLevel.LOOP_DEBUG);
//
//wait for client to be fully init'd
while(((Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING)).getVisible() || Globals.playerEntity == null){
TestEngineUtils.simulateFrames(1);
try {
TimeUnit.MILLISECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}