diff --git a/build.gradle b/build.gradle index e73b01c766..8c81534075 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ allprojects { appName = 'Mindustry' gdxVersion = '1.9.8' aiVersion = '1.8.1' - uCoreVersion = 'c5d47cc' + uCoreVersion = 'a41b4c2' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/assets/version.properties b/core/assets/version.properties index 9d9b770593..866e1dc634 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,7 +1,7 @@ #Autogenerated file. Do not modify. -#Mon Apr 02 15:23:03 EDT 2018 +#Tue Apr 03 23:58:20 EDT 2018 version=release -androidBuildCode=497 +androidBuildCode=501 name=Mindustry code=3.5 -build=37 +build=custom build diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index 828f58a3cd..77c5a8b650 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -174,15 +174,14 @@ public class NetServer extends Module{ float wtrc = 60; - if(TimeUtils.millis() < info.lastFastShot + (int)(wtrc/60f*1000)){ - info.fastShots ++; + if(!Timers.get("fastshoot-" + id + "-" + weapon.id, wtrc)){ + info.fastShots.getAndIncrement(weapon.id, 0, 1); - if(info.fastShots - 6 > (int)(wtrc / (weapon.getReload() / 2f))){ + if(info.fastShots.get(weapon.id, 0) > (int)(wtrc / (weapon.getReload() / 2f)) + 2){ kick(id, KickReason.kick); } }else{ - info.fastShots = 0; - info.lastFastShot = TimeUtils.millis(); + info.fastShots.put(weapon.id, 0); } packet.playerid = connections.get(id).id; @@ -266,8 +265,6 @@ public class NetServer extends Module{ Net.handleServer(WeaponSwitchPacket.class, (id, packet) -> { TraceInfo info = admins.getTrace(Net.getConnection(id).address); - info.fastShots = 0; - info.lastFastShot = TimeUtils.millis(); packet.playerid = connections.get(id).id; Net.sendExcept(id, packet, SendMode.tcp); diff --git a/core/src/io/anuke/mindustry/net/NetEvents.java b/core/src/io/anuke/mindustry/net/NetEvents.java index ccb59f36a1..f840180bdd 100644 --- a/core/src/io/anuke/mindustry/net/NetEvents.java +++ b/core/src/io/anuke/mindustry/net/NetEvents.java @@ -113,6 +113,8 @@ public class NetEvents { packet.rotation = angle; packet.playerid = Vars.player.id; Net.send(packet, SendMode.udp); + + handleWeaponSwitch(); } public static void handlePlace(int x, int y, Block block, int rotation){ diff --git a/core/src/io/anuke/mindustry/net/TraceInfo.java b/core/src/io/anuke/mindustry/net/TraceInfo.java index 9548ec9860..699e113e8e 100644 --- a/core/src/io/anuke/mindustry/net/TraceInfo.java +++ b/core/src/io/anuke/mindustry/net/TraceInfo.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.net; +import com.badlogic.gdx.utils.IntIntMap; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.blocks.Blocks; @@ -9,8 +10,7 @@ public class TraceInfo { public boolean modclient; public boolean android; - public int fastShots; - public long lastFastShot; + public IntIntMap fastShots = new IntIntMap(); public int totalBlocksBroken; public int structureBlocksBroken;