Added freebuild / Power system fix / Net packet pool fix / Crash fixes
This commit is contained in:
@@ -610,7 +610,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
if (target == null) {
|
||||
isShooting = false;
|
||||
target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange());
|
||||
} else {
|
||||
} else if(target.isValid()){
|
||||
//rotate toward and shoot the target
|
||||
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f);
|
||||
|
||||
@@ -697,12 +697,18 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void readSave(DataInput stream) throws IOException {
|
||||
boolean local = stream.readBoolean();
|
||||
|
||||
if(local){
|
||||
if(local && !headless){
|
||||
byte mechid = stream.readByte();
|
||||
int index = stream.readByte();
|
||||
players[index].readSaveSuper(stream);
|
||||
players[index].mech = Upgrade.getByID(mechid);
|
||||
players[index].dead = false;
|
||||
}else if(local){
|
||||
byte mechid = stream.readByte();
|
||||
stream.readByte();
|
||||
readSaveSuper(stream);
|
||||
mech = Upgrade.getByID(mechid);
|
||||
dead = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable
|
||||
|
||||
/**Start a fire on the tile. If there already is a file there, refreshes its lifetime.*/
|
||||
public static void create(Tile tile){
|
||||
if(Net.client()) return; //not clientside.
|
||||
if(Net.client() || tile == null) return; //not clientside.
|
||||
|
||||
Fire fire = map.get(tile.packedPosition());
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable
|
||||
|
||||
/**Attempts to extinguish a fire by shortening its life. If there is no fire here, does nothing.*/
|
||||
public static void extinguish(Tile tile, float intensity) {
|
||||
if (map.containsKey(tile.packedPosition())) {
|
||||
if (tile != null && map.containsKey(tile.packedPosition())) {
|
||||
map.get(tile.packedPosition()).time += intensity * Timers.delta();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
|
||||
Effects.effect(UnitFx.pickup, drop);
|
||||
}
|
||||
itemGroup.removeByID(itemid);
|
||||
netClient.addRemovedEntity(itemid);
|
||||
}
|
||||
|
||||
/**Internal use only!*/
|
||||
|
||||
Reference in New Issue
Block a user