1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-10 15:05:23 +03:00

More bugfixes

This commit is contained in:
Anuken 2019-02-22 23:16:50 -05:00
parent 7fb72bf0e2
commit d74887eaa1
17 changed files with 81 additions and 62 deletions

View File

@ -45,6 +45,8 @@ public class Vars{
public static final Team defaultTeam = Team.blue;
/**team of the enemy in waves/sectors*/
public static final Team waveTeam = Team.red;
/**how many times longer a boss wave takes*/
public static final float bossWaveMultiplier = 3f;
/**max chat message length*/
public static final int maxTextLength = 150;
/**max player name length in bytes*/

View File

@ -833,7 +833,7 @@ public class Blocks implements ContentList{
thermalGenerator = new ThermalGenerator("thermal-generator"){{
requirements(Category.power, ItemStack.with(Items.copper, 80, Items.graphite, 70, Items.lead, 100, Items.silicon, 70, Items.metaglass, 80));
powerProduction = 2f;
powerProduction = 1.8f;
generateEffect = Fx.redgeneratespark;
size = 2;
}};
@ -843,6 +843,7 @@ public class Blocks implements ContentList{
powerProduction = 6f;
itemDuration = 30f;
consumes.liquid(Liquids.water, 0.05f);
hasLiquids = true;
size = 2;
}};

View File

@ -0,0 +1,10 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.game.ContentList;
public class Loadouts implements ContentList{
@Override
public void load(){
}
}

View File

@ -132,7 +132,7 @@ public class UnitTypes implements ContentList{
mass = 5f;
hitsize = 20f;
rotatespeed = 0.06f;
health = 20000;
health = 4000;
weapon = new Weapon("chaos"){{
length = 8f;
reload = 50f;
@ -155,7 +155,7 @@ public class UnitTypes implements ContentList{
mass = 5f;
hitsize = 20f;
rotatespeed = 0.06f;
health = 80000;
health = 10000;
weapon = new Weapon("eradication"){{
length = 13f;
reload = 30f;
@ -236,7 +236,7 @@ public class UnitTypes implements ContentList{
}};
revenant = new UnitType("revenant", Revenant.class, Revenant::new){{
health = 4000;
health = 3000;
mass = 5f;
hitsize = 20f;
speed = 0.1f;
@ -266,7 +266,7 @@ public class UnitTypes implements ContentList{
}};
lich = new UnitType("lich", Revenant.class, Revenant::new){{
health = 15000;
health = 9000;
mass = 20f;
hitsize = 40f;
speed = 0.01f;
@ -297,7 +297,7 @@ public class UnitTypes implements ContentList{
}};
reaper = new UnitType("reaper", Revenant.class, Revenant::new){{
health = 30000;
health = 20000;
mass = 30f;
hitsize = 56f;
speed = 0.01f;

View File

@ -49,6 +49,7 @@ public class ContentLoader{
new Mechs(),
new UnitTypes(),
new Blocks(),
new Loadouts(),
new TechTree(),
new Zones(),

View File

@ -43,7 +43,7 @@ public class GameState{
}
public boolean isPaused(){
return (is(State.paused) && !Net.active()) || gameOver;
return (is(State.paused) && !Net.active()) || (gameOver && !Net.active());
}
public boolean is(State astate){

View File

@ -81,7 +81,7 @@ public class Logic implements ApplicationListener{
public void runWave(){
world.spawner.spawnEnemies();
state.wave++;
state.wavetime = state.rules.waveSpacing;
state.wavetime = world.isZone() && world.getZone().isBossWave(state.wave) ? state.rules.waveSpacing * bossWaveMultiplier : state.rules.waveSpacing;
Events.fire(new WaveEvent());
}

View File

@ -364,8 +364,9 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
@Override
public void drawUnder(){
float size = mech.engineSize * (mech.flying ? 1f : boostHeat);
if(dead) return;
float size = mech.engineSize * (mech.flying ? 1f : boostHeat);
Draw.color(mech.engineColor);
Fill.circle(x + Angles.trnsx(rotation + 180, mech.engineOffset), y + Angles.trnsy(rotation + 180, mech.engineOffset),
size + Mathf.absin(Time.time(), 2f, size/4f));

View File

@ -1,17 +1,10 @@
package io.anuke.mindustry.game;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
public enum Loadout{
test(Blocks.coreShard){
@Override
public void setup(Tile tile){
}
};
public abstract class Loadout extends Content{
public final Block core;
Loadout(Block core){
@ -19,4 +12,9 @@ public enum Loadout{
}
public abstract void setup(Tile tile);
@Override
public ContentType getContentType(){
return ContentType.loadout;
}
}

View File

@ -11,5 +11,6 @@ public enum ContentType {
unit,
weather,
effect,
zone
zone,
loadout
}

View File

@ -89,7 +89,7 @@ public class MapsDialog extends FloatingDialog{
TextButton button = maps.addButton("", "clear", () -> showMapInfo(map)).width(mapsize).pad(8).get();
button.clearChildren();
button.margin(9);
button.add(map.meta.tags.get("name", map.name)).growX().center().get().setEllipsis(true);
button.add(map.meta.tags.get("name", map.name)).width(mapsize - 18f).center().get().setEllipsis(true);
button.row();
button.addImage("white").growX().pad(4).color(Color.GRAY);
button.row();

View File

@ -39,10 +39,15 @@ public class ZoneInfoDialog extends FloatingDialog{
Table iteminfo = new Table();
Runnable rebuildItems = () -> {
int i = 0;
iteminfo.clear();
ItemStack[] stacks = zone.unlocked() ? zone.getLaunchCost() : zone.itemRequirements;
for(ItemStack stack : stacks){
if(stack.amount == 0) continue;
if(i++ % 2 == 0){
iteminfo.row();
}
iteminfo.addImage(stack.item.icon(Item.Icon.medium)).size(8*3).padRight(1);
iteminfo.add(stack.amount + "").color(Color.LIGHT_GRAY).padRight(5);
}
@ -157,7 +162,7 @@ public class ZoneInfoDialog extends FloatingDialog{
dialog.cont.row();
}
dialog.show();
}).colspan(4).size(100f, bsize).left();
}).colspan(4).size(100f, bsize).left().disabled(b -> !content.items().contains(item -> data.getItem(item) > 0 && item.type == ItemType.material && !zone.getStartingItems().contains(stack -> stack.item == item)));
};
rebuildLoadout[0].run();
@ -188,7 +193,7 @@ public class ZoneInfoDialog extends FloatingDialog{
hide();
world.playZone(zone);
}
}).size(300f, 70f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.getLaunchCost())).get();
}).margin(13f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.getLaunchCost())).get();
button.row();
button.add(iteminfo);

View File

@ -134,16 +134,21 @@ public class HudFragment extends Fragment{
cont.row();
//fps display
infolabel = cont.table(t -> {
infolabel = new Table();
IntFormat fps = new IntFormat("fps");
IntFormat ping = new IntFormat("ping");
t.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padRight(10);
t.row();
infolabel.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padRight(10);
infolabel.row();
if(Net.hasClient()){
t.label(() -> ping.get(Net.getPing())).visible(Net::client).colspan(2);
infolabel.label(() -> ping.get(Net.getPing())).visible(Net::client).colspan(2);
}
}).size(-1).visible(() -> Core.settings.getBool("fps")).update(t -> t.setTranslation(0,
(!waves.isVisible() ? wavetable.getHeight() + healthTable.getHeight() : Math.min(wavetable.getTranslation().y + healthTable.getHeight(), wavetable.getHeight() + healthTable.getHeight())))).get();
infolabel.visible(() -> Core.settings.getBool("fps")).update(() ->
infolabel.setPosition(0,
healthTable.isVisible() ? healthTable.getY() + healthTable.getTranslation().y : wavetable.isVisible() ? wavetable.getY() : 0f,
Align.topLeft));
infolabel.pack();
cont.addChild(infolabel);
//make wave box appear below rest of menu
if(mobile){

View File

@ -68,6 +68,7 @@ public abstract class BlockStorage extends UnlockableContent{
/**Remove a stack from this inventory, and return the amount removed.*/
public int removeStack(Tile tile, Item item, int amount){
amount = Math.min(amount, tile.entity.items.get(item));
tile.entity.noSleep();
tile.entity.items.remove(item, amount);
return amount;

View File

@ -15,6 +15,6 @@ public class TurbineGenerator extends BurnerGenerator{
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
return super.acceptLiquid(tile, source, liquid, amount) || liquid == consumes.liquid() && tile.entity.liquids.get(consumes.liquid()) < liquidCapacity;
return (liquid == consumes.liquid() && tile.entity.liquids.get(consumes.liquid()) < liquidCapacity);
}
}

View File

@ -14,11 +14,8 @@ import io.anuke.arc.util.CommandHandler.ResponseType;
import io.anuke.arc.util.Timer.Task;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.EventType.GameOverEvent;
import io.anuke.mindustry.game.RulePreset;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.maps.Map;
@ -48,7 +45,7 @@ public class ServerControl implements ApplicationListener{
private FileHandle currentLogFile;
private boolean inExtraRound;
private Task lastTask;
private RulePreset lastPreset;
public ServerControl(String[] args){
Core.settings.defaults(
@ -214,7 +211,7 @@ public class ServerControl implements ApplicationListener{
try{
preset = RulePreset.valueOf(arg[1]);
}catch(IllegalArgumentException e){
err("No gamemode '{0}' found.");
err("No gamemode '{0}' found.", arg[1]);
return;
}
}
@ -643,7 +640,9 @@ public class ServerControl implements ApplicationListener{
players.add(p);
p.setDead(true);
}
Rules rules = state.rules;
logic.reset();
state.rules = rules;
Call.onWorldDataBegin();
run.run();
logic.play();

View File

@ -241,19 +241,8 @@ public class ApplicationTests{
@Test
void zoneEmptyWaves(){
for(Zone zone : content.zones()){
checkNoEmptyWaves(zone, zone.rules.get().spawns, 1, 100);
}
}
@Test
void zoneOverflowWaves(){
for(Zone zone : content.zones()){
checkExtraWaves(zone, zone.rules.get().spawns, 1, 40, 140);
}
}
void checkNoEmptyWaves(Zone zone, Array<SpawnGroup> spawns, int from, int to){
for(int i = from; i <= to; i++){
Array<SpawnGroup> spawns = zone.rules.get().spawns;
for(int i = 1; i <= 100; i++){
int total = 0;
for(SpawnGroup spawn : spawns){
total += spawn.getUnitsSpawned(i);
@ -262,19 +251,25 @@ public class ApplicationTests{
assertNotEquals(0, total, "Zone " + zone + " has no spawned enemies at wave " + i);
}
}
}
void checkExtraWaves(Zone zone, Array<SpawnGroup> spawns, int from, int to, int max){
for(int i = from; i <= to; i++){
@Test
void zoneOverflowWaves(){
for(Zone zone : content.zones()){
Array<SpawnGroup> spawns = zone.rules.get().spawns;
for(int i = 1; i <= 40; i++){
int total = 0;
for(SpawnGroup spawn : spawns){
total += spawn.getUnitsSpawned(i);
}
if(total >= max){
if(total >= 140){
fail("Zone '" + zone + "' has too many spawned enemies at wave " + i + " : " + total);
}
}
}
}
@Test
void buildingDestruction(){