recursive foliage definition files
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
b21343b830
commit
b08d008a08
@ -1,248 +1,9 @@
|
||||
{
|
||||
"foliageList" : [
|
||||
{
|
||||
"id" : "Green Grass",
|
||||
"tokens" : [
|
||||
"AMBIENT",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"grassData": {
|
||||
"baseColor": {"x": 0.25, "y": 0.6, "z": 0.43},
|
||||
"tipColor": {"x": 0.17, "y": 0.71, "z": 0.12},
|
||||
"maxTipCurve" : 0.27,
|
||||
"minHeight" : 0.7,
|
||||
"maxHeight" : 1.3
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/grass2.fbx"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "pine",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE",
|
||||
"SEEDED"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"ambientAudio": {
|
||||
"responseWindAudioFilePath": "Audio/ambienceWind1SeamlessMono.ogg",
|
||||
"responseWindLoops": true,
|
||||
"randomizeOffset": true,
|
||||
"gainMultiplier": 0.9,
|
||||
"emitterSpatialOffset": [0,3,0]
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"proceduralModel": {
|
||||
"treeModel": {
|
||||
"trunkModel": {
|
||||
"trunkScalarFalloffFactor": 0.2,
|
||||
"minimumTrunkScalar": 0.2,
|
||||
"maximumTrunkSegments": 6,
|
||||
"physicsCutoff": 3,
|
||||
"centralTrunk": true
|
||||
},
|
||||
"branchModel": {
|
||||
"limbScalarFalloffFactor": 0.3,
|
||||
"minimumLimbScalar": 0.25,
|
||||
"maximumLimbDispersion": 0.5,
|
||||
"minimumLimbDispersion": 0.3,
|
||||
"minimumNumberForks": 3,
|
||||
"maximumNumberForks": 5,
|
||||
"maximumBranchSegments": 3,
|
||||
"maxBranchSegmentFalloffFactor": 1,
|
||||
"minimumSegmentToSpawnLeaves": 2
|
||||
},
|
||||
"minBranchHeightToStartSpawningLeaves": 1.5,
|
||||
"maxBranchHeightToStartSpawningLeaves": 3.01,
|
||||
"leafIncrement": 0.5,
|
||||
"minLeavesToSpawnPerPoint": 3,
|
||||
"maxLeavesToSpawnPerPoint": 5,
|
||||
"leafDistanceFromCenter": 1.2,
|
||||
"peelVariance": 0.2,
|
||||
"peelMinimum": 0.1,
|
||||
"swaySigmoidFactor": 2,
|
||||
"minimumSwayTime": 500,
|
||||
"swayTimeVariance": 500,
|
||||
"yawVariance": 0.2,
|
||||
"yawMinimum": 0.1,
|
||||
"minimumScalarToGenerateSwayTree": 0.5,
|
||||
"maximumScalarToGenerateSwayTree": 1.0,
|
||||
"branchHeight": 3,
|
||||
"physicsBody": {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.5,
|
||||
"dimension2" : 3,
|
||||
"dimension3" : 0.5,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 1.5,
|
||||
"offsetZ" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "oak",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE",
|
||||
"SEEDED"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"ambientAudio": {
|
||||
"responseWindAudioFilePath": "Audio/ambienceWind1SeamlessMono.ogg",
|
||||
"responseWindLoops": true,
|
||||
"randomizeOffset": true,
|
||||
"gainMultiplier": 0.9,
|
||||
"emitterSpatialOffset": [0,3,0]
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"proceduralModel": {
|
||||
"treeModel": {
|
||||
"trunkModel": {
|
||||
"maximumTrunkSegments": 4,
|
||||
"physicsCutoff": 3,
|
||||
"centralTrunk": false
|
||||
},
|
||||
"branchModel": {
|
||||
"limbScalarFalloffFactor": 0.3,
|
||||
"minimumLimbScalar": 0.25,
|
||||
"maximumLimbDispersion": 0.5,
|
||||
"minimumLimbDispersion": 0.3,
|
||||
"minimumNumberForks": 3,
|
||||
"maximumNumberForks": 5,
|
||||
"maximumBranchSegments": 3,
|
||||
"maxBranchSegmentFalloffFactor": 1,
|
||||
"minimumSegmentToSpawnLeaves": 2
|
||||
},
|
||||
"minBranchHeightToStartSpawningLeaves": 1.5,
|
||||
"maxBranchHeightToStartSpawningLeaves": 3.01,
|
||||
"leafIncrement": 0.5,
|
||||
"minLeavesToSpawnPerPoint": 3,
|
||||
"maxLeavesToSpawnPerPoint": 5,
|
||||
"leafDistanceFromCenter": 1.2,
|
||||
"peelVariance": 0.2,
|
||||
"peelMinimum": 0.1,
|
||||
"swaySigmoidFactor": 2,
|
||||
"minimumSwayTime": 500,
|
||||
"swayTimeVariance": 500,
|
||||
"yawVariance": 0.2,
|
||||
"yawMinimum": 0.1,
|
||||
"minimumScalarToGenerateSwayTree": 0.5,
|
||||
"maximumScalarToGenerateSwayTree": 1.0,
|
||||
"branchHeight": 3,
|
||||
"physicsBody": {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.5,
|
||||
"dimension2" : 3,
|
||||
"dimension3" : 0.5,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 1.5,
|
||||
"offsetZ" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "pine2",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"hitboxes" : [
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 0.045, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 0.6, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 1.2, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 1.8, 0],
|
||||
"radius": 0.175
|
||||
}
|
||||
],
|
||||
"collidable" : {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.2,
|
||||
"dimension2" : 1.6,
|
||||
"dimension3" : 0.2,
|
||||
"linearFriction": 0.001,
|
||||
"mass": 0.3,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 0.8,
|
||||
"offsetZ" : 0,
|
||||
"kinematic" : true
|
||||
},
|
||||
"healthSystem" : {
|
||||
"maxHealth" : 50,
|
||||
"onDamageIFrames" : 5,
|
||||
"lootPool" : {
|
||||
"tickets" : [
|
||||
{
|
||||
"itemId" : "Log",
|
||||
"rarity" : 0.8,
|
||||
"minQuantity" : 0,
|
||||
"maxQuantity" : 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/tree4.glb"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "bush4",
|
||||
"tokens" : [
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/bush4.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
"files" : [
|
||||
"Data/entity/foliage/grass.json",
|
||||
"Data/entity/foliage/trees.json",
|
||||
"Data/entity/foliage/bushes.json"
|
||||
]
|
||||
}
|
||||
|
||||
17
assets/Data/entity/foliage/bushes.json
Normal file
17
assets/Data/entity/foliage/bushes.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"foliageList" : [
|
||||
{
|
||||
"id" : "bush4",
|
||||
"tokens" : [
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/bush4.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"files" : [
|
||||
]
|
||||
}
|
||||
30
assets/Data/entity/foliage/grass.json
Normal file
30
assets/Data/entity/foliage/grass.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"foliageList" : [
|
||||
{
|
||||
"id" : "Green Grass",
|
||||
"tokens" : [
|
||||
"AMBIENT",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"grassData": {
|
||||
"baseColor": {"x": 0.25, "y": 0.6, "z": 0.43},
|
||||
"tipColor": {"x": 0.17, "y": 0.71, "z": 0.12},
|
||||
"maxTipCurve" : 0.27,
|
||||
"minHeight" : 0.7,
|
||||
"maxHeight" : 1.3
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/grass2.fbx"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"files" : [
|
||||
]
|
||||
}
|
||||
214
assets/Data/entity/foliage/trees.json
Normal file
214
assets/Data/entity/foliage/trees.json
Normal file
@ -0,0 +1,214 @@
|
||||
{
|
||||
"foliageList" : [
|
||||
{
|
||||
"id" : "pine",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE",
|
||||
"SEEDED"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"ambientAudio": {
|
||||
"responseWindAudioFilePath": "Audio/ambienceWind1SeamlessMono.ogg",
|
||||
"responseWindLoops": true,
|
||||
"randomizeOffset": true,
|
||||
"gainMultiplier": 0.9,
|
||||
"emitterSpatialOffset": [0,3,0]
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"proceduralModel": {
|
||||
"treeModel": {
|
||||
"trunkModel": {
|
||||
"trunkScalarFalloffFactor": 0.2,
|
||||
"minimumTrunkScalar": 0.2,
|
||||
"maximumTrunkSegments": 6,
|
||||
"physicsCutoff": 3,
|
||||
"centralTrunk": true
|
||||
},
|
||||
"branchModel": {
|
||||
"limbScalarFalloffFactor": 0.3,
|
||||
"minimumLimbScalar": 0.25,
|
||||
"maximumLimbDispersion": 0.5,
|
||||
"minimumLimbDispersion": 0.3,
|
||||
"minimumNumberForks": 3,
|
||||
"maximumNumberForks": 5,
|
||||
"maximumBranchSegments": 3,
|
||||
"maxBranchSegmentFalloffFactor": 1,
|
||||
"minimumSegmentToSpawnLeaves": 2
|
||||
},
|
||||
"minBranchHeightToStartSpawningLeaves": 1.5,
|
||||
"maxBranchHeightToStartSpawningLeaves": 3.01,
|
||||
"leafIncrement": 0.5,
|
||||
"minLeavesToSpawnPerPoint": 3,
|
||||
"maxLeavesToSpawnPerPoint": 5,
|
||||
"leafDistanceFromCenter": 1.2,
|
||||
"peelVariance": 0.2,
|
||||
"peelMinimum": 0.1,
|
||||
"swaySigmoidFactor": 2,
|
||||
"minimumSwayTime": 500,
|
||||
"swayTimeVariance": 500,
|
||||
"yawVariance": 0.2,
|
||||
"yawMinimum": 0.1,
|
||||
"minimumScalarToGenerateSwayTree": 0.5,
|
||||
"maximumScalarToGenerateSwayTree": 1.0,
|
||||
"branchHeight": 3,
|
||||
"physicsBody": {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.5,
|
||||
"dimension2" : 3,
|
||||
"dimension3" : 0.5,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 1.5,
|
||||
"offsetZ" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "oak",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"REACTS_TO_WIND",
|
||||
"GROWS_BACK",
|
||||
"FLAMMABLE",
|
||||
"SEEDED"
|
||||
],
|
||||
"growthModel": {
|
||||
"growthRate" : 0.001
|
||||
},
|
||||
"ambientAudio": {
|
||||
"responseWindAudioFilePath": "Audio/ambienceWind1SeamlessMono.ogg",
|
||||
"responseWindLoops": true,
|
||||
"randomizeOffset": true,
|
||||
"gainMultiplier": 0.9,
|
||||
"emitterSpatialOffset": [0,3,0]
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"proceduralModel": {
|
||||
"treeModel": {
|
||||
"trunkModel": {
|
||||
"maximumTrunkSegments": 4,
|
||||
"physicsCutoff": 3,
|
||||
"centralTrunk": false
|
||||
},
|
||||
"branchModel": {
|
||||
"limbScalarFalloffFactor": 0.3,
|
||||
"minimumLimbScalar": 0.25,
|
||||
"maximumLimbDispersion": 0.5,
|
||||
"minimumLimbDispersion": 0.3,
|
||||
"minimumNumberForks": 3,
|
||||
"maximumNumberForks": 5,
|
||||
"maximumBranchSegments": 3,
|
||||
"maxBranchSegmentFalloffFactor": 1,
|
||||
"minimumSegmentToSpawnLeaves": 2
|
||||
},
|
||||
"minBranchHeightToStartSpawningLeaves": 1.5,
|
||||
"maxBranchHeightToStartSpawningLeaves": 3.01,
|
||||
"leafIncrement": 0.5,
|
||||
"minLeavesToSpawnPerPoint": 3,
|
||||
"maxLeavesToSpawnPerPoint": 5,
|
||||
"leafDistanceFromCenter": 1.2,
|
||||
"peelVariance": 0.2,
|
||||
"peelMinimum": 0.1,
|
||||
"swaySigmoidFactor": 2,
|
||||
"minimumSwayTime": 500,
|
||||
"swayTimeVariance": 500,
|
||||
"yawVariance": 0.2,
|
||||
"yawMinimum": 0.1,
|
||||
"minimumScalarToGenerateSwayTree": 0.5,
|
||||
"maximumScalarToGenerateSwayTree": 1.0,
|
||||
"branchHeight": 3,
|
||||
"physicsBody": {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.5,
|
||||
"dimension2" : 3,
|
||||
"dimension3" : 0.5,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 1.5,
|
||||
"offsetZ" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : "pine2",
|
||||
"tokens" : [
|
||||
"TREE",
|
||||
"FLAMMABLE"
|
||||
],
|
||||
"hitboxes" : [
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 0.045, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 0.6, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 1.2, 0],
|
||||
"radius": 0.175
|
||||
},
|
||||
{
|
||||
"type": "hurt",
|
||||
"offset": [0, 1.8, 0],
|
||||
"radius": 0.175
|
||||
}
|
||||
],
|
||||
"collidable" : {
|
||||
"type" : "CYLINDER",
|
||||
"dimension1" : 0.2,
|
||||
"dimension2" : 1.6,
|
||||
"dimension3" : 0.2,
|
||||
"linearFriction": 0.001,
|
||||
"mass": 0.3,
|
||||
"rotX": 0,
|
||||
"rotY": 0,
|
||||
"rotZ": 0,
|
||||
"rotW": 1,
|
||||
"offsetX" : 0,
|
||||
"offsetY" : 0.8,
|
||||
"offsetZ" : 0,
|
||||
"kinematic" : true
|
||||
},
|
||||
"healthSystem" : {
|
||||
"maxHealth" : 50,
|
||||
"onDamageIFrames" : 5,
|
||||
"lootPool" : {
|
||||
"tickets" : [
|
||||
{
|
||||
"itemId" : "Log",
|
||||
"rarity" : 0.8,
|
||||
"minQuantity" : 0,
|
||||
"maxQuantity" : 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"graphicsTemplate": {
|
||||
"model": {
|
||||
"path" : "Models/foliage/tree4.glb"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"files" : [
|
||||
]
|
||||
}
|
||||
@ -1423,6 +1423,7 @@ Add rock and stick items
|
||||
Update ServerEntityUtils.repositionEntityRecursive behavior
|
||||
Add bush entity
|
||||
Add bushes to forest biome
|
||||
Make foliage data files recursive
|
||||
|
||||
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ public class FoliageCellManager {
|
||||
*/
|
||||
public void init(){
|
||||
//queue ambient foliage models
|
||||
for(FoliageType foliageType : Globals.gameConfigCurrent.getFoliageMap().getFoliageList()){
|
||||
for(FoliageType foliageType : Globals.gameConfigCurrent.getFoliageMap().getTypes()){
|
||||
if(foliageType.getTokens().contains(FoliageType.TOKEN_AMBIENT)){
|
||||
Globals.assetManager.addModelPathToQueue(foliageType.getGraphicsTemplate().getModel().getPath());
|
||||
Globals.assetManager.addShaderToQueue(FoliageCell.vertexPath, FoliageCell.fragmentPath);
|
||||
|
||||
@ -181,7 +181,7 @@ public class FoliageModel {
|
||||
Random placementRandomizer = new Random();
|
||||
//get type
|
||||
String foliageTypeName = foliageTypesSupported.get(0);
|
||||
FoliageType foliageType = Globals.gameConfigCurrent.getFoliageMap().getFoliage(foliageTypeName);
|
||||
FoliageType foliageType = Globals.gameConfigCurrent.getFoliageMap().getType(foliageTypeName);
|
||||
CommonEntityUtils.setCommonData(rVal, foliageType);
|
||||
CommonEntityUtils.setEntityType(rVal, EntityType.FOLIAGE);
|
||||
CommonEntityUtils.setEntitySubtype(rVal, foliageType.getId());
|
||||
|
||||
@ -94,7 +94,7 @@ public class SpawnSelectionPanel {
|
||||
//get relevant types
|
||||
List<CommonEntityType> types = new LinkedList<CommonEntityType>();
|
||||
types.addAll(Globals.gameConfigCurrent.getCreatureTypeLoader().getTypes());
|
||||
types.addAll(Globals.gameConfigCurrent.getFoliageMap().getFoliageList());
|
||||
types.addAll(Globals.gameConfigCurrent.getFoliageMap().getTypes());
|
||||
types.addAll(Globals.gameConfigCurrent.getItemMap().getTypes());
|
||||
types.addAll(Globals.gameConfigCurrent.getObjectTypeMap().getTypes());
|
||||
types = types.stream().filter((type) -> type.getId().toLowerCase().contains(searchString.toLowerCase())).toList();
|
||||
|
||||
@ -230,7 +230,7 @@ public class MenuGeneratorsLevelEditor {
|
||||
}));
|
||||
|
||||
//button for spawning all foliage types
|
||||
for(FoliageType data : Globals.gameConfigCurrent.getFoliageMap().getFoliageList()){
|
||||
for(FoliageType data : Globals.gameConfigCurrent.getFoliageMap().getTypes()){
|
||||
//spawn foliage button
|
||||
scrollable.addChild(Button.createButton("Spawn " + data.getId(), () -> {
|
||||
LoggerInterface.loggerEngine.INFO("spawn " + data.getId() + "!");
|
||||
|
||||
@ -33,7 +33,7 @@ public class FoliageUtils {
|
||||
* @return The entity for the foliage
|
||||
*/
|
||||
public static Entity clientSpawnBasicFoliage(String type, long seed){
|
||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getFoliage(type);
|
||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
||||
Entity rVal;
|
||||
if(
|
||||
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
||||
@ -78,7 +78,7 @@ public class FoliageUtils {
|
||||
* @return the tree entity
|
||||
*/
|
||||
public static Entity serverSpawnTreeFoliage(Realm realm, Vector3d position, String type, long seed){
|
||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getFoliage(type);
|
||||
FoliageType rawType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
||||
Entity rVal;
|
||||
if(
|
||||
rawType.getGraphicsTemplate().getProceduralModel() != null &&
|
||||
|
||||
@ -101,7 +101,7 @@ public class ProceduralTree {
|
||||
Random treeRandom = new Random(seed);
|
||||
|
||||
//call recursive branching routine to generate branches from trunk + leaf blobs
|
||||
FoliageType foliageType = Globals.gameConfigCurrent.getFoliageMap().getFoliage(type);
|
||||
FoliageType foliageType = Globals.gameConfigCurrent.getFoliageMap().getType(type);
|
||||
TreeModel treeModel = foliageType.getGraphicsTemplate().getProceduralModel().getTreeModel();
|
||||
|
||||
//generate trunk
|
||||
|
||||
@ -14,6 +14,8 @@ import electrosphere.game.data.creature.type.CreatureData;
|
||||
import electrosphere.game.data.creature.type.CreatureTypeLoader;
|
||||
import electrosphere.game.data.creature.type.attack.AttackMoveResolver;
|
||||
import electrosphere.game.data.creature.type.model.CreatureTypeMap;
|
||||
import electrosphere.game.data.foliage.type.FoliageType;
|
||||
import electrosphere.game.data.foliage.type.FoliageTypeLoader;
|
||||
import electrosphere.game.data.foliage.type.model.FoliageTypeMap;
|
||||
import electrosphere.game.data.item.ItemDataMap;
|
||||
import electrosphere.game.data.projectile.ProjectileTypeHolder;
|
||||
@ -31,13 +33,22 @@ import electrosphere.util.FileUtils;
|
||||
*/
|
||||
public class Config {
|
||||
|
||||
/**
|
||||
* The container for all creature definitions
|
||||
*/
|
||||
CreatureTypeLoader creatureTypeLoader;
|
||||
|
||||
/**
|
||||
* The container for all item definitions
|
||||
*/
|
||||
ItemDataMap itemMap;
|
||||
FoliageTypeMap foliageMap;
|
||||
|
||||
/**
|
||||
* The container for all foliage definitions
|
||||
*/
|
||||
FoliageTypeLoader foliageMap;
|
||||
|
||||
|
||||
CommonEntityMap objectTypeLoader;
|
||||
SymbolMap symbolMap;
|
||||
RaceMap raceMap;
|
||||
@ -85,10 +96,10 @@ public class Config {
|
||||
*/
|
||||
public static Config loadDefaultConfig(){
|
||||
Config config = new Config();
|
||||
config.creatureTypeLoader = loadCreatureTypes("Data/entity/creatures.json");
|
||||
config.creatureTypeLoader = Config.loadCreatureTypes("Data/entity/creatures.json");
|
||||
config.itemMap = ItemDataMap.loadItemFiles("Data/entity/items.json");
|
||||
config.foliageMap = FileUtils.loadObjectFromAssetPath("Data/entity/foliage.json", FoliageTypeMap.class);
|
||||
config.objectTypeLoader = loadCommonEntityTypes("Data/entity/objects.json");
|
||||
config.foliageMap = Config.loadFoliageTypes("Data/entity/foliage.json");
|
||||
config.objectTypeLoader = Config.loadCommonEntityTypes("Data/entity/objects.json");
|
||||
config.symbolMap = FileUtils.loadObjectFromAssetPath("Data/game/symbolism.json", SymbolMap.class);
|
||||
config.raceMap = FileUtils.loadObjectFromAssetPath("Data/game/races.json", RaceMap.class);
|
||||
config.voxelData = FileUtils.loadObjectFromAssetPath("Data/game/voxelTypes.json", VoxelData.class);
|
||||
@ -163,7 +174,7 @@ public class Config {
|
||||
}
|
||||
//push types from any other files
|
||||
for(String filepath : typeMap.getFiles()){
|
||||
List<CreatureData> parsedTypeList = readCreatureTypeFile(filepath);
|
||||
List<CreatureData> parsedTypeList = Config.readCreatureTypeFile(filepath);
|
||||
for(CreatureData type : parsedTypeList){
|
||||
typeList.add(type);
|
||||
}
|
||||
@ -178,7 +189,7 @@ public class Config {
|
||||
*/
|
||||
static CreatureTypeLoader loadCreatureTypes(String initialPath) {
|
||||
CreatureTypeLoader loader = new CreatureTypeLoader();
|
||||
List<CreatureData> typeList = readCreatureTypeFile(initialPath);
|
||||
List<CreatureData> typeList = Config.readCreatureTypeFile(initialPath);
|
||||
for(CreatureData type : typeList){
|
||||
if(type.getAttackMoves() != null){
|
||||
type.setAttackMoveResolver(new AttackMoveResolver(type.getAttackMoves()));
|
||||
@ -194,6 +205,42 @@ public class Config {
|
||||
return loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a child foliage defintion file
|
||||
* @param filename The filename
|
||||
* @return The list of foliage in the file
|
||||
*/
|
||||
static List<FoliageType> readFoliageTypeFile(String filename){
|
||||
List<FoliageType> typeList = new LinkedList<FoliageType>();
|
||||
FoliageTypeMap typeMap = FileUtils.loadObjectFromAssetPath(filename, FoliageTypeMap.class);
|
||||
//push the types from this file
|
||||
for(FoliageType foliage : typeMap.getFoliageList()){
|
||||
typeList.add(foliage);
|
||||
}
|
||||
//push types from any other files
|
||||
for(String filepath : typeMap.getFiles()){
|
||||
List<FoliageType> parsedTypeList = Config.readFoliageTypeFile(filepath);
|
||||
for(FoliageType type : parsedTypeList){
|
||||
typeList.add(type);
|
||||
}
|
||||
}
|
||||
return typeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all creature definition files recursively
|
||||
* @param initialPath The initial path to recurse from
|
||||
* @return The creature defintion interface
|
||||
*/
|
||||
static FoliageTypeLoader loadFoliageTypes(String initialPath) {
|
||||
FoliageTypeLoader loader = new FoliageTypeLoader();
|
||||
List<FoliageType> typeList = Config.readFoliageTypeFile(initialPath);
|
||||
for(FoliageType type : typeList){
|
||||
loader.putType(type.getId(), type);
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interface for creature definitions loaded into memory
|
||||
* @return The interface
|
||||
@ -214,7 +261,7 @@ public class Config {
|
||||
* Gets the data on all foliage types in memory
|
||||
* @return The foliage data
|
||||
*/
|
||||
public FoliageTypeMap getFoliageMap() {
|
||||
public FoliageTypeLoader getFoliageMap() {
|
||||
return foliageMap;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package electrosphere.game.data.foliage.type;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class FoliageTypeLoader {
|
||||
|
||||
/**
|
||||
* The map of entity id -> entity data
|
||||
*/
|
||||
Map<String,FoliageType> idTypeMap = new HashMap<String,FoliageType>();
|
||||
|
||||
/**
|
||||
* Adds entity data to the loader
|
||||
* @param name The id of the entity
|
||||
* @param type The entity data
|
||||
*/
|
||||
public void putType(String name, FoliageType type){
|
||||
idTypeMap.put(name,type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets entity data from the id of the type
|
||||
* @param id The id of the type
|
||||
* @return The entity data if it exists, null otherwise
|
||||
*/
|
||||
public FoliageType getType(String id){
|
||||
return idTypeMap.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the collection of all entity data
|
||||
* @return the collection of all entity data
|
||||
*/
|
||||
public Collection<FoliageType> getTypes(){
|
||||
return idTypeMap.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the set of all entity data id's stored in the loader
|
||||
* @return the set of all entity data ids
|
||||
*/
|
||||
public Set<String> getTypeIds(){
|
||||
return idTypeMap.keySet();
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,9 +8,17 @@ import java.util.List;
|
||||
*/
|
||||
public class FoliageTypeMap {
|
||||
|
||||
//The list of all foliage types
|
||||
/**
|
||||
* List of all the foliage types in this file
|
||||
*/
|
||||
List<FoliageType> foliageList;
|
||||
|
||||
/**
|
||||
* The list of sub-files under this file
|
||||
*/
|
||||
List<String> files;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of all foliage types
|
||||
* @return The list of all foliage types
|
||||
@ -33,4 +41,12 @@ public class FoliageTypeMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of files under this file
|
||||
* @return The list of files
|
||||
*/
|
||||
public List<String> getFiles(){
|
||||
return files;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import electrosphere.game.data.common.CommonEntityType;
|
||||
import electrosphere.game.data.creature.type.CreatureData;
|
||||
import electrosphere.game.data.creature.type.CreatureTypeLoader;
|
||||
import electrosphere.game.data.foliage.type.FoliageType;
|
||||
import electrosphere.game.data.foliage.type.model.FoliageTypeMap;
|
||||
import electrosphere.game.data.foliage.type.FoliageTypeLoader;
|
||||
import electrosphere.game.data.item.Item;
|
||||
import electrosphere.game.data.item.ItemDataMap;
|
||||
import electrosphere.test.annotations.IntegrationTest;
|
||||
@ -44,8 +44,8 @@ public class SpawnAllEntitiesTests extends EntityTestTemplate {
|
||||
ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), item.getId());
|
||||
}
|
||||
|
||||
FoliageTypeMap foliageTypeMap = Globals.gameConfigCurrent.getFoliageMap();
|
||||
for(FoliageType foliage : foliageTypeMap.getFoliageList()){
|
||||
FoliageTypeLoader foliageTypeMap = Globals.gameConfigCurrent.getFoliageMap();
|
||||
for(FoliageType foliage : foliageTypeMap.getTypes()){
|
||||
FoliageUtils.serverSpawnTreeFoliage(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), foliage.getId(), 0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user