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 13:37:36 -04:00
parent 415e20d02d
commit 0d80214dc8
16 changed files with 153 additions and 14 deletions

2
Jenkinsfile vendored
View File

@ -45,7 +45,7 @@ pipeline {
timeout: 25
]
) {
sh 'mvn test'
sh 'mvn test -P integration'
}
}
post {

View File

@ -0,0 +1,11 @@
{
"entities" : [],
"scriptPaths" : [],
"initScriptPath" : "/Scenes/testscene1/scene.ts",
"realmDescriptor" : {
"type" : "gridded",
"griddedRealmSize" : 2
},
"createSaveInstance" : false,
"loadAllCells": true
}

View File

@ -4,7 +4,10 @@ import { Scene } from "/Scripts/types/scene";
* The main scene interface
*/
const TestScene1: Scene = {
persistentValues: {},
hooks: [],
signalHookMap: {},
sceneHooks: []
}
/**

View File

@ -1,8 +0,0 @@
{
"entities": [
],
"scriptPaths": [
"Scenes/testscene1/someScript.js"
],
"initScriptPath": "Scenes/testscene1/someScript.js"
}

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Mon Aug 19 12:41:14 EDT 2024
buildNumber=276
#Mon Aug 19 13:16:30 EDT 2024
buildNumber=280

BIN
saves/testscene1/0_0_0t.dat Normal file

Binary file not shown.

BIN
saves/testscene1/central.db Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
{"serializedEntities":[]}

View File

@ -0,0 +1 @@
{"versionString":"0.0.1","timeCreated":"1724087800358","name":"testscene1"}

View File

@ -0,0 +1 @@
{"type":"LEVEL","worldMinPoint":{"x":0.0,"y":0.0,"z":0.0},"worldMaxPoint":{"x":16.0,"y":16.0,"z":16.0},"worldSizeDiscrete":1,"worldSizeDiscreteVertical":1,"dynamicInterpolationRatio":1,"randomDampener":1.0,"isArena":false}

View File

@ -2,7 +2,6 @@ package electrosphere.engine.loadingthreads;
import java.util.concurrent.TimeUnit;
import org.joml.Quaterniond;
import org.joml.Vector3f;
import electrosphere.client.fluid.cells.FluidCellManager;
@ -16,7 +15,6 @@ import electrosphere.entity.DrawableUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityCreationUtils;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.movement.ApplyRotationTree;
import electrosphere.entity.types.camera.CameraEntityUtils;
import electrosphere.logger.LoggerInterface;
import electrosphere.menu.MenuGenerators;
@ -220,6 +218,7 @@ public class ClientLoading {
try {
TimeUnit.MILLISECONDS.sleep(10);
} catch (InterruptedException ex) {
LoggerInterface.loggerEngine.ERROR(ex);
}
}
//initialize draw cell manager

View File

@ -3,6 +3,9 @@ package electrosphere.entity.types.creature;
import java.util.HashMap;
import java.util.Map;
import electrosphere.engine.Globals;
import electrosphere.game.data.creature.type.CreatureData;
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
import electrosphere.net.synchronization.transport.StateCollection;
/**
@ -100,6 +103,34 @@ public class CreatureTemplate {
this.stateCollection = stateCollection;
}
/**
* Creates a template for the creature with default values
* @param creatureType The type of creature
* @return The basic template
*/
public static CreatureTemplate createDefault(String creatureType){
CreatureTemplate storedTemplate = CreatureTemplate.create(creatureType);
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getCreature(creatureType);
if(rawType.getVisualAttributes() != null){
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
if(attributeType.getType().equals("remesh")){
if(attributeType.getVariants() != null && attributeType.getVariants().size() > 0){
//make sure stored template contains creature data
if(storedTemplate.getAttributeValue(attributeType.getAttributeId())==null){
storedTemplate.putAttributeValue(attributeType.getAttributeId(), attributeType.getVariants().get(0).getId());
}
}
}
if(attributeType.getType().equals("bone")){
//make sure stored template contains creature data
float midpoint = (attributeType.getMaxValue() - attributeType.getMinValue())/2.0f + attributeType.getMinValue();
storedTemplate.putAttributeValue(attributeType.getAttributeId(), midpoint);
}
}
}
return storedTemplate;
}
/**
* A visual attribute of a creature (ie how wide is their nose, what type of hairstyle do they have, etc)
*/

View File

@ -136,5 +136,13 @@ public class RealmManager {
}
}
/**
* Returns the first realm in the manager
* @return The first realm in the manager
*/
public Realm first(){
return realms.iterator().next();
}
}

View File

@ -0,0 +1,41 @@
package electrosphere.entity.state.equip;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.joml.Vector3d;
import org.junit.jupiter.api.Disabled;
import annotations.IntegrationTest;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.state.inventory.InventoryUtils;
import electrosphere.entity.types.creature.CreatureTemplate;
import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.types.item.ItemUtils;
import template.EntityTestTemplate;
import testutils.TestEngineUtils;
/**
* Server equip state tests
*/
public class ServerEquipStateTests extends EntityTestTemplate {
@Disabled
@IntegrationTest
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");
//equip
// Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana);
// ServerEquipState serverEquipState = ServerEquipState.getServerEquipState(creature);
// serverEquipState.commandAttemptEquip(inInventoryItem, serverEquipState.getEquipPoint("handsCombined"));
// //verify was equipped
// assertNotNull(serverEquipState.getEquippedItemAtPoint("handsCombined"));
}
}

View File

@ -0,0 +1,19 @@
package template;
import annotations.IntegrationSetup;
import testutils.EngineInit;
import testutils.TestEngineUtils;
/**
*
*/
public abstract class EntityTestTemplate extends RenderingTestTemplate {
@IntegrationSetup
@Override
public void initEngine(){
TestEngineUtils.initGraphicalEngine();
EngineInit.setupConnectedTestScene();
}
}

View File

@ -0,0 +1,32 @@
package testutils;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
import electrosphere.entity.scene.SceneFile;
import electrosphere.menu.mainmenu.MenuGeneratorsLevelEditor.LevelDescription;
public class EngineInit {
/**
* Setups up a locally-connected client and server that have loaded a test scene
*/
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();
//
//load the scene
loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1");
loadingThread.run();
}
}