@@ -113,8 +113,10 @@ public class UnitType extends UnlockableContent implements Senseable{
113
113
buildSpeed = -1f ,
114
114
/** Minimum distance from this unit that weapons can target. Prevents units from firing "inside" the unit. */
115
115
aimDst = -1f ,
116
- /** Visual offset of build beam from front. */
116
+ /** Visual offset of the build beam from the front. */
117
117
buildBeamOffset = 3.8f ,
118
+ /** Visual offset of the mining beam from the front. Defaults to half the hitsize. */
119
+ mineBeamOffset = Float .NEGATIVE_INFINITY ,
118
120
/** WIP: Units of low priority will always be ignored in favor of those with higher priority, regardless of distance. */
119
121
targetPriority = 0f ,
120
122
/** Elevation of shadow drawn under this (ground) unit. Visual only. */
@@ -236,6 +238,8 @@ public class UnitType extends UnlockableContent implements Senseable{
236
238
squareShape = false ,
237
239
/** if true, this unit will draw its building beam towards blocks. */
238
240
drawBuildBeam = true ,
241
+ /** if true, this unit will draw its mining beam towards blocks */
242
+ drawMineBeam = true ,
239
243
/** if false, the team indicator/cell is not drawn. */
240
244
drawCell = true ,
241
245
/** if false, carried items are not drawn. */
@@ -803,6 +807,8 @@ public void init(){
803
807
}).layer (Layer .debris );
804
808
}
805
809
810
+ if (mineBeamOffset == Float .NEGATIVE_INFINITY ) mineBeamOffset = hitSize / 2 ;
811
+
806
812
for (Ability ab : abilities ){
807
813
ab .init (this );
808
814
}
@@ -1226,7 +1232,6 @@ public void draw(Unit unit){
1226
1232
if (unit .inFogTo (Vars .player .team ())) return ;
1227
1233
1228
1234
unit .drawBuilding ();
1229
-
1230
1235
drawMining (unit );
1231
1236
1232
1237
boolean isPayload = !unit .isAdded ();
@@ -1339,25 +1344,29 @@ public Color shieldColor(Unit unit){
1339
1344
return shieldColor == null ? unit .team .color : shieldColor ;
1340
1345
}
1341
1346
1342
-
1343
1347
public void drawMining (Unit unit ){
1348
+ if (drawMineBeam ){
1349
+ float focusLen = mineBeamOffset + Mathf .absin (Time .time , 1.1f , 0.5f );
1350
+ float px = unit .x + Angles .trnsx (unit .rotation , focusLen );
1351
+ float py = unit .y + Angles .trnsy (unit .rotation , focusLen );
1352
+
1353
+ drawMiningBeam (unit , px , py );
1354
+ }
1355
+ }
1356
+
1357
+ public void drawMiningBeam (Unit unit , float px , float py ){
1344
1358
if (!unit .mining ()) return ;
1345
- float focusLen = unit .hitSize / 2f + Mathf .absin (Time .time , 1.1f , 0.5f );
1346
1359
float swingScl = 12f , swingMag = tilesize / 8f ;
1347
1360
float flashScl = 0.3f ;
1348
1361
1349
- float px = unit .x + Angles .trnsx (unit .rotation , focusLen );
1350
- float py = unit .y + Angles .trnsy (unit .rotation , focusLen );
1351
-
1352
1362
float ex = unit .mineTile .worldx () + Mathf .sin (Time .time + 48 , swingScl , swingMag );
1353
1363
float ey = unit .mineTile .worldy () + Mathf .sin (Time .time + 48 , swingScl + 2f , swingMag );
1354
1364
1355
1365
Draw .z (Layer .flyingUnit + 0.1f );
1356
1366
1357
1367
Draw .color (Color .lightGray , Color .white , 1f - flashScl + Mathf .absin (Time .time , 0.5f , flashScl ));
1358
1368
1359
- Draw .alpha (Renderer .unitLaserOpacity );
1360
- Drawf .laser (mineLaserRegion , mineLaserEndRegion , px , py , ex , ey , 0.75f );
1369
+ Drawf .laser (Core .atlas .find ("minelaser" ), Core .atlas .find ("minelaser-end" ), px , py , ex , ey , 0.75f );
1361
1370
1362
1371
if (unit .isLocal ()){
1363
1372
Lines .stroke (1f , Pal .accent );
0 commit comments