mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-19 20:27:44 +07:00
Fixed ore/editor icon generation
This commit is contained in:
@ -67,7 +67,7 @@ committingchanges = Comitting Changes
|
|||||||
done = Done
|
done = Done
|
||||||
|
|
||||||
mods.alphainfo = Keep in mind that mods are in alpha, and[scarlet] may be very buggy[].\nReport any issues you find to the Mindustry Github or Discord.
|
mods.alphainfo = Keep in mind that mods are in alpha, and[scarlet] may be very buggy[].\nReport any issues you find to the Mindustry Github or Discord.
|
||||||
mods.alpha = [scarlet](Alpha)
|
mods.alpha = [accent](Alpha)
|
||||||
mods = Mods
|
mods = Mods
|
||||||
mods.none = [LIGHT_GRAY]No mods found!
|
mods.none = [LIGHT_GRAY]No mods found!
|
||||||
mod.enabled = [lightgray]Enabled
|
mod.enabled = [lightgray]Enabled
|
||||||
@ -459,8 +459,6 @@ settings.graphics = Graphics
|
|||||||
settings.cleardata = Clear Game Data...
|
settings.cleardata = Clear Game Data...
|
||||||
settings.clear.confirm = Are you sure you want to clear this data?\nWhat is done cannot be undone!
|
settings.clear.confirm = Are you sure you want to clear this data?\nWhat is done cannot be undone!
|
||||||
settings.clearall.confirm = [scarlet]WARNING![]\nThis will clear all data, including saves, maps, unlocks and keybinds.\nOnce you press 'ok' the game will wipe all data and automatically exit.
|
settings.clearall.confirm = [scarlet]WARNING![]\nThis will clear all data, including saves, maps, unlocks and keybinds.\nOnce you press 'ok' the game will wipe all data and automatically exit.
|
||||||
settings.clearunlocks = Clear Unlocks
|
|
||||||
settings.clearall = Clear All
|
|
||||||
paused = [accent]< Paused >
|
paused = [accent]< Paused >
|
||||||
yes = Yes
|
yes = Yes
|
||||||
no = No
|
no = No
|
||||||
|
@ -2741,11 +2741,11 @@ omega-mech-pad
|
|||||||
orig: 96, 96
|
orig: 96, 96
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-coal-large
|
block-ore-coal-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 609, 1296
|
xy: 661, 46
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-coal-medium
|
block-ore-coal-medium
|
||||||
@ -2755,11 +2755,11 @@ block-ore-coal-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-coal-icon-full
|
block-ore-coal-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 661, 46
|
xy: 609, 1296
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-coal-small
|
block-ore-coal-small
|
||||||
@ -2783,11 +2783,11 @@ block-ore-coal-xlarge
|
|||||||
orig: 48, 48
|
orig: 48, 48
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-copper-large
|
block-ore-copper-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1557, 1253
|
xy: 695, 80
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-copper-medium
|
block-ore-copper-medium
|
||||||
@ -2797,11 +2797,11 @@ block-ore-copper-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-copper-icon-full
|
block-ore-copper-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 695, 80
|
xy: 1557, 1253
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-copper-small
|
block-ore-copper-small
|
||||||
@ -2825,11 +2825,11 @@ block-ore-copper-xlarge
|
|||||||
orig: 48, 48
|
orig: 48, 48
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-lead-large
|
block-ore-lead-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1557, 1211
|
xy: 729, 114
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-lead-medium
|
block-ore-lead-medium
|
||||||
@ -2839,11 +2839,11 @@ block-ore-lead-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-lead-icon-full
|
block-ore-lead-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 729, 114
|
xy: 1557, 1211
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-lead-small
|
block-ore-lead-small
|
||||||
@ -2867,11 +2867,11 @@ block-ore-lead-xlarge
|
|||||||
orig: 48, 48
|
orig: 48, 48
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-scrap-large
|
block-ore-scrap-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1557, 1169
|
xy: 661, 12
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-scrap-medium
|
block-ore-scrap-medium
|
||||||
@ -2881,11 +2881,11 @@ block-ore-scrap-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-scrap-icon-full
|
block-ore-scrap-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 661, 12
|
xy: 1557, 1169
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-scrap-small
|
block-ore-scrap-small
|
||||||
@ -2909,11 +2909,11 @@ block-ore-scrap-xlarge
|
|||||||
orig: 48, 48
|
orig: 48, 48
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-thorium-large
|
block-ore-thorium-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1557, 1127
|
xy: 695, 46
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-thorium-medium
|
block-ore-thorium-medium
|
||||||
@ -2923,11 +2923,11 @@ block-ore-thorium-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-thorium-icon-full
|
block-ore-thorium-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 695, 46
|
xy: 1557, 1127
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-thorium-small
|
block-ore-thorium-small
|
||||||
@ -2951,11 +2951,11 @@ block-ore-thorium-xlarge
|
|||||||
orig: 48, 48
|
orig: 48, 48
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-titanium-large
|
block-ore-titanium-full
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1557, 1085
|
xy: 729, 80
|
||||||
size: 40, 40
|
size: 32, 32
|
||||||
orig: 40, 40
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-titanium-medium
|
block-ore-titanium-medium
|
||||||
@ -2965,11 +2965,11 @@ block-ore-titanium-medium
|
|||||||
orig: 32, 32
|
orig: 32, 32
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
ore-titanium-icon-full
|
block-ore-titanium-large
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 729, 80
|
xy: 1557, 1085
|
||||||
size: 32, 32
|
size: 40, 40
|
||||||
orig: 32, 32
|
orig: 40, 40
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
block-ore-titanium-small
|
block-ore-titanium-small
|
||||||
|
@ -388,7 +388,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
GenTile tile = buffer1[px][py];
|
GenTile tile = buffer1[px][py];
|
||||||
color = MapIO.colorFor(content.block(tile.floor), content.block(tile.block), content.block(tile.ore), Team.derelict);
|
color = MapIO.colorFor(content.block(tile.floor), content.block(tile.block), content.block(tile.ore), Team.derelict);
|
||||||
}
|
}
|
||||||
pixmap.drawPixel(px, pixmap.getHeight() - 1 - py, color);
|
pixmap.draw(px, pixmap.getHeight() - 1 - py, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
@ -21,8 +22,10 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
this.description = Core.bundle.getOrNull(getContentType() + "." + name + ".description");
|
this.description = Core.bundle.getOrNull(getContentType() + "." + name + ".description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createIcons(){
|
/** Generate any special icons for this content. Called asynchronously.*/
|
||||||
//TODO implement; generate special icons, like mech icons or ores w/ pixmaps
|
@CallSuper
|
||||||
|
public void createIcons(PixmapPacker out, PixmapPacker editor){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a specific content icon, or the region {contentType}-{name} if not found.*/
|
/** Returns a specific content icon, or the region {contentType}-{name} if not found.*/
|
||||||
|
@ -106,7 +106,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
public void updateAll(){
|
public void updateAll(){
|
||||||
for(int x = 0; x < world.width(); x++){
|
for(int x = 0; x < world.width(); x++){
|
||||||
for(int y = 0; y < world.height(); y++){
|
for(int y = 0; y < world.height(); y++){
|
||||||
pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, colorFor(world.tile(x, y)));
|
pixmap.draw(x, pixmap.getHeight() - 1 - y, colorFor(world.tile(x, y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture.draw(pixmap, 0, 0);
|
texture.draw(pixmap, 0, 0);
|
||||||
@ -114,7 +114,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
|
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
int color = colorFor(world.tile(tile.x, tile.y));
|
int color = colorFor(world.tile(tile.x, tile.y));
|
||||||
pixmap.drawPixel(tile.x, pixmap.getHeight() - 1 - tile.y, color);
|
pixmap.draw(tile.x, pixmap.getHeight() - 1 - tile.y, color);
|
||||||
|
|
||||||
Pixmaps.drawPixel(texture, tile.x, pixmap.getHeight() - 1 - tile.y, color);
|
Pixmaps.drawPixel(texture, tile.x, pixmap.getHeight() - 1 - tile.y, color);
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ public class MapIO{
|
|||||||
super.setBlock(type);
|
super.setBlock(type);
|
||||||
int c = colorFor(Blocks.air, block(), Blocks.air, getTeam());
|
int c = colorFor(Blocks.air, block(), Blocks.air, getTeam());
|
||||||
if(c != black){
|
if(c != black){
|
||||||
walls.drawPixel(x, floors.getHeight() - 1 - y, c);
|
walls.draw(x, floors.getHeight() - 1 - y, c);
|
||||||
floors.drawPixel(x, floors.getHeight() - 1 - y + 1, shade);
|
floors.draw(x, floors.getHeight() - 1 - y + 1, shade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,9 +112,9 @@ public class MapIO{
|
|||||||
@Override
|
@Override
|
||||||
public Tile create(int x, int y, int floorID, int overlayID, int wallID){
|
public Tile create(int x, int y, int floorID, int overlayID, int wallID){
|
||||||
if(overlayID != 0){
|
if(overlayID != 0){
|
||||||
floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(Blocks.air, Blocks.air, content.block(overlayID), Team.derelict));
|
floors.draw(x, floors.getHeight() - 1 - y, colorFor(Blocks.air, Blocks.air, content.block(overlayID), Team.derelict));
|
||||||
}else{
|
}else{
|
||||||
floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(content.block(floorID), Blocks.air, Blocks.air, Team.derelict));
|
floors.draw(x, floors.getHeight() - 1 - y, colorFor(content.block(floorID), Blocks.air, Blocks.air, Team.derelict));
|
||||||
}
|
}
|
||||||
if(content.block(overlayID) == Blocks.spawn){
|
if(content.block(overlayID) == Blocks.spawn){
|
||||||
map.spawns ++;
|
map.spawns ++;
|
||||||
@ -136,7 +136,7 @@ public class MapIO{
|
|||||||
for(int x = 0; x < pixmap.getWidth(); x++){
|
for(int x = 0; x < pixmap.getWidth(); x++){
|
||||||
for(int y = 0; y < pixmap.getHeight(); y++){
|
for(int y = 0; y < pixmap.getHeight(); y++){
|
||||||
Tile tile = tiles[x][y];
|
Tile tile = tiles[x][y];
|
||||||
pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam()));
|
pixmap.draw(x, pixmap.getHeight() - 1 - y, colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pixmap;
|
return pixmap;
|
||||||
|
@ -261,7 +261,9 @@ public class ContentParser{
|
|||||||
FieldMetadata metadata = fields.get(child.name().replace(" ", "_"));
|
FieldMetadata metadata = fields.get(child.name().replace(" ", "_"));
|
||||||
if(metadata == null){
|
if(metadata == null){
|
||||||
if(ignoreUnknownFields){
|
if(ignoreUnknownFields){
|
||||||
Log.err("{0}: Ignoring unknown field: " + child.name + " (" + type.getName() + ")", object);
|
if(!child.name.equals("research")){
|
||||||
|
Log.err("{0}: Ignoring unknown field: " + child.name + " (" + type.getName() + ")", object);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}else{
|
}else{
|
||||||
SerializationException ex = new SerializationException("Field not found: " + child.name + " (" + type.getName() + ")");
|
SerializationException ex = new SerializationException("Field not found: " + child.name + " (" + type.getName() + ")");
|
||||||
|
@ -9,6 +9,7 @@ import io.anuke.arc.graphics.*;
|
|||||||
import io.anuke.arc.graphics.Pixmap.*;
|
import io.anuke.arc.graphics.Pixmap.*;
|
||||||
import io.anuke.arc.graphics.Texture.*;
|
import io.anuke.arc.graphics.Texture.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.TextureAtlas.*;
|
||||||
import io.anuke.arc.util.ArcAnnotate.*;
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.io.*;
|
import io.anuke.arc.util.io.*;
|
||||||
@ -44,7 +45,8 @@ public class Mods implements Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return the loaded mod found by class, or null if not found. */
|
/** @return the loaded mod found by class, or null if not found. */
|
||||||
public @Nullable LoadedMod getMod(Class<? extends Mod> type){
|
public @Nullable
|
||||||
|
LoadedMod getMod(Class<? extends Mod> type){
|
||||||
return loaded.find(l -> l.mod.getClass() == type);
|
return loaded.find(l -> l.mod.getClass() == type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +76,7 @@ public class Mods implements Loadable{
|
|||||||
if(loaded.isEmpty()) return;
|
if(loaded.isEmpty()) return;
|
||||||
|
|
||||||
packer = new PixmapPacker(2048, 2048, Format.RGBA8888, 2, true);
|
packer = new PixmapPacker(2048, 2048, Format.RGBA8888, 2, true);
|
||||||
|
|
||||||
for(LoadedMod mod : loaded){
|
for(LoadedMod mod : loaded){
|
||||||
int[] packed = {0};
|
int[] packed = {0};
|
||||||
boolean[] failed = {false};
|
boolean[] failed = {false};
|
||||||
@ -105,11 +108,32 @@ public class Mods implements Loadable{
|
|||||||
public void loadSync(){
|
public void loadSync(){
|
||||||
if(packer == null) return;
|
if(packer == null) return;
|
||||||
|
|
||||||
|
Texture editor = Core.atlas.find("clear-editor").getTexture();
|
||||||
|
PixmapPacker editorPacker = new PixmapPacker(2048, 2048, Format.RGBA8888, 2, true);
|
||||||
|
|
||||||
|
for(AtlasRegion region : Core.atlas.getRegions()){
|
||||||
|
if(region.getTexture() == editor){
|
||||||
|
editorPacker.pack(region.name, Core.atlas.getPixmap(region).crop());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//get textures packed
|
//get textures packed
|
||||||
if(totalSprites > 0){
|
if(totalSprites > 0){
|
||||||
TextureFilter filter = Core.settings.getBool("linear") ? TextureFilter.Linear : TextureFilter.Nearest;
|
TextureFilter filter = Core.settings.getBool("linear") ? TextureFilter.Linear : TextureFilter.Nearest;
|
||||||
packer.getPages().each(page -> page.updateTexture(filter, filter, false));
|
|
||||||
packer.getPages().each(page -> page.getRects().each((name, rect) -> Core.atlas.addRegion(name, page.getTexture(), (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height)));
|
packer.updateTextureAtlas(Core.atlas, filter, filter, false);
|
||||||
|
//generate new icons
|
||||||
|
for(Array<Content> arr : content.getContentMap()){
|
||||||
|
arr.each(c -> {
|
||||||
|
if(c instanceof UnlockableContent && c.mod != null){
|
||||||
|
UnlockableContent u = (UnlockableContent)c;
|
||||||
|
u.createIcons(packer, editorPacker);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editorPacker.updateTextureAtlas(Core.atlas, filter, filter, false);
|
||||||
|
packer.updateTextureAtlas(Core.atlas, filter, filter, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
packer.dispose();
|
packer.dispose();
|
||||||
@ -199,6 +223,7 @@ public class Mods implements Loadable{
|
|||||||
for(FileHandle file : folder.list()){
|
for(FileHandle file : folder.list()){
|
||||||
if(file.extension().equals("json")){
|
if(file.extension().equals("json")){
|
||||||
try{
|
try{
|
||||||
|
//this binds the content but does not load it entirely
|
||||||
Content loaded = parser.parse(mod, file.nameWithoutExtension(), file.readString(), type);
|
Content loaded = parser.parse(mod, file.nameWithoutExtension(), file.readString(), type);
|
||||||
Log.info("[{0}] Loaded '{1}'.", mod.meta.name, loaded);
|
Log.info("[{0}] Loaded '{1}'.", mod.meta.name, loaded);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@ -211,6 +236,7 @@ public class Mods implements Loadable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this finishes parsing content fields
|
||||||
parser.finishParsing();
|
parser.finishParsing();
|
||||||
|
|
||||||
each(Mod::loadContent);
|
each(Mod::loadContent);
|
||||||
|
@ -317,6 +317,10 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
tex.setFilter(filter, filter);
|
tex.setFilter(filter, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!mobile){
|
||||||
|
Core.settings.put("swapdiagonal", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void back(){
|
private void back(){
|
||||||
|
@ -667,6 +667,13 @@ public class Block extends BlockStorage{
|
|||||||
draw.rotation = rotation;
|
draw.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createIcons(PixmapPacker out, PixmapPacker editor){
|
||||||
|
super.createIcons(out, editor);
|
||||||
|
|
||||||
|
editor.pack(name + "-icon-editor", Core.atlas.getPixmap((AtlasRegion)icon(Cicon.full)).crop());
|
||||||
|
}
|
||||||
|
|
||||||
/** Never use outside of the editor! */
|
/** Never use outside of the editor! */
|
||||||
public TextureRegion editorIcon(){
|
public TextureRegion editorIcon(){
|
||||||
if(editorIcon == null) editorIcon = Core.atlas.find(name + "-icon-editor");
|
if(editorIcon == null) editorIcon = Core.atlas.find(name + "-icon-editor");
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.collection.IntSet;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.math.geom.*;
|
||||||
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.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.Effects.Effect;
|
import io.anuke.mindustry.entities.Effects.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
|
import io.anuke.annotations.Annotations.*;
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
/**An overlay ore for a specific item type.*/
|
/**An overlay ore for a specific item type.*/
|
||||||
public class OreBlock extends OverlayFloor{
|
public class OreBlock extends OverlayFloor{
|
||||||
|
|
||||||
@ -26,6 +32,39 @@ public class OreBlock extends OverlayFloor{
|
|||||||
this.color.set(ore.color);
|
this.color.set(ore.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@OverrideCallSuper
|
||||||
|
public void createIcons(PixmapPacker out, PixmapPacker editor){
|
||||||
|
for(int i = 0; i < 3; i++){
|
||||||
|
Pixmap image = new Pixmap(32, 32);
|
||||||
|
PixmapRegion shadow = Core.atlas.getPixmap(itemDrop.name + (i + 1));
|
||||||
|
|
||||||
|
int offset = image.getWidth() / tilesize - 1;
|
||||||
|
Color color = new Color();
|
||||||
|
|
||||||
|
for(int x = 0; x < image.getWidth(); x++){
|
||||||
|
for(int y = offset; y < image.getHeight(); y++){
|
||||||
|
shadow.getPixel(x, y - offset, color);
|
||||||
|
|
||||||
|
if(color.a > 0.001f){
|
||||||
|
color.set(0, 0, 0, 0.3f);
|
||||||
|
image.draw(x, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
image.draw(shadow);
|
||||||
|
|
||||||
|
out.pack(name + (i + 1), image);
|
||||||
|
editor.pack("editor-" + name + (i + 1), image);
|
||||||
|
|
||||||
|
if(i == 0){
|
||||||
|
editor.pack("editor-block-" + name + "-full", image);
|
||||||
|
out.pack("block-" + name + "-full", image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
super.init();
|
super.init();
|
||||||
|
@ -144,9 +144,9 @@ public class Drill extends Block{
|
|||||||
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / (drillTime + hardnessDrillMultiplier * returnItem.hardness) * returnCount, 2), x, y, valid);
|
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / (drillTime + hardnessDrillMultiplier * returnItem.hardness) * returnCount, 2), x, y, valid);
|
||||||
float dx = x * tilesize + offset() - width/2f - 4f, dy = y * tilesize + offset() + size * tilesize / 2f + 5;
|
float dx = x * tilesize + offset() - width/2f - 4f, dy = y * tilesize + offset() + size * tilesize / 2f + 5;
|
||||||
Draw.mixcol(Color.darkGray, 1f);
|
Draw.mixcol(Color.darkGray, 1f);
|
||||||
Draw.rect(returnItem.icon(Cicon.medium), dx, dy - 1);
|
Draw.rect(returnItem.icon(Cicon.small), dx, dy - 1);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
Draw.rect(returnItem.icon(Cicon.medium), dx, dy);
|
Draw.rect(returnItem.icon(Cicon.small), dx, dy);
|
||||||
}else{
|
}else{
|
||||||
Tile to = tile.getLinkedTilesAs(this, tempTiles).find(t -> t.drop() != null && t.drop().hardness > tier);
|
Tile to = tile.getLinkedTilesAs(this, tempTiles).find(t -> t.drop() != null && t.drop().hardness > tier);
|
||||||
Item item = to == null ? null : to.drop();
|
Item item = to == null ? null : to.drop();
|
||||||
@ -163,9 +163,9 @@ public class Drill extends Block{
|
|||||||
if(entity.dominantItem != null){
|
if(entity.dominantItem != null){
|
||||||
float dx = tile.drawx() - size * tilesize/2f, dy = tile.drawy() + size * tilesize/2f;
|
float dx = tile.drawx() - size * tilesize/2f, dy = tile.drawy() + size * tilesize/2f;
|
||||||
Draw.mixcol(Color.darkGray, 1f);
|
Draw.mixcol(Color.darkGray, 1f);
|
||||||
Draw.rect(entity.dominantItem.icon(Cicon.medium), dx, dy);
|
Draw.rect(entity.dominantItem.icon(Cicon.small), dx, dy - 1);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
Draw.rect(entity.dominantItem.icon(Cicon.medium), dx, dy);
|
Draw.rect(entity.dominantItem.icon(Cicon.small), dx, dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class Generators{
|
|||||||
image.save("../editor/editor-ore-" + item.name + (i + 1));
|
image.save("../editor/editor-ore-" + item.name + (i + 1));
|
||||||
|
|
||||||
//save icons
|
//save icons
|
||||||
image.save(ore.name + "-icon-full");
|
image.save("block-" + ore.name + "-full");
|
||||||
for(Cicon icon : Cicon.scaled){
|
for(Cicon icon : Cicon.scaled){
|
||||||
Image scaled = new Image(icon.size, icon.size);
|
Image scaled = new Image(icon.size, icon.size);
|
||||||
scaled.drawScaled(image);
|
scaled.drawScaled(image);
|
||||||
|
Reference in New Issue
Block a user