Fixed some crashes, changed some colors

This commit is contained in:
Anuken
2018-01-10 21:34:01 -05:00
parent d8f94384e0
commit d6bc6bf88c
8 changed files with 30 additions and 13 deletions

View File

@@ -128,7 +128,7 @@ text.weapons=Weapons
text.paused=Paused text.paused=Paused
text.respawn=Respawning in text.respawn=Respawning in
text.error.title=[crimson]An error has occured text.error.title=[crimson]An error has occured
text.error.crashmessage=[SCARLET]An unexpected error has occured, which would have caused a crash. []Please report the exact circumstances under which this error occured to the developer: \n[ORANGE]anukendev@gmail.com[] text.error.crashmessage=[SCARLET]An unexpected error has occured, which would have caused a crash.\n[]Please report the exact circumstances under which this error occured to the developer: \n[ORANGE]anukendev@gmail.com[]
text.error.crashtitle=An error has occured text.error.crashtitle=An error has occured
text.mode.break=Break mode: {0} text.mode.break=Break mode: {0}
text.mode.place=Place mode: {0} text.mode.place=Place mode: {0}

View File

@@ -68,6 +68,11 @@ public class Pathfind{
return vector.set(enemy.x, enemy.y); 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 //TODO documentation on what this does
Tile prev = path[enemy.node - 1]; Tile prev = path[enemy.node - 1];

View File

@@ -393,9 +393,6 @@ public class Control extends Module{
} }
public void coreDestroyed(){ public void coreDestroyed(){
if(Net.active() && Net.server()){
Net.closeServer();
}
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y); Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
Sounds.play("corexplode"); Sounds.play("corexplode");
@@ -404,7 +401,9 @@ public class Control extends Module{
} }
Effects.effect(Fx.coreexplosion, core.worldx(), core.worldy()); Effects.effect(Fx.coreexplosion, core.worldx(), core.worldy());
Timers.run(60, ()-> ui.restart.show()); Timers.run(60, () -> {
ui.restart.show();
});
} }
public boolean isGameOver(){ public boolean isGameOver(){

View File

@@ -33,8 +33,9 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
public class NetClient extends Module { public class NetClient extends Module {
public static final Color[] colorArray = {Color.ORANGE, Color.SCARLET, Color.LIME, public static final Color[] colorArray = {Color.ORANGE, Color.SCARLET, Color.LIME, Color.PURPLE,
Color.GOLD, Color.PINK, Color.SKY, Color.GOLD}; Color.GOLD, Color.PINK, Color.SKY, Color.GOLD, Color.VIOLET,
Color.GREEN, Color.CORAL, Color.CYAN, Color.CHARTREUSE};
boolean connecting = false; boolean connecting = false;
boolean gotEntities = false, gotData = false; boolean gotEntities = false, gotData = false;
boolean kicked = false; boolean kicked = false;
@@ -228,7 +229,7 @@ public class NetClient extends Module {
while (stream.available() > 0) { while (stream.available() > 0) {
int pos = stream.readInt(); 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()); Tile tile = Vars.world.tile(pos % Vars.world.width(), pos / Vars.world.width());
byte times = stream.readByte(); byte times = stream.readByte();
@@ -241,6 +242,10 @@ public class NetClient extends Module {
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (Exception e){
e.printStackTrace();
//do nothing else...
//TODO fix
} }
}); });

View File

@@ -61,16 +61,16 @@ public class Player extends DestructibleEntity implements Syncable{
@Override @Override
public void onDeath(){ public void onDeath(){
Effects.effect(Fx.explosion, this);
Effects.shake(4f, 5f, this);
Effects.sound("die", this);
if(isLocal){ if(isLocal){
remove(); remove();
}else{ }else{
set(-9999, -9999); 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 //TODO respawning doesn't work properly for multiplayer at all
if(isLocal) { if(isLocal) {
Vars.control.setRespawnTime(respawnduration); Vars.control.setRespawnTime(respawnduration);

View File

@@ -94,6 +94,7 @@ public class SaveIO{
return true; return true;
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
return false; return false;
} }
} }

View File

@@ -67,6 +67,7 @@ public class PausedDialog extends FloatingDialog{
content().addButton("$text.quit", () -> { content().addButton("$text.quit", () -> {
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> { ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
if(Net.active() && Net.client()) Net.disconnect();
runSave(); runSave();
hide(); hide();
GameState.set(State.menu); GameState.set(State.menu);
@@ -109,6 +110,7 @@ public class PausedDialog extends FloatingDialog{
new imagebutton("icon-quit", isize, () -> { new imagebutton("icon-quit", isize, () -> {
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> { Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
if(Net.active() && Net.client()) Net.disconnect();
runSave(); runSave();
hide(); hide();
GameState.set(State.menu); GameState.set(State.menu);

View File

@@ -10,6 +10,7 @@ import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.scene.builders.label; import io.anuke.ucore.scene.builders.label;
import io.anuke.ucore.scene.builders.table; 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.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles; 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" : new label(() -> Bundles.format(Vars.control.playerGroup.amount() == 1 ? "text.players.single" :
"text.players", Vars.control.playerGroup.amount())); "text.players", Vars.control.playerGroup.amount()));
row(); 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(); }}.end();
update(t -> { update(t -> {