diff --git a/assets/Data/entity/creatures/animals.json b/assets/Data/entity/creatures/animals.json index 49024f05..399a6ad1 100644 --- a/assets/Data/entity/creatures/animals.json +++ b/assets/Data/entity/creatures/animals.json @@ -2,6 +2,7 @@ "creatures" : [ { "id" : "Deer", + "displayName" : "Deer", "hitboxes" : [ { "type": "hurt", diff --git a/assets/Data/entity/creatures/editor.json b/assets/Data/entity/creatures/editor.json index 48bc8f18..4e805e50 100644 --- a/assets/Data/entity/creatures/editor.json +++ b/assets/Data/entity/creatures/editor.json @@ -2,6 +2,7 @@ "creatures" : [ { "id" : "editor", + "displayName" : "Editor", "hitboxes" : [], "tokens" : [ "TARGETABLE", diff --git a/assets/Data/entity/creatures/goblin.json b/assets/Data/entity/creatures/goblin.json index 358c0bec..19e0ed3a 100644 --- a/assets/Data/entity/creatures/goblin.json +++ b/assets/Data/entity/creatures/goblin.json @@ -2,6 +2,7 @@ "creatures" : [ { "id" : "goblin", + "displayName" : "Goblin", "hitboxes" : [ { "type": "hurt", diff --git a/assets/Data/entity/creatures/human.json b/assets/Data/entity/creatures/human.json index 91322e71..577b4b77 100644 --- a/assets/Data/entity/creatures/human.json +++ b/assets/Data/entity/creatures/human.json @@ -2,6 +2,7 @@ "creatures" : [ { "id" : "human", + "displayName" : "Human", "hitboxes" : [ { "type": "hit", diff --git a/assets/Data/entity/creatures/skeleton.json b/assets/Data/entity/creatures/skeleton.json index 218ec81f..89281c10 100644 --- a/assets/Data/entity/creatures/skeleton.json +++ b/assets/Data/entity/creatures/skeleton.json @@ -2,6 +2,7 @@ "creatures" : [ { "id" : "skeleton", + "displayName" : "Skeleton", "hitboxes" : [ { "type": "hurt", diff --git a/assets/Data/entity/foliage/bushes.json b/assets/Data/entity/foliage/bushes.json index 2cecf440..65b9bf28 100644 --- a/assets/Data/entity/foliage/bushes.json +++ b/assets/Data/entity/foliage/bushes.json @@ -2,6 +2,7 @@ "foliageList" : [ { "id" : "bush4", + "displayName" : "Bush", "tokens" : [ "FLAMMABLE", "HARVESTABLE" diff --git a/assets/Data/entity/foliage/flowers.json b/assets/Data/entity/foliage/flowers.json index a8b1c840..5647650f 100644 --- a/assets/Data/entity/foliage/flowers.json +++ b/assets/Data/entity/foliage/flowers.json @@ -2,6 +2,7 @@ "foliageList" : [ { "id" : "flower1", + "displayName" : "Flower", "tokens" : [ "FLAMMABLE" ], @@ -24,6 +25,7 @@ }, { "id" : "mushroom1", + "displayName" : "Mushroom", "tokens" : [ "FLAMMABLE" ], diff --git a/assets/Data/entity/foliage/grass.json b/assets/Data/entity/foliage/grass.json index cbb4f2c2..ce591e8b 100644 --- a/assets/Data/entity/foliage/grass.json +++ b/assets/Data/entity/foliage/grass.json @@ -2,6 +2,7 @@ "foliageList" : [ { "id" : "Green Grass", + "displayName" : "Grass", "tokens" : [ "AMBIENT", "REACTS_TO_WIND", diff --git a/assets/Data/entity/foliage/rocks.json b/assets/Data/entity/foliage/rocks.json index 0e09e8b8..7869f625 100644 --- a/assets/Data/entity/foliage/rocks.json +++ b/assets/Data/entity/foliage/rocks.json @@ -2,6 +2,7 @@ "foliageList" : [ { "id" : "rock_static", + "displayName" : "Rock", "tokens" : [ "HARVESTABLE" ], diff --git a/assets/Data/entity/foliage/trees.json b/assets/Data/entity/foliage/trees.json index 9ea66234..d8d39097 100644 --- a/assets/Data/entity/foliage/trees.json +++ b/assets/Data/entity/foliage/trees.json @@ -2,6 +2,7 @@ "foliageList" : [ { "id" : "pine", + "displayName" : "Tree (Pine)", "tokens" : [ "TREE", "REACTS_TO_WIND", @@ -75,6 +76,7 @@ }, { "id" : "oak", + "displayName" : "Tree (Oak)", "tokens" : [ "TREE", "REACTS_TO_WIND", @@ -146,6 +148,7 @@ }, { "id" : "pine2", + "displayName" : "Tree (Pine)", "tokens" : [ "TREE", "FLAMMABLE" diff --git a/assets/Data/entity/items/clothing.json b/assets/Data/entity/items/clothing.json index 98ffb146..c8adfb4b 100644 --- a/assets/Data/entity/items/clothing.json +++ b/assets/Data/entity/items/clothing.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "shorts1", + "displayName" : "Shorts", "modelPath": "Models/items/itemEntityShorts.fbx", "equipData": { "equipClass" : "clothing", @@ -40,6 +41,7 @@ { "id" : "hairshort1", + "displayName" : "Hair", "modelPath": "Models/itemEntityShorts.fbx", "equipData": { "equipClass" : "trait", @@ -78,6 +80,7 @@ { "id" : "boots1", + "displayName" : "Boots", "modelPath": "Models/boots1.glb", "tokens" : [ "GRAVITY", @@ -117,6 +120,7 @@ { "id" : "shirt1", + "displayName" : "Shirt", "modelPath": "Models/itemEntityShorts.fbx", "tokens" : [ "GRAVITY", diff --git a/assets/Data/entity/items/debug_tools.json b/assets/Data/entity/items/debug_tools.json index 2169763c..ed18cf3f 100644 --- a/assets/Data/entity/items/debug_tools.json +++ b/assets/Data/entity/items/debug_tools.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "terrainTool", + "displayName" : "Terrain Tool", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -41,6 +42,7 @@ { "id" : "spawningPalette", + "displayName" : "Spawning Palette", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -79,6 +81,7 @@ }, { "id" : "entityinspector", + "displayName" : "Entity Inspector", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -113,6 +116,7 @@ }, { "id" : "waterSpawner", + "displayName" : "Water Wand", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -147,6 +151,7 @@ }, { "id" : "fabTool", + "displayName" : "Fab Tool", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -185,6 +190,7 @@ }, { "id" : "roomTool", + "displayName" : "Room Tool", "tokens" : [ "GRAVITY", "TARGETABLE", diff --git a/assets/Data/entity/items/fabs/floors.json b/assets/Data/entity/items/fabs/floors.json index 5ad53803..ef9c7637 100644 --- a/assets/Data/entity/items/fabs/floors.json +++ b/assets/Data/entity/items/fabs/floors.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "fab:woodfloor", + "displayName" : "Floor (Wood)", "tokens" : [ "GRAVITY", "TARGETABLE" diff --git a/assets/Data/entity/items/hand_tools.json b/assets/Data/entity/items/hand_tools.json index 945f23b2..92693f26 100644 --- a/assets/Data/entity/items/hand_tools.json +++ b/assets/Data/entity/items/hand_tools.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "Stone Shovel", + "displayName" : "Stone Shovel", "tokens" : [ "GRAVITY", "TARGETABLE", @@ -36,6 +37,7 @@ }, { "id" : "Stone Pick", + "displayName" : "Stone Pick", "tokens" : [ "GRAVITY", "TARGETABLE", diff --git a/assets/Data/entity/items/materials.json b/assets/Data/entity/items/materials.json index bd9d7006..3181807b 100644 --- a/assets/Data/entity/items/materials.json +++ b/assets/Data/entity/items/materials.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "mat:Grain", + "displayName" : "Grain", "tokens" : [ "GRAVITY", "TARGETABLE" diff --git a/assets/Data/entity/items/materials/rocks.json b/assets/Data/entity/items/materials/rocks.json index d6dbf89f..8c64c8df 100644 --- a/assets/Data/entity/items/materials/rocks.json +++ b/assets/Data/entity/items/materials/rocks.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "mat:Rock", + "displayName" : "Rock", "maxStack" : 100, "tokens" : [ "GRAVITY", @@ -34,6 +35,7 @@ }, { "id" : "mat:Copper", + "displayName" : "Copper", "maxStack" : 100, "tokens" : [ "GRAVITY", @@ -72,6 +74,7 @@ }, { "id" : "mat:Tin", + "displayName" : "Tin", "maxStack" : 100, "tokens" : [ "GRAVITY", @@ -103,6 +106,7 @@ }, { "id" : "mat:Clay", + "displayName" : "Clay", "maxStack" : 100, "tokens" : [ "GRAVITY", diff --git a/assets/Data/entity/items/materials/wood.json b/assets/Data/entity/items/materials/wood.json index 92d1ce69..e95fbc93 100644 --- a/assets/Data/entity/items/materials/wood.json +++ b/assets/Data/entity/items/materials/wood.json @@ -2,6 +2,7 @@ "items" : [ { "id" : "mat:Log", + "displayName" : "Log", "maxStack" : 100, "tokens" : [ "GRAVITY", @@ -34,6 +35,7 @@ }, { "id" : "mat:Stick", + "displayName" : "Stick", "maxStack" : 100, "tokens" : [ "GRAVITY", diff --git a/assets/Data/entity/items/weapons.json b/assets/Data/entity/items/weapons.json index ab909d99..45b007e2 100644 --- a/assets/Data/entity/items/weapons.json +++ b/assets/Data/entity/items/weapons.json @@ -5,6 +5,7 @@ { "id" : "Katana", + "displayName" : "Katana (1H)", "modelPath" : "Models/items/weapons/katana1alt.fbx", "weaponData" : { "weaponClass" : "sword1h", @@ -54,6 +55,7 @@ }, { "id" : "Katana2H", + "displayName" : "Katana (2H)", "weaponData" : { "weaponClass" : "sword2h", "damage" : 10, @@ -145,6 +147,7 @@ }, { "id" : "bow1", + "displayName" : "Bow", "modelPath": "Models/bow1.fbx", "weaponData" : { "weaponClass" : "bow2h", @@ -177,6 +180,7 @@ }, { "id" : "Stone Axe", + "displayName" : "Stone Axe", "weaponData" : { "weaponClass" : "sword1h", "damage" : 7, diff --git a/assets/Data/entity/objects/containers.json b/assets/Data/entity/objects/containers.json index 68507b15..a4772b8c 100644 --- a/assets/Data/entity/objects/containers.json +++ b/assets/Data/entity/objects/containers.json @@ -3,6 +3,7 @@ { "id" : "crate", + "displayName" : "Crate", "hitboxData" : [ { "type": "static_capsule", diff --git a/assets/Data/entity/objects/crops.json b/assets/Data/entity/objects/crops.json index 9b300f2e..9b27eda5 100644 --- a/assets/Data/entity/objects/crops.json +++ b/assets/Data/entity/objects/crops.json @@ -3,6 +3,7 @@ { "id" : "wheat_plant", + "displayName" : "Wheat", "hitboxData" : [ { "type": "static_capsule", diff --git a/assets/Data/entity/objects/debug_objects.json b/assets/Data/entity/objects/debug_objects.json index 2f644ebe..5d6a5728 100644 --- a/assets/Data/entity/objects/debug_objects.json +++ b/assets/Data/entity/objects/debug_objects.json @@ -3,6 +3,7 @@ { "id" : "hitboxTester", + "displayName" : "Hitbox Tester", "hitboxData" : [ { "type": "static_capsule", diff --git a/assets/Data/entity/objects/furniture.json b/assets/Data/entity/objects/furniture.json index aa4ff8aa..b172d2d9 100644 --- a/assets/Data/entity/objects/furniture.json +++ b/assets/Data/entity/objects/furniture.json @@ -2,6 +2,7 @@ "objects" : [ { "id" : "Torch", + "displayName" : "Torch", "particleEmitter": { "maxLife": 20, "lifeCurrent": 0, @@ -59,6 +60,7 @@ }, { "id" : "Workbench", + "displayName" : "Workbench", "collidable": { "type" : "CUBE", "dimension1" : 1.0, @@ -101,6 +103,7 @@ }, { "id" : "Door1", + "displayName" : "Door", "collidable": { "type" : "CUBE", "dimension1" : 1.0, diff --git a/assets/Data/entity/objects/game_objects.json b/assets/Data/entity/objects/game_objects.json index a26dc0a8..c2b3d5a4 100644 --- a/assets/Data/entity/objects/game_objects.json +++ b/assets/Data/entity/objects/game_objects.json @@ -3,6 +3,7 @@ { "id" : "spawnPoint", + "displayName" : "Spawn Point", "graphicsTemplate": { "model": { "path" : "Models/gameobj/token.glb" @@ -14,6 +15,7 @@ }, { "id" : "marker", + "displayName" : "Marker", "graphicsTemplate": { "model": { "path" : "Models/gameobj/token.glb" @@ -25,6 +27,7 @@ }, { "id" : "flameEmitterTest", + "displayName" : "Flame Emitter", "particleEmitter": { "maxLife": 20, "lifeCurrent": 0, diff --git a/assets/Data/entity/objects/testscene1objects.json b/assets/Data/entity/objects/testscene1objects.json index 6b2c2baf..788738ef 100644 --- a/assets/Data/entity/objects/testscene1objects.json +++ b/assets/Data/entity/objects/testscene1objects.json @@ -2,6 +2,7 @@ "objects" : [ { "id" : "geometrytest1", + "displayName" : "Geometry Test", "modelPath" : "Models/geometry1.fbx", "tokens" : [ "DISABLE_COLLISION_REACTION", diff --git a/assets/Data/game/blockTypes.json b/assets/Data/game/blockTypes.json index 4e0401e1..085da46c 100644 --- a/assets/Data/game/blockTypes.json +++ b/assets/Data/game/blockTypes.json @@ -2,36 +2,36 @@ "types" : [ { "id" : 0, - "name" : "air" + "name" : "Air" }, { "id" : 1, - "name" : "brick_flat", + "name" : "Brick (Slab)", "texture" : "/Textures/block/tileableSlabstone.png" }, { "id" : 2, - "name" : "wood", + "name" : "Wood", "texture" : "/Textures/wooden.png" }, { "id" : 3, - "name" : "brick_fant", + "name" : "Brick (Fantasy)", "texture" : "/Textures/block/ruin_wall_01.png" }, { "id" : 4, - "name" : "roof_1", + "name" : "Roof Tile", "texture" : "/Textures/block/roof1.png" }, { "id" : 5, - "name" : "refined_wood", + "name" : "Wood (Refined)", "texture" : "/Textures/block/woodfiber.png" }, { "id" : 6, - "name" : "glass", + "name" : "Glass", "texture" : "/Textures/block/glass1.png", "transparent" : true } diff --git a/assets/Data/game/voxelTypes.json b/assets/Data/game/voxelTypes.json index 7827ce67..5fbd37a6 100644 --- a/assets/Data/game/voxelTypes.json +++ b/assets/Data/game/voxelTypes.json @@ -2,16 +2,16 @@ "types" : [ { "id" : 0, - "name" : "air" + "name" : "Air" }, { "id" : 1, - "name" : "dirt", + "name" : "Dirt", "texture" : "/Textures/Ground/Dirt2_256.png" }, { "id" : 2, - "name" : "grass", + "name" : "Grass", "ambientFoliage" : [ "Green Grass" ], @@ -19,32 +19,32 @@ }, { "id" : 3, - "name" : "leaves", + "name" : "Leaves", "texture" : "/Textures/Ground/Leaves1_256.png" }, { "id" : 4, - "name" : "stonepath", + "name" : "Stone Path", "texture" : "/Textures/Ground/stone1_256.png" }, { "id" : 5, - "name" : "snow", + "name" : "Snow", "texture" : "/Textures/Ground/snow1_256.jpg" }, { "id" : 6, - "name" : "rock_shale", + "name" : "Rock (Shale)", "texture" : "/Textures/Ground/cliff1_256.png" }, { "id" : 7, - "name" : "rock_gneiss", + "name" : "Rock (Gneiss)", "texture" : "/Textures/Ground/rock2_256.png" }, { "id" : 8, - "name" : "rock_slate", + "name" : "Rock (Slate)", "texture" : "/Textures/Ground/rock3_256.png" } ] diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 645e3352..6bc39d04 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1741,6 +1741,9 @@ Scaffolding growing component Fix character bug with loading into level Multiple loot pool support Crops replace loot pool on completion of growth +Display name for all common entity data + + diff --git a/src/main/java/electrosphere/data/ConfigValidator.java b/src/main/java/electrosphere/data/ConfigValidator.java index ade4e2c5..8c005353 100644 --- a/src/main/java/electrosphere/data/ConfigValidator.java +++ b/src/main/java/electrosphere/data/ConfigValidator.java @@ -1,5 +1,11 @@ package electrosphere.data; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +import electrosphere.data.common.CommonEntityType; +import electrosphere.data.common.CommonEntityValidator; import electrosphere.data.creature.CreatureData; import electrosphere.data.creature.CreatureDataValidator; import electrosphere.data.creature.CreatureTypeLoader; @@ -19,6 +25,14 @@ public class ConfigValidator { for(CreatureData creatureData : creatureTypeLoader.getTypes()){ CreatureDataValidator.validate(creatureData); } + List allData = new LinkedList(); + allData.addAll(config.getCreatureTypeLoader().getTypeIds().stream().map((String id) -> {return config.getCreatureTypeLoader().getType(id);}).collect(Collectors.toList())); + allData.addAll(config.getFoliageMap().getTypeIds().stream().map((String id) -> {return config.getFoliageMap().getType(id);}).collect(Collectors.toList())); + allData.addAll(config.getItemMap().getTypeIds().stream().map((String id) -> {return config.getItemMap().getType(id);}).collect(Collectors.toList())); + allData.addAll(config.getObjectTypeMap().getTypeIds().stream().map((String id) -> {return config.getObjectTypeMap().getType(id);}).collect(Collectors.toList())); + for(CommonEntityType type : allData){ + CommonEntityValidator.validate(type); + } } } diff --git a/src/main/java/electrosphere/data/common/CommonEntityType.java b/src/main/java/electrosphere/data/common/CommonEntityType.java index a758afcd..fb8dbccf 100644 --- a/src/main/java/electrosphere/data/common/CommonEntityType.java +++ b/src/main/java/electrosphere/data/common/CommonEntityType.java @@ -37,6 +37,11 @@ public class CommonEntityType { * The id of the creature */ String id; + + /** + * The display name of this entity + */ + String displayName; /** * The list of hitboxes on the creature @@ -184,6 +189,22 @@ public class CommonEntityType { this.id = id; } + /** + * Gets the display name of the entity type + * @return The display name + */ + public String getDisplayName(){ + return displayName; + } + + /** + * Sets the display name of the entity type + * @param displayName The display name + */ + public void setDisplayName(String displayName){ + this.displayName = displayName; + } + /** * Gets the list of hitboxes for this creature * @return The list of hitbox data diff --git a/src/main/java/electrosphere/data/common/CommonEntityValidator.java b/src/main/java/electrosphere/data/common/CommonEntityValidator.java new file mode 100644 index 00000000..9528c7b5 --- /dev/null +++ b/src/main/java/electrosphere/data/common/CommonEntityValidator.java @@ -0,0 +1,26 @@ +package electrosphere.data.common; + +import electrosphere.logger.LoggerInterface; + +/** + * Validates common entity definition data + */ +public class CommonEntityValidator { + + /** + * Validates a common entity + * @param data The data + */ + public static void validate(CommonEntityType data){ + if(data.getId() == null || data.getId().length() == 0){ + String message = "Id undefined for entity type!"; + LoggerInterface.loggerEngine.WARNING(message); + } + + if(data.getDisplayName() == null || data.getDisplayName().length() == 0){ + String message = "Display name undefined for entity type " + data.getId(); + LoggerInterface.loggerEngine.WARNING(message); + } + } + +} diff --git a/src/main/java/electrosphere/data/item/Item.java b/src/main/java/electrosphere/data/item/Item.java index 0cfcc1ee..55b96f79 100644 --- a/src/main/java/electrosphere/data/item/Item.java +++ b/src/main/java/electrosphere/data/item/Item.java @@ -99,6 +99,7 @@ public class Item extends CommonEntityType { Item rVal = new Item(); rVal.setId("spawn:" + objectData.getId()); + rVal.setDisplayName(objectData.getDisplayName() + " Spawner"); if(description.getItemIcon() != null){ @@ -142,6 +143,7 @@ public class Item extends CommonEntityType { public static Item createBlockItem(BlockType blockType){ Item rVal = new Item(); rVal.setId(Item.getBlockTypeId(blockType)); + rVal.setDisplayName(blockType.getName()); if(blockType.getTexture() != null){ @@ -208,6 +210,7 @@ public class Item extends CommonEntityType { public static Item createVoxelItem(VoxelType voxelType){ Item rVal = new Item(); rVal.setId(Item.getVoxelTypeId(voxelType)); + rVal.setDisplayName(voxelType.getName()); if(voxelType.getTexture() != null){