enable attack test, spawn tests
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
b0a92ba6e1
commit
2fd6618ff0
@ -3,7 +3,6 @@ package electrosphere.entity;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
|
|
||||||
import annotations.IntegrationTest;
|
import annotations.IntegrationTest;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
@ -18,7 +17,6 @@ import testutils.TestEntityUtils;
|
|||||||
public class SpawningCreaturesTest extends EntityTestTemplate {
|
public class SpawningCreaturesTest extends EntityTestTemplate {
|
||||||
|
|
||||||
//must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
|
//must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
|
||||||
@Disabled
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void testSpawnCreature(){
|
public void testSpawnCreature(){
|
||||||
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
||||||
@ -26,7 +24,6 @@ public class SpawningCreaturesTest extends EntityTestTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
|
//must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
|
||||||
@Disabled
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void testSpawnMultipleCreatures(){
|
public void testSpawnMultipleCreatures(){
|
||||||
int numberToSpawn = 100;
|
int numberToSpawn = 100;
|
||||||
|
|||||||
@ -4,17 +4,18 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
|
|
||||||
import annotations.IntegrationTest;
|
import annotations.IntegrationTest;
|
||||||
import electrosphere.controls.ControlHandler;
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
||||||
|
import electrosphere.entity.state.equip.ServerEquipState;
|
||||||
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
|
import electrosphere.entity.state.movement.ServerFallTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.CreatureTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import template.EntityTestTemplate;
|
import template.EntityTestTemplate;
|
||||||
import testutils.InputAPI;
|
|
||||||
import testutils.TestEngineUtils;
|
import testutils.TestEngineUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,24 +27,30 @@ public class ServerAttackTreeTests extends EntityTestTemplate {
|
|||||||
/**
|
/**
|
||||||
* Make sure can attack in default scene
|
* Make sure can attack in default scene
|
||||||
*/
|
*/
|
||||||
@Disabled //disabled until can place platform in viewport
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void testClientAttack(){
|
public void testClientAttack(){
|
||||||
//warm up engine
|
//warm up engine
|
||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn on server
|
//spawn on server
|
||||||
Entity entity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
||||||
|
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"));
|
||||||
|
|
||||||
//Get the server-side player's attack tree
|
//Get the server-side player's trees
|
||||||
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(entity);
|
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(creature);
|
||||||
|
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
||||||
|
serverFallTree.land();
|
||||||
|
|
||||||
//verify can attack
|
//verify can attack
|
||||||
assertEquals(true, serverAttackTree.canAttack(serverAttackTree.getAttackType()));
|
assertEquals(true, serverAttackTree.canAttack(serverAttackTree.getAttackType()));
|
||||||
|
|
||||||
//try attacking
|
//try attacking
|
||||||
InputAPI.simulatePress(ControlHandler.DATA_STRING_INPUT_CODE_ATTACK_PRIMARY);
|
serverAttackTree.start();
|
||||||
InputAPI.simulateRelease(ControlHandler.DATA_STRING_INPUT_CODE_ATTACK_PRIMARY);
|
|
||||||
|
|
||||||
//wait for the attack to propagate back to the client
|
//wait for the attack to propagate back to the client
|
||||||
TestEngineUtils.simulateFrames(10);
|
TestEngineUtils.simulateFrames(10);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user