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
|
Update hometown storage on characters
|
||||||
Filter test scenes out of level selection
|
Filter test scenes out of level selection
|
||||||
Visualize interaction engine collidables
|
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";
|
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.engine.Globals;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.entity.state.server.ServerCharacterData;
|
||||||
import electrosphere.server.ai.blackboard.Blackboard;
|
import electrosphere.server.ai.blackboard.Blackboard;
|
||||||
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
||||||
import electrosphere.server.ai.nodes.AITreeNode;
|
import electrosphere.server.ai.nodes.AITreeNode;
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
import electrosphere.server.macro.MacroData;
|
import electrosphere.server.macro.MacroData;
|
||||||
|
import electrosphere.server.macro.race.Race;
|
||||||
import electrosphere.server.macro.structure.VirtualStructure;
|
import electrosphere.server.macro.structure.VirtualStructure;
|
||||||
import electrosphere.server.macro.utils.StructurePlacementUtils;
|
import electrosphere.server.macro.utils.StructurePlacementUtils;
|
||||||
import electrosphere.util.FileUtils;
|
import electrosphere.util.FileUtils;
|
||||||
@ -21,17 +23,10 @@ import electrosphere.util.FileUtils;
|
|||||||
*/
|
*/
|
||||||
public class BeginStructureNode implements AITreeNode {
|
public class BeginStructureNode implements AITreeNode {
|
||||||
|
|
||||||
/**
|
|
||||||
* The data for the structure to place
|
|
||||||
*/
|
|
||||||
StructureData structureData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param structureData The type of structure to place
|
|
||||||
*/
|
*/
|
||||||
public BeginStructureNode(StructureData structureData){
|
public BeginStructureNode(){
|
||||||
this.structureData = structureData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,6 +37,14 @@ public class BeginStructureNode implements AITreeNode {
|
|||||||
MacroData macroData = realm.getMacroData();
|
MacroData macroData = realm.getMacroData();
|
||||||
Vector3d position = EntityUtils.getPosition(entity);
|
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
|
//solve where to place
|
||||||
Vector3d placementPos = StructurePlacementUtils.getPlacementPosition(macroData, structureData, position);
|
Vector3d placementPos = StructurePlacementUtils.getPlacementPosition(macroData, structureData, position);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package electrosphere.server.ai.trees.character.goals;
|
package electrosphere.server.ai.trees.character.goals;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
|
||||||
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing;
|
||||||
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
import electrosphere.server.ai.blackboard.BlackboardKeys;
|
||||||
import electrosphere.server.ai.nodes.AITreeNode;
|
import electrosphere.server.ai.nodes.AITreeNode;
|
||||||
@ -44,7 +43,7 @@ public class CharacterGoalTree {
|
|||||||
new SequenceNode(
|
new SequenceNode(
|
||||||
MacroCharacterGoalNode.create(CharacterGoalType.BUILD_STRUCTURE),
|
MacroCharacterGoalNode.create(CharacterGoalType.BUILD_STRUCTURE),
|
||||||
new PublishStatusNode("Construct a shelter"),
|
new PublishStatusNode("Construct a shelter"),
|
||||||
new BeginStructureNode(Globals.gameConfigCurrent.getStructureData().getTypes().iterator().next()),
|
new BeginStructureNode(),
|
||||||
BuildStructureTree.create()
|
BuildStructureTree.create()
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package electrosphere.server.ai.trees.hierarchy.safety.shelter;
|
package electrosphere.server.ai.trees.hierarchy.safety.shelter;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
|
||||||
import electrosphere.server.ai.nodes.AITreeNode;
|
import electrosphere.server.ai.nodes.AITreeNode;
|
||||||
import electrosphere.server.ai.nodes.checks.spatial.BeginStructureNode;
|
import electrosphere.server.ai.nodes.checks.spatial.BeginStructureNode;
|
||||||
import electrosphere.server.ai.nodes.meta.collections.SequenceNode;
|
import electrosphere.server.ai.nodes.meta.collections.SequenceNode;
|
||||||
@ -25,7 +24,7 @@ public class ConstructShelterTree {
|
|||||||
public static AITreeNode create(){
|
public static AITreeNode create(){
|
||||||
return new SequenceNode(
|
return new SequenceNode(
|
||||||
new PublishStatusNode("Construct a shelter"),
|
new PublishStatusNode("Construct a shelter"),
|
||||||
new BeginStructureNode(Globals.gameConfigCurrent.getStructureData().getTypes().iterator().next()),
|
new BeginStructureNode(),
|
||||||
BuildStructureTree.create(),
|
BuildStructureTree.create(),
|
||||||
new SucceederNode(null)
|
new SucceederNode(null)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -260,7 +260,7 @@ public class MacroData {
|
|||||||
LoggerInterface.loggerEngine.WARNING("Initial races");
|
LoggerInterface.loggerEngine.WARNING("Initial races");
|
||||||
LoggerInterface.loggerEngine.WARNING("==========================");
|
LoggerInterface.loggerEngine.WARNING("==========================");
|
||||||
for(Race race : races){
|
for(Race race : races){
|
||||||
LoggerInterface.loggerEngine.WARNING(race.getName());
|
LoggerInterface.loggerEngine.WARNING(race.getId());
|
||||||
int numCharsOfRace = 0;
|
int numCharsOfRace = 0;
|
||||||
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
//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()){
|
for(Character chara : Globals.serverState.characterService.getAllCharacters()){
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class Race extends CharacterData {
|
|||||||
* Gets the name of the race
|
* Gets the name of the race
|
||||||
* @return The name of the race
|
* @return The name of the race
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getId() {
|
||||||
return raceId;
|
return raceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public class RaceMap {
|
|||||||
*/
|
*/
|
||||||
public Race getRace(String raceName){
|
public Race getRace(String raceName){
|
||||||
for(Race race : raceMap){
|
for(Race race : raceMap){
|
||||||
if(race.getName().equals(raceName)){
|
if(race.getId().equals(raceName)){
|
||||||
return race;
|
return race;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user