Fixed drone desync, client crash, dedicated server player warping
This commit is contained in:
@@ -170,7 +170,7 @@ public class NetServer extends Module{
|
||||
|
||||
long elapsed = TimeUtils.timeSinceMillis(connection.lastRecievedTime);
|
||||
|
||||
float maxSpeed = packet.boosting && !player.mech.flying ? player.mech.boostSpeed : player.mech.speed;
|
||||
float maxSpeed = packet.boosting && !player.mech.flying ? player.mech.boostSpeed*3f : player.mech.speed*3f;
|
||||
|
||||
//extra 1.1x multiplicaton is added just in case
|
||||
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
|
||||
|
||||
@@ -171,6 +171,7 @@ public class TileEntity extends BaseEntity implements TargetTrait {
|
||||
|
||||
@Remote(called = Loc.server, in = In.blocks)
|
||||
public static void onTileDestroyed(Tile tile){
|
||||
if(tile.entity == null) return;
|
||||
tile.entity.onDeath();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package io.anuke.mindustry.entities.units.types;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import com.badlogic.gdx.utils.Queue;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
@@ -15,8 +17,10 @@ import io.anuke.mindustry.entities.units.UnitState;
|
||||
import io.anuke.mindustry.game.EventType.BlockBuildEvent;
|
||||
import io.anuke.mindustry.gen.CallEntity;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.net.In;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.BuildBlock;
|
||||
import io.anuke.mindustry.world.blocks.BuildBlock.BuildEntity;
|
||||
@@ -80,6 +84,7 @@ public class Drone extends FlyingUnit implements BuilderTrait {
|
||||
float dist = Math.min(entity.distanceTo(x, y) - placeDistance, 0);
|
||||
|
||||
if(dist / type.maxVelocity < timeToBuild * 0.9f){
|
||||
CallEntity.onDroneBeginBuild(this, entity.tile, entity.recipe);
|
||||
target = entity;
|
||||
setState(build);
|
||||
}
|
||||
@@ -213,6 +218,15 @@ public class Drone extends FlyingUnit implements BuilderTrait {
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(in = In.entities)
|
||||
public static void onDroneBeginBuild(Unit unit, Tile tile, Recipe recipe){
|
||||
if(unit == null) return;
|
||||
|
||||
Drone drone = (Drone)unit;
|
||||
|
||||
drone.getPlaceQueue().addLast(new BuildRequest(tile.x, tile.y, tile.getRotation(), recipe));
|
||||
}
|
||||
|
||||
public final UnitState
|
||||
|
||||
build = new UnitState(){
|
||||
|
||||
Reference in New Issue
Block a user