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

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

View File

@@ -43,7 +43,6 @@ public class UnitTypes implements ContentList{
speed = 0.2f;
maxVelocity = 0.8f;
range = 50f;
healSpeed = 0.22f;
health = 60;
}};
@@ -115,6 +114,7 @@ public class UnitTypes implements ContentList{
}};
phantom = new UnitType("phantom", Phantom.class, Phantom::new){{
weapon = Weapons.healBlasterDrone2;
isFlying = true;
drag = 0.01f;
mass = 2f;
@@ -125,7 +125,6 @@ public class UnitTypes implements ContentList{
health = 220;
buildPower = 0.9f;
minePower = 1.1f;
healSpeed = 0.5f;
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 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
public void load(){
@@ -179,6 +179,16 @@ public class Weapons implements ContentList{
recoil = 2f;
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

View File

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

View File

@@ -74,6 +74,11 @@ public class MapRenderer implements Disposable{
for(int y = 0; y < chunks[0].length; 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),
th / (height * tilesize), 1f);
mesh.setProjectionMatrix(Core.batch.getProjectionMatrix());

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.entities.traits;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Queue;
import io.anuke.mindustry.Vars;
@@ -229,7 +230,7 @@ public interface BuilderTrait extends Entity{
}
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;
}
}

View File

@@ -97,7 +97,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
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(){

View File

@@ -41,7 +41,7 @@ public class UnitType extends UnlockableContent{
public float carryWeight = 1f;
public int itemCapacity = 30;
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 float weaponOffsetX, weaponOffsetY;
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 io.anuke.mindustry.core.GameState.State;
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.util.Bundles;
@@ -29,8 +30,9 @@ public class PausedDialog extends FloatingDialog{
void rebuild(){
missionTable.clear();
missionTable.background("underline");
missionTable.background((Drawable) null);
if(world.getSector() != null){
missionTable.background("underline");
missionTable.add(Bundles.format("text.sector", world.getSector().x + ", " + world.getSector().y));
}
}
@@ -49,7 +51,7 @@ public class PausedDialog extends FloatingDialog{
float dw = 210f;
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().addButton("$text.unlocks", ui.unlocks::show);
@@ -61,7 +63,7 @@ public class PausedDialog extends FloatingDialog{
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();

View File

@@ -193,7 +193,7 @@ public class HudFragment extends Fragment{
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)))));
});