prefRotation for units
This commit is contained in:
@@ -27,7 +27,7 @@ abstract class BuilderComp implements Unitc{
|
||||
|
||||
@Import float x, y, rotation;
|
||||
|
||||
@SyncLocal Queue<BuildPlan> plans = new Queue<>();
|
||||
@SyncLocal Queue<BuildPlan> plans = new Queue<>(1);
|
||||
@SyncLocal transient boolean updateBuilding = true;
|
||||
|
||||
@Override
|
||||
@@ -35,7 +35,6 @@ abstract class BuilderComp implements Unitc{
|
||||
if(!updateBuilding) return;
|
||||
|
||||
float finalPlaceDst = state.rules.infiniteResources ? Float.MAX_VALUE : buildingRange;
|
||||
|
||||
boolean infinite = state.rules.infiniteResources || team().rules().infiniteResources;
|
||||
|
||||
Iterator<BuildPlan> it = plans.iterator();
|
||||
@@ -69,10 +68,6 @@ abstract class BuilderComp implements Unitc{
|
||||
|
||||
Tile tile = world.tile(current.x, current.y);
|
||||
|
||||
if(within(tile, finalPlaceDst)){
|
||||
lookAt(angleTo(tile));
|
||||
}
|
||||
|
||||
if(!(tile.block() instanceof ConstructBlock)){
|
||||
if(!current.initialized && !current.breaking && Build.validPlace(current.block, team(), current.x, current.y, current.rotation)){
|
||||
boolean hasAll = infinite || !Structs.contains(current.block.requirements, i -> core != null && !core.items.has(i.item));
|
||||
@@ -188,6 +183,10 @@ abstract class BuilderComp implements Unitc{
|
||||
}
|
||||
|
||||
boolean activelyBuilding(){
|
||||
//not actively building when not near the build plan
|
||||
if(isBuilding() && !within(buildPlan(), state.rules.infiniteResources ? Float.MAX_VALUE : buildingRange)){
|
||||
return false;
|
||||
}
|
||||
return isBuilding() && updateBuilding;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user