Fixed some crashes, changed some colors
This commit is contained in:
@@ -68,6 +68,11 @@ public class Pathfind{
|
||||
return vector.set(enemy.x, enemy.y);
|
||||
}
|
||||
|
||||
if(enemy.node >= path.length){
|
||||
enemy.node = -1;
|
||||
return vector.set(enemy.x, enemy.y);
|
||||
}
|
||||
|
||||
//TODO documentation on what this does
|
||||
Tile prev = path[enemy.node - 1];
|
||||
|
||||
|
||||
@@ -393,9 +393,6 @@ public class Control extends Module{
|
||||
}
|
||||
|
||||
public void coreDestroyed(){
|
||||
if(Net.active() && Net.server()){
|
||||
Net.closeServer();
|
||||
}
|
||||
|
||||
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
|
||||
Sounds.play("corexplode");
|
||||
@@ -404,7 +401,9 @@ public class Control extends Module{
|
||||
}
|
||||
Effects.effect(Fx.coreexplosion, core.worldx(), core.worldy());
|
||||
|
||||
Timers.run(60, ()-> ui.restart.show());
|
||||
Timers.run(60, () -> {
|
||||
ui.restart.show();
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isGameOver(){
|
||||
|
||||
@@ -33,8 +33,9 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NetClient extends Module {
|
||||
public static final Color[] colorArray = {Color.ORANGE, Color.SCARLET, Color.LIME,
|
||||
Color.GOLD, Color.PINK, Color.SKY, Color.GOLD};
|
||||
public static final Color[] colorArray = {Color.ORANGE, Color.SCARLET, Color.LIME, Color.PURPLE,
|
||||
Color.GOLD, Color.PINK, Color.SKY, Color.GOLD, Color.VIOLET,
|
||||
Color.GREEN, Color.CORAL, Color.CYAN, Color.CHARTREUSE};
|
||||
boolean connecting = false;
|
||||
boolean gotEntities = false, gotData = false;
|
||||
boolean kicked = false;
|
||||
@@ -228,7 +229,7 @@ public class NetClient extends Module {
|
||||
while (stream.available() > 0) {
|
||||
int pos = stream.readInt();
|
||||
|
||||
//TODO what if there's no entity?
|
||||
//TODO what if there's no entity? new code
|
||||
Tile tile = Vars.world.tile(pos % Vars.world.width(), pos / Vars.world.width());
|
||||
|
||||
byte times = stream.readByte();
|
||||
@@ -241,6 +242,10 @@ public class NetClient extends Module {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
//do nothing else...
|
||||
//TODO fix
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -61,16 +61,16 @@ public class Player extends DestructibleEntity implements Syncable{
|
||||
|
||||
@Override
|
||||
public void onDeath(){
|
||||
Effects.effect(Fx.explosion, this);
|
||||
Effects.shake(4f, 5f, this);
|
||||
Effects.sound("die", this);
|
||||
|
||||
if(isLocal){
|
||||
remove();
|
||||
}else{
|
||||
set(-9999, -9999);
|
||||
}
|
||||
|
||||
Effects.effect(Fx.explosion, this);
|
||||
Effects.shake(4f, 5f, this);
|
||||
Effects.sound("die", this);
|
||||
|
||||
//TODO respawning doesn't work properly for multiplayer at all
|
||||
if(isLocal) {
|
||||
Vars.control.setRespawnTime(respawnduration);
|
||||
|
||||
@@ -94,6 +94,7 @@ public class SaveIO{
|
||||
return true;
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
|
||||
content().addButton("$text.quit", () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
||||
if(Net.active() && Net.client()) Net.disconnect();
|
||||
runSave();
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
@@ -109,6 +110,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
|
||||
new imagebutton("icon-quit", isize, () -> {
|
||||
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
||||
if(Net.active() && Net.client()) Net.disconnect();
|
||||
runSave();
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
@@ -25,7 +26,11 @@ public class PlayerListFragment implements Fragment{
|
||||
new label(() -> Bundles.format(Vars.control.playerGroup.amount() == 1 ? "text.players.single" :
|
||||
"text.players", Vars.control.playerGroup.amount()));
|
||||
row();
|
||||
add(content).grow();
|
||||
content.marginRight(13f).marginLeft(13f);
|
||||
ScrollPane pane = new ScrollPane(content, "clear");
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setFadeScrollBars(false);
|
||||
add(pane).grow();
|
||||
}}.end();
|
||||
|
||||
update(t -> {
|
||||
|
||||
Reference in New Issue
Block a user