Code cleanup
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||

|

|
||||||
|
|
||||||
[](https://travis-ci.org/Anuken/Mindustry)
|
[](https://travis-ci.org/Anuken/Mindustry)
|
||||||
[](discord.gg/mindustry)
|
[](https://discord.gg/mindustry)
|
||||||
|
|
||||||
A pixelated sandbox tower defense game made using [LibGDX](https://libgdx.badlogicgames.com/). Winner of the [GDL Metal Monstrosity Jam](https://itch.io/jam/gdl---metal-monstrosity-jam).
|
A pixelated sandbox tower defense game made using [LibGDX](https://libgdx.badlogicgames.com/). Winner of the [GDL Metal Monstrosity Jam](https://itch.io/jam/gdl---metal-monstrosity-jam).
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ task deploy(type: Copy){
|
|||||||
dependsOn "assembleRelease"
|
dependsOn "assembleRelease"
|
||||||
|
|
||||||
from "build/outputs/apk/google/release/android-google-release.apk"
|
from "build/outputs/apk/google/release/android-google-release.apk"
|
||||||
into "../deploy/";
|
into "../deploy/"
|
||||||
rename ("android-google-release.apk", appName + "-android-" + getVersionString() + ".apk");
|
rename ("android-google-release.apk", appName + "-android-" + getVersionString() + ".apk")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -100,7 +100,7 @@ android {
|
|||||||
keyAlias RELEASE_KEY_ALIAS
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
keyPassword RELEASE_KEY_PASSWORD
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
}else{
|
}else{
|
||||||
println("No keystore info property found!");
|
println("No keystore info property found!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,11 +115,11 @@ android {
|
|||||||
// the natives configuration, and extracts them to the proper libs/ folders
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
// so they get packed with the APK.
|
// so they get packed with the APK.
|
||||||
task copyAndroidNatives() {
|
task copyAndroidNatives() {
|
||||||
file("libs/armeabi/").mkdirs();
|
file("libs/armeabi/").mkdirs()
|
||||||
file("libs/armeabi-v7a/").mkdirs();
|
file("libs/armeabi-v7a/").mkdirs()
|
||||||
file("libs/arm64-v8a/").mkdirs();
|
file("libs/arm64-v8a/").mkdirs()
|
||||||
file("libs/x86_64/").mkdirs();
|
file("libs/x86_64/").mkdirs()
|
||||||
file("libs/x86/").mkdirs();
|
file("libs/x86/").mkdirs()
|
||||||
|
|
||||||
configurations.natives.files.each { jar ->
|
configurations.natives.files.each { jar ->
|
||||||
def outputDir = null
|
def outputDir = null
|
||||||
@@ -181,7 +181,7 @@ eclipse {
|
|||||||
project {
|
project {
|
||||||
name = appName + "-android"
|
name = appName + "-android"
|
||||||
natures 'com.android.ide.eclipse.adt.AndroidNature'
|
natures 'com.android.ide.eclipse.adt.AndroidNature'
|
||||||
buildCommands.clear();
|
buildCommands.clear()
|
||||||
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
|
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
|
||||||
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
|
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
|
||||||
buildCommand "org.eclipse.jdt.core.javabuilder"
|
buildCommand "org.eclipse.jdt.core.javabuilder"
|
||||||
@@ -191,14 +191,14 @@ eclipse {
|
|||||||
// sets up the Android Idea project, using the old Ant based build.
|
// sets up the Android Idea project, using the old Ant based build.
|
||||||
idea {
|
idea {
|
||||||
module {
|
module {
|
||||||
sourceDirs += file("src");
|
sourceDirs += file("src")
|
||||||
scopes = [COMPILE: [plus: [project.configurations.compile]]]
|
scopes = [COMPILE: [plus: [project.configurations.compile]]]
|
||||||
|
|
||||||
iml {
|
iml {
|
||||||
withXml {
|
withXml {
|
||||||
def node = it.asNode()
|
def node = it.asNode()
|
||||||
def builder = NodeBuilder.newInstance();
|
def builder = NodeBuilder.newInstance()
|
||||||
builder.current = node;
|
builder.current = node
|
||||||
builder.component(name: "FacetManager") {
|
builder.component(name: "FacetManager") {
|
||||||
facet(type: "android", name: "Android") {
|
facet(type: "android", name: "Android") {
|
||||||
configuration {
|
configuration {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class AndroidTextFieldDialog{
|
|||||||
while(!isBuild){
|
while(!isBuild){
|
||||||
try{
|
try{
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
}catch(InterruptedException e){
|
}catch(InterruptedException ignored){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,10 @@ public class DonationsActivity extends FragmentActivity{
|
|||||||
|
|
||||||
public void onStart(){
|
public void onStart(){
|
||||||
super.onStart();
|
super.onStart();
|
||||||
Button b = ((Button) findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button));
|
Button b = findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button);
|
||||||
b.setOnClickListener(new View.OnClickListener(){
|
b.setOnClickListener(view -> {
|
||||||
@Override
|
donationsFragment.donateGoogleOnClick(donationsFragment.getView());
|
||||||
public void onClick(View view){
|
b.setEnabled(false);
|
||||||
donationsFragment.donateGoogleOnClick(donationsFragment.getView());
|
|
||||||
b.setEnabled(false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +61,7 @@ public class DonationsActivity extends FragmentActivity{
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
Button b = ((Button) findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button));
|
Button b = findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button);
|
||||||
b.setEnabled(true);
|
b.setEnabled(true);
|
||||||
|
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ allprojects {
|
|||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
uCoreVersion = 'e0789c76198a90cb115e12f03d44ddec35b35a6e'
|
uCoreVersion = '4bee866809b94c7fac6c83620b05bed4650cca26'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
@@ -47,10 +47,10 @@ allprojects {
|
|||||||
def output = 'en\n'
|
def output = 'en\n'
|
||||||
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
||||||
bundles.listFiles().each { other ->
|
bundles.listFiles().each { other ->
|
||||||
if(other.name == "bundle.properties") return;
|
if(other.name == "bundle.properties") return
|
||||||
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
output += other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + "\n"
|
||||||
}
|
}
|
||||||
new File(project(':core').projectDir, 'assets/locales').text = output;
|
new File(project(':core').projectDir, 'assets/locales').text = output
|
||||||
}
|
}
|
||||||
|
|
||||||
writeVersion = {
|
writeVersion = {
|
||||||
@@ -59,7 +59,7 @@ allprojects {
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
pfile.createNewFile()
|
pfile.createNewFile()
|
||||||
}catch (Exception e){}
|
}catch (Exception ignored){}
|
||||||
|
|
||||||
if(pfile.exists()) {
|
if(pfile.exists()) {
|
||||||
|
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ tutorial.begin=Votre mission, si vous l'acceptez est de détruire [LIGHT_GRAY]l'
|
|||||||
tutorial.drill=Le minage manuel est inefficace.\n[accent]Des foreuses[]peuvent miner automatiquement.\nPlacez-en une sur un filon de cuivre.
|
tutorial.drill=Le minage manuel est inefficace.\n[accent]Des foreuses[]peuvent miner automatiquement.\nPlacez-en une sur un filon de cuivre.
|
||||||
tutorial.conveyor=[accent]Les Tapis roulants[] sont utilisés pour transporter des objets jusqu'à la base.\nFaites une ligne de tapis roulants de la foreuse à la base .
|
tutorial.conveyor=[accent]Les Tapis roulants[] sont utilisés pour transporter des objets jusqu'à la base.\nFaites une ligne de tapis roulants de la foreuse à la base .
|
||||||
tutorial.morecopper=Plus de cuivre est demandé .\n\nRécupérez le soit manuellement soit construisez plus de foreuses.
|
tutorial.morecopper=Plus de cuivre est demandé .\n\nRécupérez le soit manuellement soit construisez plus de foreuses.
|
||||||
tutorial.turret=Des constructions défensives doivent être construites pour repousser [LIGHT_GRAY]les ennemis[].\Construisez une tourelle "duo" près de votre base.
|
tutorial.turret=Des constructions défensives doivent être construites pour repousser [LIGHT_GRAY]les ennemis[].Construisez une tourelle "duo" près de votre base.
|
||||||
tutorial.drillturret=Les tourelles "Duo" ont besoin de [accent]munitions en cuivre[] pour tirer.\nPlacez une foreuse à côté de la tourelle pour l'approvisionner avec du cuivre.
|
tutorial.drillturret=Les tourelles "Duo" ont besoin de [accent]munitions en cuivre[] pour tirer.\nPlacez une foreuse à côté de la tourelle pour l'approvisionner avec du cuivre.
|
||||||
tutorial.waves=Les [LIGHT_GRAY]ennemies[] approchent.\n\nDéfendez votre base pour 2 vagues. Construisez plus de tourelles.
|
tutorial.waves=Les [LIGHT_GRAY]ennemies[] approchent.\n\nDéfendez votre base pour 2 vagues. Construisez plus de tourelles.
|
||||||
tutorial.lead=Plus de minerais sont forables. Explorez et minez du[accent] Plomb[].\n\nRamenez votre unité à la base pour transférer les ressources.
|
tutorial.lead=Plus de minerais sont forables. Explorez et minez du[accent] Plomb[].\n\nRamenez votre unité à la base pour transférer les ressources.
|
||||||
@@ -644,5 +644,5 @@ tutorial.nodelink=L'énergie peut être transféré à l'aide de blocs utilisant
|
|||||||
tutorial.silicon=Du silicone est maintenant produit. Obtenez-en.\n\nAugmenter la production est recommandé.
|
tutorial.silicon=Du silicone est maintenant produit. Obtenez-en.\n\nAugmenter la production est recommandé.
|
||||||
tutorial.daggerfactory=Construire [accent]une usine de "Poignards" []est recommandé .\n\nElle sera utilisée pour produire des unités d'attaque.
|
tutorial.daggerfactory=Construire [accent]une usine de "Poignards" []est recommandé .\n\nElle sera utilisée pour produire des unités d'attaque.
|
||||||
tutorial.router=Les usines ont besoin de ressources pour fonctionner.\nCréez un routeur pour séparer les objets.
|
tutorial.router=Les usines ont besoin de ressources pour fonctionner.\nCréez un routeur pour séparer les objets.
|
||||||
tutorial.dagger=Reliez des transmetteurs énergétiques à l'usine.\nUne fois que les conditions seront remplies , un mécha sera créé.\n\Construisez autant de foreuses, de générateurs et de tapis roulants que nécessaire.
|
tutorial.dagger=Reliez des transmetteurs énergétiques à l'usine.\nUne fois que les conditions seront remplies , un mécha sera créé.\nConstruisez autant de foreuses, de générateurs et de tapis roulants que nécessaire.
|
||||||
tutorial.battle=[LIGHT_GRAY]L'Ennemi[] a révélé sa base .\nDétruisez la avec votre unité et des méchas "Poignard".
|
tutorial.battle=[LIGHT_GRAY]L'Ennemi[] a révélé sa base .\nDétruisez la avec votre unité et des méchas "Poignard".
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ public class ContentLoader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set up ID mapping
|
//set up ID mapping
|
||||||
for(int k = 0; k < contentMap.length; k ++){
|
for(Array<Content> arr : contentMap){
|
||||||
Array<Content> arr = contentMap[k];
|
|
||||||
for(int i = 0; i < arr.size; i++){
|
for(int i = 0; i < arr.size; i++){
|
||||||
int id = arr.get(i).id;
|
int id = arr.get(i).id;
|
||||||
if(id < 0) id += 256;
|
if(id < 0) id += 256;
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ public abstract class Platform {
|
|||||||
public String format(Date date){return "invalid";}
|
public String format(Date date){return "invalid";}
|
||||||
/**Format a number by adding in commas or periods where needed.*/
|
/**Format a number by adding in commas or periods where needed.*/
|
||||||
public String format(int number){return "invalid";}
|
public String format(int number){return "invalid";}
|
||||||
/**Show a native error dialog.*/
|
|
||||||
public void showError(String text){}
|
|
||||||
/**Add a text input dialog that should show up after the field is tapped.*/
|
/**Add a text input dialog that should show up after the field is tapped.*/
|
||||||
public void addDialog(TextField field){
|
public void addDialog(TextField field){
|
||||||
addDialog(field, 16);
|
addDialog(field, 16);
|
||||||
|
|||||||
@@ -180,11 +180,6 @@ public class UI extends SceneModule{
|
|||||||
loadfrag.build(group);
|
loadfrag.build(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasMouse(){
|
|
||||||
return super.hasMouse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height){
|
public void resize(int width, int height){
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public enum EditorTool{
|
|||||||
byte brt = Bits.packByte((byte) editor.getDrawRotation(), (byte) editor.getDrawTeam().ordinal());
|
byte brt = Bits.packByte((byte) editor.getDrawRotation(), (byte) editor.getDrawTeam().ordinal());
|
||||||
|
|
||||||
dest = floor ? bf : bw;
|
dest = floor ? bf : bw;
|
||||||
byte draw = (byte) editor.getDrawBlock().id;
|
byte draw = editor.getDrawBlock().id;
|
||||||
|
|
||||||
if(dest == draw){
|
if(dest == draw){
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class MapEditor{
|
|||||||
if(clear){
|
if(clear){
|
||||||
for(int x = 0; x < map.width(); x++){
|
for(int x = 0; x < map.width(); x++){
|
||||||
for(int y = 0; y < map.height(); y++){
|
for(int y = 0; y < map.height(); y++){
|
||||||
map.write(x, y, DataPosition.floor, (byte) Blocks.stone.id);
|
map.write(x, y, DataPosition.floor, Blocks.stone.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,7 +277,7 @@ public class MapEditor{
|
|||||||
map = new MapTileData(width, height);
|
map = new MapTileData(width, height);
|
||||||
for(int x = 0; x < map.width(); x++){
|
for(int x = 0; x < map.width(); x++){
|
||||||
for(int y = 0; y < map.height(); y++){
|
for(int y = 0; y < map.height(); y++){
|
||||||
map.write(x, y, DataPosition.floor, (byte) Blocks.stone.id);
|
map.write(x, y, DataPosition.floor, Blocks.stone.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderer.resize(width, height);
|
renderer.resize(width, height);
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ import io.anuke.ucore.entities.impl.BaseBulletType;
|
|||||||
import io.anuke.ucore.util.Translator;
|
import io.anuke.ucore.util.Translator;
|
||||||
|
|
||||||
public abstract class BulletType extends Content implements BaseBulletType<Bullet>{
|
public abstract class BulletType extends Content implements BaseBulletType<Bullet>{
|
||||||
public float lifetime = 100;
|
public float lifetime;
|
||||||
public float speed = 1f;
|
public float speed;
|
||||||
public float damage = 1;
|
public float damage;
|
||||||
public float hitsize = 4;
|
public float hitsize = 4;
|
||||||
public float drawSize = 20f;
|
public float drawSize = 20f;
|
||||||
public float drag = 0f;
|
public float drag = 0f;
|
||||||
public boolean pierce;
|
public boolean pierce;
|
||||||
public Effect hiteffect = null, despawneffect = null;
|
public Effect hiteffect, despawneffect;
|
||||||
|
|
||||||
/**Knockback in velocity.*/
|
/**Knockback in velocity.*/
|
||||||
public float knockback;
|
public float knockback;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import io.anuke.ucore.util.SeedRandom;
|
|||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
@@ -161,14 +160,10 @@ public class Lightning extends SolidEntity implements Poolable, DrawTrait, SyncT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutput data) throws IOException{
|
public void write(DataOutput data){}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(DataInput data, long time) throws IOException{
|
public void read(DataInput data, long time){}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float lifetime(){
|
public float lifetime(){
|
||||||
|
|||||||
@@ -334,16 +334,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawUnder(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawOver(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxVelocity(){
|
public float getMaxVelocity(){
|
||||||
return type.maxVelocity;
|
return type.maxVelocity;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class Drone extends FlyingUnit implements BuilderTrait{
|
public class Drone extends FlyingUnit implements BuilderTrait{
|
||||||
protected static float discoverRange = 120f;
|
protected static float discoverRange = 120f;
|
||||||
protected static boolean initialized;
|
|
||||||
protected static int timerRepairEffect = timerIndex++;
|
protected static int timerRepairEffect = timerIndex++;
|
||||||
|
|
||||||
protected Item targetItem;
|
protected Item targetItem;
|
||||||
@@ -234,17 +233,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
static{
|
||||||
initEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize placement event notifier system.
|
|
||||||
* Static initialization is to be avoided, thus, this is done lazily.
|
|
||||||
*/
|
|
||||||
private static void initEvents(){
|
|
||||||
if(initialized) return;
|
|
||||||
|
|
||||||
Events.on(BlockBuildEvent.class, event -> {
|
Events.on(BlockBuildEvent.class, event -> {
|
||||||
EntityGroup<BaseUnit> group = unitGroups[event.team.ordinal()];
|
EntityGroup<BaseUnit> group = unitGroups[event.team.ordinal()];
|
||||||
|
|
||||||
@@ -257,8 +246,6 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyPlaced(BuildEntity entity){
|
private void notifyPlaced(BuildEntity entity){
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ public class Unlocks{
|
|||||||
* @return whether or not this content was newly unlocked.
|
* @return whether or not this content was newly unlocked.
|
||||||
*/
|
*/
|
||||||
public boolean unlockContent(UnlockableContent content){
|
public boolean unlockContent(UnlockableContent content){
|
||||||
if(rootSet().isUnlocked(content)) return false;
|
return !rootSet().isUnlocked(content) && currentSet().unlockContent(content);
|
||||||
return currentSet().unlockContent(content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentUnlockSet currentSet(){
|
private ContentUnlockSet currentSet(){
|
||||||
@@ -76,7 +75,7 @@ public class Unlocks{
|
|||||||
public void load(){
|
public void load(){
|
||||||
sets.clear();
|
sets.clear();
|
||||||
|
|
||||||
ObjectMap<String, ObjectMap<ContentType, Array<String>>> result = Settings.getObject("content-sets", ObjectMap.class, () -> new ObjectMap<>());
|
ObjectMap<String, ObjectMap<ContentType, Array<String>>> result = Settings.getObject("content-sets", ObjectMap.class, ObjectMap::new);
|
||||||
|
|
||||||
for(Entry<String, ObjectMap<ContentType, Array<String>>> outer : result.entries()){
|
for(Entry<String, ObjectMap<ContentType, Array<String>>> outer : result.entries()){
|
||||||
ContentUnlockSet cset = new ContentUnlockSet();
|
ContentUnlockSet cset = new ContentUnlockSet();
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
act.addImageButton("icon-arrow", 16 * 2f, () -> rotation = Mathf.mod(rotation + 1, 4))
|
act.addImageButton("icon-arrow", 16 * 2f, () -> rotation = Mathf.mod(rotation + 1, 4))
|
||||||
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center))
|
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center))
|
||||||
.disabled(i -> recipe == null || !recipe.result.rotate);
|
.disabled(i -> recipe == null || !recipe.result.rotate);
|
||||||
}).visible(() -> mode != none).touchable(Touchable.enabled);;
|
}).visible(() -> mode != none).touchable(Touchable.enabled);
|
||||||
|
|
||||||
c.row();
|
c.row();
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
showGuide("deconstruction");
|
showGuide("deconstruction");
|
||||||
}
|
}
|
||||||
}).update(l -> l.setChecked(mode == breaking));
|
}).update(l -> l.setChecked(mode == breaking));
|
||||||
}).margin(5).touchable(Touchable.enabled);;
|
}).margin(5).touchable(Touchable.enabled);
|
||||||
|
|
||||||
c.table("pane", cancel -> {
|
c.table("pane", cancel -> {
|
||||||
cancel.defaults().size(60f);
|
cancel.defaults().size(60f);
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ public class MapIO{
|
|||||||
Block block = ColorMapper.getByColor(pixmap.getPixel(y, pixmap.getWidth() - 1 - x));
|
Block block = ColorMapper.getByColor(pixmap.getPixel(y, pixmap.getWidth() - 1 - x));
|
||||||
|
|
||||||
if(block == null){
|
if(block == null){
|
||||||
data.write(x, y, DataPosition.floor, (byte) Blocks.stone.id);
|
data.write(x, y, DataPosition.floor, Blocks.stone.id);
|
||||||
}else{
|
}else{
|
||||||
data.write(x, y, DataPosition.floor, (byte) block.id);
|
data.write(x, y, DataPosition.floor, block.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.write(x, y, DataPosition.wall, (byte) Blocks.air.id);
|
data.write(x, y, DataPosition.wall, Blocks.air.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,21 +55,19 @@ public abstract class SaveFileVersion{
|
|||||||
Array<Content>[] map = content.getContentMap();
|
Array<Content>[] map = content.getContentMap();
|
||||||
|
|
||||||
int mappable = 0;
|
int mappable = 0;
|
||||||
for(int i =0; i < map.length; i ++){
|
for(Array<Content> arr : map){
|
||||||
Array<Content> arr = map[i];
|
|
||||||
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
||||||
mappable ++;
|
mappable++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.writeByte(mappable);
|
stream.writeByte(mappable);
|
||||||
for(int i =0; i < map.length; i ++){
|
for(Array<Content> arr : map){
|
||||||
Array<Content> arr = map[i];
|
|
||||||
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
||||||
stream.writeByte(arr.first().getContentType().ordinal());
|
stream.writeByte(arr.first().getContentType().ordinal());
|
||||||
stream.writeShort(arr.size);
|
stream.writeShort(arr.size);
|
||||||
for(Content c : arr){
|
for(Content c : arr){
|
||||||
stream.writeUTF(((MappableContent)c).getContentName());
|
stream.writeUTF(((MappableContent) c).getContentName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(Block.class)
|
@WriteClass(Block.class)
|
||||||
public static void writeBlock(ByteBuffer buffer, Block block){
|
public static void writeBlock(ByteBuffer buffer, Block block){
|
||||||
buffer.put((byte) block.id);
|
buffer.put(block.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReadClass(Block.class)
|
@ReadClass(Block.class)
|
||||||
@@ -278,7 +278,7 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(Liquid.class)
|
@WriteClass(Liquid.class)
|
||||||
public static void writeLiquid(ByteBuffer buffer, Liquid liquid){
|
public static void writeLiquid(ByteBuffer buffer, Liquid liquid){
|
||||||
buffer.put((byte) liquid.id);
|
buffer.put(liquid.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReadClass(Liquid.class)
|
@ReadClass(Liquid.class)
|
||||||
@@ -298,7 +298,7 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(BulletType.class)
|
@WriteClass(BulletType.class)
|
||||||
public static void writeBulletType(ByteBuffer buffer, BulletType type){
|
public static void writeBulletType(ByteBuffer buffer, BulletType type){
|
||||||
buffer.put((byte) type.id);
|
buffer.put(type.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReadClass(BulletType.class)
|
@ReadClass(BulletType.class)
|
||||||
@@ -308,7 +308,7 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(Item.class)
|
@WriteClass(Item.class)
|
||||||
public static void writeItem(ByteBuffer buffer, Item item){
|
public static void writeItem(ByteBuffer buffer, Item item){
|
||||||
buffer.put(item == null ? -1 : (byte) item.id);
|
buffer.put(item == null ? -1 : item.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReadClass(Item.class)
|
@ReadClass(Item.class)
|
||||||
@@ -319,7 +319,7 @@ public class TypeIO{
|
|||||||
|
|
||||||
@WriteClass(Recipe.class)
|
@WriteClass(Recipe.class)
|
||||||
public static void writeRecipe(ByteBuffer buffer, Recipe recipe){
|
public static void writeRecipe(ByteBuffer buffer, Recipe recipe){
|
||||||
buffer.put((byte) recipe.id);
|
buffer.put(recipe.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReadClass(Recipe.class)
|
@ReadClass(Recipe.class)
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class Maps implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
customMapNames = Settings.getObject("custom-maps", Array.class, () -> new Array<>());
|
customMapNames = Settings.getObject("custom-maps", Array.class, Array::new);
|
||||||
|
|
||||||
for(String name : customMapNames){
|
for(String name : customMapNames){
|
||||||
try{
|
try{
|
||||||
|
|||||||
@@ -16,35 +16,42 @@ import static io.anuke.mindustry.Vars.mobile;
|
|||||||
public class SectorPresets{
|
public class SectorPresets{
|
||||||
private final GridMap<SectorPreset> presets = new GridMap<SectorPreset>(){{
|
private final GridMap<SectorPreset> presets = new GridMap<SectorPreset>(){{
|
||||||
//base tutorial mission
|
//base tutorial mission
|
||||||
put(0, 0, new SectorPreset(TutorialSector.getMissions(), Array.with(Items.copper), 1));
|
put(0, 0, new SectorPreset(TutorialSector.getMissions(), 1));
|
||||||
|
|
||||||
//water mission
|
//water mission
|
||||||
put(-2, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
|
put(-2, 0, new SectorPreset(Array.with(), 1));
|
||||||
//command center mission
|
//command center mission
|
||||||
//TODO generate enemy base
|
//TODO generate enemy base
|
||||||
//TODO make 2x2
|
//TODO make 2x2
|
||||||
//TODO more gen info
|
//TODO more gen info
|
||||||
put(0, 1, new SectorPreset(Structs.array(new BlockMission(UnitBlocks.daggerFactory), Missions.blockRecipe(UnitBlocks.commandCenter),
|
put(0, 1, new SectorPreset(Structs.array(new BlockMission(UnitBlocks.daggerFactory), Missions.blockRecipe(UnitBlocks.commandCenter),
|
||||||
new CommandMission(UnitCommand.retreat), new CommandMission(UnitCommand.attack), new BattleMission()), Array.with(Items.copper), 1));
|
new CommandMission(UnitCommand.retreat), new CommandMission(UnitCommand.attack), new BattleMission()), 2));
|
||||||
//reconstructor mission
|
//reconstructor mission
|
||||||
put(0, -1, new SectorPreset(Structs.array(Missions.blockRecipe(mobile ? UpgradeBlocks.tridentPad : UpgradeBlocks.deltaPad),
|
put(0, -1, new SectorPreset(Structs.array(Missions.blockRecipe(mobile ? UpgradeBlocks.tridentPad : UpgradeBlocks.deltaPad),
|
||||||
new MechMission(Mechs.delta)), Array.with(Items.copper), 1));
|
new MechMission(Mechs.delta)), 1));
|
||||||
//oil mission
|
//oil mission
|
||||||
put(1, 0, new SectorPreset(Array.with(), Array.with(Items.copper), 1));
|
put(1, 0, new SectorPreset(Array.with(), 1));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
private final GridMap<Array<Item>> orePresets = new GridMap<Array<Item>>(){{
|
||||||
|
put(0, 0, Array.with(Items.copper));
|
||||||
|
put(1, 0, Array.with(Items.copper, Items.lead, Items.coal));
|
||||||
|
}};
|
||||||
|
|
||||||
|
public Array<Item> getOres(int x, int y){
|
||||||
|
return orePresets.get(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
public SectorPreset get(int x, int y){
|
public SectorPreset get(int x, int y){
|
||||||
return presets.get(x, y);
|
return presets.get(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SectorPreset{
|
public static class SectorPreset{
|
||||||
public final Array<Mission> missions;
|
public final Array<Mission> missions;
|
||||||
public final Array<Item> ores;
|
|
||||||
public final int size;
|
public final int size;
|
||||||
|
|
||||||
public SectorPreset(Array<Mission> missions, Array<Item> ores, int size){
|
public SectorPreset(Array<Mission> missions, int size){
|
||||||
this.missions = missions;
|
this.missions = missions;
|
||||||
this.ores = ores;
|
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,12 +207,7 @@ public class Sectors{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Array<Item> getOres(int x, int y){
|
public Array<Item> getOres(int x, int y){
|
||||||
if(x == 0 && y == 0){
|
return presets.getOres(x, y) == null ? Array.with(Items.copper) : presets.getOres(x, y);
|
||||||
return Array.with(Items.copper);
|
|
||||||
}else if(x == 1 && y == 0){
|
|
||||||
return Array.with(Items.copper, Items.lead, Items.coal);
|
|
||||||
}
|
|
||||||
return Array.with(Items.copper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Unlocks a sector. This shows nearby sectors.*/
|
/**Unlocks a sector. This shows nearby sectors.*/
|
||||||
@@ -263,7 +258,7 @@ public class Sectors{
|
|||||||
}
|
}
|
||||||
grid.clear();
|
grid.clear();
|
||||||
|
|
||||||
Array<Sector> out = Settings.getObject("sectors", Array.class, () -> new Array<>());
|
Array<Sector> out = Settings.getObject("sectors", Array.class, Array::new);
|
||||||
|
|
||||||
for(Sector sector : out){
|
for(Sector sector : out){
|
||||||
createTexture(sector);
|
createTexture(sector);
|
||||||
@@ -297,6 +292,7 @@ public class Sectors{
|
|||||||
if(presets.get(sector.x, sector.y) != null){
|
if(presets.get(sector.x, sector.y) != null){
|
||||||
SectorPreset p = presets.get(sector.x, sector.y);
|
SectorPreset p = presets.get(sector.x, sector.y);
|
||||||
sector.missions.addAll(p.missions);
|
sector.missions.addAll(p.missions);
|
||||||
|
sector.width = sector.height = p.size;
|
||||||
}else{
|
}else{
|
||||||
genMissions(sector);
|
genMissions(sector);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ public class Administration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void load(){
|
private void load(){
|
||||||
playerInfo = Settings.getObject("player-info", ObjectMap.class, () -> new ObjectMap<>());
|
playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new);
|
||||||
bannedIPs = Settings.getObject("banned-ips", Array.class, () -> new Array<>());
|
bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serialize
|
@Serialize
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import io.anuke.ucore.util.Log;
|
|||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static io.anuke.mindustry.Vars.port;
|
|
||||||
|
|
||||||
public class JoinDialog extends FloatingDialog{
|
public class JoinDialog extends FloatingDialog{
|
||||||
Array<Server> servers = new Array<>();
|
Array<Server> servers = new Array<>();
|
||||||
@@ -327,7 +326,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadServers(){
|
private void loadServers(){
|
||||||
servers = Settings.getObject("server-list", Array.class, () -> new Array<>());
|
servers = Settings.getObject("server-list", Array.class, Array::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveServers(){
|
private void saveServers(){
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class SaveDialog extends LoadDialog{
|
|||||||
slot.save();
|
slot.save();
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
e = (e.getCause() == null ? e : e.getCause());
|
|
||||||
|
|
||||||
ui.showError("[orange]" + Bundles.get("text.savefail"));
|
ui.showError("[orange]" + Bundles.get("text.savefail"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ public class BlocksFragment extends Fragment{
|
|||||||
|
|
||||||
descTable.row();
|
descTable.row();
|
||||||
|
|
||||||
descTable.add(requirements);
|
|
||||||
descTable.left();
|
descTable.left();
|
||||||
|
descTable.add(requirements);
|
||||||
|
|
||||||
for(ItemStack stack : recipe.requirements){
|
for(ItemStack stack : recipe.requirements){
|
||||||
requirements.addImage(stack.item.region).size(8 * 3);
|
requirements.addImage(stack.item.region).size(8 * 3);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public class BuildBlock extends Block{
|
|||||||
|
|
||||||
for(TextureRegion region : target.getBlockIcon()){
|
for(TextureRegion region : target.getBlockIcon()){
|
||||||
Shaders.blockbuild.region = region;
|
Shaders.blockbuild.region = region;
|
||||||
Shaders.blockbuild.progress = (float) entity.progress;
|
Shaders.blockbuild.progress = entity.progress;
|
||||||
Shaders.blockbuild.apply();
|
Shaders.blockbuild.apply();
|
||||||
|
|
||||||
Draw.rect(region, tile.drawx(), tile.drawy(), target.rotate ? tile.getRotation() * 90 : 0);
|
Draw.rect(region, tile.drawx(), tile.drawy(), target.rotate ? tile.getRotation() * 90 : 0);
|
||||||
@@ -165,11 +165,6 @@ public class BuildBlock extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(Tile tile){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity newEntity(){
|
public TileEntity newEntity(){
|
||||||
return new BuildEntity();
|
return new BuildEntity();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class Floor extends Block{
|
|||||||
120, 29, 122, 30, 123, 31, 126, 32, 127, 33, 208, 34, 210, 35, 214, 36, 216, 37,
|
120, 29, 122, 30, 123, 31, 126, 32, 127, 33, 208, 34, 210, 35, 214, 36, 216, 37,
|
||||||
218, 38, 219, 39, 222, 40, 223, 41, 248, 42, 250, 43, 251, 44, 254, 45, 255, 46, 0, 47);
|
218, 38, 219, 39, 222, 40, 223, 41, 248, 42, 250, 43, 251, 44, 254, 45, 255, 46, 0, 47);
|
||||||
/** number of different variant regions to use */
|
/** number of different variant regions to use */
|
||||||
public int variants = 0;
|
public int variants;
|
||||||
/** edge fallback, used mainly for ores */
|
/** edge fallback, used mainly for ores */
|
||||||
public String edge = "stone";
|
public String edge = "stone";
|
||||||
/** Multiplies unit velocity by this when walked on. */
|
/** Multiplies unit velocity by this when walked on. */
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import io.anuke.ucore.scene.ui.ButtonGroup;
|
|||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.control;
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public interface SelectionTrait{
|
public interface SelectionTrait{
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ import io.anuke.mindustry.world.ItemBuffer;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class BufferedItemBridge extends ExtendingItemBridge{
|
public class BufferedItemBridge extends ExtendingItemBridge{
|
||||||
protected int timerAccept = timers++;
|
protected int timerAccept = timers++;
|
||||||
|
|
||||||
@@ -47,15 +43,5 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
|||||||
|
|
||||||
class BufferedItemBridgeEntity extends ItemBridgeEntity{
|
class BufferedItemBridgeEntity extends ItemBridgeEntity{
|
||||||
ItemBuffer buffer = new ItemBuffer(bufferCapacity, speed);
|
ItemBuffer buffer = new ItemBuffer(bufferCapacity, speed);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(DataOutputStream stream) throws IOException{
|
|
||||||
super.write(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(DataInputStream stream) throws IOException{
|
|
||||||
super.read(stream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,9 +77,7 @@ public class Conduit extends LiquidBlock{
|
|||||||
Tile other = tile.getNearby(Mathf.mod(tile.getRotation() - direction, 4));
|
Tile other = tile.getNearby(Mathf.mod(tile.getRotation() - direction, 4));
|
||||||
if(other != null) other = other.target();
|
if(other != null) other = other.target();
|
||||||
|
|
||||||
if(other == null || !(other.block().hasLiquids) || !(other.block().outputsLiquid)) return false;
|
return other != null && other.block().hasLiquids && other.block().outputsLiquid && ((tile.getNearby(tile.getRotation()) == other) || (!other.block().rotate || other.getNearby(other.getRotation()) == tile));
|
||||||
return (tile.getNearby(tile.getRotation()) == other)
|
|
||||||
|| (!other.block().rotate || other.getNearby(other.getRotation()) == tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.itemSize;
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Conveyor extends Block{
|
public class Conveyor extends Block{
|
||||||
|
|||||||
@@ -80,11 +80,6 @@ public class WarpGate extends PowerBlock{
|
|||||||
entity.color = color;
|
entity.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStats(){
|
|
||||||
super.setStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerPlaced(Tile tile){
|
public void playerPlaced(Tile tile){
|
||||||
Call.setTeleporterColor(null, tile, lastColor);
|
Call.setTeleporterColor(null, tile, lastColor);
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ public class Fracker extends SolidPump{
|
|||||||
topRegion = Draw.region(name + "-top");
|
topRegion = Draw.region(name + "-top");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStats(){
|
|
||||||
super.setStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
FrackerEntity entity = tile.entity();
|
FrackerEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
|||||||
import io.anuke.mindustry.world.meta.BlockBar;
|
import io.anuke.mindustry.world.meta.BlockBar;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
import io.anuke.mindustry.world.modules.LiquidModule;
|
import io.anuke.mindustry.world.modules.LiquidModule;
|
||||||
import io.anuke.ucore.core.Timers;
|
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
|
||||||
public class LiquidMixer extends LiquidBlock{
|
public class LiquidMixer extends LiquidBlock{
|
||||||
|
|||||||
@@ -166,11 +166,8 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(useFlux && item.fluxiness >= minFlux){
|
return useFlux && item.fluxiness >= minFlux && tile.entity.items.get(item) < itemCapacity;
|
||||||
return tile.entity.items.get(item) < itemCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
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.core.Timers;
|
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@@ -107,8 +106,7 @@ public class SolidPump extends Pump{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValid(Tile tile){
|
protected boolean isValid(Tile tile){
|
||||||
if(tile == null) return false;
|
return tile != null && !tile.floor().isLiquid;
|
||||||
return !tile.floor().isLiquid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -179,12 +179,6 @@ public class CoreBlock extends StorageBlock{
|
|||||||
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;
|
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyed(Tile tile){
|
|
||||||
super.onDestroyed(tile);
|
|
||||||
//TODO more dramatic effects
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
if(Net.server() || !Net.active()) super.handleItem(item, tile, source);
|
if(Net.server() || !Net.active()) super.handleItem(item, tile, source);
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ public class Vault extends StorageBlock{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
|
||||||
super.handleItem(item, tile, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
return tile.entity.items.total() < itemCapacity;
|
return tile.entity.items.total() < itemCapacity;
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ public class ConsumePower extends Consume{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean valid(Block block, TileEntity entity){
|
public boolean valid(Block block, TileEntity entity){
|
||||||
if(entity.power == null) return false;
|
return entity.power != null && entity.power.amount >= use(block, entity);
|
||||||
return entity.power.amount >= use(block, entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ task packrCmd() {
|
|||||||
"--mainclass", project.ext.mainClassName,
|
"--mainclass", project.ext.mainClassName,
|
||||||
"--jdk", PACKR_DIR + "jdk-" + getPlatform() + ".zip",
|
"--jdk", PACKR_DIR + "jdk-" + getPlatform() + ".zip",
|
||||||
"--icon", ICON_DIR.getAbsolutePath(),
|
"--icon", ICON_DIR.getAbsolutePath(),
|
||||||
"--vmargs", (getPlatform().equals("mac") ? "XstartOnFirstThread" : "Xms256m"),
|
"--vmargs", (getPlatform() == "mac" ? "XstartOnFirstThread" : "Xms256m"),
|
||||||
"Djava.net.preferIPv4Stack=true",
|
"Djava.net.preferIPv4Stack=true",
|
||||||
"--classpath", "--", PACKR_DIR + "config.json")
|
"--classpath", "--", PACKR_DIR + "config.json")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,6 @@ public class DesktopPlatform extends Platform{
|
|||||||
return NumberFormat.getIntegerInstance().format(number);
|
return NumberFormat.getIntegerInstance().format(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showError(String text){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocaleName(Locale locale){
|
public String getLocaleName(Locale locale){
|
||||||
return locale.getDisplayName(locale);
|
return locale.getDisplayName(locale);
|
||||||
|
|||||||
@@ -45,13 +45,11 @@ public class FrameworkSerializer {
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}else if(id == 1){
|
}else if(id == 1){
|
||||||
DiscoverHost p = new DiscoverHost();
|
|
||||||
|
|
||||||
return p;
|
return new DiscoverHost();
|
||||||
}else if(id == 2){
|
}else if(id == 2){
|
||||||
KeepAlive p = new KeepAlive();
|
|
||||||
|
|
||||||
return p;
|
return new KeepAlive();
|
||||||
}else if(id == 3){
|
}else if(id == 3){
|
||||||
RegisterUDP p = new RegisterUDP();
|
RegisterUDP p = new RegisterUDP();
|
||||||
p.connectionID = buffer.getInt();
|
p.connectionID = buffer.getInt();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ sourceCompatibility = 1.8
|
|||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
|
project.ext.mainClassName = "io.anuke.mindustry.server.ServerLauncher"
|
||||||
project.ext.assetsDir = new File("../core/assets");
|
project.ext.assetsDir = new File("../core/assets")
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
@@ -30,7 +30,7 @@ task dist(type: Jar) {
|
|||||||
from files(sourceSets.main.output.classesDirs)
|
from files(sourceSets.main.output.classesDirs)
|
||||||
from files(sourceSets.main.output.resourcesDir)
|
from files(sourceSets.main.output.resourcesDir)
|
||||||
from {configurations.compile.collect {zipTree(it)}}
|
from {configurations.compile.collect {zipTree(it)}}
|
||||||
from files(project.assetsDir);
|
from files(project.assetsDir)
|
||||||
|
|
||||||
writeVersion()
|
writeVersion()
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ task deploy(type: Copy){
|
|||||||
dependsOn "dist"
|
dependsOn "dist"
|
||||||
|
|
||||||
from "build/libs/server-release.jar"
|
from "build/libs/server-release.jar"
|
||||||
into "../deploy/";
|
into "../deploy/"
|
||||||
rename ("server-release.jar", appName + "-server-" + getVersionString() + ".jar");
|
rename ("server-release.jar", appName + "-server-" + getVersionString() + ".jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
dist.dependsOn classes
|
dist.dependsOn classes
|
||||||
|
|||||||
@@ -291,8 +291,7 @@ public class ServerControl extends Module{
|
|||||||
|
|
||||||
handler.register("difficulty", "<difficulty>", "Set game difficulty.", arg -> {
|
handler.register("difficulty", "<difficulty>", "Set game difficulty.", arg -> {
|
||||||
try{
|
try{
|
||||||
Difficulty diff = Difficulty.valueOf(arg[0]);
|
state.difficulty = Difficulty.valueOf(arg[0]);
|
||||||
state.difficulty = diff;
|
|
||||||
info("Difficulty set to '{0}'.", arg[0]);
|
info("Difficulty set to '{0}'.", arg[0]);
|
||||||
}catch(IllegalArgumentException e){
|
}catch(IllegalArgumentException e){
|
||||||
err("No difficulty with name '{0}' found.", arg[0]);
|
err("No difficulty with name '{0}' found.", arg[0]);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
include 'desktop', 'html', 'core', 'android', 'kryonet', 'server', 'ios', 'annotations', 'tools', 'tests'
|
include 'desktop', 'html', 'core', 'android', 'kryonet', 'server', 'ios', 'annotations', 'tools', 'tests'
|
||||||
|
|
||||||
if(System.properties["release"] == null || System.properties["release"].equals("false")){
|
if(System.properties["release"] == null || System.properties["release"] == "false"){
|
||||||
if (new File(settingsDir, '../uCore').exists()) {
|
if (new File(settingsDir, '../uCore').exists()) {
|
||||||
include ':uCore'
|
include ':uCore'
|
||||||
project(':uCore').projectDir = new File(settingsDir, '../uCore')
|
project(':uCore').projectDir = new File(settingsDir, '../uCore')
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ def textureFolder = "../core/assets-raw/sprites/generated/"
|
|||||||
task swapColors(){
|
task swapColors(){
|
||||||
doLast{
|
doLast{
|
||||||
if (project.hasProperty("colors")) {
|
if (project.hasProperty("colors")) {
|
||||||
def carr = new File(getProperty("colors")).text.split("\n");
|
def carr = new File(getProperty("colors")).text.split("\n")
|
||||||
def map = [:]
|
def map = [:]
|
||||||
def swaps = 0
|
def swaps = 0
|
||||||
carr.each {str -> map[Color.argb8888(Color.valueOf(str.split("=")[0]))] = Color.argb8888(Color.valueOf(str.split("=")[1]))}
|
carr.each {str -> map[Color.argb8888(Color.valueOf(str.split("=")[0]))] = Color.argb8888(Color.valueOf(str.split("=")[1]))}
|
||||||
def tmpc = new Color()
|
def tmpc = new Color()
|
||||||
|
|
||||||
fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit { file ->
|
fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit { file ->
|
||||||
if(file.isDirectory()) return;
|
if(file.isDirectory()) return
|
||||||
swaps ++
|
swaps ++
|
||||||
|
|
||||||
def img = ImageIO.read(file.file)
|
def img = ImageIO.read(file.file)
|
||||||
@@ -39,7 +39,7 @@ task swapColors(){
|
|||||||
}
|
}
|
||||||
println "Swapped $swaps images."
|
println "Swapped $swaps images."
|
||||||
}else{
|
}else{
|
||||||
throw new InvalidUserDataException("No replacement colors specified. Use -Pcolors=\"<path to color file>\"");
|
throw new InvalidUserDataException("No replacement colors specified. Use -Pcolors=\"<path to color file>\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user