Bugfixes / Font changed / Zone tweaks

This commit is contained in:
Anuken
2019-03-08 19:07:23 -05:00
parent 3776b99c39
commit 64533de597
47 changed files with 1401 additions and 1482 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

View File

@@ -278,14 +278,9 @@ zone.groundZero.name = Ground Zero
zone.craters.name = The Craters zone.craters.name = The Craters
zone.frozenForest.name = Frozen Forest zone.frozenForest.name = Frozen Forest
zone.ruinousShores.name = Ruinous Shores zone.ruinousShores.name = Ruinous Shores
zone.crags.name = Crags
zone.stainedMountains.name = Stained Mountains zone.stainedMountains.name = Stained Mountains
zone.impact0079.name = Impact 0079
zone.desolateRift.name = Desolate Rift zone.desolateRift.name = Desolate Rift
zone.arcticDesert.name = Arctic Desert
zone.dryWastes.name = Dry Wastes
zone.nuclearComplex.name = Nuclear Production Complex zone.nuclearComplex.name = Nuclear Production Complex
zone.moltenFault.name = Molten Fault
settings.language = Language settings.language = Language
settings.reset = Reset to Defaults settings.reset = Reset to Defaults
@@ -656,6 +651,7 @@ block.phantom-factory.name = Phantom Drone Factory
block.wraith-factory.name = Wraith Fighter Factory block.wraith-factory.name = Wraith Fighter Factory
block.ghoul-factory.name = Ghoul Bomber Factory block.ghoul-factory.name = Ghoul Bomber Factory
block.dagger-factory.name = Dagger Mech Factory block.dagger-factory.name = Dagger Mech Factory
block.crawler-factory.name = Crawler Mech Factory
block.titan-factory.name = Titan Mech Factory block.titan-factory.name = Titan Mech Factory
block.fortress-factory.name = Fortress Mech Factory block.fortress-factory.name = Fortress Mech Factory
block.revenant-factory.name = Revenant Fighter Factory block.revenant-factory.name = Revenant Fighter Factory
@@ -812,6 +808,7 @@ block.wraith-factory.description = Produces fast, hit-and-run interceptor units.
block.ghoul-factory.description = Produces heavy carpet bombers. block.ghoul-factory.description = Produces heavy carpet bombers.
block.dagger-factory.description = Produces basic ground units. block.dagger-factory.description = Produces basic ground units.
block.titan-factory.description = Produces advanced, armored ground units. block.titan-factory.description = Produces advanced, armored ground units.
block.fortress-factory.description = Produces heavy artillery ground units. block.fortress-factory.description = Produces heavy artillery ground units.
block.revenant-factory.description = Produces heavy laser air units. block.revenant-factory.description = Produces heavy laser air units.
block.repair-point.description = Continuously heals the closest damaged unit in its vicinity. block.repair-point.description = Continuously heals the closest damaged unit in its vicinity.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

BIN
core/assets/fonts/font.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,8 +5,6 @@ precision mediump int;
uniform sampler2D u_texture; uniform sampler2D u_texture;
const float round = 0.01;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_texCoord; varying vec2 v_texCoord;

View File

