move macro data around
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
9963c4aa78
commit
6f72167d68
@ -1707,6 +1707,8 @@ Move character utils classe to macro data
|
|||||||
Move CharacterService to service package
|
Move CharacterService to service package
|
||||||
Convert character service to singleton
|
Convert character service to singleton
|
||||||
Start moving character goal logic from behavior trees to macro level simulation
|
Start moving character goal logic from behavior trees to macro level simulation
|
||||||
|
Goal macro data work
|
||||||
|
Shuffle where macro data is stored
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,6 @@ import electrosphere.server.entity.poseactor.PoseModel;
|
|||||||
import electrosphere.server.saves.Save;
|
import electrosphere.server.saves.Save;
|
||||||
import electrosphere.server.service.CharacterService;
|
import electrosphere.server.service.CharacterService;
|
||||||
import electrosphere.server.service.StructureScanningService;
|
import electrosphere.server.service.StructureScanningService;
|
||||||
import electrosphere.server.simulation.MacroSimulation;
|
|
||||||
import electrosphere.server.simulation.MicroSimulation;
|
import electrosphere.server.simulation.MicroSimulation;
|
||||||
import electrosphere.util.FileUtils;
|
import electrosphere.util.FileUtils;
|
||||||
|
|
||||||
@ -329,9 +328,6 @@ public class Globals {
|
|||||||
//manages all models loaded into memory
|
//manages all models loaded into memory
|
||||||
public static AssetManager assetManager;
|
public static AssetManager assetManager;
|
||||||
|
|
||||||
//macro simulation
|
|
||||||
public static MacroSimulation macroSimulation;
|
|
||||||
|
|
||||||
//micro simulation
|
//micro simulation
|
||||||
public static MicroSimulation microSimulation;
|
public static MicroSimulation microSimulation;
|
||||||
|
|
||||||
|
|||||||
@ -219,9 +219,6 @@ public class LoadingUtils {
|
|||||||
if(Globals.microSimulation != null){
|
if(Globals.microSimulation != null){
|
||||||
Globals.microSimulation.setReady(true);
|
Globals.microSimulation.setReady(true);
|
||||||
}
|
}
|
||||||
if(Globals.macroSimulation != null){
|
|
||||||
Globals.macroSimulation.setReady(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,6 @@ public class MainMenuLoading {
|
|||||||
Globals.serverSynchronizationManager = null;
|
Globals.serverSynchronizationManager = null;
|
||||||
Globals.realmManager.reset();
|
Globals.realmManager.reset();
|
||||||
Globals.realmManager = new RealmManager();
|
Globals.realmManager = new RealmManager();
|
||||||
Globals.macroSimulation = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -42,22 +42,13 @@ public class MainServerFunctions {
|
|||||||
MainServerFunctions.simulateServices();
|
MainServerFunctions.simulateServices();
|
||||||
|
|
||||||
//
|
//
|
||||||
//Micro simulation (ie simulating each scene on the server)
|
//Simulation
|
||||||
Globals.profiler.beginCpuSample("MainServerFunctions.simulate - Server micro simulation");
|
Globals.profiler.beginCpuSample("MainServerFunctions.simulate - Realm simulation");
|
||||||
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin server micro simulation");
|
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin server realm simulation");
|
||||||
if(Globals.realmManager != null){
|
if(Globals.realmManager != null){
|
||||||
Globals.realmManager.simulate();
|
Globals.realmManager.simulate();
|
||||||
}
|
}
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
|
|
||||||
//
|
|
||||||
//Macro simulation (ie simulating the larger world macro data)
|
|
||||||
Globals.profiler.beginCpuSample("MainServerFunctions.simulate - Server macro simulation");
|
|
||||||
LoggerInterface.loggerEngine.DEBUG_LOOP("MainServerFunctions.simulate - Server macro simulation");
|
|
||||||
if(Globals.macroSimulation != null && Globals.macroSimulation.isReady()){
|
|
||||||
Globals.macroSimulation.simulate();
|
|
||||||
}
|
|
||||||
Globals.profiler.endCpuSample();
|
|
||||||
|
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class MacroDataExists implements AITreeNode {
|
|||||||
@Override
|
@Override
|
||||||
public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) {
|
public AITreeNodeResult evaluate(Entity entity, Blackboard blackboard) {
|
||||||
Realm entityRealm = Globals.realmManager.getEntityRealm(entity);
|
Realm entityRealm = Globals.realmManager.getEntityRealm(entity);
|
||||||
if(entityRealm.getServerContentManager().getMacroData() == null){
|
if(entityRealm.getMacroData() == null){
|
||||||
return AITreeNodeResult.FAILURE;
|
return AITreeNodeResult.FAILURE;
|
||||||
}
|
}
|
||||||
return AITreeNodeResult.SUCCESS;
|
return AITreeNodeResult.SUCCESS;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class BeginStructureNode implements AITreeNode {
|
|||||||
if(!BeginStructureNode.hasStructureTarget(blackboard)){
|
if(!BeginStructureNode.hasStructureTarget(blackboard)){
|
||||||
//requisite data
|
//requisite data
|
||||||
Realm realm = Globals.realmManager.getEntityRealm(entity);
|
Realm realm = Globals.realmManager.getEntityRealm(entity);
|
||||||
MacroData macroData = realm.getServerContentManager().getMacroData();
|
MacroData macroData = realm.getMacroData();
|
||||||
Vector3d position = EntityUtils.getPosition(entity);
|
Vector3d position = EntityUtils.getPosition(entity);
|
||||||
|
|
||||||
//solve where to place
|
//solve where to place
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import electrosphere.script.ScriptEngine;
|
|||||||
import electrosphere.server.datacell.interfaces.DataCellManager;
|
import electrosphere.server.datacell.interfaces.DataCellManager;
|
||||||
import electrosphere.server.datacell.interfaces.PathfindingManager;
|
import electrosphere.server.datacell.interfaces.PathfindingManager;
|
||||||
import electrosphere.server.entity.ServerContentManager;
|
import electrosphere.server.entity.ServerContentManager;
|
||||||
|
import electrosphere.server.macro.MacroData;
|
||||||
|
import electrosphere.server.simulation.MacroSimulation;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -83,7 +85,12 @@ public class Realm {
|
|||||||
/**
|
/**
|
||||||
* The content manager
|
* The content manager
|
||||||
*/
|
*/
|
||||||
ServerContentManager serverContentManager;
|
ServerContentManager serverContentManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The macro data for the realm
|
||||||
|
*/
|
||||||
|
MacroData macroData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The instanceId of the scene that was loaded with this realm
|
* The instanceId of the scene that was loaded with this realm
|
||||||
@ -102,19 +109,22 @@ public class Realm {
|
|||||||
* @param chemistryEngine The chemistry system collision engine for the realm
|
* @param chemistryEngine The chemistry system collision engine for the realm
|
||||||
* @param hitboxManager The hitbox manager for the realm
|
* @param hitboxManager The hitbox manager for the realm
|
||||||
* @param serverContentManager The content manager for the realm
|
* @param serverContentManager The content manager for the realm
|
||||||
|
* @param macroData The macro data for the realm (can be null if no macro data is present)
|
||||||
*/
|
*/
|
||||||
protected Realm(
|
protected Realm(
|
||||||
ServerWorldData serverWorldData,
|
ServerWorldData serverWorldData,
|
||||||
CollisionEngine collisionEngine,
|
CollisionEngine collisionEngine,
|
||||||
CollisionEngine chemistryEngine,
|
CollisionEngine chemistryEngine,
|
||||||
HitboxManager hitboxManager,
|
HitboxManager hitboxManager,
|
||||||
ServerContentManager serverContentManager
|
ServerContentManager serverContentManager,
|
||||||
|
MacroData macroData
|
||||||
){
|
){
|
||||||
this.serverWorldData = serverWorldData;
|
this.serverWorldData = serverWorldData;
|
||||||
this.collisionEngine = collisionEngine;
|
this.collisionEngine = collisionEngine;
|
||||||
this.chemistryEngine = chemistryEngine;
|
this.chemistryEngine = chemistryEngine;
|
||||||
this.hitboxManager = hitboxManager;
|
this.hitboxManager = hitboxManager;
|
||||||
this.serverContentManager = serverContentManager;
|
this.serverContentManager = serverContentManager;
|
||||||
|
this.macroData = macroData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,6 +237,7 @@ public class Realm {
|
|||||||
*/
|
*/
|
||||||
protected void simulate(){
|
protected void simulate(){
|
||||||
Globals.profiler.beginCpuSample("Realm.simulate");
|
Globals.profiler.beginCpuSample("Realm.simulate");
|
||||||
|
|
||||||
//
|
//
|
||||||
//simulate bullet physics engine step
|
//simulate bullet physics engine step
|
||||||
if(Globals.RUN_PHYSICS){
|
if(Globals.RUN_PHYSICS){
|
||||||
@ -235,12 +246,21 @@ public class Realm {
|
|||||||
PhysicsEntityUtils.serverRepositionEntities(this,collisionEngine);
|
PhysicsEntityUtils.serverRepositionEntities(this,collisionEngine);
|
||||||
chemistryEngine.collide();
|
chemistryEngine.collide();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//hitbox sim
|
//hitbox sim
|
||||||
hitboxManager.simulate();
|
hitboxManager.simulate();
|
||||||
|
|
||||||
//
|
//
|
||||||
//main simulation
|
//main simulation
|
||||||
dataCellManager.simulate();
|
dataCellManager.simulate();
|
||||||
|
|
||||||
|
//
|
||||||
|
//macro data simulation
|
||||||
|
if(this.macroData != null){
|
||||||
|
MacroSimulation.simulate(this.macroData);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//clear collidable impulse lists
|
//clear collidable impulse lists
|
||||||
collisionEngine.clearCollidableImpulseLists();
|
collisionEngine.clearCollidableImpulseLists();
|
||||||
@ -261,8 +281,8 @@ public class Realm {
|
|||||||
dataCellManager.save(saveName);
|
dataCellManager.save(saveName);
|
||||||
serverWorldData.getServerTerrainManager().save(saveName);
|
serverWorldData.getServerTerrainManager().save(saveName);
|
||||||
serverWorldData.getServerBlockManager().save(saveName);
|
serverWorldData.getServerBlockManager().save(saveName);
|
||||||
if(serverContentManager.getMacroData() != null){
|
if(this.macroData != null){
|
||||||
serverContentManager.getMacroData().save(saveName);
|
this.macroData.save(saveName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,5 +354,13 @@ public class Realm {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the macro data in the realm
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MacroData getMacroData(){
|
||||||
|
return this.macroData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,8 @@ public class RealmManager {
|
|||||||
new CollisionEngine(),
|
new CollisionEngine(),
|
||||||
chemistryEngine,
|
chemistryEngine,
|
||||||
new HitboxManager(new ServerHitboxResolutionCallback()),
|
new HitboxManager(new ServerHitboxResolutionCallback()),
|
||||||
ServerContentManager.createServerContentManager(false, null)
|
ServerContentManager.createServerContentManager(false, null),
|
||||||
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,8 @@ public class RealmManager {
|
|||||||
collisionEngine,
|
collisionEngine,
|
||||||
chemistryEngine,
|
chemistryEngine,
|
||||||
new HitboxManager(new ServerHitboxResolutionCallback()),
|
new HitboxManager(new ServerHitboxResolutionCallback()),
|
||||||
serverContentManager
|
serverContentManager,
|
||||||
|
serverContentManager.getMacroData()
|
||||||
);
|
);
|
||||||
//create function classes
|
//create function classes
|
||||||
GriddedDataCellManager griddedDataCellManager = new GriddedDataCellManager(realm);
|
GriddedDataCellManager griddedDataCellManager = new GriddedDataCellManager(realm);
|
||||||
@ -123,7 +125,8 @@ public class RealmManager {
|
|||||||
collisionEngine,
|
collisionEngine,
|
||||||
chemistryEngine,
|
chemistryEngine,
|
||||||
new HitboxManager(new ServerHitboxResolutionCallback()),
|
new HitboxManager(new ServerHitboxResolutionCallback()),
|
||||||
ServerContentManager.createServerContentManager(false, null)
|
ServerContentManager.createServerContentManager(false, null),
|
||||||
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
//add function classes to realm
|
//add function classes to realm
|
||||||
|
|||||||
@ -40,18 +40,38 @@ public class CharacterUtils {
|
|||||||
return (Diety)character.getData(CharacterDataStrings.DIETY);
|
return (Diety)character.getData(CharacterDataStrings.DIETY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the shelter of a character
|
||||||
|
* @param character The character
|
||||||
|
* @param shelter The shelter
|
||||||
|
*/
|
||||||
public static void addShelter(Character character, Structure shelter){
|
public static void addShelter(Character character, Structure shelter){
|
||||||
character.putData(CharacterDataStrings.SHELTER, shelter);
|
character.putData(CharacterDataStrings.SHELTER, shelter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the shelter of a character
|
||||||
|
* @param character The character
|
||||||
|
* @return The shelter if it exists, null otherwise
|
||||||
|
*/
|
||||||
public static Structure getShelter(Character character){
|
public static Structure getShelter(Character character){
|
||||||
return (Structure)character.getData(CharacterDataStrings.SHELTER);
|
return (Structure)character.getData(CharacterDataStrings.SHELTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a hometown to a character
|
||||||
|
* @param character The character
|
||||||
|
* @param town The town
|
||||||
|
*/
|
||||||
public static void addHometown(Character character, Town town){
|
public static void addHometown(Character character, Town town){
|
||||||
character.putData(CharacterDataStrings.HOMETOWN, town);
|
character.putData(CharacterDataStrings.HOMETOWN, town);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hometown of a character
|
||||||
|
* @param character The character
|
||||||
|
* @return The hometown if it exists, null otherwise
|
||||||
|
*/
|
||||||
public static Town getHometown(Character character){
|
public static Town getHometown(Character character){
|
||||||
return (Town)character.getData(CharacterDataStrings.HOMETOWN);
|
return (Town)character.getData(CharacterDataStrings.HOMETOWN);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
package electrosphere.server.macro.character.goal;
|
package electrosphere.server.macro.character.goal;
|
||||||
|
|
||||||
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.server.macro.character.Character;
|
import electrosphere.server.macro.character.Character;
|
||||||
import electrosphere.server.macro.character.data.CharacterData;
|
import electrosphere.server.macro.character.data.CharacterData;
|
||||||
import electrosphere.server.macro.character.data.CharacterDataStrings;
|
import electrosphere.server.macro.character.data.CharacterDataStrings;
|
||||||
|
import electrosphere.server.macro.structure.Structure;
|
||||||
|
import electrosphere.util.annotation.Exclude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for working with goals on macro characters
|
* Utilities for working with goals on macro characters
|
||||||
@ -32,6 +37,30 @@ public class CharacterGoal extends CharacterData {
|
|||||||
*/
|
*/
|
||||||
CharacterGoalType type;
|
CharacterGoalType type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The target structure
|
||||||
|
*/
|
||||||
|
@Exclude
|
||||||
|
Structure structureTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity to target
|
||||||
|
*/
|
||||||
|
@Exclude
|
||||||
|
Entity entityTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of some piece of data to target
|
||||||
|
*/
|
||||||
|
@Exclude
|
||||||
|
String idTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The point to target
|
||||||
|
*/
|
||||||
|
@Exclude
|
||||||
|
Vector3d pointTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param type The type of goal
|
* @param type The type of goal
|
||||||
@ -41,6 +70,17 @@ public class CharacterGoal extends CharacterData {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param type The type of goal
|
||||||
|
* @param target The target of the goal
|
||||||
|
*/
|
||||||
|
public CharacterGoal(CharacterGoalType type, Object target){
|
||||||
|
super(CharacterDataStrings.ENTITY_GOAL);
|
||||||
|
this.type = type;
|
||||||
|
this.setTarget(target);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of goal that this is
|
* Gets the type of goal that this is
|
||||||
* @return The type
|
* @return The type
|
||||||
@ -49,6 +89,24 @@ public class CharacterGoal extends CharacterData {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the target of this tree
|
||||||
|
* @param target The target
|
||||||
|
*/
|
||||||
|
public void setTarget(Object target){
|
||||||
|
if(target instanceof Structure){
|
||||||
|
this.structureTarget = (Structure)target;
|
||||||
|
} else if(target instanceof Entity){
|
||||||
|
this.entityTarget = (Entity)target;
|
||||||
|
} else if(target instanceof String){
|
||||||
|
this.idTarget = (String)target;
|
||||||
|
} else if(target instanceof Vector3d){
|
||||||
|
this.pointTarget = (Vector3d)target;
|
||||||
|
} else {
|
||||||
|
throw new Error("Trying to set target to unsupported type " + target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the goal on a character
|
* Sets the goal on a character
|
||||||
* @param character The character
|
* @param character The character
|
||||||
|
|||||||
@ -2,10 +2,20 @@ package electrosphere.server.simulation;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.game.data.block.BlockFab;
|
||||||
|
import electrosphere.game.data.struct.StructureData;
|
||||||
|
import electrosphere.server.macro.MacroData;
|
||||||
import electrosphere.server.macro.character.Character;
|
import electrosphere.server.macro.character.Character;
|
||||||
import electrosphere.server.macro.character.CharacterUtils;
|
import electrosphere.server.macro.character.CharacterUtils;
|
||||||
import electrosphere.server.macro.character.data.CharacterDataStrings;
|
import electrosphere.server.macro.character.data.CharacterDataStrings;
|
||||||
|
import electrosphere.server.macro.character.goal.CharacterGoal;
|
||||||
|
import electrosphere.server.macro.character.goal.CharacterGoal.CharacterGoalType;
|
||||||
|
import electrosphere.server.macro.structure.Structure;
|
||||||
|
import electrosphere.server.macro.utils.StructurePlacementUtils;
|
||||||
|
import electrosphere.util.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the macro-level (ie virtual, non-physics based) simulation
|
* Performs the macro-level (ie virtual, non-physics based) simulation
|
||||||
@ -20,12 +30,12 @@ public class MacroSimulation {
|
|||||||
/**
|
/**
|
||||||
* Iterates the macro simulation
|
* Iterates the macro simulation
|
||||||
*/
|
*/
|
||||||
public void simulate(){
|
public static void simulate(MacroData macroData){
|
||||||
List<Character> characters = Globals.characterService.getAllCharacters();
|
List<Character> characters = Globals.characterService.getAllCharacters();
|
||||||
if(characters != null && characters.size() > 0){
|
if(characters != null && characters.size() > 0){
|
||||||
for(Character character : Globals.characterService.getAllCharacters()){
|
for(Character character : Globals.characterService.getAllCharacters()){
|
||||||
//do something
|
//do something
|
||||||
MacroSimulation.checkForShelter(character);
|
MacroSimulation.checkForShelter(macroData, character);
|
||||||
MacroSimulation.checkTownMembership(character);
|
MacroSimulation.checkTownMembership(character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +62,7 @@ public class MacroSimulation {
|
|||||||
*/
|
*/
|
||||||
static final int MAX_PLACE_ATTEMPTS = 10;
|
static final int MAX_PLACE_ATTEMPTS = 10;
|
||||||
|
|
||||||
protected static void checkForShelter(Character chara){
|
protected static void checkForShelter(MacroData macroData, Character chara){
|
||||||
// for(Character chara : Globals.macroData.getAliveCharacters()){
|
// for(Character chara : Globals.macroData.getAliveCharacters()){
|
||||||
/*
|
/*
|
||||||
If doesn’t have shelter, check if in town
|
If doesn’t have shelter, check if in town
|
||||||
@ -74,7 +84,21 @@ public class MacroSimulation {
|
|||||||
// //try to find a place to put down a structure
|
// //try to find a place to put down a structure
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// } else {
|
} else {
|
||||||
|
Vector3d position = chara.getPos();
|
||||||
|
StructureData structureData = Globals.gameConfigCurrent.getStructureData().getTypes().iterator().next();
|
||||||
|
|
||||||
|
//solve where to place
|
||||||
|
Vector3d placementPos = StructurePlacementUtils.getPlacementPosition(macroData, structureData, position);
|
||||||
|
|
||||||
|
//add to macro data
|
||||||
|
Structure struct = Structure.createStructure(structureData, placementPos);
|
||||||
|
struct.setRepairable(true);
|
||||||
|
struct.setFab(BlockFab.read(FileUtils.getAssetFile(struct.getFabPath())));
|
||||||
|
CharacterUtils.addShelter(chara, struct);
|
||||||
|
|
||||||
|
//target the struct
|
||||||
|
CharacterGoal.setCharacterGoal(chara, new CharacterGoal(CharacterGoalType.BUILD_STRUCTURE, struct));
|
||||||
// //cry
|
// //cry
|
||||||
// //TODO: Get building type to place
|
// //TODO: Get building type to place
|
||||||
// String buildingTypeToPlace = "building1";
|
// String buildingTypeToPlace = "building1";
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import electrosphere.server.datacell.ServerWorldData;
|
|||||||
import electrosphere.server.physics.terrain.generation.OverworldChunkGenerator;
|
import electrosphere.server.physics.terrain.generation.OverworldChunkGenerator;
|
||||||
import electrosphere.server.physics.terrain.manager.ServerTerrainManager;
|
import electrosphere.server.physics.terrain.manager.ServerTerrainManager;
|
||||||
import electrosphere.server.physics.terrain.models.TerrainModel;
|
import electrosphere.server.physics.terrain.models.TerrainModel;
|
||||||
import electrosphere.server.simulation.MacroSimulation;
|
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -28,8 +27,6 @@ public class TerrainViewer {
|
|||||||
// Utilities.saveObjectToBakedJsonFile("/Config/testingTerrain.json", terrainModel);
|
// Utilities.saveObjectToBakedJsonFile("/Config/testingTerrain.json", terrainModel);
|
||||||
// terrainModel = FileLoadingUtils.loadObjectFromAssetPath("/Config/testingTerrain.json", TerrainModel.class);
|
// terrainModel = FileLoadingUtils.loadObjectFromAssetPath("/Config/testingTerrain.json", TerrainModel.class);
|
||||||
|
|
||||||
MacroSimulation simulation = new MacroSimulation();
|
|
||||||
|
|
||||||
JFrame frame = new JFrame();
|
JFrame frame = new JFrame();
|
||||||
TerrainViewerJComponent jComponent = new TerrainViewerJComponent(terrainModel);
|
TerrainViewerJComponent jComponent = new TerrainViewerJComponent(terrainModel);
|
||||||
frame.add(jComponent);
|
frame.add(jComponent);
|
||||||
@ -41,7 +38,6 @@ public class TerrainViewer {
|
|||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
frame.repaint();
|
frame.repaint();
|
||||||
simulation.simulate();
|
|
||||||
try {
|
try {
|
||||||
TimeUnit.MILLISECONDS.sleep(10);
|
TimeUnit.MILLISECONDS.sleep(10);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user