Spritesheet cleanup / Heat blocks / Editor bugfix

This commit is contained in:
Anuken
2019-02-01 21:47:44 -05:00
parent 7a072746d9
commit 59a68ee981
23 changed files with 1609 additions and 1519 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 507 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -37,7 +37,7 @@ public class Blocks implements ContentList{
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow, air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster, holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow, stainedBoulder, iceSnow, sandWater, duneRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow, stainedBoulder,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, ignarock, magmarock, hotrock,
//crafting //crafting
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
@@ -51,7 +51,7 @@ public class Blocks implements ContentList{
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine, phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine,
//transport //transpor
conveyor, titaniumConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver, conveyor, titaniumConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver,
//liquids //liquids
@@ -271,14 +271,24 @@ public class Blocks implements ContentList{
blendGroup = metalFloor; blendGroup = metalFloor;
}}; }};
metalFloor4 = new Floor("metal-floor-4"){{ metalFloor5 = new Floor("metal-floor-5"){{
variants = 0; variants = 0;
blendGroup = metalFloor; blendGroup = metalFloor;
}}; }};
metalFloor5 = new Floor("metal-floor-5"){{ ignarock = new Floor("ignarock"){{
variants = 0;
blendGroup = metalFloor; }};
hotrock = new Floor("hotrock"){{
heat = 0.5f;
blendGroup = ignarock;
}};
magmarock = new Floor("magmarock"){{
heat = 0.75f;
updateEffect = Fx.magmasmoke;
blendGroup = ignarock;
}}; }};
//endregion //endregion

View File

@@ -33,7 +33,7 @@ public class Fx implements ContentList{
bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke,
shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium,
shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot,
launchFull, unitSpawn, spawnShockwave; launchFull, unitSpawn, spawnShockwave, magmasmoke;
@Override @Override
public void load(){ public void load(){
@@ -93,6 +93,12 @@ public class Fx implements ContentList{
Draw.reset(); Draw.reset();
}); });
magmasmoke = new Effect(110, e -> {
Draw.color(Color.GRAY);
Fill.circle(e.x, e.y, e.fslope() * 6f);
Draw.reset();
});
spawn = new Effect(30, e -> { spawn = new Effect(30, e -> {
Lines.stroke(2f * e.fout()); Lines.stroke(2f * e.fout());
Draw.color(Palette.accent); Draw.color(Palette.accent);

View File

@@ -11,7 +11,6 @@ import io.anuke.arc.graphics.g2d.TextureAtlas;
import io.anuke.arc.input.KeyCode; import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.ui.TextField; import io.anuke.arc.scene.ui.TextField;
import io.anuke.arc.util.Interval; import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings; import io.anuke.arc.util.Strings;
import io.anuke.arc.util.Time; import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Mechs; import io.anuke.mindustry.content.Mechs;
@@ -29,7 +28,6 @@ import io.anuke.mindustry.input.MobileInput;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block;
import java.io.IOException; import java.io.IOException;
@@ -307,7 +305,7 @@ public class Control implements ApplicationListener{
} }
//auto-update rpc every 5 seconds //auto-update rpc every 5 seconds
if(timer.get(60 * 5)){ if(timer.get(0, 60 * 5)){
Platform.instance.updateRPC(); Platform.instance.updateRPC();
} }

View File

@@ -54,7 +54,7 @@ public class Maps implements Disposable{
/**Returns map by internal name.*/ /**Returns map by internal name.*/
public Map getByName(String name){ public Map getByName(String name){
return maps.get(name.toLowerCase()); return maps.get(name);
} }
/**Loads a map from the map folder and returns it. Should only be used for zone maps. /**Loads a map from the map folder and returns it. Should only be used for zone maps.
@@ -136,7 +136,7 @@ public class Maps implements Disposable{
map.texture = new Texture(MapIO.generatePixmap(MapIO.readTileData(ds, meta, true))); map.texture = new Texture(MapIO.generatePixmap(MapIO.readTileData(ds, meta, true)));
} }
maps.put(map.name.toLowerCase(), map); maps.put(map.name, map);
allMaps.add(map); allMaps.add(map);
} }
} }

View File

@@ -369,6 +369,11 @@ public class Block extends BlockStorage{
public void update(Tile tile){ public void update(Tile tile){
} }
/**Called when this tile is randomly updated. This only happens on a client, and should be used for effects only.
* TODO currently unimplemented*/
public void randomUpdate(Tile tile){
}
public boolean isAccessible(){ public boolean isAccessible(){
return (hasItems && itemCapacity > 0); return (hasItems && itemCapacity > 0);
} }

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.world.blocks; package io.anuke.mindustry.world.blocks;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.Effects.Effect; import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
@@ -8,6 +9,7 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry; import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2; import io.anuke.arc.math.geom.Point2;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.content.StatusEffects; import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
@@ -57,6 +59,8 @@ public class Floor extends Block{
public String edgeStyle = "smooth"; public String edgeStyle = "smooth";
/**Group of blocks that this block does not draw edges on.*/ /**Group of blocks that this block does not draw edges on.*/
public Block blendGroup = this; public Block blendGroup = this;
/**Effect displayed when randomly updated.*/
public Effect updateEffect = Fx.none;
protected TextureRegion[][] edges; protected TextureRegion[][] edges;
protected byte eq = 0; protected byte eq = 0;
@@ -94,6 +98,13 @@ public class Floor extends Block{
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")}; return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
} }
@Override
public void randomUpdate(Tile tile){
if(tile.block() == Blocks.air){
Effects.effect(updateEffect, tile.worldx() + Mathf.range(tilesize/2f), tile.worldy() + Mathf.range(tilesize/2f));
}
}
@Override @Override
public void init(){ public void init(){
super.init(); super.init();
@@ -118,7 +129,7 @@ public class Floor extends Block{
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i]; Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point); Tile other = tile.getNearby(point);
if(other != null && doEdge(other.floor()) && other.floor().edges != null){ if(other != null && doEdge(other.floor()) && other.floor().edges() != null){
eq |= (1 << i); eq |= (1 << i);
} }
} }
@@ -134,8 +145,12 @@ public class Floor extends Block{
} }
} }
protected TextureRegion[][] edges(){
return ((Floor)blendGroup).edges;
}
protected boolean doEdge(Floor other){ protected boolean doEdge(Floor other){
return (other.blendGroup.id > id || edges == null) && other.edgeOnto(this); return (other.blendGroup.id > id || edges() == null) && other.edgeOnto(this);
} }
protected boolean edgeOnto(Floor other){ protected boolean edgeOnto(Floor other){
@@ -163,7 +178,7 @@ public class Floor extends Block{
} }
TextureRegion edge(Floor block, int type, int x, int y){ TextureRegion edge(Floor block, int type, int x, int y){
return block.edges[x + type*3][2-y]; return block.edges()[x + type*3][2-y];
} }
} }

View File

@@ -170,7 +170,7 @@ public class Generators {
Floor floor = (Floor)block; Floor floor = (Floor)block;
if(ImagePacker.has(floor.name + "-edge")){ if(ImagePacker.has(floor.name + "-edge") || floor.blendGroup != floor){
continue; continue;
} }