@@ -18,10 +18,6 @@ uniform vec2 u_offset;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_texCoord; varying vec2 v_texCoord;
float round(float f){
return float(int(f));
}
void main() { void main() {
vec2 T = v_texCoord.xy; vec2 T = v_texCoord.xy;
@@ -41,7 +37,7 @@ void main() {
}else{ }else{
if(color.a > 0.1){ if(color.a > 0.1){
if(mod(coords.x / u_dp + coords.y / u_dp + sin(round(coords.x / u_dp) / 5.0) * 3.0 + sin(round(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){ if(mod(coords.x / u_dp + coords.y / u_dp + sin(floor(coords.x / u_dp) / 5.0) * 3.0 + sin(floor(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
color *= 1.65; color *= 1.65;
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -17,7 +17,7 @@ public class Mindustry extends ApplicationCore{
public void setup(){ public void setup(){
Time.setDeltaProvider(() -> { Time.setDeltaProvider(() -> {
float result = Core.graphics.getDeltaTime() * 60f; float result = Core.graphics.getDeltaTime() * 60f;
return Float.isNaN(result) || Float.isInfinite(result) ? 1f : Math.min(result, 60f / 10f); return (Float.isNaN(result) || Float.isInfinite(result)) ? 1f : Math.min(result, 60f / 10f);
}); });
Time.mark(); Time.mark();

View File

@@ -2,21 +2,21 @@ package io.anuke.mindustry;
import io.anuke.arc.Application.ApplicationType; import io.anuke.arc.Application.ApplicationType;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.mindustry.entities.Entities;
import io.anuke.mindustry.entities.EntityGroup;
import io.anuke.mindustry.entities.impl.EffectEntity;
import io.anuke.mindustry.entities.traits.DrawTrait;
import io.anuke.arc.files.FileHandle; import io.anuke.arc.files.FileHandle;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.util.Structs; import io.anuke.arc.util.Structs;
import io.anuke.mindustry.core.*; import io.anuke.mindustry.core.*;
import io.anuke.mindustry.entities.type.Player; import io.anuke.mindustry.entities.Entities;
import io.anuke.mindustry.entities.type.TileEntity; import io.anuke.mindustry.entities.EntityGroup;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Fire; import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Puddle; import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.entities.impl.EffectEntity;
import io.anuke.mindustry.entities.traits.DrawTrait;
import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.entities.traits.SyncTrait;
import io.anuke.mindustry.entities.type.BaseUnit; import io.anuke.mindustry.entities.type.BaseUnit;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.game.GlobalData; import io.anuke.mindustry.game.GlobalData;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Version; import io.anuke.mindustry.game.Version;
@@ -24,11 +24,14 @@ import io.anuke.mindustry.gen.Serialization;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.world.blocks.defense.ForceProjector.ShieldEntity; import io.anuke.mindustry.world.blocks.defense.ForceProjector.ShieldEntity;
import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class Vars{ public class Vars{
/**global charset*/
public static final Charset charset = Charset.forName("UTF-8");
/**main application name, capitalized*/ /**main application name, capitalized*/
public static final String appName = "Mindustry"; public static final String appName = "Mindustry";
/**URL for discord invite.*/ /**URL for discord invite.*/

View File

@@ -280,7 +280,7 @@ public class BlockIndexer{
outer: outer:
for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){ for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){
for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){ for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){
Tile result = world.tile(x, y); Tile result = world.tile(x, y).target();
//when a targetable block is found, mark this quadrant as occupied and stop searching //when a targetable block is found, mark this quadrant as occupied and stop searching
if(result.entity != null && result.getTeam() == data.team){ if(result.entity != null && result.getTeam() == data.team){
structQuadrants[data.team.ordinal()].set(index); structQuadrants[data.team.ordinal()].set(index);

View File

@@ -146,6 +146,7 @@ public class Pathfinder{
while(path.frontier.size > 0 && (nsToRun < 0 || Time.timeSinceNanos(start) <= nsToRun)){ while(path.frontier.size > 0 && (nsToRun < 0 || Time.timeSinceNanos(start) <= nsToRun)){
Tile tile = world.tile(path.frontier.removeLast()); Tile tile = world.tile(path.frontier.removeLast());
if(tile == null || path.weights == null) return; //something went horribly wrong, bail
float cost = path.weights[tile.x][tile.y]; float cost = path.weights[tile.x][tile.y];
//pathfinding overflowed for some reason, time to bail. the next block update will handle this, hopefully //pathfinding overflowed for some reason, time to bail. the next block update will handle this, hopefully

View File

@@ -71,7 +71,7 @@ public class Blocks implements ContentList{
duo, hail, arc, wave, lancer, swarmer, salvo, fuse, ripple, cyclone, spectre, meltdown, duo, hail, arc, wave, lancer, swarmer, salvo, fuse, ripple, cyclone, spectre, meltdown,
//units //units
spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, titanFactory, spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, crawlerFactory, titanFactory,
fortressFactory, repairPoint, fortressFactory, repairPoint,
//upgrades //upgrades
@@ -732,7 +732,7 @@ public class Blocks implements ContentList{
rotaryPump = new Pump("rotary-pump"){{ rotaryPump = new Pump("rotary-pump"){{
requirements(Category.liquid, ItemStack.with(Items.copper, 140, Items.lead, 100, Items.silicon, 40, Items.titanium, 70)); requirements(Category.liquid, ItemStack.with(Items.copper, 140, Items.lead, 100, Items.silicon, 40, Items.titanium, 70));
pumpAmount = 0.8f; pumpAmount = 0.8f;
consumes.power(1.50f); consumes.power(0.15f);
liquidCapacity = 30f; liquidCapacity = 30f;
hasPower = true; hasPower = true;
size = 2; size = 2;
@@ -1322,6 +1322,15 @@ public class Blocks implements ContentList{
consumes.items(new ItemStack(Items.silicon, 10)); consumes.items(new ItemStack(Items.silicon, 10));
}}; }};
crawlerFactory = new UnitFactory("crawler-factory"){{
requirements(Category.units, ItemStack.with(Items.lead, 100, Items.silicon, 80));
type = UnitTypes.crawler;
produceTime = 1200;
size = 2;
consumes.power(0.4f);
consumes.items(new ItemStack(Items.blastCompound, 10));
}};
titanFactory = new UnitFactory("titan-factory"){{ titanFactory = new UnitFactory("titan-factory"){{
requirements(Category.units, ItemStack.with(Items.thorium, 90, Items.lead, 140, Items.silicon, 90)); requirements(Category.units, ItemStack.with(Items.thorium, 90, Items.lead, 140, Items.silicon, 90));
type = UnitTypes.titan; type = UnitTypes.titan;

View File

@@ -684,29 +684,17 @@ public class Bullets implements ContentList{
hitEffect = Fx.pulverize; hitEffect = Fx.pulverize;
lifetime = 23f; lifetime = 23f;
speed = 1f; speed = 1f;
splashDamageRadius = 60f; splashDamageRadius = 50f;
splashDamage = 30f; splashDamage = 30f;
} }
@Override @Override
public void init(Bullet b){ public void init(Bullet b){
if(b.getOwner() instanceof Unit){ if(b.getOwner() instanceof Unit){
Unit unit = (Unit)b.getOwner(); ((Unit)b.getOwner()).kill();
unit.damage(unit.maxHealth() + 1);
} }
b.time(b.lifetime()); b.time(b.lifetime());
} }
@Override
public void hit(Bullet b, float x, float y){
super.hit(b, x, y);
for(int i = 0; i < 3; i++){
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddle.deposit(tile, Liquids.oil, 5f);
}
}
}; };
} }
} }

View File

@@ -12,8 +12,8 @@ import io.anuke.mindustry.type.Zone;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
public class Zones implements ContentList{ public class Zones implements ContentList{
public static Zone groundZero, craters, frozenForest, ruinousShores, crags, stainedMountains, public static Zone groundZero, craters, frozenForest, ruinousShores, stainedMountains,
impact, desolateRift, arcticDesert, dryWastes, nuclearComplex, moltenFault; desolateRift, nuclearComplex;
@Override @Override
public void load(){ public void load(){
@@ -78,7 +78,7 @@ public class Zones implements ContentList{
waveSpacing = 60 * 60 * 1f; waveSpacing = 60 * 60 * 1f;
spawns = Array.with( spawns = Array.with(
new SpawnGroup(UnitTypes.crawler){{ new SpawnGroup(UnitTypes.crawler){{
unitScaling = 1.5f; unitScaling = 2f;
}}, }},
new SpawnGroup(UnitTypes.crawler){{ new SpawnGroup(UnitTypes.crawler){{
@@ -90,7 +90,7 @@ public class Zones implements ContentList{
new SpawnGroup(UnitTypes.dagger){{ new SpawnGroup(UnitTypes.dagger){{
begin = 3; begin = 3;
unitScaling = 1.5f; unitScaling = 2f;
}}, }},
new SpawnGroup(UnitTypes.crawler){{ new SpawnGroup(UnitTypes.crawler){{
@@ -353,91 +353,6 @@ public class Zones implements ContentList{
}}; }};
}}; }};
impact = new Zone("impact0079", new MapGenerator("impact0079", 2)
.dist(2.2f, true)
.decor(
new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01),
new Decoration(Blocks.metalFloor, Blocks.metalFloorDamaged, 0.02)
).drops(ItemStack.with(Items.copper, 2000, Items.lead, 1500, Items.silicon, 1000, Items.graphite, 2000, Items.pyratite, 2000, Items.titanium, 2000, Items.metaglass, 1000, Items.coal, 2000))){{
loadout = Loadouts.basicFoundation;
baseLaunchCost = ItemStack.with(Items.copper, 500, Items.lead, 500, Items.silicon, 100);
startingItems = ItemStack.list(Items.copper, 2000, Items.lead, 500, Items.silicon, 200, Items.titanium, 400, Items.graphite, 200);
itemRequirements = ItemStack.with(Items.silicon, 8000, Items.titanium, 6000, Items.graphite, 4000);
conditionWave = 20;
zoneRequirements = new Zone[]{stainedMountains};
blockRequirements = new Block[]{Blocks.launchPad, Blocks.unloader, Blocks.melter, Blocks.separator};
resources = new Item[]{Items.scrap};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 60;
spawns = Array.with(
new SpawnGroup(UnitTypes.titan){{
unitScaling = 2;
spacing = 2;
end = 10;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 1;
unitScaling = 1;
spacing = 2;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 2;
unitScaling = 1;
spacing = 2;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 10;
spacing = 2;
unitScaling = 2;
unitAmount = 2;
}},
new SpawnGroup(UnitTypes.ghoul){{
begin = 5;
unitScaling = 0.5f;
unitAmount = 1;
spacing = 5;
}},
new SpawnGroup(UnitTypes.wraith){{
begin = 10;
unitScaling = 1f;
unitAmount = 1;
spacing = 5;
}},
new SpawnGroup(UnitTypes.dagger){{
begin = 2;
unitScaling = 1;
spacing = 2;
}},
new SpawnGroup(UnitTypes.wraith){{
begin = 23;
unitScaling = 1f;
unitAmount = 1;
spacing = 2;
}},
new SpawnGroup(UnitTypes.crawler){{
begin = 20;
unitScaling = 1;
spacing = 10;
unitScaling = 0.5f;
unitAmount = 10;
}},
bossGroup(UnitTypes.lich)
);
}};
}};
desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift").dist(2f)){{ desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift").dist(2f)){{
loadout = Loadouts.basicNucleus; loadout = Loadouts.basicNucleus;
baseLaunchCost = ItemStack.with(Items.copper, 500); baseLaunchCost = ItemStack.with(Items.copper, 500);
@@ -511,34 +426,6 @@ public class Zones implements ContentList{
}}; }};
}}; }};
/*
arcticDesert = new Zone("arcticDesert", new MapGenerator("groundZero", 1)){{ //TODO implement
baseLaunchCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
dryWastes = new Zone("dryWastes", new MapGenerator("groundZero", 1)){{ //TODO implement
baseLaunchCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};
*/
nuclearComplex = new Zone("nuclearComplex", new MapGenerator("nuclearProductionComplex", 1) nuclearComplex = new Zone("nuclearComplex", new MapGenerator("nuclearProductionComplex", 1)
.drops(ItemStack.with(Items.copper, 2000, Items.lead, 1500, Items.silicon, 1000, Items.graphite, 1000, Items.thorium, 200, Items.titanium, 2000, Items.metaglass, 1000)) .drops(ItemStack.with(Items.copper, 2000, Items.lead, 1500, Items.silicon, 1000, Items.graphite, 1000, Items.thorium, 200, Items.titanium, 2000, Items.metaglass, 1000))
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{ .decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{
@@ -548,7 +435,7 @@ public class Zones implements ContentList{
itemRequirements = ItemStack.with(Items.copper, 10000, Items.titanium, 8000, Items.metaglass, 6000, Items.plastanium, 2000); itemRequirements = ItemStack.with(Items.copper, 10000, Items.titanium, 8000, Items.metaglass, 6000, Items.plastanium, 2000);
conditionWave = 30; conditionWave = 30;
launchPeriod = 15; launchPeriod = 15;
zoneRequirements = new Zone[]{impact}; zoneRequirements = new Zone[]{desolateRift};
blockRequirements = new Block[]{Blocks.blastDrill, Blocks.thermalGenerator}; blockRequirements = new Block[]{Blocks.blastDrill, Blocks.thermalGenerator};
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium, Items.sand}; resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium, Items.sand};
rules = () -> new Rules(){{ rules = () -> new Rules(){{
@@ -628,19 +515,5 @@ public class Zones implements ContentList{
); );
}}; }};
}}; }};
/*
moltenFault = new Zone("moltenFault", new MapGenerator("groundZero", 1)){{ //TODO implement
baseLaunchCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
conditionWave = 15;
zoneRequirements = new Zone[]{frozenForest};
blockRequirements = new Block[]{Blocks.copperWall};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 80;
}};
}};*/
} }
} }

View File

@@ -87,10 +87,10 @@ public class Logic implements ApplicationListener{
} }
private void checkGameOver(){ private void checkGameOver(){
if(!state.rules.pvp && state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){ if(state.rules.waves && state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){
state.gameOver = true; state.gameOver = true;
Events.fire(new GameOverEvent(waveTeam)); Events.fire(new GameOverEvent(waveTeam));
}else if(state.rules.pvp){ }else if(!state.rules.waves){
Team alive = null; Team alive = null;
for(Team team : Team.all){ for(Team team : Team.all){

View File

@@ -230,7 +230,7 @@ public class Renderer implements ApplicationListener{
private void drawFlyerShadows(){ private void drawFlyerShadows(){
float trnsX = -12, trnsY = -13; float trnsX = -12, trnsY = -13;
Draw.color(0, 0, 0, 0.15f); Draw.color(0, 0, 0, 0.22f);
for(EntityGroup<? extends BaseUnit> group : unitGroups){ for(EntityGroup<? extends BaseUnit> group : unitGroups){
if(!group.isEmpty()){ if(!group.isEmpty()){
@@ -287,7 +287,7 @@ public class Renderer implements ApplicationListener{
public void clampScale(){ public void clampScale(){
float s = io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f); float s = io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f);
targetscale = Mathf.clamp(targetscale, s * 2.5f, Math.round(s * 5)); targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 5));
} }
} }

View File

@@ -114,22 +114,23 @@ public class UI implements ApplicationListener{
} }
void loadCursors(){ void loadCursors(){
int cursorScaling = 3; int cursorScaling = 1, outlineThickness = 3;
Color outlineColor = Color.valueOf("444444"); Color outlineColor = Color.valueOf("444444");
drillCursor = Core.graphics.newCursor("drill", cursorScaling, outlineColor); drillCursor = Core.graphics.newCursor("drill", cursorScaling, outlineColor, outlineThickness);
unloadCursor = Core.graphics.newCursor("unload", cursorScaling, outlineColor); unloadCursor = Core.graphics.newCursor("unload", cursorScaling, outlineColor, outlineThickness);
SystemCursor.arrow.set(Core.graphics.newCursor("cursor", cursorScaling, outlineColor)); SystemCursor.arrow.set(Core.graphics.newCursor("cursor", cursorScaling, outlineColor, outlineThickness));
SystemCursor.hand.set(Core.graphics.newCursor("hand", cursorScaling, outlineColor)); SystemCursor.hand.set(Core.graphics.newCursor("hand", cursorScaling, outlineColor, outlineThickness));
SystemCursor.ibeam.set(Core.graphics.newCursor("ibeam", cursorScaling, outlineColor)); SystemCursor.ibeam.set(Core.graphics.newCursor("ibeam", cursorScaling, outlineColor, outlineThickness));
Core.graphics.restoreCursor(); Core.graphics.restoreCursor();
} }
void generateFonts(Skin skin){ void generateFonts(Skin skin){
generator = new FreeTypeFontGenerator(Core.files.internal("fonts/pixel.ttf")); generator = new FreeTypeFontGenerator(Core.files.internal("fonts/font.ttf"));
FreeTypeFontParameter param = new FreeTypeFontParameter(); FreeTypeFontParameter param = new FreeTypeFontParameter();
param.size = (int)(14*2 * Math.max(Unit.dp.scl(1f), 0.5f)); param.size = (int)(8*2 * Math.max(Unit.dp.scl(1f), 0.5f));
//param.size = (int)(14*2 * Math.max(Unit.dp.scl(1f), 0.5f));
param.shadowColor = Color.DARK_GRAY; param.shadowColor = Color.DARK_GRAY;
param.shadowOffsetY = 2; param.shadowOffsetY = 2;
param.incremental = true; param.incremental = true;

View File

@@ -797,6 +797,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(isLocal){ if(isLocal){
stream.writeByte(mech.id); stream.writeByte(mech.id);
stream.writeByte(playerIndex); stream.writeByte(playerIndex);
stream.writeInt(lastSpawner == null ? noSpawner : lastSpawner.getTile().pos());
super.writeSave(stream, false); super.writeSave(stream, false);
} }
} }
@@ -808,12 +809,17 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(local && !headless){ if(local && !headless){
byte mechid = stream.readByte(); byte mechid = stream.readByte();
int index = stream.readByte(); int index = stream.readByte();
int spawner = stream.readInt();
if(world.tile(spawner) != null && world.tile(spawner).entity != null && world.tile(spawner).entity instanceof SpawnerTrait){
lastSpawner = (SpawnerTrait)(world.tile(spawner).entity);
}
players[index].readSaveSuper(stream); players[index].readSaveSuper(stream);
players[index].mech = content.getByID(ContentType.mech, mechid); players[index].mech = content.getByID(ContentType.mech, mechid);
players[index].dead = false; players[index].dead = false;
}else if(local){ }else if(local){
byte mechid = stream.readByte(); byte mechid = stream.readByte();
stream.readByte(); stream.readByte();
stream.readInt();
readSaveSuper(stream); readSaveSuper(stream);
mech = content.getByID(ContentType.mech, mechid); mech = content.getByID(ContentType.mech, mechid);
dead = false; dead = false;
@@ -833,7 +839,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2)); buffer.writeByte(Pack.byteValue(isAdmin) | (Pack.byteValue(dead) << 1) | (Pack.byteValue(isBoosting) << 2));
buffer.writeInt(Color.rgba8888(color)); buffer.writeInt(Color.rgba8888(color));
buffer.writeByte(mech.id); buffer.writeByte(mech.id);
buffer.writeInt(mining == null ? -1 : mining.pos()); buffer.writeInt(mining == null ? noSpawner : mining.pos());
buffer.writeInt(spawner == null ? noSpawner : spawner.getTile().pos()); buffer.writeInt(spawner == null ? noSpawner : spawner.getTile().pos());
buffer.writeShort((short) (baseRotation * 2)); buffer.writeShort((short) (baseRotation * 2));

View File

@@ -165,6 +165,7 @@ public class BlockRenderer{
for(int y = miny; y <= maxy; y++){ for(int y = miny; y <= maxy; y++){
boolean expanded = (Math.abs(x - avgx) > rangex || Math.abs(y - avgy) > rangey); boolean expanded = (Math.abs(x - avgx) > rangex || Math.abs(y - avgy) > rangey);
Tile tile = world.rawTile(x, y); Tile tile = world.rawTile(x, y);
if(tile == null) continue; //how is this possible?
Block block = tile.block(); Block block = tile.block();
if(block != Blocks.air && block.cacheLayer == CacheLayer.normal){ if(block != Blocks.air && block.cacheLayer == CacheLayer.normal){

View File

@@ -2,21 +2,24 @@ package io.anuke.mindustry.io;
import io.anuke.annotations.Annotations.ReadClass; import io.anuke.annotations.Annotations.ReadClass;
import io.anuke.annotations.Annotations.WriteClass; import io.anuke.annotations.Annotations.WriteClass;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.entities.Effects; import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.Effects.Effect; import io.anuke.mindustry.entities.Effects.Effect;
import io.anuke.mindustry.entities.Entities; import io.anuke.mindustry.entities.Entities;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.Unit;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
import io.anuke.mindustry.entities.traits.ShooterTrait; import io.anuke.mindustry.entities.traits.ShooterTrait;
import io.anuke.mindustry.entities.type.BaseUnit; import io.anuke.mindustry.entities.type.BaseUnit;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.Unit;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.net.Packets.AdminAction; import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.mindustry.net.Packets.KickReason; import io.anuke.mindustry.net.Packets.KickReason;
import io.anuke.mindustry.type.*; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Pos; import io.anuke.mindustry.world.Pos;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
@@ -25,7 +28,6 @@ import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
@@ -253,7 +255,7 @@ public class TypeIO{
@WriteClass(String.class) @WriteClass(String.class)
public static void writeString(ByteBuffer buffer, String string){ public static void writeString(ByteBuffer buffer, String string){
if(string != null){ if(string != null){
byte[] bytes = string.getBytes(StandardCharsets.UTF_8); byte[] bytes = string.getBytes(charset);
buffer.putShort((short) bytes.length); buffer.putShort((short) bytes.length);
buffer.put(bytes); buffer.put(bytes);
}else{ }else{
@@ -267,7 +269,7 @@ public class TypeIO{
if(slength != -1){ if(slength != -1){
byte[] bytes = new byte[slength]; byte[] bytes = new byte[slength];
buffer.get(bytes); buffer.get(bytes);
return new String(bytes, StandardCharsets.UTF_8); return new String(bytes, charset);
}else{ }else{
return null; return null;
} }
@@ -289,7 +291,7 @@ public class TypeIO{
public static void writeStringData(DataOutput buffer, String string) throws IOException{ public static void writeStringData(DataOutput buffer, String string) throws IOException{
if(string != null){ if(string != null){
byte[] bytes = string.getBytes(StandardCharsets.UTF_8); byte[] bytes = string.getBytes(charset);
buffer.writeShort((short) bytes.length); buffer.writeShort((short) bytes.length);
buffer.write(bytes); buffer.write(bytes);
}else{ }else{
@@ -302,7 +304,7 @@ public class TypeIO{
if(slength != -1){ if(slength != -1){
byte[] bytes = new byte[slength]; byte[] bytes = new byte[slength];
buffer.readFully(bytes); buffer.readFully(bytes);
return new String(bytes, StandardCharsets.UTF_8); return new String(bytes, charset);
}else{ }else{
return null; return null;
} }

View File

@@ -3,8 +3,8 @@ package io.anuke.mindustry.net;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.collection.ObjectMap; import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.collection.ObjectMap.Entry; import io.anuke.arc.collection.ObjectMap.Entry;
import io.anuke.mindustry.entities.Entities;
import io.anuke.arc.util.Time; import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Entities;
import io.anuke.mindustry.entities.type.Player; import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Teams; import io.anuke.mindustry.game.Teams;
@@ -17,7 +17,6 @@ import io.anuke.mindustry.world.Tile;
import java.io.*; import java.io.*;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
@@ -149,17 +148,17 @@ public class NetworkIO{
ByteBuffer buffer = ByteBuffer.allocate(128); ByteBuffer buffer = ByteBuffer.allocate(128);
buffer.put((byte) host.getBytes(StandardCharsets.UTF_8).length); buffer.put((byte) host.getBytes(charset).length);
buffer.put(host.getBytes(StandardCharsets.UTF_8)); buffer.put(host.getBytes(charset));
buffer.put((byte) map.getBytes(StandardCharsets.UTF_8).length); buffer.put((byte) map.getBytes(charset).length);
buffer.put(map.getBytes(StandardCharsets.UTF_8)); buffer.put(map.getBytes(charset));
buffer.putInt(playerGroup.size()); buffer.putInt(playerGroup.size());
buffer.putInt(state.wave); buffer.putInt(state.wave);
buffer.putInt(Version.build); buffer.putInt(Version.build);
buffer.put((byte)Version.type.getBytes(StandardCharsets.UTF_8).length); buffer.put((byte)Version.type.getBytes(charset).length);
buffer.put(Version.type.getBytes(StandardCharsets.UTF_8)); buffer.put(Version.type.getBytes(charset));
return buffer; return buffer;
} }
@@ -172,8 +171,8 @@ public class NetworkIO{
byte[] mb = new byte[mlength]; byte[] mb = new byte[mlength];
buffer.get(mb); buffer.get(mb);
String host = new String(hb, StandardCharsets.UTF_8); String host = new String(hb, charset);
String map = new String(mb, StandardCharsets.UTF_8); String map = new String(mb, charset);
int players = buffer.getInt(); int players = buffer.getInt();
int wave = buffer.getInt(); int wave = buffer.getInt();
@@ -181,7 +180,7 @@ public class NetworkIO{
byte tlength = buffer.get(); byte tlength = buffer.get();
byte[] tb = new byte[tlength]; byte[] tb = new byte[tlength];
buffer.get(tb); buffer.get(tb);
String vertype = new String(tb, StandardCharsets.UTF_8); String vertype = new String(tb, charset);
return new Host(host, hostAddress, map, wave, players, version, vertype); return new Host(host, hostAddress, map, wave, players, version, vertype);
} }

View File

@@ -78,6 +78,7 @@ public class Bar extends Element{
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
lay.setText(font, name); lay.setText(font, name);
font.setColor(Color.WHITE);
font.draw(name, x + width/2f - lay.width/2f, y + height/2f + lay.height/2f + 1); font.draw(name, x + width/2f - lay.width/2f, y + height/2f + lay.height/2f + 1);
Pools.free(lay); Pools.free(lay);

View File

@@ -29,6 +29,7 @@ public class BlockConfigFragment extends Fragment{
@Override @Override
public void build(Group parent){ public void build(Group parent){
table.visible(false);
parent.addChild(table); parent.addChild(table);
} }

View File

@@ -54,8 +54,6 @@ public class HudFragment extends Fragment{
cont.top().left().visible(() -> !state.is(State.menu)); cont.top().left().visible(() -> !state.is(State.menu));
if(mobile){ if(mobile){
cont.table(t -> {});
cont.row();
cont.table(select -> { cont.table(select -> {
select.left(); select.left();
select.defaults().size(dsize).left(); select.defaults().size(dsize).left();

View File

@@ -43,7 +43,7 @@ public class MenuFragment extends Fragment{
} }
//version info //version info
parent.fill(c -> c.bottom().left().add(Strings.formatArgs("Mindustry v{0} {1}-{2} {3}{4}", Version.number, Version.modifier, Version.type, parent.fill(c -> c.bottom().left().add(Strings.format("Mindustry v{0} {1}-{2} {3}{4}", Version.number, Version.modifier, Version.type,
(Version.build == -1 ? "custom build" : "build " + Version.build), Version.revision == 0 ? "" : "." + Version.revision)) (Version.build == -1 ? "custom build" : "build " + Version.build), Version.revision == 0 ? "" : "." + Version.revision))
.visible(() -> state.is(State.menu))); .visible(() -> state.is(State.menu)));
} }

View File

@@ -13,8 +13,6 @@ import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings;
import io.anuke.arc.util.Time; import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Damage; import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
@@ -157,6 +155,8 @@ public class Block extends BlockStorage{
public Array<Tile> getPowerConnections(Tile tile, Array<Tile> out){ public Array<Tile> getPowerConnections(Tile tile, Array<Tile> out){
out.clear(); out.clear();
if(tile == null || tile.entity == null || tile.entity.power == null) return out;
for(Tile other : tile.entity.proximity()){ for(Tile other : tile.entity.proximity()){
if(other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower) if(other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower)
&& !tile.entity.power.links.contains(other.pos())){ && !tile.entity.power.links.contains(other.pos())){
@@ -284,10 +284,6 @@ public class Block extends BlockStorage{
setBars(); setBars();
consumes.checkRequired(this); consumes.checkRequired(this);
if(buildRequirements.length > 0 && !Core.bundle.has("block." + name + ".name")){
Log.warn("No name for block '{0}' found. Add the following to bundle.properties:\nblock.{0}.name = {1}", name, Strings.capitalize(name));
}
} }
@Override @Override

View File

@@ -182,7 +182,7 @@ public class Conveyor extends Block{
entity.minitem = 1f; entity.minitem = 1f;
Tile next = tile.getNearby(tile.getRotation()); Tile next = tile.getNearby(tile.getRotation());
float nextMax = next.block() instanceof Conveyor ? 1f - Math.max(itemSpace - next.<ConveyorEntity>entity().minitem, 0) : 1f; float nextMax = next != null && next.block() instanceof Conveyor ? 1f - Math.max(itemSpace - next.<ConveyorEntity>entity().minitem, 0) : 1f;
int minremove = Integer.MAX_VALUE; int minremove = Integer.MAX_VALUE;
for(int i = entity.convey.size - 1; i >= 0; i--){ for(int i = entity.convey.size - 1; i >= 0; i--){

View File

@@ -91,7 +91,7 @@ public class ItemBridge extends Block{
} }
public Tile findLink(int x, int y){ public Tile findLink(int x, int y){
if(linkValid(world.tile(x, y), world.tile(lastPlaced)) && lastPlaced != Pos.get(x, y)){ if(world.tile(x, y) != null && linkValid(world.tile(x, y), world.tile(lastPlaced)) && lastPlaced != Pos.get(x, y)){
return world.tile(lastPlaced); return world.tile(lastPlaced);
} }
@@ -312,7 +312,7 @@ public class ItemBridge extends Block{
} }
public boolean linkValid(Tile tile, Tile other, boolean checkDouble){ public boolean linkValid(Tile tile, Tile other, boolean checkDouble){
if(other == null) return false; if(other == null || tile == null) return false;
if(tile.x == other.x){ if(tile.x == other.x){
if(Math.abs(tile.y - other.y) > range) return false; if(Math.abs(tile.y - other.y) > range) return false;
}else if(tile.y == other.y){ }else if(tile.y == other.y){

View File

@@ -52,7 +52,7 @@ public class ImpactReactor extends PowerGenerator{
bars.add("poweroutput", entity -> new Bar(() -> bars.add("poweroutput", entity -> new Bar(() ->
Core.bundle.format("blocks.poweroutput", Core.bundle.format("blocks.poweroutput",
Strings.toFixed(Math.max(entity.tile.block().getPowerProduction(entity.tile) - consumes.get(ConsumePower.class).powerPerTick, 0)*60, 1)), Strings.toFixed(Math.max(entity.tile.block().getPowerProduction(entity.tile) - consumes.get(ConsumePower.class).powerPerTick, 0)*60 * entity.delta(), 1)),
() -> Pal.powerBar, () -> Pal.powerBar,
() -> ((GeneratorEntity)entity).productionEfficiency)); () -> ((GeneratorEntity)entity).productionEfficiency));
} }

View File

@@ -167,9 +167,6 @@ public class Drill extends Block{
public void update(Tile tile){ public void update(Tile tile){
DrillEntity entity = tile.entity(); DrillEntity entity = tile.entity();
if(Float.isNaN(entity.drillTime)) entity.drillTime = 0f;
if(Float.isNaN(entity.warmup)) entity.warmup = 0f;
if(entity.dominantItem == null){ if(entity.dominantItem == null){
oreCount.clear(); oreCount.clear();
itemArray.clear(); itemArray.clear();

View File

@@ -21,6 +21,7 @@ import java.io.DataOutput;
import java.io.IOException; import java.io.IOException;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.control;
public class LiquidSource extends Block{ public class LiquidSource extends Block{
@@ -71,8 +72,10 @@ public class LiquidSource extends Block{
for(int i = 0; i < items.size; i++){ for(int i = 0; i < items.size; i++){
final int f = i; final int f = i;
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> {
() -> Call.setLiquidSourceLiquid(null, tile, items.get(f))).size(38).group(group).get(); Call.setLiquidSourceLiquid(null, tile, items.get(f));
control.input(0).frag.config.hideConfig();
}).size(38).group(group).get();
button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion); button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion);
button.setChecked(entity.source.id == f); button.setChecked(entity.source.id == f);

View File

@@ -8,7 +8,7 @@ public class StringValue implements StatValue{
private final String value; private final String value;
public StringValue(String value, Object... args){ public StringValue(String value, Object... args){
this.value = Strings.formatArgs(value, args); this.value = Strings.format(value, args);
} }
@Override @Override

View File

@@ -306,7 +306,7 @@ public class ServerControl implements ApplicationListener{
} }
}); });
handler.register("fillitems", "[team]", "Fill the core with 2000 items.", arg -> { handler.register("fillitems", "[team]", "Fill the core with items.", arg -> {
if(!state.is(State.playing)){ if(!state.is(State.playing)){
err("Not playing. Host first."); err("Not playing. Host first.");
return; return;
@@ -322,7 +322,7 @@ public class ServerControl implements ApplicationListener{
for(Item item : content.items()){ for(Item item : content.items()){
if(item.type == ItemType.material){ if(item.type == ItemType.material){
state.teams.get(team).cores.first().entity.items.add(item, 2000); state.teams.get(team).cores.first().entity.items.set(item, state.teams.get(team).cores.first().block().itemCapacity);
} }
} }

View File

@@ -131,7 +131,7 @@ public class ImagePacker{
} }
static void err(String message, Object... args){ static void err(String message, Object... args){
throw new IllegalArgumentException(Strings.formatArgs(message, args)); throw new IllegalArgumentException(Strings.format(message, args));
} }
static class GenRegion extends AtlasRegion{ static class GenRegion extends AtlasRegion{