mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-08 23:07:33 +07:00
Bugfixes
This commit is contained in:
@ -19,6 +19,8 @@ public class BuilderAI extends AIController{
|
||||
builder.lookAt(builder.vel().angle());
|
||||
}
|
||||
|
||||
builder.updateBuilding(true);
|
||||
|
||||
//approach request if building
|
||||
if(builder.buildPlan() != null){
|
||||
BuildPlan req = builder.buildPlan();
|
||||
|
@ -554,7 +554,7 @@ public class NetClient implements ApplicationListener{
|
||||
void sync(){
|
||||
if(timer.get(0, playerSyncTime)){
|
||||
BuildPlan[] requests = null;
|
||||
if(player.isBuilder() && control.input.isBuilding){
|
||||
if(player.isBuilder()){
|
||||
//limit to 10 to prevent buffer overflows
|
||||
int usedRequests = Math.min(player.builder().plans().size, 10);
|
||||
|
||||
@ -574,7 +574,7 @@ public class NetClient implements ApplicationListener{
|
||||
unit instanceof Mechc ? ((Mechc)unit).baseRotation() : 0,
|
||||
unit.vel.x, unit.vel.y,
|
||||
player.miner().mineTile(),
|
||||
player.boosting, player.shooting, ui.chatfrag.shown(),
|
||||
player.boosting, player.shooting, ui.chatfrag.shown(), control.input.isBuilding,
|
||||
requests,
|
||||
Core.camera.position.x, Core.camera.position.y,
|
||||
Core.camera.width * viewScale, Core.camera.height * viewScale);
|
||||
|
@ -6,8 +6,8 @@ import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.CommandHandler.*;
|
||||
import arc.util.io.*;
|
||||
import arc.util.serialization.*;
|
||||
@ -535,7 +535,7 @@ public class NetServer implements ApplicationListener{
|
||||
float rotation, float baseRotation,
|
||||
float xVelocity, float yVelocity,
|
||||
Tile mining,
|
||||
boolean boosting, boolean shooting, boolean chatting,
|
||||
boolean boosting, boolean shooting, boolean chatting, boolean building,
|
||||
@Nullable BuildPlan[] requests,
|
||||
float viewX, float viewY, float viewWidth, float viewHeight
|
||||
){
|
||||
@ -572,6 +572,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
if(player.isBuilder()){
|
||||
player.builder().clearBuilding();
|
||||
player.builder().updateBuilding(building);
|
||||
}
|
||||
|
||||
if(player.isMiner()){
|
||||
|
@ -29,13 +29,7 @@ abstract class BuilderComp implements Unitc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
@SyncLocal Queue<BuildPlan> plans = new Queue<>();
|
||||
transient boolean updateBuilding = true;
|
||||
|
||||
@Override
|
||||
public void controller(UnitController next){
|
||||
//reset building state so AI controlled units will always start off building
|
||||
updateBuilding = true;
|
||||
}
|
||||
@SyncLocal transient boolean updateBuilding = true;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
@ -85,12 +79,12 @@ abstract class BuilderComp implements Unitc{
|
||||
boolean hasAll = infinite || !Structs.contains(current.block.requirements, i -> core != null && !core.items.has(i.item));
|
||||
|
||||
if(hasAll){
|
||||
Build.beginPlace(current.block, team(), current.x, current.y, current.rotation);
|
||||
Call.beginPlace(current.block, team(), current.x, current.y, current.rotation);
|
||||
}else{
|
||||
current.stuck = true;
|
||||
}
|
||||
}else if(!current.initialized && current.breaking && Build.validBreak(team(), current.x, current.y)){
|
||||
Build.beginBreak(team(), current.x, current.y);
|
||||
Call.beginBreak(team(), current.x, current.y);
|
||||
}else{
|
||||
plans.removeFirst();
|
||||
return;
|
||||
|
@ -326,6 +326,8 @@ public class LExecutor{
|
||||
}
|
||||
|
||||
exec.setobj(output, targeted);
|
||||
}else{
|
||||
exec.setobj(output, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user