Implemented many new weapons (still broken)
This commit is contained in:
@@ -16,7 +16,6 @@ import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.input.AndroidInput;
|
||||
import io.anuke.mindustry.input.DesktopInput;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.io.BundleGen;
|
||||
import io.anuke.mindustry.io.Saves;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -76,8 +75,6 @@ public class Control extends Module{
|
||||
private boolean controlling;
|
||||
|
||||
public Control(){
|
||||
BundleGen.cleanBundles(Gdx.files.internal("bundles/bundle.properties"));
|
||||
|
||||
if(Mindustry.args.contains("-debug", false))
|
||||
Vars.debug = true;
|
||||
|
||||
@@ -230,7 +227,8 @@ public class Control extends Module{
|
||||
player.weaponLeft = player.weaponRight = weapons.first();
|
||||
|
||||
if(debug){
|
||||
weapons.add(Weapon.triblaster);
|
||||
weapons.add(Weapon.triblaster, Weapon.clustergun, Weapon.beam, Weapon.railgun);
|
||||
weapons.add(Weapon.mortar);
|
||||
player.weaponLeft = player.weaponRight = weapons.peek();
|
||||
}
|
||||
|
||||
@@ -254,7 +252,7 @@ public class Control extends Module{
|
||||
}
|
||||
|
||||
ui.hudfrag.updateItems();
|
||||
ui.weaponfrag.update();
|
||||
ui.hudfrag.updateWeapons();
|
||||
}
|
||||
|
||||
public void play(){
|
||||
|
||||
@@ -392,9 +392,9 @@ public class Tutorial{
|
||||
}
|
||||
|
||||
void onSwitch(){
|
||||
if(!Vars.control.getWeapons().contains(Weapon.multigun, true)){
|
||||
Vars.control.getWeapons().add(Weapon.multigun);
|
||||
Vars.ui.weaponfrag.update();
|
||||
if(!Vars.control.getWeapons().contains(Weapon.triblaster, true)){
|
||||
Vars.control.getWeapons().add(Weapon.triblaster);
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -43,7 +43,6 @@ public class UI extends SceneModule{
|
||||
public final ToolFragment toolfrag = new ToolFragment();
|
||||
public final HudFragment hudfrag = new HudFragment();
|
||||
public final PlacementFragment placefrag = new PlacementFragment();
|
||||
public final WeaponFragment weaponfrag = new WeaponFragment();
|
||||
public final ChatFragment chatfrag = new ChatFragment();
|
||||
public final PlayerListFragment listfrag = new PlayerListFragment();
|
||||
public final BackgroundFragment backfrag = new BackgroundFragment();
|
||||
@@ -143,7 +142,6 @@ public class UI extends SceneModule{
|
||||
build.begin(scene);
|
||||
|
||||
backfrag.build();
|
||||
weaponfrag.build();
|
||||
hudfrag.build();
|
||||
configfrag.build();
|
||||
menufrag.build();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.mindustry.entities.effect.DamageArea;
|
||||
import io.anuke.mindustry.entities.effect.EMP;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
@@ -10,17 +9,12 @@ import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.BaseBulletType;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
static Color glowy = Color.valueOf("fdc056");
|
||||
static Color lightGold = Hue.mix(Color.GOLD, Color.WHITE, 0.4f);
|
||||
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
static Color lightOrange = Color.valueOf("f68021");
|
||||
static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
static Color whiteYellow = Hue.mix(Color.YELLOW, Color.WHITE, 0.6f);
|
||||
import static io.anuke.mindustry.graphics.Fx.*;
|
||||
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
public static final BulletType
|
||||
|
||||
@@ -88,9 +82,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
}
|
||||
|
||||
public void removed(Bullet b){
|
||||
Timers.run(5f, ()->{
|
||||
new EMP(b.x, b.y, b.getDamage()).add();
|
||||
});
|
||||
Timers.run(5f, ()-> new EMP(b.x, b.y, b.getDamage()).add());
|
||||
Effects.effect(Fx.empshockwave, b);
|
||||
Effects.shake(3f, 3f, b);
|
||||
}
|
||||
@@ -220,12 +212,6 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
public void draw(Bullet b){}
|
||||
},
|
||||
shellshot = new BulletType(1.5f, 6){
|
||||
{
|
||||
lifetime = 7f;
|
||||
}
|
||||
public void draw(Bullet b){}
|
||||
},
|
||||
blastshot = new BulletType(1.6f, 6){
|
||||
{
|
||||
lifetime = 7f;
|
||||
@@ -255,7 +241,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
flame = new BulletType(0.6f, 5){
|
||||
flame = new BulletType(0.6f, 5){ //for turrets
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.YELLOW, Color.SCARLET, b.time/lifetime);
|
||||
float size = 6f-b.time/lifetime*5f;
|
||||
@@ -274,7 +260,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
flameshot = new BulletType(0.5f, 3){
|
||||
flameshot = new BulletType(0.5f, 3){ //for enemies
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.ORANGE, Color.SCARLET, b.time/lifetime);
|
||||
float size = 6f-b.time/lifetime*5f;
|
||||
@@ -294,9 +280,9 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
spread = new BulletType(2.4f, 6) {
|
||||
spread = new BulletType(2.4f, 7) {
|
||||
{
|
||||
lifetime = 50;
|
||||
lifetime = 70;
|
||||
}
|
||||
|
||||
public void draw(Bullet b) {
|
||||
@@ -308,15 +294,132 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
multishot = new BulletType(2.5f, 3){
|
||||
cluster = new BulletType(4.4f, 13){
|
||||
{
|
||||
lifetime = 40;
|
||||
lifetime = 60;
|
||||
drag = 0.06f;
|
||||
}
|
||||
|
||||
public void draw(Bullet b){
|
||||
Draw.color(Color.SKY);
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.thick(2f);
|
||||
Draw.color(lightOrange);
|
||||
Draw.circle(b.x, b.y, 1.6f);
|
||||
Draw.thick(1f);
|
||||
Draw.color(Color.WHITE, lightOrange, b.ifract()/2f);
|
||||
Draw.alpha(b.ifract());
|
||||
Draw.spikes(b.x, b.y, 1.5f, 2f, 6);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void despawned(Bullet b){
|
||||
removed(b);
|
||||
}
|
||||
|
||||
public void removed(Bullet b){
|
||||
Effects.shake(1f, 1f, b);
|
||||
|
||||
Effects.effect(Fx.clusterbomb, b);
|
||||
|
||||
DamageArea.damage(!(b.owner instanceof Enemy), b.x, b.y, 22f, damage);
|
||||
}
|
||||
},
|
||||
rail = new BulletType(4.5f, 11) {
|
||||
{
|
||||
lifetime = 50;
|
||||
}
|
||||
|
||||
public void init(Bullet b) {
|
||||
Timers.reset(b, "smoke", Mathf.random(4f));
|
||||
}
|
||||
|
||||
public void draw(Bullet b){
|
||||
Draw.color(lightGray);
|
||||
Draw.thick(1f);
|
||||
Draw.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void update(Bullet b){
|
||||
if(Timers.get(b, "smoke", 4)){
|
||||
Effects.effect(Fx.chainsmoke, b.x, b.y);
|
||||
}
|
||||
}
|
||||
},
|
||||
shotgun = new BulletType(5.4f, 10) {
|
||||
|
||||
{
|
||||
drag = 0.03f;
|
||||
lifetime = 30f;
|
||||
}
|
||||
|
||||
public void init(Bullet b) {
|
||||
b.velocity.scl(Mathf.random(0.5f, 1f));
|
||||
}
|
||||
|
||||
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);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void despawned(Bullet b) {
|
||||
removed(b);
|
||||
}
|
||||
|
||||
public void removed(Bullet b) {
|
||||
for(int i = 0; i < 4; i ++){
|
||||
Bullet bullet = new Bullet(scrap, b.owner, b.x, b.y, b.angle() + Mathf.range(80f));
|
||||
bullet.add();
|
||||
}
|
||||
}
|
||||
},
|
||||
scrap = new BulletType(2f, 3) {
|
||||
{
|
||||
drag = 0.06f;
|
||||
lifetime = 30f;
|
||||
}
|
||||
|
||||
public void init(Bullet b) {
|
||||
b.velocity.scl(Mathf.random(0.5f, 1f));
|
||||
}
|
||||
|
||||
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);
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
beamlaser = new BulletType(0.001f, 35) {
|
||||
float length = 230f;
|
||||
{
|
||||
drawSize = length*2f+20f;
|
||||
lifetime = 15f;
|
||||
}
|
||||
|
||||
public void init(Bullet b) {
|
||||
DamageArea.damageLine(true, Fx.beamhit, b.x, b.y, b.angle(), length, damage);
|
||||
}
|
||||
|
||||
public void draw(Bullet b) {
|
||||
float f = b.fract()*1.5f;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
Draw.color(beamLight);
|
||||
Draw.thick(1.5f * f);
|
||||
Draw.rect("circle", b.x, b.y, 3f*f, 3f*f);
|
||||
Draw.lineAngle(b.x, b.y, b.angle(), length);
|
||||
}
|
||||
};
|
||||
|
||||
private BulletType(float speed, int damage){
|
||||
|
||||
@@ -1,22 +1,66 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.*;
|
||||
|
||||
//TODO
|
||||
public class DamageArea{
|
||||
private static Rectangle rect = new Rectangle();
|
||||
|
||||
//only for entities, not tiles (yet!)
|
||||
public static void damageLine(boolean enemies, Effect effect, float x, float y, float angle, float length, int damage){
|
||||
Angles.translation(angle, length);
|
||||
rect.setPosition(x, y).setSize(Angles.x(), Angles.y());
|
||||
float x2 = Angles.x() + x, y2 = Angles.y() + y;
|
||||
|
||||
if(rect.width < 0){
|
||||
rect.x += rect.width;
|
||||
rect.width *= -1;
|
||||
}
|
||||
|
||||
if(rect.height < 0){
|
||||
rect.y += rect.height;
|
||||
rect.height *= -1;
|
||||
}
|
||||
|
||||
float expand = 3f;
|
||||
|
||||
rect.y -= expand;
|
||||
rect.x -= expand;
|
||||
rect.width += expand*2;
|
||||
rect.height += expand*2;
|
||||
|
||||
if(enemies){
|
||||
Entities.getNearby(Vars.control.enemyGroup, rect, e -> {
|
||||
Enemy enemy = (Enemy)e;
|
||||
Rectangle other = enemy.hitbox.getRect(enemy.x, enemy.y);
|
||||
other.y -= expand;
|
||||
other.x -= expand;
|
||||
other.width += expand*2;
|
||||
other.height += expand*2;
|
||||
|
||||
Vector2 vec = Physics.raycastRect(x, y, x2, y2, other);
|
||||
|
||||
if(vec != null){
|
||||
Effects.effect(effect, vec.x, vec.y);
|
||||
enemy.damage(damage);
|
||||
}
|
||||
});
|
||||
}//TODO else damage players and blocks?
|
||||
}
|
||||
|
||||
public static void damageEntities(float x, float y, float radius, int damage){
|
||||
damage(true, x, y, radius, damage);
|
||||
|
||||
if(!Vars.android && Vars.player.distanceTo(x, y) < radius){
|
||||
Player player = Vars.player;
|
||||
|
||||
for(Player player : Vars.control.playerGroup.all()){
|
||||
if(player.isAndroid) continue;
|
||||
int amount = calculateDamage(x, y, player.x, player.y, radius, damage);
|
||||
player.damage(amount);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class Enemy extends DestructibleEntity implements Syncable{
|
||||
public float angle;
|
||||
public Vector2 velocity = new Vector2();
|
||||
public Entity target;
|
||||
public float hitTime;
|
||||
public int tier = 1;
|
||||
|
||||
public Enemy(EnemyType type){
|
||||
@@ -59,6 +60,12 @@ public class Enemy extends DestructibleEntity implements Syncable{
|
||||
return (other instanceof Bullet) && !(((Bullet) other).owner instanceof Enemy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(int amount){
|
||||
super.damage(amount);
|
||||
hitTime = EnemyType.hitDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(){
|
||||
type.onDeath(this);
|
||||
|
||||
@@ -31,6 +31,7 @@ public class EnemyType {
|
||||
public final static int maxtier = 4;
|
||||
public final static float maxIdle = 60*1.5f;
|
||||
public final static float maxIdleLife = 60f*13f; //13 seconds idle = death
|
||||
public final static float hitDuration = 5f;
|
||||
|
||||
public final String name;
|
||||
public final byte id;
|
||||
@@ -65,6 +66,7 @@ public class EnemyType {
|
||||
String region = name + "-t" + Mathf.clamp(enemy.tier, 1, 3);
|
||||
|
||||
Shaders.outline.color.set(tierColors[enemy.tier - 1]);
|
||||
Shaders.outline.lighten = Mathf.clamp(enemy.hitTime/hitDuration);
|
||||
Shaders.outline.region = Draw.region(region);
|
||||
|
||||
Shaders.outline.apply();
|
||||
@@ -73,12 +75,16 @@ public class EnemyType {
|
||||
Draw.color();
|
||||
|
||||
Graphics.flush();
|
||||
Shaders.outline.lighten = 0f;
|
||||
}
|
||||
|
||||
public void drawOver(Enemy enemy){ }
|
||||
|
||||
public void update(Enemy enemy){
|
||||
float lastx = enemy.x, lasty = enemy.y;
|
||||
if(enemy.hitTime > 0){
|
||||
enemy.hitTime -= Timers.delta();
|
||||
}
|
||||
|
||||
move(enemy);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TitanType extends EnemyType {
|
||||
|
||||
if(Timers.getTime(enemy, "salvo") < 60){
|
||||
if(Timers.get(enemy, "salvoShoot", 6)){
|
||||
enemy.shoot(BulletType.flame, Mathf.range(20f));
|
||||
enemy.shoot(BulletType.flameshot, Mathf.range(20f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,15 @@ import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Fx{
|
||||
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
static Color lightOrange = Color.valueOf("f68021");
|
||||
static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
static Color whiteYellow = Hue.mix(Color.YELLOW, Color.WHITE, 0.6f);
|
||||
public static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
public static Color lightOrange = Color.valueOf("f68021");
|
||||
public static Color lighterOrange = Color.valueOf("f6e096");
|
||||
public static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
public static Color whiteYellow = Hue.mix(Color.YELLOW, Color.WHITE, 0.6f);
|
||||
public static Color lightGray = Color.valueOf("b0b0b0");
|
||||
public static Color glowy = Color.valueOf("fdc056");
|
||||
public static Color beam = Color.valueOf("9bffbe");
|
||||
public static Color beamLight = Color.valueOf("ddffe9");
|
||||
|
||||
public static final Effect
|
||||
|
||||
@@ -350,9 +355,8 @@ public class Fx{
|
||||
}),
|
||||
|
||||
laserShoot = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 6f, 2f, 0.8f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
@@ -361,22 +365,40 @@ public class Fx{
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 9f, 3.5f, 0.8f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
railshoot = new Effect(8, e -> {
|
||||
Draw.thickness(2f - e.ifract()*2f);
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, 1f + e.ifract() * 4f, 1, 5);
|
||||
|
||||
clusterShoot = new Effect(12, e -> {
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 10f, 2.5f, 0.7f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
mortarshoot = new Effect(9, e -> {
|
||||
Draw.thickness(1.3f - e.ifract());
|
||||
railShoot = new Effect(8, e -> {
|
||||
Draw.color(lighterOrange, lightOrange, e.ifract());
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 10f, 2f, 0.7f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
mortarShoot = new Effect(8, e -> {
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.circle(e.x, e.y, e.ifract() * 5f + 1f);
|
||||
Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 14f, 4f, 0.8f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
|
||||
beamShoot = new Effect(8, e -> {
|
||||
Draw.color(beamLight, beam, e.ifract());
|
||||
Draw.lineShot(e.x, e.y, e.rotation - 70, 3, e.fract(), 12f, 1f, 0.5f);
|
||||
Draw.lineShot(e.x, e.y, e.rotation + 70, 3, e.fract(), 12f, 1f, 0.5f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
beamhit = new Effect(8, e -> {
|
||||
Draw.color(beamLight, beam, e.ifract());
|
||||
Draw.thick(e.fract()*3f+0.5f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*8f);
|
||||
Draw.spikes(e.x, e.y, e.ifract()*6f, 2f, 4, 45);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
titanExplosion = new Effect(11, 48f, e -> {
|
||||
Draw.thickness(2f*e.fract()+0.5f);
|
||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
||||
@@ -426,6 +448,14 @@ public class Fx{
|
||||
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
clusterbomb = new Effect(10f, e -> {
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.thick(e.fract()*1.5f);
|
||||
Draw.polygon(4, e.x, e.y, e.fract()*8f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*14f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
coreexplosion = new Effect(13, e -> {
|
||||
Draw.thickness(3f-e.ifract()*2f);
|
||||
@@ -448,6 +478,13 @@ public class Fx{
|
||||
Draw.rect("circle", e.x, e.y, size, size);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
chainsmoke = new Effect(30, e -> {
|
||||
Draw.color(lightGray);
|
||||
float size = e.fract()*4f;
|
||||
Draw.rect("circle", e.x, e.y, size, size);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
dashsmoke = new Effect(30, e -> {
|
||||
Draw.color(Color.CORAL, Color.GRAY, e.ifract());
|
||||
|
||||
@@ -16,7 +16,8 @@ public class Shaders{
|
||||
|
||||
public static class Outline extends Shader{
|
||||
public Color color = new Color();
|
||||
|
||||
public float lighten = 0f;
|
||||
|
||||
public Outline(){
|
||||
super("outline", "default");
|
||||
}
|
||||
@@ -24,6 +25,7 @@ public class Shaders{
|
||||
@Override
|
||||
public void apply(){
|
||||
shader.setUniformf("u_color", color);
|
||||
shader.setUniformf("u_lighten", lighten);
|
||||
shader.setUniformf("u_texsize", Tmp.v1.set(region.getTexture().getWidth(), region.getTexture().getHeight()));
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DesktopInput extends InputHandler{
|
||||
if(Inputs.keyTap("weapon_" + i)){
|
||||
player.weaponLeft = player.weaponRight = control.getWeapons().get(i - 1);
|
||||
Vars.netClient.handleWeaponSwitch();
|
||||
ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class NetworkIO {
|
||||
Vars.control.getWeapons().clear();
|
||||
Vars.control.getWeapons().add(Weapon.blaster);
|
||||
Vars.player.weaponLeft = Vars.player.weaponRight = Weapon.blaster;
|
||||
Vars.ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
|
||||
//enemies
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Save12 extends SaveFileVersion {
|
||||
Vars.control.addWeapon((Weapon)Upgrade.getByID(stream.readByte()));
|
||||
}
|
||||
|
||||
Vars.ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
|
||||
//inventory
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Save13 extends SaveFileVersion {
|
||||
Vars.control.addWeapon((Weapon) Upgrade.getByID(stream.readByte()));
|
||||
}
|
||||
|
||||
Vars.ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
|
||||
//inventory
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Save14 extends SaveFileVersion{
|
||||
Vars.control.addWeapon((Weapon) Upgrade.getByID(stream.readByte()));
|
||||
}
|
||||
|
||||
Vars.ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
|
||||
//inventory
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import io.anuke.ucore.util.Mathf;
|
||||
public class UpgradeRecipes {
|
||||
private static final ObjectMap<Upgrade, ItemStack[]> recipes = Mathf.map(
|
||||
Weapon.triblaster, list(stack(Item.iron, 40)),
|
||||
Weapon.multigun, list(stack(Item.iron, 60), stack(Item.steel, 20)),
|
||||
Weapon.flamer, list(stack(Item.steel, 60), stack(Item.iron, 120)),
|
||||
Weapon.clustergun, list(stack(Item.iron, 60), stack(Item.steel, 20)),
|
||||
Weapon.beam, list(stack(Item.steel, 60), stack(Item.iron, 120)),
|
||||
Weapon.railgun, list(stack(Item.iron, 60), stack(Item.steel, 60)),
|
||||
Weapon.mortar, list(stack(Item.titanium, 40), stack(Item.steel, 60))
|
||||
);
|
||||
|
||||
@@ -21,36 +21,49 @@ public class Weapon extends Upgrade{
|
||||
effect = Fx.laserShoot;
|
||||
}
|
||||
},
|
||||
triblaster = new Weapon("triblaster", 18, BulletType.spread){
|
||||
triblaster = new Weapon("triblaster", 20, BulletType.spread){
|
||||
{
|
||||
shots = 3;
|
||||
effect = Fx.spreadShoot;
|
||||
roundrobin = true;
|
||||
}
|
||||
},
|
||||
multigun = new Weapon("multigun", 6, BulletType.multishot){
|
||||
clustergun = new Weapon("clustergun", 26f, BulletType.cluster){
|
||||
{
|
||||
effect = Fx.laserShoot;
|
||||
inaccuracy = 6f;
|
||||
effect = Fx.clusterShoot;
|
||||
inaccuracy = 20f;
|
||||
roundrobin = true;
|
||||
shots = 2;
|
||||
spacing = 0;
|
||||
}
|
||||
},
|
||||
flamer = new Weapon("flamer", 5, BulletType.flame){
|
||||
beam = new Weapon("beam", 30f, BulletType.beamlaser){
|
||||
{
|
||||
shootsound = "flame2";
|
||||
inaccuracy = 12f;
|
||||
effect = Fx.beamShoot;
|
||||
inaccuracy = 0;
|
||||
roundrobin = true;
|
||||
shake = 2f;
|
||||
}
|
||||
},
|
||||
railgun = new Weapon("railgun", 30, BulletType.sniper){
|
||||
railgun = new Weapon("railgun", 5, BulletType.rail){
|
||||
{
|
||||
shootsound = "railgun";
|
||||
effect = Fx.railshoot;
|
||||
effect = Fx.railShoot;
|
||||
inaccuracy = 5;
|
||||
roundrobin = true;
|
||||
shake = 1f;
|
||||
inaccuracy = 4f;
|
||||
}
|
||||
},
|
||||
mortar = new Weapon("mortar", 100, BulletType.shell){
|
||||
//TODO rename!
|
||||
mortar = new Weapon("mortar", 36, BulletType.shotgun){
|
||||
{
|
||||
shootsound = "bigshot";
|
||||
effect = Fx.mortarshoot;
|
||||
effect = Fx.mortarShoot;
|
||||
shake = 2f;
|
||||
roundrobin = true;
|
||||
shots = 7;
|
||||
inaccuracy = 15f;
|
||||
}
|
||||
};
|
||||
/**weapon reload in frames*/
|
||||
@@ -80,8 +93,8 @@ public class Weapon extends Upgrade{
|
||||
|
||||
public void update(Player p, boolean left){
|
||||
if(Timers.get(p, "reload"+left, reload)){
|
||||
if(left && roundrobin){
|
||||
Timers.reset(p, "reload" + false, reload/2f);
|
||||
if(roundrobin){
|
||||
Timers.reset(p, "reload" + !left, reload/2f);
|
||||
}
|
||||
float ang = Angles.mouseAngle(p.x, p.y);
|
||||
Angles.translation(ang + Mathf.sign(left) * -60f, 3f);
|
||||
|
||||
@@ -27,7 +27,7 @@ import static io.anuke.mindustry.Vars.control;
|
||||
import static io.anuke.mindustry.Vars.fontscale;
|
||||
|
||||
public class BlocksFragment implements Fragment{
|
||||
private Table desctable, itemtable, blocks;
|
||||
private Table desctable, itemtable, blocks, weapons;
|
||||
private Stack stack = new Stack();
|
||||
private Array<String> statlist = new Array<>();
|
||||
private boolean shown = true;
|
||||
@@ -90,7 +90,7 @@ public class BlocksFragment implements Fragment{
|
||||
}
|
||||
});
|
||||
button.setName("sectionbutton" + sec.name());
|
||||
add(button).growX().height(54).padRight(-1).padTop(sec.ordinal() <= 2 ? -10 : -5);
|
||||
add(button).growX().height(54).padLeft(-1).padTop(sec.ordinal() <= 2 ? -10 : -5);
|
||||
button.getImageCell().size(40).padBottom(4).padTop(2);
|
||||
group.add(button);
|
||||
|
||||
@@ -144,16 +144,47 @@ public class BlocksFragment implements Fragment{
|
||||
add(stack).colspan(Section.values().length);
|
||||
margin(10f);
|
||||
|
||||
marginLeft(0f);
|
||||
marginRight(0f);
|
||||
marginLeft(1f);
|
||||
marginRight(1f);
|
||||
|
||||
end();
|
||||
}}.right().bottom().uniformX();
|
||||
|
||||
row();
|
||||
|
||||
if(!Vars.android) {
|
||||
weapons = new table("button").margin(0).fillX().end().get();
|
||||
}
|
||||
|
||||
visible(() -> !GameState.is(State.menu) && shown);
|
||||
|
||||
}}.end().get();
|
||||
}}.end();
|
||||
|
||||
updateWeapons();
|
||||
}
|
||||
|
||||
public void updateWeapons(){
|
||||
if(Vars.android) return;
|
||||
|
||||
weapons.clearChildren();
|
||||
weapons.left();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
|
||||
for(int i = 0; i < Vars.control.getWeapons().size; i ++){
|
||||
Weapon weapon = Vars.control.getWeapons().get(i);
|
||||
weapons.addImageButton(weapon.name, "toggle", 8*3, () -> {
|
||||
Vars.player.weaponLeft = Vars.player.weaponRight = weapon;
|
||||
}).left().size(40f, 45f).padRight(-1).group(group);
|
||||
}
|
||||
|
||||
int idx = Vars.control.getWeapons().indexOf(Vars.player.weaponLeft, true);
|
||||
|
||||
if(idx != -1)
|
||||
group.getButtons().get(idx).setChecked(true);
|
||||
else if(group.getButtons().size > 0)
|
||||
group.getButtons().get(0).setChecked(true);
|
||||
}
|
||||
|
||||
public void toggle(boolean show, float t, Interpolation ip){
|
||||
|
||||
@@ -219,6 +219,10 @@ public class HudFragment implements Fragment{
|
||||
public void updateItems(){
|
||||
blockfrag.updateItems();
|
||||
}
|
||||
|
||||
public void updateWeapons(){
|
||||
blockfrag.updateWeapons();
|
||||
}
|
||||
|
||||
public void fadeRespawn(boolean in){
|
||||
respawntable.addAction(Actions.color(in ? new Color(0, 0, 0, 0.3f) : Color.CLEAR, 0.3f));
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
public class WeaponFragment implements Fragment{
|
||||
|
||||
@Override
|
||||
public void build(){
|
||||
|
||||
}
|
||||
|
||||
public void update(){}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class WeaponFactory extends Block implements Configurable{
|
||||
ImageButton button = content.addImageButton("white", 8*4, () -> {
|
||||
control.removeItems(requirements);
|
||||
control.addWeapon(weapon);
|
||||
Vars.ui.weaponfrag.update();
|
||||
Vars.ui.hudfrag.updateWeapons();
|
||||
run.listen();
|
||||
Effects.sound("purchase");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user