structure selection
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
7320d3e04f
commit
653822f4f8
@ -1873,6 +1873,7 @@ Rename structure -> virtualstructure
|
||||
Update hometown storage on characters
|
||||
Filter test scenes out of level selection
|
||||
Visualize interaction engine collidables
|
||||
AIs build structures based on their character's race
|
||||
|
||||
|
||||
|
||||
|
||||
@ -90,4 +90,9 @@ public class BlackboardKeys {
|
||||
*/
|
||||
public static final String POINT_TARGET = "pointTarget";
|
||||
|
||||
/**
|
||||
* A town that the entity is targeting
|
||||
*/
|
||||
public static final String TOWN_TARGET = "townTarget";
|
||||
|
||||
}
|
||||
|
||||
@ -7,11 +7,13 @@ import electrosphere.data.struct.StructureData;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.state.server.ServerCharacterData;
|
||||
import electrosphere.server.ai.blackboard.Blackboard;
|
||||
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
||||
import electrosphere.server.ai.nodes.AITreeNode;
|
||||
import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.macro.MacroData;
|
||||
import electrosphere.server.macro.race.Race;
|
||||
import electrosphere.server.macro.structure.VirtualStructure;
|
||||
import electrosphere.server.macro.utils.StructurePlacementUtils;
|
||||
import electrosphere.util.FileUtils;
|
||||
@ -21,17 +23,10 @@ import electrosphere.util.FileUtils;
|
||||
*/
|
||||
public class BeginStructureNode implements AITreeNode {
|
||||
|
||||
/**
|
||||
* The data for the structure to place
|
||||
*/
|
||||
StructureData structureData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param structureData The type of structure to place
|
||||
*/
|
||||
public BeginStructureNode(StructureData structureData){
|
||||
this.structureData = structureData;
|
||||
public BeginStructureNode(){
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,6 +37,14 @@ public class BeginStructureNode implements AITreeNode {
|
||||
MacroData macroData = realm.getMacroData();
|
||||
Vector3d position = EntityUtils.getPosition(entity);
|
||||
|
||||
//get the structures this race can build
|
||||
ServerCharacterData charData = ServerCharacterData.getServerCharacterData(entity);
|
||||
Race race = Race.getRace(charData.getCharacterData());
|
||||
if(race.getStructureIds().size() < 1){
|
||||
throw new Error("Race has no associated structures! " + race.getId());
|
||||
}
|
||||
StructureData structureData = Globals.gameConfigCurrent.getStructureData().getType(race.getStructureIds().get(0));
|
||||
|
||||
//solve where to place
|
||||
Vector3d placementPos = StructurePlacementUtils.getPlacementPosition(macroData, structureData, position);
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package electrosphere.server.ai.trees.character.goals;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
||||
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
||||
import electrosphere.server.ai.nodes.AITreeNode;
|
||||
@ -44,7 +43,7 @@ public class CharacterGoalTree {
|
||||
new SequenceNode(
|
||||
MacroCharacterGoalNode.create(CharacterGoalType.BUILD_STRUCTURE),
|
||||
new PublishStatusNode("Construct a shelter"),
|
||||
new BeginStructureNode(Globals.gameConfigCurrent.getStructureData().getTypes().iterator().next()),
|
||||
new BeginStructureNode(),
|
||||
BuildStructureTree.create()
|
||||
),
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package electrosphere.server.ai.trees.hierarchy.safety.shelter;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.server.ai.nodes.AITreeNode;
|
||||
import electrosphere.server.ai.nodes.checks.spatial.BeginStructureNode;
|
||||
import electrosphere.server.ai.nodes.meta.collections.SequenceNode;
|
||||
@ -25,7 +24,7 @@ public class ConstructShelterTree {
|
||||
public static AITreeNode create(){
|
||||
return new SequenceNode(
|
||||
new PublishStatusNode("Construct a shelter"),
|
||||
new BeginStructureNode(Globals.gameConfigCurrent.getStructureData().getTypes().iterator().next()),
|
||||
new BeginStructureNode(),
|
||||
BuildStructureTree.create(),
|
||||
new SucceederNode(null)
|
||||
);
|
||||
|
||||
@ -260,7 +260,7 @@ public class MacroData {
|
||||
LoggerInterface.loggerEngine.WARNING("Initial races");
|
||||
LoggerInterface.loggerEngine.WARNING("==========================");
|
||||
for(Race race : races){
|
||||
LoggerInterface.loggerEngine.WARNING(race.getName());
|
||||
LoggerInterface.loggerEngine.WARNING(race.getId());
|
||||
int numCharsOfRace = 0;
|
||||
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
||||
for(Character chara : Globals.serverState.characterService.getAllCharacters()){
|
||||
|
||||
@ -42,7 +42,7 @@ public class Race extends CharacterData {
|
||||
* Gets the name of the race
|
||||
* @return The name of the race
|
||||
*/
|
||||
public String getName() {
|
||||
public String getId() {
|
||||
return raceId;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ public class RaceMap {
|
||||
*/
|
||||
public Race getRace(String raceName){
|
||||
for(Race race : raceMap){
|
||||
if(race.getName().equals(raceName)){
|
||||
if(race.getId().equals(raceName)){
|
||||
return race;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user