diff --git a/annotations/src/main/java/mindustry/annotations/Annotations.java b/annotations/src/main/java/mindustry/annotations/Annotations.java index 7fec308493..2e58e13f49 100644 --- a/annotations/src/main/java/mindustry/annotations/Annotations.java +++ b/annotations/src/main/java/mindustry/annotations/Annotations.java @@ -87,12 +87,22 @@ public class Annotations{ //endregion //region misc. utility + /** Automatically loads block regions annotated with this. */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.SOURCE) public @interface Load{ + /** + * The region name to load. Variables can be used: + * "@" -> block name + * "$size" -> block size + * "#" "#1" "#2" -> index number, for arrays + * */ String value(); + /** 1D Array length, if applicable. */ int length() default 1; + /** 2D array lengths. */ int[] lengths() default {}; + /** Fallback string used to replace "@" (the block name) if the region isn't found. */ String fallback() default "error"; } diff --git a/core/src/mindustry/ai/types/MimicAI.java b/core/src/mindustry/ai/types/FormationAI.java similarity index 72% rename from core/src/mindustry/ai/types/MimicAI.java rename to core/src/mindustry/ai/types/FormationAI.java index fbb8eef8db..5a605cb993 100644 --- a/core/src/mindustry/ai/types/MimicAI.java +++ b/core/src/mindustry/ai/types/FormationAI.java @@ -1,31 +1,31 @@ package mindustry.ai.types; import arc.util.ArcAnnotate.*; -import arc.util.*; import mindustry.entities.units.*; import mindustry.gen.*; -public class MimicAI extends AIController{ +public class FormationAI extends AIController{ public @Nullable Unitc control; - public MimicAI(@Nullable Unitc control){ + public FormationAI(@Nullable Unitc control){ this.control = control; } - public MimicAI(){ + public FormationAI(){ } @Override public void update(){ if(control != null){ + unit.controlWeapons(control.isRotate(), control.isShooting()); - //TODO this isn't accurate - unit.moveAt(Tmp.v1.set(control.vel()).limit(unit.type().speed)); + // unit.moveAt(Tmp.v1.set(deltaX, deltaY).limit(unit.type().speed)); if(control.isShooting()){ unit.aimLook(control.aimX(), control.aimY()); }else{ unit.lookAt(unit.vel().angle()); } + } } diff --git a/core/src/mindustry/async/PhysicsProcess.java b/core/src/mindustry/async/PhysicsProcess.java index de19d8d53f..c01007d3af 100644 --- a/core/src/mindustry/async/PhysicsProcess.java +++ b/core/src/mindustry/async/PhysicsProcess.java @@ -120,7 +120,8 @@ public class PhysicsProcess implements AsyncProcess{ //save last position ref.position.set(entity); - entity.vel().add(ref.velocity).sub(ref.lastVelocity); + //add delta velocity - this doesn't work very well yet + //entity.vel().add(ref.velocity).sub(ref.lastVelocity); } } diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index d5fc57fe7c..14266bd308 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -186,7 +186,7 @@ public class DesktopInput extends InputHandler{ Fx.commandSend.at(player); Units.nearby(player.team(), player.x(), player.y(), 200f, u -> { if(u.isAI()){ - u.controller(new MimicAI(player.unit())); + u.controller(new FormationAI(player.unit())); } }); }