File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
main/src/omaloon/entities/comp Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 88import mindustry .*;
99import mindustry .gen .*;
1010import mindustry .type .*;
11+ import mindustry .ai .*;
12+ import mindustry .ai .types .*;
1113import omaloon .annotations .Annotations .*;
1214import omaloon .gen .*;
1315import omaloon .type .*;
@@ -188,6 +190,22 @@ public void splitTop(){
188190
189191 @ Override
190192 public void update (){
193+ if (head != null && head != self () && !dead &&
194+ ((Unit )self ()).controller () instanceof CommandAI ai &&
195+ head instanceof Unit u && u .controller () instanceof CommandAI hai &&
196+ ai .command == UnitCommand .moveCommand && ai .hasCommand ()){
197+
198+ if (ai .attackTarget == null ){
199+ if (u .within (ai .targetPos , Math .max (u .hitSize () / 2f , 5f ))){
200+ ai .clearCommands ();
201+ ai .command (null );
202+ }else if (!hai .hasCommand () || !ai .targetPos .equals (hai .targetPos )){
203+ hai .command (ai .command );
204+ hai .commandPosition (ai .targetPos );
205+ }
206+ }
207+ }
208+
191209 if (head .type () instanceof GlasmoreUnitType headType ){
192210 if (headType .killSmallChains && chainLength () < headType .segmentUnits ){
193211 if (dead ) Call .unitDestroy (id ());
@@ -199,7 +217,9 @@ public void update(){
199217 @ Replace
200218 public void rotateMove (Vec2 vec ){
201219 if (head != null && head != self ()){
202- head .rotateMove (vec );
220+ if (((Unit )self ()).isPlayer ()){
221+ head .rotateMove (vec );
222+ }
203223 return ;
204224 }
205225 float len = vec .len ();
You can’t perform that action at this time.
0 commit comments