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 org.joml.Vector3d;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
import annotations.IntegrationTest;
|
||||
import electrosphere.engine.Globals;
|
||||
@ -18,7 +17,6 @@ import testutils.TestEntityUtils;
|
||||
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
|
||||
@Disabled
|
||||
@IntegrationTest
|
||||
public void testSpawnCreature(){
|
||||
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
|
||||
@Disabled
|
||||
@IntegrationTest
|
||||
public void testSpawnMultipleCreatures(){
|
||||
int numberToSpawn = 100;
|
||||
|
||||
@ -4,17 +4,18 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
import org.joml.Vector3d;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
import annotations.IntegrationTest;
|
||||
import electrosphere.controls.ControlHandler;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
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.CreatureUtils;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
import template.EntityTestTemplate;
|
||||
import testutils.InputAPI;
|
||||
import testutils.TestEngineUtils;
|
||||
|
||||
/**
|
||||
@ -26,24 +27,30 @@ public class ServerAttackTreeTests extends EntityTestTemplate {
|
||||
/**
|
||||
* Make sure can attack in default scene
|
||||
*/
|
||||
@Disabled //disabled until can place platform in viewport
|
||||
@IntegrationTest
|
||||
public void testClientAttack(){
|
||||
//warm up engine
|
||||
TestEngineUtils.simulateFrames(1);
|
||||
|
||||
//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
|
||||
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(entity);
|
||||
//Get the server-side player's trees
|
||||
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(creature);
|
||||
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
||||
serverFallTree.land();
|
||||
|
||||
//verify can attack
|
||||
assertEquals(true, serverAttackTree.canAttack(serverAttackTree.getAttackType()));
|
||||
|
||||
//try attacking
|
||||
InputAPI.simulatePress(ControlHandler.DATA_STRING_INPUT_CODE_ATTACK_PRIMARY);
|
||||
InputAPI.simulateRelease(ControlHandler.DATA_STRING_INPUT_CODE_ATTACK_PRIMARY);
|
||||
serverAttackTree.start();
|
||||
|
||||
//wait for the attack to propagate back to the client
|
||||
TestEngineUtils.simulateFrames(10);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user