Logic rule instruction / Lock erekir proc sectors
This commit is contained in:
@@ -1617,6 +1617,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return switch(sensor){
|
||||
case x -> World.conv(x);
|
||||
case y -> World.conv(y);
|
||||
case color -> Color.toDoubleBits(team.color.r, team.color.g, team.color.b, 1f);
|
||||
case dead -> !isValid() ? 1 : 0;
|
||||
case team -> team.id;
|
||||
case health -> health;
|
||||
|
||||
@@ -2,6 +2,7 @@ package mindustry.entities.comp;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
@@ -195,6 +196,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
case commanded -> controller instanceof FormationAI && isValid() ? 1 : 0;
|
||||
case payloadCount -> ((Object)this) instanceof Payloadc pay ? pay.payloads().size : 0;
|
||||
case size -> hitSize / tilesize;
|
||||
case color -> Color.toDoubleBits(team.color.r, team.color.g, team.color.b, 1f);
|
||||
default -> Float.NaN;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,6 +38,21 @@ public abstract class DrawPart{
|
||||
}
|
||||
}
|
||||
|
||||
public static class PartMove{
|
||||
public PartProgress progress = PartProgress.warmup;
|
||||
public float x, y, rot;
|
||||
|
||||
public PartMove(PartProgress progress, float x, float y, float rot){
|
||||
this.progress = progress;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.rot = rot;
|
||||
}
|
||||
|
||||
public PartMove(){
|
||||
}
|
||||
}
|
||||
|
||||
public interface PartProgress{
|
||||
/** Reload of the weapon - 1 right after shooting, 0 when ready to fire*/
|
||||
PartProgress
|
||||
|
||||
@@ -31,11 +31,12 @@ public class RegionPart extends DrawPart{
|
||||
public Blending blending = Blending.normal;
|
||||
public float layer = -1, layerOffset = 0f;
|
||||
public float outlineLayerOffset = -0.001f;
|
||||
public float rotation, rotMove;
|
||||
public float x, y, moveX, moveY;
|
||||
public float x, y, rotation;
|
||||
public float moveX, moveY, moveRot;
|
||||
public @Nullable Color color, colorTo;
|
||||
public Color heatColor = Pal.turretHeat.cpy();
|
||||
public Seq<DrawPart> children = new Seq<>();
|
||||
public Seq<PartMove> moves = new Seq<>();
|
||||
|
||||
public RegionPart(String region){
|
||||
this.suffix = region;
|
||||
@@ -61,6 +62,17 @@ public class RegionPart extends DrawPart{
|
||||
|
||||
float prevZ = Draw.z();
|
||||
float prog = progress.getClamp(params);
|
||||
float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog;
|
||||
|
||||
if(moves.size > 0){
|
||||
for(int i = 0; i < moves.size; i++){
|
||||
var move = moves.get(i);
|
||||
float p = move.progress.getClamp(params);
|
||||
mx += move.x * p;
|
||||
my += move.y * p;
|
||||
mr += move.rot * p;
|
||||
}
|
||||
}
|
||||
|
||||
int len = mirror && params.sideOverride == -1 ? 2 : 1;
|
||||
|
||||
@@ -71,12 +83,12 @@ public class RegionPart extends DrawPart{
|
||||
//can be null
|
||||
var region = drawRegion ? regions[Math.min(i, regions.length - 1)] : null;
|
||||
float sign = (i == 0 ? 1 : -1) * params.sideMultiplier;
|
||||
Tmp.v1.set((x + moveX * prog) * sign, y + moveY * prog).rotate(params.rotation - 90);
|
||||
Tmp.v1.set((x + mx) * sign, y + my).rotate(params.rotation - 90);
|
||||
|
||||
float
|
||||
rx = params.x + Tmp.v1.x,
|
||||
ry = params.y + Tmp.v1.y,
|
||||
rot = rotMove * prog * sign + params.rotation - 90;
|
||||
rot = mr * sign + params.rotation - 90;
|
||||
|
||||
Draw.xscl = sign;
|
||||
|
||||
@@ -113,9 +125,9 @@ public class RegionPart extends DrawPart{
|
||||
for(int s = 0; s < len; s++){
|
||||
int i = (params.sideOverride == -1 ? s : params.sideOverride);
|
||||
float sign = (i == 1 ? -1 : 1) * params.sideMultiplier;
|
||||
Tmp.v1.set((x + moveX * prog) * sign, y + moveY * prog).rotate(params.rotation - 90);
|
||||
Tmp.v1.set((x + mx) * sign, y + my).rotate(params.rotation - 90);
|
||||
|
||||
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + rotMove * prog * sign + params.rotation);
|
||||
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + mr * sign + params.rotation);
|
||||
childParam.sideMultiplier = params.sideMultiplier;
|
||||
childParam.life = params.life;
|
||||
childParam.sideOverride = i;
|
||||
|
||||
Reference in New Issue
Block a user