mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 07:07:03 +07:00
Docs
This commit is contained in:
parent
fed4d10ec6
commit
25f07e7bcb
@ -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";
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user