Packet spam, rate limit fix / Flying unit command limit nerf

This commit is contained in:
Anuken 2020-11-04 14:41:19 -05:00
parent e8a5e35f50
commit 6bdde8b964
2 changed files with 19 additions and 10 deletions

View File

@ -896,20 +896,28 @@ public class UnitTypes implements ContentList{
engineOffset = 5.5f;
range = 140f;
targetAir = false;
commandLimit = 4;
weapons.add(new Weapon(){{
y = 0f;
x = 2f;
reload = 13f;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
bullet = new BasicBulletType(2.5f, 9){{
width = 7f;
height = 9f;
lifetime = 45f;
shootEffect = Fx.shootSmall;
smokeEffect = Fx.shootSmallSmoke;
ammoMultiplier = 2;
}};
shootSound = Sounds.shoot;
}});
}};
horizon = new UnitType("horizon"){{
health = 350;
speed = 1.8f;
health = 340;
speed = 1.7f;
accel = 0.08f;
drag = 0.016f;
flying = true;
@ -920,6 +928,7 @@ public class UnitTypes implements ContentList{
faceTarget = false;
armor = 4f;
targetFlag = BlockFlag.factory;
commandLimit = 5;
weapons.add(new Weapon(){{
minShootVelocity = 0.75f;
@ -1718,7 +1727,7 @@ public class UnitTypes implements ContentList{
hitSize = 9f;
rotateShooting = false;
lowAltitude = true;
commandLimit = 5;
commandLimit = 4;
weapons.add(new Weapon("small-mount-weapon"){{
top = false;
@ -1757,7 +1766,7 @@ public class UnitTypes implements ContentList{
health = 220f;
engineOffset = 6f;
hitSize = 11f;
commandLimit = 7;
commandLimit = 5;
weapons.add(new Weapon("small-mount-weapon"){{
top = false;

View File

@ -46,14 +46,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
final static float playerSelectRange = mobile ? 17f : 11f;
/** Maximum line length. */
final static int maxLength = 100;
final static Vec2 stackTrns = new Vec2();
final static Rect r1 = new Rect(), r2 = new Rect();
final static Seq<Unit> units = new Seq<>();
/** Distance on the back from where items originate. */
final static float backTrns = 3f;
public final OverlayFragment frag = new OverlayFragment();
public Interval controlInterval = new Interval();
public @Nullable Block block;
public boolean overrideLineRotation;
public int rotation;
@ -419,7 +416,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type == controlledType && !u.dead);
if(unit != null){
Call.unitControl(player, unit);
//only trying controlling once a second to prevent packet spam
if(!net.client() || controlInterval.get(0, 70f)){
Call.unitControl(player, unit);
}
}
}
}