Fixed incorrect scaling
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -40,7 +40,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class NetServer implements ApplicationListener{
|
public class NetServer implements ApplicationListener{
|
||||||
public final static int maxSnapshotSize = 430;
|
public final static int maxSnapshotSize = 430;
|
||||||
private final static float serverSyncTime = 20, kickDuration = 30 * 1000;
|
private final static float serverSyncTime = 15, kickDuration = 30 * 1000;
|
||||||
private final static Vector2 vector = new Vector2();
|
private final static Vector2 vector = new Vector2();
|
||||||
private final static Rectangle viewport = new Rectangle();
|
private final static Rectangle viewport = new Rectangle();
|
||||||
/** If a player goes away of their server-side coordinates by this distance, they get teleported back. */
|
/** If a player goes away of their server-side coordinates by this distance, they get teleported back. */
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
return type.drag;
|
return type.drag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Tile getSpawner(){
|
||||||
|
return world.tile(spawner);
|
||||||
|
}
|
||||||
|
|
||||||
/** Initialize the type and team of this unit. Only call once! */
|
/** Initialize the type and team of this unit. Only call once! */
|
||||||
public void init(UnitType type, Team team){
|
public void init(UnitType type, Team team){
|
||||||
if(this.type != null) throw new RuntimeException("This unit is already initialized!");
|
if(this.type != null) throw new RuntimeException("This unit is already initialized!");
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import java.io.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Drone extends FlyingUnit implements BuilderTrait{
|
public class Drone extends FlyingUnit implements BuilderTrait{
|
||||||
|
|
||||||
|
|
||||||
protected Item targetItem;
|
protected Item targetItem;
|
||||||
protected Tile mineTile;
|
protected Tile mineTile;
|
||||||
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
||||||
@@ -77,20 +75,14 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|
||||||
retarget(() -> {
|
retarget(() -> target = Units.findDamagedTile(team, x, y));
|
||||||
target = Units.findDamagedTile(team, x, y);
|
|
||||||
|
|
||||||
if(target == null){
|
if(target != null){
|
||||||
setState(mine);
|
if(target.dst(Drone.this) > type.range){
|
||||||
|
circle(type.range * 0.9f);
|
||||||
|
}else{
|
||||||
|
getWeapon().update(Drone.this, target.getX(), target.getY());
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if(target == null) return;
|
|
||||||
|
|
||||||
if(target.dst(Drone.this) > type.range){
|
|
||||||
circle(type.range * 0.9f);
|
|
||||||
}else{
|
|
||||||
getWeapon().update(Drone.this, target.getX(), target.getY());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -196,10 +188,14 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
if(health >= maxHealth()){
|
if(health >= maxHealth()){
|
||||||
state.set(attack);
|
state.set(attack);
|
||||||
}else if(!targetHasFlag(BlockFlag.repair)){
|
}else if(!targetHasFlag(BlockFlag.repair)){
|
||||||
if(timer.get(timerTarget, 20)){
|
retarget(() -> {
|
||||||
Tile target = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair));
|
Tile repairPoint = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair));
|
||||||
if(target != null) Drone.this.target = target.entity;
|
if(repairPoint != null){
|
||||||
}
|
target = repairPoint;
|
||||||
|
}else if(getSpawner() != null){
|
||||||
|
target = getSpawner();
|
||||||
|
}
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
circle(40f);
|
circle(40f);
|
||||||
}
|
}
|
||||||
@@ -300,8 +296,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void behavior(){
|
public void behavior(){
|
||||||
if(health <= health * type.retreatPercent &&
|
if(health <= health * type.retreatPercent){
|
||||||
Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair)) != null){
|
|
||||||
setState(retreat);
|
setState(retreat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.util.Log;
|
|||||||
import io.anuke.arc.util.OS;
|
import io.anuke.arc.util.OS;
|
||||||
import io.anuke.arc.util.Strings;
|
import io.anuke.arc.util.Strings;
|
||||||
import io.anuke.arc.util.io.PropertiesUtils;
|
import io.anuke.arc.util.io.PropertiesUtils;
|
||||||
|
import io.anuke.arc.util.io.Streams;
|
||||||
import io.anuke.arc.util.serialization.JsonValue;
|
import io.anuke.arc.util.serialization.JsonValue;
|
||||||
import io.anuke.arc.util.serialization.JsonValue.ValueType;
|
import io.anuke.arc.util.serialization.JsonValue.ValueType;
|
||||||
import io.anuke.arc.util.serialization.JsonWriter.OutputType;
|
import io.anuke.arc.util.serialization.JsonWriter.OutputType;
|
||||||
@@ -66,7 +67,7 @@ public class CrashSender{
|
|||||||
try{
|
try{
|
||||||
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + DateTimeFormatter.ofPattern("MM_dd_yyyy_HH_mm_ss").format(LocalDateTime.now()) + ".txt");
|
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + DateTimeFormatter.ofPattern("MM_dd_yyyy_HH_mm_ss").format(LocalDateTime.now()) + ".txt");
|
||||||
new File(OS.getAppDataDirectoryString(Vars.appName)).mkdir();
|
new File(OS.getAppDataDirectoryString(Vars.appName)).mkdir();
|
||||||
new BufferedOutputStream(new FileOutputStream(file), 2048).write(parseException(exception).getBytes());
|
new BufferedOutputStream(new FileOutputStream(file), Streams.DEFAULT_BUFFER_SIZE).write(parseException(exception).getBytes());
|
||||||
Files.createDirectories(Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes"));
|
Files.createDirectories(Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes"));
|
||||||
|
|
||||||
writeListener.accept(file);
|
writeListener.accept(file);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public boolean rotateWeapon = false;
|
public boolean rotateWeapon = false;
|
||||||
public float drag = 0.1f;
|
public float drag = 0.1f;
|
||||||
public float maxVelocity = 5f;
|
public float maxVelocity = 5f;
|
||||||
public float retreatPercent = 0.2f;
|
public float retreatPercent = 0.6f;
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
|
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
|
||||||
public float buildPower = 0.3f, minePower = 0.7f;
|
public float buildPower = 0.3f, minePower = 0.7f;
|
||||||
|
|||||||
@@ -142,9 +142,14 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Table wavesMain, editorMain;
|
Table wavesMain, editorMain;
|
||||||
|
boolean[] prev = {false};
|
||||||
|
|
||||||
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight()).update(s -> {
|
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight()).update(s -> {
|
||||||
((Table)s.getParent()).getCell(s).height(wavesMain.isVisible() ? wavesMain.getPrefHeight() : editorMain.getPrefHeight());
|
((Table)s.getParent()).getCell(s).height((wavesMain.isVisible() ? wavesMain.getPrefHeight() : editorMain.getPrefHeight()) / Unit.dp.scl(1f));
|
||||||
|
if(prev[0] != wavesMain.isVisible()){
|
||||||
|
s.getParent().pack();
|
||||||
|
prev[0] = wavesMain.isVisible();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user