Converted almost everything to an I18nBundle

This commit is contained in:
Anuken
2017-12-26 17:58:20 -05:00
parent 40bb499eeb
commit 42909abf53
36 changed files with 525 additions and 593 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 199 B

View File

@@ -0,0 +1 @@
{}

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#ifdef GL_ES #ifdef GL_ES
precision mediump float; precision highp float;
precision mediump int; precision highp int;
#endif #endif
#define MAX_HITS 64 #define MAX_HITS 64
@@ -13,6 +13,7 @@ uniform vec4 u_color;
uniform vec2 u_texsize; uniform vec2 u_texsize;
uniform float u_time; uniform float u_time;
uniform float u_scaling; uniform float u_scaling;
uniform float u_dp;
uniform vec2 u_offset; uniform vec2 u_offset;
uniform int u_hitamount; uniform int u_hitamount;
uniform vec3 u_hits[MAX_HITS]; uniform vec3 u_hits[MAX_HITS];
@@ -20,15 +21,19 @@ uniform vec3 u_hits[MAX_HITS];
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_texCoord; varying vec2 v_texCoord;
float round(float f){
return float(int(f));
}
void main() { void main() {
vec2 T = v_texCoord.xy; vec2 T = v_texCoord.xy;
vec2 coords = (T * u_texsize) + u_offset; vec2 coords = (T * u_texsize) + u_offset;
T += vec2(sin(coords.y / 3.0 + u_time / 20.0) / 250.0, sin(coords.x / 3.0 + u_time / 20.0) / 250.0) * u_scaling; T += vec2(sin(coords.y / 3.0 + u_time / 20.0) / 240.0, sin(coords.x / 3.0 + u_time / 20.0) / 240.0) * u_scaling;
float si = 1.0 + sin(u_time / 20.0 /*+ (coords.x + coords.y) / 30.0*/) / 8.0; float si = 1.0 + sin(u_time / 20.0) / 8.0;
vec4 color = texture2D(u_texture, T) * vec4(si, si, si, 1.0); vec4 color = texture2D(u_texture, T) * vec4(si, si, si, 1.0);
@@ -48,9 +53,8 @@ void main() {
gl_FragColor = u_color * vec4(si, si, si, 1.0); gl_FragColor = u_color * vec4(si, si, si, 1.0);
}else{ }else{
//coords.x = float(int(coords.x));
if(color.a > 0.1){ if(color.a > 0.1){
if(mod(coords.x + coords.y + sin(coords.x / 5.0) * 3.0 + sin(coords.y / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){ if(mod(coords.x / u_dp + coords.y / u_dp + sin(round(coords.x / u_dp) / 5.0) * 3.0 + sin(round(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
color *= 1.65; color *= 1.65;
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -1,14 +1,21 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.I18NBundle;
import io.anuke.mindustry.core.*; import io.anuke.mindustry.core.*;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.io.BundleUtil;
import io.anuke.mindustry.io.PlatformFunction; import io.anuke.mindustry.io.PlatformFunction;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.*; import io.anuke.mindustry.world.blocks.*;
import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.function.Callable; import io.anuke.ucore.function.Callable;
@@ -26,27 +33,41 @@ public class Mindustry extends ModuleCore {
@Override public void addDialog(TextField field){} @Override public void addDialog(TextField field){}
}; };
//always initialize blocks in this order, otherwise there are ID errors
public Block[] blockClasses = {
Blocks.air,
DefenseBlocks.compositewall,
DistributionBlocks.conduit,
ProductionBlocks.coaldrill,
WeaponBlocks.chainturret,
SpecialBlocks.enemySpawn
};
@Override @Override
public void init(){ public void init(){
loadBundle();
module(Vars.world = new World()); module(Vars.world = new World());
module(Vars.control = new Control()); module(Vars.control = new Control());
module(Vars.renderer = new Renderer()); module(Vars.renderer = new Renderer());
module(Vars.ui = new UI()); module(Vars.ui = new UI());
} }
public void loadBundle(){
I18NBundle.setExceptionOnMissingKey(false);
FileHandle handle = Gdx.files.internal("bundles/bundle");
Locale locale = Locale.getDefault();
Core.bundle = I18NBundle.createBundle(handle, locale);
//always initialize blocks in this order, otherwise there are ID errors
Block[] blockClasses = {
Blocks.air,
DefenseBlocks.compositewall,
DistributionBlocks.conduit,
ProductionBlocks.coaldrill,
WeaponBlocks.chainturret,
SpecialBlocks.enemySpawn
};
UCore.log("Block classes: " + blockClasses.length);
}
@Override @Override
public void postInit(){ public void postInit(){
Vars.control.reset(); Vars.control.reset();
BundleUtil.buildBundle(Gdx.files.absolute("/home/anuke/bundle_en_US.properties"));
} }
@Override @Override

View File

@@ -70,8 +70,6 @@ public class Vars{
public static final int tilesize = 8; public static final int tilesize = 8;
public static I18NBundle bundle;
public static Control control; public static Control control;
public static Renderer renderer; public static Renderer renderer;
public static UI ui; public static UI ui;

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.core;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
@@ -12,7 +13,9 @@ import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.controllers.Controller; import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerAdapter; import com.badlogic.gdx.controllers.ControllerAdapter;
import com.badlogic.gdx.controllers.Controllers; import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.I18NBundle;
import com.badlogic.gdx.utils.reflect.ClassReflection; import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Mindustry;
@@ -27,6 +30,7 @@ import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.input.AndroidInput; import io.anuke.mindustry.input.AndroidInput;
import io.anuke.mindustry.input.DesktopInput; import io.anuke.mindustry.input.DesktopInput;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.io.BundleUtil;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.resource.Weapon; import io.anuke.mindustry.resource.Weapon;
@@ -80,6 +84,11 @@ public class Control extends Module{
if(Mindustry.args.contains("-debug", false)) if(Mindustry.args.contains("-debug", false))
Vars.debug = true; Vars.debug = true;
FileHandle handle = Gdx.files.internal("bundles/bundle");
Locale locale = Locale.getDefault();
Core.bundle = I18NBundle.createBundle(handle, locale);
Inputs.useControllers(false); Inputs.useControllers(false);
log("Total blocks loaded: " + Block.getAllBlocks().size); log("Total blocks loaded: " + Block.getAllBlocks().size);

View File

@@ -18,6 +18,7 @@ import io.anuke.ucore.scene.builders.table;
import io.anuke.ucore.scene.ui.ImageButton; import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.Label; import io.anuke.ucore.scene.ui.Label;
import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Tmp; import io.anuke.ucore.util.Tmp;
@@ -171,35 +172,30 @@ public class Tutorial{
} }
} }
enum Stage{ public enum Stage{
intro{ intro{
{ {
text = "[yellow]Welcome to the tutorial.[] To begin, press 'next'.";
} }
}, },
moveDesktop{ moveDesktop{
{ {
desktopOnly = true; desktopOnly = true;
text = "To move, use the [orange][[WASD][] keys. Hold [orange]shift[] to boost. Hold [orange]CTRL[] while using the [orange]scrollwheel[] to zoom in or out.";
} }
}, },
shoot{ shoot{
{ {
desktopOnly = true; desktopOnly = true;
text = "Use your mouse to aim, hold [orange]left mouse button[] to shoot. Try practicing on the [yellow]target[].";
} }
}, },
moveAndroid{ moveAndroid{
{ {
androidOnly = true; androidOnly = true;
text = "To pan the view, drag one finger across the screen. Pinch and drag to zoom in or out.";
} }
}, },
placeSelect{ placeSelect{
{ {
canBack = false; canBack = false;
canPlace = true; canPlace = true;
text = "Try selecting a [yellow]conveyor[] from the block menu in the bottom right.";
} }
void onSwitch(){ void onSwitch(){
@@ -216,7 +212,6 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -2; blockPlaceY = -2;
targetBlock = DistributionBlocks.conveyor; targetBlock = DistributionBlocks.conveyor;
text = "Use the [orange][[scrollwheel][] to rotate the conveyor to face [orange]forwards[], then place it in the [yellow]marked location[] using the [orange][[left mouse button][].";
} }
}, },
placeConveyorAndroid{ placeConveyorAndroid{
@@ -229,16 +224,12 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -2; blockPlaceY = -2;
targetBlock = DistributionBlocks.conveyor; targetBlock = DistributionBlocks.conveyor;
text = "Use the [orange][[rotate button][] to rotate the conveyor to face [orange]forwards[], drag it into position with one finger, then place it in the [yellow]marked location[] using the [orange][[checkmark][].";
} }
}, },
placeConveyorAndroidInfo{ placeConveyorAndroidInfo{
{ {
androidOnly = true; androidOnly = true;
canBack = false; canBack = false;
text = "Alternatively, you can press the crosshair icon in the bottom left to switch to [orange][[touch mode][], and "
+ "place blocks by tapping on the screen. In touch mode, blocks can be rotated with the arrow at the bottom left. "
+ "Press [yellow]next[] to try it out.";
} }
void onSwitch(){ void onSwitch(){
@@ -254,7 +245,6 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -3; blockPlaceY = -3;
targetBlock = ProductionBlocks.stonedrill; targetBlock = ProductionBlocks.stonedrill;
text = "Now, select and place a [yellow]stone drill[] at the marked location.";
} }
void onSwitch(){ void onSwitch(){
@@ -264,27 +254,23 @@ public class Tutorial{
blockInfo{ blockInfo{
{ {
canBack = true; canBack = true;
text = "If you want to learn more about a block, you can tap the [orange]question mark[] in the top right to read its description.";
} }
}, },
deselectDesktop{ deselectDesktop{
{ {
desktopOnly = true; desktopOnly = true;
canBack = false; canBack = false;
text = "You can de-select a block using the [orange][[right mouse button][].";
} }
}, },
deselectAndroid{ deselectAndroid{
{ {
androidOnly = true; androidOnly = true;
canBack = false; canBack = false;
text = "You can deselect a block by pressing the [orange]X[] button.";
} }
}, },
drillPlaced{ drillPlaced{
{ {
canBack = false; canBack = false;
text = "The drill will now produce [yellow]stone,[] output it onto the conveyor, then move it into the [yellow]core[].";
} }
void onSwitch(){ void onSwitch(){
@@ -293,18 +279,15 @@ public class Tutorial{
}, },
drillInfo{ drillInfo{
{ {
text = "Different ores need different drills. Stone requires stone drills, iron requires iron drills, etc.";
} }
}, },
drillPlaced2{ drillPlaced2{
{ {
text = "Moving items into the core puts them in your [yellow]item inventory[], in the top left. Placing blocks uses items from your inventory.";
} }
}, },
moreDrills{ moreDrills{
{ {
canBack = false; canBack = false;
text = "You can link many drills and conveyors up together, like so.";
} }
void onSwitch(){ void onSwitch(){
@@ -327,23 +310,20 @@ public class Tutorial{
targetBlock = Blocks.air; targetBlock = Blocks.air;
blockPlaceX = 2; blockPlaceX = 2;
blockPlaceY = -2; blockPlaceY = -2;
text = !Vars.android ? desktopOnly = true;
"You can delete blocks by clicking the [orange]right mouse button[] on the block you want to delete. Try deleting this conveyor.":
"You can delete blocks by [orange]selecting the crosshair[] in the [orange]break mode menu[] in the bottom left and tapping a block. Try deleting this conveyor.";
} }
}, },
/* deleteBlockAndroid{
deleteBlock2{
{ {
canBack = false; canBack = false;
canForward = false; canForward = false;
showBlock = true; showBlock = true;
targetBlock = Blocks.air; targetBlock = Blocks.air;
blockPlaceX = -2; blockPlaceX = 2;
blockPlaceY = -2; blockPlaceY = -2;
text = "Try deleting this other conveyor too."; androidOnly = true;
} }
},*/ },
placeTurret{ placeTurret{
{ {
canBack = false; canBack = false;
@@ -353,7 +333,6 @@ public class Tutorial{
targetBlock = WeaponBlocks.turret; targetBlock = WeaponBlocks.turret;
blockPlaceX = 2; blockPlaceX = 2;
blockPlaceY = 2; blockPlaceY = 2;
text = "Now, select and place a [yellow]turret[] at the [yellow]marked location[].";
} }
void onSwitch(){ void onSwitch(){
@@ -363,8 +342,6 @@ public class Tutorial{
placedTurretAmmo{ placedTurretAmmo{
{ {
canBack = false; canBack = false;
text = "This turret will now accept [yellow]ammo[] from the conveyor. You can see how much ammo it has by " +
(Vars.android ? "tapping it" : "hovering over it") + " and checking the [green]green bar[].";
} }
void onSwitch(){ void onSwitch(){
@@ -377,38 +354,30 @@ public class Tutorial{
turretExplanation{ turretExplanation{
{ {
canBack = false; canBack = false;
text = "Turrets will automatically shoot at the nearest enemy in range, as long as they have enough ammo.";
} }
}, },
waves{ waves{
{ {
text = "Every [yellow]" + (int)(Vars.wavespace/60) + "[] seconds, a wave of [coral]enemies[] will spawn in specific locations and attempt to destroy the core.";
} }
}, },
coreDestruction{ coreDestruction{
{ {
text = "Your objective is to [yellow]defend the core[]. If the core is destroyed, you [coral]lose the game[].";
} }
}, },
pausingDesktop{ pausingDesktop{
{ {
desktopOnly = true; desktopOnly = true;
text = "If you ever need to take a break, press the [orange]pause button[] in the top left or [orange]space[] "
+ "to pause the game. You can still select and place blocks while paused, but cannot move or shoot.";
} }
}, },
pausingAndroid{ pausingAndroid{
{ {
androidOnly = true; androidOnly = true;
text = "If you ever need to take a break, press the [orange]pause button[] in the top left"
+ " to pause the game. You can still place select and place blocks while paused.";
} }
}, },
purchaseWeapons{ purchaseWeapons{
{ {
desktopOnly = true; desktopOnly = true;
canBack = false; canBack = false;
text = "You can purchase new [yellow]weapons[] for your mech by opening the upgrade menu in the bottom left.";
} }
void onSwitch(){ void onSwitch(){
@@ -420,7 +389,6 @@ public class Tutorial{
{ {
canBack = false; canBack = false;
desktopOnly = true; desktopOnly = true;
text = "Switch weapons by either clicking its icon in the bottom left, or using numbers [orange][[1-9][].";
} }
void onSwitch(){ void onSwitch(){
@@ -435,7 +403,6 @@ public class Tutorial{
{ {
canBack = false; canBack = false;
canForward = false; canForward = false;
text = "Here comes a wave now. Destroy them.";
} }
void update(Tutorial t){ void update(Tutorial t){
@@ -453,7 +420,6 @@ public class Tutorial{
pumpDesc{ pumpDesc{
{ {
canBack = false; canBack = false;
text = "In later waves, you might need to use [yellow]pumps[] to distribute liquids for generators or extractors.";
} }
}, },
pumpPlace{ pumpPlace{
@@ -465,7 +431,6 @@ public class Tutorial{
targetBlock = ProductionBlocks.pump; targetBlock = ProductionBlocks.pump;
blockPlaceX = 6; blockPlaceX = 6;
blockPlaceY = -2; blockPlaceY = -2;
text = "Pumps work similarly to drills, except that they produce liquids instead of items. Try placing a pump on the [yellow]designated oil[].";
} }
void onSwitch(){ void onSwitch(){
@@ -484,7 +449,6 @@ public class Tutorial{
blockPlaceX = 5; blockPlaceX = 5;
blockPlaceY = -2; blockPlaceY = -2;
blockRotation = 2; blockRotation = 2;
text = "Now place a [orange]conduit[] leading away from the pump.";
} }
void onSwitch(){ void onSwitch(){
@@ -502,7 +466,6 @@ public class Tutorial{
blockPlaceX = 4; blockPlaceX = 4;
blockPlaceY = -2; blockPlaceY = -2;
blockRotation = 1; blockRotation = 1;
text = "And a few more...";
} }
void onSwitch(){ void onSwitch(){
@@ -519,7 +482,6 @@ public class Tutorial{
blockPlaceX = 4; blockPlaceX = 4;
blockPlaceY = -1; blockPlaceY = -1;
blockRotation = 1; blockRotation = 1;
text = "And a few more...";
} }
void onSwitch(){ void onSwitch(){
@@ -535,7 +497,6 @@ public class Tutorial{
targetBlock = ProductionBlocks.combustiongenerator; targetBlock = ProductionBlocks.combustiongenerator;
blockPlaceX = 4; blockPlaceX = 4;
blockPlaceY = 0; blockPlaceY = 0;
text = "Now, place a [orange]combustion generator[] block at the end of the conduit.";
} }
void onSwitch(){ void onSwitch(){
@@ -548,7 +509,6 @@ public class Tutorial{
generatorExplain{ generatorExplain{
{ {
canBack = false; canBack = false;
text = "This generator will now create [yellow]power[] from the oil.";
} }
}, },
lasers{ lasers{
@@ -557,7 +517,6 @@ public class Tutorial{
canForward = false; canForward = false;
showBlock = true; showBlock = true;
canPlace = true; canPlace = true;
text = "Power is distributed using [yellow]power lasers[]. Rotate and place one here.";
blockPlaceX = 4; blockPlaceX = 4;
blockPlaceY = 4; blockPlaceY = 4;
blockRotation = 2; blockRotation = 2;
@@ -571,14 +530,11 @@ public class Tutorial{
laserExplain{ laserExplain{
{ {
canBack = false; canBack = false;
text = "The generator will now move power into the laser block. An [yellow]opaque[] beam means that it is currently transmitting power, "
+ "and a [yellow]transparent[] beam means it is not.";
} }
}, },
laserMore{ laserMore{
{ {
canBack = false; canBack = false;
text = "You can check how much power a block has by hovering over it and checking the [yellow]yellow bar[] at the top.";
} }
}, },
healingTurret{ healingTurret{
@@ -591,7 +547,6 @@ public class Tutorial{
blockPlaceX = 1; blockPlaceX = 1;
blockPlaceY = 4; blockPlaceY = 4;
targetBlock = DefenseBlocks.repairturret; targetBlock = DefenseBlocks.repairturret;
text = "This laser can be used to power a [lime]repair turret[]. Place one here.";
} }
void onSwitch(){ void onSwitch(){
@@ -601,7 +556,6 @@ public class Tutorial{
healingTurretExplain{ healingTurretExplain{
{ {
canBack = false; canBack = false;
text = "As long as it has power, this turret will [lime]repair nearby blocks.[] When playing, make sure you get one in your base as quickly as possible!";
} }
}, },
smeltery{ smeltery{
@@ -614,7 +568,6 @@ public class Tutorial{
blockPlaceX = 0; blockPlaceX = 0;
blockPlaceY = -6; blockPlaceY = -6;
targetBlock = ProductionBlocks.smelter; targetBlock = ProductionBlocks.smelter;
text = "Many blocks require [orange]steel[] to make, which requires a [orange]smelter[] to craft. Place one here.";
} }
void onSwitch(){ void onSwitch(){
@@ -627,7 +580,6 @@ public class Tutorial{
smelterySetup{ smelterySetup{
{ {
canBack = false; canBack = false;
text = "This smelter will now produce [orange]steel[] from the input coal and iron.";
} }
void onSwitch(){ void onSwitch(){
@@ -643,11 +595,10 @@ public class Tutorial{
}, },
end{ end{
{ {
text = "And that concludes the tutorial! Good luck!";
canBack = false; canBack = false;
} }
}; };
String text = "no text"; public final String text = Bundles.getNotNull("tutorial."+name()+".text");
boolean androidOnly; boolean androidOnly;
boolean desktopOnly; boolean desktopOnly;

View File

@@ -43,6 +43,7 @@ import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.Window.WindowStyle; import io.anuke.ucore.scene.ui.Window.WindowStyle;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.ui.layout.Unit; import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Bundles;
public class UI extends SceneModule{ public class UI extends SceneModule{
Table loadingtable, desctable, configtable; Table loadingtable, desctable, configtable;
@@ -190,20 +191,18 @@ public class UI extends SceneModule{
settingserror.hide(); settingserror.hide();
}).size(80f, 55f).pad(4); }).size(80f, 55f).pad(4);
gameerror = new Dialog("An error has occured", "dialog"); gameerror = new Dialog("$text.error.crashtitle", "dialog");
gameerror.content().add(new Label("[SCARLET]An unexpected error has occured, which would have caused a crash. " gameerror.content().labelWrap("$text.error.crashmessage").width(600f).pad(10f);
+ "[]Please report the exact circumstances under which this error occured to the developer: " gameerror.buttons().addButton("#text.ok", gameerror::hide).size(200f, 50);
+ "\n[ORANGE]anukendev@gmail.com[]"){{
setWrap(true);
}}).width(600f).pad(10f);
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
discord = new Dialog("Discord", "dialog"); discord = new Dialog("Discord", "dialog");
discord.content().margin(12f); discord.content().margin(12f);
discord.content().add("Join the mindustry discord!\n[orange]" + Vars.discordURL); discord.content().add("$text.discord");
discord.content().row();
discord.content().add("[orange]"+Vars.discordURL);
discord.buttons().defaults().size(200f, 50); discord.buttons().defaults().size(200f, 50);
discord.buttons().addButton("Open link", () -> Mindustry.platforms.openLink(Vars.discordURL)); discord.buttons().addButton("$text.openlink", () -> Mindustry.platforms.openLink(Vars.discordURL));
discord.buttons().addButton("Back", discord::hide); discord.buttons().addButton("$text.back", discord::hide);
load = new LoadDialog(); load = new LoadDialog();
@@ -218,18 +217,18 @@ public class UI extends SceneModule{
prefs.sound.volumePrefs(); prefs.sound.volumePrefs();
prefs.game.sliderPref("difficulty", "Difficulty", 1, 0, 2, i -> i == 0 ? "Easy" : i == 1 ? "Normal" : "Hard"); prefs.game.sliderPref("difficulty", 1, 0, 2, i -> Bundles.get("setting.difficulty." + (i == 0 ? "easy" : i == 1 ? "normal" : "hard")));
prefs.game.screenshakePref(); prefs.game.screenshakePref();
prefs.game.checkPref("smoothcam", "Smooth Camera", true); prefs.game.checkPref("smoothcam", true);
prefs.game.checkPref("indicators", "Enemy Indicators", true); prefs.game.checkPref("indicators", true);
prefs.game.checkPref("effects", "Display Effects", true); prefs.game.checkPref("effects", true);
prefs.game.sliderPref("sensitivity", "Controller Sensitivity", 100, 10, 300, i -> i + "%"); prefs.game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
prefs.graphics.checkPref("fps", "Show FPS", false); prefs.graphics.checkPref("fps", false);
prefs.graphics.checkPref("vsync", "VSync", true, b -> Gdx.graphics.setVSync(b)); prefs.graphics.checkPref("vsync", true, b -> Gdx.graphics.setVSync(b));
prefs.graphics.checkPref("lasers", "Show Power Lasers", true); prefs.graphics.checkPref("lasers", true);
prefs.graphics.checkPref("healthbars", "Show Entity Health bars", true); prefs.graphics.checkPref("healthbars", true);
prefs.graphics.checkPref("pixelate", "Pixelate Screen", true, b->{ prefs.graphics.checkPref("pixelate", true, b->{
if(b){ if(b){
Vars.renderer.pixelSurface.setScale(Core.cameraScale); Vars.renderer.pixelSurface.setScale(Core.cameraScale);
Vars.renderer.shadowSurface.setScale(Core.cameraScale); Vars.renderer.shadowSurface.setScale(Core.cameraScale);
@@ -270,19 +269,20 @@ public class UI extends SceneModule{
about.content().row(); about.content().row();
} }
restart = new Dialog("The core was destroyed.", "dialog"); restart = new Dialog("$text.gameover", "dialog");
restart.shown(()->{ restart.shown(()->{
restart.content().clearChildren(); restart.content().clearChildren();
if(control.isHighScore()){ if(control.isHighScore()){
restart.content().add("[YELLOW]New highscore!").pad(6); restart.content().add("$text.highscore").pad(6);
restart.content().row(); restart.content().row();
} }
restart.content().add("You lasted until wave [GREEN]" + control.getWave() + "[].").pad(12).get(); restart.content().add("$text.lasted").pad(12).get();
restart.content().add("[GREEN]" + control.getWave());
restart.pack(); restart.pack();
}); });
restart.getButtonTable().addButton("Back to menu", ()->{ restart.getButtonTable().addButton("$text.menu", ()->{
restart.hide(); restart.hide();
GameState.set(State.menu); GameState.set(State.menu);
control.reset(); control.reset();
@@ -305,7 +305,7 @@ public class UI extends SceneModule{
get().addImage("white").growX() get().addImage("white").growX()
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent")); .height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
row(); row();
new label("[accent]Loading..."){{ new label("$text.loading"){{
get().setName("namelabel"); get().setName("namelabel");
}}.pad(10); }}.pad(10);
row(); row();
@@ -370,7 +370,7 @@ public class UI extends SceneModule{
} }
public void showError(String text){ public void showError(String text){
new Dialog("[crimson]An error has occured", "dialog"){{ new Dialog("$text.error.title", "dialog"){{
content().margin(15); content().margin(15);
content().add(text); content().add(text);
getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4); getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4);
@@ -378,7 +378,7 @@ public class UI extends SceneModule{
} }
public void showErrorClose(String text){ public void showErrorClose(String text){
new Dialog("[crimson]A critical error has occured", "dialog"){{ new Dialog("$text.error.title", "dialog"){{
content().margin(15); content().margin(15);
content().add(text); content().add(text);
getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4); getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4);
@@ -386,7 +386,7 @@ public class UI extends SceneModule{
} }
public void showLoading(){ public void showLoading(){
showLoading("[accent]Loading.."); showLoading("$text.loading");
} }
public void showLoading(String text){ public void showLoading(String text){
@@ -480,12 +480,16 @@ public class UI extends SceneModule{
((HudFragment)hudfrag).updateItems(); ((HudFragment)hudfrag).updateItems();
} }
public MindustrySettingsDialog getPrefs() {
return prefs;
}
public void showConfirm(String title, String text, Listenable confirmed){ public void showConfirm(String title, String text, Listenable confirmed){
FloatingDialog dialog = new FloatingDialog(title); FloatingDialog dialog = new FloatingDialog(title);
dialog.content().add(text).pad(4f); dialog.content().add(text).pad(4f);
dialog.buttons().defaults().size(200f, 54f).pad(2f); dialog.buttons().defaults().size(200f, 54f).pad(2f);
dialog.buttons().addButton("Cancel", dialog::hide); dialog.buttons().addButton("$text.cancel", dialog::hide);
dialog.buttons().addButton("OK", () -> { dialog.buttons().addButton("$text.ok", () -> {
dialog.hide(); dialog.hide();
confirmed.listen(); confirmed.listen();
}); });

View File

@@ -0,0 +1,79 @@
package io.anuke.mindustry.io;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.files.FileHandle;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.Tutorial;
import io.anuke.mindustry.core.Tutorial.Stage;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.resource.Weapon;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.GameMode;
import io.anuke.mindustry.world.Map;
import io.anuke.ucore.core.Inputs.DeviceType;
import io.anuke.ucore.core.KeyBinds;
import io.anuke.ucore.core.KeyBinds.Keybind;
import io.anuke.ucore.scene.ui.SettingsDialog.SettingsTable.Setting;
import io.anuke.ucore.util.Mathf;
import java.io.File;
public class BundleUtil {
private static FileHandle file;
public static void buildBundle(FileHandle file){
BundleUtil.file = file;
file.writeString("", false);
write("about.text=" + join(Vars.aboutText));
write("discord.text=Join the mindustry discord!\n[orange]");
Mathf.each(table -> {
for(Setting setting : table.getSettings()){
write("setting." + setting.name + ".name=" + setting.title);
}
}, Vars.ui.getPrefs().game, Vars.ui.getPrefs().graphics, Vars.ui.getPrefs().sound);
for(Map map : Vars.world.maps().list()){
write("map." + map.name + ".name=" + map.name);
}
for(Tutorial.Stage stage : Stage.values()){
write("tutorial." + stage.name() + ".text=" + stage.text);
}
for(Keybind bind : KeyBinds.getSection("default").keybinds.get(DeviceType.keyboard)){
write("keybind." + bind.name + ".name=" + bind.name);
}
for(GameMode mode : GameMode.values()){
write("mode." + mode.name() + ".name=" + mode.name());
}
for(Weapon weapon : Weapon.values()){
write("weapon." + weapon.name() + ".name=" + weapon.name());
write("weapon." + weapon.name() + ".description=" + weapon.description);
}
for(Item item : Item.values()){
write("item." + item.name() + ".name=" + item.name());
}
for(Liquid liquid : Liquid.values()){
write("liquid." + liquid.name() + ".name=" + liquid.name());
}
for(Block block : Block.getAllBlocks()){
write("block." + block.name + ".name=" + block.formalName);
if(block.fullDescription != null) write("block." + block.name + ".fulldescription=" + block.fullDescription);
if(block.description != null) write("block." + block.name + ".description=" + block.description);
}
}
private static void write(String string){
file.writeString(string.replaceAll("\\n", "\\\\n") + "\n", true);
}
public static String join(String[] strings){
String s = "";
for(String string : strings){
s += string + "\n";
}
return s;
}
}

View File

@@ -12,10 +12,11 @@ import io.anuke.mindustry.graphics.Fx;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.entities.Entity; import io.anuke.ucore.entities.Entity;
import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public enum Weapon{ public enum Weapon{
blaster(15, BulletType.shot, "Shoots a slow, weak bullet."){ blaster(15, BulletType.shot){
{ {
unlocked = true; unlocked = true;
} }
@@ -26,7 +27,7 @@ public enum Weapon{
Effects.effect(Fx.shoot3, p.x + vector.x, p.y+vector.y); Effects.effect(Fx.shoot3, p.x + vector.x, p.y+vector.y);
} }
}, },
triblaster(13, BulletType.shot, "Shoots 3 bullets in a spread.", stack(Item.iron, 40)){ triblaster(13, BulletType.shot, stack(Item.iron, 40)){
@Override @Override
public void shoot(Player p){ public void shoot(Player p){
@@ -41,7 +42,7 @@ public enum Weapon{
} }
}, },
multigun(6, BulletType.multishot, "Shoots inaccurate bullets with a high\nrate of fire.", stack(Item.iron, 60), stack(Item.steel, 20)){ multigun(6, BulletType.multishot, stack(Item.iron, 60), stack(Item.steel, 20)){
@Override @Override
public void shoot(Player p){ public void shoot(Player p){
float ang = mouseAngle(p); float ang = mouseAngle(p);
@@ -52,7 +53,7 @@ public enum Weapon{
Effects.effect(Fx.shoot2, p.x + vector.x, p.y+vector.y); Effects.effect(Fx.shoot2, p.x + vector.x, p.y+vector.y);
} }
}, },
flamer(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){ flamer(5, BulletType.flame, stack(Item.steel, 60), stack(Item.coal, 60)){
{ {
shootsound = "flame2"; shootsound = "flame2";
@@ -67,7 +68,7 @@ public enum Weapon{
bullet(p, p.x, p.y, ang + Mathf.range(12)); bullet(p, p.x, p.y, ang + Mathf.range(12));
} }
}, },
railgun(40, BulletType.sniper, "Shoots one long-range bullet.", stack(Item.steel, 60), stack(Item.iron, 60)){ railgun(40, BulletType.sniper, stack(Item.steel, 60), stack(Item.iron, 60)){
{ {
shootsound = "railgun"; shootsound = "railgun";
@@ -81,7 +82,7 @@ public enum Weapon{
Effects.effect(Fx.railshoot, p.x + vector.x, p.y+vector.y); Effects.effect(Fx.railshoot, p.x + vector.x, p.y+vector.y);
} }
}, },
mortar(100, BulletType.shell, "Shoots a slow, but damaging shell.", stack(Item.titanium, 40), stack(Item.steel, 60)){ mortar(100, BulletType.shell, stack(Item.titanium, 40), stack(Item.steel, 60)){
{ {
shootsound = "bigshot"; shootsound = "bigshot";
@@ -100,15 +101,15 @@ public enum Weapon{
public String shootsound = "shoot"; public String shootsound = "shoot";
public boolean unlocked; public boolean unlocked;
public ItemStack[] requirements; public ItemStack[] requirements;
public String description = "no desc for you"; public final String description;
Vector2 vector = new Vector2(); Vector2 vector = new Vector2();
private Weapon(float reload, BulletType type, String desc, ItemStack... requirements){ private Weapon(float reload, BulletType type, ItemStack... requirements){
this.reload = reload; this.reload = reload;
this.type = type; this.type = type;
this.requirements = requirements; this.requirements = requirements;
this.description = desc; this.description = Bundles.getNotNull("weapon."+name()+".description");
} }
public void shoot(Player p){ public void shoot(Player p){

View File

@@ -59,7 +59,7 @@ public class FileChooser extends FloatingDialog{
if(!open) Mindustry.platforms.addDialog(filefield); if(!open) Mindustry.platforms.addDialog(filefield);
filefield.setDisabled(open); filefield.setDisabled(open);
ok = new TextButton(open ? "Open" : "Save"); ok = new TextButton(open ? "$text.save" : "$text.save");
ok.clicked(() -> { ok.clicked(() -> {
if(ok.isDisabled()) return; if(ok.isDisabled()) return;
@@ -74,8 +74,8 @@ public class FileChooser extends FloatingDialog{
filefield.change(); filefield.change();
TextButton cancel = new TextButton("Cancel"); TextButton cancel = new TextButton("$text.cancel");
cancel.clicked(() -> hide()); cancel.clicked(this::hide);
navigation = new TextField(""); navigation = new TextField("");
navigation.setTouchable(Touchable.disabled); navigation.setTouchable(Touchable.disabled);

View File

@@ -14,6 +14,7 @@ import io.anuke.ucore.scene.ui.layout.Stack;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.utils.ClickListener; import io.anuke.ucore.scene.utils.ClickListener;
import io.anuke.ucore.scene.utils.Elements; import io.anuke.ucore.scene.utils.Elements;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Tmp; import io.anuke.ucore.util.Tmp;
public class LevelDialog extends FloatingDialog{ public class LevelDialog extends FloatingDialog{
@@ -22,7 +23,7 @@ public class LevelDialog extends FloatingDialog{
private ScrollPane pane; private ScrollPane pane;
public LevelDialog(){ public LevelDialog(){
super("Level Select"); super("$text.level.select");
getTitleTable().getCell(title()).growX().center(); getTitleTable().getCell(title()).growX().center();
getTitleTable().center(); getTitleTable().center();
addCloseButton(); addCloseButton();
@@ -43,10 +44,10 @@ public class LevelDialog extends FloatingDialog{
Table selmode = new Table(); Table selmode = new Table();
ButtonGroup<TextButton> group = new ButtonGroup<>(); ButtonGroup<TextButton> group = new ButtonGroup<>();
selmode.add("Gamemode: ").padRight(10f); selmode.add("$text.level.mode").padRight(15f);
for(GameMode mode : GameMode.values()){ for(GameMode mode : GameMode.values()){
TextButton b = Elements.newButton(mode.toString(), "toggle", ()->{ TextButton b = Elements.newButton("$mode."+mode.name()+".name", "toggle", ()->{
Vars.control.setMode(mode); Vars.control.setMode(mode);
}); });
group.add(b); group.add(b);
@@ -66,9 +67,9 @@ public class LevelDialog extends FloatingDialog{
} }
Table inset = new Table("pane-button"); Table inset = new Table("pane-button");
inset.add("[accent]"+map.name).pad(3f); inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f);
inset.row(); inset.row();
inset.label((() -> "High Score: [accent]" + Settings.getInt("hiscore" + map.name))) inset.label((() -> Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name))))
.pad(3f); .pad(3f);
inset.pack(); inset.pack();
@@ -87,7 +88,7 @@ public class LevelDialog extends FloatingDialog{
image.row(); image.row();
delete[0] = image.addButton("Delete", () -> { delete[0] = image.addButton("Delete", () -> {
Timers.run(1f, () -> { Timers.run(1f, () -> {
Vars.ui.showConfirm("Confirm Delete", "Are you sure you want to delete\nthe map \"[orange]" + map.name + "[]\"?", () -> { Vars.ui.showConfirm("$text.level.delete.title", Bundles.format("text.level.delete", Bundles.get("map."+map.name+".name", map.name)), () -> {
Vars.world.maps().removeMap(map); Vars.world.maps().removeMap(map);
reload(); reload();
Core.scene.setScrollFocus(pane); Core.scene.setScrollFocus(pane);

View File

@@ -12,12 +12,13 @@ import io.anuke.ucore.scene.ui.Label;
import io.anuke.ucore.scene.ui.ScrollPane; import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
public class LoadDialog extends FloatingDialog{ public class LoadDialog extends FloatingDialog{
ScrollPane pane; ScrollPane pane;
public LoadDialog() { public LoadDialog() {
this("Load Game"); this("$text.loadgame");
} }
public LoadDialog(String title) { public LoadDialog(String title) {
@@ -35,7 +36,7 @@ public class LoadDialog extends FloatingDialog{
private void setup(){ private void setup(){
content().clear(); content().clear();
content().add("Select a save slot.").padBottom(2); content().add("$text.selectslot").padBottom(2);
content().row(); content().row();
Table slots = new Table(); Table slots = new Table();
@@ -46,15 +47,15 @@ public class LoadDialog extends FloatingDialog{
for(int i = 0; i < Vars.saveSlots; i++){ for(int i = 0; i < Vars.saveSlots; i++){
TextButton button = new TextButton("[accent]Slot " + (i + 1)); TextButton button = new TextButton(Bundles.format("text.slot", (i + 1)));
button.margin(12); button.margin(12);
button.getLabelCell().top().left().growX(); button.getLabelCell().top().left().growX();
button.row(); button.row();
Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? "<empty>" : SaveIO.getMode(i) + ", " Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? Bundles.get("text.empty") : SaveIO.getMode(i) + ", "
+ SaveIO.getMap(i).name + ", Wave " + SaveIO.getWave(i) + SaveIO.getMap(i).name + ", " + Bundles.format("text.save.wave", SaveIO.getWave(i)) + "\n"
+ "\nLast Saved: " + SaveIO.getTimeString(i))); + Bundles.format("text.save.date", SaveIO.getTimeString(i))));
info.setAlignment(Align.center, Align.center); info.setAlignment(Align.center, Align.center);
button.add(info).padBottom(3).padTop(7); button.add(info).padBottom(3).padTop(7);
@@ -88,7 +89,7 @@ public class LoadDialog extends FloatingDialog{
Vars.ui.hideMenu(); Vars.ui.hideMenu();
GameState.set(State.menu); GameState.set(State.menu);
Vars.control.reset(); Vars.control.reset();
Vars.ui.showError("[orange]Save file corrupted or invalid!"); Vars.ui.showError("$text.save.corrupted");
return; return;
} }
}); });

View File

@@ -31,32 +31,32 @@ public class MenuDialog extends FloatingDialog{
if(!Vars.android){ if(!Vars.android){
content().defaults().width(220).height(50); content().defaults().width(220).height(50);
content().addButton("Back", () -> { content().addButton("$text.back", () -> {
hide(); hide();
if(!wasPaused) if(!wasPaused)
GameState.set(State.playing); GameState.set(State.playing);
}); });
content().row(); content().row();
content().addButton("Settings", () -> { content().addButton("$text.settings", () -> {
ui.showPrefs(); ui.showPrefs();
}); });
if(!Vars.gwt){ if(!Vars.gwt){
content().row(); content().row();
content().addButton("Save Game", () -> { content().addButton("$text.savegame", () -> {
save.show(); save.show();
}); });
content().row(); content().row();
content().addButton("Load Game", () -> { content().addButton("$text.loadgame", () -> {
load.show(); load.show();
}); });
} }
content().row(); content().row();
content().addButton("Quit", () -> { content().addButton("$text.quit", () -> {
new ConfirmDialog("Confirm", "Are you sure you want to quit?", () -> { new ConfirmDialog("$text.confirm", "$text.quit.confirm", () -> {
hide(); hide();
GameState.set(State.menu); GameState.set(State.menu);
}){ }){
@@ -79,16 +79,16 @@ public class MenuDialog extends FloatingDialog{
hide(); hide();
if(!wasPaused) if(!wasPaused)
GameState.set(State.playing); GameState.set(State.playing);
}).text("Back").padTop(4f); }).text("$text.back").padTop(4f);
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("Settings").padTop(4f); new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
new imagebutton("icon-save", isize, ()-> save.show()).text("Save").padTop(4f); new imagebutton("icon-save", isize, ()-> save.show()).text("$text.save").padTop(4f);
new imagebutton("icon-load", isize, () -> load.show()).text("Load").padTop(4f); new imagebutton("icon-load", isize, () -> load.show()).text("$text.load").padTop(4f);
new imagebutton("icon-quit", isize, () -> { new imagebutton("icon-quit", isize, () -> {
new ConfirmDialog("Confirm", "Are you sure you want to quit?", () -> { new ConfirmDialog("$text.confirm", "$text.quit.confirm", () -> {
hide(); hide();
GameState.set(State.menu); GameState.set(State.menu);
}){{ }){{

View File

@@ -21,7 +21,7 @@ public class MindustryKeybindDialog extends KeybindDialog{
@Override @Override
public void addCloseButton(){ public void addCloseButton(){
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, this::hide).size(230f, 64f); buttons().addImageTextButton("$text.back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
keyDown(key->{ keyDown(key->{
if(key == Keys.ESCAPE || key == Keys.BACK) if(key == Keys.ESCAPE || key == Keys.BACK)

View File

@@ -39,7 +39,7 @@ public class MindustrySettingsDialog extends SettingsDialog{
Consumer<SettingsTable> s = table -> { Consumer<SettingsTable> s = table -> {
table.row(); table.row();
table.addImageTextButton("Back", "icon-arrow-left", 10*3, this::back).size(240f, 60f).colspan(2).padTop(15f); table.addImageTextButton("$text.back", "icon-arrow-left", 10*3, this::back).size(240f, 60f).colspan(2).padTop(15f);
}; };
game = new SettingsTable(s); game = new SettingsTable(s);
@@ -51,15 +51,15 @@ public class MindustrySettingsDialog extends SettingsDialog{
prefs.margin(14f); prefs.margin(14f);
menu.defaults().size(300f, 60f).pad(3f); menu.defaults().size(300f, 60f).pad(3f);
menu.addButton("Game", () -> visible(0)); menu.addButton("$text.settings.game", () -> visible(0));
menu.row(); menu.row();
menu.addButton("Graphics", () -> visible(1)); menu.addButton("$text.settings.graphics", () -> visible(1));
menu.row(); menu.row();
menu.addButton("Sound", () -> visible(2)); menu.addButton("$text.settings.sound", () -> visible(2));
if(!Vars.android) { if(!Vars.android) {
menu.row(); menu.row();
menu.addButton("Controls", () -> Vars.ui.showControls()); menu.addButton("$text.settings.controls", () -> Vars.ui.showControls());
} }
prefs.clearChildren(); prefs.clearChildren();
@@ -89,7 +89,7 @@ public class MindustrySettingsDialog extends SettingsDialog{
@Override @Override
public void addCloseButton(){ public void addCloseButton(){
buttons().addImageTextButton("Menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f); buttons().addImageTextButton("$text.menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
keyDown(key->{ keyDown(key->{
if(key == Keys.ESCAPE || key == Keys.BACK) if(key == Keys.ESCAPE || key == Keys.BACK)

View File

@@ -8,18 +8,19 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.scene.ui.ConfirmDialog; import io.anuke.ucore.scene.ui.ConfirmDialog;
import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Cell; import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.util.Bundles;
public class SaveDialog extends LoadDialog{ public class SaveDialog extends LoadDialog{
public SaveDialog() { public SaveDialog() {
super("Save Game"); super("$text.savegame");
} }
@Override @Override
public void modifyButton(TextButton button, int slot){ public void modifyButton(TextButton button, int slot){
button.clicked(() -> { button.clicked(() -> {
if(SaveIO.isSaveValid(slot)){ if(SaveIO.isSaveValid(slot)){
new ConfirmDialog("Overwrite", "Are you sure you want to overwrite\nthis save slot?", () -> { new ConfirmDialog("$text.overwrite", "$text.save.overwrite", () -> {
save(slot); save(slot);
}){ }){
{ {
@@ -35,7 +36,7 @@ public class SaveDialog extends LoadDialog{
} }
void save(int slot){ void save(int slot){
Vars.ui.showLoading("[accent]Saving..."); Vars.ui.showLoading("text.saveload");
Timers.runTask(5f, () -> { Timers.runTask(5f, () -> {
hide(); hide();
@@ -45,7 +46,7 @@ public class SaveDialog extends LoadDialog{
}catch(Throwable e){ }catch(Throwable e){
e = (e.getCause() == null ? e : e.getCause()); e = (e.getCause() == null ? e : e.getCause());
Vars.ui.showError("[orange]Failed to save game!\n[white]" + ClassReflection.getSimpleName(e.getClass()) + ": " + e.getMessage() + "\n" + "at " + e.getStackTrace()[0].getFileName() + ":" + e.getStackTrace()[0].getLineNumber()); Vars.ui.showError("[orange]"+Bundles.get("text.savefail")+"\n[white]" + ClassReflection.getSimpleName(e.getClass()) + ": " + e.getMessage() + "\n" + "at " + e.getStackTrace()[0].getFileName() + ":" + e.getStackTrace()[0].getLineNumber());
} }
}); });
} }

View File

@@ -21,7 +21,7 @@ public class UpgradeDialog extends FloatingDialog{
boolean wasPaused = false; boolean wasPaused = false;
public UpgradeDialog() { public UpgradeDialog() {
super("Upgrades"); super("$text.upgrades");
setup(); setup();
} }
@@ -107,7 +107,7 @@ public class UpgradeDialog extends FloatingDialog{
tiptable.add("[gray]" + description).left(); tiptable.add("[gray]" + description).left();
tiptable.row(); tiptable.row();
if(control.hasWeapon(weapon)){ if(control.hasWeapon(weapon)){
tiptable.add("[LIME]Purchased!").padTop(6).left(); tiptable.add("$text.purchased").padTop(6).left();
} }
tiptable.margin(14f); tiptable.margin(14f);
}; };
@@ -131,7 +131,7 @@ public class UpgradeDialog extends FloatingDialog{
}); });
} }
content().add("Weapons"); content().add("$text.weapons");
content().row(); content().row();
content().add(weptab); content().add(weptab);
content().row(); content().row();

View File

@@ -2,9 +2,12 @@ package io.anuke.mindustry.ui.fragments;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.core.GameState; import io.anuke.mindustry.core.GameState;
@@ -13,9 +16,11 @@ import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.resource.Recipe; import io.anuke.mindustry.resource.Recipe;
import io.anuke.mindustry.resource.Section; import io.anuke.mindustry.resource.Section;
import io.anuke.mindustry.ui.FloatingDialog; import io.anuke.mindustry.ui.FloatingDialog;
import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.scene.actions.Actions;
import io.anuke.ucore.scene.builders.button; import io.anuke.ucore.scene.builders.button;
import io.anuke.ucore.scene.builders.imagebutton; import io.anuke.ucore.scene.builders.imagebutton;
import io.anuke.ucore.scene.builders.table; import io.anuke.ucore.scene.builders.table;
@@ -23,6 +28,7 @@ import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Stack; import io.anuke.ucore.scene.ui.layout.Stack;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public class BlocksFragment implements Fragment{ public class BlocksFragment implements Fragment{
@@ -38,7 +44,7 @@ public class BlocksFragment implements Fragment{
visible(() -> !GameState.is(State.menu)); visible(() -> !GameState.is(State.menu));
new table(){{ Table blocks = new table(){{
new table("button") {{ new table("button") {{
visible(() -> player.recipe != null); visible(() -> player.recipe != null);
@@ -108,10 +114,8 @@ public class BlocksFragment implements Fragment{
image.getImageCell().size(size); image.getImageCell().size(size);
image.update(() -> { image.update(() -> {
boolean canPlace = !control.getTutorial().active() || control.getTutorial().canPlace(); boolean canPlace = !control.getTutorial().active() || control.getTutorial().canPlace();
boolean has = (control.hasItems(r.requirements)) && canPlace; boolean has = (control.hasItems(r.requirements)) && canPlace;
//image.setDisabled(!has);
image.setChecked(player.recipe == r); image.setChecked(player.recipe == r);
image.setTouchable(canPlace ? Touchable.enabled : Touchable.disabled); image.setTouchable(canPlace ? Touchable.enabled : Touchable.disabled);
image.getImage().setColor(has ? Color.WHITE : Hue.lightness(0.33f)); image.getImage().setColor(has ? Color.WHITE : Hue.lightness(0.33f));
@@ -133,22 +137,42 @@ public class BlocksFragment implements Fragment{
add(stack).colspan(Section.values().length); add(stack).colspan(Section.values().length);
margin(10f); margin(10f);
get().marginLeft(0f); marginLeft(0f);
get().marginRight(0f); marginRight(0f);
end(); end();
}}.right().bottom().uniformX(); }}.right().bottom().uniformX();
visible(() -> !GameState.is(State.menu) && shown); visible(() -> !GameState.is(State.menu) && shown);
}}.end(); }}.end().get();
row(); row();
new imagebutton("icon-arrow-down", 10*2, () -> { ImageButton buttons[] = new ImageButton[2];
shown = !shown; float size = 46f;
}).padBottom(-5).uniformX().fillX()
.update(i -> i.getStyle().imageUp = Core.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up")); float t = 0.2f;
Interpolation ip = Interpolation.pow3Out;
//TODO fix glitch when resizing
buttons[0] = new imagebutton("icon-arrow-down", 10*2, () -> {
if(blocks.getActions().size != 0) return;
blocks.actions(Actions.translateBy(0, -blocks.getHeight(), t, ip), Actions.call(() -> shown = false));
buttons[0].actions(Actions.fadeOut(t));
buttons[1].actions(Actions.fadeIn(t));
}).padBottom(-5).visible(() -> shown).height(size).uniformX().fillX()
.update(i -> i.getStyle().imageUp = Core.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up")).get();
buttons[1] = new imagebutton("icon-arrow-up", 10*2, () -> {
if(blocks.getActions().size != 0) return;
blocks.actions(Actions.translateBy(0, blocks.getHeight(), t, ip));
shown = true;
buttons[0].actions(Actions.fadeIn(t));
buttons[1].actions(Actions.fadeOut(t));
}).touchable(() -> shown ? Touchable.disabled : Touchable.enabled).size(size).padBottom(-5).padLeft(-size).get();
buttons[1].getColor().a = 0f;
}}.end(); }}.end();
} }
@@ -187,7 +211,7 @@ public class BlocksFragment implements Fragment{
boolean wasPaused = GameState.is(State.paused); boolean wasPaused = GameState.is(State.paused);
GameState.set(State.paused); GameState.set(State.paused);
FloatingDialog d = new FloatingDialog("Block Info"); FloatingDialog d = new FloatingDialog("$text.blocks.blockinfo");
Table table = new Table(); Table table = new Table();
table.defaults().pad(1f); table.defaults().pad(1f);
ScrollPane pane = new ScrollPane(table, "clear"); ScrollPane pane = new ScrollPane(table, "clear");
@@ -204,7 +228,7 @@ public class BlocksFragment implements Fragment{
d.content().add(pane).grow(); d.content().add(pane).grow();
if(statlist.size > 0){ if(statlist.size > 0){
table.add("[accent]extra block info:").padTop(6).padBottom(5).left(); table.add("$text.blocks.extrainfo").padTop(6).padBottom(5).left();
table.row(); table.row();
} }
@@ -213,7 +237,7 @@ public class BlocksFragment implements Fragment{
table.row(); table.row();
} }
d.buttons().addButton("OK", ()->{ d.buttons().addButton("$text.ok", ()->{
if(!wasPaused) GameState.set(State.playing); if(!wasPaused) GameState.set(State.playing);
d.hide(); d.hide();
}).size(110, 50).pad(10f); }).size(110, 50).pad(10f);
@@ -252,7 +276,7 @@ public class BlocksFragment implements Fragment{
desctable.row(); desctable.row();
Label label = new Label("[health]health: " + recipe.result.health + (recipe.result.description == null ? Label label = new Label("[health]"+ Bundles.get("text.health")+": " + recipe.result.health + (recipe.result.description == null ?
"" : ("\n[]" + recipe.result.description))); "" : ("\n[]" + recipe.result.description)));
label.setWrap(true); label.setWrap(true);
desctable.add(label).width(200).padTop(4).padBottom(2); desctable.add(label).width(200).padTop(4).padBottom(2);

View File

@@ -23,6 +23,7 @@ import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.Label; import io.anuke.ucore.scene.ui.Label;
import io.anuke.ucore.scene.ui.layout.Cell; import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
public class HudFragment implements Fragment{ public class HudFragment implements Fragment{
private Table itemtable, respawntable; private Table itemtable, respawntable;
@@ -91,7 +92,7 @@ public class HudFragment implements Fragment{
atop(); atop();
new table("pane"){{ new table("pane"){{
new label("[orange]< paused >").scale(0.75f).pad(6); new label("[orange]< "+ Bundles.get("text.paused") + " >").scale(0.75f).pad(6);
}}.end(); }}.end();
}}.end(); }}.end();
@@ -122,7 +123,7 @@ public class HudFragment implements Fragment{
new table(){{ new table(){{
new table("pane"){{ new table("pane"){{
new label(()->"[orange]Respawning in " + (int)(control.getRespawnTime()/60)).scale(0.75f).pad(10); new label(()->"[orange]"+Bundles.get("text.respawn")+" " + (int)(control.getRespawnTime()/60)).scale(0.75f).pad(10);
visible(()->control.getRespawnTime() > 0 && !GameState.is(State.menu)); visible(()->control.getRespawnTime() > 0 && !GameState.is(State.menu));
@@ -149,10 +150,10 @@ public class HudFragment implements Fragment{
} }
} }
private String printEnemiesRemaining() { private String getEnemiesRemaining() {
if(control.getEnemiesRemaining() == 1) { if(control.getEnemiesRemaining() == 1) {
return " enemy left"; return Bundles.format("text.single", control.getEnemiesRemaining());
} else return " enemies left"; } else return Bundles.format("text.enemies", control.getEnemiesRemaining());
} }
private void addWaveTable(){ private void addWaveTable(){
@@ -163,13 +164,14 @@ public class HudFragment implements Fragment{
new table(){{ new table(){{
aleft(); aleft();
new label(()->"[orange]Wave " + control.getWave()).scale(fontscale*1.5f).left(); new label(() -> Bundles.format("text.wave", control.getWave())).scale(fontscale*1.5f).left();
row(); row();
new label(()-> control.getEnemiesRemaining() > 0 ? new label(()-> control.getEnemiesRemaining() > 0 ?
control.getEnemiesRemaining() + printEnemiesRemaining() : getEnemiesRemaining() :
(control.getTutorial().active() || Vars.control.getMode().toggleWaves) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f)) (control.getTutorial().active() || Vars.control.getMode().toggleWaves) ? "$text.waiting"
: Bundles.format("text.wave.waiting", (int) (control.getWaveCountdown() / 60f)))
.minWidth(140).left(); .minWidth(140).left();
margin(12f); margin(12f);

View File

@@ -56,22 +56,22 @@ public class MenuFragment implements Fragment{
defaults().size(120f).pad(5); defaults().size(120f).pad(5);
float isize = 14f*4; float isize = 14f*4;
new imagebutton("icon-play-2", isize, () -> ui.showLevels()).text("Play").padTop(4f); new imagebutton("icon-play-2", isize, () -> ui.showLevels()).text("$text.play").padTop(4f);
new imagebutton("icon-tutorial", isize, () -> control.playMap(world.maps().getMap("tutorial"))).text("Tutorial").padTop(4f); new imagebutton("icon-tutorial", isize, () -> control.playMap(world.maps().getMap("tutorial"))).text("$text.tutorial").padTop(4f);
new imagebutton("icon-load", isize, () -> ui.showLoadGame()).text("Load").padTop(4f); new imagebutton("icon-load", isize, () -> ui.showLoadGame()).text("$text.load").padTop(4f);
row(); row();
new imagebutton("icon-editor", isize, () -> ui.showEditor()).text("Editor").padTop(4f); new imagebutton("icon-editor", isize, () -> ui.showEditor()).text("$text.editor").padTop(4f);
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("Settings").padTop(4f); new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
if(Mindustry.donationsCallable != null){ if(Mindustry.donationsCallable != null){
new imagebutton("icon-donate", isize, () -> { new imagebutton("icon-donate", isize, () -> {
Mindustry.donationsCallable.run(); Mindustry.donationsCallable.run();
}).text("Donate").padTop(4f); }).text("$text.donate").padTop(4f);
} }
visible(()->GameState.is(State.menu)); visible(()->GameState.is(State.menu));

View File

@@ -28,7 +28,7 @@ public class PlacementFragment implements Fragment{
touchable(Touchable.enabled); touchable(Touchable.enabled);
aleft(); aleft();
new label("place mode"); new label("$text.placemode");
row(); row();
new table("pane"){{ new table("pane"){{
@@ -76,7 +76,7 @@ public class PlacementFragment implements Fragment{
abottom(); abottom();
aleft(); aleft();
new label("break mode"); new label("$text.breakmode");
row(); row();
new table("pane"){{ new table("pane"){{

View File

@@ -28,7 +28,7 @@ public class WeaponFragment implements Fragment{
public void updateWeapons(){ public void updateWeapons(){
weapontable.clearChildren(); weapontable.clearChildren();
ButtonGroup group = new ButtonGroup(); ButtonGroup<ImageButton> group = new ButtonGroup<>();
weapontable.defaults().size(58, 62); weapontable.defaults().size(58, 62);
@@ -52,14 +52,14 @@ public class WeaponFragment implements Fragment{
String description = weapon.description; String description = weapon.description;
tiptable.background("button"); tiptable.background("button");
tiptable.add("" + weapon.name(), 0.5f).left().padBottom(3f); tiptable.add("weapon."+weapon.name()+".name", 0.5f).left().padBottom(3f);
tiptable.row(); tiptable.row();
tiptable.row(); tiptable.row();
tiptable.add("[GRAY]" + description).left(); tiptable.add("[GRAY]" + description).left();
tiptable.margin(14f); tiptable.margin(14f);
Tooltip tip = new Tooltip(tiptable); Tooltip<Table> tip = new Tooltip<>(tiptable);
tip.setInstant(true); tip.setInstant(true);

View File

@@ -15,6 +15,7 @@ import io.anuke.mindustry.resource.Liquid;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Tmp; import io.anuke.ucore.util.Tmp;
public class Block{ public class Block{
@@ -29,7 +30,7 @@ public class Block{
/**internal ID*/ /**internal ID*/
public final int id; public final int id;
/**display name*/ /**display name*/
public String formalName; public final String formalName;
/**played on destroy*/ /**played on destroy*/
public Effect explosionEffect = Fx.blockexplosion; public Effect explosionEffect = Fx.blockexplosion;
/**played on destroy*/ /**played on destroy*/
@@ -67,9 +68,9 @@ public class Block{
/**multiblock width/height*/ /**multiblock width/height*/
public int width = 1, height = 1; public int width = 1, height = 1;
/**Brief block description. Should be short enough fit in the place menu.*/ /**Brief block description. Should be short enough fit in the place menu.*/
public String description; public final String description;
/**Detailed description of the block. Can be as long as necesary.*/ /**Detailed description of the block. Can be as long as necesary.*/
public String fullDescription; public final String fullDescription;
/**Whether to draw this block in the expanded draw range.*/ /**Whether to draw this block in the expanded draw range.*/
public boolean expanded = false; public boolean expanded = false;
/**Max of timers used.*/ /**Max of timers used.*/
@@ -83,7 +84,9 @@ public class Block{
blocks.add(this); blocks.add(this);
this.name = name; this.name = name;
this.formalName = name; this.formalName = Bundles.get("block." + name + ".name", name);
this.description = Bundles.get("block." + name + ".description");
this.fullDescription = Bundles.get("block." + name + ".fulldescription");
this.solid = false; this.solid = false;
this.id = lastid++; this.id = lastid++;
} }

View File

@@ -11,66 +11,43 @@ public class DefenseBlocks{
stonewall = new Wall("stonewall"){{ stonewall = new Wall("stonewall"){{
health = 50; health = 50;
formalName = "stone wall";
fullDescription = "A cheap defensive block. Useful for protecting the core and turrets in the first few waves.";
}}, }},
ironwall = new Wall("ironwall"){{ ironwall = new Wall("ironwall"){{
health = 80; health = 80;
formalName = "iron wall";
fullDescription = "A basic defensive block. Provides protection from enemies.";
}}, }},
steelwall = new Wall("steelwall"){{ steelwall = new Wall("steelwall"){{
health = 110; health = 110;
formalName = "steel wall";
fullDescription = "A standard defensive block. adequate protection from enemies.";
}}, }},
titaniumwall = new Wall("titaniumwall"){{ titaniumwall = new Wall("titaniumwall"){{
health = 150; health = 150;
formalName = "titanium wall";
fullDescription = "A strong defensive block. Provides protection from enemies.";
}}, }},
diriumwall = new Wall("duriumwall"){{ diriumwall = new Wall("duriumwall"){{
health = 190; health = 190;
formalName = "dirium wall";
fullDescription = "A very strong defensive block. Provides protection from enemies.";
}}, }},
compositewall = new Wall("compositewall"){{ compositewall = new Wall("compositewall"){{
health = 270; health = 270;
formalName = "composite wall";
}}, }},
steelwalllarge = new Wall("steelwall-large"){{ steelwalllarge = new Wall("steelwall-large"){{
health = 110*4; health = 110*4;
formalName = "large steel wall";
width = height = 2; width = height = 2;
fullDescription = "A standard defensive block. Spans multiple tiles.";
}}, }},
titaniumwalllarge = new Wall("titaniumwall-large"){{ titaniumwalllarge = new Wall("titaniumwall-large"){{
health = 150*4; health = 150*4;
formalName = "large titanium wall";
width = height = 2; width = height = 2;
fullDescription = "A strong defensive block. Spans multiple tiles.";
}}, }},
diriumwalllarge = new Wall("duriumwall-large"){{ diriumwalllarge = new Wall("duriumwall-large"){{
health = 190*4; health = 190*4;
formalName = "large dirium wall";
width = height = 2; width = height = 2;
fullDescription = "A very strong defensive block. Spans multiple tiles.";
}}, }},
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{ titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
fullDescription = "A strong defensive block, with an extra built-in shield. Requires power. "
+ "Uses energy to absorb enemy bullets. It is recommended to use power boosters to provide energy to this block.";
health = 150; health = 150;
formalName = "shielded wall";
}}, }},
repairturret = new RepairTurret("repairturret"){ repairturret = new RepairTurret("repairturret"){
{ {
fullDescription = "Repairs nearby damaged blocks in range at a slow rate. "
+ "Uses small amounts of power.";
formalName = "repair turret";
range = 30; range = 30;
reload = 60f; reload = 60f;
health = 60; health = 60;
@@ -79,9 +56,6 @@ public class DefenseBlocks{
megarepairturret = new RepairTurret("megarepairturret"){ megarepairturret = new RepairTurret("megarepairturret"){
{ {
fullDescription = "Repairs nearby damaged blocks in range at a decent rate. "
+ "Uses power.";
formalName = "repair turret II";
range = 44; range = 44;
reload = 30f; reload = 30f;
powerUsed = 0.15f; powerUsed = 0.15f;
@@ -91,21 +65,13 @@ public class DefenseBlocks{
shieldgenerator = new ShieldBlock("shieldgenerator"){ shieldgenerator = new ShieldBlock("shieldgenerator"){
{ {
//TODO
fullDescription = "An advanced defensive block. Shields all the blocks in a radius from attack. Uses power at a slow rate when idle, "
+ "but drains energy quickly on bullet contact.";
formalName = "shield generator";
} }
}, },
door = new Door("door"){{ door = new Door("door"){{
fullDescription = "A block than can be opened and closed by tapping it.";
description = "Opens and closes.\n[interact]Tap to toggle";
health = 90; health = 90;
}}, }},
largedoor = new Door("door-large"){{ largedoor = new Door("door-large"){{
formalName = "large door";
fullDescription = "A block than can be opened and closed by tapping it.";
description = "Opens and closes.\n[interact]Tap to toggle";
openfx = Fx.dooropenlarge; openfx = Fx.dooropenlarge;
closefx = Fx.doorcloselarge; closefx = Fx.doorcloselarge;
health = 90*4; health = 90*4;

View File

@@ -9,107 +9,58 @@ public class DistributionBlocks{
public static final Block public static final Block
conduit = new LiquidBlock("conduit"){{ conduit = new LiquidBlock("conduit"){{
fullDescription = "Basic liquid transport block. Works like a conveyor, but with liquids. "
+ "Best used with pumps or other conduits. Can be used as a bridge over liquids for enemies and players.";
health = 45; health = 45;
}}, }},
pulseconduit = new LiquidBlock("pulseconduit"){{ pulseconduit = new LiquidBlock("pulseconduit"){{
formalName = "pulse conduit";
fullDescription = "Advanced liquid transport block. Transports liquids faster and stores more than standard conduits.";
liquidCapacity = 16f; liquidCapacity = 16f;
flowfactor = 4.9f; flowfactor = 4.9f;
health = 65; health = 65;
}}, }},
liquidrouter = new LiquidRouter("liquidrouter"){{ liquidrouter = new LiquidRouter("liquidrouter"){{
description = "Splits input liquid into 3 directions.";
fullDescription = "Works similarly to a router. Accepts liquid input from one side and outputs it to the other sides. "
+ "Useful for splitting liquid from a single conduit into multiple other conduits.";
formalName = "liquid router";
}}, }},
conveyor = new Conveyor("conveyor"){{ conveyor = new Conveyor("conveyor"){{
fullDescription = "Basic item transport block. Moves items forward and automatically deposits them into turrets or crafters. "
+ "Rotatable. Can be used as a bridge over liquids for enemies and players.";
}}, }},
steelconveyor = new Conveyor("steelconveyor"){{ steelconveyor = new Conveyor("steelconveyor"){{
health = 55; health = 55;
speed = 0.04f; speed = 0.04f;
formalName = "steel conveyor";
fullDescription = "Advanced item transport block. Moves items faster than standard conveyors.";
}}, }},
pulseconveyor = new Conveyor("poweredconveyor"){{ pulseconveyor = new Conveyor("poweredconveyor"){{
health = 75; health = 75;
speed = 0.09f; speed = 0.09f;
formalName = "pulse conveyor";
fullDescription = "The ultimate item transport block. Moves items faster than steel conveyors.";
}}, }},
router = new Router("router"){{ router = new Router("router"){{
description = "Split input materials into 3 directions.";
fullDescription = "Accepts items from one direction and outputs them to 3 other directions. Can also store a certain amount of items."
+ "Useful for splitting the materials from one drill into multiple turrets.";
}}, }},
junction = new Junction("junction"){{ junction = new Junction("junction"){{
description = "Serves as a conveyor junction.";
fullDescription = "Acts as a bridge for two crossing conveyor belts. Useful in situations with "
+ "two different conveyors carrying different materials to different locations.";
}}, }},
tunnel = new TunnelConveyor("conveyortunnel"){{ tunnel = new TunnelConveyor("conveyortunnel"){{
formalName = "conveyor tunnel";
description = "Transports items under blocks.";
fullDescription = "Transports item under blocks. "
+ "To use, place one tunnel leading into the block to be tunneled under, and one on the other side.";
}}, }},
liquidjunction = new LiquidJunction("liquidjunction"){{ liquidjunction = new LiquidJunction("liquidjunction"){{
formalName = "liquid junction";
fullDescription = "Acts as a bridge for two crossing conduits. Useful in situations with "
+ "two different conduits carrying different liquids to different locations.";
}}, }},
liquiditemjunction = new LiquidItemJunction("liquiditemjunction"){{ liquiditemjunction = new LiquidItemJunction("liquiditemjunction"){{
formalName = "liquid-item junction";
description = "Serves as a junction for items and liquids.";
fullDescription = "Acts as a bridge for crossing conduits and conveyors.";
}}, }},
powerbooster = new PowerBooster("powerbooster"){{ powerbooster = new PowerBooster("powerbooster"){{
formalName = "power booster";
powerRange = 4; powerRange = 4;
description = "Distributes power within a radius.";
fullDescription = "Distributes power to all blocks within its radius. ";
}}, }},
powerlaser = new PowerLaser("powerlaser"){{ powerlaser = new PowerLaser("powerlaser"){{
formalName = "power laser";
description = "Transmits power.";
fullDescription = "Creates a laser that transmits power to the block in front of it. Does not generate any power itself. "
+ "Best used with generators or other lasers.";
}}, }},
powerlaserrouter = new PowerLaserRouter("powerlaserrouter"){{ powerlaserrouter = new PowerLaserRouter("powerlaserrouter"){{
formalName = "laser router";
description = "Splits input power into 3 lasers.";
fullDescription = "Laser that distributes power to three directions at once. "
+ "Useful in situations where it is required to power multiple blocks from one generator.";
}}, }},
powerlasercorner = new PowerLaserRouter("powerlasercorner"){{ powerlasercorner = new PowerLaserRouter("powerlasercorner"){{
laserDirections = 2; laserDirections = 2;
formalName = "laser corner";
description = "Splits input power into 2 lasers.";
fullDescription = "Laser that distributes power to two directions at once. "
+ "Useful in situations where it is required to power multiple blocks from one generator, and a router is imprecise.";
}}, }},
teleporter = new Teleporter("teleporter"){{ teleporter = new Teleporter("teleporter"){{
description = "[interact]Tap block to config[]";
fullDescription = "Advanced item transport block. Teleporters input items to other teleporters of the same color."
+ " Does nothing if no teleporters of the same color exist. If multiple teleporters exist of the same color, a random one is selected."
+ " Tap and click the arrows to change color.";
}}, }},
sorter = new Sorter("sorter"){{ sorter = new Sorter("sorter"){{
description = "[interact]Tap block to config[]";
fullDescription = "Sorts item by material type. Material to accept is indicated by the color in the block. "
+ "All items that match the sort material are outputted forward, everything else is outputted to the left and right.";
}}; }};
} }

View File

@@ -7,46 +7,20 @@ import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.defense.CoreBlock;
import io.anuke.mindustry.world.blocks.types.production.*; import io.anuke.mindustry.world.blocks.types.production.*;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
public class ProductionBlocks{ public class ProductionBlocks{
public static final Block public static final Block
core = new Block("core"){ core = new CoreBlock("core"),
{
health = 800;
solid = true;
destructible = true;
width = 3;
height = 3;
}
@Override
public int handleDamage(Tile tile, int amount){
return Vars.debug ? 0 : amount;
}
@Override
public void handleItem(Item item, Tile tile, Tile source){
Vars.control.addItem(item, 1);
}
@Override
public boolean acceptItem(Item item, Tile dest, Tile source){
return true;
}
},
pump = new Pump("pump"){{ pump = new Pump("pump"){{
description = "Pumps liquids into nearby conduits.";
fullDescription = "Pumps liquids from a source block- usually water, lava or oil. Outputs liquid into nearby conduits.";
}}, }},
fluxpump = new Pump("fluxpump"){{ fluxpump = new Pump("fluxpump"){{
pumpAmount = 3f; pumpAmount = 3f;
description = "Pumps liquids into nearby conduits.";
fullDescription = "An advanced version of the pump. Stores more liquid and pumps liquid faster.";
}}, }},
smelter = new Crafter("smelter"){ smelter = new Crafter("smelter"){
@@ -54,8 +28,6 @@ public class ProductionBlocks{
health = 70; health = 70;
requirements = new Item[]{Item.coal, Item.iron}; requirements = new Item[]{Item.coal, Item.iron};
result = Item.steel; result = Item.steel;
description = "Converts coal + iron to steel.";
fullDescription = "The essential crafting block. When inputted 1x iron and 1x coal, outputs one steel.";
} }
}, },
@@ -64,14 +36,11 @@ public class ProductionBlocks{
health = 90; health = 90;
requirements = new Item[]{Item.titanium, Item.steel}; requirements = new Item[]{Item.titanium, Item.steel};
result = Item.dirium; result = Item.dirium;
description = "Converts steel + titanium to dirium.";
fullDescription = "An advanced crafting block. When inputted 1x titanium and 1x steel, outputs one dirium.";
} }
}, },
coalpurifier = new LiquidCrafter("coalpurifier"){ coalpurifier = new LiquidCrafter("coalpurifier"){
{ {
formalName = "coal extractor";
input = Item.stone; input = Item.stone;
inputAmount = 5; inputAmount = 5;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
@@ -79,14 +48,11 @@ public class ProductionBlocks{
output = Item.coal; output = Item.coal;
health = 50; health = 50;
purifyTime = 50; purifyTime = 50;
description = "Converts stone + water to coal.";
fullDescription = "A basic extractor block. Outputs coal when supplied with large amounts of water and stone.";
} }
}, },
titaniumpurifier = new LiquidCrafter("titaniumpurifier"){ titaniumpurifier = new LiquidCrafter("titaniumpurifier"){
{ {
formalName = "titanium extractor";
input = Item.iron; input = Item.iron;
inputAmount = 6; inputAmount = 6;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
@@ -95,14 +61,11 @@ public class ProductionBlocks{
purifyTime = 60; purifyTime = 60;
output = Item.titanium; output = Item.titanium;
health = 70; health = 70;
description = "Converts iron + water to titanium.";
fullDescription = "A standard extractor block. Outputs titanium when supplied with large amounts of water and iron.";
} }
}, },
oilrefinery = new LiquidCrafter("oilrefinery"){ oilrefinery = new LiquidCrafter("oilrefinery"){
{ {
formalName = "oil refinery";
inputLiquid = Liquid.oil; inputLiquid = Liquid.oil;
liquidAmount = 45f; liquidAmount = 45f;
liquidCapacity = 46f; liquidCapacity = 46f;
@@ -110,14 +73,11 @@ public class ProductionBlocks{
output = Item.coal; output = Item.coal;
health = 80; health = 80;
craftEffect = Fx.purifyoil; craftEffect = Fx.purifyoil;
description = "Converts oil to coal.";
fullDescription = "Refines large amounts of oil into coal items. Useful for fueling coal-based turrets when coal veins are scarce.";
} }
}, },
stoneformer = new LiquidCrafter("stoneformer"){ stoneformer = new LiquidCrafter("stoneformer"){
{ {
formalName = "stone former";
input = null; input = null;
inputLiquid = Liquid.lava; inputLiquid = Liquid.lava;
liquidAmount = 16f; liquidAmount = 16f;
@@ -126,14 +86,11 @@ public class ProductionBlocks{
output = Item.stone; output = Item.stone;
health = 80; health = 80;
craftEffect = Fx.purifystone; craftEffect = Fx.purifystone;
description = "Converts lava to stone.";
fullDescription = "Soldifies liquid lava into stone. Useful for producing massive amounts of stone for coal purifiers.";
} }
}, },
lavasmelter = new LiquidCrafter("lavasmelter"){ lavasmelter = new LiquidCrafter("lavasmelter"){
{ {
formalName = "lava smelter";
input = Item.iron; input = Item.iron;
inputAmount = 1; inputAmount = 1;
inputLiquid = Liquid.lava; inputLiquid = Liquid.lava;
@@ -143,8 +100,6 @@ public class ProductionBlocks{
output = Item.steel; output = Item.steel;
health = 80; health = 80;
craftEffect = Fx.purifystone; craftEffect = Fx.purifystone;
description = "Converts iron + lava to steel.";
fullDescription = "Uses lava to convert iron to steel. An alternative to smelteries. Useful in situations where coal is scarace.";
} }
}, },
@@ -152,42 +107,27 @@ public class ProductionBlocks{
resource = Blocks.stone; resource = Blocks.stone;
result = Item.stone; result = Item.stone;
time = 4; time = 4;
formalName = "stone drill";
description = "Mines 1 "+resource.name+" every "+time+" seconds.";
fullDescription = "The essential drill. When placed on stone tiles, outputs stone at a slow pace indefinitely.";
}}, }},
irondrill = new Drill("irondrill"){{ irondrill = new Drill("irondrill"){{
resource = Blocks.iron; resource = Blocks.iron;
result = Item.iron; result = Item.iron;
formalName = "iron drill";
description = "Mines 1 "+resource.name+" every "+time+" seconds.";
fullDescription = "A basic drill. When placed on iron ore tiles, outputs iron at a slow pace indefinitely.";
}}, }},
coaldrill = new Drill("coaldrill"){{ coaldrill = new Drill("coaldrill"){{
resource = Blocks.coal; resource = Blocks.coal;
result = Item.coal; result = Item.coal;
formalName = "coal drill";
description = "Mines 1 "+resource.name+" every "+time+" seconds.";
fullDescription = "A basic drill. When placed on coal ore tiles, outputs coal at a slow pace indefinitely.";
}}, }},
uraniumdrill = new Drill("uraniumdrill"){{ uraniumdrill = new Drill("uraniumdrill"){{
resource = Blocks.uranium; resource = Blocks.uranium;
result = Item.uranium; result = Item.uranium;
formalName = "uranium drill";
time = 7; time = 7;
description = "Mines 1 "+resource.name+" every "+time+" seconds.";
fullDescription = "An advanced drill. When placed on uranium ore tiles, outputs uranium at a slow pace indefinitely.";
}}, }},
titaniumdrill = new Drill("titaniumdrill"){{ titaniumdrill = new Drill("titaniumdrill"){{
resource = Blocks.titanium; resource = Blocks.titanium;
result = Item.titanium; result = Item.titanium;
formalName = "titanium drill";
description = "Mines 1 "+resource.name+" every "+time+" seconds.";
fullDescription = "An advanced drill. When placed on titanium ore tiles, outputs titanium at a slow pace indefinitely.";
}}, }},
omnidrill = new Drill("omnidrill"){ omnidrill = new Drill("omnidrill"){
@@ -196,9 +136,6 @@ public class ProductionBlocks{
resource = null; resource = null;
result = null; result = null;
time = 3; time = 3;
formalName = "omnidrill";
description = "Mines 1 of any resource every "+time+" seconds.";
fullDescription = "The ultimate drill. Will mine any ore it is placed on at a rapid pace.";
} }
@Override @Override
@@ -217,62 +154,42 @@ public class ProductionBlocks{
}, },
coalgenerator = new ItemPowerGenerator("coalgenerator"){ coalgenerator = new ItemPowerGenerator("coalgenerator"){
{ {
//TODO
formalName = "coal generator";
generateItem = Item.coal; generateItem = Item.coal;
powerOutput = 0.05f; powerOutput = 0.05f;
powerCapacity = 40f; powerCapacity = 40f;
description = "Generates power from coal.";
fullDescription = "The essential generator. Generates power from coal. Outputs power as lasers to its 4 sides.";
} }
}, },
thermalgenerator = new LiquidPowerGenerator("thermalgenerator"){ thermalgenerator = new LiquidPowerGenerator("thermalgenerator"){
{ {
formalName = "thermal generator";
//TODO
generateLiquid = Liquid.lava; generateLiquid = Liquid.lava;
maxLiquidGenerate = 0.5f; maxLiquidGenerate = 0.5f;
powerPerLiquid = 0.09f; powerPerLiquid = 0.09f;
powerCapacity = 40f; powerCapacity = 40f;
description = "Generates power from lava.";
fullDescription = "Generates power from lava. Outputs power as lasers to its 4 sides.";
generateEffect = Fx.redgeneratespark; generateEffect = Fx.redgeneratespark;
} }
}, },
combustiongenerator = new LiquidPowerGenerator("combustiongenerator"){ combustiongenerator = new LiquidPowerGenerator("combustiongenerator"){
{ {
formalName = "combustion generator";
//TODO
generateLiquid = Liquid.oil; generateLiquid = Liquid.oil;
maxLiquidGenerate = 0.4f; maxLiquidGenerate = 0.4f;
powerPerLiquid = 0.13f; powerPerLiquid = 0.13f;
powerCapacity = 40f; powerCapacity = 40f;
description = "Generates power from oil.";
fullDescription = "Generates power from oil. Outputs power as lasers to its 4 sides.";
} }
}, },
rtgenerator = new ItemPowerGenerator("rtgenerator"){ rtgenerator = new ItemPowerGenerator("rtgenerator"){
{ {
//TODO make this generate slowly
formalName = "RTG generator";
generateItem = Item.uranium; generateItem = Item.uranium;
powerCapacity = 40f; powerCapacity = 40f;
powerOutput = 0.04f; powerOutput = 0.04f;
itemDuration = 240f; itemDuration = 240f;
description = "Generates power from uranium.";
fullDescription = "Generates small amounts of power from the radioactive decay of uranium. Outputs power as lasers to its 4 sides.";
} }
}, },
nuclearReactor = new NuclearReactor("nuclearreactor"){ nuclearReactor = new NuclearReactor("nuclearreactor"){
{ {
//TODO
formalName = "nuclear reactor";
width = 3; width = 3;
height = 3; height = 3;
health = 600; health = 600;
breaktime *= 2.3f; breaktime *= 2.3f;
fullDescription = "An advanced version of the RTG Generator, and the ultimate power generator. Generates power from uranium. Requires constant water cooling. "
+ "Highly volatile; will explode violently if insufficient amounts of coolant are supplied. ";
} }
}; };
} }

View File

@@ -22,26 +22,22 @@ public class WeaponBlocks{
turret = new Turret("turret"){ turret = new Turret("turret"){
{ {
formalName = "turret";
range = 52; range = 52;
reload = 15f; reload = 15f;
bullet = BulletType.stone; bullet = BulletType.stone;
health = 50; health = 50;
ammo = Item.stone; ammo = Item.stone;
fullDescription = "A basic, cheap turret. Uses stone for ammo. Has slightly more range than the double-turret.";
} }
}, },
doubleturret = new Turret("doubleturret"){ doubleturret = new Turret("doubleturret"){
{ {
formalName = "double turret";
range = 44; range = 44;
reload = 13f; reload = 13f;
bullet = BulletType.stone; bullet = BulletType.stone;
ammo = Item.stone; ammo = Item.stone;
health = 55; health = 55;
health = 50; health = 50;
fullDescription = "A slightly more powerful version of the turret. Uses stone for ammo. Does significantly more damage, but has a lower range. Shoots two bullets.";
} }
@Override @Override
@@ -58,19 +54,16 @@ public class WeaponBlocks{
machineturret = new Turret("machineturret"){ machineturret = new Turret("machineturret"){
{ {
formalName = "gattling turret";
range = 65; range = 65;
reload = 7f; reload = 7f;
bullet = BulletType.iron; bullet = BulletType.iron;
ammo = Item.iron; ammo = Item.iron;
health = 65; health = 65;
fullDescription = "A standard all-around turret. Uses iron for ammo. Has a fast fire rate with decent damage.";
} }
}, },
shotgunturret = new Turret("shotgunturret"){ shotgunturret = new Turret("shotgunturret"){
{ {
formalName = "splitter turret";
range = 50; range = 50;
reload = 30f; reload = 30f;
bullet = BulletType.iron; bullet = BulletType.iron;
@@ -79,36 +72,28 @@ public class WeaponBlocks{
shots = 5; shots = 5;
inaccuracy = 15f; inaccuracy = 15f;
shotDelayScale = 0.7f; shotDelayScale = 0.7f;
fullDescription = "A standard turret. Uses iron for ammo. Shoots a spread of 7 bullets. "
+ "Lower range, but higher damage output than the gattling turret.";
} }
}, },
flameturret = new Turret("flameturret"){ flameturret = new Turret("flameturret"){
{ {
formalName = "flamer turret";
range = 35f; range = 35f;
reload = 5f; reload = 5f;
bullet = BulletType.flame; bullet = BulletType.flame;
ammo = Item.coal; ammo = Item.coal;
health = 90; health = 90;
fullDescription = "Advanced close-range turret. Uses coal for ammo. Has very low range, but very high damage. "
+ "Good for close quarters. Recommended to be used behind walls.";
} }
}, },
sniperturret = new Turret("sniperturret"){ sniperturret = new Turret("sniperturret"){
{ {
shootsound = "railgun"; shootsound = "railgun";
formalName = "railgun turret";
range = 120; range = 120;
reload = 50f; reload = 50f;
bullet = BulletType.sniper; bullet = BulletType.sniper;
ammo = Item.steel; ammo = Item.steel;
health = 70; health = 70;
shootEffect = Fx.railshot; shootEffect = Fx.railshot;
fullDescription = "Advanced long-range turret. Uses steel for ammo. Very high damage, but low fire rate. "
+ "Expensive to use, but can be placed far away from enemy lines due to its range.";
} }
}, },
@@ -116,16 +101,12 @@ public class WeaponBlocks{
{ {
shootsound = "bigshot"; shootsound = "bigshot";
rotatespeed = 0.1f; rotatespeed = 0.1f;
formalName = "flak turret";
range = 120; range = 120;
reload = 100f; reload = 100f;
bullet = BulletType.shell; bullet = BulletType.shell;
ammo = Item.coal; ammo = Item.coal;
ammoMultiplier = 5; ammoMultiplier = 5;
health = 110; health = 110;
fullDescription = "Advanced splash-damage turret. Uses coal for ammo. "
+ "Very slow fire rate and bullets, but very high single-target and splash damage. "
+ "Useful for large crowds of enemies.";
shootEffect = Fx.mortarshot; shootEffect = Fx.mortarshot;
shootShake = 2f; shootShake = 2f;
} }
@@ -135,27 +116,21 @@ public class WeaponBlocks{
{ {
shootsound = "laser"; shootsound = "laser";
beamColor = Color.SKY; beamColor = Color.SKY;
formalName = "laser turret";
range = 60; range = 60;
reload = 4f; reload = 4f;
damage = 10; damage = 10;
health = 110; health = 110;
powerUsed = 0.2f; powerUsed = 0.2f;
fullDescription = "Advanced single-target turret. Uses power. Good medium-range all-around turret. "
+ "Single-target only. Never misses.";
} }
}, },
teslaturret = new PowerTurret("waveturret"){ teslaturret = new PowerTurret("waveturret"){
{ {
shootsound = "tesla"; shootsound = "tesla";
formalName = "tesla turret";
range = 70; range = 70;
reload = 15f; reload = 15f;
bullet = BulletType.shell; bullet = BulletType.shell;
health = 140; health = 140;
fullDescription = "Advanced multi-target turret. Uses power. Medium range. Never misses."
+ "Average to low damage, but can hit multiple enemies simultaneously with chain lighting.";
} }
@Override @Override
@@ -172,15 +147,12 @@ public class WeaponBlocks{
{ {
shootsound = "flame2"; shootsound = "flame2";
inaccuracy = 7f; inaccuracy = 7f;
formalName = "plasma turret";
range = 60f; range = 60f;
reload = 3f; reload = 3f;
bullet = BulletType.plasmaflame; bullet = BulletType.plasmaflame;
ammo = Item.coal; ammo = Item.coal;
health = 180; health = 180;
ammoMultiplier = 40; ammoMultiplier = 40;
fullDescription = "Highly advanced version of the flamer turret. Uses coal as ammo. "
+ "Very high damage, low to medium range.";
} }
}, },
@@ -188,7 +160,6 @@ public class WeaponBlocks{
{ {
shootsound = "bigshot"; shootsound = "bigshot";
inaccuracy = 8f; inaccuracy = 8f;
formalName = "chain turret";
range = 80f; range = 80f;
reload = 8f; reload = 8f;
bullet = BulletType.chain; bullet = BulletType.chain;
@@ -198,8 +169,6 @@ public class WeaponBlocks{
shootCone = 9f; shootCone = 9f;
ammoMultiplier = 8; ammoMultiplier = 8;
shots = 2; shots = 2;
fullDescription = "The ultimate rapid-fire turret. Uses uranium as ammo. Shoots large slugs at a high fire rate. "
+ "Medium range. Spans multiple tiles. Extremely tough.";
shootEffect = Fx.chainshot; shootEffect = Fx.chainshot;
} }
@@ -226,7 +195,6 @@ public class WeaponBlocks{
titanturret = new Turret("titancannon"){ titanturret = new Turret("titancannon"){
{ {
shootsound = "blast"; shootsound = "blast";
formalName = "titan cannon";
range = 120f; range = 120f;
reload = 23f; reload = 23f;
bullet = BulletType.titanshell; bullet = BulletType.titanshell;
@@ -236,8 +204,6 @@ public class WeaponBlocks{
width = height = 3; width = height = 3;
rotatespeed = 0.07f; rotatespeed = 0.07f;
shootCone = 9f; shootCone = 9f;
fullDescription = "The ultimate long-range turret. Uses uranium as ammo. Shoots large splash-damage shells at a medium rate of fire. "
+ "Long range. Spans multiple tiles. Extremely tough.";
shootEffect = Fx.titanshot; shootEffect = Fx.titanshot;
shootShake = 3f; shootShake = 3f;
} }

View File

@@ -0,0 +1,34 @@
package io.anuke.mindustry.world.blocks.types.defense;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
public class CoreBlock extends Block {
public CoreBlock(String name) {
super(name);
health = 800;
solid = true;
destructible = true;
width = 3;
height = 3;
}
@Override
public int handleDamage(Tile tile, int amount){
return Vars.debug ? 0 : amount;
}
@Override
public void handleItem(Item item, Tile tile, Tile source){
Vars.control.addItem(item, 1);
}
@Override
public boolean acceptItem(Item item, Tile dest, Tile source){
return true;
}
}

View File

@@ -26,11 +26,6 @@ public class PowerTurret extends Turret implements PowerAcceptor{
ammo = null; ammo = null;
} }
@Override
public void postInit(){
description = "[turretinfo]Uses power.";
}
@Override @Override
public void getStats(Array<String> list){ public void getStats(Array<String> list){
super.getStats(list); super.getStats(list);

View File

@@ -32,11 +32,6 @@ public class RepairTurret extends PowerTurret{
list.add("[turretinfo]Repairs/Second: " + Strings.toFixed(60f/reload, 1)); list.add("[turretinfo]Repairs/Second: " + Strings.toFixed(60f/reload, 1));
} }
@Override
public void postInit(){
description = "[powerinfo]Uses power[white]\nRepairs nearby blocks.";
}
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
PowerTurretEntity entity = tile.entity(); PowerTurretEntity entity = tile.entity();

View File

@@ -71,12 +71,6 @@ public class Turret extends Block{
list.add("[turretinfo]Shots: " + shots); list.add("[turretinfo]Shots: " + shots);
} }
@Override
public void postInit(){
if(ammo != null)
description = "[turretinfo]Ammo: " + ammo;
}
@Override @Override
public boolean canReplace(Block other){ public boolean canReplace(Block other){
return other instanceof Turret; return other instanceof Turret;