Unlockable cleanup / Added javelin ship / Mobile fixes
This commit is contained in:
@@ -27,7 +27,7 @@ import io.anuke.ucore.util.OS;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Vars{
|
||||
public static final boolean testMobile = false;
|
||||
public static final boolean testMobile = true;
|
||||
//shorthand for whether or not this is running on android or ios
|
||||
public static boolean mobile;
|
||||
public static boolean ios;
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.content;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.bullets.*;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.content.fx.ShootFx;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
@@ -10,7 +11,7 @@ import io.anuke.mindustry.type.ContentList;
|
||||
|
||||
public class AmmoTypes implements ContentList {
|
||||
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletPyratite,
|
||||
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite,
|
||||
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile,
|
||||
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
|
||||
artilleryCarbide, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
|
||||
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
|
||||
@@ -50,6 +51,12 @@ public class AmmoTypes implements ContentList {
|
||||
shootEffect = ShootFx.shootSmallFlame;
|
||||
}};
|
||||
|
||||
weaponMissile = new AmmoType(Items.carbide, MissileBullets.javelin, 2) {{
|
||||
shootEffect = BulletFx.hitBulletSmall;
|
||||
smokeEffect = Fx.none;
|
||||
reloadMultiplier = 1.2f;
|
||||
}};
|
||||
|
||||
//bullets
|
||||
|
||||
bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 5) {{
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.type.Mech;
|
||||
import io.anuke.mindustry.type.Upgrade;
|
||||
|
||||
public class Mechs implements ContentList {
|
||||
public static Mech alpha, delta, tau, omega, dart, trident, javelin, halberd;
|
||||
public static Mech alpha, delta, tau, omega, dart, javelin, trident, halberd;
|
||||
|
||||
/**These are not new mechs, just re-assignments for convenience.*/
|
||||
public static Mech starterDesktop, starterMobile;
|
||||
@@ -57,16 +57,18 @@ public class Mechs implements ContentList {
|
||||
trailColor = Palette.lightTrail;
|
||||
}};
|
||||
|
||||
trident = new Mech("trident-ship", true){{
|
||||
drillPower = 1;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 3f;
|
||||
drag = 0.1f;
|
||||
}};
|
||||
|
||||
javelin = new Mech("javelin-ship", true){{
|
||||
drillPower = -1;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 3.6f;
|
||||
drag = 0.09f;
|
||||
weapon = Weapons.missiles;
|
||||
trailColor = Color.valueOf("d3ddff");
|
||||
}};
|
||||
|
||||
trident = new Mech("trident-ship", true){{
|
||||
drillPower = 1;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 3f;
|
||||
drag = 0.1f;
|
||||
}};
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Recipes implements ContentList{
|
||||
new Recipe(units, UpgradeBlocks.dartFactory, new ItemStack(Items.lead, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240))
|
||||
.setDesktop(); //dart is desktop only, because it's the starter mobile ship
|
||||
|
||||
new Recipe(units, UpgradeBlocks.tridentFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
|
||||
new Recipe(units, UpgradeBlocks.javelinFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
|
||||
|
||||
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.carbide, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250))
|
||||
.setDesktop();
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.type.Upgrade;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
|
||||
public class Weapons implements ContentList {
|
||||
public static Weapon blaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower;
|
||||
public static Weapon blaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower, missiles;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
@@ -22,6 +22,17 @@ public class Weapons implements ContentList {
|
||||
setAmmo(AmmoTypes.bulletLead);
|
||||
}};
|
||||
|
||||
missiles = new Weapon("missiles") {{
|
||||
length = 1.5f;
|
||||
reload = 40f;
|
||||
shots = 2;
|
||||
inaccuracy = 10f;
|
||||
roundrobin = false;
|
||||
roundrobin = true;
|
||||
ejectEffect = Fx.none;
|
||||
setAmmo(AmmoTypes.weaponMissile);
|
||||
}};
|
||||
|
||||
chainBlaster = new Weapon("chain-blaster") {{
|
||||
length = 1.5f;
|
||||
reload = 20f;
|
||||
|
||||
@@ -5,13 +5,13 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.units.MechFactory;
|
||||
|
||||
public class UpgradeBlocks extends BlockList {
|
||||
public static Block deltaFactory, tauFactory, omegaFactory, dartFactory, tridentFactory, javelinFactory, halberdFactory;
|
||||
public static Block deltaFactory, tauFactory, omegaFactory, dartFactory, javelinFactory, tridentFactory, halberdFactory;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
deltaFactory = new MechFactory("delta-mech-factory"){{
|
||||
mech = Mechs.delta;
|
||||
size = 2;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
tauFactory = new MechFactory("tau-mech-factory"){{
|
||||
@@ -29,13 +29,13 @@ public class UpgradeBlocks extends BlockList {
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
tridentFactory = new MechFactory("trident-ship-factory"){{
|
||||
mech = Mechs.trident;
|
||||
javelinFactory = new MechFactory("javelin-ship-factory"){{
|
||||
mech = Mechs.javelin;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
javelinFactory = new MechFactory("javelin-ship-factory"){{
|
||||
mech = Mechs.javelin;
|
||||
tridentFactory = new MechFactory("trident-ship-factory"){{
|
||||
mech = Mechs.trident;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.type.ContentList;
|
||||
|
||||
public class MissileBullets extends BulletList implements ContentList {
|
||||
public static BulletType explosive, incindiary, surge;
|
||||
public static BulletType explosive, incindiary, surge, javelin;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
@@ -50,5 +50,20 @@ public class MissileBullets extends BulletList implements ContentList {
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
};
|
||||
|
||||
javelin = new MissileBulletType(2.5f, 10, "missile") {
|
||||
{
|
||||
bulletWidth = 8f;
|
||||
bulletHeight = 8f;
|
||||
bulletShrink = 0f;
|
||||
drag = -0.02f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 15f;
|
||||
lifetime = 90f;
|
||||
hiteffect = BulletFx.blastExplosion;
|
||||
despawneffect = BulletFx.blastExplosion;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,12 @@ public class Control extends Module{
|
||||
state.set(State.playing);
|
||||
});
|
||||
|
||||
Events.on(WorldLoadGraphicsEvent.class, () -> {
|
||||
if(mobile){
|
||||
Core.camera.position.set(players[0].x, players[0].y, 0);
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(ResetEvent.class, () -> {
|
||||
for(Player player : players){
|
||||
player.reset();
|
||||
|
||||
@@ -227,15 +227,13 @@ public class Renderer extends RendererModule{
|
||||
blocks.skipLayer(Layer.turret);
|
||||
blocks.drawBlocks(Layer.laser);
|
||||
|
||||
overlays.drawBottom();
|
||||
|
||||
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
||||
|
||||
drawAllTeams(true);
|
||||
|
||||
drawAndInterpolate(bulletGroup);
|
||||
drawAndInterpolate(effectGroup);
|
||||
|
||||
overlays.drawBottom();
|
||||
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
||||
overlays.drawTop();
|
||||
|
||||
if(pixelate)
|
||||
|
||||
@@ -23,12 +23,16 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity;
|
||||
import io.anuke.mindustry.world.blocks.units.MechFactory;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.*;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.ThreadQueue;
|
||||
import io.anuke.ucore.util.Timer;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -59,7 +63,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public boolean isLocal = false;
|
||||
public Timer timer = new Timer(4);
|
||||
public TargetTrait target;
|
||||
public CarriableTrait pickupTarget;
|
||||
public TargetTrait moveTarget;
|
||||
|
||||
private boolean respawning;
|
||||
private float walktime;
|
||||
@@ -551,18 +555,23 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
float targetX = Core.camera.position.x, targetY = Core.camera.position.y;
|
||||
float attractDst = 15f;
|
||||
|
||||
if(pickupTarget != null && !pickupTarget.isDead()){
|
||||
targetX = pickupTarget.getX();
|
||||
targetY = pickupTarget.getY();
|
||||
if(moveTarget != null && !moveTarget.isDead()){
|
||||
targetX = moveTarget.getX();
|
||||
targetY = moveTarget.getY();
|
||||
attractDst = 0f;
|
||||
|
||||
if(distanceTo(pickupTarget) < 2f){
|
||||
carry(pickupTarget);
|
||||
if(distanceTo(moveTarget) < 2f){
|
||||
if(moveTarget instanceof CarriableTrait){
|
||||
carry((CarriableTrait) moveTarget);
|
||||
}else if(moveTarget instanceof TileEntity && ((TileEntity) moveTarget).tile.block() instanceof MechFactory){
|
||||
Tile tile = ((TileEntity) moveTarget).tile;
|
||||
tile.block().tapped(tile, this);
|
||||
}
|
||||
|
||||
pickupTarget = null;
|
||||
moveTarget = null;
|
||||
}
|
||||
}else{
|
||||
pickupTarget = null;
|
||||
moveTarget = null;
|
||||
}
|
||||
|
||||
movement.set(targetX - x, targetY - y).limit(mech.speed);
|
||||
|
||||
@@ -542,7 +542,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
||||
Unit unit = Units.getClosest(player.getTeam(), Graphics.world(x, y).x, Graphics.world(x, y).y, 4f, u -> !u.isFlying() && u.getMass() <= player.mech.carryWeight);
|
||||
|
||||
if(unit != null){
|
||||
player.pickupTarget = unit;
|
||||
player.moveTarget = unit;
|
||||
Effects.effect(Fx.select, unit.getX(), unit.getY());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,9 @@ public abstract class InputHandler extends InputAdapter{
|
||||
}
|
||||
|
||||
//call tapped event
|
||||
CallBlocks.onTileTapped(player, tile);
|
||||
if(tile.getTeam() == player.getTeam()){
|
||||
CallBlocks.onTileTapped(player, tile);
|
||||
}
|
||||
|
||||
//consume tap event if necessary
|
||||
if(tile.getTeam() == player.getTeam() && tile.block().consumesTap){
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Liquid implements UnlockableContent{
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
iconRegion = Draw.region("icon-liquid-" + name);
|
||||
iconRegion = Draw.region("liquid-icon-" + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.mobile;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class MechFactory extends Block{
|
||||
@@ -52,6 +53,8 @@ public class MechFactory extends Block{
|
||||
|
||||
if(checkValidTap(tile, player)){
|
||||
CallBlocks.onMechFactoryBegin(player, tile);
|
||||
}else if(player.isLocal && mobile){
|
||||
player.moveTarget = tile.entity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class LiquidFilterValue implements StatValue {
|
||||
|
||||
for (int i = 0; i < list.size; i++) {
|
||||
Liquid item = list.get(i);
|
||||
table.addImage("liquid-icon").color(item.color).size(8*3).padRight(2).padLeft(2).padTop(2).padBottom(2);
|
||||
table.addImage(item.getContentIcon()).size(8*3).padRight(2).padLeft(2).padTop(2).padBottom(2);
|
||||
if(i != list.size - 1){
|
||||
table.add("/");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public class LiquidValue implements ContentStatValue {
|
||||
|
||||
@Override
|
||||
public void display(Table table) {
|
||||
table.addImage("liquid-icon").color(liquid.color).size(8*3);
|
||||
table.addImage(liquid.getContentIcon()).size(8*3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user