code maintenance
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
5bf5080f74
commit
c2da5ad7f8
6
assets/Data/macro/jobs.json
Normal file
6
assets/Data/macro/jobs.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"jobs": [
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -2030,6 +2030,8 @@ Fix client LOD component re-enabling physics positioning
|
|||||||
Debug rendering of server physics objects
|
Debug rendering of server physics objects
|
||||||
Server LOD component properly attaches physics bodies when the entity comes in range
|
Server LOD component properly attaches physics bodies when the entity comes in range
|
||||||
Fix physics destruction on server via ServerLODComponent
|
Fix physics destruction on server via ServerLODComponent
|
||||||
|
More job data scaffolding
|
||||||
|
Config class cleanup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import electrosphere.data.entity.foliage.FoliageTypeMap;
|
|||||||
import electrosphere.data.entity.item.ItemDataMap;
|
import electrosphere.data.entity.item.ItemDataMap;
|
||||||
import electrosphere.data.entity.item.source.ItemSourcingMap;
|
import electrosphere.data.entity.item.source.ItemSourcingMap;
|
||||||
import electrosphere.data.entity.projectile.ProjectileTypeHolder;
|
import electrosphere.data.entity.projectile.ProjectileTypeHolder;
|
||||||
|
import electrosphere.data.macro.job.CharaJobDataLoader;
|
||||||
import electrosphere.data.macro.struct.StructureDataLoader;
|
import electrosphere.data.macro.struct.StructureDataLoader;
|
||||||
import electrosphere.data.macro.units.UnitDefinitionFile;
|
import electrosphere.data.macro.units.UnitDefinitionFile;
|
||||||
import electrosphere.data.macro.units.UnitLoader;
|
import electrosphere.data.macro.units.UnitLoader;
|
||||||
@ -41,83 +42,102 @@ public class Config {
|
|||||||
/**
|
/**
|
||||||
* Top level user settings object
|
* Top level user settings object
|
||||||
*/
|
*/
|
||||||
UserSettings userSettings;
|
private UserSettings userSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional config that can be included alongside engine to inject a default network to populate on the multiplayer screens
|
* Optional config that can be included alongside engine to inject a default network to populate on the multiplayer screens
|
||||||
*/
|
*/
|
||||||
NetConfig netConfig;
|
private NetConfig netConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The container for all creature definitions
|
* The container for all creature definitions
|
||||||
*/
|
*/
|
||||||
CreatureTypeLoader creatureTypeLoader;
|
private CreatureTypeLoader creatureTypeLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The container for all item definitions
|
* The container for all item definitions
|
||||||
*/
|
*/
|
||||||
ItemDataMap itemMap;
|
private ItemDataMap itemMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The container for all foliage definitions
|
* The container for all foliage definitions
|
||||||
*/
|
*/
|
||||||
FoliageTypeLoader foliageMap;
|
private FoliageTypeLoader foliageMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The object type loader
|
||||||
|
*/
|
||||||
|
private CommonEntityMap objectTypeLoader;
|
||||||
|
|
||||||
CommonEntityMap objectTypeLoader;
|
/**
|
||||||
SymbolMap symbolMap;
|
* The symbol map
|
||||||
|
*/
|
||||||
|
private SymbolMap symbolMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The race data
|
* The race data
|
||||||
*/
|
*/
|
||||||
RaceMap raceMap;
|
private RaceMap raceMap;
|
||||||
ProjectileTypeHolder projectileTypeHolder;
|
|
||||||
|
|
||||||
//data about every voxel type
|
/**
|
||||||
VoxelData voxelData;
|
* The projectile data holder
|
||||||
|
*/
|
||||||
|
private ProjectileTypeHolder projectileTypeHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* data about every voxel type
|
||||||
|
*/
|
||||||
|
private VoxelData voxelData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The block data
|
* The block data
|
||||||
*/
|
*/
|
||||||
BlockData blockData;
|
private BlockData blockData;
|
||||||
|
|
||||||
//the hints that are defined
|
/**
|
||||||
HintDefinition hintData;
|
* the hints that are defined
|
||||||
|
*/
|
||||||
|
private HintDefinition hintData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The surface audio definitions
|
* The surface audio definitions
|
||||||
*/
|
*/
|
||||||
SurfaceAudioCollection surfaceAudioCollection;
|
private SurfaceAudioCollection surfaceAudioCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unit loader
|
* The unit loader
|
||||||
*/
|
*/
|
||||||
UnitLoader unitLoader;
|
private UnitLoader unitLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The crafting recipe map
|
* The crafting recipe map
|
||||||
*/
|
*/
|
||||||
RecipeDataMap recipeMap;
|
private RecipeDataMap recipeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The biome map
|
* The biome map
|
||||||
*/
|
*/
|
||||||
BiomeTypeMap biomeMap;
|
private BiomeTypeMap biomeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of sampler definitions
|
* The list of sampler definitions
|
||||||
*/
|
*/
|
||||||
List<SamplerFile> samplerDefinitions;
|
private List<SamplerFile> samplerDefinitions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The structure data
|
* The structure data
|
||||||
*/
|
*/
|
||||||
StructureDataLoader structureData;
|
private StructureDataLoader structureData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item sourcing map for items
|
* The item sourcing map for items
|
||||||
*/
|
*/
|
||||||
ItemSourcingMap itemSourcingMap;
|
private ItemSourcingMap itemSourcingMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Definitions for job types
|
||||||
|
*/
|
||||||
|
private CharaJobDataLoader charaJobs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the default data
|
* Loads the default data
|
||||||
@ -145,6 +165,7 @@ public class Config {
|
|||||||
config.biomeMap = BiomeTypeMap.loadBiomeFile("Data/game/biomes.json");
|
config.biomeMap = BiomeTypeMap.loadBiomeFile("Data/game/biomes.json");
|
||||||
config.samplerDefinitions = SamplerFile.readSamplerDefinitionFiles("Data/game/voxel");
|
config.samplerDefinitions = SamplerFile.readSamplerDefinitionFiles("Data/game/voxel");
|
||||||
config.structureData = StructureDataLoader.loadStructureFiles("Data/game/structure.json");
|
config.structureData = StructureDataLoader.loadStructureFiles("Data/game/structure.json");
|
||||||
|
config.charaJobs = CharaJobDataLoader.loadJobFiles("Data/macro/jobs.json");
|
||||||
|
|
||||||
//create procedural item types
|
//create procedural item types
|
||||||
ItemDataMap.loadSpawnItems(config.itemMap, config.recipeMap, config.objectTypeLoader);
|
ItemDataMap.loadSpawnItems(config.itemMap, config.recipeMap, config.objectTypeLoader);
|
||||||
@ -175,7 +196,7 @@ public class Config {
|
|||||||
* @param filename The filename
|
* @param filename The filename
|
||||||
* @return The list of entities in the file
|
* @return The list of entities in the file
|
||||||
*/
|
*/
|
||||||
static List<CommonEntityType> recursiveReadEntityLoader(String filename){
|
private static List<CommonEntityType> recursiveReadEntityLoader(String filename){
|
||||||
List<CommonEntityType> typeList = new LinkedList<CommonEntityType>();
|
List<CommonEntityType> typeList = new LinkedList<CommonEntityType>();
|
||||||
CommonEntityLoader loaderFile = FileUtils.loadObjectFromAssetPath(filename, CommonEntityLoader.class);
|
CommonEntityLoader loaderFile = FileUtils.loadObjectFromAssetPath(filename, CommonEntityLoader.class);
|
||||||
//push the types from this file
|
//push the types from this file
|
||||||
@ -197,7 +218,7 @@ public class Config {
|
|||||||
* @param initialPath The initial path to recurse from
|
* @param initialPath The initial path to recurse from
|
||||||
* @return The common entity defintion interface
|
* @return The common entity defintion interface
|
||||||
*/
|
*/
|
||||||
static CommonEntityMap loadCommonEntityTypes(String initialPath) {
|
private static CommonEntityMap loadCommonEntityTypes(String initialPath) {
|
||||||
CommonEntityMap rVal = new CommonEntityMap();
|
CommonEntityMap rVal = new CommonEntityMap();
|
||||||
List<CommonEntityType> typeList = recursiveReadEntityLoader(initialPath);
|
List<CommonEntityType> typeList = recursiveReadEntityLoader(initialPath);
|
||||||
for(CommonEntityType type : typeList){
|
for(CommonEntityType type : typeList){
|
||||||
@ -211,7 +232,7 @@ public class Config {
|
|||||||
* @param filename The filename
|
* @param filename The filename
|
||||||
* @return The list of creatures in the file
|
* @return The list of creatures in the file
|
||||||
*/
|
*/
|
||||||
static List<CreatureData> readCreatureTypeFile(String filename){
|
private static List<CreatureData> readCreatureTypeFile(String filename){
|
||||||
List<CreatureData> typeList = new LinkedList<CreatureData>();
|
List<CreatureData> typeList = new LinkedList<CreatureData>();
|
||||||
CreatureTypeMap typeMap = FileUtils.loadObjectFromAssetPath(filename, CreatureTypeMap.class);
|
CreatureTypeMap typeMap = FileUtils.loadObjectFromAssetPath(filename, CreatureTypeMap.class);
|
||||||
//push the types from this file
|
//push the types from this file
|
||||||
@ -233,7 +254,7 @@ public class Config {
|
|||||||
* @param initialPath The initial path to recurse from
|
* @param initialPath The initial path to recurse from
|
||||||
* @return The creature defintion interface
|
* @return The creature defintion interface
|
||||||
*/
|
*/
|
||||||
static CreatureTypeLoader loadCreatureTypes(String initialPath) {
|
private static CreatureTypeLoader loadCreatureTypes(String initialPath) {
|
||||||
CreatureTypeLoader loader = new CreatureTypeLoader();
|
CreatureTypeLoader loader = new CreatureTypeLoader();
|
||||||
List<CreatureData> typeList = Config.readCreatureTypeFile(initialPath);
|
List<CreatureData> typeList = Config.readCreatureTypeFile(initialPath);
|
||||||
for(CreatureData type : typeList){
|
for(CreatureData type : typeList){
|
||||||
@ -256,7 +277,7 @@ public class Config {
|
|||||||
* @param filename The filename
|
* @param filename The filename
|
||||||
* @return The list of foliage in the file
|
* @return The list of foliage in the file
|
||||||
*/
|
*/
|
||||||
static List<FoliageType> readFoliageTypeFile(String filename){
|
private static List<FoliageType> readFoliageTypeFile(String filename){
|
||||||
List<FoliageType> typeList = new LinkedList<FoliageType>();
|
List<FoliageType> typeList = new LinkedList<FoliageType>();
|
||||||
FoliageTypeMap typeMap = FileUtils.loadObjectFromAssetPath(filename, FoliageTypeMap.class);
|
FoliageTypeMap typeMap = FileUtils.loadObjectFromAssetPath(filename, FoliageTypeMap.class);
|
||||||
//push the types from this file
|
//push the types from this file
|
||||||
@ -278,7 +299,7 @@ public class Config {
|
|||||||
* @param initialPath The initial path to recurse from
|
* @param initialPath The initial path to recurse from
|
||||||
* @return The creature defintion interface
|
* @return The creature defintion interface
|
||||||
*/
|
*/
|
||||||
static FoliageTypeLoader loadFoliageTypes(String initialPath) {
|
private static FoliageTypeLoader loadFoliageTypes(String initialPath) {
|
||||||
FoliageTypeLoader loader = new FoliageTypeLoader();
|
FoliageTypeLoader loader = new FoliageTypeLoader();
|
||||||
List<FoliageType> typeList = Config.readFoliageTypeFile(initialPath);
|
List<FoliageType> typeList = Config.readFoliageTypeFile(initialPath);
|
||||||
for(FoliageType type : typeList){
|
for(FoliageType type : typeList){
|
||||||
@ -438,5 +459,13 @@ public class Config {
|
|||||||
public NetConfig getNetConfig(){
|
public NetConfig getNetConfig(){
|
||||||
return netConfig;
|
return netConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the job definitions
|
||||||
|
* @return The job definitions
|
||||||
|
*/
|
||||||
|
public CharaJobDataLoader getJobDefinitions(){
|
||||||
|
return charaJobs;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
package electrosphere.data.macro.job;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A file that stores job data
|
||||||
|
*/
|
||||||
|
public class CharaJobDataFile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of job definitions
|
||||||
|
*/
|
||||||
|
List<CharaJob> data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All child files of this one
|
||||||
|
*/
|
||||||
|
List<String> files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the job data in this file
|
||||||
|
* @return The job data in this file
|
||||||
|
*/
|
||||||
|
public List<CharaJob> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the job data in this file
|
||||||
|
* @param data The job data in this file
|
||||||
|
*/
|
||||||
|
public void setData(List<CharaJob> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all child files of this one
|
||||||
|
* @return All child files of this one
|
||||||
|
*/
|
||||||
|
public List<String> getFiles() {
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets all child files of this one
|
||||||
|
* @param files All child files of this one
|
||||||
|
*/
|
||||||
|
public void setFiles(List<String> files) {
|
||||||
|
this.files = files;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
package electrosphere.data.macro.job;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import electrosphere.util.FileUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The job type loader
|
||||||
|
*/
|
||||||
|
public class CharaJobDataLoader {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The map of job name -> job data
|
||||||
|
*/
|
||||||
|
Map<String,CharaJob> idTypeMap = new HashMap<String,CharaJob>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of java file object -> job data file at that path
|
||||||
|
*/
|
||||||
|
Map<File,CharaJobDataFile> fileMap = new HashMap<File,CharaJobDataFile>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds job data to the loader
|
||||||
|
* @param name The id of the job
|
||||||
|
* @param type The job data
|
||||||
|
*/
|
||||||
|
public void putType(String name, CharaJob type){
|
||||||
|
idTypeMap.put(name,type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets job data from the id of the type
|
||||||
|
* @param id The id of the type
|
||||||
|
* @return The job data if it exists, null otherwise
|
||||||
|
*/
|
||||||
|
public CharaJob getType(String id){
|
||||||
|
return idTypeMap.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the collection of all job data
|
||||||
|
* @return the collection of all job data
|
||||||
|
*/
|
||||||
|
public Collection<CharaJob> getTypes(){
|
||||||
|
return idTypeMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the set of all job data id's stored in the loader
|
||||||
|
* @return the set of all job data ids
|
||||||
|
*/
|
||||||
|
public Set<String> getTypeIds(){
|
||||||
|
return idTypeMap.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a child job defintion file
|
||||||
|
* @param loader The loader that is loading all the files
|
||||||
|
* @param filename The filename
|
||||||
|
* @return The list of job in the file
|
||||||
|
*/
|
||||||
|
static List<CharaJob> recursiveReadJobLoader(CharaJobDataLoader loader, String filename){
|
||||||
|
List<CharaJob> typeList = new LinkedList<CharaJob>();
|
||||||
|
CharaJobDataFile loaderFile = FileUtils.loadObjectFromAssetPath(filename, CharaJobDataFile.class);
|
||||||
|
loader.fileMap.put(FileUtils.getAssetFile(filename),loaderFile);
|
||||||
|
//push the types from this file
|
||||||
|
for(CharaJob type : loaderFile.getData()){
|
||||||
|
typeList.add(type);
|
||||||
|
}
|
||||||
|
//push types from any other files
|
||||||
|
if(loaderFile.getFiles() != null){
|
||||||
|
for(String filepath : loaderFile.getFiles()){
|
||||||
|
List<CharaJob> parsedTypeList = CharaJobDataLoader.recursiveReadJobLoader(loader, filepath);
|
||||||
|
for(CharaJob type : parsedTypeList){
|
||||||
|
typeList.add(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads all job definition files recursively
|
||||||
|
* @param initialPath The initial path to recurse from
|
||||||
|
* @return The job defintion interface
|
||||||
|
*/
|
||||||
|
public static CharaJobDataLoader loadJobFiles(String initialPath) {
|
||||||
|
CharaJobDataLoader rVal = new CharaJobDataLoader();
|
||||||
|
List<CharaJob> typeList = CharaJobDataLoader.recursiveReadJobLoader(rVal, initialPath);
|
||||||
|
for(CharaJob type : typeList){
|
||||||
|
rVal.putType(type.getName(), type);
|
||||||
|
}
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the updated state of the loader
|
||||||
|
*/
|
||||||
|
public void save(){
|
||||||
|
for(Entry<File,CharaJobDataFile> pair : this.fileMap.entrySet()){
|
||||||
|
FileUtils.serializeObjectToFilePath(pair.getKey(), pair.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user