10
10
import arc .util .*;
11
11
import arc .util .io .*;
12
12
import extrasandredux .util .*;
13
+ import extrasandredux .world .blocks .logic .TurretController .TurretControllerBuild .*;
13
14
import mindustry .entities .units .*;
14
15
import mindustry .game .*;
15
16
import mindustry .gen .*;
23
24
import static mindustry .Vars .*;
24
25
25
26
public class TurretController extends Block {
27
+ protected static Vec2 tmpVec = new Vec2 ();
28
+
26
29
protected TextureRegion modeRegion ;
27
30
protected TextureRegion plugRegion0 , plugRegion1 ;
28
31
@@ -36,6 +39,7 @@ public TurretController(String name){
36
39
rotateDraw = false ;
37
40
configurable = true ;
38
41
saveConfig = false ;
42
+ commandable = true ;
39
43
40
44
config (Integer .class , (TurretControllerBuild tile , Integer state ) -> {
41
45
tile .controlState = ControlState .values ()[state ];
@@ -81,6 +85,23 @@ public class TurretControllerBuild extends Building{
81
85
/** x = angle, y = distance */
82
86
public Vec2 targetSetting = new Vec2 ();
83
87
88
+ @ Override
89
+ public Vec2 getCommandPosition (){
90
+ if (front () instanceof TurretBuild b && b .team == team ){
91
+ tmpVec .trns (targetSetting .x , targetSetting .y ).add (b );
92
+ return tmpVec ;
93
+ }else {
94
+ return null ;
95
+ }
96
+ }
97
+
98
+ @ Override
99
+ public void onCommand (Vec2 target ){
100
+ if (front () instanceof TurretBuild b && b .team == team ){
101
+ targetSetting .set (b .angleTo (target ), b .dst (target ));
102
+ }
103
+ }
104
+
84
105
@ Override
85
106
public void created (){
86
107
targetSetting .set (90 , 80 );
0 commit comments