display name for all common entity data
This commit is contained in:
		
							parent
							
								
									4847528e48
								
							
						
					
					
						commit
						46d526a26d
					
				| @ -2,6 +2,7 @@ | ||||
|     "creatures" : [ | ||||
|         { | ||||
|             "id" : "Deer", | ||||
|             "displayName" : "Deer", | ||||
|             "hitboxes" : [ | ||||
|                 { | ||||
|                     "type": "hurt", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "creatures" : [ | ||||
|         { | ||||
|             "id" : "editor", | ||||
|             "displayName" : "Editor", | ||||
|             "hitboxes" : [], | ||||
|             "tokens" : [ | ||||
|                 "TARGETABLE", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "creatures" : [ | ||||
|         { | ||||
|             "id" : "goblin", | ||||
|             "displayName" : "Goblin", | ||||
|             "hitboxes" : [ | ||||
|                 { | ||||
|                     "type": "hurt", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "creatures" : [ | ||||
|         { | ||||
|             "id" : "human", | ||||
|             "displayName" : "Human", | ||||
|             "hitboxes" : [ | ||||
|                 { | ||||
|                     "type": "hit", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "creatures" : [ | ||||
|         { | ||||
|             "id" : "skeleton", | ||||
|             "displayName" : "Skeleton", | ||||
|             "hitboxes" : [ | ||||
|                 { | ||||
|                     "type": "hurt", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "foliageList" : [ | ||||
|         { | ||||
|             "id" : "bush4", | ||||
|             "displayName" : "Bush", | ||||
|             "tokens" : [ | ||||
|                 "FLAMMABLE", | ||||
|                 "HARVESTABLE" | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "foliageList" : [ | ||||
|         { | ||||
|             "id" : "flower1", | ||||
|             "displayName" : "Flower", | ||||
|             "tokens" : [ | ||||
|                 "FLAMMABLE" | ||||
|             ], | ||||
| @ -24,6 +25,7 @@ | ||||
|         }, | ||||
|         { | ||||
|             "id" : "mushroom1", | ||||
|             "displayName" : "Mushroom", | ||||
|             "tokens" : [ | ||||
|                 "FLAMMABLE" | ||||
|             ], | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "foliageList" : [ | ||||
|         { | ||||
|             "id" : "Green Grass", | ||||
|             "displayName" : "Grass", | ||||
|             "tokens" : [ | ||||
|                 "AMBIENT", | ||||
|                 "REACTS_TO_WIND", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "foliageList" : [ | ||||
|         { | ||||
|             "id" : "rock_static", | ||||
|             "displayName" : "Rock", | ||||
|             "tokens" : [ | ||||
|                 "HARVESTABLE" | ||||
|             ], | ||||
|  | ||||
| @ -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" | ||||
|  | ||||
| @ -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", | ||||
|  | ||||
| @ -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", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "items" : [ | ||||
|         { | ||||
|             "id" : "fab:woodfloor", | ||||
|             "displayName" : "Floor (Wood)", | ||||
|             "tokens" : [ | ||||
|                 "GRAVITY", | ||||
|                 "TARGETABLE" | ||||
|  | ||||
| @ -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", | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "items" : [ | ||||
|         { | ||||
|             "id" : "mat:Grain", | ||||
|             "displayName" : "Grain", | ||||
|             "tokens" : [ | ||||
|                 "GRAVITY", | ||||
|                 "TARGETABLE" | ||||
|  | ||||
| @ -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", | ||||
|  | ||||
| @ -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", | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| 
 | ||||
|         { | ||||
|             "id" : "crate", | ||||
|             "displayName" : "Crate", | ||||
|             "hitboxData" : [ | ||||
|                     { | ||||
|                     "type": "static_capsule", | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| 
 | ||||
|         { | ||||
|             "id" : "wheat_plant", | ||||
|             "displayName" : "Wheat", | ||||
|             "hitboxData" : [ | ||||
|                     { | ||||
|                     "type": "static_capsule", | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| 
 | ||||
|         { | ||||
|             "id" : "hitboxTester", | ||||
|             "displayName" : "Hitbox Tester", | ||||
|             "hitboxData" : [ | ||||
|                     { | ||||
|                     "type": "static_capsule", | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
|     "objects" : [ | ||||
|         { | ||||
|             "id" : "geometrytest1", | ||||
|             "displayName" : "Geometry Test", | ||||
|             "modelPath" : "Models/geometry1.fbx", | ||||
|             "tokens" : [ | ||||
|                 "DISABLE_COLLISION_REACTION", | ||||
|  | ||||
| @ -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 | ||||
|         } | ||||
|  | ||||
| @ -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" | ||||
|         } | ||||
|     ] | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -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<CommonEntityType> allData = new LinkedList<CommonEntityType>(); | ||||
|         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); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -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){ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user