This commit is contained in:
Anuken
2020-11-29 19:41:10 -05:00
parent ba9bc472e8
commit c41dfa46aa
5 changed files with 10 additions and 8 deletions

View File

@@ -90,8 +90,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
public float prefRotation(){
if(activelyBuilding()){
return angleTo(buildPlan());
}else if(mineTile() != null){
return angleTo(mineTile());
}else if(mineTile != null){
return angleTo(mineTile);
}else if(moving()){
return vel().angle();
}

View File

@@ -37,6 +37,7 @@ public class PlanetRenderer implements Disposable{
public final VertexBatch3D batch = new VertexBatch3D(20000, false, true, 0);
public float zoom = 1f;
public float orbitAlpha = 1f;
private final Mesh[] outlines = new Mesh[10];
public final PlaneBatch3D projector = new PlaneBatch3D();
@@ -168,7 +169,7 @@ public class PlanetRenderer implements Disposable{
Vec3 center = planet.parent.position;
float radius = planet.orbitRadius;
int points = (int)(radius * 10);
Angles.circleVectors(points, radius, (cx, cy) -> batch.vertex(Tmp.v32.set(center).add(cx, 0, cy), Pal.gray));
Angles.circleVectors(points, radius, (cx, cy) -> batch.vertex(Tmp.v32.set(center).add(cx, 0, cy), Pal.gray.write(Tmp.c1).a(orbitAlpha)));
batch.flush(Gl.lineLoop);
}

View File

@@ -629,8 +629,8 @@ public class DesktopInput extends InputHandler{
unit.moveAt(movement);
}else{
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
if(!movement.isZero() && ground){
unit.vel.rotateTo(movement.angle(), unit.type.rotateSpeed);
if(!movement.isZero()){
unit.vel.rotateTo(movement.angle(), unit.type.rotateSpeed * Math.max(Time.delta, 1));
}
}

View File

@@ -836,7 +836,7 @@ public class MobileInput extends InputHandler implements GestureListener{
if(type == null) return;
boolean omni = unit.type.omniMovement;
boolean legs = unit.isGrounded();
boolean ground = unit.isGrounded();
boolean allowHealing = type.canHeal;
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
((Building)target).damaged() && target.within(unit, type.range);
@@ -908,8 +908,8 @@ public class MobileInput extends InputHandler implements GestureListener{
unit.moveAt(movement);
}else{
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
if(!movement.isZero() && legs){
unit.vel.rotateTo(movement.angle(), type.rotateSpeed);
if(!movement.isZero()){
unit.vel.rotateTo(movement.angle(), unit.type.rotateSpeed * Math.max(Time.delta, 1));
}
}

View File

@@ -409,6 +409,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
@Override
public void draw(){
planets.orbitAlpha = selectAlpha;
planets.render(PlanetDialog.this);
if(Core.scene.getDialog() == PlanetDialog.this){
Core.scene.setScrollFocus(PlanetDialog.this);