2626import mindustry .world .blocks .storage .CoreBlock ;
2727import mindustry .world .blocks .units .UnitFactory ;
2828
29- import static arc .graphics .g2d .Draw .draw ;
29+ import static arc .graphics .g2d .Draw .* ;
3030import static mindustry .Vars .*;
3131
3232
@@ -42,6 +42,7 @@ public void worldRenderer(){
4242 if (!CuiVars .globalShow ) return ;
4343 boolean unitBars = Core .settings .getInt ("cui-showUnitBarStyle" ) > 0 ;
4444 boolean trackPlayerCursor = Core .settings .getBool ("cui-TrackPlayerCursor" );
45+ boolean filterPlayerCursor = Core .settings .getBool ("cui-useCycleFilter" ), filterNoCores = Core .settings .getBool ("cui-cyclePlayersIgnoreNoCore" );
4546 boolean trackLogicControl = Core .settings .getInt ("cui-logicLineAlpha" ) > 0 ;
4647 boolean unitCmds = Core .settings .getInt ("cui-unitscommands" ) > 0 ;
4748
@@ -63,6 +64,7 @@ public void worldRenderer(){
6364 }));
6465 if (unitCmds ) drawUnitPointer ();
6566 if (trackPlayerCursor ) Groups .player .each (ply ->{
67+ if (filterPlayerCursor && (CuiVars .hiddenCycleTeam [ply .team ().id ] || (filterNoCores && ply .team ().cores ().size == 0 ))) return ;
6668 if (ply .unit () != null ){drawPlayerCursor (ply );}
6769 });
6870 }
@@ -119,28 +121,39 @@ public void drawUnitBars(Unit unit, int style, float alpha, float stroke){
119121 Color shclr = new Color ().set (unit .team .color ).lerp (Color .black , 0.25f ).a (alpha );
120122
121123 Draw .alpha (alpha );
122- Draw .draw (Layer .flyingUnit +2 , () ->{
124+ Draw .draw (Layer .flyingUnit +2 , () -> {
123125 if (Core .settings .getInt ("cui-showUnitTextStyle" ) > 0 ){
124126 int tstyle = Core .settings .getInt ("cui-showUnitTextStyle" );
125127 String txt = "[red]" ;
126128 if (tstyle == 1 ){
127- txt += Mathf .round (hp * 100 ) + "%[]" ;
129+ txt += Mathf .round (hp * 100 ) + "%[]" ;
128130 if (shield > 0 ) txt += "\n " + CuiVars .decFor .format (unit .shield );
129131 }else if (style == 2 ){
130- txt += CuiVars .decFor .format (unit .health ) + "[]" ;
132+ txt += CuiVars .decFor .format (unit .health ) + "[]" ;
131133 if (shield > 0 ) txt += "\n " + CuiVars .decFor .format (unit .shield );
132- } else {
133- txt += (CuiVars .decFor .format (unit .health ) + "[][white]/[][pink]" + Math .round (unit .maxHealth ) +"[]" );
134+ }else {
135+ txt += (CuiVars .decFor .format (unit .health ) + "[][white]/[][pink]" + Math .round (unit .maxHealth ) + "[]" );
134136 if (shield > 0 ) txt += "\n " + CuiVars .decFor .format (unit .shield );
135137 }
136138
137139 drawLabel (unit .x , unit .y , txt , colour );
138140
139141 }
140- if (stroke == 0 ) return ;
142+ });
143+ if (stroke == 0 ) return ;
144+ Draw .draw (Layer .flyingUnit +1.99f , () ->{
141145 float yShield = y - offset + stroke , yShieldAlt = yShield + (stroke /2.5f );
142146 float yOff = y - offset ;
147+
143148 switch (style ) {
149+ case 10 -> { //diamonds, (don't remember which mod that used to do this so ughh yes)
150+ drawInner (Pal .darkishGray , 1f , false , x - (offset /1.5f ), y - (offset /2 ), (width / 2f ), unit .hitSize , 1 );
151+ drawInner (colour , hp ,false , x - (offset /1.5f ), y - (offset /2 ), (width / 2f ), unit .hitSize , 1 );
152+ if (shield > 0 ){
153+ drawInner (Pal .darkishGray , 1f , true , x + (offset /1.5f ), y - (offset /2 ), (width / 2f ), unit .hitSize , 1 );
154+ drawInner (colour , shield ,true , x + (offset /1.5f ), y - (offset /2 ), (width / 2f ), unit .hitSize , 1 );
155+ }
156+ }
144157 case 9 -> {//boarder - right
145158 if (shield > 0 )drawBoardedLine (colour , x + width , yShield , x - (width ), yShield ,x + offset + ((width * 2 ) * shield ), yShield , x + offset , yShield , stroke , bg );
146159 drawBoardedLine (colour , x + width , yOff , x - (width ), yOff ,x + offset + ((width * 2 ) * hp ), yOff , x + offset , yOff , stroke , bg );
@@ -356,6 +369,48 @@ public void drawPointer(Color color, float x, float y, Position unit, int style)
356369 Draw .reset ();
357370 }
358371
372+ public void drawInner (Color color , float fract , boolean flip , float x , float y , float width , float height , float parentAlpha ){
373+ if (fract < 0 ) return ;
374+
375+ fract = Mathf .clamp (fract );
376+ if (flip ){
377+ x += width ;
378+ width = -width ;
379+ }
380+
381+ float stroke = width * 0.35f ;
382+ float bh = height /2f ;
383+ Draw .color (color , parentAlpha );
384+
385+ float f1 = Math .min (fract * 2f , 1f ), f2 = (fract - 0.5f ) * 2f ;
386+
387+ float bo = -(1f - f1 ) * (width - stroke );
388+
389+ Fill .quad (
390+ x , y ,
391+ x + stroke , y ,
392+ x + width + bo , y + bh * f1 ,
393+ x + width - stroke + bo , y + bh * f1
394+ );
395+
396+ if (f2 > 0 ){
397+ float bx = x + (width - stroke ) * (1f - f2 );
398+ Fill .quad (
399+ x + width , y + bh ,
400+ x + width - stroke , y + bh ,
401+ bx , y + height * fract ,
402+ bx + stroke , y + height * fract
403+ );
404+ }
405+
406+ Draw .reset ();
407+
408+ if (flip ){
409+ width = -width ;
410+ x -= width ;
411+ }
412+ }
413+
359414 public static void drawBoardedLine (Color color , float x , float y , float x2 , float y2 , float x3 , float y3 , float stoke , Color bg ){
360415 drawBoardedLine (color , x , y , x2 , y2 , x3 , y3 , x , y , stoke , bg );
361416 }
0 commit comments