More difficulty tweaks, made sandbox work properly
This commit is contained in:
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
@@ -664,7 +664,7 @@ blocks/oil
|
|||||||
index: -1
|
index: -1
|
||||||
blocks/oiledge
|
blocks/oiledge
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 456, 423
|
xy: 470, 423
|
||||||
size: 12, 12
|
size: 12, 12
|
||||||
orig: 12, 12
|
orig: 12, 12
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
@@ -1579,9 +1579,9 @@ laserend
|
|||||||
orig: 18, 18
|
orig: 18, 18
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
mechs/player
|
mechs/mech-standard
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 470, 423
|
xy: 456, 423
|
||||||
size: 12, 12
|
size: 12, 12
|
||||||
orig: 12, 12
|
orig: 12, 12
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
@@ -159,6 +159,14 @@ public class Control extends Module{
|
|||||||
//multiplying by 2 so you start with more time in the beginning
|
//multiplying by 2 so you start with more time in the beginning
|
||||||
wavetime = waveSpacing()*2;
|
wavetime = waveSpacing()*2;
|
||||||
|
|
||||||
|
if(mode == GameMode.sandbox){
|
||||||
|
for(Item type : Item.values()){
|
||||||
|
items.put(type, 999999999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.updateItems();
|
||||||
|
|
||||||
GameState.set(State.playing);
|
GameState.set(State.playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +244,7 @@ public class Control extends Module{
|
|||||||
int index = i;
|
int index = i;
|
||||||
float range = 12f;
|
float range = 12f;
|
||||||
|
|
||||||
Timers.run(index*50f, ()->{
|
Timers.run(index*5f, ()->{
|
||||||
try{
|
try{
|
||||||
Enemy enemy = ClassReflection.newInstance(spawn.type);
|
Enemy enemy = ClassReflection.newInstance(spawn.type);
|
||||||
enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range));
|
enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range));
|
||||||
|
|||||||
@@ -409,7 +409,8 @@ public class Renderer extends RendererModule{
|
|||||||
Draw.thickness(2f);
|
Draw.thickness(2f);
|
||||||
Draw.linecrect(x + offset.x, y + offset.y, tilesize * player.recipe.result.width + si, tilesize * player.recipe.result.height + si);
|
Draw.linecrect(x + offset.x, y + offset.y, tilesize * player.recipe.result.width + si, tilesize * player.recipe.result.height + si);
|
||||||
|
|
||||||
player.recipe.result.drawPlace(tilex, tiley, valid);
|
player.recipe.result.drawPlace(tilex, tiley, player.rotation, valid);
|
||||||
|
Draw.thickness(2f);
|
||||||
|
|
||||||
if(player.recipe.result.rotate){
|
if(player.recipe.result.rotate){
|
||||||
Draw.color("orange");
|
Draw.color("orange");
|
||||||
@@ -420,7 +421,7 @@ public class Renderer extends RendererModule{
|
|||||||
Draw.thickness(1f);
|
Draw.thickness(1f);
|
||||||
Draw.color("scarlet");
|
Draw.color("scarlet");
|
||||||
for(SpawnPoint spawn : control.getSpawnPoints()){
|
for(SpawnPoint spawn : control.getSpawnPoints()){
|
||||||
Draw.dashcircle(spawn.start.worldx(), spawn.start.worldy(), enemyspawnspace);
|
Draw.dashCircle(spawn.start.worldx(), spawn.start.worldy(), enemyspawnspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(valid)
|
if(valid)
|
||||||
|
|||||||
@@ -379,6 +379,10 @@ public class UI extends SceneModule{
|
|||||||
about.show();
|
about.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onDialog(){
|
||||||
|
return scene.getKeyboardFocus() instanceof Dialog;
|
||||||
|
}
|
||||||
|
|
||||||
public void showUpgrades(){
|
public void showUpgrades(){
|
||||||
upgrades.show();
|
upgrades.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
DamageArea.damage(!(b.owner instanceof Enemy), b.x, b.y, 25f, (int)(damage * 2f/3f));
|
DamageArea.damage(!(b.owner instanceof Enemy), b.x, b.y, 25f, (int)(damage * 2f/3f));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
titanshell = new BulletType(1.8f, 60){
|
titanshell = new BulletType(1.8f, 40){
|
||||||
{
|
{
|
||||||
lifetime = 70f;
|
lifetime = 70f;
|
||||||
hitsize = 11f;
|
hitsize = 15f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b){
|
public void draw(Bullet b){
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ public class EnemySpawn{
|
|||||||
/**The spacing, in waves, of spawns. 2 = spawns every other wave*/
|
/**The spacing, in waves, of spawns. 2 = spawns every other wave*/
|
||||||
protected int spacing = 1;
|
protected int spacing = 1;
|
||||||
/**How many waves need to pass after the start of this spawn for the tier to increase by one*/
|
/**How many waves need to pass after the start of this spawn for the tier to increase by one*/
|
||||||
protected int tierscale = 15;
|
protected int tierscale = 14;
|
||||||
/**How many less enemies there are, every time the tier increases*/
|
/**How many less enemies there are, every time the tier increases*/
|
||||||
protected int tierscaleback = 1;
|
protected int tierscaleback = 1;
|
||||||
|
/**The tier this spawn starts at.*/
|
||||||
|
protected int tier = 1;
|
||||||
/**Maximum amount of enemies that spawn*/
|
/**Maximum amount of enemies that spawn*/
|
||||||
protected int max = 17;
|
protected int max = 17;
|
||||||
/**How many waves need to pass before the amount of enemies increases by 1*/
|
/**How many waves need to pass before the amount of enemies increases by 1*/
|
||||||
@@ -35,6 +37,6 @@ public class EnemySpawn{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int tier(int wave, int lane){
|
public int tier(int wave, int lane){
|
||||||
return Mathf.clamp(1 + (wave-after)/tierscale, 1, Enemy.maxtier);
|
return Mathf.clamp(tier + (wave-after)/tierscale, 1, Enemy.maxtier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.entities.effect.Fx;
|
import io.anuke.mindustry.entities.effect.Fx;
|
||||||
import io.anuke.mindustry.input.Input;
|
import io.anuke.mindustry.input.Input;
|
||||||
|
import io.anuke.mindustry.resource.Mech;
|
||||||
import io.anuke.mindustry.resource.Recipe;
|
import io.anuke.mindustry.resource.Recipe;
|
||||||
import io.anuke.mindustry.resource.Weapon;
|
import io.anuke.mindustry.resource.Weapon;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
@@ -18,6 +19,7 @@ import io.anuke.ucore.util.Angles;
|
|||||||
|
|
||||||
public class Player extends DestructibleEntity{
|
public class Player extends DestructibleEntity{
|
||||||
public Weapon weapon;
|
public Weapon weapon;
|
||||||
|
public Mech mech = Mech.standard;
|
||||||
public float breaktime = 0;
|
public float breaktime = 0;
|
||||||
|
|
||||||
public Recipe recipe;
|
public Recipe recipe;
|
||||||
@@ -50,9 +52,9 @@ public class Player extends DestructibleEntity{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
|
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
|
||||||
Draw.rect("player", (int)x, (int)y, direction.angle()-90);
|
Draw.rect("mech-"+mech.name(), (int)x, (int)y, direction.angle()-90);
|
||||||
}else{
|
}else{
|
||||||
Draw.rect("player", x, y, direction.angle()-90);
|
Draw.rect("mech-"+mech.name(), x, y, direction.angle()-90);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class TileEntity extends Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean collide(Bullet other){
|
public boolean collide(Bullet other){
|
||||||
return other.owner instanceof Enemy;
|
return other.owner instanceof Enemy; //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,11 +53,18 @@ public class WaveCreator{
|
|||||||
amount = 1;
|
amount = 1;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
new EnemySpawn(Enemy.class){{
|
||||||
|
scaling = 3;
|
||||||
|
after = 8;
|
||||||
|
spacing = 4;
|
||||||
|
tier = 2;
|
||||||
|
}},
|
||||||
|
|
||||||
new EnemySpawn(TitanEnemy.class){{
|
new EnemySpawn(TitanEnemy.class){{
|
||||||
after = 6;
|
after = 6;
|
||||||
amount = 2;
|
amount = 2;
|
||||||
spacing = 5;
|
spacing = 5;
|
||||||
scaling = 3;
|
scaling = 2;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
new EnemySpawn(FlamerEnemy.class){{
|
new EnemySpawn(FlamerEnemy.class){{
|
||||||
@@ -67,6 +74,13 @@ public class WaveCreator{
|
|||||||
scaling = 2;
|
scaling = 2;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
new EnemySpawn(EmpEnemy.class){{
|
||||||
|
after = 15;
|
||||||
|
amount = 1;
|
||||||
|
spacing = 5;
|
||||||
|
scaling = 1;
|
||||||
|
}},
|
||||||
|
|
||||||
new EnemySpawn(BlastEnemy.class){{
|
new EnemySpawn(BlastEnemy.class){{
|
||||||
after = 4 + 5 + 5;
|
after = 4 + 5 + 5;
|
||||||
amount = 3;
|
amount = 3;
|
||||||
|
|||||||
@@ -27,10 +27,20 @@ public class BlastEnemy extends Enemy{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(target != null && target.distanceTo(this) < range){
|
if(target != null && target.distanceTo(this) < range){
|
||||||
Bullet b = new Bullet(BulletType.blast, this, x, y, 0).add();
|
explode();
|
||||||
b.damage = BulletType.blast.damage + (tier-1) * 40;
|
|
||||||
damage(999);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeath(){
|
||||||
|
super.onDeath();
|
||||||
|
explode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void explode(){
|
||||||
|
Bullet b = new Bullet(BulletType.blast, this, x, y, 0).add();
|
||||||
|
b.damage = BulletType.blast.damage + (tier-1) * 40;
|
||||||
|
damage(999);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ public class EmpEnemy extends Enemy{
|
|||||||
|
|
||||||
public EmpEnemy() {
|
public EmpEnemy() {
|
||||||
|
|
||||||
speed = 0.27f;
|
speed = 0.3f;
|
||||||
reload = 70;
|
reload = 60;
|
||||||
maxhealth = 210;
|
maxhealth = 210;
|
||||||
range = 80f;
|
range = 80f;
|
||||||
bullet = BulletType.emp;
|
bullet = BulletType.emp;
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
maxhealth *= tier;
|
maxhealth *= tier;
|
||||||
speed += 0.04f * tier + Mathf.range(0.1f);
|
speed += 0.04f * tier /*+ Mathf.range(0.1f)*/;
|
||||||
reload /= Math.max(tier / 1.5f, 1f);
|
reload /= Math.max(tier / 1.5f, 1f);
|
||||||
range += tier * 5;
|
range += tier * 5;
|
||||||
speed = Math.max(speed, 0.07f);
|
speed = Math.max(speed, 0.07f);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ public class FortressEnemy extends Enemy{
|
|||||||
|
|
||||||
public FortressEnemy() {
|
public FortressEnemy() {
|
||||||
|
|
||||||
speed = 0.2f;
|
speed = 0.25f;
|
||||||
reload = 90;
|
reload = 90;
|
||||||
maxhealth = 700;
|
maxhealth = 800;
|
||||||
range = 70f;
|
range = 70f;
|
||||||
bullet = BulletType.yellowshell;
|
bullet = BulletType.yellowshell;
|
||||||
hitbox.setSize(10f);
|
hitbox.setSize(10f);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ public class HealerEnemy extends Enemy{
|
|||||||
|
|
||||||
public HealerEnemy() {
|
public HealerEnemy() {
|
||||||
|
|
||||||
speed = 0.2f;
|
speed = 0.25f;
|
||||||
reload = 14;
|
reload = 10;
|
||||||
maxhealth = 130;
|
maxhealth = 200;
|
||||||
range = 90f;
|
range = 90f;
|
||||||
bullet = BulletType.shot;
|
bullet = BulletType.shot;
|
||||||
range = 30f;
|
range = 30f;
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ public class TitanEnemy extends Enemy{
|
|||||||
|
|
||||||
public TitanEnemy() {
|
public TitanEnemy() {
|
||||||
|
|
||||||
speed = 0.22f;
|
speed = 0.26f;
|
||||||
reload = 30;
|
reload = 30;
|
||||||
maxhealth = 421;
|
maxhealth = 430;
|
||||||
range = 60f;
|
range = 60f;
|
||||||
bullet = BulletType.small;
|
bullet = BulletType.small;
|
||||||
hitbox.setSize(7f);
|
hitbox.setSize(7f);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Input{
|
|||||||
//player is dead
|
//player is dead
|
||||||
if(player.health <= 0) return;
|
if(player.health <= 0) return;
|
||||||
|
|
||||||
if(Inputs.scrolled() && GameState.is(State.playing)){
|
if(Inputs.scrolled() && !GameState.is(State.menu) && !Vars.ui.onDialog()){
|
||||||
Vars.renderer.scaleCamera(Inputs.scroll());
|
Vars.renderer.scaleCamera(Inputs.scroll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package io.anuke.mindustry.resource;
|
package io.anuke.mindustry.resource;
|
||||||
|
|
||||||
public enum Mech{
|
public enum Mech{
|
||||||
normal("default"),
|
standard,
|
||||||
scout("scout"){{
|
scout{{
|
||||||
|
|
||||||
}};
|
}};
|
||||||
public final String name;
|
|
||||||
public float speedBoost = 1f, damageBoost = 1f;
|
public float speedBoost = 1f, damageBoost = 1f;
|
||||||
public int regenRate = 10;
|
public int regenRate = 10;
|
||||||
public int health = 20;
|
public int health = 20;
|
||||||
|
|
||||||
private Mech(String name){
|
private Mech(){
|
||||||
this.name = name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public enum Recipe{
|
|||||||
mortarturret(weapon, WeaponBlocks.mortarturret, stack(Item.steel, 20), stack(Item.titanium, 15)),
|
mortarturret(weapon, WeaponBlocks.mortarturret, stack(Item.steel, 20), stack(Item.titanium, 15)),
|
||||||
teslaturret(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)),
|
teslaturret(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)),
|
||||||
plasmaturret(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
|
plasmaturret(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
|
||||||
chainturret(weapon, WeaponBlocks.chainturret, stack(Item.steel, 35), stack(Item.titanium, 25), stack(Item.dirium, 35)),
|
chainturret(weapon, WeaponBlocks.chainturret, stack(Item.steel, 50), stack(Item.titanium, 25), stack(Item.dirium, 35)),
|
||||||
titanturret(weapon, WeaponBlocks.titanturret, stack(Item.steel, 50), stack(Item.titanium, 45), stack(Item.dirium, 55)),
|
titanturret(weapon, WeaponBlocks.titanturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
|
||||||
|
|
||||||
smelter(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
|
smelter(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
|
||||||
crucible(crafting, ProductionBlocks.crucible, stack(Item.titanium, 40), stack(Item.steel, 40)),
|
crucible(crafting, ProductionBlocks.crucible, stack(Item.titanium, 40), stack(Item.steel, 40)),
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Timer;
|
|
||||||
import com.badlogic.gdx.utils.Timer.Task;
|
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState;
|
import io.anuke.mindustry.core.GameState;
|
||||||
@@ -20,7 +18,7 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
|||||||
public class LoadDialog extends FloatingDialog{
|
public class LoadDialog extends FloatingDialog{
|
||||||
ScrollPane pane;
|
ScrollPane pane;
|
||||||
|
|
||||||
public LoadDialog(){
|
public LoadDialog() {
|
||||||
this("Load Game");
|
this("Load Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,10 +26,9 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
super(title);
|
super(title);
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
setup();
|
setup();
|
||||||
Timers.runTask(2f, ()-> Core.scene.setScrollFocus(pane));
|
Timers.runTask(2f, () -> Core.scene.setScrollFocus(pane));
|
||||||
});
|
});
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
@@ -58,9 +55,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
|
|
||||||
Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? "<empty>" : SaveIO.getMode(slot) + ", " +
|
Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? "<empty>" : SaveIO.getMode(slot) + ", " + SaveIO.getMap(slot) + ", Wave " + SaveIO.getWave(slot) + "\nLast Saved: " + SaveIO.getTimeString(i)));
|
||||||
SaveIO.getMap(slot) +
|
|
||||||
", Wave " + SaveIO.getWave(slot) + "\nLast Saved: " + 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);
|
||||||
@@ -84,26 +79,22 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
if(!button.isDisabled()){
|
if(!button.isDisabled()){
|
||||||
Vars.ui.showLoading();
|
Vars.ui.showLoading();
|
||||||
|
|
||||||
Timer.schedule(new Task(){
|
Timers.runTask(3f, () -> {
|
||||||
@Override
|
Vars.ui.hideLoading();
|
||||||
public void run(){
|
hide();
|
||||||
Vars.ui.hideLoading();
|
try{
|
||||||
hide();
|
SaveIO.loadFromSlot(slot);
|
||||||
try{
|
GameState.set(State.playing);
|
||||||
SaveIO.loadFromSlot(slot);
|
Vars.ui.hideMenu();
|
||||||
GameState.set(State.playing);
|
}catch(Exception e){
|
||||||
Vars.ui.hideMenu();
|
e.printStackTrace();
|
||||||
}catch(Exception e){
|
Vars.ui.hideMenu();
|
||||||
e.printStackTrace();
|
GameState.set(State.menu);
|
||||||
Vars.ui.hideMenu();
|
Vars.control.reset();
|
||||||
GameState.set(State.menu);
|
Vars.ui.showError("[orange]Save file corrupted or invalid!");
|
||||||
Vars.control.reset();
|
return;
|
||||||
Vars.ui.showError("[orange]Save file corrupted or invalid!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 3f/60f);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Timer;
|
|
||||||
import com.badlogic.gdx.utils.Timer.Task;
|
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.SaveIO;
|
||||||
|
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;
|
||||||
@@ -14,21 +13,23 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
|||||||
//TODO unified save/load dialogs
|
//TODO unified save/load dialogs
|
||||||
public class SaveDialog extends LoadDialog{
|
public class SaveDialog extends LoadDialog{
|
||||||
|
|
||||||
public SaveDialog(){
|
public SaveDialog() {
|
||||||
super("Save Game");
|
super("Save Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
@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("Overwrite", "Are you sure you want to overwrite\nthis save slot?", () -> {
|
||||||
save(slot);
|
save(slot);
|
||||||
}){{
|
}){
|
||||||
content().pad(16);
|
{
|
||||||
for(Cell<?> cell : getButtonTable().getCells())
|
content().pad(16);
|
||||||
cell.size(110, 45).pad(4).units(Unit.dp);
|
for(Cell<?> cell : getButtonTable().getCells())
|
||||||
}}.show();
|
cell.size(110, 45).pad(4).units(Unit.dp);
|
||||||
|
}
|
||||||
|
}.show();
|
||||||
}else{
|
}else{
|
||||||
save(slot);
|
save(slot);
|
||||||
}
|
}
|
||||||
@@ -38,23 +39,17 @@ public class SaveDialog extends LoadDialog{
|
|||||||
void save(int slot){
|
void save(int slot){
|
||||||
Vars.ui.showLoading("[orange]Saving...");
|
Vars.ui.showLoading("[orange]Saving...");
|
||||||
|
|
||||||
Timer.schedule(new Task(){
|
Timers.runTask(5f, () -> {
|
||||||
@Override
|
hide();
|
||||||
public void run(){
|
Vars.ui.hideLoading();
|
||||||
hide();
|
try{
|
||||||
Vars.ui.hideLoading();
|
SaveIO.saveToSlot(slot);
|
||||||
try{
|
}catch(Throwable e){
|
||||||
SaveIO.saveToSlot(slot);
|
e = (e.getCause() == null ? e : e.getCause());
|
||||||
}catch (Throwable e){
|
|
||||||
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]Failed to save game!\n[white]" + ClassReflection.getSimpleName(e.getClass()) + ": " + e.getMessage() + "\n" + "at " + e.getStackTrace()[0].getFileName() + ":" + e.getStackTrace()[0].getLineNumber());
|
||||||
}
|
}
|
||||||
}, 5f/60f);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
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.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);
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ import io.anuke.ucore.scene.builders.label;
|
|||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
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.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.Profiler;
|
import io.anuke.ucore.util.Profiler;
|
||||||
|
|
||||||
public class HudFragment implements Fragment{
|
public class HudFragment implements Fragment{
|
||||||
private Table itemtable, respawntable;
|
private Table itemtable, respawntable;
|
||||||
|
private Cell<Table> itemcell;
|
||||||
private Array<Item> tempItems = new Array<>();
|
private Array<Item> tempItems = new Array<>();
|
||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
@@ -63,6 +65,8 @@ public class HudFragment implements Fragment{
|
|||||||
row();
|
row();
|
||||||
|
|
||||||
itemtable = new table("button").end().top().left().fillX().size(-1).get();
|
itemtable = new table("button").end().top().left().fillX().size(-1).get();
|
||||||
|
itemtable.setVisible(()-> control.getMode() != GameMode.sandbox);
|
||||||
|
itemcell = get().getCell(itemtable);
|
||||||
|
|
||||||
get().setVisible(()->!GameState.is(State.menu));
|
get().setVisible(()->!GameState.is(State.menu));
|
||||||
|
|
||||||
@@ -167,6 +171,10 @@ public class HudFragment implements Fragment{
|
|||||||
itemtable.clear();
|
itemtable.clear();
|
||||||
itemtable.left();
|
itemtable.left();
|
||||||
|
|
||||||
|
if(control.getMode() == GameMode.sandbox){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tempItems.clear();
|
tempItems.clear();
|
||||||
for(Item item : control.getItems().keys()){
|
for(Item item : control.getItems().keys()){
|
||||||
tempItems.add(item);
|
tempItems.add(item);
|
||||||
@@ -174,8 +182,13 @@ public class HudFragment implements Fragment{
|
|||||||
tempItems.sort();
|
tempItems.sort();
|
||||||
|
|
||||||
for(Item stack : tempItems){
|
for(Item stack : tempItems){
|
||||||
|
int amount = control.getAmount(stack);
|
||||||
|
String formatted = Mindustry.formatter.format(amount);
|
||||||
|
if(amount > 99999999){
|
||||||
|
formatted = "inf";
|
||||||
|
}
|
||||||
Image image = new Image(Draw.region("icon-" + stack.name()));
|
Image image = new Image(Draw.region("icon-" + stack.name()));
|
||||||
Label label = new Label("" + Mindustry.formatter.format(control.getAmount(stack)));
|
Label label = new Label(formatted);
|
||||||
label.setFontScale(fontscale*1.5f);
|
label.setFontScale(fontscale*1.5f);
|
||||||
itemtable.add(image).size(8*3).units(Unit.dp);
|
itemtable.add(image).size(8*3).units(Unit.dp);
|
||||||
itemtable.add(label).left();
|
itemtable.add(label).left();
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class Block{
|
|||||||
|
|
||||||
public void drawOver(Tile tile){}
|
public void drawOver(Tile tile){}
|
||||||
public void drawPixelOverlay(Tile tile){}
|
public void drawPixelOverlay(Tile tile){}
|
||||||
public void drawPlace(int x, int y, boolean valid){}
|
public void drawPlace(int x, int y, int rotation, boolean valid){}
|
||||||
public void postInit(){}
|
public void postInit(){}
|
||||||
|
|
||||||
public void getStats(Array<String> list){
|
public void getStats(Array<String> list){
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class Generator{
|
|||||||
|
|
||||||
if(floor == Blocks.stone || floor == Blocks.grass || floor == Blocks.blackstone ||
|
if(floor == Blocks.stone || floor == Blocks.grass || floor == Blocks.blackstone ||
|
||||||
floor == Blocks.snow || floor == Blocks.sand){
|
floor == Blocks.snow || floor == Blocks.sand){
|
||||||
if(Noise.nnoise(x, y, 8, 1) > 0.2){
|
if(Noise.nnoise(x, y, 8, 1) > 0.21){
|
||||||
floor = Blocks.iron;
|
floor = Blocks.iron;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class Generator{
|
|||||||
floor = Blocks.coal;
|
floor = Blocks.coal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.264){
|
if(Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.27){
|
||||||
floor = Blocks.titanium;
|
floor = Blocks.titanium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,8 +207,8 @@ public class Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void changed(){
|
public void changed(){
|
||||||
if(entity != null && entity.added){
|
if(entity != null){
|
||||||
entity.remove();
|
if(entity.added) entity.remove();
|
||||||
entity = null;
|
entity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ public class World extends Module{
|
|||||||
|
|
||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
|
|
||||||
Block block = tile.block();
|
Block block = tile.isLinked() ? tile.getLinked().block() : tile.block();
|
||||||
Recipe result = null;
|
Recipe result = null;
|
||||||
|
|
||||||
for(Recipe recipe : Recipe.values()){
|
for(Recipe recipe : Recipe.values()){
|
||||||
@@ -420,7 +420,7 @@ public class World extends Module{
|
|||||||
other = other.getLinked();
|
other = other.getLinked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(other == null || other.entity == null ||(tile != null && other.entity == tile.entity)) continue;
|
if(other == null || other.entity == null || (tile != null && other.entity == tile.entity)) continue;
|
||||||
|
|
||||||
TileEntity e = other.entity;
|
TileEntity e = other.entity;
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class DefenseBlocks{
|
|||||||
+ "Uses small amounts of power.";
|
+ "Uses small amounts of power.";
|
||||||
formalName = "repair turret";
|
formalName = "repair turret";
|
||||||
range = 30;
|
range = 30;
|
||||||
reload = 40f;
|
reload = 60f;
|
||||||
health = 60;
|
health = 60;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -83,7 +83,8 @@ public class DefenseBlocks{
|
|||||||
+ "Uses power.";
|
+ "Uses power.";
|
||||||
formalName = "repair turret II";
|
formalName = "repair turret II";
|
||||||
range = 44;
|
range = 44;
|
||||||
reload = 20f;
|
reload = 30f;
|
||||||
|
powerUsed = 0.15f;
|
||||||
health = 90;
|
health = 90;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ public class ProductionBlocks{
|
|||||||
formalName = "thermal generator";
|
formalName = "thermal generator";
|
||||||
//TODO
|
//TODO
|
||||||
generateLiquid = Liquid.lava;
|
generateLiquid = Liquid.lava;
|
||||||
inputLiquid = 20f;
|
inputLiquid = 25f;
|
||||||
generatePower = 1f;
|
generatePower = 0.5f;
|
||||||
powerCapacity = 40f;
|
powerCapacity = 40f;
|
||||||
description = "Generates power from lava.";
|
description = "Generates power from lava.";
|
||||||
fullDescription = "Generates power from lava. Outputs power as lasers to its 4 sides.";
|
fullDescription = "Generates power from lava. Outputs power as lasers to its 4 sides.";
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class WeaponBlocks{
|
|||||||
inaccuracy = 8f;
|
inaccuracy = 8f;
|
||||||
formalName = "chain turret";
|
formalName = "chain turret";
|
||||||
range = 80f;
|
range = 80f;
|
||||||
reload = 7f;
|
reload = 8f;
|
||||||
bullet = BulletType.chain;
|
bullet = BulletType.chain;
|
||||||
ammo = Item.uranium;
|
ammo = Item.uranium;
|
||||||
health = 430;
|
health = 430;
|
||||||
@@ -219,7 +219,7 @@ public class WeaponBlocks{
|
|||||||
{
|
{
|
||||||
formalName = "titan cannon";
|
formalName = "titan cannon";
|
||||||
range = 120f;
|
range = 120f;
|
||||||
reload = 20f;
|
reload = 23f;
|
||||||
bullet = BulletType.titanshell;
|
bullet = BulletType.titanshell;
|
||||||
ammo = Item.uranium;
|
ammo = Item.uranium;
|
||||||
health = 800;
|
health = 800;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class PowerTurret extends Turret implements PowerAcceptor{
|
|||||||
Vector2 offset = getPlaceOffset();
|
Vector2 offset = getPlaceOffset();
|
||||||
|
|
||||||
Draw.color("green");
|
Draw.color("green");
|
||||||
Draw.dashcircle(tile.worldx() + offset.x, tile.worldy() + offset.y, range);
|
Draw.dashCircle(tile.worldx() + offset.x, tile.worldy() + offset.y, range);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
drawPowerBar(tile);
|
drawPowerBar(tile);
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public class RepairTurret extends PowerTurret{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(entity.blockTarget != null && entity.blockTarget.dead){
|
||||||
|
entity.blockTarget = null;
|
||||||
|
}
|
||||||
|
|
||||||
if(Timers.get(entity, "blocktarget", targetInterval)){
|
if(Timers.get(entity, "blocktarget", targetInterval)){
|
||||||
entity.blockTarget = Vars.world.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true);
|
entity.blockTarget = Vars.world.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true);
|
||||||
}
|
}
|
||||||
@@ -64,7 +68,7 @@ public class RepairTurret extends PowerTurret{
|
|||||||
@Override
|
@Override
|
||||||
public void drawPixelOverlay(Tile tile){
|
public void drawPixelOverlay(Tile tile){
|
||||||
Draw.color("green");
|
Draw.color("green");
|
||||||
Draw.dashcircle(tile.worldx(), tile.worldy(), range);
|
Draw.dashCircle(tile.worldx(), tile.worldy(), range);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
drawPowerBar(tile);
|
drawPowerBar(tile);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class Turret extends Block{
|
|||||||
Vector2 offset = getPlaceOffset();
|
Vector2 offset = getPlaceOffset();
|
||||||
|
|
||||||
Draw.color("green");
|
Draw.color("green");
|
||||||
Draw.dashcircle(tile.worldx() + offset.x, tile.worldy() + offset.y, range);
|
Draw.dashCircle(tile.worldx() + offset.x, tile.worldy() + offset.y, range);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
TurretEntity entity = tile.entity();
|
TurretEntity entity = tile.entity();
|
||||||
@@ -116,10 +116,10 @@ public class Turret extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
Draw.color(Color.PURPLE);
|
Draw.color(Color.PURPLE);
|
||||||
Draw.thick(1f);
|
Draw.thick(1f);
|
||||||
Draw.dashcircle(x*Vars.tilesize, y*Vars.tilesize, range);
|
Draw.dashCircle(x*Vars.tilesize, y*Vars.tilesize, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,7 +25,14 @@ public class PowerBooster extends Generator{
|
|||||||
super.drawPixelOverlay(tile);
|
super.drawPixelOverlay(tile);
|
||||||
|
|
||||||
Draw.color("yellow");
|
Draw.color("yellow");
|
||||||
Draw.dashcircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize);
|
Draw.dashCircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
Draw.color("purple");
|
||||||
|
Draw.dashCircle(x * Vars.tilesize, y * Vars.tilesize, laserRange * Vars.tilesize);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class Drill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawOver(Tile tile){
|
public void drawOver(Tile tile){
|
||||||
if(tile.floor() != resource && !(resource.drops.equals(tile.floor().drops)) && resource != null){
|
if(tile.floor() != resource && resource != null && !(resource.drops.equals(tile.floor().drops))){
|
||||||
Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f));
|
Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f));
|
||||||
Draw.rect("cross", tile.worldx(), tile.worldy());
|
Draw.rect("cross", tile.worldx(), tile.worldy());
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import io.anuke.ucore.util.*;
|
|||||||
|
|
||||||
public class Generator extends PowerBlock{
|
public class Generator extends PowerBlock{
|
||||||
public static final int powerTime = 2;
|
public static final int powerTime = 2;
|
||||||
|
public static boolean drawRangeOverlay = false;
|
||||||
|
|
||||||
public int laserRange = 6;
|
public int laserRange = 6;
|
||||||
public int laserDirections = 4;
|
public int laserDirections = 4;
|
||||||
@@ -36,7 +37,7 @@ public class Generator extends PowerBlock{
|
|||||||
|
|
||||||
if(hasLasers){
|
if(hasLasers){
|
||||||
list.add("[powerinfo]Laser range: " + laserRange + " blocks");
|
list.add("[powerinfo]Laser range: " + laserRange + " blocks");
|
||||||
list.add("[powerinfo]Max power transfer/second: " + Strings.toFixed(powerSpeed*2, 2));
|
list.add("[powerinfo]Max power transfer/second: " + Strings.toFixed(powerSpeed * 2, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(explosive){
|
if(explosive){
|
||||||
@@ -44,6 +45,56 @@ public class Generator extends PowerBlock{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPixelOverlay(Tile tile){
|
||||||
|
super.drawPixelOverlay(tile);
|
||||||
|
|
||||||
|
if(drawRangeOverlay){
|
||||||
|
int rotation = tile.getRotation();
|
||||||
|
if(hasLasers){
|
||||||
|
Draw.color("yellow");
|
||||||
|
Draw.thick(2f);
|
||||||
|
|
||||||
|
for(int i = 0; i < laserDirections; i++){
|
||||||
|
int dir = Mathf.mod(i + rotation - laserDirections / 2, 4);
|
||||||
|
float lx = Geometry.getD4Points()[dir].x, ly = Geometry.getD4Points()[dir].y;
|
||||||
|
float dx = lx * laserRange * Vars.tilesize;
|
||||||
|
float dy = ly * laserRange * Vars.tilesize;
|
||||||
|
|
||||||
|
Draw.dashLine(
|
||||||
|
tile.worldx() + lx * Vars.tilesize / 2,
|
||||||
|
tile.worldy() + ly * Vars.tilesize / 2,
|
||||||
|
tile.worldx() + dx - lx * Vars.tilesize,
|
||||||
|
tile.worldy() + dy - ly * Vars.tilesize, 9);
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
if(hasLasers){
|
||||||
|
Draw.color("purple");
|
||||||
|
Draw.thick(2f);
|
||||||
|
|
||||||
|
for(int i = 0; i < laserDirections; i++){
|
||||||
|
int dir = Mathf.mod(i + rotation - laserDirections / 2, 4);
|
||||||
|
float lx = Geometry.getD4Points()[dir].x, ly = Geometry.getD4Points()[dir].y;
|
||||||
|
float dx = lx * laserRange * Vars.tilesize;
|
||||||
|
float dy = ly * laserRange * Vars.tilesize;
|
||||||
|
Draw.dashLine(
|
||||||
|
x * Vars.tilesize + lx * Vars.tilesize / 2,
|
||||||
|
y * Vars.tilesize + ly * Vars.tilesize / 2,
|
||||||
|
x * Vars.tilesize + dx - lx * Vars.tilesize,
|
||||||
|
y * Vars.tilesize + dy - ly * Vars.tilesize, 9);
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyed(Tile tile){
|
public void onDestroyed(Tile tile){
|
||||||
if(explosive){
|
if(explosive){
|
||||||
@@ -58,7 +109,7 @@ public class Generator extends PowerBlock{
|
|||||||
Effects.effect(Fx.shockwave, x, y);
|
Effects.effect(Fx.shockwave, x, y);
|
||||||
|
|
||||||
Timers.run(12f + Mathf.random(20f), () -> {
|
Timers.run(12f + Mathf.random(20f), () -> {
|
||||||
tile.damageNearby(4, 40, 0f);
|
tile.damageNearby(4, 60, 0f);
|
||||||
});
|
});
|
||||||
|
|
||||||
Effects.sound(explosionSound, x, y);
|
Effects.sound(explosionSound, x, y);
|
||||||
@@ -79,7 +130,7 @@ public class Generator extends PowerBlock{
|
|||||||
}else{
|
}else{
|
||||||
Draw.alpha(0.5f);
|
Draw.alpha(0.5f);
|
||||||
}
|
}
|
||||||
drawLaserTo(tile, (tile.getRotation() + i) - laserDirections/2);
|
drawLaserTo(tile, (tile.getRotation() + i) - laserDirections / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
@@ -94,10 +145,11 @@ public class Generator extends PowerBlock{
|
|||||||
PowerEntity entity = tile.entity();
|
PowerEntity entity = tile.entity();
|
||||||
|
|
||||||
for(int i = 0; i < laserDirections; i++){
|
for(int i = 0; i < laserDirections; i++){
|
||||||
int rot = (tile.getRotation() + i) - laserDirections/2;
|
int rot = (tile.getRotation() + i) - laserDirections / 2;
|
||||||
Tile target = laserTarget(tile, rot);
|
Tile target = laserTarget(tile, rot);
|
||||||
|
|
||||||
if(target == null || isInterfering(target, rot)) continue;
|
if(target == null || isInterfering(target, rot))
|
||||||
|
continue;
|
||||||
|
|
||||||
PowerAcceptor p = (PowerAcceptor) target.block();
|
PowerAcceptor p = (PowerAcceptor) target.block();
|
||||||
if(p.acceptsPower(target) && entity.power >= powerSpeed){
|
if(p.acceptsPower(target) && entity.power >= powerSpeed){
|
||||||
@@ -115,11 +167,9 @@ public class Generator extends PowerBlock{
|
|||||||
if(target != null){
|
if(target != null){
|
||||||
boolean interfering = isInterfering(target, rotation);
|
boolean interfering = isInterfering(target, rotation);
|
||||||
|
|
||||||
Tmp.v1.set(Angles.translation(rotation * 90, target.block().width * Vars.tilesize/2 + 2f +
|
Tmp.v1.set(Angles.translation(rotation * 90, target.block().width * Vars.tilesize / 2 + 2f + (interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - Vars.tilesize / 2f * target.block().width - 1 : 0)));
|
||||||
(interfering ?
|
|
||||||
Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - Vars.tilesize/2f * target.block().width - 1 : 0)));
|
|
||||||
|
|
||||||
Angles.translation(rotation * 90, width * Vars.tilesize/2 + 2f);
|
Angles.translation(rotation * 90, width * Vars.tilesize / 2 + 2f);
|
||||||
|
|
||||||
if(!interfering){
|
if(!interfering){
|
||||||
Draw.tint(Hue.mix(Color.GRAY, Color.WHITE, 0.904f + Mathf.sin(Timers.time(), 1.7f, 0.06f)));
|
Draw.tint(Hue.mix(Color.GRAY, Color.WHITE, 0.904f + Mathf.sin(Timers.time(), 1.7f, 0.06f)));
|
||||||
@@ -132,8 +182,7 @@ public class Generator extends PowerBlock{
|
|||||||
|
|
||||||
float r = interfering ? 0.8f : 0f;
|
float r = interfering ? 0.8f : 0f;
|
||||||
|
|
||||||
Draw.laser("laser", "laserend", tile.worldx() + Angles.x(), tile.worldy() + Angles.y(),
|
Draw.laser("laser", "laserend", tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), target.worldx() - Tmp.v1.x + Mathf.range(r), target.worldy() - Tmp.v1.y + Mathf.range(r), 0.7f + Mathf.sin(Timers.time(), 2f, 0.1f * 0));
|
||||||
target.worldx() - Tmp.v1.x + Mathf.range(r), target.worldy() - Tmp.v1.y + Mathf.range(r), 0.7f + Mathf.sin(Timers.time(), 2f, 0.1f * 0));
|
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
@@ -141,9 +190,9 @@ public class Generator extends PowerBlock{
|
|||||||
|
|
||||||
protected boolean isInterfering(Tile target, int rotation){
|
protected boolean isInterfering(Tile target, int rotation){
|
||||||
if(target.block() instanceof Generator){
|
if(target.block() instanceof Generator){
|
||||||
Generator other = (Generator)target.block();
|
Generator other = (Generator) target.block();
|
||||||
int relrot = (rotation + 2) % 4;
|
int relrot = (rotation + 2) % 4;
|
||||||
if(other.hasLasers && Math.abs(target.getRotation() - relrot) <= other.laserDirections/2){
|
if(other.hasLasers && Math.abs(target.getRotation() - relrot) <= other.laserDirections / 2){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
desktop/mindustry-saves/4.mins
Normal file
BIN
desktop/mindustry-saves/4.mins
Normal file
Binary file not shown.
BIN
desktop/mindustry-saves/6.mins
Normal file
BIN
desktop/mindustry-saves/6.mins
Normal file
Binary file not shown.
BIN
desktop/mindustry-saves/7.mins
Normal file
BIN
desktop/mindustry-saves/7.mins
Normal file
Binary file not shown.
Reference in New Issue
Block a user