mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 03:08:38 +07:00
Cleanup / Desktop dead camera panning
This commit is contained in:
parent
df4a0dd5e4
commit
77b89d45d6
@ -125,7 +125,7 @@ public class Renderer implements ApplicationListener{
|
||||
TileEntity core = player.getClosestCore();
|
||||
if(core != null && player.spawner == null){
|
||||
camera.position.lerpDelta(core.x, core.y, 0.08f);
|
||||
}else{
|
||||
}else if(core != null){
|
||||
camera.position.lerpDelta(position, 0.08f);
|
||||
}
|
||||
}else if(control.input instanceof DesktopInput){
|
||||
|
@ -7,11 +7,13 @@ import arc.graphics.*;
|
||||
import arc.math.geom.*;
|
||||
import mindustry.entities.traits.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static mindustry.Vars.collisions;
|
||||
|
||||
/** Represents a group of a certain type of entity.*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EntityGroup<T extends Entity>{
|
||||
public class EntityGroup<T extends Entity> implements Iterable<T>{
|
||||
private final boolean useTree;
|
||||
private final int id;
|
||||
private final Class<T> type;
|
||||
@ -253,8 +255,13 @@ public class EntityGroup<T extends Entity>{
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Returns the logic-only array for iteration. */
|
||||
/** Returns the array for iteration. */
|
||||
public Array<T> all(){
|
||||
return entityArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator(){
|
||||
return entityArray.iterator();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import arc.scene.event.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.entities.traits.BuilderTrait.*;
|
||||
@ -135,6 +136,12 @@ public class DesktopInput extends InputHandler{
|
||||
ui.listfrag.toggle();
|
||||
}
|
||||
|
||||
if(player.getClosestCore() == null){
|
||||
//move camera around
|
||||
float camSpeed = 6f;
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
||||
}
|
||||
|
||||
if(Core.input.keyRelease(Binding.select)){
|
||||
player.isShooting = false;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@ -37,7 +38,7 @@ public class ForceProjector extends Block{
|
||||
private static ForceProjector paramBlock;
|
||||
private static ForceEntity paramEntity;
|
||||
private static Cons<AbsorbTrait> shieldConsumer = trait -> {
|
||||
if(trait.canBeAbsorbed() && trait.getTeam() != paramTile.getTeam() && paramBlock.isInsideHexagon(trait.getX(), trait.getY(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
|
||||
if(trait.canBeAbsorbed() && trait.getTeam() != paramTile.getTeam() && Intersector.isInsideHexagon(trait.getX(), trait.getY(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
|
||||
trait.absorb();
|
||||
Effects.effect(Fx.absorb, trait);
|
||||
paramEntity.hit = 1f;
|
||||
@ -111,17 +112,6 @@ public class ForceProjector extends Block{
|
||||
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, entity.efficiency(), 0.1f);
|
||||
|
||||
/*
|
||||
if(entity.power.status < relativePowerDraw){
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.15f);
|
||||
entity.power.status = 0f;
|
||||
if(entity.warmup <= 0.09f){
|
||||
entity.broken = true;
|
||||
}
|
||||
}else{
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.1f);
|
||||
}*/
|
||||
|
||||
if(entity.buildup > 0){
|
||||
float scale = !entity.broken ? cooldownNormal : cooldownBrokenBase;
|
||||
ConsumeLiquidFilter cons = consumes.get(ConsumeType.liquid);
|
||||
@ -159,13 +149,6 @@ public class ForceProjector extends Block{
|
||||
return (radius + entity.phaseHeat * phaseRadiusBoost) * entity.radscl;
|
||||
}
|
||||
|
||||
boolean isInsideHexagon(float x0, float y0, float d, float x, float y){
|
||||
float dx = Math.abs(x - x0) / d;
|
||||
float dy = Math.abs(y - y0) / d;
|
||||
float a = 0.25f * Mathf.sqrt3;
|
||||
return (dy <= a) && (a * dx + 0.25 * dy <= 0.5 * a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=0e25944f7f3a065ed6707f0dbe48548980cad8a6
|
||||
archash=fe82ca9037028044764cc4b02fdbf851e3d09f78
|
||||
|
Loading…
Reference in New Issue
Block a user