Fixed some multiplayer bugs
This commit is contained in:
@@ -3320,7 +3320,7 @@ public class Blocks{
|
||||
|
||||
ammo(Items.scrap, new BasicBulletType(){{
|
||||
damage = 40;
|
||||
speed = 8f;
|
||||
speed = 8.5f;
|
||||
width = 11f;
|
||||
height = 16f;
|
||||
trailColor = Pal.bulletYellowBack;
|
||||
@@ -3329,13 +3329,20 @@ public class Blocks{
|
||||
collidesTiles = false;
|
||||
shootEffect = Fx.shootBig2;
|
||||
smokeEffect = Fx.shootBigSmoke2;
|
||||
frontColor = Color.white;
|
||||
backColor = Color.valueOf("869cbe");
|
||||
|
||||
lifetime = 34f;
|
||||
//controversial
|
||||
homingDelay = 10f;
|
||||
homingPower = 0.01f;
|
||||
}});
|
||||
|
||||
//TODO bullet.
|
||||
|
||||
//recoilAmount = 1f;
|
||||
reloadTime = 8f;
|
||||
shootLength = 15f;
|
||||
shootLength = 14f;
|
||||
rotateSpeed = 5f;
|
||||
|
||||
coolantUsage = 30f / 60f;
|
||||
@@ -3350,7 +3357,7 @@ public class Blocks{
|
||||
widthSpread = true;
|
||||
targetGround = false;
|
||||
spread = 4.6f;
|
||||
inaccuracy = 8f;
|
||||
inaccuracy = 9f;
|
||||
|
||||
restitution = 0.1f;
|
||||
shootWarmupSpeed = 0.08f;
|
||||
@@ -3359,7 +3366,7 @@ public class Blocks{
|
||||
acceptCoolant = false;
|
||||
|
||||
scaledHealth = 340;
|
||||
range = 250f;
|
||||
range = 270f;
|
||||
size = 4;
|
||||
}};
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class NetClient implements ApplicationListener{
|
||||
private static final float dataTimeout = 60 * 20;
|
||||
private static final float playerSyncTime = 5;
|
||||
/** ticks between syncs, e.g. 5 means 60/5 = 12 syncs/sec*/
|
||||
private static final float playerSyncTime = 4;
|
||||
private static final Reads dataReads = new Reads(null);
|
||||
|
||||
private long ping;
|
||||
|
||||
@@ -728,12 +728,9 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
Call.commandUnits(player, ids, attack instanceof Building b ? b : null, attack instanceof Unit u ? u : null, target);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return super.tap(x, y, count, button);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,6 +194,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
public static void commandUnits(Player player, int[] unitIds, @Nullable Building buildTarget, @Nullable Unit unitTarget, @Nullable Vec2 posTarget){
|
||||
if(player == null || unitIds == null) return;
|
||||
|
||||
//why did I ever think this was a good idea
|
||||
if(unitTarget != null && unitTarget.isNull()) unitTarget = null;
|
||||
|
||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.commandUnits, event -> {
|
||||
event.unitIDs = unitIds;
|
||||
})){
|
||||
|
||||
@@ -443,15 +443,18 @@ public class Weapon implements Cloneable{
|
||||
if(unitSpawned == null){
|
||||
return bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl);
|
||||
}else{
|
||||
Unit spawned = unitSpawned.create(unit.team);
|
||||
spawned.set(x, y);
|
||||
spawned.rotation = angle;
|
||||
//immediately spawn at top speed, since it was launched
|
||||
spawned.vel.trns(angle, unitSpawned.speed);
|
||||
if(spawned.controller() instanceof MissileAI ai){
|
||||
ai.shooter = unit;
|
||||
//don't spawn units clientside!
|
||||
if(!net.client()){
|
||||
Unit spawned = unitSpawned.create(unit.team);
|
||||
spawned.set(x, y);
|
||||
spawned.rotation = angle;
|
||||
//immediately spawn at top speed, since it was launched
|
||||
spawned.vel.trns(angle, unitSpawned.speed);
|
||||
if(spawned.controller() instanceof MissileAI ai){
|
||||
ai.shooter = unit;
|
||||
}
|
||||
spawned.add();
|
||||
}
|
||||
spawned.add();
|
||||
//TODO assign AI target here?
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user