Fixed map colors / Cultivator tweak / Color gen
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 98 B |
Binary file not shown.
|
Before Width: | Height: | Size: 101 B |
Binary file not shown.
|
Before Width: | Height: | Size: 102 B |
BIN
core/assets/maps/desolateRift.mmap
Normal file
BIN
core/assets/maps/desolateRift.mmap
Normal file
Binary file not shown.
BIN
core/assets/sprites/block_colors.png
Normal file
BIN
core/assets/sprites/block_colors.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 505 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 |
@@ -27,6 +27,7 @@ public class Mindustry extends ApplicationCore{
|
|||||||
Log.setUseColors(false);
|
Log.setUseColors(false);
|
||||||
BundleLoader.load();
|
BundleLoader.load();
|
||||||
content.load();
|
content.load();
|
||||||
|
content.loadColors();
|
||||||
|
|
||||||
add(logic = new Logic());
|
add(logic = new Logic());
|
||||||
add(world = new World());
|
add(world = new World());
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
//environment
|
//environment
|
||||||
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, ice, snow,
|
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,
|
iceSnow, sandWater, duneRocks, stainedRocks, stainedStone, stainedRocksRed, stainedStoneRed, stainedRocksYellow, stainedStoneYellow, stainedBoulder,
|
||||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5,
|
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5,
|
||||||
|
|
||||||
@@ -118,7 +118,6 @@ public class Blocks implements ContentList{
|
|||||||
statusDuration = 120f;
|
statusDuration = 120f;
|
||||||
drownTime = 140f;
|
drownTime = 140f;
|
||||||
cacheLayer = CacheLayer.water;
|
cacheLayer = CacheLayer.water;
|
||||||
minimapColor = Color.valueOf("465a96");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
water = new Floor("water"){{
|
water = new Floor("water"){{
|
||||||
@@ -130,7 +129,6 @@ public class Blocks implements ContentList{
|
|||||||
liquidDrop = Liquids.water;
|
liquidDrop = Liquids.water;
|
||||||
isLiquid = true;
|
isLiquid = true;
|
||||||
cacheLayer = CacheLayer.water;
|
cacheLayer = CacheLayer.water;
|
||||||
minimapColor = Color.valueOf("506eb4");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
tar = new Floor("tar"){{
|
tar = new Floor("tar"){{
|
||||||
@@ -143,22 +141,18 @@ public class Blocks implements ContentList{
|
|||||||
liquidDrop = Liquids.oil;
|
liquidDrop = Liquids.oil;
|
||||||
isLiquid = true;
|
isLiquid = true;
|
||||||
cacheLayer = CacheLayer.oil;
|
cacheLayer = CacheLayer.oil;
|
||||||
minimapColor = Color.valueOf("292929");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
stone = new Floor("stone"){{
|
stone = new Floor("stone"){{
|
||||||
hasOres = true;
|
hasOres = true;
|
||||||
minimapColor = Color.valueOf("323232");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
craters = new Floor("craters"){{
|
craters = new Floor("craters"){{
|
||||||
minimapColor = Color.valueOf("323232");
|
|
||||||
variants = 6;
|
variants = 6;
|
||||||
blendGroup = stone;
|
blendGroup = stone;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
charr = new Floor("char"){{
|
charr = new Floor("char"){{
|
||||||
minimapColor = Color.valueOf("323232");
|
|
||||||
blendGroup = stone;
|
blendGroup = stone;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -171,12 +165,10 @@ public class Blocks implements ContentList{
|
|||||||
liquidDrop = Liquids.water;
|
liquidDrop = Liquids.water;
|
||||||
isLiquid = true;
|
isLiquid = true;
|
||||||
cacheLayer = CacheLayer.water;
|
cacheLayer = CacheLayer.water;
|
||||||
minimapColor = Color.valueOf("506eb4");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sand = new Floor("sand"){{
|
sand = new Floor("sand"){{
|
||||||
itemDrop = Items.sand;
|
itemDrop = Items.sand;
|
||||||
minimapColor = Color.valueOf("988a67");
|
|
||||||
hasOres = true;
|
hasOres = true;
|
||||||
playerUnmineable = true;
|
playerUnmineable = true;
|
||||||
}};
|
}};
|
||||||
@@ -191,17 +183,11 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
snow = new Floor("snow"){{
|
snow = new Floor("snow"){{
|
||||||
minimapColor = Color.valueOf("c2d1d2");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
ice = new Floor("ice"){{
|
ice = new Floor("ice"){{
|
||||||
dragMultiplier = 0.2f;
|
dragMultiplier = 0.2f;
|
||||||
speedMultiplier = 0.4f;
|
speedMultiplier = 0.4f;
|
||||||
minimapColor = Color.valueOf("b8eef8");
|
|
||||||
}};
|
|
||||||
|
|
||||||
grass = new Floor("grass"){{
|
|
||||||
minimapColor = Color.valueOf("549d5b");
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cliffs = new StaticWall("cliffs"){{
|
cliffs = new StaticWall("cliffs"){{
|
||||||
@@ -957,8 +943,8 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
cultivator = new Cultivator("cultivator"){{
|
cultivator = new Cultivator("cultivator"){{
|
||||||
requirements(Category.production, ItemStack.with(Items.copper, 20, Items.lead, 50, Items.silicon, 20));
|
requirements(Category.production, ItemStack.with(Items.copper, 20, Items.lead, 50, Items.silicon, 20));
|
||||||
result = Items.biomatter;
|
output = Items.biomatter;
|
||||||
drillTime = 200;
|
craftTime = 200;
|
||||||
size = 2;
|
size = 2;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ public class Zones implements ContentList{
|
|||||||
itemRequirements = ItemStack.with(Items.silicon, 8000, Items.titanium, 6000, Items.graphite, 4000);
|
itemRequirements = ItemStack.with(Items.silicon, 8000, Items.titanium, 6000, Items.graphite, 4000);
|
||||||
conditionWave = 20;
|
conditionWave = 20;
|
||||||
zoneRequirements = new Zone[]{stainedMountains};
|
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(){{
|
rules = () -> new Rules(){{
|
||||||
waves = true;
|
waves = true;
|
||||||
waveTimer = 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);
|
deployCost = ItemStack.with(Items.copper, 300);
|
||||||
startingItems = ItemStack.with(Items.copper, 200);
|
startingItems = ItemStack.with(Items.copper, 200);
|
||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import io.anuke.arc.collection.Array;
|
|||||||
import io.anuke.arc.collection.ObjectMap;
|
import io.anuke.arc.collection.ObjectMap;
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.collection.ObjectSet;
|
||||||
import io.anuke.arc.function.Consumer;
|
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.arc.util.Log;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.Player;
|
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.Content;
|
||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.game.MappableContent;
|
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.Block;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
|
||||||
import io.anuke.mindustry.world.LegacyColorMapper;
|
import io.anuke.mindustry.world.LegacyColorMapper;
|
||||||
|
|
||||||
|
import static io.anuke.arc.Core.files;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all game content.
|
* Loads all game content.
|
||||||
* Call load() before doing anything with content.
|
* Call load() before doing anything with content.
|
||||||
@@ -48,7 +54,6 @@ public class ContentLoader{
|
|||||||
new Zones(),
|
new Zones(),
|
||||||
|
|
||||||
//these are not really content classes, but this makes initialization easier
|
//these are not really content classes, but this makes initialization easier
|
||||||
new ColorMapper(),
|
|
||||||
new LegacyColorMapper(),
|
new LegacyColorMapper(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,6 +131,22 @@ public class ContentLoader{
|
|||||||
initialization.add(callable);
|
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){
|
public void verbose(boolean verbose){
|
||||||
this.verbose = 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.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;
|
||||||
@@ -28,6 +29,7 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class Renderer implements ApplicationListener{
|
|||||||
batch = new SpriteBatch(4096);
|
batch = new SpriteBatch(4096);
|
||||||
camera = new Camera();
|
camera = new Camera();
|
||||||
Lines.setCircleVertices(14);
|
Lines.setCircleVertices(14);
|
||||||
|
|
||||||
Shaders.init();
|
Shaders.init();
|
||||||
|
|
||||||
Effects.setScreenShakeProvider((intensity, duration) -> {
|
Effects.setScreenShakeProvider((intensity, duration) -> {
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
if(mech.shake > 1f){
|
if(mech.shake > 1f){
|
||||||
Effects.shake(mech.shake, mech.shake, this);
|
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);
|
mech.onLand(this);
|
||||||
achievedFlight = false;
|
achievedFlight = false;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import io.anuke.mindustry.entities.Unit;
|
|||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
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 io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
@@ -137,7 +137,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
|
|
||||||
private int colorFor(Tile tile){
|
private int colorFor(Tile tile){
|
||||||
tile = tile.target();
|
tile = tile.target();
|
||||||
return ColorMapper.colorFor(tile.floor(), tile.block(), tile.getTeam());
|
return MapIO.colorFor(tile.floor(), tile.block(), tile.getTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import io.anuke.mindustry.maps.MapTileData.DataPosition;
|
|||||||
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
|
||||||
import io.anuke.mindustry.world.LegacyColorMapper;
|
import io.anuke.mindustry.world.LegacyColorMapper;
|
||||||
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
|
import io.anuke.mindustry.world.LegacyColorMapper.LegacyBlock;
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ public class MapIO{
|
|||||||
data.read(marker);
|
data.read(marker);
|
||||||
Block floor = content.block(marker.floor);
|
Block floor = content.block(marker.floor);
|
||||||
Block wall = content.block(marker.wall);
|
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);
|
pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,4 +195,11 @@ public class MapIO{
|
|||||||
stream.writeShort(meta.width);
|
stream.writeShort(meta.width);
|
||||||
stream.writeShort(meta.height);
|
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;
|
public boolean configurable;
|
||||||
/** Whether this block consumes touchDown events when tapped. */
|
/** Whether this block consumes touchDown events when tapped. */
|
||||||
public boolean consumesTap;
|
public boolean consumesTap;
|
||||||
/** The color of this block when displayed on the minimap or map preview. */
|
/** The color of this block when displayed on the minimap or map preview.
|
||||||
public Color minimapColor = Color.CLEAR;
|
* Do not set manually! This is overriden when loading.*/
|
||||||
|
public Color color = new Color(0, 0, 0, 1);
|
||||||
/**Whether units target this block.*/
|
/**Whether units target this block.*/
|
||||||
public boolean targetable = true;
|
public boolean targetable = true;
|
||||||
/**Whether the overdrive core has any effect on this block.*/
|
/**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("00ff00", Blocks.stone, 0);
|
||||||
map("323232", Blocks.stone, 0);
|
map("323232", Blocks.stone, 0);
|
||||||
map("646464", Blocks.stone, 1);
|
map("646464", Blocks.stone, 1);
|
||||||
map("50965a", Blocks.grass, 0);
|
//map("50965a", Blocks.grass, 0);
|
||||||
map("5ab464", Blocks.grass, 1);
|
//map("5ab464", Blocks.grass, 1);
|
||||||
map("506eb4", Blocks.water, 0);
|
map("506eb4", Blocks.water, 0);
|
||||||
map("465a96", Blocks.deepwater, 0);
|
map("465a96", Blocks.deepwater, 0);
|
||||||
//map("252525", Blocks.blackstone, 0);
|
//map("252525", Blocks.blackstone, 0);
|
||||||
|
|||||||
@@ -18,13 +18,18 @@ public class OreBlock extends Floor{
|
|||||||
this.itemDrop = ore;
|
this.itemDrop = ore;
|
||||||
this.base = base;
|
this.base = base;
|
||||||
this.variants = 3;
|
this.variants = 3;
|
||||||
this.minimapColor = ore.color;
|
|
||||||
this.edge = base.name;
|
this.edge = base.name;
|
||||||
this.blendGroup = base;
|
this.blendGroup = base;
|
||||||
|
this.color.set(ore.color);
|
||||||
|
|
||||||
oreBlockMap.getOr(ore, ObjectMap::new).put(base, this);
|
oreBlockMap.getOr(ore, ObjectMap::new).put(base, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
super.init();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayName(Tile tile){
|
public String getDisplayName(Tile tile){
|
||||||
return itemDrop.localizedName();
|
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.Mathf;
|
||||||
import io.anuke.arc.math.RandomXS128;
|
import io.anuke.arc.math.RandomXS128;
|
||||||
import io.anuke.arc.util.Time;
|
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.content.Fx;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.type.Item;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Cultivator extends Drill{
|
public class Cultivator extends GenericCrafter{
|
||||||
protected Color plantColor = Color.valueOf("648b55");
|
protected static final Color plantColor = Color.valueOf("648b55");
|
||||||
protected Color plantColorLight = Color.valueOf("73a75f");
|
protected static final Color plantColorLight = Color.valueOf("73a75f");
|
||||||
protected Color bottomColor = Color.valueOf("474747");
|
protected static final Color bottomColor = Color.valueOf("474747");
|
||||||
|
|
||||||
protected TextureRegion middleRegion, topRegion;
|
protected TextureRegion middleRegion, topRegion;
|
||||||
|
|
||||||
protected Item result;
|
|
||||||
|
|
||||||
protected RandomXS128 random = new RandomXS128(0);
|
protected RandomXS128 random = new RandomXS128(0);
|
||||||
protected float recurrence = 6f;
|
protected float recurrence = 6f;
|
||||||
|
|
||||||
public Cultivator(String name){
|
public Cultivator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
drillEffect = Fx.none;
|
craftEffect = 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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,17 +84,7 @@ public class Cultivator extends Drill{
|
|||||||
return new CultivatorEntity();
|
return new CultivatorEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static class CultivatorEntity extends TileEntity{
|
||||||
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 float warmup;
|
public float warmup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public class Generators {
|
|||||||
public static void generate(){
|
public static void generate(){
|
||||||
|
|
||||||
ImagePacker.generate("block-icons", () -> {
|
ImagePacker.generate("block-icons", () -> {
|
||||||
|
Image colors = new Image(256, 1);
|
||||||
|
|
||||||
for(Block block : content.blocks()){
|
for(Block block : content.blocks()){
|
||||||
TextureRegion[] regions = block.getGeneratedIcons();
|
TextureRegion[] regions = block.getGeneratedIcons();
|
||||||
|
|
||||||
@@ -44,12 +46,27 @@ public class Generators {
|
|||||||
scaled.drawScaled(image);
|
scaled.drawScaled(image);
|
||||||
scaled.save(block.name + "-icon-" + icon.name());
|
scaled.save(block.name + "-icon-" + icon.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color average = new Color();
|
||||||
|
for(int x = 0; x < image.width(); x++){
|
||||||
|
for(int y = 0; y < image.height(); y++){
|
||||||
|
Color color = image.getColor(x, y);
|
||||||
|
average.r += color.r;
|
||||||
|
average.g += color.g;
|
||||||
|
average.b += color.b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
average.mul(1f / (image.width() * image.height()));
|
||||||
|
average.a = 1f;
|
||||||
|
colors.draw(block.id, 0, average);
|
||||||
}catch(IllegalArgumentException e){
|
}catch(IllegalArgumentException e){
|
||||||
Log.info("Skipping &ly'{0}'", block.name);
|
Log.info("Skipping &ly'{0}'", block.name);
|
||||||
}catch(NullPointerException e){
|
}catch(NullPointerException e){
|
||||||
Log.err("Block &ly'{0}'&lr has an null region!");
|
Log.err("Block &ly'{0}'&lr has an null region!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
colors.save("../../../assets/sprites/block_colors");
|
||||||
});
|
});
|
||||||
|
|
||||||
ImagePacker.generate("mech-icons", () -> {
|
ImagePacker.generate("mech-icons", () -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user