Crash fixes

This commit is contained in:
Anuken
2018-11-28 08:53:03 -05:00
parent cc90e6d479
commit f2be23274e
11 changed files with 30 additions and 14 deletions

View File

@@ -16,7 +16,6 @@ TintedDrawable: {
none: {name: white, color: {r: 0, g: 0, b: 0, a: 0}}, none: {name: white, color: {r: 0, g: 0, b: 0, a: 0}},
flat: {name: white, color: {r: 0.0, g: 0.0, b: 0.0, a: 0.6}}, flat: {name: white, color: {r: 0.0, g: 0.0, b: 0.0, a: 0.6}},
flat-over: {name: white, color: { hex: "#ffffff82" }}, flat-over: {name: white, color: { hex: "#ffffff82" }},
flat-alpha: {name: white, color: { hex: "#ffd37fff" }},
flat-down: {name: white, color: { hex: "#ffd37fff" }} flat-down: {name: white, color: { hex: "#ffd37fff" }}
}, },
ButtonStyle: { ButtonStyle: {
@@ -42,7 +41,7 @@ ImageButtonStyle: {
static-down: {up: button-down }, static-down: {up: button-down },
toggle: {checked: button-down, down: button-down, up: button, imageDisabledColor: gray, imageUpColor: white }, toggle: {checked: button-down, down: button-down, up: button, imageDisabledColor: gray, imageUpColor: white },
select: {checked: button-select, up: none }, select: {checked: button-select, up: none },
clear: {down: flat-down, up: flat, over: flat-over}, clear: {down: flat-over, up: flat, over: flat-over},
clear-full: {down: white, up: button-select, over: flat-down}, clear-full: {down: white, up: button-select, over: flat-down},
clear-partial: {down: flat-down, up: none, over: flat-over}, clear-partial: {down: flat-down, up: none, over: flat-over},
clear-toggle: {down: flat-down, checked: flat-down, up: flat, over: flat-over}, clear-toggle: {down: flat-down, checked: flat-down, up: flat, over: flat-over},

View File

@@ -45,7 +45,7 @@ public class Pathfinder{
} }
public void update(){ public void update(){
if(Net.client()) return; if(Net.client() || paths == null) return;
for(Team team : Team.all){ for(Team team : Team.all){
if(state.teams.isActive(team)){ if(state.teams.isActive(team)){

View File

@@ -43,7 +43,6 @@ public class UnitTypes implements ContentList{
speed = 0.2f; speed = 0.2f;
maxVelocity = 0.8f; maxVelocity = 0.8f;
range = 50f; range = 50f;
healSpeed = 0.22f;
health = 60; health = 60;
}}; }};
@@ -115,6 +114,7 @@ public class UnitTypes implements ContentList{
}}; }};
phantom = new UnitType("phantom", Phantom.class, Phantom::new){{ phantom = new UnitType("phantom", Phantom.class, Phantom::new){{
weapon = Weapons.healBlasterDrone2;
isFlying = true; isFlying = true;
drag = 0.01f; drag = 0.01f;
mass = 2f; mass = 2f;
@@ -125,7 +125,6 @@ public class UnitTypes implements ContentList{
health = 220; health = 220;
buildPower = 0.9f; buildPower = 0.9f;
minePower = 1.1f; minePower = 1.1f;
healSpeed = 0.5f;
toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium); toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium);
}}; }};
} }

View File

@@ -8,7 +8,7 @@ import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{ public class Weapons implements ContentList{
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, healBlasterDrone, chainBlaster, shockgun, public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, healBlasterDrone, chainBlaster, shockgun,
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery, laserBurster; sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery, laserBurster, healBlasterDrone2;
@Override @Override
public void load(){ public void load(){
@@ -179,6 +179,16 @@ public class Weapons implements ContentList{
recoil = 2f; recoil = 2f;
ammo = AmmoTypes.healBlaster; ammo = AmmoTypes.healBlaster;
}}; }};
healBlasterDrone2 = new Weapon("heal-blaster"){{
length = 1.5f;
reload = 20f;
width = 0.5f;
roundrobin = true;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
}};
} }
@Override @Override

View File

@@ -21,7 +21,7 @@ public class PowerBlocks extends BlockList implements ContentList{
thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{ thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{
maxLiquidGenerate = 2f; maxLiquidGenerate = 2f;
powerCapacity = 40f; powerCapacity = 40f;
powerPerLiquid = 0.2f; powerPerLiquid = 0.3f;
generateEffect = BlockFx.redgeneratespark; generateEffect = BlockFx.redgeneratespark;
size = 2; size = 2;
}}; }};

View File

