Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e9d833c77 | ||
|
|
48061d3cae | ||
|
|
292ce33e0f | ||
|
|
365fc6af20 | ||
|
|
97360b33f4 | ||
|
|
8a965e56cd | ||
|
|
8cef351ed9 | ||
|
|
714c5fd784 | ||
|
|
ee24eb8d1b | ||
|
|
d396149521 | ||
|
|
e21d92cf4d | ||
|
|
e6f9ce888f | ||
|
|
0e50fbf3f2 | ||
|
|
68593acf89 | ||
|
|
494e415bd3 | ||
|
|
c17b34c70d | ||
|
|
02ab945ab8 | ||
|
|
cce4113b2d | ||
|
|
4b6b1b43cd | ||
|
|
439d2c88ae | ||
|
|
b1ad8f917d | ||
|
|
221f7be21b | ||
|
|
bed34c4cad | ||
|
|
697e288de2 | ||
|
|
815daccff1 | ||
|
|
f61aa6068b | ||
|
|
7cf619e620 | ||
|
|
5172ae781f | ||
|
|
53ca2d0755 | ||
|
|
0559b43bde | ||
|
|
efd9280f96 |
@@ -115,6 +115,8 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
+ Character.digit(s.charAt(i + 1), 16));
|
+ Character.digit(s.charAt(i + 1), 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(new String(Base64Coder.encode(data)).equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
Settings.defaults("uuid", "");
|
Settings.defaults("uuid", "");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ allprojects {
|
|||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = 'c5d47cc'
|
uCoreVersion = 'a6f9111'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
@@ -107,7 +107,7 @@ project(":core") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
boolean comp = System.properties["release"] == null || System.properties["release"].equals("false")
|
boolean comp = false
|
||||||
|
|
||||||
if(!comp){
|
if(!comp){
|
||||||
println("NOTICE: Compiling release build.")
|
println("NOTICE: Compiling release build.")
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
BIN
core/assets-raw/sprites/blocks/chainturret-icon_old.png
Normal file
|
After Width: | Height: | Size: 281 B |
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 402 B |
BIN
core/assets-raw/sprites/blocks/chainturret_old.png
Normal file
|
After Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 256 B |
BIN
core/assets-raw/sprites/blocks/titancannon-icon_old.png
Normal file
|
After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 532 B |
BIN
core/assets-raw/sprites/blocks/titancannon_old.png
Normal file
|
After Width: | Height: | Size: 603 B |
@@ -270,6 +270,7 @@ setting.multithread.name=Multithreading
|
|||||||
setting.fps.name=Show FPS
|
setting.fps.name=Show FPS
|
||||||
setting.vsync.name=VSync
|
setting.vsync.name=VSync
|
||||||
setting.lasers.name=Show Power Lasers
|
setting.lasers.name=Show Power Lasers
|
||||||
|
setting.previewopacity.name=Placing Preview Opacity
|
||||||
setting.healthbars.name=Show Entity Health bars
|
setting.healthbars.name=Show Entity Health bars
|
||||||
setting.pixelate.name=Pixelate Screen
|
setting.pixelate.name=Pixelate Screen
|
||||||
setting.musicvol.name=Music Volume
|
setting.musicvol.name=Music Volume
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ void main() {
|
|||||||
if(i >= u_hitamount) break;
|
if(i >= u_hitamount) break;
|
||||||
vec3 hit = u_hits[i];
|
vec3 hit = u_hits[i];
|
||||||
float rad = hit.z * HIT_RADIUS;
|
float rad = hit.z * HIT_RADIUS;
|
||||||
float fract = 1.0 - hit.z;
|
float fin = 1.0 - hit.z;
|
||||||
|
|
||||||
if(abs(distance(vec2(hit.x, hit.y), coords - u_texsize/2.0) - rad) < 1.0){
|
if(abs(distance(vec2(hit.x, hit.y), coords - u_texsize/2.0) - rad) < 1.0){
|
||||||
color = mix(color, u_color* vec4(si, si, si, 1.0), (1.0 * fract));
|
color = mix(color, u_color* vec4(si, si, si, 1.0), (1.0 * fin));
|
||||||
color.a = ALPHA + 0.82 *fract;
|
color.a = ALPHA + 0.82 *fin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 92 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Mon Apr 02 14:29:45 EDT 2018
|
#Sat Apr 21 18:07:19 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=494
|
androidBuildCode=529
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.5
|
code=3.5
|
||||||
build=37
|
build=custom build
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public class NetServer extends Module{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.info("Recieved connect packet for player '{0}' / UUID {1} / IP {2}", packet.name, uuid, trace.ip);
|
||||||
|
|
||||||
String ip = Net.getConnection(id).address;
|
String ip = Net.getConnection(id).address;
|
||||||
|
|
||||||
admins.updatePlayerJoined(uuid, ip, packet.name);
|
admins.updatePlayerJoined(uuid, ip, packet.name);
|
||||||
@@ -86,8 +88,6 @@ public class NetServer extends Module{
|
|||||||
trace.modclient = true;
|
trace.modclient = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("Sending data to player '{0}' / {1}", packet.name, id);
|
|
||||||
|
|
||||||
Player player = new Player();
|
Player player = new Player();
|
||||||
player.isAdmin = admins.isAdmin(uuid, ip);
|
player.isAdmin = admins.isAdmin(uuid, ip);
|
||||||
player.clientid = id;
|
player.clientid = id;
|
||||||
@@ -172,17 +172,16 @@ public class NetServer extends Module{
|
|||||||
TraceInfo info = admins.getTrace(Net.getConnection(id).address);
|
TraceInfo info = admins.getTrace(Net.getConnection(id).address);
|
||||||
Weapon weapon = (Weapon)Upgrade.getByID(packet.weaponid);
|
Weapon weapon = (Weapon)Upgrade.getByID(packet.weaponid);
|
||||||
|
|
||||||
float wtrc = 60;
|
float wtrc = 80;
|
||||||
|
|
||||||
if(TimeUtils.millis() < info.lastFastShot + (int)(wtrc/60f*1000)){
|
if(!Timers.get("fastshoot-" + id + "-" + weapon.id, wtrc)){
|
||||||
info.fastShots ++;
|
info.fastShots.getAndIncrement(weapon.id, 0, 1);
|
||||||
|
|
||||||
if(info.fastShots - 6 > (int)(wtrc / (weapon.getReload() / 2f))){
|
if(info.fastShots.get(weapon.id, 0) > (int)(wtrc / (weapon.getReload() / 2f)) + 6){
|
||||||
kick(id, KickReason.kick);
|
kick(id, KickReason.kick);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info.fastShots = 0;
|
info.fastShots.put(weapon.id, 0);
|
||||||
info.lastFastShot = TimeUtils.millis();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
packet.playerid = connections.get(id).id;
|
packet.playerid = connections.get(id).id;
|
||||||
@@ -266,8 +265,6 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
Net.handleServer(WeaponSwitchPacket.class, (id, packet) -> {
|
Net.handleServer(WeaponSwitchPacket.class, (id, packet) -> {
|
||||||
TraceInfo info = admins.getTrace(Net.getConnection(id).address);
|
TraceInfo info = admins.getTrace(Net.getConnection(id).address);
|
||||||
info.fastShots = 0;
|
|
||||||
info.lastFastShot = TimeUtils.millis();
|
|
||||||
|
|
||||||
packet.playerid = connections.get(id).id;
|
packet.playerid = connections.get(id).id;
|
||||||
Net.sendExcept(id, packet, SendMode.tcp);
|
Net.sendExcept(id, packet, SendMode.tcp);
|
||||||
|
|||||||
@@ -541,14 +541,14 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO optimize!
|
//TODO optimize!
|
||||||
public void drawBar(Color color, float x, float y, float fraction){
|
public void drawBar(Color color, float x, float y, float finion){
|
||||||
fraction = Mathf.clamp(fraction);
|
finion = Mathf.clamp(finion);
|
||||||
|
|
||||||
if(fraction > 0) fraction = Mathf.clamp(fraction + 0.2f, 0.24f, 1f);
|
if(finion > 0) finion = Mathf.clamp(finion + 0.2f, 0.24f, 1f);
|
||||||
|
|
||||||
float len = 3;
|
float len = 3;
|
||||||
|
|
||||||
float w = (int) (len * 2 * fraction) + 0.5f;
|
float w = (int) (len * 2 * finion) + 0.5f;
|
||||||
|
|
||||||
x -= 0.5f;
|
x -= 0.5f;
|
||||||
y += 0.5f;
|
y += 0.5f;
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, b.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.GRAY, b.fin());
|
||||||
Lines.stroke(2f - b.ifract());
|
Lines.stroke(2f - b.fin());
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b){
|
public void draw(Bullet b){
|
||||||
Draw.color(Color.WHITE, lightOrange, b.fract()/2f + 0.25f);
|
Draw.color(Color.WHITE, lightOrange, b.fout()/2f + 0.25f);
|
||||||
Lines.stroke(1.5f);
|
Lines.stroke(1.5f);
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), 3f);
|
Lines.lineAngle(b.x, b.y, b.angle(), 3f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -337,7 +337,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
float size = 3f - b.ifract()*1f;
|
float size = 3f - b.fin()*1f;
|
||||||
|
|
||||||
Draw.color(Color.PURPLE, Color.WHITE, 0.8f);
|
Draw.color(Color.PURPLE, Color.WHITE, 0.8f);
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
@@ -356,8 +356,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
Draw.color(lightOrange, Color.WHITE, 0.4f);
|
Draw.color(lightOrange, Color.WHITE, 0.4f);
|
||||||
Lines.poly(b.x, b.y, 3, 1.6f, b.angle());
|
Lines.poly(b.x, b.y, 3, 1.6f, b.angle());
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.WHITE, lightOrange, b.ifract()/2f);
|
Draw.color(Color.WHITE, lightOrange, b.fin()/2f);
|
||||||
Draw.alpha(b.ifract());
|
Draw.alpha(b.fin());
|
||||||
Lines.spikes(b.x, b.y, 1.5f, 2f, 6);
|
Lines.spikes(b.x, b.y, 1.5f, 2f, 6);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
@@ -408,9 +408,9 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
|
Draw.color(Color.WHITE, Color.ORANGE, b.fin());
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*5f);
|
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fout()*5f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,9 +436,9 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
|
Draw.color(Color.WHITE, Color.ORANGE, b.fin());
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*4f);
|
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fout()*4f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -454,7 +454,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
float f = b.fract()*1.5f;
|
float f = b.fout()*1.5f;
|
||||||
|
|
||||||
Draw.color(beam);
|
Draw.color(beam);
|
||||||
Draw.rect("circle", b.x, b.y, 6f*f, 6f*f);
|
Draw.rect("circle", b.x, b.y, 6f*f, 6f*f);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class Player extends SyncEntity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(int amount){
|
public void damage(float amount){
|
||||||
if(debug || isAndroid) return;
|
if(debug || isAndroid) return;
|
||||||
|
|
||||||
health -= amount;
|
health -= amount;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class EMP extends TimedEntity{
|
|||||||
|
|
||||||
drawLine(target.worldx(), target.worldy());
|
drawLine(target.worldx(), target.worldy());
|
||||||
|
|
||||||
float rad = 5f*fract();
|
float rad = 5f*fout();
|
||||||
Draw.rect("circle", target.worldx(), target.worldy(), rad, rad);
|
Draw.rect("circle", target.worldx(), target.worldy(), rad, rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class EMP extends TimedEntity{
|
|||||||
drawLine(x + tr.x, y + tr.y);
|
drawLine(x + tr.x, y + tr.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines.stroke(fract()*2f);
|
Lines.stroke(fout()*2f);
|
||||||
Lines.poly(x, y, 34, radius * tilesize);
|
Lines.poly(x, y, 34, radius * tilesize);
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -114,7 +114,7 @@ public class EMP extends TimedEntity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawLaser(float x, float y, float x2, float y2){
|
private void drawLaser(float x, float y, float x2, float y2){
|
||||||
Lines.stroke(fract() * 2f);
|
Lines.stroke(fout() * 2f);
|
||||||
Lines.line(x, y, x2, y2);
|
Lines.line(x, y, x2, y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,17 @@ public class TeslaOrb extends Entity{
|
|||||||
|
|
||||||
Array<SolidEntity> enemies = Entities.getNearby(enemyGroup, curx, cury, range*2f);
|
Array<SolidEntity> enemies = Entities.getNearby(enemyGroup, curx, cury, range*2f);
|
||||||
|
|
||||||
for(SolidEntity entity : enemies){
|
synchronized (Entities.entityLock) {
|
||||||
if(entity != null && entity.distanceTo(curx, cury) < range && !hit.contains((Enemy)entity)){
|
|
||||||
hit.add((Enemy)entity);
|
for (SolidEntity entity : enemies) {
|
||||||
points.add(new Vector2(entity.x + Mathf.range(shake), entity.y + Mathf.range(shake)));
|
if (entity != null && entity.distanceTo(curx, cury) < range && !hit.contains((Enemy) entity)) {
|
||||||
damageEnemy((Enemy)entity);
|
hit.add((Enemy) entity);
|
||||||
curx = entity.x;
|
points.add(new Vector2(entity.x + Mathf.range(shake), entity.y + Mathf.range(shake)));
|
||||||
cury = entity.y;
|
damageEnemy((Enemy) entity);
|
||||||
break;
|
curx = entity.x;
|
||||||
|
cury = entity.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class Enemy extends SyncEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(int amount){
|
public void damage(float amount){
|
||||||
super.damage(amount);
|
super.damage(amount);
|
||||||
hitTime = EnemyType.hitDuration;
|
hitTime = EnemyType.hitDuration;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ import io.anuke.mindustry.world.Layer;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||||
|
import io.anuke.mindustry.world.blocks.types.defense.Turret;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.graphics.CacheBatch;
|
import io.anuke.ucore.graphics.CacheBatch;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -27,6 +28,8 @@ import static io.anuke.ucore.core.Core.camera;
|
|||||||
public class BlockRenderer{
|
public class BlockRenderer{
|
||||||
private final static int chunksize = 32;
|
private final static int chunksize = 32;
|
||||||
private final static int initialRequests = 32*32;
|
private final static int initialRequests = 32*32;
|
||||||
|
private static float storeX = 0;
|
||||||
|
private static float storeY = 0;
|
||||||
|
|
||||||
private int[][][] cache;
|
private int[][][] cache;
|
||||||
private CacheBatch cbatch;
|
private CacheBatch cbatch;
|
||||||
@@ -215,7 +218,7 @@ public class BlockRenderer{
|
|||||||
if(point.pathTiles != null){
|
if(point.pathTiles != null){
|
||||||
for(int i = 1; i < point.pathTiles.length; i ++){
|
for(int i = 1; i < point.pathTiles.length; i ++){
|
||||||
Lines.line(point.pathTiles[i-1].worldx(), point.pathTiles[i-1].worldy(),
|
Lines.line(point.pathTiles[i-1].worldx(), point.pathTiles[i-1].worldy(),
|
||||||
point.pathTiles[i].worldx(), point.pathTiles[i].worldy());
|
point.pathTiles[i].worldx(), point.pathTiles[i].worldy());
|
||||||
Lines.circle(point.pathTiles[i-1].worldx(), point.pathTiles[i-1].worldy(), 6f);
|
Lines.circle(point.pathTiles[i-1].worldx(), point.pathTiles[i-1].worldy(), 6f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,4 +283,49 @@ public class BlockRenderer{
|
|||||||
cbatch.dispose();
|
cbatch.dispose();
|
||||||
cbatch = new CacheBatch(world.width() * world.height() * 4);
|
cbatch = new CacheBatch(world.width() * world.height() * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawPreview(Block block, float drawx, float drawy, float rotation, float opacity) {
|
||||||
|
Draw.alpha(opacity);
|
||||||
|
Draw.rect(block.name(), drawx, drawy, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePreview(Block block, float rotation, float drawx, float drawy, int tilex, int tiley) {
|
||||||
|
|
||||||
|
if(control.input().recipe != null && state.inventory.hasItems(control.input().recipe.requirements)
|
||||||
|
&& control.input().validPlace(tilex, tiley, block) && (android || control.input().cursorNear())) {
|
||||||
|
|
||||||
|
if(block.isMultiblock()) {
|
||||||
|
float halfBlockWidth = (block.width * tilesize) / 2;
|
||||||
|
float halfBlockHeight = (block.height * tilesize) / 2;
|
||||||
|
if((storeX == 0 && storeY == 0)) {
|
||||||
|
storeX = drawx;
|
||||||
|
storeY = drawy;
|
||||||
|
}
|
||||||
|
if((storeX == drawx - halfBlockWidth || storeX == drawx + halfBlockWidth || storeY == drawy - halfBlockHeight || storeY == drawy + halfBlockHeight) &&
|
||||||
|
((tiley - control.input().getBlockY()) % block.height != 0 || (tilex - control.input().getBlockX()) % block.width != 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
storeX = drawx;
|
||||||
|
storeY = drawy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float opacity = (float) Settings.getInt("previewopacity") / 100f;
|
||||||
|
Draw.color(Color.WHITE);
|
||||||
|
Draw.alpha(opacity);
|
||||||
|
|
||||||
|
if(block instanceof Turret) {
|
||||||
|
if (block.isMultiblock()) {
|
||||||
|
Draw.rect("block-" + block.width + "x" + block.height, drawx, drawy);
|
||||||
|
} else {
|
||||||
|
Draw.rect("block", drawx, drawy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drawPreview(block, drawx, drawy, rotation, opacity);
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,125 +27,125 @@ public class Fx{
|
|||||||
public static final Effect
|
public static final Effect
|
||||||
|
|
||||||
generatorexplosion = new Effect(28, 40f, e -> {
|
generatorexplosion = new Effect(28, 40f, e -> {
|
||||||
Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 16, 10f + e.fin()*8f, (x, y)->{
|
||||||
float size = e.fract()*12f + 1f;
|
float size = e.fout()*12f + 1f;
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
reactorsmoke = new Effect(17, e -> {
|
reactorsmoke = new Effect(17, e -> {
|
||||||
Angles.randLenVectors(e.id, 4, e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 4, e.fin()*8f, (x, y)->{
|
||||||
float size = 1f+e.fract()*5f;
|
float size = 1f+e.fout()*5f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
nuclearsmoke = new Effect(40, e -> {
|
nuclearsmoke = new Effect(40, e -> {
|
||||||
Angles.randLenVectors(e.id, 4, e.ifract()*13f, (x, y)->{
|
Angles.randLenVectors(e.id, 4, e.fin()*13f, (x, y)->{
|
||||||
float size = e.sfract()*4f;
|
float size = e.finpow()*4f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
nuclearcloud = new Effect(90, 200f, e -> {
|
nuclearcloud = new Effect(90, 200f, e -> {
|
||||||
Angles.randLenVectors(e.id, 10, e.powfract()*90f, (x, y)->{
|
Angles.randLenVectors(e.id, 10, e.finpow()*90f, (x, y)->{
|
||||||
float size = e.fract()*14f;
|
float size = e.fout()*14f;
|
||||||
Draw.color(Color.LIME, Color.GRAY, e.ifract());
|
Draw.color(Color.LIME, Color.GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
chainshot = new Effect(9f, e -> {
|
chainshot = new Effect(9f, e -> {
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Lines.stroke(e.fract()*4f);
|
Lines.stroke(e.fout()*4f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*7f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*7f);
|
||||||
Lines.stroke(e.fract()*2f);
|
Lines.stroke(e.fout()*2f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*10f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*10f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
mortarshot = new Effect(10f, e -> {
|
mortarshot = new Effect(10f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.DARK_GRAY, e.fin());
|
||||||
Lines.stroke(e.fract()*6f);
|
Lines.stroke(e.fout()*6f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*10f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*10f);
|
||||||
Lines.stroke(e.fract()*5f);
|
Lines.stroke(e.fout()*5f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*14f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*14f);
|
||||||
Lines.stroke(e.fract()*1f);
|
Lines.stroke(e.fout()*1f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*16f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*16f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
railshot = new Effect(9f, e -> {
|
railshot = new Effect(9f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.DARK_GRAY, e.fin());
|
||||||
Lines.stroke(e.fract()*5f);
|
Lines.stroke(e.fout()*5f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*8f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*8f);
|
||||||
Lines.stroke(e.fract()*4f);
|
Lines.stroke(e.fout()*4f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*12f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*12f);
|
||||||
Lines.stroke(e.fract()*1f);
|
Lines.stroke(e.fout()*1f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*14f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*14f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
titanshot = new Effect(12f, e -> {
|
titanshot = new Effect(12f, e -> {
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Lines.stroke(e.fract()*7f);
|
Lines.stroke(e.fout()*7f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*12f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*12f);
|
||||||
Lines.stroke(e.fract()*4f);
|
Lines.stroke(e.fout()*4f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*16f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*16f);
|
||||||
Lines.stroke(e.fract()*2f);
|
Lines.stroke(e.fout()*2f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*18f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*18f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
largeCannonShot = new Effect(11f, e -> {
|
largeCannonShot = new Effect(11f, e -> {
|
||||||
Draw.color(Color.WHITE, whiteYellow, e.ifract());
|
Draw.color(Color.WHITE, whiteYellow, e.fin());
|
||||||
Lines.stroke(e.fract()*6f);
|
Lines.stroke(e.fout()*6f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*12f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*12f);
|
||||||
Lines.stroke(e.fract()*3f);
|
Lines.stroke(e.fout()*3f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*16f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*16f);
|
||||||
Lines.stroke(e.fract()*1f);
|
Lines.stroke(e.fout()*1f);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, e.fract()*18f);
|
Lines.lineAngle(e.x, e.y, e.rotation, e.fout()*18f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shockwave = new Effect(10f, 80f, e -> {
|
shockwave = new Effect(10f, 80f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fract()*2f + 0.2f);
|
Lines.stroke(e.fout()*2f + 0.2f);
|
||||||
Lines.circle(e.x, e.y, e.ifract()*28f);
|
Lines.circle(e.x, e.y, e.fin()*28f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
nuclearShockwave = new Effect(10f, 200f, e -> {
|
nuclearShockwave = new Effect(10f, 200f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fract()*3f + 0.2f);
|
Lines.stroke(e.fout()*3f + 0.2f);
|
||||||
Lines.poly(e.x, e.y, 40, e.ifract()*140f);
|
Lines.poly(e.x, e.y, 40, e.fin()*140f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shockwaveSmall = new Effect(10f, e -> {
|
shockwaveSmall = new Effect(10f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fract()*2f + 0.1f);
|
Lines.stroke(e.fout()*2f + 0.1f);
|
||||||
Lines.circle(e.x, e.y, e.ifract()*15f);
|
Lines.circle(e.x, e.y, e.fin()*15f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
empshockwave = new Effect(7f, e -> {
|
empshockwave = new Effect(7f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
Draw.color(Color.WHITE, Color.SKY, e.fin());
|
||||||
Lines.stroke(e.fract()*2f);
|
Lines.stroke(e.fout()*2f);
|
||||||
Lines.circle(e.x, e.y, e.ifract()*40f);
|
Lines.circle(e.x, e.y, e.fin()*40f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
empspark = new Effect(13, e -> {
|
empspark = new Effect(13, e -> {
|
||||||
Angles.randLenVectors(e.id, 7, 1f + e.ifract()*12f, (x, y)->{
|
Angles.randLenVectors(e.id, 7, 1f + e.fin()*12f, (x, y)->{
|
||||||
float len = 1f+e.fract()*6f;
|
float len = 1f+e.fout()*6f;
|
||||||
Draw.color(Color.SKY);
|
Draw.color(Color.SKY);
|
||||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -153,67 +153,67 @@ public class Fx{
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
redgeneratespark = new Effect(18, e -> {
|
redgeneratespark = new Effect(18, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, e.fin()*8f, (x, y)->{
|
||||||
float len = e.fract()*4f;
|
float len = e.fout()*4f;
|
||||||
Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.ifract());
|
Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.fin());
|
||||||
//Draw.alpha(e.fract());
|
//Draw.alpha(e.fout());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
generatespark = new Effect(18, e -> {
|
generatespark = new Effect(18, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, e.fin()*8f, (x, y)->{
|
||||||
float len = e.fract()*4f;
|
float len = e.fout()*4f;
|
||||||
Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.ifract());
|
Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.fin());
|
||||||
//Draw.alpha(e.fract());
|
//Draw.alpha(e.fout());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
fuelburn = new Effect(23, e -> {
|
fuelburn = new Effect(23, e -> {
|
||||||
Angles.randLenVectors(e.id, 5, e.ifract()*9f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, e.fin()*9f, (x, y)->{
|
||||||
float len = e.fract()*4f;
|
float len = e.fout()*4f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
|
||||||
//Draw.alpha(e.fract());
|
//Draw.alpha(e.fout());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
Draw.rect("circle", e.x + x, e.y + y, len, len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
laserspark = new Effect(14, e -> {
|
laserspark = new Effect(14, e -> {
|
||||||
Angles.randLenVectors(e.id, 8, 1f + e.ifract()*11f, (x, y)->{
|
Angles.randLenVectors(e.id, 8, 1f + e.fin()*11f, (x, y)->{
|
||||||
float len = 1f+e.fract()*5f;
|
float len = 1f+e.fout()*5f;
|
||||||
Draw.color(Color.WHITE, Color.CORAL, e.ifract());
|
Draw.color(Color.WHITE, Color.CORAL, e.fin());
|
||||||
Draw.alpha(e.ifract()/1.3f);
|
Draw.alpha(e.fin()/1.3f);
|
||||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shellsmoke = new Effect(20, e -> {
|
shellsmoke = new Effect(20, e -> {
|
||||||
Angles.randLenVectors(e.id, 8, 3f + e.ifract()*17f, (x, y)->{
|
Angles.randLenVectors(e.id, 8, 3f + e.fin()*17f, (x, y)->{
|
||||||
float size = 2f+e.fract()*5f;
|
float size = 2f+e.fout()*5f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
blastsmoke = new Effect(26, e -> {
|
blastsmoke = new Effect(26, e -> {
|
||||||
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{
|
Angles.randLenVectors(e.id, 12, 1f + e.fin()*23f, (x, y)->{
|
||||||
float size = 2f+e.fract()*6f;
|
float size = 2f+e.fout()*6f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lava = new Effect(18, e -> {
|
lava = new Effect(18, e -> {
|
||||||
Angles.randLenVectors(e.id, 3, 1f + e.ifract()*10f, (x, y)->{
|
Angles.randLenVectors(e.id, 3, 1f + e.fin()*10f, (x, y)->{
|
||||||
float size = e.sfract()*4f;
|
float size = e.finpow()*4f;
|
||||||
Draw.color(Color.ORANGE, Color.GRAY, e.ifract());
|
Draw.color(Color.ORANGE, Color.GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
@@ -222,194 +222,194 @@ public class Fx{
|
|||||||
lavabubble = new Effect(45f, e -> {
|
lavabubble = new Effect(45f, e -> {
|
||||||
Draw.color(Color.ORANGE);
|
Draw.color(Color.ORANGE);
|
||||||
float scl = 0.35f;
|
float scl = 0.35f;
|
||||||
Lines.stroke(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
Lines.stroke(1f - Mathf.clamp(e.fin() - (1f-scl)) * (1f/scl));
|
||||||
Lines.circle(e.x, e.y, e.ifract()*4f);
|
Lines.circle(e.x, e.y, e.fin()*4f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
oilbubble = new Effect(64f, e -> {
|
oilbubble = new Effect(64f, e -> {
|
||||||
Draw.color(Color.DARK_GRAY);
|
Draw.color(Color.DARK_GRAY);
|
||||||
float scl = 0.25f;
|
float scl = 0.25f;
|
||||||
Lines.stroke(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
Lines.stroke(1f - Mathf.clamp(e.fin() - (1f-scl)) * (1f/scl));
|
||||||
Lines.circle(e.x, e.y, e.ifract()*3f);
|
Lines.circle(e.x, e.y, e.fin()*3f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shellexplosion = new Effect(9, e -> {
|
shellexplosion = new Effect(9, e -> {
|
||||||
Lines.stroke(2f - e.ifract()*1.7f);
|
Lines.stroke(2f - e.fin()*1.7f);
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.circle(e.x, e.y, 3f + e.ifract() * 9f);
|
Lines.circle(e.x, e.y, 3f + e.fin() * 9f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
blastexplosion = new Effect(14, e -> {
|
blastexplosion = new Effect(14, e -> {
|
||||||
Lines.stroke(1.2f - e.ifract());
|
Lines.stroke(1.2f - e.fin());
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Lines.circle(e.x, e.y, 1.5f + e.ifract() * 9f);
|
Lines.circle(e.x, e.y, 1.5f + e.fin() * 9f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
place = new Effect(16, e -> {
|
place = new Effect(16, e -> {
|
||||||
Lines.stroke(3f - e.ifract() * 2f);
|
Lines.stroke(3f - e.fin() * 2f);
|
||||||
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 3f);
|
Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 3f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
dooropen = new Effect(10, e -> {
|
dooropen = new Effect(10, e -> {
|
||||||
Lines.stroke(e.fract() * 1.6f);
|
Lines.stroke(e.fout() * 1.6f);
|
||||||
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 2f);
|
Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 2f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
doorclose= new Effect(10, e -> {
|
doorclose= new Effect(10, e -> {
|
||||||
Lines.stroke(e.fract() * 1.6f);
|
Lines.stroke(e.fout() * 1.6f);
|
||||||
Lines.square(e.x, e.y, tilesize / 2f + e.fract() * 2f);
|
Lines.square(e.x, e.y, tilesize / 2f + e.fout() * 2f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
dooropenlarge = new Effect(10, e -> {
|
dooropenlarge = new Effect(10, e -> {
|
||||||
Lines.stroke(e.fract() * 1.6f);
|
Lines.stroke(e.fout() * 1.6f);
|
||||||
Lines.square(e.x, e.y, tilesize + e.ifract() * 2f);
|
Lines.square(e.x, e.y, tilesize + e.fin() * 2f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
doorcloselarge = new Effect(10, e -> {
|
doorcloselarge = new Effect(10, e -> {
|
||||||
Lines.stroke(e.fract() * 1.6f);
|
Lines.stroke(e.fout() * 1.6f);
|
||||||
Lines.square(e.x, e.y, tilesize + e.fract() * 2f);
|
Lines.square(e.x, e.y, tilesize + e.fout() * 2f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
purify = new Effect(10, e -> {
|
purify = new Effect(10, e -> {
|
||||||
Draw.color(Color.ROYAL, Color.GRAY, e.ifract());
|
Draw.color(Color.ROYAL, Color.GRAY, e.fin());
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
purifyoil = new Effect(10, e -> {
|
purifyoil = new Effect(10, e -> {
|
||||||
Draw.color(Color.BLACK, Color.GRAY, e.ifract());
|
Draw.color(Color.BLACK, Color.GRAY, e.fin());
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
purifystone = new Effect(10, e -> {
|
purifystone = new Effect(10, e -> {
|
||||||
Draw.color(Color.ORANGE, Color.GRAY, e.ifract());
|
Draw.color(Color.ORANGE, Color.GRAY, e.fin());
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
generate = new Effect(11, e -> {
|
generate = new Effect(11, e -> {
|
||||||
Draw.color(Color.ORANGE, Color.YELLOW, e.ifract());
|
Draw.color(Color.ORANGE, Color.YELLOW, e.fin());
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
spark = new Effect(10, e -> {
|
spark = new Effect(10, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
Draw.color(Color.WHITE, Color.GRAY, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
sparkbig = new Effect(11, e -> {
|
sparkbig = new Effect(11, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(lightRed, Color.GRAY, e.ifract());
|
Draw.color(lightRed, Color.GRAY, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8);
|
Lines.spikes(e.x, e.y, e.fin() * 5f, 2.3f, 8);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
smelt = new Effect(10, e -> {
|
smelt = new Effect(10, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
Draw.color(Color.YELLOW, Color.RED, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 1f, 8);
|
Lines.spikes(e.x, e.y, e.fin() * 5f, 1f, 8);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
breakBlock = new Effect(12, e -> {
|
breakBlock = new Effect(12, e -> {
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Draw.color(Color.WHITE, Colors.get("break"), e.ifract());
|
Draw.color(Color.WHITE, Colors.get("break"), e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 6f, 2, 5, 90);
|
Lines.spikes(e.x, e.y, e.fin() * 6f, 2, 5, 90);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
hit = new Effect(10, e -> {
|
hit = new Effect(10, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
Draw.color(Color.WHITE, Color.ORANGE, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 3f, 2, 8);
|
Lines.spikes(e.x, e.y, e.fin() * 3f, 2, 8);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
laserhit = new Effect(10, e -> {
|
laserhit = new Effect(10, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
Draw.color(Color.WHITE, Color.SKY, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 2f, 2, 6);
|
Lines.spikes(e.x, e.y, e.fin() * 2f, 2, 6);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shieldhit = new Effect(9, e -> {
|
shieldhit = new Effect(9, e -> {
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
Draw.color(Color.WHITE, Color.SKY, e.fin());
|
||||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 6);
|
Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 6);
|
||||||
Lines.stroke(4f*e.fract());
|
Lines.stroke(4f*e.fout());
|
||||||
Lines.circle(e.x, e.y, e.ifract()*14f);
|
Lines.circle(e.x, e.y, e.fin()*14f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
laserShoot = new Effect(8, e -> {
|
laserShoot = new Effect(8, e -> {
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 6f, 2f, 0.8f);
|
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fout(), 6f, 2f, 0.8f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
spreadShoot = new Effect(12, e -> {
|
spreadShoot = new Effect(12, e -> {
|
||||||
Draw.color(Color.WHITE, Color.PURPLE, e.ifract());
|
Draw.color(Color.WHITE, Color.PURPLE, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 9f, 3.5f, 0.8f);
|
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fout(), 9f, 3.5f, 0.8f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
clusterShoot = new Effect(12, e -> {
|
clusterShoot = new Effect(12, e -> {
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 10f, 2.5f, 0.7f);
|
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fout(), 10f, 2.5f, 0.7f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
vulcanShoot = new Effect(8, e -> {
|
vulcanShoot = new Effect(8, e -> {
|
||||||
Draw.color(lighterOrange, lightOrange, e.ifract());
|
Draw.color(lighterOrange, lightOrange, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 10f, 2f, 0.7f);
|
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fout(), 10f, 2f, 0.7f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shockShoot = new Effect(8, e -> {
|
shockShoot = new Effect(8, e -> {
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
Draw.color(Color.WHITE, Color.ORANGE, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 14f, 4f, 0.8f);
|
Shapes.lineShot(e.x, e.y, e.rotation, 3, e.fout(), 14f, 4f, 0.8f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
beamShoot = new Effect(8, e -> {
|
beamShoot = new Effect(8, e -> {
|
||||||
Draw.color(beamLight, beam, e.ifract());
|
Draw.color(beamLight, beam, e.fin());
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation - 70, 3, e.fract(), 12f, 1f, 0.5f);
|
Shapes.lineShot(e.x, e.y, e.rotation - 70, 3, e.fout(), 12f, 1f, 0.5f);
|
||||||
Shapes.lineShot(e.x, e.y, e.rotation + 70, 3, e.fract(), 12f, 1f, 0.5f);
|
Shapes.lineShot(e.x, e.y, e.rotation + 70, 3, e.fout(), 12f, 1f, 0.5f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
beamhit = new Effect(8, e -> {
|
beamhit = new Effect(8, e -> {
|
||||||
Draw.color(beamLight, beam, e.ifract());
|
Draw.color(beamLight, beam, e.fin());
|
||||||
Lines.stroke(e.fract()*3f+0.5f);
|
Lines.stroke(e.fout()*3f+0.5f);
|
||||||
Lines.circle(e.x, e.y, e.ifract()*8f);
|
Lines.circle(e.x, e.y, e.fin()*8f);
|
||||||
Lines.spikes(e.x, e.y, e.ifract()*6f, 2f, 4, 45);
|
Lines.spikes(e.x, e.y, e.fin()*6f, 2f, 4, 45);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
titanExplosion = new Effect(11, 48f, e -> {
|
titanExplosion = new Effect(11, 48f, e -> {
|
||||||
Lines.stroke(2f*e.fract()+0.5f);
|
Lines.stroke(2f*e.fout()+0.5f);
|
||||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
Draw.color(Color.WHITE, Color.DARK_GRAY, e.finpow());
|
||||||
Lines.circle(e.x, e.y, 5f + e.powfract() * 8f);
|
Lines.circle(e.x, e.y, 5f + e.finpow() * 8f);
|
||||||
|
|
||||||
Draw.color(e.ifract() < 0.5f ? whiteOrange : Color.DARK_GRAY);
|
Draw.color(e.fin() < 0.5f ? whiteOrange : Color.DARK_GRAY);
|
||||||
float rad = e.fract()*10f + 5f;
|
float rad = e.fout()*10f + 5f;
|
||||||
Angles.randLenVectors(e.id, 5, 9f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 9f, (x, y)->{
|
||||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||||
});
|
});
|
||||||
@@ -418,12 +418,12 @@ public class Fx{
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
explosion = new Effect(11, e -> {
|
explosion = new Effect(11, e -> {
|
||||||
Lines.stroke(2f*e.fract()+0.5f);
|
Lines.stroke(2f*e.fout()+0.5f);
|
||||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
Draw.color(Color.WHITE, Color.DARK_GRAY, e.finpow());
|
||||||
Lines.circle(e.x, e.y, 5f + e.powfract() * 6f);
|
Lines.circle(e.x, e.y, 5f + e.finpow() * 6f);
|
||||||
|
|
||||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
Draw.color(e.fin() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||||
float rad = e.fract()*10f + 5f;
|
float rad = e.fout()*10f + 5f;
|
||||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||||
});
|
});
|
||||||
@@ -433,19 +433,19 @@ public class Fx{
|
|||||||
|
|
||||||
|
|
||||||
blockexplosion = new Effect(13, e -> {
|
blockexplosion = new Effect(13, e -> {
|
||||||
Angles.randLenVectors(e.id+1, 8, 5f + e.ifract()*11f, (x, y)->{
|
Angles.randLenVectors(e.id+1, 8, 5f + e.fin()*11f, (x, y)->{
|
||||||
float size = 2f+e.fract()*8f;
|
float size = 2f+e.fout()*8f;
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.fin());
|
||||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
Lines.stroke(2f*e.fract()+0.4f);
|
Lines.stroke(2f*e.fout()+0.4f);
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, e.powfract());
|
Draw.color(Color.WHITE, Color.ORANGE, e.finpow());
|
||||||
Lines.circle(e.x, e.y, 2f + e.powfract() * 9f);
|
Lines.circle(e.x, e.y, 2f + e.finpow() * 9f);
|
||||||
|
|
||||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
Draw.color(e.fin() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||||
float rad = e.fract()*10f + 2f;
|
float rad = e.fout()*10f + 2f;
|
||||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||||
});
|
});
|
||||||
@@ -454,53 +454,53 @@ public class Fx{
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
clusterbomb = new Effect(10f, e -> {
|
clusterbomb = new Effect(10f, e -> {
|
||||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
Draw.color(Color.WHITE, lightOrange, e.fin());
|
||||||
Lines.stroke(e.fract()*1.5f);
|
Lines.stroke(e.fout()*1.5f);
|
||||||
Lines.poly(e.x, e.y, 4, e.fract()*8f);
|
Lines.poly(e.x, e.y, 4, e.fout()*8f);
|
||||||
Lines.circle(e.x, e.y, e.ifract()*14f);
|
Lines.circle(e.x, e.y, e.fin()*14f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
coreexplosion = new Effect(13, e -> {
|
coreexplosion = new Effect(13, e -> {
|
||||||
Lines.stroke(3f-e.ifract()*2f);
|
Lines.stroke(3f-e.fin()*2f);
|
||||||
Draw.color(Color.ORANGE, Color.WHITE, e.ifract());
|
Draw.color(Color.ORANGE, Color.WHITE, e.fin());
|
||||||
Lines.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6);
|
Lines.spikes(e.x, e.y, 5f + e.fin() * 40f, 6, 6);
|
||||||
Lines.circle(e.x, e.y, 4f + e.ifract() * 40f);
|
Lines.circle(e.x, e.y, 4f + e.fin() * 40f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
smoke = new Effect(100, e -> {
|
smoke = new Effect(100, e -> {
|
||||||
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.ifract());
|
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.fin());
|
||||||
float size = 7f-e.ifract()*7f;
|
float size = 7f-e.fin()*7f;
|
||||||
Draw.rect("circle", e.x, e.y, size, size);
|
Draw.rect("circle", e.x, e.y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
railsmoke = new Effect(30, e -> {
|
railsmoke = new Effect(30, e -> {
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract());
|
Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.fin());
|
||||||
float size = e.fract()*4f;
|
float size = e.fout()*4f;
|
||||||
Draw.rect("circle", e.x, e.y, size, size);
|
Draw.rect("circle", e.x, e.y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
chainsmoke = new Effect(30, e -> {
|
chainsmoke = new Effect(30, e -> {
|
||||||
Draw.color(lightGray);
|
Draw.color(lightGray);
|
||||||
float size = e.fract()*4f;
|
float size = e.fout()*4f;
|
||||||
Draw.rect("circle", e.x, e.y, size, size);
|
Draw.rect("circle", e.x, e.y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
dashsmoke = new Effect(30, e -> {
|
dashsmoke = new Effect(30, e -> {
|
||||||
Draw.color(Color.CORAL, Color.GRAY, e.ifract());
|
Draw.color(Color.CORAL, Color.GRAY, e.fin());
|
||||||
float size = e.fract()*4f;
|
float size = e.fout()*4f;
|
||||||
Draw.rect("circle", e.x, e.y, size, size);
|
Draw.rect("circle", e.x, e.y, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
spawn = new Effect(23, e -> {
|
spawn = new Effect(23, e -> {
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract());
|
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.fin());
|
||||||
Lines.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
Lines.circle(e.x, e.y, 7f - e.fin() * 6f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ public class Fx{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
transfer = new Effect(20, e -> {
|
transfer = new Effect(20, e -> {
|
||||||
Draw.color(Color.SCARLET, Color.CLEAR, e.fract());
|
Draw.color(Color.SCARLET, Color.CLEAR, e.fout());
|
||||||
Lines.square(e.x, e.y, 4);
|
Lines.square(e.x, e.y, 4);
|
||||||
Lines.lineAngle(e.x, e.y, e.rotation, 5f);
|
Lines.lineAngle(e.x, e.y, e.rotation, 5f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GestureHandler extends GestureAdapter{
|
|||||||
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
||||||
|
|
||||||
if(!control.showCursor() && !(control.input().recipe != null
|
if(!control.showCursor() && !(control.input().recipe != null
|
||||||
&& control.input().placeMode.lockCamera) &&
|
&& control.input().placeMode.lockCamera && state.inventory.hasItems(control.input().recipe.requirements)) &&
|
||||||
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
||||||
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
||||||
player.x -= dx;
|
player.x -= dx;
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean cursorNear(){
|
public boolean cursorNear(){
|
||||||
return Vector2.dst(player.x, player.y, getBlockX() * tilesize, getBlockY() * tilesize) <= placerange;
|
return Vector2.dst(player.x, player.y, getBlockX() * tilesize, getBlockY() * tilesize) <= placerange ||
|
||||||
|
state.mode.infiniteResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryPlaceBlock(int x, int y, boolean sound){
|
public boolean tryPlaceBlock(int x, int y, boolean sound){
|
||||||
|
|||||||
@@ -34,15 +34,17 @@ public enum PlaceMode{
|
|||||||
|
|
||||||
float si = MathUtils.sin(Timers.time() / 6f) + 1.5f;
|
float si = MathUtils.sin(Timers.time() / 6f) + 1.5f;
|
||||||
|
|
||||||
|
renderer.getBlocks().handlePreview(control.input().recipe.result, control.input().recipe.result.rotate ? control.input().rotation * 90 : 0f, x + offset.x, y + offset.y, tilex, tiley);
|
||||||
|
|
||||||
Draw.color(valid ? Colors.get("place") : Colors.get("placeInvalid"));
|
Draw.color(valid ? Colors.get("place") : Colors.get("placeInvalid"));
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Lines.crect(x + offset.x, y + offset.y, tilesize * control.input().recipe.result.width + si,
|
Lines.crect(x + offset.x, y + offset.y, tilesize * control.input().recipe.result.width + si,
|
||||||
tilesize * control.input().recipe.result.height + si);
|
tilesize * control.input().recipe.result.height + si);
|
||||||
|
|
||||||
control.input().recipe.result.drawPlace(tilex, tiley, control.input().rotation, valid);
|
control.input().recipe.result.drawPlace(tilex, tiley, control.input().rotation, valid);
|
||||||
Lines.stroke(2f);
|
|
||||||
|
|
||||||
if(control.input().recipe.result.rotate){
|
if(control.input().recipe.result.rotate){
|
||||||
|
|
||||||
Draw.color(Colors.get("placeRotate"));
|
Draw.color(Colors.get("placeRotate"));
|
||||||
tr.trns(control.input().rotation * 90, 7, 0);
|
tr.trns(control.input().rotation * 90, 7, 0);
|
||||||
Lines.line(x, y, x + tr.x, y + tr.y);
|
Lines.line(x, y, x + tr.x, y + tr.y);
|
||||||
@@ -85,11 +87,11 @@ public enum PlaceMode{
|
|||||||
if(tile != null && control.input().validBreak(tilex, tiley)){
|
if(tile != null && control.input().validBreak(tilex, tiley)){
|
||||||
if(tile.isLinked())
|
if(tile.isLinked())
|
||||||
tile = tile.getLinked();
|
tile = tile.getLinked();
|
||||||
float fract = control.input().breaktime / tile.getBreakTime();
|
float fin = control.input().breaktime / tile.getBreakTime();
|
||||||
|
|
||||||
if(android && control.input().breaktime > 0){
|
if(android && control.input().breaktime > 0){
|
||||||
Draw.color(Colors.get("breakStart"), Colors.get("break"), fract);
|
Draw.color(Colors.get("breakStart"), Colors.get("break"), fin);
|
||||||
Lines.poly(tile.drawx(), tile.drawy(), 25, 4 + (1f - fract) * 26);
|
Lines.poly(tile.drawx(), tile.drawy(), 25, 4 + (1f - fin) * 26);
|
||||||
}
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
@@ -150,7 +152,7 @@ public enum PlaceMode{
|
|||||||
tile = tile.getLinked();
|
tile = tile.getLinked();
|
||||||
if(tile != null && control.input().validBreak(tile.x, tile.y)){
|
if(tile != null && control.input().validBreak(tile.x, tile.y)){
|
||||||
Lines.crect(tile.drawx(), tile.drawy(),
|
Lines.crect(tile.drawx(), tile.drawy(),
|
||||||
tile.block().width * t, tile.block().height * t);
|
tile.block().width * t, tile.block().height * t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,29 +270,55 @@ public enum PlaceMode{
|
|||||||
cursor.draw(tilex, tiley, endx, endy);
|
cursor.draw(tilex, tiley, endx, endy);
|
||||||
}else{
|
}else{
|
||||||
Lines.stroke(2f);
|
Lines.stroke(2f);
|
||||||
Draw.color(control.input().cursorNear() ? Colors.get("place") : Colors.get("placeInvalid"));
|
Draw.color(control.input().cursorNear() ? "place" : "placeInvalid");
|
||||||
Lines.rect(x, y, x2 - x, y2 - y);
|
Lines.rect(x, y, x2 - x, y2 - y);
|
||||||
Draw.alpha(0.3f);
|
Draw.alpha(0.3f);
|
||||||
Draw.crect("blank", x, y, x2 - x, y2 - y);
|
Draw.crect("blank", x, y, x2 - x, y2 - y);
|
||||||
|
|
||||||
Draw.color(Colors.get("placeInvalid"));
|
|
||||||
|
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
for(int cx = 0; cx <= Math.abs(endx - tilex); cx ++){
|
boolean isX = Math.abs(endx - tilex) >= Math.abs(endy - tiley);
|
||||||
for(int cy = 0; cy <= Math.abs(endy - tiley); cy ++){
|
|
||||||
int px = tx + cx * Mathf.sign(ex - tx),
|
|
||||||
py = ty + cy * Mathf.sign(ey - ty);
|
|
||||||
|
|
||||||
if(!control.input().validPlace(px, py, control.input().recipe.result)
|
for(int cx = 0; cx <= Math.abs(endx - tilex); cx += (isX ? 0 : 1)){
|
||||||
|| !state.inventory.hasItems(control.input().recipe.requirements, amount)){
|
for(int cy = 0; cy <= Math.abs(endy - tiley); cy += (isX ? 1 : 0)){
|
||||||
Lines.crect(px * t + offset.x, py * t + offset.y, t*block.width, t*block.height);
|
|
||||||
|
int px = tx + cx * Mathf.sign(ex - tx),
|
||||||
|
py = ty + cy * Mathf.sign(ey - ty);
|
||||||
|
|
||||||
|
//step by the block size if it's valid
|
||||||
|
if(control.input().validPlace(px, py, control.input().recipe.result) && state.inventory.hasItems(control.input().recipe.requirements, amount)){
|
||||||
|
|
||||||
|
renderer.getBlocks().handlePreview(control.input().recipe.result, block.rotate ? rotation * 90 : 0f, px * t + offset.x, py * t + offset.y, px, py);
|
||||||
|
|
||||||
|
if(isX){
|
||||||
|
cx += block.width;
|
||||||
|
}else{
|
||||||
|
cy += block.width;
|
||||||
|
}
|
||||||
|
amount ++;
|
||||||
|
}else{ //otherwise, step by 1 until it is valid
|
||||||
|
if(control.input().cursorNear()){
|
||||||
|
Lines.stroke(2f);
|
||||||
|
Draw.color("placeInvalid");
|
||||||
|
Lines.crect(
|
||||||
|
px * t + (isX ? 0 : offset.x) + (ex < tx && isX ? t : 0) - (block.width == 3 && ex > tx && isX ? t : 0),
|
||||||
|
py * t + (isX ? offset.y : 0) + (ey < ty && !isX ? t : 0) - (block.height == 3 && ey > ty && !isX ? t : 0),
|
||||||
|
t*(isX ? 1 : block.width),
|
||||||
|
t*(isX ? block.height : 1));
|
||||||
|
Draw.color("place");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isX){
|
||||||
|
cx += 1;
|
||||||
|
}else{
|
||||||
|
cy += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
amount ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(control.input().recipe.result.rotate){
|
if(control.input().recipe.result.rotate){
|
||||||
float cx = tx * t, cy = ty * t;
|
float cx = tx * t, cy = ty * t;
|
||||||
|
Lines.stroke(2f);
|
||||||
Draw.color(Colors.get("placeRotate"));
|
Draw.color(Colors.get("placeRotate"));
|
||||||
tr.trns(rotation * 90, 7, 0);
|
tr.trns(rotation * 90, 7, 0);
|
||||||
Lines.line(cx, cy, cx + tr.x, cy + tr.y);
|
Lines.line(cx, cy, cx + tr.x, cy + tr.y);
|
||||||
|
|||||||
@@ -130,7 +130,15 @@ public class SaveIO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void load(FileHandle file){
|
public static void load(FileHandle file){
|
||||||
load(file.read());
|
try {
|
||||||
|
load(file.read());
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
FileHandle backup = file.sibling(file.name() + "-backup." + file.extension());
|
||||||
|
if(backup.exists()){
|
||||||
|
load(backup.read());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load(InputStream is){
|
public static void load(InputStream is){
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class Saves {
|
|||||||
|
|
||||||
exec.submit(() -> {
|
exec.submit(() -> {
|
||||||
SaveIO.saveToSlot(current.index);
|
SaveIO.saveToSlot(current.index);
|
||||||
|
current.meta = SaveIO.getData(current.index);
|
||||||
saving = false;
|
saving = false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class Save12 extends SaveFileVersion {
|
|||||||
stream.writeFloat(Vars.player.x); //player x/y
|
stream.writeFloat(Vars.player.x); //player x/y
|
||||||
stream.writeFloat(Vars.player.y);
|
stream.writeFloat(Vars.player.y);
|
||||||
|
|
||||||
stream.writeInt(Vars.player.health); //player health
|
stream.writeInt((int)Vars.player.health); //player health
|
||||||
|
|
||||||
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ public class Save12 extends SaveFileVersion {
|
|||||||
stream.writeFloat(enemy.x); //x
|
stream.writeFloat(enemy.x); //x
|
||||||
stream.writeFloat(enemy.y); //y
|
stream.writeFloat(enemy.y); //y
|
||||||
stream.writeByte(enemy.tier); //tier
|
stream.writeByte(enemy.tier); //tier
|
||||||
stream.writeInt(enemy.health); //health
|
stream.writeInt((int)enemy.health); //health
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MAP DATA--
|
//--MAP DATA--
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public class Save13 extends SaveFileVersion {
|
|||||||
stream.writeFloat(Vars.player.x); //player x/y
|
stream.writeFloat(Vars.player.x); //player x/y
|
||||||
stream.writeFloat(Vars.player.y);
|
stream.writeFloat(Vars.player.y);
|
||||||
|
|
||||||
stream.writeInt(Vars.player.health); //player health
|
stream.writeInt((int)Vars.player.health); //player health
|
||||||
|
|
||||||
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public class Save13 extends SaveFileVersion {
|
|||||||
stream.writeFloat(enemy.x); //x
|
stream.writeFloat(enemy.x); //x
|
||||||
stream.writeFloat(enemy.y); //y
|
stream.writeFloat(enemy.y); //y
|
||||||
stream.writeByte(enemy.tier); //tier
|
stream.writeByte(enemy.tier); //tier
|
||||||
stream.writeShort(enemy.health); //health
|
stream.writeShort((short)enemy.health); //health
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MAP DATA--
|
//--MAP DATA--
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public class Save14 extends SaveFileVersion{
|
|||||||
stream.writeFloat(Vars.player.x); //player x/y
|
stream.writeFloat(Vars.player.x); //player x/y
|
||||||
stream.writeFloat(Vars.player.y);
|
stream.writeFloat(Vars.player.y);
|
||||||
|
|
||||||
stream.writeInt(Vars.player.health); //player health
|
stream.writeInt((int)Vars.player.health); //player health
|
||||||
|
|
||||||
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ public class Save14 extends SaveFileVersion{
|
|||||||
stream.writeFloat(enemy.x); //x
|
stream.writeFloat(enemy.x); //x
|
||||||
stream.writeFloat(enemy.y); //y
|
stream.writeFloat(enemy.y); //y
|
||||||
stream.writeByte(enemy.tier); //tier
|
stream.writeByte(enemy.tier); //tier
|
||||||
stream.writeShort(enemy.health); //health
|
stream.writeShort((short)enemy.health); //health
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MAP DATA--
|
//--MAP DATA--
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class Save15 extends SaveFileVersion {
|
|||||||
stream.writeFloat(player.x); //player x/y
|
stream.writeFloat(player.x); //player x/y
|
||||||
stream.writeFloat(player.y);
|
stream.writeFloat(player.y);
|
||||||
|
|
||||||
stream.writeInt(player.health); //player health
|
stream.writeInt((int)player.health); //player health
|
||||||
|
|
||||||
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
stream.writeByte(control.upgrades().getWeapons().size - 1); //amount of weapons
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ public class Save15 extends SaveFileVersion {
|
|||||||
stream.writeFloat(enemy.x); //x
|
stream.writeFloat(enemy.x); //x
|
||||||
stream.writeFloat(enemy.y); //y
|
stream.writeFloat(enemy.y); //y
|
||||||
stream.writeByte(enemy.tier); //tier
|
stream.writeByte(enemy.tier); //tier
|
||||||
stream.writeShort(enemy.health); //health
|
stream.writeShort((short)enemy.health); //health
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MAP DATA--
|
//--MAP DATA--
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.mapeditor;
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input.Keys;
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
@@ -27,6 +26,7 @@ import io.anuke.ucore.scene.builders.table;
|
|||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
import io.anuke.ucore.util.Input;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
@@ -340,20 +340,20 @@ public class MapEditorDialog extends Dialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ctrl keys (undo, redo, save)
|
//ctrl keys (undo, redo, save)
|
||||||
if(Inputs.keyDown(Keys.CONTROL_LEFT)){
|
if(Inputs.keyDown(Input.CONTROL_LEFT)){
|
||||||
if(Inputs.keyTap(Keys.Z)){
|
if(Inputs.keyTap(Input.Z)){
|
||||||
view.undo();
|
view.undo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyTap(Keys.Y)){
|
if(Inputs.keyTap(Input.Y)){
|
||||||
view.redo();
|
view.redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyTap(Keys.S)){
|
if(Inputs.keyTap(Input.S)){
|
||||||
saveDialog.save();
|
saveDialog.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyTap(Keys.G)){
|
if(Inputs.keyTap(Input.G)){
|
||||||
view.setGrid(!view.isGrid());
|
view.setGrid(!view.isGrid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.mapeditor;
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input.Keys;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
@@ -27,6 +26,7 @@ import io.anuke.ucore.scene.event.InputListener;
|
|||||||
import io.anuke.ucore.scene.event.Touchable;
|
import io.anuke.ucore.scene.event.Touchable;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
import io.anuke.ucore.util.Input;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
|
||||||
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) &&
|
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) &&
|
||||||
!Inputs.keyDown(Keys.CONTROL_LEFT)) {
|
!Inputs.keyDown(Input.CONTROL_LEFT)) {
|
||||||
float ax = Inputs.getAxis("move_x");
|
float ax = Inputs.getAxis("move_x");
|
||||||
float ay = Inputs.getAxis("move_y");
|
float ay = Inputs.getAxis("move_y");
|
||||||
offsetx -= ax * 15f / zoom;
|
offsetx -= ax * 15f / zoom;
|
||||||
|
|||||||
@@ -184,6 +184,18 @@ public class Administration {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Array<PlayerInfo> findByIPs(String ip){
|
||||||
|
Array<PlayerInfo> result = new Array<>();
|
||||||
|
|
||||||
|
for(PlayerInfo info : playerInfo.values()){
|
||||||
|
if(info.ips.contains(ip, false)){
|
||||||
|
result.add(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerInfo getInfo(String id){
|
public PlayerInfo getInfo(String id){
|
||||||
return getCreateInfo(id);
|
return getCreateInfo(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.net;
|
package io.anuke.mindustry.net;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.IntIntMap;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
|
|
||||||
@@ -9,8 +10,7 @@ public class TraceInfo {
|
|||||||
public boolean modclient;
|
public boolean modclient;
|
||||||
public boolean android;
|
public boolean android;
|
||||||
|
|
||||||
public int fastShots;
|
public IntIntMap fastShots = new IntIntMap();
|
||||||
public long lastFastShot;
|
|
||||||
|
|
||||||
public int totalBlocksBroken;
|
public int totalBlocksBroken;
|
||||||
public int structureBlocksBroken;
|
public int structureBlocksBroken;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
@@ -35,6 +36,12 @@ public class ColorPickDialog extends Dialog{
|
|||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyDown(key->{
|
||||||
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(Consumer<Color> cons){
|
public void show(Consumer<Color> cons){
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package io.anuke.mindustry.ui.dialogs;
|
|||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
import io.anuke.ucore.core.Inputs;
|
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
|
|
||||||
public class FloatingDialog extends Dialog{
|
public class FloatingDialog extends Dialog{
|
||||||
@@ -26,11 +24,5 @@ public class FloatingDialog extends Dialog{
|
|||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
update(() -> {
|
|
||||||
if(Inputs.keyTap("menu")){
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,13 @@ import io.anuke.ucore.core.Core;
|
|||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
|
import io.anuke.ucore.scene.Element;
|
||||||
|
import io.anuke.ucore.scene.event.InputEvent;
|
||||||
|
import io.anuke.ucore.scene.event.InputListener;
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
import io.anuke.ucore.scene.ui.Image;
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.SettingsDialog;
|
import io.anuke.ucore.scene.ui.SettingsDialog;
|
||||||
|
import io.anuke.ucore.scene.ui.Slider;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
@@ -92,6 +96,24 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
prefs.add(menu);
|
prefs.add(menu);
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(prefs, "clear");
|
ScrollPane pane = new ScrollPane(prefs, "clear");
|
||||||
|
pane.addCaptureListener(new InputListener() {
|
||||||
|
@Override
|
||||||
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
|
Element actor = pane.hit(x, y, true);
|
||||||
|
if (actor instanceof Slider) {
|
||||||
|
pane.setFlickScroll(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.touchDown(event, x, y, pointer, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
|
pane.setFlickScroll(true);
|
||||||
|
super.touchUp(event, x, y, pointer, button);
|
||||||
|
}
|
||||||
|
});
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
row();
|
row();
|
||||||
@@ -139,6 +161,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
graphics.checkPref("fps", false);
|
graphics.checkPref("fps", false);
|
||||||
graphics.checkPref("lasers", true);
|
graphics.checkPref("lasers", true);
|
||||||
|
graphics.sliderPref("previewopacity", 50, 0, 100, i -> i + "%");
|
||||||
graphics.checkPref("indicators", true);
|
graphics.checkPref("indicators", true);
|
||||||
graphics.checkPref("healthbars", true);
|
graphics.checkPref("healthbars", true);
|
||||||
graphics.checkPref("pixelate", true, b -> {
|
graphics.checkPref("pixelate", true, b -> {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class Junction extends Block{
|
|||||||
|
|
||||||
for(int i = 0; i < 2; i ++){
|
for(int i = 0; i < 2; i ++){
|
||||||
Buffer buffer = (i == 0 ? entity.bx : entity.by);
|
Buffer buffer = (i == 0 ? entity.bx : entity.by);
|
||||||
|
|
||||||
if(buffer.index > 0){
|
if(buffer.index > 0){
|
||||||
if(buffer.index > buffer.items.length) buffer.index = buffer.items.length;
|
if(buffer.index > buffer.items.length) buffer.index = buffer.items.length;
|
||||||
long l = buffer.items[0];
|
long l = buffer.items[0];
|
||||||
@@ -45,7 +46,13 @@ public class Junction extends Block{
|
|||||||
int direction = Bits.getRightShort(val);
|
int direction = Bits.getRightShort(val);
|
||||||
Tile dest = tile.getNearby(direction);
|
Tile dest = tile.getNearby(direction);
|
||||||
|
|
||||||
if(dest == null || !dest.block().acceptItem(item, dest, tile)) continue;
|
if(dest == null || !dest.block().acceptItem(item, dest, tile)){
|
||||||
|
if(buffer.index > 1){
|
||||||
|
System.arraycopy(buffer.items, 1, buffer.items, 0, buffer.index - 1);
|
||||||
|
buffer.index --;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
dest.block().handleItem(item, dest, tile);
|
dest.block().handleItem(item, dest, tile);
|
||||||
System.arraycopy(buffer.items, 1, buffer.items, 0, buffer.index - 1);
|
System.arraycopy(buffer.items, 1, buffer.items, 0, buffer.index - 1);
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public class ItemPowerGenerator extends Generator{
|
|||||||
PowerEntity entity = tile.entity();
|
PowerEntity entity = tile.entity();
|
||||||
|
|
||||||
float maxPower = Math.min(powerCapacity - entity.power, powerOutput * Timers.delta());
|
float maxPower = Math.min(powerCapacity - entity.power, powerOutput * Timers.delta());
|
||||||
float mfract = maxPower/(powerOutput);
|
float mfin = maxPower/(powerOutput);
|
||||||
|
|
||||||
if(entity.time > 0f){
|
if(entity.time > 0f){
|
||||||
entity.time -= 1f/itemDuration*mfract;
|
entity.time -= 1f/itemDuration*mfin;
|
||||||
entity.power += maxPower;
|
entity.power += maxPower;
|
||||||
entity.time = Mathf.clamp(entity.time);
|
entity.time = Mathf.clamp(entity.time);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package io.anuke.mindustry.desktop;
|
|||||||
import club.minnced.discord.rpc.DiscordEventHandlers;
|
import club.minnced.discord.rpc.DiscordEventHandlers;
|
||||||
import club.minnced.discord.rpc.DiscordRPC;
|
import club.minnced.discord.rpc.DiscordRPC;
|
||||||
import club.minnced.discord.rpc.DiscordRichPresence;
|
import club.minnced.discord.rpc.DiscordRichPresence;
|
||||||
|
import com.badlogic.gdx.utils.Base64Coder;
|
||||||
import io.anuke.kryonet.DefaultThreadImpl;
|
import io.anuke.kryonet.DefaultThreadImpl;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
||||||
import io.anuke.mindustry.io.Platform;
|
import io.anuke.mindustry.io.Platform;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.ucore.UCore;
|
import io.anuke.ucore.UCore;
|
||||||
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -19,6 +21,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -106,15 +109,34 @@ public class DesktopPlatform extends Platform {
|
|||||||
try {
|
try {
|
||||||
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
||||||
NetworkInterface out;
|
NetworkInterface out;
|
||||||
for(out = e.nextElement(); out.getHardwareAddress() == null && e.hasMoreElements(); out = e.nextElement());
|
for(out = e.nextElement(); out.getHardwareAddress() == null && e.hasMoreElements() && validAddress(out.getHardwareAddress()); out = e.nextElement());
|
||||||
|
|
||||||
byte[] bytes = out.getHardwareAddress();
|
byte[] bytes = out.getHardwareAddress();
|
||||||
byte[] result = new byte[8];
|
byte[] result = new byte[8];
|
||||||
System.arraycopy(bytes, 0, result, 0, bytes.length);
|
System.arraycopy(bytes, 0, result, 0, bytes.length);
|
||||||
|
|
||||||
|
if(new String(Base64Coder.encode(result)).equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
Settings.defaults("uuid", "");
|
||||||
return null;
|
|
||||||
|
String uuid = Settings.getString("uuid");
|
||||||
|
if(uuid.isEmpty()){
|
||||||
|
byte[] result = new byte[8];
|
||||||
|
new Random().nextBytes(result);
|
||||||
|
uuid = new String(Base64Coder.encode(result));
|
||||||
|
Settings.putString("uuid", uuid);
|
||||||
|
Settings.save();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return Base64Coder.decode(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean validAddress(byte[] bytes){
|
||||||
|
byte[] result = new byte[8];
|
||||||
|
System.arraycopy(bytes, 0, result, 0, bytes.length);
|
||||||
|
return !new String(Base64Coder.encode(result)).equals("AAAAAAAAAOA=");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ import io.anuke.ucore.modules.ModuleCore;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class MindustryServer extends ModuleCore {
|
public class MindustryServer extends ModuleCore {
|
||||||
|
private String[] args;
|
||||||
|
|
||||||
|
public MindustryServer(String[] args){
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
@@ -23,6 +28,6 @@ public class MindustryServer extends ModuleCore {
|
|||||||
module(world = new World());
|
module(world = new World());
|
||||||
module(netServer = new NetServer());
|
module(netServer = new NetServer());
|
||||||
module(netCommon = new NetCommon());
|
module(netCommon = new NetCommon());
|
||||||
module(new ServerControl());
|
module(new ServerControl(args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ServerControl extends Module {
|
|||||||
private final CommandHandler handler = new CommandHandler("");
|
private final CommandHandler handler = new CommandHandler("");
|
||||||
private ShuffleMode mode;
|
private ShuffleMode mode;
|
||||||
|
|
||||||
public ServerControl(){
|
public ServerControl(String[] args){
|
||||||
Settings.defaultList(
|
Settings.defaultList(
|
||||||
"shufflemode", "normal",
|
"shufflemode", "normal",
|
||||||
"bans", "",
|
"bans", "",
|
||||||
@@ -69,7 +69,24 @@ public class ServerControl extends Module {
|
|||||||
@Override public void debug(String tag, String message, Throwable exception) { }
|
@Override public void debug(String tag, String message, Throwable exception) { }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
String[] commands = {};
|
||||||
|
|
||||||
|
if(args.length > 0){
|
||||||
|
commands = String.join(" ", args).split(",");
|
||||||
|
Log.info("&lmFound {0} command-line arguments to parse. {1}", commands.length);
|
||||||
|
}
|
||||||
|
|
||||||
registerCommands();
|
registerCommands();
|
||||||
|
|
||||||
|
for(String s : commands){
|
||||||
|
Response response = handler.handleMessage(s);
|
||||||
|
if(response.type != ResponseType.valid){
|
||||||
|
Log.err("Invalid command argument sent: '{0}': {1}", s, response.type.name());
|
||||||
|
Log.err("Argument usage: &lc<command-1> <command1-args...>,<command-2> <command-2-args2...>");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Thread thread = new Thread(this::readCommands, "Server Controls");
|
Thread thread = new Thread(this::readCommands, "Server Controls");
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
@@ -333,7 +350,11 @@ public class ServerControl extends Module {
|
|||||||
Log.info("&lmBanned players [IP]:");
|
Log.info("&lmBanned players [IP]:");
|
||||||
for(String string : ipbans){
|
for(String string : ipbans){
|
||||||
PlayerInfo info = netServer.admins.findByIP(string);
|
PlayerInfo info = netServer.admins.findByIP(string);
|
||||||
Log.info(" &lm '{0}' / Last known name: '{1}' / ID: '{2}'", string, info.lastName, info.id);
|
if(info != null) {
|
||||||
|
Log.info(" &lm '{0}' / Last known name: '{1}' / ID: '{2}'", string, info.lastName, info.id);
|
||||||
|
}else{
|
||||||
|
Log.info(" &lm '{0}' (No known name or info)", string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -343,7 +364,9 @@ public class ServerControl extends Module {
|
|||||||
info("Banned player by IP: {0}.", arg[0]);
|
info("Banned player by IP: {0}.", arg[0]);
|
||||||
|
|
||||||
for(Player player : playerGroup.all()){
|
for(Player player : playerGroup.all()){
|
||||||
if(Net.getConnection(player.clientid).address.equals(arg[0])){
|
if(Net.getConnection(player.clientid) != null &&
|
||||||
|
Net.getConnection(player.clientid).address != null &&
|
||||||
|
Net.getConnection(player.clientid).address.equals(arg[0])){
|
||||||
netServer.kick(player.clientid, KickReason.banned);
|
netServer.kick(player.clientid, KickReason.banned);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -496,6 +519,37 @@ public class ServerControl extends Module {
|
|||||||
info("Saved to slot {0}.", slot);
|
info("Saved to slot {0}.", slot);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
handler.register("griefers", "[min-break:place-ratio] [min-breakage]", "Find possible griefers currently online.", arg -> {
|
||||||
|
if(!state.is(State.playing)) {
|
||||||
|
err("Open the server first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
float ratio = arg.length > 0 ? Float.parseFloat(arg[0]) : 0.5f;
|
||||||
|
int minbreak = arg.length > 1 ? Integer.parseInt(arg[1]) : 100;
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
|
for (Player player : playerGroup.all()) {
|
||||||
|
TraceInfo info = netServer.admins.getTrace(Net.getConnection(player.clientid).address);
|
||||||
|
if(info.totalBlocksBroken >= minbreak && info.totalBlocksBroken / Math.max(info.totalBlocksPlaced, 1f) >= ratio){
|
||||||
|
info("&ly - Player '{0}' / UUID &lm{1}&ly found: &lc{2}&ly broken and &lc{3}&ly placed.",
|
||||||
|
player.name, info.uuid, info.totalBlocksBroken, info.totalBlocksPlaced);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
info("No griefers matching the criteria have been found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (NumberFormatException e){
|
||||||
|
err("Invalid number format.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
handler.register("gameover", "Force a game over.", arg -> {
|
handler.register("gameover", "Force a game over.", arg -> {
|
||||||
if(state.is(State.menu)){
|
if(state.is(State.menu)){
|
||||||
info("Not playing a map.");
|
info("Not playing a map.");
|
||||||
@@ -537,8 +591,8 @@ public class ServerControl extends Module {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("find", "<name> [check-all-names]", "Find player info(s) by name. Can optionally check for all names a player has had.", arg -> {
|
handler.register("find", "<name...>", "Find player info(s) by name. Can optionally check for all names a player has had.", arg -> {
|
||||||
boolean checkAll = arg.length == 2 && arg[1].equals("true");
|
boolean checkAll = true;
|
||||||
|
|
||||||
Array<PlayerInfo> infos = netServer.admins.findByName(arg[0], checkAll);
|
Array<PlayerInfo> infos = netServer.admins.findByName(arg[0], checkAll);
|
||||||
|
|
||||||
@@ -564,6 +618,33 @@ public class ServerControl extends Module {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
handler.register("findip", "<ip>", "Find player info(s) by IP.", arg -> {
|
||||||
|
|
||||||
|
Array<PlayerInfo> infos = netServer.admins.findByIPs(arg[0]);
|
||||||
|
|
||||||
|
if(infos.size == 1) {
|
||||||
|
PlayerInfo info = infos.peek();
|
||||||
|
Log.info("&lcTrace info for player '{0}' / UUID {1}:", info.lastName, info.id);
|
||||||
|
Log.info(" &lyall names used: {0}", info.names);
|
||||||
|
Log.info(" &lyIP: {0}", info.lastIP);
|
||||||
|
Log.info(" &lyall IPs used: {0}", info.ips);
|
||||||
|
Log.info(" &lytimes joined: {0}", info.timesJoined);
|
||||||
|
Log.info(" &lytimes kicked: {0}", info.timesKicked);
|
||||||
|
Log.info("");
|
||||||
|
Log.info(" &lytotal blocks broken: {0}", info.totalBlocksBroken);
|
||||||
|
Log.info(" &lytotal blocks placed: {0}", info.totalBlockPlaced);
|
||||||
|
}else if(infos.size > 1){
|
||||||
|
Log.info("&lcMultiple people have been found with that IP:");
|
||||||
|
for(PlayerInfo info : infos){
|
||||||
|
Log.info(" &ly{0}", info.id);
|
||||||
|
}
|
||||||
|
Log.info("&lcUse the info command to examine each person individually.");
|
||||||
|
}else{
|
||||||
|
info("Nobody with that IP could be found.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
handler.register("info", "<UUID>", "Get global info for a player's UUID.", arg -> {
|
handler.register("info", "<UUID>", "Get global info for a player's UUID.", arg -> {
|
||||||
PlayerInfo info = netServer.admins.getInfoOptional(arg[0]);
|
PlayerInfo info = netServer.admins.getInfoOptional(arg[0]);
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import io.anuke.mindustry.net.Net;
|
|||||||
|
|
||||||
public class ServerLauncher{
|
public class ServerLauncher{
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception{
|
public static void main(String[] args){
|
||||||
|
|
||||||
Net.setClientProvider(new KryoClient());
|
Net.setClientProvider(new KryoClient());
|
||||||
Net.setServerProvider(new KryoServer());
|
Net.setServerProvider(new KryoServer());
|
||||||
|
|
||||||
new HeadlessApplication(new MindustryServer());
|
new HeadlessApplication(new MindustryServer(args));
|
||||||
|
|
||||||
//find and handle uncaught exceptions in libGDX thread
|
//find and handle uncaught exceptions in libGDX thread
|
||||||
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
for(Thread thread : Thread.getAllStackTraces().keySet()){
|
||||||
@@ -24,6 +24,5 @@ public class ServerLauncher{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||