town job scaffolding
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
653822f4f8
commit
ee1058e71d
@ -1874,6 +1874,9 @@ 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
|
||||
Scaffolding jobs assigned by town to characters
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -45,6 +45,11 @@ public class Town implements MacroAreaObject {
|
||||
*/
|
||||
private List<Character> residents = new LinkedList<Character>();
|
||||
|
||||
/**
|
||||
* The list of jobs queued in the town
|
||||
*/
|
||||
private List<TownJob> jobs = new LinkedList<TownJob>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -98,6 +103,30 @@ public class Town implements MacroAreaObject {
|
||||
return residents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a job to the town
|
||||
* @param job The job
|
||||
*/
|
||||
public void addJob(TownJob job){
|
||||
this.jobs.add(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the jobs in the town
|
||||
* @return The list of jobs
|
||||
*/
|
||||
public List<TownJob> getJobs(){
|
||||
return jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a job from the town
|
||||
* @param job The job
|
||||
*/
|
||||
public void removeJob(TownJob job){
|
||||
this.jobs.remove(job);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3d getPos() {
|
||||
return this.position;
|
||||
|
||||
66
src/main/java/electrosphere/server/macro/town/TownJob.java
Normal file
66
src/main/java/electrosphere/server/macro/town/TownJob.java
Normal file
@ -0,0 +1,66 @@
|
||||
package electrosphere.server.macro.town;
|
||||
|
||||
import electrosphere.server.macro.structure.VirtualStructure;
|
||||
|
||||
/**
|
||||
* A job that a town has queued
|
||||
*/
|
||||
public class TownJob {
|
||||
|
||||
/**
|
||||
* Types of jobs
|
||||
*/
|
||||
public static enum TownJobType {
|
||||
/**
|
||||
* Build a structure
|
||||
*/
|
||||
BUILD_STRUCTURE,
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of the job
|
||||
*/
|
||||
private TownJobType type;
|
||||
|
||||
/**
|
||||
* The structure to target
|
||||
*/
|
||||
private VirtualStructure structureTarget;
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
*/
|
||||
private TownJob(){ }
|
||||
|
||||
/**
|
||||
* Creates a job to build a structure
|
||||
* @param structureTarget The virtual structure
|
||||
* @return The job
|
||||
*/
|
||||
public static TownJob createBuildStructure(VirtualStructure structureTarget){
|
||||
if(structureTarget == null){
|
||||
throw new Error("Target is null!");
|
||||
}
|
||||
TownJob rVal = new TownJob();
|
||||
rVal.type = TownJobType.BUILD_STRUCTURE;
|
||||
rVal.structureTarget = structureTarget;
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of job
|
||||
* @return The type of job
|
||||
*/
|
||||
public TownJobType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the structure that is the target of the job
|
||||
* @return The structure
|
||||
*/
|
||||
public VirtualStructure getStructureTarget() {
|
||||
return structureTarget;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package electrosphere.server.macro.town;
|
||||
|
||||
/**
|
||||
* Simulates town
|
||||
*/
|
||||
public class TownSimulator {
|
||||
|
||||
/**
|
||||
* Simulates a town
|
||||
* @param town The town
|
||||
*/
|
||||
public static void simualte(Town town){
|
||||
//add a job if none exists
|
||||
if(town.getJobs().size() < 1){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,6 +5,8 @@ import java.util.List;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.macro.character.Character;
|
||||
import electrosphere.server.macro.town.Town;
|
||||
import electrosphere.server.macro.town.TownSimulator;
|
||||
import electrosphere.server.service.CharacterService;
|
||||
import electrosphere.server.simulation.chara.CharaSimulation;
|
||||
|
||||
@ -36,6 +38,10 @@ public class MacroSimulation {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Town> towns = realm.getMacroData().getTowns();
|
||||
for(Town town : towns){
|
||||
TownSimulator.simualte(town);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user