@@ -74,6 +74,11 @@ public class MapRenderer implements Disposable{
for(int y = 0; y < chunks[0].length; y++){ for(int y = 0; y < chunks[0].length; y++){
IndexedRenderer mesh = chunks[x][y]; IndexedRenderer mesh = chunks[x][y];
if(mesh == null){
chunks[x][y] = new IndexedRenderer(chunksize * chunksize * 2);
mesh = chunks[x][y];
}
mesh.getTransformMatrix().setToTranslation(tx, ty, 0).scl(tw / (width * tilesize), mesh.getTransformMatrix().setToTranslation(tx, ty, 0).scl(tw / (width * tilesize),
th / (height * tilesize), 1f); th / (height * tilesize), 1f);
mesh.setProjectionMatrix(Core.batch.getProjectionMatrix()); mesh.setProjectionMatrix(Core.batch.getProjectionMatrix());

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.entities.traits; package io.anuke.mindustry.entities.traits;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Queue; import com.badlogic.gdx.utils.Queue;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
@@ -229,7 +230,7 @@ public interface BuilderTrait extends Entity{
} }
if(!current.initialized){ if(!current.initialized){
Events.fire(new BuildSelectEvent(tile, unit.getTeam(), this, current.breaking)); Gdx.app.postRunnable(() -> Events.fire(new BuildSelectEvent(tile, unit.getTeam(), this, current.breaking)));
current.initialized = true; current.initialized = true;
} }
} }

View File

@@ -97,7 +97,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
} }
public boolean isCommanded(){ public boolean isCommanded(){
return !isWave && world.indexer.getAllied(team, BlockFlag.comandCenter).size != 0; return !isWave && world.indexer.getAllied(team, BlockFlag.comandCenter).size != 0 && world.indexer.getAllied(team, BlockFlag.comandCenter).first().entity instanceof CommandCenterEntity;
} }
public UnitCommand getCommand(){ public UnitCommand getCommand(){

View File

@@ -41,7 +41,7 @@ public class UnitType extends UnlockableContent{
public float carryWeight = 1f; public float carryWeight = 1f;
public int itemCapacity = 30; public int itemCapacity = 30;
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper); public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 2f; public float buildPower = 0.3f, minePower = 0.7f;
public Weapon weapon = Weapons.blaster; public Weapon weapon = Weapons.blaster;
public float weaponOffsetX, weaponOffsetY; public float weaponOffsetX, weaponOffsetY;
public Color trailColor = Color.valueOf("ffa665"); public Color trailColor = Color.valueOf("ffa665");

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.ucore.scene.style.Drawable;
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;
@@ -29,8 +30,9 @@ public class PausedDialog extends FloatingDialog{
void rebuild(){ void rebuild(){
missionTable.clear(); missionTable.clear();
missionTable.background("underline"); missionTable.background((Drawable) null);
if(world.getSector() != null){ if(world.getSector() != null){
missionTable.background("underline");
missionTable.add(Bundles.format("text.sector", world.getSector().x + ", " + world.getSector().y)); missionTable.add(Bundles.format("text.sector", world.getSector().x + ", " + world.getSector().y));
} }
} }
@@ -49,7 +51,7 @@ public class PausedDialog extends FloatingDialog{
float dw = 210f; float dw = 210f;
content().defaults().width(dw).height(50).pad(5f); content().defaults().width(dw).height(50).pad(5f);
content().addButton("$text.back", this::hide).colspan(2).width(dw*2 + 10f); content().addButton("$text.back", this::hide).colspan(2).width(dw*2 + 20f);
content().row(); content().row();
content().addButton("$text.unlocks", ui.unlocks::show); content().addButton("$text.unlocks", ui.unlocks::show);
@@ -61,7 +63,7 @@ public class PausedDialog extends FloatingDialog{
content().row(); content().row();
content().addButton("$text.hostserver", ui.host::show).disabled(b -> Net.active()).colspan(2).width(dw*2 + 10f); content().addButton("$text.hostserver", ui.host::show).disabled(b -> Net.active()).colspan(2).width(dw*2 + 20f);
content().row(); content().row();

View File

@@ -193,7 +193,7 @@ public class HudFragment extends Fragment{
return coreAttackOpacity > 0; return coreAttackOpacity > 0;
}); });
t.table("clear", top -> top.add("$text.coreattack").pad(6) t.table("button", top -> top.add("$text.coreattack").pad(2)
.update(label -> label.setColor(Hue.mix(Color.ORANGE, Color.SCARLET, Mathf.absin(Timers.time(), 2f, 1f))))); .update(label -> label.setColor(Hue.mix(Color.ORANGE, Color.SCARLET, Mathf.absin(Timers.time(), 2f, 1f)))));
}); });