Fixed map colors / Cultivator tweak / Color gen
This commit is contained in:
@@ -27,6 +27,7 @@ public class Mindustry extends ApplicationCore{
|
||||
Log.setUseColors(false);
|
||||
BundleLoader.load();
|
||||
content.load();
|
||||
content.loadColors();
|
||||
|
||||
add(logic = new Logic());
|
||||
add(world = new World());
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
//environment
|
||||
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
||||
grass, 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,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5,
|
||||
|
||||
@@ -118,7 +118,6 @@ public class Blocks implements ContentList{
|
||||
statusDuration = 120f;
|
||||
drownTime = 140f;
|
||||
cacheLayer = CacheLayer.water;
|
||||
minimapColor = Color.valueOf("465a96");
|
||||
}};
|
||||
|
||||
water = new Floor("water"){{
|
||||
@@ -130,7 +129,6 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
minimapColor = Color.valueOf("506eb4");
|
||||
}};
|
||||
|
||||
tar = new Floor("tar"){{
|
||||
@@ -143,22 +141,18 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.oil;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.oil;
|
||||
minimapColor = Color.valueOf("292929");
|
||||
}};
|
||||
|
||||
stone = new Floor("stone"){{
|
||||
hasOres = true;
|
||||
minimapColor = Color.valueOf("323232");
|
||||
}};
|
||||
|
||||
craters = new Floor("craters"){{
|
||||
minimapColor = Color.valueOf("323232");
|
||||
variants = 6;
|
||||
blendGroup = stone;
|
||||
}};
|
||||
|
||||
charr = new Floor("char"){{
|
||||
minimapColor = Color.valueOf("323232");
|
||||
blendGroup = stone;
|
||||
}};
|
||||
|
||||
@@ -171,12 +165,10 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
minimapColor = Color.valueOf("506eb4");
|
||||
}};
|
||||
|
||||
sand = new Floor("sand"){{
|
||||
itemDrop = Items.sand;
|
||||
minimapColor = Color.valueOf("988a67");
|
||||
hasOres = true;
|
||||
playerUnmineable = true;
|
||||
}};
|
||||
@@ -191,17 +183,11 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
snow = new Floor("snow"){{
|
||||
minimapColor = Color.valueOf("c2d1d2");
|
||||
}};
|
||||
|
||||
ice = new Floor("ice"){{
|
||||
dragMultiplier = 0.2f;
|
||||
speedMultiplier = 0.4f;
|
||||
minimapColor = Color.valueOf("b8eef8");
|
||||
}};
|
||||
|
||||
grass = new Floor("grass"){{
|
||||
minimapColor = Color.valueOf("549d5b");
|
||||
}};
|
||||
|
||||
cliffs = new StaticWall("cliffs"){{
|
||||
@@ -957,8 +943,8 @@ public class Blocks implements ContentList{
|
||||
|
||||
cultivator = new Cultivator("cultivator"){{
|
||||
requirements(Category.production, ItemStack.with(Items.copper, 20, Items.lead, 50, Items.silicon, 20));
|
||||
result = Items.biomatter;
|
||||
drillTime = 200;
|
||||
output = Items.biomatter;
|
||||
craftTime = 200;
|
||||
size = 2;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
|
||||
@@ -323,7 +323,7 @@ public class Zones implements ContentList{
|
||||
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.container};
|
||||
blockRequirements = new Block[]{Blocks.launchPad, Blocks.unloader, Blocks.coreFoundation};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -387,7 +387,7 @@ public class Zones implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
desolateRift = new Zone("desolateRift", new MapGenerator("groundZero", 1)){{ //TODO implement
|
||||
desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift")){{
|
||||
deployCost = ItemStack.with(Items.copper, 300);
|
||||
startingItems = ItemStack.with(Items.copper, 200);
|
||||
conditionWave = 15;
|
||||
|
||||
@@ -4,6 +4,8 @@ import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.ObjectMap;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.function.Consumer;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.Pixmap;
|
||||
import io.anuke.arc.util.Log;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
@@ -16,11 +18,15 @@ import io.anuke.mindustry.entities.traits.TypeTrait;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.game.MappableContent;
|
||||
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.Zone;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.world.LegacyColorMapper;
|
||||
|
||||
import static io.anuke.arc.Core.files;
|
||||
|
||||
/**
|
||||
* Loads all game content.
|
||||
* Call load() before doing anything with content.
|
||||
@@ -48,7 +54,6 @@ public class ContentLoader{
|
||||
new Zones(),
|
||||
|
||||
//these are not really content classes, but this makes initialization easier
|
||||
new ColorMapper(),
|
||||
new LegacyColorMapper(),
|
||||
};
|
||||
|
||||
@@ -126,6 +131,22 @@ public class ContentLoader{
|
||||
initialization.add(callable);
|
||||
}
|
||||
|
||||
/**Loads block colors.*/
|
||||
public void loadColors(){
|
||||
Pixmap pixmap = new Pixmap(files.internal("sprites/block_colors.png"));
|
||||
for(int i = 0; i < 256; i++){
|
||||
if(blocks().size > i){
|
||||
int color = pixmap.getPixel(i, 0);
|
||||
|
||||
if(color == 0) continue;
|
||||
|
||||
Block block = block(i);
|
||||
Color.rgba8888ToColor(block.color, color);
|
||||
}
|
||||
}
|
||||
pixmap.dispose();
|
||||
}
|
||||
|
||||
public void verbose(boolean verbose){
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -28,6 +29,7 @@ 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;
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ public class Renderer implements ApplicationListener{
|
||||
batch = new SpriteBatch(4096);
|
||||
camera = new Camera();
|
||||
Lines.setCircleVertices(14);
|
||||
|
||||
Shaders.init();
|
||||
|
||||
Effects.setScreenShakeProvider((intensity, duration) -> {
|
||||
|
||||
@@ -529,7 +529,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
if(mech.shake > 1f){
|
||||
Effects.shake(mech.shake, mech.shake, this);
|
||||
}
|
||||
Effects.effect(Fx.unitLand, tile.floor().liquidColor == null ? tile.floor().minimapColor : tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
|
||||
Effects.effect(Fx.unitLand, tile.floor().liquidColor == null ? tile.floor().color : tile.floor().color, x, y, tile.floor().isLiquid ? 1f : 0.5f);
|
||||
}
|
||||
mech.onLand(this);
|
||||
achievedFlight = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.io.MapIO;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
@@ -137,7 +137,7 @@ public class MinimapRenderer implements Disposable{
|
||||
|
||||
private int colorFor(Tile tile){
|
||||
tile = tile.target();
|
||||
return ColorMapper.colorFor(tile.floor(), tile.block(), tile.getTeam());
|
||||
return MapIO.colorFor(tile.floor(), tile.block(), tile.getTeam());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@ import io.anuke.mindustry.maps.MapTileData.DataPosition;
|
||||
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.world.LegacyColorMapper;
|
||||
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
|
||||
|
||||
@@ -52,7 +51,7 @@ public class MapIO{
|
||||
data.read(marker);
|
||||
Block floor = content.block(marker.floor);
|
||||
Block wall = content.block(marker.wall);
|
||||
int color = ColorMapper.colorFor(floor, wall, Team.all[marker.team]);
|
||||
int color = colorFor(floor, wall, Team.all[marker.team]);
|
||||
pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, color);
|
||||
}
|
||||
}
|
||||
@@ -196,4 +195,11 @@ public class MapIO{
|
||||
stream.writeShort(meta.width);
|
||||
stream.writeShort(meta.height);
|
||||
}
|
||||
|
||||
public static int colorFor(Block floor, Block wall, Team team){
|
||||
if(wall.synthetic()){
|
||||
return team.intColor;
|
||||
}
|
||||
return Color.rgba8888(wall.solid ? wall.color : floor.color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,9 @@ public class Block extends BlockStorage{
|
||||
public boolean configurable;
|
||||
/** Whether this block consumes touchDown events when tapped. */
|
||||
public boolean consumesTap;
|
||||
/** The color of this block when displayed on the minimap or map preview. */
|
||||
public Color minimapColor = Color.CLEAR;
|
||||
/** The color of this block when displayed on the minimap or map preview.
|
||||
* Do not set manually! This is overriden when loading.*/
|
||||
public Color color = new Color(0, 0, 0, 1);
|
||||
/**Whether units target this block.*/
|
||||
public boolean targetable = true;
|
||||
/**Whether the overdrive core has any effect on this block.*/
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.anuke.mindustry.world;
|
||||
|
||||
import io.anuke.arc.collection.IntMap;
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
|
||||
public class ColorMapper implements ContentList{
|
||||
private static IntMap<Block> blockMap = new IntMap<>();
|
||||
private static ObjectIntMap<Block> colorMap = new ObjectIntMap<>();
|
||||
private static ThreadLocal<Color> tmpColors = new ThreadLocal<>();
|
||||
|
||||
private static int getBlockColor(Block block){
|
||||
return colorMap.get(block, 0);
|
||||
}
|
||||
|
||||
public static int colorFor(Block floor, Block wall, Team team){
|
||||
if(wall.synthetic()){
|
||||
return team.intColor;
|
||||
}
|
||||
int color = getBlockColor(wall);
|
||||
if(color == 0) color = ColorMapper.getBlockColor(floor);
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
for(Block block : content.blocks()){
|
||||
int color = Color.rgba8888(block.minimapColor);
|
||||
if(color == 0) continue; //skip blocks that are not mapped
|
||||
|
||||
blockMap.put(color, block);
|
||||
colorMap.put(block, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,8 @@ public class LegacyColorMapper implements ContentList{
|
||||
map("00ff00", Blocks.stone, 0);
|
||||
map("323232", Blocks.stone, 0);
|
||||
map("646464", Blocks.stone, 1);
|
||||
map("50965a", Blocks.grass, 0);
|
||||
map("5ab464", Blocks.grass, 1);
|
||||
//map("50965a", Blocks.grass, 0);
|
||||
//map("5ab464", Blocks.grass, 1);
|
||||
map("506eb4", Blocks.water, 0);
|
||||
map("465a96", Blocks.deepwater, 0);
|
||||
//map("252525", Blocks.blackstone, 0);
|
||||
|
||||
@@ -18,13 +18,18 @@ public class OreBlock extends Floor{
|
||||
this.itemDrop = ore;
|
||||
this.base = base;
|
||||
this.variants = 3;
|
||||
this.minimapColor = ore.color;
|
||||
this.edge = base.name;
|
||||
this.blendGroup = base;
|
||||
this.color.set(ore.color);
|
||||
|
||||
oreBlockMap.getOr(ore, ObjectMap::new).put(base, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(Tile tile){
|
||||
return itemDrop.localizedName();
|
||||
|
||||
@@ -8,43 +8,26 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.RandomXS128;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Cultivator extends Drill{
|
||||
protected Color plantColor = Color.valueOf("648b55");
|
||||
protected Color plantColorLight = Color.valueOf("73a75f");
|
||||
protected Color bottomColor = Color.valueOf("474747");
|
||||
public class Cultivator extends GenericCrafter{
|
||||
protected static final Color plantColor = Color.valueOf("648b55");
|
||||
protected static final Color plantColorLight = Color.valueOf("73a75f");
|
||||
protected static final Color bottomColor = Color.valueOf("474747");
|
||||
|
||||
protected TextureRegion middleRegion, topRegion;
|
||||
|
||||
protected Item result;
|
||||
|
||||
protected RandomXS128 random = new RandomXS128(0);
|
||||
protected float recurrence = 6f;
|
||||
|
||||
public Cultivator(String name){
|
||||
super(name);
|
||||
drillEffect = Fx.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.remove(BlockStat.drillTier);
|
||||
stats.add(BlockStat.drillTier, table -> {
|
||||
table.addImage("grass1").size(8 * 3).padBottom(3).padTop(3);
|
||||
table.add(Blocks.grass.formalName).padLeft(3);
|
||||
});
|
||||
craftEffect = Fx.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,17 +84,7 @@ public class Cultivator extends Drill{
|
||||
return new CultivatorEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Tile tile){
|
||||
return tile != null && tile.floor() == Blocks.grass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getDrop(Tile tile){
|
||||
return Items.biomatter;
|
||||
}
|
||||
|
||||
public static class CultivatorEntity extends DrillEntity{
|
||||
public static class CultivatorEntity extends TileEntity{
|
||||
public float warmup;
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user