mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 06:51:30 -08:00
Fixed incorrect scaling
This commit is contained in:
parent
0dd15f3141
commit
af1746932f
7 changed files with 29 additions and 24 deletions
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 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 Rectangle viewport = new Rectangle();
|
||||
/** 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;
|
||||
}
|
||||
|
||||
public Tile getSpawner(){
|
||||
return world.tile(spawner);
|
||||
}
|
||||
|
||||
/** Initialize the type and team of this unit. Only call once! */
|
||||
public void init(UnitType type, Team team){
|
||||
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.*;
|
||||
|
||||
public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
|
||||
|
||||
protected Item targetItem;
|
||||
protected Tile mineTile;
|
||||
protected Queue<BuildRequest> placeQueue = new Queue<>();
|
||||
|
|
@ -77,20 +75,14 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||
|
||||
public void update(){
|
||||
|
||||
retarget(() -> {
|
||||
target = Units.findDamagedTile(team, x, y);
|
||||
retarget(() -> target = Units.findDamagedTile(team, x, y));
|
||||
|
||||
if(target == null){
|
||||
setState(mine);
|
||||
if(target != null){
|
||||
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()){
|
||||
state.set(attack);
|
||||
}else if(!targetHasFlag(BlockFlag.repair)){
|
||||
if(timer.get(timerTarget, 20)){
|
||||
Tile target = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair));
|
||||
if(target != null) Drone.this.target = target.entity;
|
||||
}
|
||||
retarget(() -> {
|
||||
Tile repairPoint = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair));
|
||||
if(repairPoint != null){
|
||||
target = repairPoint;
|
||||
}else if(getSpawner() != null){
|
||||
target = getSpawner();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
circle(40f);
|
||||
}
|
||||
|
|
@ -300,8 +296,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||
|
||||
@Override
|
||||
public void behavior(){
|
||||
if(health <= health * type.retreatPercent &&
|
||||
Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair)) != null){
|
||||
if(health <= health * type.retreatPercent){
|
||||
setState(retreat);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import io.anuke.arc.util.Log;
|
|||
import io.anuke.arc.util.OS;
|
||||
import io.anuke.arc.util.Strings;
|
||||
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.ValueType;
|
||||
import io.anuke.arc.util.serialization.JsonWriter.OutputType;
|
||||
|
|
@ -66,7 +67,7 @@ public class CrashSender{
|
|||
try{
|
||||
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 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"));
|
||||
|
||||
writeListener.accept(file);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class UnitType extends UnlockableContent{
|
|||
public boolean rotateWeapon = false;
|
||||
public float drag = 0.1f;
|
||||
public float maxVelocity = 5f;
|
||||
public float retreatPercent = 0.2f;
|
||||
public float retreatPercent = 0.6f;
|
||||
public int itemCapacity = 30;
|
||||
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
|
||||
public float buildPower = 0.3f, minePower = 0.7f;
|
||||
|
|
|
|||
|
|
@ -142,9 +142,14 @@ public class HudFragment extends Fragment{
|
|||
});
|
||||
|
||||
Table wavesMain, editorMain;
|
||||
boolean[] prev = {false};
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue