inventory data definition
This commit is contained in:
parent
1a9bd8daa5
commit
e68e637a84
@ -7,7 +7,6 @@
|
||||
"tokens" : [
|
||||
"TARGETABLE",
|
||||
"CAN_EQUIP",
|
||||
"INVENTORY",
|
||||
"OUTLINE",
|
||||
"PLAYABLE",
|
||||
"UNIT_CONTROLS",
|
||||
@ -47,6 +46,9 @@
|
||||
"primarySlot" : "handRight",
|
||||
"combinedSlot" : "handsCombined"
|
||||
},
|
||||
"inventoryData" : {
|
||||
"naturalSize" : 10
|
||||
},
|
||||
"attackMoves" : [],
|
||||
"healthSystem" : {
|
||||
"maxHealth" : 100,
|
||||
|
||||
@ -74,11 +74,13 @@
|
||||
"GRAVITY",
|
||||
"TARGETABLE",
|
||||
"CAN_EQUIP",
|
||||
"INVENTORY",
|
||||
"OUTLINE",
|
||||
"PLAYABLE",
|
||||
"UNIT_CONTROLS"
|
||||
],
|
||||
"inventoryData" : {
|
||||
"naturalSize" : 10
|
||||
},
|
||||
"visualAttributes" : [
|
||||
{
|
||||
"attributeId" : "TorsoHeight",
|
||||
|
||||
@ -61,11 +61,13 @@
|
||||
"GRAVITY",
|
||||
"TARGETABLE",
|
||||
"CAN_EQUIP",
|
||||
"INVENTORY",
|
||||
"OUTLINE",
|
||||
"PLAYABLE",
|
||||
"UNIT_CONTROLS"
|
||||
],
|
||||
"inventoryData" : {
|
||||
"naturalSize" : 10
|
||||
},
|
||||
"visualAttributes" : [
|
||||
],
|
||||
"movementSystems" : [
|
||||
|
||||
@ -1744,6 +1744,8 @@ Crops replace loot pool on completion of growth
|
||||
Display name for all common entity data
|
||||
Enitity id collision validation
|
||||
Full-sized wheat plants spawn in forest now
|
||||
Natural inventory size explicitly defined in data
|
||||
Fix server life tree missing nullcheck
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import electrosphere.data.collidable.CollidableTemplate;
|
||||
import electrosphere.data.collidable.HitboxData;
|
||||
import electrosphere.data.common.camera.CameraData;
|
||||
import electrosphere.data.common.interact.InteractionData;
|
||||
import electrosphere.data.common.item.InventoryDescription;
|
||||
import electrosphere.data.common.item.SpawnItemDescription;
|
||||
import electrosphere.data.common.life.HealthSystem;
|
||||
import electrosphere.data.common.light.PointLightDescription;
|
||||
@ -173,6 +174,11 @@ public class CommonEntityType {
|
||||
*/
|
||||
GrowthData growthData;
|
||||
|
||||
/**
|
||||
* The data on the inventory of this entity
|
||||
*/
|
||||
InventoryDescription inventoryData;
|
||||
|
||||
/**
|
||||
* Gets the id for this creature type
|
||||
* @return The id
|
||||
@ -453,5 +459,13 @@ public class CommonEntityType {
|
||||
return growthData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the inventory data for this object
|
||||
* @return The inventory data
|
||||
*/
|
||||
public InventoryDescription getInventoryData(){
|
||||
return inventoryData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package electrosphere.data.common.item;
|
||||
|
||||
/**
|
||||
* Describes the inventory on an inventory
|
||||
*/
|
||||
public class InventoryDescription {
|
||||
|
||||
/**
|
||||
* The size of the natural inventory
|
||||
*/
|
||||
Integer naturalSize;
|
||||
|
||||
/**
|
||||
* Gets the size of the natural inventory
|
||||
* @return The size of the natural inventory
|
||||
*/
|
||||
public Integer getNaturalSize(){
|
||||
return naturalSize;
|
||||
}
|
||||
|
||||
}
|
||||
@ -387,10 +387,6 @@ public class CommonEntityUtils {
|
||||
case "TARGETABLE": {
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.TARGETABLE);
|
||||
} break;
|
||||
case "INVENTORY":
|
||||
entity.putData(EntityDataStrings.NATURAL_INVENTORY,UnrelationalInventoryState.createUnrelationalInventory(10));
|
||||
InventoryUtils.clientSetInventoryState(entity, ClientInventoryState.clientCreateInventoryState(entity));
|
||||
break;
|
||||
case "OUTLINE": {
|
||||
entity.putData(EntityDataStrings.DRAW_OUTLINE, true);
|
||||
} break;
|
||||
@ -445,6 +441,12 @@ public class CommonEntityUtils {
|
||||
ClientLifeTree.attachTree(entity,rawType.getHealthSystem());
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.LIFE_STATE);
|
||||
}
|
||||
if(rawType.getInventoryData() != null){
|
||||
if(rawType.getInventoryData().getNaturalSize() != null){
|
||||
entity.putData(EntityDataStrings.NATURAL_INVENTORY,UnrelationalInventoryState.createUnrelationalInventory(rawType.getInventoryData().getNaturalSize()));
|
||||
InventoryUtils.clientSetInventoryState(entity, ClientInventoryState.clientCreateInventoryState(entity));
|
||||
}
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
@ -698,10 +700,6 @@ public class CommonEntityUtils {
|
||||
case "TARGETABLE": {
|
||||
ServerEntityTagUtils.attachTagToEntity(entity, EntityTags.TARGETABLE);
|
||||
} break;
|
||||
case "INVENTORY": {
|
||||
entity.putData(EntityDataStrings.NATURAL_INVENTORY,UnrelationalInventoryState.createUnrelationalInventory(10));
|
||||
InventoryUtils.serverSetInventoryState(entity, ServerInventoryState.serverCreateInventoryState(entity));
|
||||
} break;
|
||||
case "OUTLINE": {
|
||||
entity.putData(EntityDataStrings.DRAW_OUTLINE, true);
|
||||
} break;
|
||||
@ -762,6 +760,13 @@ public class CommonEntityUtils {
|
||||
ServerGrowthComponent.attachTree(entity, rawType.getGrowthData());
|
||||
}
|
||||
|
||||
if(rawType.getInventoryData() != null){
|
||||
if(rawType.getInventoryData().getNaturalSize() != null){
|
||||
entity.putData(EntityDataStrings.NATURAL_INVENTORY,UnrelationalInventoryState.createUnrelationalInventory(rawType.getInventoryData().getNaturalSize()));
|
||||
InventoryUtils.serverSetInventoryState(entity, ServerInventoryState.serverCreateInventoryState(entity));
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// AI (This SHOULD only be applied on the server with the way AI architected currently)
|
||||
|
||||
@ -166,11 +166,15 @@ public class ServerHitboxResolutionCallback implements CollisionResolutionCallba
|
||||
if(isItem){
|
||||
if(hitboxAttachParent != receiverEntity){
|
||||
ServerLifeTree serverLifeTree = ServerLifeTree.getServerLifeTree(receiverEntity);
|
||||
serverLifeTree.addCollisionEvent(impactorEntity, impactorShapeStatus, receiverShapeStatus, worldPos, isDamageEvent, isBlockEvent);
|
||||
if(serverLifeTree != null){
|
||||
serverLifeTree.addCollisionEvent(impactorEntity, impactorShapeStatus, receiverShapeStatus, worldPos, isDamageEvent, isBlockEvent);
|
||||
}
|
||||
}
|
||||
} else if(isCreature){
|
||||
ServerLifeTree serverLifeTree = ServerLifeTree.getServerLifeTree(receiverEntity);
|
||||
serverLifeTree.addCollisionEvent(impactorEntity, impactorShapeStatus, receiverShapeStatus, worldPos, isDamageEvent, isBlockEvent);
|
||||
if(serverLifeTree != null){
|
||||
serverLifeTree.addCollisionEvent(impactorEntity, impactorShapeStatus, receiverShapeStatus, worldPos, isDamageEvent, isBlockEvent);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user