Fixed #1959 / Indication of selected units
This commit is contained in:
@@ -28,4 +28,9 @@ public class MimicAI extends AIController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFollowing(Playerc player){
|
||||||
|
return control == player.unit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class UnitTypes implements ContentList{
|
|||||||
public void load(){
|
public void load(){
|
||||||
|
|
||||||
dagger = new UnitType("dagger"){{
|
dagger = new UnitType("dagger"){{
|
||||||
|
|
||||||
speed = 0.5f;
|
speed = 0.5f;
|
||||||
drag = 0.3f;
|
drag = 0.3f;
|
||||||
hitsize = 8f;
|
hitsize = 8f;
|
||||||
@@ -168,6 +167,7 @@ public class UnitTypes implements ContentList{
|
|||||||
health = 400;
|
health = 400;
|
||||||
buildSpeed = 0.4f;
|
buildSpeed = 0.4f;
|
||||||
engineOffset = 6.5f;
|
engineOffset = 6.5f;
|
||||||
|
hitsize = 7f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,4 +14,8 @@ public interface UnitController{
|
|||||||
default void update(){
|
default void update(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean isFollowing(Playerc player){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ public class UnitType extends UnlockableContent{
|
|||||||
//region drawing
|
//region drawing
|
||||||
|
|
||||||
public void draw(Unitc unit){
|
public void draw(Unitc unit){
|
||||||
|
if(unit.controller().isFollowing(player)){
|
||||||
|
drawControl(unit);
|
||||||
|
}
|
||||||
|
|
||||||
if(unit.isFlying()){
|
if(unit.isFlying()){
|
||||||
Draw.z(Layer.darkness);
|
Draw.z(Layer.darkness);
|
||||||
drawShadow(unit);
|
drawShadow(unit);
|
||||||
@@ -139,6 +143,15 @@ public class UnitType extends UnlockableContent{
|
|||||||
drawLight(unit);
|
drawLight(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawControl(Unitc unit){
|
||||||
|
Draw.z(Layer.groundUnit - 2);
|
||||||
|
|
||||||
|
Draw.color(Pal.accent, Color.white, Mathf.absin(4f, 0.3f));
|
||||||
|
Lines.poly(unit.x(), unit.y(), 4, unit.hitSize() + 1.5f);
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
|
||||||
public void drawShadow(Unitc unit){
|
public void drawShadow(Unitc unit){
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.rect(region, unit.x() + shadowTX * unit.elevation(), unit.y() + shadowTY * unit.elevation(), unit.rotation() - 90);
|
Draw.rect(region, unit.x() + shadowTX * unit.elevation(), unit.y() + shadowTY * unit.elevation(), unit.rotation() - 90);
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
public void onProximityUpdate(){
|
public void onProximityUpdate(){
|
||||||
super.onProximityUpdate();
|
super.onProximityUpdate();
|
||||||
|
|
||||||
|
int lastState = state;
|
||||||
|
|
||||||
state = stateMove;
|
state = stateMove;
|
||||||
|
|
||||||
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
||||||
@@ -160,6 +162,15 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
blendprox |= (1 << i);
|
blendprox |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update other conveyor state when this conveyor's state changes
|
||||||
|
if(state != lastState){
|
||||||
|
for(Tilec near : proximity){
|
||||||
|
if(near instanceof StackConveyorEntity){
|
||||||
|
near.onProximityUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ public class UnitFactory extends Block{
|
|||||||
flags = EnumSet.of(BlockFlag.producer);
|
flags = EnumSet.of(BlockFlag.producer);
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
|
||||||
config(Integer.class, (tile, i) -> ((UnitFactoryEntity)tile).currentPlan = i < 0 || i >= plans.length ? -1 : i);
|
config(Integer.class, (tile, i) -> {
|
||||||
|
((UnitFactoryEntity)tile).currentPlan = i < 0 || i >= plans.length ? -1 : i;
|
||||||
|
((UnitFactoryEntity)tile).progress = 0;
|
||||||
|
});
|
||||||
|
|
||||||
consumes.add(new ConsumeItemDynamic(e -> {
|
consumes.add(new ConsumeItemDynamic(e -> {
|
||||||
UnitFactoryEntity entity = (UnitFactoryEntity)e;
|
UnitFactoryEntity entity = (UnitFactoryEntity)e;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user