Bugfixes
This commit is contained in:
@@ -7,9 +7,11 @@ import mindustry.game.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
import static mindustry.Vars.pathfinder;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class GroundAI extends AIController{
|
public class GroundAI extends AIController{
|
||||||
|
//static final float commandCooldown = 60f * 10;
|
||||||
|
//float commandTimer = 60*3;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateMovement(){
|
public void updateMovement(){
|
||||||
@@ -33,6 +35,21 @@ public class GroundAI extends AIController{
|
|||||||
}else if(unit.moving()){
|
}else if(unit.moving()){
|
||||||
unit.lookAt(unit.vel().angle());
|
unit.lookAt(unit.vel().angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//auto-command works but it's very buggy
|
||||||
|
/*
|
||||||
|
if(unit instanceof Commanderc){
|
||||||
|
Commanderc c = (Commanderc)unit;
|
||||||
|
//try to command when missing members
|
||||||
|
if(c.controlling().size <= unit.type().commandLimit/2){
|
||||||
|
commandTimer -= Time.delta;
|
||||||
|
|
||||||
|
if(commandTimer <= 0){
|
||||||
|
c.commandNearby(new SquareFormation(), u -> !(u.controller() instanceof FormationAI) && !(u instanceof Commanderc));
|
||||||
|
commandTimer = commandCooldown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void moveToCore(FlagTarget path){
|
protected void moveToCore(FlagTarget path){
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ public class Fx{
|
|||||||
float scl = 1f + e.fout() * 2f;
|
float scl = 1f + e.fout() * 2f;
|
||||||
|
|
||||||
UnitType unit = e.data();
|
UnitType unit = e.data();
|
||||||
rect(unit.region, e.x, e.y,
|
TextureRegion region = unit.icon(Cicon.full);
|
||||||
unit.region.getWidth() * Draw.scl * scl, unit.region.getHeight() * Draw.scl * scl, 180f);
|
|
||||||
|
rect(region, e.x, e.y,
|
||||||
|
region.getWidth() * Draw.scl * scl, region.getHeight() * Draw.scl * scl, 180f);
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -331,6 +331,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
//endregion
|
//endregion
|
||||||
//region handler methods
|
//region handler methods
|
||||||
|
|
||||||
|
/** Called when this block is dropped as a payload. */
|
||||||
|
public void dropped(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** This is for logic blocks. */
|
/** This is for logic blocks. */
|
||||||
public void handleString(Object value){
|
public void handleString(Object value){
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package mindustry.entities.comp;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
|
import arc.func.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.ai.formations.*;
|
import mindustry.ai.formations.*;
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
@@ -12,6 +15,7 @@ import mindustry.gen.*;
|
|||||||
@Component
|
@Component
|
||||||
abstract class CommanderComp implements Unitc{
|
abstract class CommanderComp implements Unitc{
|
||||||
private static final Seq<FormationMember> members = new Seq<>();
|
private static final Seq<FormationMember> members = new Seq<>();
|
||||||
|
private static final Seq<Unit> units = new Seq<>();
|
||||||
|
|
||||||
@Import float x, y, rotation;
|
@Import float x, y, rotation;
|
||||||
|
|
||||||
@@ -44,6 +48,28 @@ abstract class CommanderComp implements Unitc{
|
|||||||
clearCommand();
|
clearCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void commandNearby(FormationPattern pattern){
|
||||||
|
commandNearby(pattern, u -> true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void commandNearby(FormationPattern pattern, Boolf<Unit> include){
|
||||||
|
Formation formation = new Formation(new Vec3(x, y, rotation), pattern);
|
||||||
|
formation.slotAssignmentStrategy = new DistanceAssignmentStrategy(pattern);
|
||||||
|
|
||||||
|
units.clear();
|
||||||
|
|
||||||
|
Units.nearby(team(), x, y, 200f, u -> {
|
||||||
|
if(u.isAI() && include.get(u) && u != base()){
|
||||||
|
units.add(u);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
units.sort(u -> u.dst2(this));
|
||||||
|
units.truncate(type().commandLimit);
|
||||||
|
|
||||||
|
command(formation, units);
|
||||||
|
}
|
||||||
|
|
||||||
void command(Formation formation, Seq<Unit> units){
|
void command(Formation formation, Seq<Unit> units){
|
||||||
clearCommand();
|
clearCommand();
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc, Unitc{
|
|||||||
|
|
||||||
Draw.z(Layer.debris);
|
Draw.z(Layer.debris);
|
||||||
|
|
||||||
Floor floor = floorOn();
|
Floor floor = tileOn() == null ? Blocks.air.asFloor() : tileOn().floor();
|
||||||
Color color = Tmp.c1.set(floor.mapColor).mul(1.5f);
|
Color color = Tmp.c1.set(floor.mapColor.equals(Color.black) ? Blocks.water.mapColor : floor.mapColor).mul(1.5f);
|
||||||
trailColor.lerp(color, Mathf.clamp(Time.delta * 0.04f));
|
trailColor.lerp(color, Mathf.clamp(Time.delta * 0.04f));
|
||||||
|
|
||||||
tleft.draw(trailColor, type.trailScl);
|
tleft.draw(trailColor, type.trailScl);
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ public class DefaultWaves{
|
|||||||
max = 4;
|
max = 4;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
new SpawnGroup(UnitTypes.pulsar){{
|
||||||
|
begin = 13;
|
||||||
|
spacing = 3;
|
||||||
|
unitScaling = 0.5f;
|
||||||
|
}},
|
||||||
|
|
||||||
new SpawnGroup(UnitTypes.mace){{
|
new SpawnGroup(UnitTypes.mace){{
|
||||||
begin = 7;
|
begin = 7;
|
||||||
spacing = 3;
|
spacing = 3;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import arc.scene.ui.layout.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ai.formations.*;
|
|
||||||
import mindustry.ai.formations.patterns.*;
|
import mindustry.ai.formations.patterns.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -261,23 +260,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(commander.isCommanding()){
|
if(commander.isCommanding()){
|
||||||
commander.clearCommand();
|
commander.clearCommand();
|
||||||
}else{
|
}else{
|
||||||
FormationPattern pattern = new SquareFormation();
|
|
||||||
Formation formation = new Formation(new Vec3(player.x, player.y, player.unit().rotation), pattern);
|
|
||||||
formation.slotAssignmentStrategy = new DistanceAssignmentStrategy(pattern);
|
|
||||||
|
|
||||||
units.clear();
|
|
||||||
|
|
||||||
|
commander.commandNearby(new SquareFormation());
|
||||||
Fx.commandSend.at(player);
|
Fx.commandSend.at(player);
|
||||||
Units.nearby(player.team(), player.x, player.y, 200f, u -> {
|
|
||||||
if(u.isAI()){
|
|
||||||
units.add(u);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
units.sort(u -> u.dst2(player.unit()));
|
|
||||||
units.truncate(player.unit().type().commandLimit);
|
|
||||||
|
|
||||||
commander.command(formation, units);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class ForceProjector extends Block{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
//TODO this isn't good enough, shields are still clipped
|
||||||
expanded = true;
|
expanded = true;
|
||||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
|
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,11 @@ public class LogicBlock extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
Drawf.circles(x*tilesize + offset, y*tilesize + offset, range);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object pointConfig(Object config, Cons<Point2> transformer){
|
public Object pointConfig(Object config, Cons<Point2> transformer){
|
||||||
if(config instanceof byte[]){
|
if(config instanceof byte[]){
|
||||||
@@ -389,10 +394,7 @@ public class LogicBlock extends Block{
|
|||||||
return other != null && other.isValid() && other.team == team && other.within(this, range + other.block.size*tilesize/2f) && !(other instanceof BuildEntity);
|
return other != null && other.isValid() && other.team == team && other.within(this, range + other.block.size*tilesize/2f) && !(other instanceof BuildEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawSelect(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildConfiguration(Table table){
|
public void buildConfiguration(Table table){
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class BlockPayload implements Payload{
|
|||||||
|
|
||||||
public void place(Tile tile, int rotation){
|
public void place(Tile tile, int rotation){
|
||||||
tile.setBlock(entity.block(), entity.team(), rotation, () -> entity);
|
tile.setBlock(entity.block(), entity.team(), rotation, () -> entity);
|
||||||
|
entity.dropped();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -306,6 +306,14 @@ public class PowerNode extends PowerBlock{
|
|||||||
super.placed();
|
super.placed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropped(){
|
||||||
|
power.links.clear();
|
||||||
|
//create new power graph to manually unlink (this may be redundant)
|
||||||
|
power.graph = new PowerGraph();
|
||||||
|
power.graph.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
power.graph.update();
|
power.graph.update();
|
||||||
|
|||||||
Reference in New Issue
Block a user