creature template to object template
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
7217b5a5ba
commit
d56d08204c
@ -1733,6 +1733,7 @@ Fix block generation thread filtering repairable structures
|
|||||||
Catch errors in pathfinding threads
|
Catch errors in pathfinding threads
|
||||||
Remove old data classes
|
Remove old data classes
|
||||||
Update default block cursor size
|
Update default block cursor size
|
||||||
|
Creature template -> object template
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package electrosphere.client.entity.character;
|
package electrosphere.client.entity.character;
|
||||||
|
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a character
|
* Describes a character
|
||||||
@ -15,7 +15,7 @@ public class CharacterDescriptionDTO {
|
|||||||
/**
|
/**
|
||||||
* The character's template data
|
* The character's template data
|
||||||
*/
|
*/
|
||||||
CreatureTemplate template;
|
ObjectTemplate template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the character
|
* Gets the id of the character
|
||||||
@ -37,7 +37,7 @@ public class CharacterDescriptionDTO {
|
|||||||
* Gets the creature template for the character
|
* Gets the creature template for the character
|
||||||
* @return The creature template
|
* @return The creature template
|
||||||
*/
|
*/
|
||||||
public CreatureTemplate getTemplate() {
|
public ObjectTemplate getTemplate() {
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class CharacterDescriptionDTO {
|
|||||||
* Sets the creature template for the character
|
* Sets the creature template for the character
|
||||||
* @param template The creature template
|
* @param template The creature template
|
||||||
*/
|
*/
|
||||||
public void setTemplate(CreatureTemplate template) {
|
public void setTemplate(ObjectTemplate template) {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,8 @@ import org.joml.Vector4d;
|
|||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.AttributeVariant;
|
import electrosphere.game.data.creature.type.visualattribute.AttributeVariant;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
||||||
@ -57,7 +58,7 @@ public class CharacterCustomizer {
|
|||||||
* @param race The race of the character
|
* @param race The race of the character
|
||||||
* @return The panel component
|
* @return The panel component
|
||||||
*/
|
*/
|
||||||
public static Element createCharacterCustomizerPanel(String race, Consumer<CreatureTemplate> onConfirm){
|
public static Element createCharacterCustomizerPanel(String race, Consumer<ObjectTemplate> onConfirm){
|
||||||
//figure out race data
|
//figure out race data
|
||||||
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ public class CharacterCustomizer {
|
|||||||
ActorStaticMorph staticMorph = new ActorStaticMorph();
|
ActorStaticMorph staticMorph = new ActorStaticMorph();
|
||||||
|
|
||||||
//create creature template
|
//create creature template
|
||||||
CreatureTemplate template = CreatureTemplate.create(race);
|
ObjectTemplate template = ObjectTemplate.create(EntityType.CREATURE, race);
|
||||||
|
|
||||||
//create scrollable
|
//create scrollable
|
||||||
ScrollableContainer scrollable = ScrollableContainer.createScrollable();
|
ScrollableContainer scrollable = ScrollableContainer.createScrollable();
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import electrosphere.client.ui.menu.WindowUtils;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread;
|
import electrosphere.engine.loadingthreads.LoadingThread;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.net.parser.net.message.CharacterMessage;
|
import electrosphere.net.parser.net.message.CharacterMessage;
|
||||||
import electrosphere.net.parser.net.message.TerrainMessage;
|
import electrosphere.net.parser.net.message.TerrainMessage;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
@ -96,7 +96,7 @@ public class MenuCharacterCreation {
|
|||||||
public static Element createCharacterCustomizationMenu(){
|
public static Element createCharacterCustomizationMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
rVal.addChild(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {
|
rVal.addChild(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (ObjectTemplate template) -> {
|
||||||
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import electrosphere.client.ui.menu.mainmenu.worldgen.MenuWorldSelect;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread;
|
import electrosphere.engine.loadingthreads.LoadingThread;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.net.NetUtils;
|
import electrosphere.net.NetUtils;
|
||||||
import electrosphere.net.parser.net.message.CharacterMessage;
|
import electrosphere.net.parser.net.message.CharacterMessage;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
@ -63,7 +63,7 @@ public class MenuGeneratorsMultiplayer {
|
|||||||
createButton.addChild(createLabel);
|
createButton.addChild(createLabel);
|
||||||
rVal.addChild(createButton);
|
rVal.addChild(createButton);
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
WindowUtils.replaceMainMenuContents(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {
|
WindowUtils.replaceMainMenuContents(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (ObjectTemplate template) -> {
|
||||||
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
||||||
}));
|
}));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import electrosphere.entity.EntityCreationUtils;
|
|||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.state.inventory.RelationalInventoryState;
|
import electrosphere.entity.state.inventory.RelationalInventoryState;
|
||||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.game.data.common.CommonEntityType;
|
import electrosphere.game.data.common.CommonEntityType;
|
||||||
import electrosphere.game.data.crafting.RecipeData;
|
import electrosphere.game.data.crafting.RecipeData;
|
||||||
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
import electrosphere.game.data.creature.type.equip.EquipPoint;
|
||||||
@ -137,7 +137,7 @@ public class MenuGeneratorsUITesting {
|
|||||||
formEl.addChild(panel);
|
formEl.addChild(panel);
|
||||||
} break;
|
} break;
|
||||||
case "CharacterCustomizer": {
|
case "CharacterCustomizer": {
|
||||||
formEl.addChild(CharacterCustomizer.createCharacterCustomizerPanel("human", (CreatureTemplate template) ->{}));
|
formEl.addChild(CharacterCustomizer.createCharacterCustomizerPanel("human", (ObjectTemplate template) ->{}));
|
||||||
} break;
|
} break;
|
||||||
case "NaturalInventoryPanel": {
|
case "NaturalInventoryPanel": {
|
||||||
Entity ent = EntityCreationUtils.TEST_createEntity();
|
Entity ent = EntityCreationUtils.TEST_createEntity();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import electrosphere.auth.AuthenticationManager;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
@ -153,7 +153,7 @@ public class LoadingUtils {
|
|||||||
race = races.get(new Random().nextInt(races.size()));
|
race = races.get(new Random().nextInt(races.size()));
|
||||||
}
|
}
|
||||||
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
CreatureTemplate template = CreatureTemplate.create(race);
|
ObjectTemplate template = ObjectTemplate.create(EntityType.CREATURE, race);
|
||||||
for(VisualAttribute attribute : type.getVisualAttributes()){
|
for(VisualAttribute attribute : type.getVisualAttributes()){
|
||||||
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
||||||
float min = attribute.getMinValue();
|
float min = attribute.getMinValue();
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class EntityDataStrings {
|
|||||||
public static final String TREE_CLIENTJUMPTREE = "treeClientJumpTree";
|
public static final String TREE_CLIENTJUMPTREE = "treeClientJumpTree";
|
||||||
public static final String TREE_SERVERJUMPTREE = "treeServerJumpTree";
|
public static final String TREE_SERVERJUMPTREE = "treeServerJumpTree";
|
||||||
public static final String FALL_TREE = "fallTree";
|
public static final String FALL_TREE = "fallTree";
|
||||||
public static final String CREATURE_TEMPLATE = "creatureTemplate";
|
public static final String OBJECT_TEMPLATE = "objectTemplate";
|
||||||
public static final String FIRST_PERSON_TREE = "firstPersonTree";
|
public static final String FIRST_PERSON_TREE = "firstPersonTree";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,8 @@ import electrosphere.entity.state.rotator.ServerRotatorTree;
|
|||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
|
import electrosphere.entity.types.creature.ObjectInventoryData;
|
||||||
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.game.data.collidable.CollidableTemplate;
|
import electrosphere.game.data.collidable.CollidableTemplate;
|
||||||
import electrosphere.game.data.common.CommonEntityType;
|
import electrosphere.game.data.common.CommonEntityType;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
@ -86,6 +88,7 @@ import electrosphere.game.data.item.Item;
|
|||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
import electrosphere.net.parser.net.message.EntityMessage;
|
||||||
import electrosphere.net.parser.net.message.NetworkMessage;
|
import electrosphere.net.parser.net.message.NetworkMessage;
|
||||||
import electrosphere.net.server.player.Player;
|
import electrosphere.net.server.player.Player;
|
||||||
|
import electrosphere.net.synchronization.transport.StateCollection;
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.renderer.actor.ActorBoneRotator;
|
import electrosphere.renderer.actor.ActorBoneRotator;
|
||||||
import electrosphere.renderer.actor.ActorUtils;
|
import electrosphere.renderer.actor.ActorUtils;
|
||||||
@ -93,6 +96,8 @@ import electrosphere.server.datacell.Realm;
|
|||||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||||
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
||||||
import electrosphere.server.entity.poseactor.PoseActor;
|
import electrosphere.server.entity.poseactor.PoseActor;
|
||||||
|
import electrosphere.server.entity.serialization.ContentSerialization;
|
||||||
|
import electrosphere.server.entity.serialization.EntitySerialization;
|
||||||
import electrosphere.util.math.SpatialMathUtils;
|
import electrosphere.util.math.SpatialMathUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -948,4 +953,52 @@ public class CommonEntityUtils {
|
|||||||
entity.putData(EntityDataStrings.ENTITY_SUBTYPE, subtype);
|
entity.putData(EntityDataStrings.ENTITY_SUBTYPE, subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the template for the creature
|
||||||
|
* @param e The creature
|
||||||
|
* @return The template
|
||||||
|
*/
|
||||||
|
public static ObjectTemplate getObjectTemplate(Entity e){
|
||||||
|
ObjectTemplate template = (ObjectTemplate)e.getData(EntityDataStrings.OBJECT_TEMPLATE);
|
||||||
|
if(template == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
|
inventoryData.clear();
|
||||||
|
if(ServerEquipState.hasEquipState(e)){
|
||||||
|
ServerEquipState serverEquipState = ServerEquipState.getEquipState(e);
|
||||||
|
for(String point : serverEquipState.equippedPoints()){
|
||||||
|
Entity item = serverEquipState.getEquippedItemAtPoint(point);
|
||||||
|
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(item);
|
||||||
|
inventoryData.addEquippedItem(point, itemSerialized);
|
||||||
|
inventoryData.setEquippedId(point, item.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(InventoryUtils.hasToolbarInventory(e)){
|
||||||
|
RelationalInventoryState toolbarInventory = InventoryUtils.getToolbarInventory(e);
|
||||||
|
for(String slot : toolbarInventory.getSlots()){
|
||||||
|
Entity slotItem = toolbarInventory.getItemSlot(slot);
|
||||||
|
if(slotItem != null){
|
||||||
|
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(slotItem);
|
||||||
|
inventoryData.addToolbarItem(slot, itemSerialized);
|
||||||
|
inventoryData.setToolbarId(slot, slotItem.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(InventoryUtils.hasNaturalInventory(e)){
|
||||||
|
UnrelationalInventoryState toolbarInventory = InventoryUtils.getNaturalInventory(e);
|
||||||
|
int i = 0;
|
||||||
|
for(Entity item : toolbarInventory.getItems()){
|
||||||
|
if(item != null){
|
||||||
|
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(item);
|
||||||
|
inventoryData.addNaturalItem(itemSerialized);
|
||||||
|
inventoryData.setNaturalId(i, item.getId());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template.setStateCollection(StateCollection.getStateCollection(e));
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,8 +22,6 @@ import electrosphere.entity.state.equip.ServerEquipState;
|
|||||||
import electrosphere.entity.state.equip.ServerToolbarState;
|
import electrosphere.entity.state.equip.ServerToolbarState;
|
||||||
import electrosphere.entity.state.idle.ClientIdleTree;
|
import electrosphere.entity.state.idle.ClientIdleTree;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.state.inventory.RelationalInventoryState;
|
|
||||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree;
|
||||||
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
@ -37,7 +35,6 @@ import electrosphere.net.NetUtils;
|
|||||||
import electrosphere.net.parser.net.message.EntityMessage;
|
import electrosphere.net.parser.net.message.EntityMessage;
|
||||||
import electrosphere.net.parser.net.message.NetworkMessage;
|
import electrosphere.net.parser.net.message.NetworkMessage;
|
||||||
import electrosphere.net.server.player.Player;
|
import electrosphere.net.server.player.Player;
|
||||||
import electrosphere.net.synchronization.transport.StateCollection;
|
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.renderer.actor.ActorStaticMorph;
|
import electrosphere.renderer.actor.ActorStaticMorph;
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
@ -58,7 +55,7 @@ public class CreatureUtils {
|
|||||||
* @param template The creature template if applicable
|
* @param template The creature template if applicable
|
||||||
* @return The creature entity
|
* @return The creature entity
|
||||||
*/
|
*/
|
||||||
public static Entity clientSpawnBasicCreature(String type, CreatureTemplate template){
|
public static Entity clientSpawnBasicCreature(String type, ObjectTemplate template){
|
||||||
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
|
|
||||||
@ -73,7 +70,7 @@ public class CreatureUtils {
|
|||||||
Actor creatureActor = EntityUtils.getActor(rVal);
|
Actor creatureActor = EntityUtils.getActor(rVal);
|
||||||
|
|
||||||
//variants
|
//variants
|
||||||
CreatureTemplate storedTemplate = CreatureTemplate.create(rawType.getId());
|
ObjectTemplate storedTemplate = ObjectTemplate.create(EntityType.CREATURE, rawType.getId());
|
||||||
if(rawType.getVisualAttributes() != null){
|
if(rawType.getVisualAttributes() != null){
|
||||||
ActorStaticMorph staticMorph = null;
|
ActorStaticMorph staticMorph = null;
|
||||||
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
||||||
@ -138,7 +135,7 @@ public class CreatureUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//set race
|
//set race
|
||||||
storedTemplate.creatureType = rawType.getId();
|
storedTemplate.objectType = rawType.getId();
|
||||||
//store template on creature
|
//store template on creature
|
||||||
CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
|
CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
|
||||||
|
|
||||||
@ -153,13 +150,13 @@ public class CreatureUtils {
|
|||||||
* @param creature The creature
|
* @param creature The creature
|
||||||
* @param template The template
|
* @param template The template
|
||||||
*/
|
*/
|
||||||
public static void clientApplyTemplate(Entity creature, CreatureTemplate template){
|
public static void clientApplyTemplate(Entity creature, ObjectTemplate template){
|
||||||
//
|
//
|
||||||
//must happen after the player is attached to the entity, or server won't send packet to add item to player's entity
|
//must happen after the player is attached to the entity, or server won't send packet to add item to player's entity
|
||||||
//now that creature has been spawned, need to create all attached items
|
//now that creature has been spawned, need to create all attached items
|
||||||
if(template != null){
|
if(template != null){
|
||||||
if(template.getInventoryData() != null){
|
if(template.getInventoryData() != null){
|
||||||
CreatureInventoryData inventoryData = template.getInventoryData();
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
for(Entry<String,EntitySerialization> toolbarItem : inventoryData.getToolbarItems()){
|
for(Entry<String,EntitySerialization> toolbarItem : inventoryData.getToolbarItems()){
|
||||||
EntitySerialization serialization = toolbarItem.getValue();
|
EntitySerialization serialization = toolbarItem.getValue();
|
||||||
String toolbarSlot = toolbarItem.getKey();
|
String toolbarSlot = toolbarItem.getKey();
|
||||||
@ -210,7 +207,7 @@ public class CreatureUtils {
|
|||||||
* @param template The creature template to use
|
* @param template The creature template to use
|
||||||
* @return The creature entity
|
* @return The creature entity
|
||||||
*/
|
*/
|
||||||
public static Entity serverSpawnBasicCreature(Realm realm, Vector3d position, String type, CreatureTemplate template){
|
public static Entity serverSpawnBasicCreature(Realm realm, Vector3d position, String type, ObjectTemplate template){
|
||||||
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
||||||
Entity rVal = EntityCreationUtils.createServerEntity(realm, position);
|
Entity rVal = EntityCreationUtils.createServerEntity(realm, position);
|
||||||
|
|
||||||
@ -230,7 +227,7 @@ public class CreatureUtils {
|
|||||||
|
|
||||||
|
|
||||||
//variants
|
//variants
|
||||||
CreatureTemplate storedTemplate = CreatureTemplate.create(rawType.getId());
|
ObjectTemplate storedTemplate = ObjectTemplate.create(EntityType.CREATURE, rawType.getId());
|
||||||
if(rawType.getVisualAttributes() != null){
|
if(rawType.getVisualAttributes() != null){
|
||||||
ActorStaticMorph staticMorph = null;
|
ActorStaticMorph staticMorph = null;
|
||||||
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
||||||
@ -286,7 +283,7 @@ public class CreatureUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//set race
|
//set race
|
||||||
storedTemplate.creatureType = rawType.getId();
|
storedTemplate.objectType = rawType.getId();
|
||||||
//store template on creature
|
//store template on creature
|
||||||
CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
|
CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
|
||||||
|
|
||||||
@ -312,13 +309,13 @@ public class CreatureUtils {
|
|||||||
* @param creature The creature
|
* @param creature The creature
|
||||||
* @param template The template
|
* @param template The template
|
||||||
*/
|
*/
|
||||||
public static void serverApplyTemplate(Realm realm, Entity creature, CreatureTemplate template){
|
public static void serverApplyTemplate(Realm realm, Entity creature, ObjectTemplate template){
|
||||||
//
|
//
|
||||||
//must happen after the player is attached to the entity, or server won't send packet to add item to player's entity
|
//must happen after the player is attached to the entity, or server won't send packet to add item to player's entity
|
||||||
//now that creature has been spawned, need to create all attached items
|
//now that creature has been spawned, need to create all attached items
|
||||||
if(template != null){
|
if(template != null){
|
||||||
if(template.getInventoryData() != null){
|
if(template.getInventoryData() != null){
|
||||||
CreatureInventoryData inventoryData = template.getInventoryData();
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
for(Entry<String,EntitySerialization> toolbarItem : inventoryData.getToolbarItems()){
|
for(Entry<String,EntitySerialization> toolbarItem : inventoryData.getToolbarItems()){
|
||||||
EntitySerialization serialization = toolbarItem.getValue();
|
EntitySerialization serialization = toolbarItem.getValue();
|
||||||
String toolbarSlot = toolbarItem.getKey();
|
String toolbarSlot = toolbarItem.getKey();
|
||||||
@ -365,7 +362,7 @@ public class CreatureUtils {
|
|||||||
*/
|
*/
|
||||||
public static Entity clientCreateViewModel(
|
public static Entity clientCreateViewModel(
|
||||||
String type,
|
String type,
|
||||||
CreatureTemplate template
|
ObjectTemplate template
|
||||||
){
|
){
|
||||||
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(type);
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -397,7 +394,7 @@ public class CreatureUtils {
|
|||||||
int id = creature.getId();
|
int id = creature.getId();
|
||||||
Vector3d position = EntityUtils.getPosition(creature);
|
Vector3d position = EntityUtils.getPosition(creature);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(creature);
|
Quaterniond rotation = EntityUtils.getRotation(creature);
|
||||||
String template = Utilities.stringify(CreatureUtils.getCreatureTemplate(creature));
|
String template = Utilities.stringify(CommonEntityUtils.getObjectTemplate(creature));
|
||||||
NetworkMessage message = EntityMessage.constructCreateMessage(
|
NetworkMessage message = EntityMessage.constructCreateMessage(
|
||||||
id,
|
id,
|
||||||
EntityType.CREATURE.getValue(),
|
EntityType.CREATURE.getValue(),
|
||||||
@ -543,53 +540,8 @@ public class CreatureUtils {
|
|||||||
return (ClientIdleTree)e.getData(EntityDataStrings.TREE_IDLE);
|
return (ClientIdleTree)e.getData(EntityDataStrings.TREE_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCreatureTemplate(Entity e, CreatureTemplate template){
|
public static void setCreatureTemplate(Entity e, ObjectTemplate template){
|
||||||
e.putData(EntityDataStrings.CREATURE_TEMPLATE, template);
|
e.putData(EntityDataStrings.OBJECT_TEMPLATE, template);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the template for the creature
|
|
||||||
* @param e The creature
|
|
||||||
* @return The template
|
|
||||||
*/
|
|
||||||
public static CreatureTemplate getCreatureTemplate(Entity e){
|
|
||||||
CreatureTemplate template = (CreatureTemplate)e.getData(EntityDataStrings.CREATURE_TEMPLATE);
|
|
||||||
CreatureInventoryData inventoryData = template.getInventoryData();
|
|
||||||
inventoryData.clear();
|
|
||||||
if(ServerEquipState.hasEquipState(e)){
|
|
||||||
ServerEquipState serverEquipState = ServerEquipState.getEquipState(e);
|
|
||||||
for(String point : serverEquipState.equippedPoints()){
|
|
||||||
Entity item = serverEquipState.getEquippedItemAtPoint(point);
|
|
||||||
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(item);
|
|
||||||
inventoryData.addEquippedItem(point, itemSerialized);
|
|
||||||
inventoryData.setEquippedId(point, item.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(InventoryUtils.hasToolbarInventory(e)){
|
|
||||||
RelationalInventoryState toolbarInventory = InventoryUtils.getToolbarInventory(e);
|
|
||||||
for(String slot : toolbarInventory.getSlots()){
|
|
||||||
Entity slotItem = toolbarInventory.getItemSlot(slot);
|
|
||||||
if(slotItem != null){
|
|
||||||
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(slotItem);
|
|
||||||
inventoryData.addToolbarItem(slot, itemSerialized);
|
|
||||||
inventoryData.setToolbarId(slot, slotItem.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(InventoryUtils.hasNaturalInventory(e)){
|
|
||||||
UnrelationalInventoryState toolbarInventory = InventoryUtils.getNaturalInventory(e);
|
|
||||||
int i = 0;
|
|
||||||
for(Entity item : toolbarInventory.getItems()){
|
|
||||||
if(item != null){
|
|
||||||
EntitySerialization itemSerialized = ContentSerialization.constructEntitySerialization(item);
|
|
||||||
inventoryData.addNaturalItem(itemSerialized);
|
|
||||||
inventoryData.setNaturalId(i, item.getId());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template.setStateCollection(StateCollection.getStateCollection(e));
|
|
||||||
return template;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ import java.util.Set;
|
|||||||
import electrosphere.server.entity.serialization.EntitySerialization;
|
import electrosphere.server.entity.serialization.EntitySerialization;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inventory data for a creature template
|
* Inventory data for a object template
|
||||||
*/
|
*/
|
||||||
public class CreatureInventoryData {
|
public class ObjectInventoryData {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbar items
|
* Toolbar items
|
||||||
@ -4,29 +4,35 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
||||||
import electrosphere.net.synchronization.transport.StateCollection;
|
import electrosphere.net.synchronization.transport.StateCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The template used to construct the creature on the client
|
* The template used to construct the object on the client
|
||||||
*/
|
*/
|
||||||
public class CreatureTemplate {
|
public class ObjectTemplate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the creature
|
* The type of the object
|
||||||
*/
|
*/
|
||||||
String creatureType;
|
String objectType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The category of entity
|
||||||
|
*/
|
||||||
|
EntityType entityType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attribute map for visual variants
|
* The attribute map for visual variants
|
||||||
*/
|
*/
|
||||||
private Map<String,CreatureTemplateAttributeValue> attributeMap = new HashMap<String,CreatureTemplateAttributeValue>();
|
private Map<String,TemplateAttributeValue> attributeMap = new HashMap<String,TemplateAttributeValue>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data about the inventory of the creature
|
* Data about the inventory of the object
|
||||||
*/
|
*/
|
||||||
private CreatureInventoryData inventoryData = new CreatureInventoryData();
|
private ObjectInventoryData inventoryData = new ObjectInventoryData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The collection of synchronized values
|
* The collection of synchronized values
|
||||||
@ -34,13 +40,15 @@ public class CreatureTemplate {
|
|||||||
private StateCollection stateCollection;
|
private StateCollection stateCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the creature template
|
* Creates the object template
|
||||||
* @param creatureType The type of creature
|
* @param category The category of entity
|
||||||
* @return The creature template
|
* @param subtype The type of object
|
||||||
|
* @return The object template
|
||||||
*/
|
*/
|
||||||
public static CreatureTemplate create(String creatureType){
|
public static ObjectTemplate create(EntityType category, String subtype){
|
||||||
CreatureTemplate rVal = new CreatureTemplate();
|
ObjectTemplate rVal = new ObjectTemplate();
|
||||||
rVal.creatureType = creatureType;
|
rVal.entityType = category;
|
||||||
|
rVal.objectType = subtype;
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +58,7 @@ public class CreatureTemplate {
|
|||||||
* @param value The value of the attribute
|
* @param value The value of the attribute
|
||||||
*/
|
*/
|
||||||
public void putAttributeValue(String attributeName, float value){
|
public void putAttributeValue(String attributeName, float value){
|
||||||
attributeMap.put(attributeName,new CreatureTemplateAttributeValue(value));
|
attributeMap.put(attributeName,new TemplateAttributeValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +67,7 @@ public class CreatureTemplate {
|
|||||||
* @param value The value of the attribute
|
* @param value The value of the attribute
|
||||||
*/
|
*/
|
||||||
public void putAttributeValue(String attributeName, String value){
|
public void putAttributeValue(String attributeName, String value){
|
||||||
attributeMap.put(attributeName,new CreatureTemplateAttributeValue(value));
|
attributeMap.put(attributeName,new TemplateAttributeValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,28 +75,28 @@ public class CreatureTemplate {
|
|||||||
* @param attributeName The name of the attribute
|
* @param attributeName The name of the attribute
|
||||||
* @return The value of the attribute
|
* @return The value of the attribute
|
||||||
*/
|
*/
|
||||||
public CreatureTemplateAttributeValue getAttributeValue(String attributeName){
|
public TemplateAttributeValue getAttributeValue(String attributeName){
|
||||||
return attributeMap.get(attributeName);
|
return attributeMap.get(attributeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the creature
|
* Gets the type of the object
|
||||||
* @return The type of the creature
|
* @return The type of the object
|
||||||
*/
|
*/
|
||||||
public String getCreatureType(){
|
public String getObjectType(){
|
||||||
return creatureType;
|
return objectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the inventory data for the creature
|
* Gets the inventory data for the object
|
||||||
* @return The inventory data
|
* @return The inventory data
|
||||||
*/
|
*/
|
||||||
public CreatureInventoryData getInventoryData(){
|
public ObjectInventoryData getInventoryData(){
|
||||||
return this.inventoryData;
|
return this.inventoryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the state collection for the creature
|
* Gets the state collection for the object
|
||||||
* @return The collection of synchronized values
|
* @return The collection of synchronized values
|
||||||
*/
|
*/
|
||||||
public StateCollection getStateCollection(){
|
public StateCollection getStateCollection(){
|
||||||
@ -96,7 +104,7 @@ public class CreatureTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the synchronized values for this creature
|
* Sets the synchronized values for this object
|
||||||
* @param stateCollection The synchronized values
|
* @param stateCollection The synchronized values
|
||||||
*/
|
*/
|
||||||
public void setStateCollection(StateCollection stateCollection){
|
public void setStateCollection(StateCollection stateCollection){
|
||||||
@ -104,13 +112,14 @@ public class CreatureTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a template for the creature with default values
|
* Creates a template for the object with default values
|
||||||
* @param creatureType The type of creature
|
* @param objectType The type of object
|
||||||
* @return The basic template
|
* @return The basic template
|
||||||
*/
|
*/
|
||||||
public static CreatureTemplate createDefault(String creatureType){
|
public static ObjectTemplate createDefault(EntityType category, String objectType){
|
||||||
CreatureTemplate storedTemplate = CreatureTemplate.create(creatureType);
|
ObjectTemplate storedTemplate = ObjectTemplate.create(category, objectType);
|
||||||
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(creatureType);
|
if(category == EntityType.CREATURE){
|
||||||
|
CreatureData rawType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(objectType);
|
||||||
if(rawType.getVisualAttributes() != null){
|
if(rawType.getVisualAttributes() != null){
|
||||||
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
for(VisualAttribute attributeType : rawType.getVisualAttributes()){
|
||||||
if(attributeType.getType().equals("remesh")){
|
if(attributeType.getType().equals("remesh")){
|
||||||
@ -128,13 +137,14 @@ public class CreatureTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return storedTemplate;
|
return storedTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visual attribute of a creature (ie how wide is their nose, what type of hairstyle do they have, etc)
|
* A visual attribute of an object (ie how wide is their nose, what type of hairstyle do they have, etc)
|
||||||
*/
|
*/
|
||||||
public class CreatureTemplateAttributeValue {
|
public class TemplateAttributeValue {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The string value of the attribute
|
* The string value of the attribute
|
||||||
@ -150,7 +160,7 @@ public class CreatureTemplate {
|
|||||||
* Creates a float attribute
|
* Creates a float attribute
|
||||||
* @param value The value
|
* @param value The value
|
||||||
*/
|
*/
|
||||||
public CreatureTemplateAttributeValue(float value){
|
public TemplateAttributeValue(float value){
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +168,7 @@ public class CreatureTemplate {
|
|||||||
* Creates a string attribute
|
* Creates a string attribute
|
||||||
* @param variantId The string
|
* @param variantId The string
|
||||||
*/
|
*/
|
||||||
public CreatureTemplateAttributeValue(String variantId){
|
public TemplateAttributeValue(String variantId){
|
||||||
this.variantId = variantId;
|
this.variantId = variantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import electrosphere.entity.state.physicssync.ClientPhysicsSyncTree;
|
|||||||
import electrosphere.entity.types.EntityTypes;
|
import electrosphere.entity.types.EntityTypes;
|
||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.foliage.FoliageUtils;
|
import electrosphere.entity.types.foliage.FoliageUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
@ -213,8 +213,8 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
*/
|
*/
|
||||||
static Entity spawnCreature(EntityMessage message){
|
static Entity spawnCreature(EntityMessage message){
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] Spawn Creature " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] Spawn Creature " + message.getentityID() + " at " + message.getpositionX() + " " + message.getpositionY() + " " + message.getpositionZ());
|
||||||
CreatureTemplate template = Utilities.deserialize(message.getcreatureTemplate(), CreatureTemplate.class);
|
ObjectTemplate template = Utilities.deserialize(message.getcreatureTemplate(), ObjectTemplate.class);
|
||||||
Entity newlySpawnedEntity = CreatureUtils.clientSpawnBasicCreature(template.getCreatureType(),template);
|
Entity newlySpawnedEntity = CreatureUtils.clientSpawnBasicCreature(template.getObjectType(),template);
|
||||||
ClientEntityUtils.initiallyPositionEntity(
|
ClientEntityUtils.initiallyPositionEntity(
|
||||||
newlySpawnedEntity,
|
newlySpawnedEntity,
|
||||||
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package electrosphere.net.server;
|
package electrosphere.net.server;
|
||||||
|
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.parser.net.message.AuthMessage;
|
import electrosphere.net.parser.net.message.AuthMessage;
|
||||||
@ -90,7 +90,7 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
/**
|
/**
|
||||||
* the creature template associated with this player
|
* the creature template associated with this player
|
||||||
*/
|
*/
|
||||||
CreatureTemplate currentCreatureTemplate;
|
ObjectTemplate currentCreatureTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the server protocol object associated with this player
|
* the server protocol object associated with this player
|
||||||
@ -438,7 +438,7 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
* Sets the current creature template for the connection
|
* Sets the current creature template for the connection
|
||||||
* @param currentCreatureTemplate The new creature template
|
* @param currentCreatureTemplate The new creature template
|
||||||
*/
|
*/
|
||||||
public void setCreatureTemplate(CreatureTemplate currentCreatureTemplate){
|
public void setCreatureTemplate(ObjectTemplate currentCreatureTemplate){
|
||||||
this.currentCreatureTemplate = currentCreatureTemplate;
|
this.currentCreatureTemplate = currentCreatureTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ public class ServerConnectionHandler implements Runnable {
|
|||||||
* Gets the current creature template for the connection
|
* Gets the current creature template for the connection
|
||||||
* @return The current template
|
* @return The current template
|
||||||
*/
|
*/
|
||||||
public CreatureTemplate getCurrentCreatureTemplate(){
|
public ObjectTemplate getCurrentCreatureTemplate(){
|
||||||
return this.currentCreatureTemplate;
|
return this.currentCreatureTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import electrosphere.entity.Entity;
|
|||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.ServerEntityUtils;
|
import electrosphere.entity.ServerEntityUtils;
|
||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
||||||
import electrosphere.net.parser.net.message.CharacterMessage;
|
import electrosphere.net.parser.net.message.CharacterMessage;
|
||||||
@ -67,11 +67,11 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
public void handleSyncMessage(ServerConnectionHandler connectionHandler, CharacterMessage message) {
|
public void handleSyncMessage(ServerConnectionHandler connectionHandler, CharacterMessage message) {
|
||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case REQUESTCREATECHARACTER: {
|
case REQUESTCREATECHARACTER: {
|
||||||
CreatureTemplate template = Utilities.deserialize(message.getdata(), CreatureTemplate.class);
|
ObjectTemplate template = Utilities.deserialize(message.getdata(), ObjectTemplate.class);
|
||||||
if(template != null){
|
if(template != null){
|
||||||
Character charaData = Globals.characterService.createCharacter(template, connectionHandler.getPlayer().getDBID());
|
Character charaData = Globals.characterService.createCharacter(template, connectionHandler.getPlayer().getDBID());
|
||||||
charaData.setPos(Globals.realmManager.first().getSpawnPoint());
|
charaData.setPos(Globals.realmManager.first().getSpawnPoint());
|
||||||
connectionHandler.setCreatureTemplate(Utilities.deserialize(message.getdata(), CreatureTemplate.class));
|
connectionHandler.setCreatureTemplate(Utilities.deserialize(message.getdata(), ObjectTemplate.class));
|
||||||
connectionHandler.setCharacterId(charaData.getId());
|
connectionHandler.setCharacterId(charaData.getId());
|
||||||
connectionHandler.addMessagetoOutgoingQueue(CharacterMessage.constructResponseCreateCharacterSuccessMessage());
|
connectionHandler.addMessagetoOutgoingQueue(CharacterMessage.constructResponseCreateCharacterSuccessMessage());
|
||||||
} else {
|
} else {
|
||||||
@ -128,7 +128,7 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
*/
|
*/
|
||||||
static Entity swapPlayerCharacter(ServerConnectionHandler connectionHandler){
|
static Entity swapPlayerCharacter(ServerConnectionHandler connectionHandler){
|
||||||
//change the connection handler's creature template
|
//change the connection handler's creature template
|
||||||
if(connectionHandler.getCurrentCreatureTemplate() != null && connectionHandler.getCurrentCreatureTemplate().getCreatureType().matches(LoadingUtils.EDITOR_RACE_NAME)){
|
if(connectionHandler.getCurrentCreatureTemplate() != null && connectionHandler.getCurrentCreatureTemplate().getObjectType().matches(LoadingUtils.EDITOR_RACE_NAME)){
|
||||||
//solve what race to pick
|
//solve what race to pick
|
||||||
String race = LoadingUtils.EDITOR_RACE_NAME;
|
String race = LoadingUtils.EDITOR_RACE_NAME;
|
||||||
List<String> races = Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces();
|
List<String> races = Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces();
|
||||||
@ -137,7 +137,7 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
}
|
}
|
||||||
//create template
|
//create template
|
||||||
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
CreatureTemplate template = CreatureTemplate.create(race);
|
ObjectTemplate template = ObjectTemplate.create(EntityType.CREATURE, race);
|
||||||
for(VisualAttribute attribute : type.getVisualAttributes()){
|
for(VisualAttribute attribute : type.getVisualAttributes()){
|
||||||
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
||||||
float min = attribute.getMinValue();
|
float min = attribute.getMinValue();
|
||||||
@ -167,7 +167,7 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
} else {
|
} else {
|
||||||
String race = LoadingUtils.EDITOR_RACE_NAME;
|
String race = LoadingUtils.EDITOR_RACE_NAME;
|
||||||
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData type = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
CreatureTemplate template = CreatureTemplate.create(race);
|
ObjectTemplate template = ObjectTemplate.create(EntityType.CREATURE, race);
|
||||||
for(VisualAttribute attribute : type.getVisualAttributes()){
|
for(VisualAttribute attribute : type.getVisualAttributes()){
|
||||||
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
if(attribute.getType().equals(VisualAttribute.TYPE_BONE)){
|
||||||
float min = attribute.getMinValue();
|
float min = attribute.getMinValue();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import electrosphere.entity.state.server.ServerCharacterData;
|
|||||||
import electrosphere.entity.types.EntityTypes;
|
import electrosphere.entity.types.EntityTypes;
|
||||||
import electrosphere.entity.types.EntityTypes.EntityType;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.foliage.FoliageUtils;
|
import electrosphere.entity.types.foliage.FoliageUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
@ -71,8 +71,8 @@ public class ContentSerialization {
|
|||||||
case CREATURE: {
|
case CREATURE: {
|
||||||
serializedEntity.setType(EntityType.CREATURE.getValue());
|
serializedEntity.setType(EntityType.CREATURE.getValue());
|
||||||
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
serializedEntity.setSubtype(CommonEntityUtils.getEntitySubtype(entity));
|
||||||
if(CreatureUtils.getCreatureTemplate(entity) != null){
|
if(CommonEntityUtils.getObjectTemplate(entity) != null){
|
||||||
serializedEntity.setTemplate(Utilities.stringify(CreatureUtils.getCreatureTemplate(entity)));
|
serializedEntity.setTemplate(Utilities.stringify(CommonEntityUtils.getObjectTemplate(entity)));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case ITEM: {
|
case ITEM: {
|
||||||
@ -123,9 +123,9 @@ public class ContentSerialization {
|
|||||||
}
|
}
|
||||||
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
||||||
case CREATURE: {
|
case CREATURE: {
|
||||||
CreatureTemplate template = null;
|
ObjectTemplate template = null;
|
||||||
if(serializedEntity.getTemplate() != null){
|
if(serializedEntity.getTemplate() != null){
|
||||||
template = Utilities.deserialize(serializedEntity.getTemplate(), CreatureTemplate.class);
|
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -162,9 +162,9 @@ public class ContentSerialization {
|
|||||||
Entity rVal = null;
|
Entity rVal = null;
|
||||||
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
switch(EntityTypes.fromInt(serializedEntity.getType())){
|
||||||
case CREATURE: {
|
case CREATURE: {
|
||||||
CreatureTemplate template = null;
|
ObjectTemplate template = null;
|
||||||
if(serializedEntity.getTemplate() != null){
|
if(serializedEntity.getTemplate() != null){
|
||||||
template = Utilities.deserialize(serializedEntity.getTemplate(), CreatureTemplate.class);
|
template = Utilities.deserialize(serializedEntity.getTemplate(), ObjectTemplate.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -6,7 +6,8 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.equip.ServerEquipState;
|
import electrosphere.entity.state.equip.ServerEquipState;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.game.data.units.UnitDefinition;
|
import electrosphere.game.data.units.UnitDefinition;
|
||||||
@ -39,7 +40,7 @@ public class UnitUtils {
|
|||||||
LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException("Tried to spawn unit with invalid creatureId! \"" + creatureId + "\""));
|
LoggerInterface.loggerEngine.ERROR(new IllegalArgumentException("Tried to spawn unit with invalid creatureId! \"" + creatureId + "\""));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Entity rVal = CreatureUtils.serverSpawnBasicCreature(realm, position, creatureId, CreatureTemplate.createDefault(creatureId));
|
Entity rVal = CreatureUtils.serverSpawnBasicCreature(realm, position, creatureId, ObjectTemplate.createDefault(EntityType.CREATURE, creatureId));
|
||||||
|
|
||||||
//optionally apply ai
|
//optionally apply ai
|
||||||
if(unitDefinition.getAI() != null){
|
if(unitDefinition.getAI() != null){
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.server.macro.character.data.CharacterData;
|
import electrosphere.server.macro.character.data.CharacterData;
|
||||||
import electrosphere.server.macro.spatial.MacroObject;
|
import electrosphere.server.macro.spatial.MacroObject;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class Character implements MacroObject {
|
|||||||
/**
|
/**
|
||||||
* The creature template
|
* The creature template
|
||||||
*/
|
*/
|
||||||
CreatureTemplate creatureTemplate;
|
ObjectTemplate creatureTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position of the character object
|
* The position of the character object
|
||||||
@ -103,7 +103,7 @@ public class Character implements MacroObject {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param template
|
* @param template
|
||||||
*/
|
*/
|
||||||
public Character(CreatureTemplate template){
|
public Character(ObjectTemplate template){
|
||||||
this.creatureTemplate = template;
|
this.creatureTemplate = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class Character implements MacroObject {
|
|||||||
* Gets the creature template for the character
|
* Gets the creature template for the character
|
||||||
* @return The template
|
* @return The template
|
||||||
*/
|
*/
|
||||||
public CreatureTemplate getCreatureTemplate() {
|
public ObjectTemplate getCreatureTemplate() {
|
||||||
return creatureTemplate;
|
return creatureTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class Character implements MacroObject {
|
|||||||
* Sets the creature template for the character
|
* Sets the creature template for the character
|
||||||
* @param creatureTemplate The template
|
* @param creatureTemplate The template
|
||||||
*/
|
*/
|
||||||
public void setCreatureTemplate(CreatureTemplate creatureTemplate) {
|
public void setCreatureTemplate(ObjectTemplate creatureTemplate) {
|
||||||
this.creatureTemplate = creatureTemplate;
|
this.creatureTemplate = creatureTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,8 @@ package electrosphere.server.macro.character;
|
|||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
import electrosphere.server.macro.MacroData;
|
import electrosphere.server.macro.MacroData;
|
||||||
import electrosphere.server.macro.character.data.CharacterAssociatedId;
|
import electrosphere.server.macro.character.data.CharacterAssociatedId;
|
||||||
@ -93,7 +94,7 @@ public class CharacterUtils {
|
|||||||
public static Character spawnCharacter(Realm realm, Vector3d position, String race){
|
public static Character spawnCharacter(Realm realm, Vector3d position, String race){
|
||||||
Race raceData = Globals.gameConfigCurrent.getRaceMap().getRace(race);
|
Race raceData = Globals.gameConfigCurrent.getRaceMap().getRace(race);
|
||||||
String creatureType = raceData.getAssociatedCreature();
|
String creatureType = raceData.getAssociatedCreature();
|
||||||
Character rVal = Globals.characterService.createCharacter(CreatureTemplate.createDefault(creatureType), CharacterService.NO_PLAYER);
|
Character rVal = Globals.characterService.createCharacter(ObjectTemplate.createDefault(EntityType.CREATURE, creatureType), CharacterService.NO_PLAYER);
|
||||||
rVal.setPos(position);
|
rVal.setPos(position);
|
||||||
Race.setRace(rVal, Race.create(race, creatureType));
|
Race.setRace(rVal, Race.create(race, creatureType));
|
||||||
realm.getDataCellManager().evaluateMacroObject(rVal);
|
realm.getDataCellManager().evaluateMacroObject(rVal);
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.server.ServerCharacterData;
|
import electrosphere.entity.state.server.ServerCharacterData;
|
||||||
import electrosphere.entity.state.server.ServerPlayerViewDirTree;
|
import electrosphere.entity.state.server.ServerPlayerViewDirTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.server.ServerConnectionHandler;
|
import electrosphere.net.server.ServerConnectionHandler;
|
||||||
@ -32,11 +32,11 @@ public class PlayerCharacterCreation {
|
|||||||
//
|
//
|
||||||
//get template
|
//get template
|
||||||
Character charaData = Globals.characterService.getCharacter(connectionHandler.getCharacterId());
|
Character charaData = Globals.characterService.getCharacter(connectionHandler.getCharacterId());
|
||||||
CreatureTemplate template = charaData.getCreatureTemplate();
|
ObjectTemplate template = charaData.getCreatureTemplate();
|
||||||
if(connectionHandler.getCharacterId() == CharacterProtocol.SPAWN_EXISTING_TEMPLATE){
|
if(connectionHandler.getCharacterId() == CharacterProtocol.SPAWN_EXISTING_TEMPLATE){
|
||||||
template = connectionHandler.getCurrentCreatureTemplate();
|
template = connectionHandler.getCurrentCreatureTemplate();
|
||||||
}
|
}
|
||||||
String raceName = template.getCreatureType();
|
String raceName = template.getObjectType();
|
||||||
|
|
||||||
//
|
//
|
||||||
//spawn entity in world
|
//spawn entity in world
|
||||||
|
|||||||
@ -16,8 +16,8 @@ import electrosphere.engine.signal.SignalServiceImpl;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.server.ServerCharacterData;
|
import electrosphere.entity.state.server.ServerCharacterData;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.server.datacell.ServerWorldData;
|
import electrosphere.server.datacell.ServerWorldData;
|
||||||
import electrosphere.server.db.DatabaseResult;
|
import electrosphere.server.db.DatabaseResult;
|
||||||
@ -62,7 +62,7 @@ public class CharacterService extends SignalServiceImpl {
|
|||||||
* @param template The creature template for the character
|
* @param template The creature template for the character
|
||||||
* @param playerId The player's id
|
* @param playerId The player's id
|
||||||
*/
|
*/
|
||||||
public Character createCharacter(CreatureTemplate template, int playerId){
|
public Character createCharacter(ObjectTemplate template, int playerId){
|
||||||
if(template == null){
|
if(template == null){
|
||||||
throw new Error("Template is null!");
|
throw new Error("Template is null!");
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ public class CharacterService extends SignalServiceImpl {
|
|||||||
Character charaData = characterData.getCharacterData();
|
Character charaData = characterData.getCharacterData();
|
||||||
|
|
||||||
//serialize
|
//serialize
|
||||||
charaData.setCreatureTemplate(CreatureUtils.getCreatureTemplate(characterEntity));
|
charaData.setCreatureTemplate(CommonEntityUtils.getObjectTemplate(characterEntity));
|
||||||
charaData.setPos(EntityUtils.getPosition(characterEntity));
|
charaData.setPos(EntityUtils.getPosition(characterEntity));
|
||||||
String toStore = SerializationUtils.serialize(charaData);
|
String toStore = SerializationUtils.serialize(charaData);
|
||||||
|
|
||||||
@ -254,10 +254,10 @@ public class CharacterService extends SignalServiceImpl {
|
|||||||
public void saveAll(){
|
public void saveAll(){
|
||||||
lock.lock();
|
lock.lock();
|
||||||
for(Character chara : this.loadedCharacterMap.values()){
|
for(Character chara : this.loadedCharacterMap.values()){
|
||||||
CreatureTemplate template = chara.getCreatureTemplate();
|
ObjectTemplate template = chara.getCreatureTemplate();
|
||||||
if(this.characterEntityMap.containsKey(chara)){
|
if(this.characterEntityMap.containsKey(chara)){
|
||||||
Entity characterEntity = this.characterEntityMap.get(chara);
|
Entity characterEntity = this.characterEntityMap.get(chara);
|
||||||
template = CreatureUtils.getCreatureTemplate(characterEntity);
|
template = CommonEntityUtils.getObjectTemplate(characterEntity);
|
||||||
chara.setCreatureTemplate(template);
|
chara.setCreatureTemplate(template);
|
||||||
chara.setPos(EntityUtils.getPosition(characterEntity));
|
chara.setPos(EntityUtils.getPosition(characterEntity));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.types.creature.CreatureInventoryData;
|
import electrosphere.entity.types.creature.ObjectInventoryData;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.server.entity.serialization.EntitySerialization;
|
import electrosphere.server.entity.serialization.EntitySerialization;
|
||||||
import electrosphere.server.macro.character.Character;
|
import electrosphere.server.macro.character.Character;
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ public class CharaInventoryUtils {
|
|||||||
* @return The list of all items in the character's inventories
|
* @return The list of all items in the character's inventories
|
||||||
*/
|
*/
|
||||||
public static List<EntitySerialization> getInventoryContents(Character chara){
|
public static List<EntitySerialization> getInventoryContents(Character chara){
|
||||||
CreatureTemplate template = chara.getCreatureTemplate();
|
ObjectTemplate template = chara.getCreatureTemplate();
|
||||||
if(CharaMacroUtils.isMicroSim(chara)){
|
if(CharaMacroUtils.isMicroSim(chara)){
|
||||||
Entity creature = Globals.characterService.getEntity(chara);
|
Entity creature = Globals.characterService.getEntity(chara);
|
||||||
template = CreatureUtils.getCreatureTemplate(creature);
|
template = CommonEntityUtils.getObjectTemplate(creature);
|
||||||
}
|
}
|
||||||
CreatureInventoryData inventoryData = template.getInventoryData();
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
return inventoryData.getAllItems();
|
return inventoryData.getAllItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,9 @@ import org.joml.Vector3d;
|
|||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.foliage.FoliageUtils;
|
import electrosphere.entity.types.foliage.FoliageUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
@ -36,7 +37,7 @@ public class SpawnAllEntitiesTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
CreatureTypeLoader creatureLoader = Globals.gameConfigCurrent.getCreatureTypeLoader();
|
CreatureTypeLoader creatureLoader = Globals.gameConfigCurrent.getCreatureTypeLoader();
|
||||||
for(CreatureData creature : creatureLoader.getTypes()){
|
for(CreatureData creature : creatureLoader.getTypes()){
|
||||||
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), creature.getId(), CreatureTemplate.createDefault(creature.getId()));
|
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), creature.getId(), ObjectTemplate.createDefault(EntityType.CREATURE, creature.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemDataMap itemMap = Globals.gameConfigCurrent.getItemMap();
|
ItemDataMap itemMap = Globals.gameConfigCurrent.getItemMap();
|
||||||
|
|||||||
@ -6,7 +6,8 @@ import org.joml.Vector3d;
|
|||||||
|
|
||||||
import electrosphere.test.annotations.IntegrationTest;
|
import electrosphere.test.annotations.IntegrationTest;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
import electrosphere.test.testutils.TestEntityUtils;
|
import electrosphere.test.testutils.TestEntityUtils;
|
||||||
@ -19,7 +20,7 @@ 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
|
||||||
@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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
assertEquals(1, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
|
assertEquals(1, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ public class SpawningCreaturesTest extends EntityTestTemplate {
|
|||||||
public void testSpawnMultipleCreatures(){
|
public void testSpawnMultipleCreatures(){
|
||||||
int numberToSpawn = 100;
|
int numberToSpawn = 100;
|
||||||
for(int i = 0; i < numberToSpawn; i++){
|
for(int i = 0; i < numberToSpawn; i++){
|
||||||
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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
}
|
}
|
||||||
assertEquals(numberToSpawn, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
|
assertEquals(numberToSpawn, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,8 @@ import electrosphere.entity.state.inventory.InventoryUtils;
|
|||||||
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
||||||
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
@ -35,7 +36,7 @@ public class ServerAttackTreeTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn on server
|
//spawn on server
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
|
|
||||||
//equip
|
//equip
|
||||||
@ -70,7 +71,7 @@ public class ServerAttackTreeTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn on server
|
//spawn on server
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
|
|
||||||
//equip
|
//equip
|
||||||
|
|||||||
@ -9,7 +9,8 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityTags;
|
import electrosphere.entity.EntityTags;
|
||||||
import electrosphere.entity.state.movement.fall.ClientFallTree;
|
import electrosphere.entity.state.movement.fall.ClientFallTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
import electrosphere.test.testutils.TestEngineUtils;
|
import electrosphere.test.testutils.TestEngineUtils;
|
||||||
@ -25,7 +26,7 @@ public class ClientCollidableTreeTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn on server
|
//spawn on server
|
||||||
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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
//wait for the creature to land
|
//wait for the creature to land
|
||||||
TestEngineUtils.simulateFrames(3);
|
TestEngineUtils.simulateFrames(3);
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import electrosphere.test.annotations.IntegrationTest;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
import electrosphere.test.testutils.TestEngineUtils;
|
import electrosphere.test.testutils.TestEngineUtils;
|
||||||
@ -24,7 +25,7 @@ public class ServerCollidableTreeTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn on server
|
//spawn on server
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
//wait for the creature to land
|
//wait for the creature to land
|
||||||
TestEngineUtils.simulateFrames(3);
|
TestEngineUtils.simulateFrames(3);
|
||||||
|
|||||||
@ -16,7 +16,8 @@ import electrosphere.entity.EntityTags;
|
|||||||
import electrosphere.entity.state.attach.AttachUtils;
|
import electrosphere.entity.state.attach.AttachUtils;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
@ -39,7 +40,7 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
|
|
||||||
//spawn entities
|
//spawn entities
|
||||||
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
||||||
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate);
|
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");
|
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,8 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.attach.AttachUtils;
|
import electrosphere.entity.state.attach.AttachUtils;
|
||||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.entity.types.item.ItemUtils;
|
import electrosphere.entity.types.item.ItemUtils;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
@ -31,7 +32,7 @@ public class ServerEquipStateTests extends EntityTestTemplate {
|
|||||||
public void testServerEquipItem(){
|
public void testServerEquipItem(){
|
||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
//spawn entities
|
//spawn entities
|
||||||
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
||||||
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate);
|
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");
|
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class ServerEquipStateTests extends EntityTestTemplate {
|
|||||||
public void testServerFailEquipToOccupied(){
|
public void testServerFailEquipToOccupied(){
|
||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
//spawn entities
|
//spawn entities
|
||||||
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
||||||
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate);
|
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");
|
Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
Entity katana2 = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
Entity katana2 = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import org.joml.Vector3d;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
import electrosphere.entity.state.movement.jump.ClientJumpTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.test.annotations.IntegrationTest;
|
import electrosphere.test.annotations.IntegrationTest;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
@ -21,7 +22,7 @@ public class ClientFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AtRest_false(){
|
public void isFalling_AtRest_false(){
|
||||||
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", CreatureTemplate.createDefault("human"));
|
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
||||||
|
|
||||||
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
||||||
@ -30,7 +31,7 @@ public class ClientFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AfterJump_true(){
|
public void isFalling_AfterJump_true(){
|
||||||
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", CreatureTemplate.createDefault("human"));
|
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
||||||
|
|
||||||
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
||||||
@ -43,7 +44,7 @@ public class ClientFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AfterLand_false(){
|
public void isFalling_AfterLand_false(){
|
||||||
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", CreatureTemplate.createDefault("human"));
|
Entity serverEntity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(), "human", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
Entity clientEntity = TestEngineUtils.getClientEquivalent(serverEntity);
|
||||||
|
|
||||||
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
ClientFallTree clientFallTree = ClientFallTree.getFallTree(clientEntity);
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import org.joml.Vector3d;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.state.movement.jump.ServerJumpTree;
|
import electrosphere.entity.state.movement.jump.ServerJumpTree;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.test.annotations.IntegrationTest;
|
import electrosphere.test.annotations.IntegrationTest;
|
||||||
import electrosphere.test.template.EntityTestTemplate;
|
import electrosphere.test.template.EntityTestTemplate;
|
||||||
@ -22,7 +23,7 @@ public class ServerFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AtRest_false(){
|
public void isFalling_AtRest_false(){
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
||||||
assertEquals(false, serverFallTree.isFalling());
|
assertEquals(false, serverFallTree.isFalling());
|
||||||
@ -30,7 +31,7 @@ public class ServerFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AfterJump_true(){
|
public void isFalling_AfterJump_true(){
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
||||||
ServerJumpTree serverJumpTree = ServerJumpTree.getServerJumpTree(creature);
|
ServerJumpTree serverJumpTree = ServerJumpTree.getServerJumpTree(creature);
|
||||||
@ -45,7 +46,7 @@ public class ServerFallTreeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void isFalling_AfterLand_false(){
|
public void isFalling_AfterLand_false(){
|
||||||
Entity creature = 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", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
ServerFallTree serverFallTree = ServerFallTree.getFallTree(creature);
|
||||||
ServerJumpTree serverJumpTree = ServerJumpTree.getServerJumpTree(creature);
|
ServerJumpTree serverJumpTree = ServerJumpTree.getServerJumpTree(creature);
|
||||||
|
|||||||
@ -8,7 +8,8 @@ import electrosphere.test.annotations.IntegrationTest;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.ServerEntityUtils;
|
import electrosphere.entity.ServerEntityUtils;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.server.ai.blackboard.Blackboard;
|
import electrosphere.server.ai.blackboard.Blackboard;
|
||||||
import electrosphere.server.ai.nodes.AITreeNode.AITreeNodeResult;
|
import electrosphere.server.ai.nodes.AITreeNode.AITreeNodeResult;
|
||||||
@ -26,7 +27,7 @@ public class MeleeTargetingNodeTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
//spawn test entities
|
//spawn test entities
|
||||||
Entity swordsman = UnitUtils.spawnUnit(Globals.realmManager.first(), new Vector3d(0,0,0), "humanSwordsman");
|
Entity swordsman = UnitUtils.spawnUnit(Globals.realmManager.first(), new Vector3d(0,0,0), "humanSwordsman");
|
||||||
Entity target = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(1,0,0), "human", CreatureTemplate.createDefault("human"));
|
Entity target = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(1,0,0), "human", ObjectTemplate.createDefault(EntityType.CREATURE, "human"));
|
||||||
|
|
||||||
//check if the swordsman can find a target
|
//check if the swordsman can find a target
|
||||||
Blackboard blackboard = new Blackboard();
|
Blackboard blackboard = new Blackboard();
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.engine.Main;
|
import electrosphere.engine.Main;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread;
|
import electrosphere.engine.loadingthreads.LoadingThread;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
import electrosphere.net.server.ServerConnectionHandler;
|
import electrosphere.net.server.ServerConnectionHandler;
|
||||||
import electrosphere.server.datacell.utils.EntityLookupUtils;
|
import electrosphere.server.datacell.utils.EntityLookupUtils;
|
||||||
import electrosphere.server.macro.character.PlayerCharacterCreation;
|
import electrosphere.server.macro.character.PlayerCharacterCreation;
|
||||||
@ -161,7 +162,7 @@ public class TestEngineUtils {
|
|||||||
* @return The entity
|
* @return The entity
|
||||||
*/
|
*/
|
||||||
public static void spawnPlayerEntity(){
|
public static void spawnPlayerEntity(){
|
||||||
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human");
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
||||||
ServerConnectionHandler serverConnection = Globals.server.getFirstConnection();
|
ServerConnectionHandler serverConnection = Globals.server.getFirstConnection();
|
||||||
serverConnection.setCreatureTemplate(creatureTemplate);
|
serverConnection.setCreatureTemplate(creatureTemplate);
|
||||||
Character chara = Globals.characterService.createCharacter(creatureTemplate, serverConnection.getPlayerId());
|
Character chara = Globals.characterService.createCharacter(creatureTemplate, serverConnection.getPlayerId());
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import org.joml.Vector3d;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread;
|
import electrosphere.engine.loadingthreads.LoadingThread;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.ObjectTemplate;
|
||||||
|
import electrosphere.entity.types.EntityTypes.EntityType;
|
||||||
import electrosphere.entity.types.creature.CreatureUtils;
|
import electrosphere.entity.types.creature.CreatureUtils;
|
||||||
import electrosphere.net.NetUtils;
|
import electrosphere.net.NetUtils;
|
||||||
import electrosphere.net.server.ServerConnectionHandler;
|
import electrosphere.net.server.ServerConnectionHandler;
|
||||||
@ -29,7 +30,7 @@ public class TestViewportUtils {
|
|||||||
*/
|
*/
|
||||||
public static Entity spawnPlayerCharacter(String creatureType){
|
public static Entity spawnPlayerCharacter(String creatureType){
|
||||||
//spawn creature
|
//spawn creature
|
||||||
CreatureTemplate creatureTemplate = CreatureTemplate.createDefault(creatureType);
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, creatureType);
|
||||||
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), creatureType, creatureTemplate);
|
Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), creatureType, creatureTemplate);
|
||||||
|
|
||||||
//get required data
|
//get required data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user