This commit is contained in:
Anuken
2020-09-15 13:47:00 -04:00
parent 2e8d6b56df
commit d1b5b7eb3c
6 changed files with 17 additions and 12 deletions

View File

@@ -87,7 +87,7 @@ public class BuilderAI extends AIController{
}
//find new request
if(!unit.team().data().blocks.isEmpty() && following == null){
if(!unit.team().data().blocks.isEmpty() && following == null && timer.get(timerTarget3, 60 * 2f)){
Queue<BlockPlan> blocks = unit.team().data().blocks;
BlockPlan block = blocks.first();

View File

@@ -338,6 +338,8 @@ public class NetClient implements ApplicationListener{
@Remote(variants = Variant.both)
public static void setRules(Rules rules){
state.rules = rules;
//campaign is not valid in multiplayer
state.rules.sector = null;
}
@Remote(variants = Variant.both)

View File

@@ -17,6 +17,7 @@ public class AIController implements UnitController{
protected static final Vec2 vec = new Vec2();
protected static final int timerTarget = 0;
protected static final int timerTarget2 = 1;
protected static final int timerTarget3 = 2;
protected Unit unit;
protected Interval timer = new Interval(4);

View File

@@ -42,6 +42,8 @@ public class NetworkIO{
try(DataInputStream stream = new DataInputStream(is)){
Time.clear();
state.rules = JsonIO.read(Rules.class, stream.readUTF());
//campaign is not valid in multiplayer
state.rules.sector = null;
state.map = new Map(SaveIO.getSaveWriter().readStringMap(stream));
state.wave = stream.readInt();

View File

@@ -28,8 +28,8 @@ public class ExtendingItemBridge extends ItemBridge{
int i = tile.absoluteRelativeTo(other.x, other.y);
float ex = other.worldx() - x - Geometry.d4[i].x * tilesize / 2f,
ey = other.worldy() - y - Geometry.d4[i].y * tilesize / 2f;
float ex = other.worldx() - x - Geometry.d4(i).x * tilesize / 2f,
ey = other.worldy() - y - Geometry.d4(i).y * tilesize / 2f;
float uptime = state.isEditor() ? 1f : this.uptime;
@@ -42,15 +42,15 @@ public class ExtendingItemBridge extends ItemBridge{
Lines.stroke(8f);
Lines.line(bridgeRegion,
x + Geometry.d4[i].x * tilesize / 2f,
y + Geometry.d4[i].y * tilesize / 2f,
x + Geometry.d4(i).x * tilesize / 2f,
y + Geometry.d4(i).y * tilesize / 2f,
x + ex,
y + ey, false);
Draw.rect(endRegion, x, y, i * 90 + 90);
Draw.rect(endRegion,
x + ex + Geometry.d4[i].x * tilesize / 2f,
y + ey + Geometry.d4[i].y * tilesize / 2f, i * 90 + 270);
x + ex + Geometry.d4(i).x * tilesize / 2f,
y + ey + Geometry.d4(i).y * tilesize / 2f, i * 90 + 270);
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
@@ -61,8 +61,8 @@ public class ExtendingItemBridge extends ItemBridge{
for(int a = 0; a < arrows; a++){
Draw.alpha(Mathf.absin(a / (float)arrows - time / 100f, 0.1f, 1f) * uptime * opacity);
Draw.rect(arrowRegion,
x + Geometry.d4[i].x * (tilesize / 2f + a * 6f + 2) * uptime,
y + Geometry.d4[i].y * (tilesize / 2f + a * 6f + 2) * uptime,
x + Geometry.d4(i).x * (tilesize / 2f + a * 6f + 2) * uptime,
y + Geometry.d4(i).y * (tilesize / 2f + a * 6f + 2) * uptime,
i * 90f);
}
Draw.reset();

View File

@@ -99,7 +99,7 @@ public class ItemBridge extends Block{
float h = (link.y == y ? tilesize : Math.abs(link.y - y) * tilesize - tilesize);
Lines.rect((x + link.x) / 2f * tilesize - w / 2f, (y + link.y) / 2f * tilesize - h / 2f, w, h);
Draw.rect("bridge-arrow", link.x * tilesize + Geometry.d4[rot].x * tilesize, link.y * tilesize + Geometry.d4[rot].y * tilesize, link.absoluteRelativeTo(x, y) * 90);
Draw.rect("bridge-arrow", link.x * tilesize + Geometry.d4(rot).x * tilesize, link.y * tilesize + Geometry.d4(rot).y * tilesize, link.absoluteRelativeTo(x, y) * 90);
}
Draw.reset();
}
@@ -321,8 +321,8 @@ public class ItemBridge extends Block{
for(int a = 0; a < arrows; a++){
Draw.alpha(Mathf.absin(a / (float)arrows - time / 100f, 0.1f, 1f) * uptime * opacity);
Draw.rect(arrowRegion,
x + Geometry.d4[i].x * (tilesize / 2f + a * 4f + time % 4f),
y + Geometry.d4[i].y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);
x + Geometry.d4(i).x * (tilesize / 2f + a * 4f + time % 4f),
y + Geometry.d4(i).y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);
}
Draw.reset();
}