diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index b3e71811d5..0bf7edab5e 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1043,7 +1043,7 @@ public class Blocks implements ContentList{ differentialGenerator = new ItemLiquidGenerator(true, true, "differential-generator"){{ requirements(Category.power, ItemStack.with(Items.copper, 140, Items.titanium, 100, Items.lead, 200, Items.silicon, 130, Items.metaglass, 100)); - powerProduction = 13f; + powerProduction = 16f; itemDuration = 50f; hasLiquids = true; size = 3; @@ -1083,9 +1083,9 @@ public class Blocks implements ContentList{ requirements(Category.power, ItemStack.with(Items.lead, 1000, Items.silicon, 600, Items.graphite, 800, Items.thorium, 200, Items.surgealloy, 500, Items.metaglass, 500)); size = 4; health = 900; - powerProduction = 80f; + powerProduction = 100f; itemDuration = 40f; - consumes.power(23f); + consumes.power(25f); consumes.item(Items.blastCompound); consumes.liquid(Liquids.cryofluid, 0.8f); }}; @@ -1505,12 +1505,12 @@ public class Blocks implements ContentList{ shootShake = 2f; powerUsed = 0.5f; consumes.powerBuffered(1200f); - range = 160f; + range = 190f; reload = 170f; - firingMoveFract = 0.1f; + firingMoveFract = 0.2f; shootDuration = 220f; - health = 165 * size * size; + health = 200 * size * size; consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.5f)).update(false); }}; diff --git a/core/src/io/anuke/mindustry/content/Bullets.java b/core/src/io/anuke/mindustry/content/Bullets.java index 2a749524b0..96ab25ee79 100644 --- a/core/src/io/anuke/mindustry/content/Bullets.java +++ b/core/src/io/anuke/mindustry/content/Bullets.java @@ -533,13 +533,13 @@ public class Bullets implements ContentList{ } }; - meltdownLaser = new BulletType(0.001f, 35){ + meltdownLaser = new BulletType(0.001f, 50){ Color tmpColor = new Color(); Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE}; float[] tscales = {1f, 0.7f, 0.5f, 0.2f}; float[] strokes = {2f, 1.5f, 1f, 0.3f}; float[] lenscales = {1f, 1.12f, 1.15f, 1.17f}; - float length = 200f; + float length = 220f; { hitEffect = Fx.hitMeltdown; diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index b3d5f594e2..1a873bc539 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -63,6 +63,7 @@ public class NetClient implements ApplicationListener{ public NetClient(){ Net.handleClient(Connect.class, packet -> { + Log.info("Connecting to server: {0}", packet.addressTCP); player.isAdmin = false; diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index 4ec5ad6232..0e17cf53d9 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -190,20 +190,7 @@ public class NetServer implements ApplicationListener{ //playing in pvp mode automatically assigns players to teams if(state.rules.pvp){ - //find team with minimum amount of players and auto-assign player to that. - Team min = Structs.findMin(Team.all, team -> { - if(state.teams.isActive(team)){ - int count = 0; - for(Player other : playerGroup.all()){ - if(other.getTeam() == team){ - count ++; - } - } - return count; - } - return Integer.MAX_VALUE; - }); - player.setTeam(min); + player.setTeam(assignTeam()); Log.info("Auto-assigned player {0} to team {1}.", player.name, player.getTeam()); } @@ -221,6 +208,22 @@ public class NetServer implements ApplicationListener{ }); } + public Team assignTeam(){ + //find team with minimum amount of players and auto-assign player to that. + return Structs.findMin(Team.all, team -> { + if(state.teams.isActive(team)){ + int count = 0; + for(Player other : playerGroup.all()){ + if(other.getTeam() == team){ + count ++; + } + } + return count; + } + return Integer.MAX_VALUE; + }); + } + public void sendWorldData(Player player, int clientID){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); DeflaterOutputStream def = new DeflaterOutputStream(stream); @@ -427,7 +430,7 @@ public class NetServer implements ApplicationListener{ Log.err("Cannot kick unknown player!"); return; }else{ - Log.info("Kicking connection #{0} / IP: {1}. Reason: {2}", connection, con.address, reason); + Log.info("Kicking connection #{0} / IP: {1}. Reason: {2}", connection, con.address, reason.name()); } Player player = connections.get(con.id); diff --git a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java index db665df3fb..ac3a9be1b0 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java +++ b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java @@ -133,7 +133,7 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool public float damageMultiplier(){ if(owner instanceof Unit){ - return type.damage * ((Unit) owner).getDamageMultipler(); + return ((Unit) owner).getDamageMultipler(); } if(owner instanceof Lightning && data instanceof Float){ diff --git a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java index 8d4d86e5f4..750eb89717 100644 --- a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java @@ -357,6 +357,8 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ interpolator.read(lastx, lasty, x, y, rotation); rotation = lastrot; + x = lastx; + y = lasty; } public void onSuperDeath(){ diff --git a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java index 79318f4b4f..6b0f0528c1 100644 --- a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java @@ -211,8 +211,6 @@ public abstract class GroundUnit extends BaseUnit{ if(tile == targetTile) return; - float angle = angleTo(targetTile); - velocity.add(vec.trns(angleTo(targetTile), type.speed*Time.delta())); if(Units.invalidateTarget(target, this)){ rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed); @@ -237,8 +235,6 @@ public abstract class GroundUnit extends BaseUnit{ if(tile == targetTile || core == null || dst(core) < 90f) return; - float angle = angleTo(targetTile); - velocity.add(vec.trns(angleTo(targetTile), type.speed*Time.delta())); rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed); } diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 6bd427df18..3e1eeda4fc 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -879,10 +879,10 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ interpolator.read(lastx, lasty, x, y, rotation, baseRotation); rotation = lastrot; + x = lastx; + y = lasty; if(isLocal){ - x = lastx; - y = lasty; velocity.x = lastvx; velocity.y = lastvy; }else{ diff --git a/core/src/io/anuke/mindustry/entities/type/Unit.java b/core/src/io/anuke/mindustry/entities/type/Unit.java index 8b5629559e..2cb0f2af98 100644 --- a/core/src/io/anuke/mindustry/entities/type/Unit.java +++ b/core/src/io/anuke/mindustry/entities/type/Unit.java @@ -95,7 +95,9 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ @Override public void damage(float amount){ - super.damage(calculateDamage(amount)); + if(!Net.client()){ + super.damage(calculateDamage(amount)); + } hitTime = hitDuration; } diff --git a/core/src/io/anuke/mindustry/maps/Map.java b/core/src/io/anuke/mindustry/maps/Map.java index b97f30a91e..2495df33db 100644 --- a/core/src/io/anuke/mindustry/maps/Map.java +++ b/core/src/io/anuke/mindustry/maps/Map.java @@ -83,7 +83,7 @@ public class Map implements Comparable{ } public String tag(String name){ - return tags.containsKey(name) && !tags.get(name).trim().isEmpty() ? tags.get(name): Core.bundle.get("unknown"); + return tags.containsKey(name) && !tags.get(name).trim().isEmpty() ? tags.get(name) : Core.bundle.get("unknown"); } public boolean hasTag(String name){ diff --git a/core/src/io/anuke/mindustry/net/Administration.java b/core/src/io/anuke/mindustry/net/Administration.java index 52de0350f5..681de95177 100644 --- a/core/src/io/anuke/mindustry/net/Administration.java +++ b/core/src/io/anuke/mindustry/net/Administration.java @@ -163,7 +163,7 @@ public class Administration{ public boolean adminPlayer(String id, String usid){ PlayerInfo info = getCreateInfo(id); - if(info.admin) + if(info.admin && info.adminUsid != null && info.adminUsid.equals(usid)) return false; info.adminUsid = usid; diff --git a/core/src/io/anuke/mindustry/net/Interpolator.java b/core/src/io/anuke/mindustry/net/Interpolator.java index b7b32b321a..0201f980ce 100644 --- a/core/src/io/anuke/mindustry/net/Interpolator.java +++ b/core/src/io/anuke/mindustry/net/Interpolator.java @@ -36,7 +36,6 @@ public class Interpolator{ } public void update(){ - if(lastUpdated != 0 && updateSpacing != 0){ float timeSinceUpdate = Time.timeSinceMillis(lastUpdated); float alpha = Math.min(timeSinceUpdate / updateSpacing, 2f); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java index 1e7554d8d5..4a4ca776c3 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java @@ -69,10 +69,10 @@ public class PlayerListFragment extends Fragment{ playerGroup.all().sort((p1, p2) -> p1.getTeam().compareTo(p2.getTeam())); - playerGroup.forEach(player -> { - NetConnection connection = player.con; + playerGroup.forEach(user -> { + NetConnection connection = user.con; - if(connection == null && Net.server() && !player.isLocal) return; + if(connection == null && Net.server() && !user.isLocal) return; Table button = new Table(); button.left(); @@ -90,15 +90,15 @@ public class PlayerListFragment extends Fragment{ } }; table.margin(8); - table.add(new Image(player.mech.iconRegion)).grow(); + table.add(new Image(user.mech.iconRegion)).grow(); button.add(table).size(h); - button.labelWrap("[#" + player.color.toString().toUpperCase() + "]" + player.name).width(170f).pad(10); + button.labelWrap("[#" + user.color.toString().toUpperCase() + "]" + user.name).width(170f).pad(10); button.add().grow(); - button.addImage("icon-admin").size(14 * 2).visible(() -> player.isAdmin && !(!player.isLocal && Net.server())).padRight(5).get().updateVisibility(); + button.addImage("icon-admin").size(14 * 2).visible(() -> user.isAdmin && !(!user.isLocal && Net.server())).padRight(5).get().updateVisibility(); - if((Net.server() || player.isAdmin) && !player.isLocal && (!player.isAdmin || Net.server())){ + if((Net.server() || player.isAdmin) && !user.isLocal && (!user.isAdmin || Net.server())){ button.add().growY(); float bs = (h) / 2f; @@ -107,36 +107,36 @@ public class PlayerListFragment extends Fragment{ t.defaults().size(bs); t.addImageButton("icon-ban", "clear-partial", 14 * 2, - () -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(player, AdminAction.ban))); + () -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban))); t.addImageButton("icon-cancel", "clear-partial", 16 * 2, - () -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(player, AdminAction.kick))); + () -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick))); t.row(); t.addImageButton("icon-admin", "clear-toggle-partial", 14 * 2, () -> { if(Net.client()) return; - String id = player.uuid; + String id = user.uuid; if(netServer.admins.isAdmin(id, connection.address)){ ui.showConfirm("$confirm", "$confirmunadmin", () -> netServer.admins.unAdminPlayer(id)); }else{ - ui.showConfirm("$confirm", "$confirmadmin", () -> netServer.admins.adminPlayer(id, player.usid)); + ui.showConfirm("$confirm", "$confirmadmin", () -> netServer.admins.adminPlayer(id, user.usid)); } }) - .update(b -> b.setChecked(player.isAdmin)) + .update(b -> b.setChecked(user.isAdmin)) .disabled(b -> Net.client()) .touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled) - .checked(player.isAdmin); + .checked(user.isAdmin); - t.addImageButton("icon-zoom-small", "clear-partial", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(player, AdminAction.trace)*/); + t.addImageButton("icon-zoom-small", "clear-partial", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(user, AdminAction.trace)*/); }).padRight(12).size(bs + 10f, bs); } content.add(button).padBottom(-6).width(350f).maxHeight(h + 14); content.row(); - content.addImage("blank").height(3f).color(state.rules.pvp ? player.getTeam().color : Pal.accent).growX(); + content.addImage("blank").height(3f).color(state.rules.pvp ? user.getTeam().color : Pal.accent).growX(); content.row(); }); diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index 6b5664fe0d..c9ca7f9b7e 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -144,7 +144,7 @@ public class ServerControl implements ApplicationListener{ Call.onInfoMessage((state.rules.pvp ? "[YELLOW]The " + event.winner.name() + " team is victorious![]" : "[SCARLET]Game over![]") + "\nNext selected map:[accent] "+map.name()+"[]" - + (map.author() != null ? " by[accent] " + map.author() + "[]" : "") + "."+ + + (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "."+ "\nNew game begins in " + roundExtraTime + " seconds."); info("Selected next map to be {0}.", map.name()); @@ -662,6 +662,9 @@ public class ServerControl implements ApplicationListener{ logic.play(); for(Player p : players){ p.reset(); + if(state.rules.pvp){ + p.setTeam(netServer.assignTeam()); + } netServer.sendWorldData(p, p.con.id); } inExtraRound = false;