Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0

# Conflicts:
#	core/assets/sprites/sprites.atlas
#	core/assets/sprites/sprites.png
#	core/assets/version.properties
#	core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java
This commit is contained in:
Anuken
2018-02-27 19:58:34 -05:00
59 changed files with 2419 additions and 1120 deletions
@@ -34,6 +34,7 @@ public class Player extends SyncEntity{
public String name = "name";
public boolean isAndroid;
public boolean isAdmin;
public Color color = new Color();
public Weapon weaponLeft = Weapon.blaster;
@@ -44,7 +45,7 @@ public class Player extends SyncEntity{
public float stucktime = 0f;
public boolean dashing = false;
public int clientid;
public int clientid = -1;
public boolean isLocal = false;
public Timer timer = new Timer(4);
@@ -83,7 +84,7 @@ public class Player extends SyncEntity{
@Override
public void onDeath(){
remove();
dead = true;
if(Net.active()){
NetEvents.handlePlayerDeath();
}
@@ -112,7 +113,7 @@ public class Player extends SyncEntity{
@Override
public void drawSmooth(){
if((debug && (!showPlayer || !showUI)) || (isAndroid && isLocal) || (dead && !isLocal)) return;
if((debug && (!showPlayer || !showUI)) || (isAndroid && isLocal) || dead) return;
boolean snap = snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate") && isLocal;
String part = isAndroid ? "ship" : "mech";
@@ -155,6 +156,8 @@ public class Player extends SyncEntity{
return;
}
if(isDead()) return;
Tile tile = world.tileWorld(x, y);
//if player is in solid block
@@ -240,6 +243,7 @@ public class Player extends SyncEntity{
buffer.put(weaponLeft.id);
buffer.put(weaponRight.id);
buffer.put(isAndroid ? 1 : (byte)0);
buffer.put(isAdmin ? 1 : (byte)0);
buffer.putInt(Color.rgba8888(color));
buffer.putFloat(x);
buffer.putFloat(y);
@@ -254,6 +258,7 @@ public class Player extends SyncEntity{
weaponLeft = (Weapon) Upgrade.getByID(buffer.get());
weaponRight = (Weapon) Upgrade.getByID(buffer.get());
isAndroid = buffer.get() == 1;
isAdmin = buffer.get() == 1;
color.set(buffer.getInt());
x = buffer.getFloat();
y = buffer.getFloat();
@@ -17,6 +17,7 @@ import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
@@ -82,6 +83,13 @@ public class EnemyType {
Graphics.flush();
if(isCalculating(enemy)){
Draw.color(Color.SKY);
Lines.polySeg(20, 0, 4, enemy.x, enemy.y, 11f, Timers.time() * 2f + enemy.id*52f);
Lines.polySeg(20, 0, 4, enemy.x, enemy.y, 11f, Timers.time() * 2f + enemy.id*52f + 180f);
Draw.color();
}
if(showPaths){
Draw.tscl(0.25f);
Draw.text((int)enemy.idletime + " " + enemy.node + " " + enemy.id + "\n" + Strings.toFixed(enemy.totalMove.x, 2) + ", "
@@ -100,9 +108,10 @@ public class EnemyType {
enemy.hitTime -= Timers.delta();
}
if(enemy.lane >= world.getSpawns().size) enemy.lane = 0;
if(enemy.lane >= world.getSpawns().size || enemy.lane < 0) enemy.lane = 0;
boolean waiting = world.getSpawns().get(enemy.lane).pathTiles == null || enemy.node <= 0;
boolean waiting = enemy.lane >= world.getSpawns().size || enemy.lane < 0
|| world.getSpawns().get(enemy.lane).pathTiles == null || enemy.node <= 0;
move(enemy);
@@ -156,6 +165,8 @@ public class EnemyType {
Tile core = world.getCore();
if(core == null) return;
if(enemy.idletime > maxIdleLife && enemy.node > 0){
enemy.onDeath();
return;
@@ -189,7 +200,7 @@ public class EnemyType {
}else if(dst < avoidRange){
calc.set((enemy.x - other.x), (enemy.y - other.y)).setLength(avoidSpeed);
shift.add(calc.scl(1.1f));
}else if(dst < attractRange && !nearCore){
}else if(dst < attractRange && !nearCore && !isCalculating(enemy)){
calc.set((enemy.x - other.x), (enemy.y - other.y)).setLength(avoidSpeed);
shift.add(calc.scl(-1));
}
@@ -217,7 +228,8 @@ public class EnemyType {
//no tile found
if(enemy.target == null){
enemy.target = Entities.getClosest(playerGroup, enemy.x, enemy.y, range, e -> !((Player)e).isAndroid);
enemy.target = Entities.getClosest(playerGroup, enemy.x, enemy.y, range, e -> !((Player)e).isAndroid &&
!((Player)e).isDead());
}
}else if(nearCore){
enemy.target = world.getCore().entity;
@@ -267,6 +279,10 @@ public class EnemyType {
}
}
public boolean isCalculating(Enemy enemy){
return enemy.node < 0 && !Net.client();
}
public static EnemyType getByID(byte id){
return types.get(id);
}
@@ -56,4 +56,9 @@ public class TargetType extends EnemyType {
new Enemy(EnemyTypes.target).set(enemy.x, enemy.y).add();
});
}
@Override
public boolean isCalculating(Enemy enemy){
return false;
}
}