Project-wide refactoring, link crash fixes

This commit is contained in:
Anuken
2018-01-24 16:48:07 -05:00
parent 257335ebaf
commit 8c39e05f58
60 changed files with 302 additions and 303 deletions
@@ -10,13 +10,18 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.tilesize;
public class Bullet extends BulletEntity{
BulletType type;
public boolean absorbed = false;
public Bullet(BulletType type, Entity owner, float x, float y, float angle){
super(type, owner, angle);
set(x, y);
this.type = type;
}
public void absorb(){
absorbed = true;
remove();
}
public void draw(){
type.draw(this);
@@ -5,10 +5,11 @@ import io.anuke.mindustry.entities.effect.DamageArea;
import io.anuke.mindustry.entities.effect.EMP;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.BaseBulletType;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@@ -45,8 +46,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
sniper = new BulletType(3f, 25){
public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY);
Draw.thick(1f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), 3f);
Lines.stroke(1f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 3f);
Draw.reset();
}
@@ -66,7 +67,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
float rad = 6f + Mathf.sin(Timers.time(), 5f, 2f);
Draw.color(Color.SKY);
Draw.circle(b.x, b.y, 4f);
Lines.circle(b.x, b.y, 4f);
Draw.rect("circle", b.x, b.y, rad, rad);
Draw.reset();
}
@@ -138,10 +139,10 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b) {
Draw.color(Color.GRAY);
Draw.thick(3f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Draw.thick(1.5f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), 5f);
Lines.stroke(3f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Lines.stroke(1.5f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 5f);
Draw.reset();
}
@@ -168,8 +169,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b) {
Draw.color(Color.LIGHT_GRAY, Color.GRAY, b.ifract());
Draw.thick(2f - b.ifract());
Draw.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Lines.stroke(2f - b.ifract());
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Draw.reset();
}
},
@@ -324,8 +325,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b){
Draw.color(Color.WHITE, lightOrange, b.fract()/2f + 0.25f);
Draw.thick(1.5f);
Draw.lineAngle(b.x, b.y, b.angle(), 3f);
Lines.stroke(1.5f);
Lines.lineAngle(b.x, b.y, b.angle(), 3f);
Draw.reset();
}
},
@@ -338,8 +339,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
float size = 3f - b.ifract()*1f;
Draw.color(Color.PURPLE, Color.WHITE, 0.8f);
Draw.thick(1f);
Draw.circle(b.x, b.y, size);
Lines.stroke(1f);
Lines.circle(b.x, b.y, size);
Draw.reset();
}
},
@@ -350,13 +351,13 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
}
public void draw(Bullet b){
Draw.thick(2f);
Lines.stroke(2f);
Draw.color(lightOrange, Color.WHITE, 0.4f);
Draw.polygon(b.x, b.y, 3, 1.6f, b.angle());
Draw.thick(1f);
Lines.poly(b.x, b.y, 3, 1.6f, b.angle());
Lines.stroke(1f);
Draw.color(Color.WHITE, lightOrange, b.ifract()/2f);
Draw.alpha(b.ifract());
Draw.spikes(b.x, b.y, 1.5f, 2f, 6);
Lines.spikes(b.x, b.y, 1.5f, 2f, 6);
Draw.reset();
}
@@ -383,8 +384,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b){
Draw.color(lightGray);
Draw.thick(1f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Lines.stroke(1f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
Draw.reset();
}
@@ -407,8 +408,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b) {
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
Draw.thick(2f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*5f);
Lines.stroke(2f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*5f);
Draw.reset();
}
@@ -435,8 +436,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
public void draw(Bullet b) {
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
Draw.thick(1f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*4f);
Lines.stroke(1f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*4f);
Draw.reset();
}
},
@@ -456,18 +457,18 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.color(beam);
Draw.rect("circle", b.x, b.y, 6f*f, 6f*f);
Draw.thick(3f * f);
Draw.lineAngle(b.x, b.y, b.angle(), length);
Lines.stroke(3f * f);
Lines.lineAngle(b.x, b.y, b.angle(), length);
Draw.thick(2f * f);
Draw.lineAngle(b.x, b.y, b.angle(), length + 6f);
Draw.thick(1f * f);
Draw.lineAngle(b.x, b.y, b.angle(), length + 12f);
Lines.stroke(2f * f);
Lines.lineAngle(b.x, b.y, b.angle(), length + 6f);
Lines.stroke(1f * f);
Lines.lineAngle(b.x, b.y, b.angle(), length + 12f);
Draw.color(beamLight);
Draw.thick(1.5f * f);
Lines.stroke(1.5f * f);
Draw.rect("circle", b.x, b.y, 3f*f, 3f*f);
Draw.lineAngle(b.x, b.y, b.angle(), length);
Lines.lineAngle(b.x, b.y, b.angle(), length);
}
};
@@ -9,6 +9,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.ucore.core.*;
import io.anuke.ucore.entities.SolidEntity;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@@ -8,9 +8,10 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.entities.TimedEntity;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@@ -83,8 +84,8 @@ public class EMP extends TimedEntity{
drawLine(x + Angles.x(), y + Angles.y());
}
Draw.thick(fract()*2f);
Draw.polygon(x, y, 34, radius * Vars.tilesize);
Lines.stroke(fract()*2f);
Lines.poly(x, y, 34, radius * Vars.tilesize);
Draw.reset();
}
@@ -111,7 +112,7 @@ public class EMP extends TimedEntity{
}
private void drawLaser(float x, float y, float x2, float y2){
Draw.thick(fract() * 2f);
Draw.line(x, y, x2, y2);
Lines.stroke(fract() * 2f);
Lines.line(x, y, x2, y2);
}
}
@@ -6,7 +6,7 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.BulletEntity;
import io.anuke.ucore.entities.Entities;
@@ -8,12 +8,13 @@ import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.entities.Entity;
import io.anuke.ucore.entities.SolidEntity;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Tmp;
@@ -95,8 +96,8 @@ public class TeslaOrb extends Entity{
Draw.color(Color.WHITE);
Draw.alpha(1f-life/lifetime);
Draw.thick(3f - life/lifetime*2f);
Draw.line(x1, y1, x2, y2);
Lines.stroke(3f - life/lifetime*2f);
Lines.line(x1, y1, x2, y2);
float rad = 7f - life/lifetime*5f;
@@ -108,7 +109,7 @@ public class TeslaOrb extends Entity{
//Draw.color(Color.WHITE);
//Draw.thick(2f - life/lifetime*2f);
//Draw.stroke(2f - life/lifetime*2f);
//Draw.line(x1, y1, x2, y2);
Draw.reset();
@@ -12,7 +12,7 @@ import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers;
@@ -11,7 +11,9 @@ import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.ucore.core.*;
import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Shapes;
import io.anuke.ucore.util.Angles;
public class HealerType extends EnemyType {
@@ -75,7 +77,7 @@ public class HealerType extends EnemyType {
if(target.health < target.maxhealth){
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 13f));
Draw.alpha(0.9f);
Draw.laser("laser", "laserend", enemy.x + Angles.x(), enemy.y + Angles.y(), target.x - Angles.x()/1.5f, target.y - Angles.y()/1.5f);
Shapes.laser("laser", "laserend", enemy.x + Angles.x(), enemy.y + Angles.y(), target.x - Angles.x()/1.5f, target.y - Angles.y()/1.5f);
Draw.color();
}
Graphics.shader(Shaders.outline);
@@ -6,8 +6,9 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.entities.enemies.EnemyType;
import io.anuke.mindustry.entities.enemies.EnemyTypes;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
public class TargetType extends EnemyType {
@@ -42,7 +43,7 @@ public class TargetType extends EnemyType {
Draw.color(Color.YELLOW);
if(Vars.control.getTutorial().showTarget()){
Draw.spikes(enemy.x, enemy.y, 11f + Mathf.sin(Timers.time(), 7f, 1f), 4f, 8, Timers.time());
Lines.spikes(enemy.x, enemy.y, 11f + Mathf.sin(Timers.time(), 7f, 1f), 4f, 8, Timers.time());
}
Draw.color();