definiition files
All checks were successful
studiorailgun/trpg/pipeline/head This commit looks good

This commit is contained in:
austin 2025-01-05 16:48:12 -05:00
parent e1daee0a1f
commit 5f5aace1e2
13 changed files with 91 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{
"locations" : [
{
"name" : "Entrance"
"name" : "entrance"
}
],
"dependencies" : [

View File

@ -0,0 +1,6 @@
{
"dependencies" : [
"./data/sim/location/building.json",
"./data/sim/location/wilderness/wilderness.json"
]
}

View File

@ -1,8 +1,10 @@
{
"locations" : [
{
"name" : "field"
}
],
"dependencies" : [
"./data/sim/location/building.json"
]
}

View File

@ -0,0 +1,5 @@
{
"dependencies" : [
"./data/sim/location/wilderness/plains.json"
]
}

View File

@ -0,0 +1,13 @@
{
"name" : "continent",
"childrenMandatory" : [
],
"childrenOptional" : [
"plains"
],
"dependencies" : [
"./data/sim/region/wilderness/wilderness.json",
"./data/sim/region/town/town.json"
]
}

View File

@ -1,5 +1,5 @@
{
"name" : "world",
"name" : "continent",
"childrenMandatory" : [
],

View File

@ -0,0 +1,7 @@
{
"name" : "plains",
"isWilderness" : true,
"discoverables" : [
"field"
]
}

View File

@ -0,0 +1,6 @@
{
"name" : "wilderness",
"dependencies" : [
"./data/sim/region/wilderness/plains.json"
]
}

View File

@ -0,0 +1,9 @@
{
"name" : "world",
"childrenMandatory" : [
"continent"
],
"dependencies" : [
"./data/sim/region/continent.json"
]
}

View File

@ -12,6 +12,8 @@ control
observe
lay
sleep
explore (look for a new region)
search (search for anything in the current region)

View File

@ -14,7 +14,7 @@ public class LocationDefinitionManager {
/**
* Path to the root file
*/
static final String ROOT_FILE_PATH = "./data/sim/location/loc_def.json";
static final String ROOT_FILE_PATH = "./data/sim/location/loc.json";
/**
* The definitions
@ -40,10 +40,17 @@ public class LocationDefinitionManager {
*/
private static void recursivelyParse(LocationDefinitionManager manager, String path){
LocationDefinitionFile defFile = FileUtils.loadObjectFromFile(new File(path), LocationDefinitionFile.class);
if(defFile.getLocations() != null){
for(LocationDefinition def : defFile.getLocations()){
manager.addDefinition(def);
}
}
if(defFile.getDependencies() != null){
for(String depPath : defFile.getDependencies()){
recursivelyParse(manager, depPath);
}
}
}
/**
* Adds a location definition to the manager

View File

@ -22,6 +22,16 @@ public class RegionDefinitionFile {
*/
List<String> childrenOptional;
/**
* If set to true, this will be a wild region that dynamically generates locations as it is explored
*/
Boolean isWilderness;
/**
* The location types that can be discovered in a given wilderness region
*/
List<String> discoverables;
/**
* The region files that this file depends on
*/
@ -39,6 +49,14 @@ public class RegionDefinitionFile {
return childrenOptional;
}
public Boolean isWilderness(){
return isWilderness;
}
public List<String> getDiscoverables() {
return discoverables;
}
public List<String> getDependencies() {
return dependencies;
}

View File

@ -14,7 +14,7 @@ public class RegionDefinitionManager {
/**
* Path to the root file
*/
static final String ROOT_FILE_PATH = "./data/sim/region/region_def.json";
static final String ROOT_FILE_PATH = "./data/sim/region/world.json";
/**
* The definitions
@ -40,8 +40,15 @@ public class RegionDefinitionManager {
*/
private static void recursivelyParse(RegionDefinitionManager manager, String path){
RegionDefinitionFile def = FileUtils.loadObjectFromFile(new File(path), RegionDefinitionFile.class);
if(def.getName() != null){
manager.addDefinition(def);
}
if(def.getDependencies() != null){
for(String depPath : def.getDependencies()){
recursivelyParse(manager, depPath);
}
}
}
/**
* Adds a region definition to the manager