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

View File

@@ -37,7 +37,7 @@ public class Blocks implements ContentList{
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
holostone, rocks, icerocks, cliffs, pine, whiteTree, whiteTreeDead, sporeCluster,
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
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,
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine,
//transport
//transpor
conveyor, titaniumConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver,
//liquids
@@ -271,14 +271,24 @@ public class Blocks implements ContentList{
blendGroup = metalFloor;
}};
metalFloor4 = new Floor("metal-floor-4"){{
metalFloor5 = new Floor("metal-floor-5"){{
variants = 0;
blendGroup = metalFloor;
}};
metalFloor5 = new Floor("metal-floor-5"){{
variants = 0;
blendGroup = metalFloor;
ignarock = new Floor("ignarock"){{
}};
hotrock = new Floor("hotrock"){{
heat = 0.5f;
blendGroup = ignarock;
}};
magmarock = new Floor("magmarock"){{
heat = 0.75f;
updateEffect = Fx.magmasmoke;
blendGroup = ignarock;
}};
//endregion

View File

@@ -33,7 +33,7 @@ public class Fx implements ContentList{
bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke,
shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium,
shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot,
launchFull, unitSpawn, spawnShockwave;
launchFull, unitSpawn, spawnShockwave, magmasmoke;
@Override
public void load(){
@@ -93,6 +93,12 @@ public class Fx implements ContentList{
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 -> {
Lines.stroke(2f * e.fout());
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.scene.ui.TextField;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings;
import io.anuke.arc.util.Time;
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.net.Net;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block;
import java.io.IOException;
@@ -307,7 +305,7 @@ public class Control implements ApplicationListener{
}
//auto-update rpc every 5 seconds
if(timer.get(60 * 5)){
if(timer.get(0, 60 * 5)){
Platform.instance.updateRPC();
}

View File

@@ -54,7 +54,7 @@ public class Maps implements Disposable{
/**Returns map by internal 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.
@@ -136,7 +136,7 @@ public class Maps implements Disposable{
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);
}
}

View File

@@ -369,6 +369,11 @@ public class Block extends BlockStorage{
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(){
return (hasItems && itemCapacity > 0);
}

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.world.blocks;
import io.anuke.arc.Core;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.Color;
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.geom.Geometry;
import io.anuke.arc.math.geom.Point2;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.type.Item;
@@ -57,6 +59,8 @@ public class Floor extends Block{
public String edgeStyle = "smooth";
/**Group of blocks that this block does not draw edges on.*/
public Block blendGroup = this;
/**Effect displayed when randomly updated.*/
public Effect updateEffect = Fx.none;
protected TextureRegion[][] edges;
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")};
}
@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
public void init(){
super.init();
@@ -118,7 +129,7 @@ public class Floor extends Block{
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
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);
}
}
@@ -134,8 +145,12 @@ public class Floor extends Block{
}
}
protected TextureRegion[][] edges(){
return ((Floor)blendGroup).edges;
}
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){
@@ -163,7 +178,7 @@ public class Floor extends Block{
}
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];
}
}