Support for unit missiles

This commit is contained in:
Anuken
2021-12-07 16:58:11 -05:00
parent f5e9df1265
commit 0b7d8f371e
16 changed files with 276 additions and 77 deletions

View File

@@ -0,0 +1,34 @@
package mindustry.ai.types;
import mindustry.entities.units.*;
public class MissileAI extends AIController{
//TODO UNPREDICTABLE TARGETING
@Override
public void updateMovement(){
unloadPayloads();
if(target != null){
unit.lookAt(target);
var build = unit.buildOn();
//kill instantly on building contact
//TODO kill on target unit contact too
if(build != null && build == target){
unit.kill();
}
}
//move forward forever
unit.moveAt(vec.trns(unit.rotation, unit.speed()));
}
@Override
public boolean retarget(){
//more frequent retarget. TODO lag?
return timer.get(timerTarget, 10f);
}
}