No Erekir default AI / Core unit tweaks

This commit is contained in:
Anuken
2022-02-06 20:54:57 -05:00
parent cb110e5e6f
commit ce82b3943e
13 changed files with 147 additions and 73 deletions
@@ -98,18 +98,18 @@ public class RepairPoint extends Block{
return new TextureRegion[]{baseRegion, region};
}
public static void drawBeam(float x, float y, float rotation, float length, int id, Sized target, Team team,
public static void drawBeam(float x, float y, float rotation, float length, int id, @Nullable Sized target, Team team,
float strength, float pulseStroke, float pulseRadius, float beamWidth,
Vec2 lastEnd, Vec2 offset,
Color laserColor, Color laserTopColor,
TextureRegion laser, TextureRegion laserEnd, TextureRegion laserTop, TextureRegion laserTopEnd){
rand.setSeed(id + (target instanceof Entityc e ? e.id() : 0));
if(target != null){
float
originX = x + Angles.trnsx(rotation, length),
originY = y + Angles.trnsy(rotation, length);
rand.setSeed(id + (target instanceof Entityc e ? e.id() : 0));
lastEnd.set(target).sub(originX, originY);
lastEnd.setLength(Math.max(2f, lastEnd.len()));
@@ -172,7 +172,7 @@ public class UnitAssembler extends PayloadBlock{
public Seq<Unit> units = new Seq<>();
public Seq<UnitAssemblerModuleBuild> modules = new Seq<>();
public BlockSeq blocks = new BlockSeq();
public float progress, warmup, droneWarmup;
public float progress, warmup, droneWarmup, powerWarmup;
public float invalidWarmup = 0f;
public int currentTier = 0;
public boolean wasOccupied = false;
@@ -284,6 +284,7 @@ public class UnitAssembler extends PayloadBlock{
units.removeAll(u -> !u.isAdded() || u.dead || !(u.controller() instanceof AssemblerAI));
powerWarmup = Mathf.lerpDelta(powerWarmup, efficiency(), 0.1f);
droneWarmup = Mathf.lerpDelta(droneWarmup, units.size < dronesCreated ? efficiency() : 0f, 0.1f);
totalDroneProgress += droneWarmup * Time.delta;
@@ -380,6 +381,7 @@ public class UnitAssembler extends PayloadBlock{
var plan = plan();
//draw the unit construction as outline
Draw.draw(Layer.blockBuilding, () -> {
Draw.color(Pal.accent, warmup);
@@ -397,8 +399,9 @@ public class UnitAssembler extends PayloadBlock{
Draw.z(Layer.buildBeam);
//draw unit outline
//draw unit silhouette
Draw.mixcol(Tmp.c1.set(Pal.accent).lerp(Pal.remove, invalidWarmup), 1f);
Draw.alpha(powerWarmup);
Draw.rect(plan.unit.fullIcon, spawn.x, spawn.y);
//build beams do not draw when invalid
@@ -423,6 +426,7 @@ public class UnitAssembler extends PayloadBlock{
//draw full area
Lines.stroke(2f, Pal.accent);
Draw.alpha(powerWarmup);
Drawf.dashRectBasic(spawn.x - fulls, spawn.y - fulls, fulls*2f, fulls*2f);
Draw.reset();