Edited laser effect, fixed some bugs
This commit is contained in:
@@ -58,6 +58,7 @@ public enum Recipe{
|
||||
combustiongenerator(power, ProductionBlocks.combustiongenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
nuclearreactor(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
powerbooster(power, DistributionBlocks.powerbooster, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
powerlaser(power, DistributionBlocks.powerlaser, stack(Item.titanium, 10), stack(Item.dirium, 10)),
|
||||
|
||||
pump(production, ProductionBlocks.pump, stack(Item.steel, 10));
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import io.anuke.ucore.scene.ui.*;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class UpgradeDialog extends Dialog{
|
||||
boolean wasPaused = false;
|
||||
|
||||
public UpgradeDialog() {
|
||||
super("Upgrades");
|
||||
@@ -26,9 +27,11 @@ public class UpgradeDialog extends Dialog{
|
||||
addCloseButton();
|
||||
|
||||
hidden(()->{
|
||||
GameState.set(State.playing);
|
||||
if(!wasPaused)
|
||||
GameState.set(State.playing);
|
||||
});
|
||||
shown(()->{
|
||||
wasPaused = GameState.is(State.paused);
|
||||
GameState.set(State.paused);
|
||||
});
|
||||
|
||||
@@ -37,7 +40,6 @@ public class UpgradeDialog extends Dialog{
|
||||
}).size(96, 50).pad(5);
|
||||
|
||||
Table weptab = new Table();
|
||||
//weptab.background("button");
|
||||
weptab.pad(20);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -46,5 +46,10 @@ public class DistributionBlocks{
|
||||
{
|
||||
formalName = "power booster";
|
||||
}
|
||||
},
|
||||
powerlaser = new PowerLaser("powerlaser"){
|
||||
{
|
||||
formalName = "power laser";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,35 +1,49 @@
|
||||
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.World;
|
||||
import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
|
||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class PowerLaser extends PowerBlock{
|
||||
public int laserRange = 4;
|
||||
public float powerAmount = 0.01f;
|
||||
public int laserRange = 6;
|
||||
public float powerAmount = 0.03f;
|
||||
public Color color = Color.valueOf("e54135");
|
||||
|
||||
public PowerLaser(String name) {
|
||||
super(name);
|
||||
rotate = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOver(Tile tile){
|
||||
Tile target = target(tile);
|
||||
|
||||
if(target != null){
|
||||
Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), target.worldx(), target.worldy());
|
||||
}else{
|
||||
Angles.translation(tile.rotation*90, laserRange*Vars.tilesize);
|
||||
PowerEntity entity = tile.entity();
|
||||
|
||||
if(target != null && entity.power > powerAmount){
|
||||
Angles.translation(tile.rotation * 90, 6f);
|
||||
|
||||
Draw.laser("laser", "laserend", tile.worldx(), tile.worldy(), tile.worldx() + Angles.x(), tile.worldy() + Angles.y());
|
||||
Draw.color(Color.GRAY, Color.WHITE, 0.902f + Mathf.sin(Timers.time(), 1.7f, 0.08f));
|
||||
Draw.alpha(1f);
|
||||
|
||||
float r = 0f;
|
||||
|
||||
Draw.laser("laser", "laserend",
|
||||
tile.worldx() + Angles.x() + Mathf.range(r), tile.worldy() + Angles.y() + Mathf.range(r),
|
||||
target.worldx() - Angles.x() + Mathf.range(r), target.worldy() - Angles.y() + Mathf.range(r),
|
||||
0.7f + Mathf.sin(Timers.time(), 2f, 0.1f*0));
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +52,8 @@ public class PowerLaser extends PowerBlock{
|
||||
PowerEntity entity = tile.entity();
|
||||
Tile target = target(tile);
|
||||
|
||||
if(target == null) return;
|
||||
|
||||
PowerAcceptor p = (PowerAcceptor)target.block();
|
||||
if(p.acceptsPower(target) && entity.power >= powerAmount){
|
||||
entity.power -= (powerAmount - p.addPower(target, powerAmount));
|
||||
|
||||
@@ -14,7 +14,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
public class Generator extends PowerBlock{
|
||||
public static final int powerTime = 2;
|
||||
|
||||
public int powerRange = 6;
|
||||
public int powerRange = 4;
|
||||
public float powerSpeed = 0.2f;
|
||||
|
||||
public Generator(String name) {
|
||||
|
||||
Reference in New Issue
Block a user