Fixed some multiplayer crashes
This commit is contained in:
@@ -473,7 +473,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
updateMech();
|
||||
}
|
||||
|
||||
avoidOthers(8f);
|
||||
if(isLocal) {
|
||||
avoidOthers(8f);
|
||||
}
|
||||
|
||||
if(!isShooting()) {
|
||||
updateBuilding(this);
|
||||
|
||||
@@ -199,7 +199,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
}
|
||||
|
||||
public void avoidOthers(float avoidRange){
|
||||
if(Net.client()) return;
|
||||
|
||||
EntityPhysics.getNearby(getGroup(), x, y, avoidRange*2f, t -> {
|
||||
if(t == this || (t instanceof Unit && (((Unit) t).isDead() || (((Unit) t).isFlying() != isFlying()) || ((Unit) t).getCarrier() == this) || getCarrier() == t)) return;
|
||||
|
||||
@@ -41,6 +41,7 @@ public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{
|
||||
|
||||
@Remote(called = Loc.both, targets = Loc.both, forward = true, in = In.entities)
|
||||
static void setCarryOf(Player player, CarryTrait trait, CarriableTrait unit){
|
||||
if(trait == null) return;
|
||||
if(player != null){ //when a server recieves this called from a player, set the carrier to the player.
|
||||
trait = player;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,9 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
return;
|
||||
}
|
||||
|
||||
avoidOthers(8f);
|
||||
if(!Net.client()){
|
||||
avoidOthers(8f);
|
||||
}
|
||||
|
||||
if(squad != null){
|
||||
squad.update();
|
||||
|
||||
Reference in New Issue
Block a user