Heal bullet effect fix / Spawned ID sync / Crash fix
This commit is contained in:
@@ -360,6 +360,7 @@ public class Bullets implements ContentList{
|
||||
|
||||
{
|
||||
shootEffect = Fx.shootHeal;
|
||||
smokeEffect = Fx.hitLaser;
|
||||
hitEffect = Fx.hitLaser;
|
||||
despawnEffect = Fx.hitLaser;
|
||||
collidesTeam = true;
|
||||
|
||||
@@ -162,7 +162,7 @@ public class Fx implements ContentList{
|
||||
heal = new Effect(11, e -> {
|
||||
Draw.color(Pal.heal);
|
||||
Lines.stroke(e.fout() * 2f);
|
||||
Lines.poly(e.x, e.y, 10, 2f + e.finpow() * 7f);
|
||||
Lines.poly(e.x, e.y, 24, 2f + e.finpow() * 7f);
|
||||
Draw.color();
|
||||
});
|
||||
|
||||
|
||||
@@ -98,16 +98,15 @@ public class NetClient implements ApplicationListener{
|
||||
});
|
||||
|
||||
Net.handleClient(Disconnect.class, packet -> {
|
||||
state.set(State.menu);
|
||||
connecting = false;
|
||||
Platform.instance.updateRPC();
|
||||
|
||||
if(quiet) return;
|
||||
|
||||
Time.runTask(3f, ui.loadfrag::hide);
|
||||
|
||||
state.set(State.menu);
|
||||
|
||||
ui.showError("$disconnect");
|
||||
connecting = false;
|
||||
|
||||
Platform.instance.updateRPC();
|
||||
});
|
||||
|
||||
Net.handleClient(WorldStream.class, data -> {
|
||||
|
||||
@@ -233,6 +233,12 @@ public class NetServer implements ApplicationListener{
|
||||
}
|
||||
|
||||
public static void onDisconnect(Player player){
|
||||
//singleplayer multiplayer wierdness
|
||||
if(player.con == null){
|
||||
player.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.con.hasConnected){
|
||||
Call.sendMessage("[accent]" + player.name + "[accent] has disconnected.");
|
||||
Call.onPlayerDisconnect(player.id);
|
||||
@@ -573,7 +579,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
NetConnection connection = player.con;
|
||||
|
||||
if(!connection.isConnected() || !connections.containsKey(connection.id)){
|
||||
if(connection == null || !connection.isConnected() || !connections.containsKey(connection.id)){
|
||||
//player disconnected, call d/c event
|
||||
onDisconnect(player);
|
||||
return;
|
||||
|
||||
@@ -337,6 +337,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
public void write(DataOutput data) throws IOException{
|
||||
super.writeSave(data);
|
||||
data.writeByte(type.id);
|
||||
data.writeInt(spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,6 +345,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
float lastx = x, lasty = y, lastrot = rotation;
|
||||
super.readSave(data);
|
||||
this.type = content.getByID(ContentType.unit, data.readByte());
|
||||
this.spawner = data.readInt();
|
||||
|
||||
interpolator.read(lastx, lasty, x, y, rotation);
|
||||
rotation = lastrot;
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UnitFactory extends Block{
|
||||
//for attack mode
|
||||
protected float gracePeriodMultiplier = 15f;
|
||||
protected float speedupTime = 60f * 60f * 20;
|
||||
protected float maxSpeedup = 2f;
|
||||
@@ -57,14 +58,14 @@ public class UnitFactory extends Block{
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onUnitFactorySpawn(Tile tile){
|
||||
public static void onUnitFactorySpawn(Tile tile, int spawns){
|
||||
if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitFactory)) return;
|
||||
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactory factory = (UnitFactory) tile.block();
|
||||
|
||||
entity.buildTime = 0f;
|
||||
entity.spawned ++;
|
||||
entity.spawned = spawns;
|
||||
|
||||
Effects.shake(2f, 3f, entity);
|
||||
Effects.effect(Fx.producesmoke, tile.drawx(), tile.drawy());
|
||||
@@ -182,7 +183,7 @@ public class UnitFactory extends Block{
|
||||
if(entity.buildTime >= produceTime){
|
||||
entity.buildTime = 0f;
|
||||
|
||||
Call.onUnitFactorySpawn(tile);
|
||||
Call.onUnitFactorySpawn(tile, entity.spawned + 1);
|
||||
useContent(tile, type);
|
||||
|
||||
for(ItemStack stack : consumes.items()){
|
||||
|
||||
Reference in New Issue
Block a user