Omega mech implementation
This commit is contained in:
@@ -11,7 +11,7 @@ import io.anuke.mindustry.type.ContentList;
|
||||
|
||||
public class AmmoTypes implements ContentList{
|
||||
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
|
||||
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, bulletMech,
|
||||
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
|
||||
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
|
||||
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
|
||||
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
|
||||
@@ -64,6 +64,12 @@ public class AmmoTypes implements ContentList{
|
||||
reloadMultiplier = 1.2f;
|
||||
}};
|
||||
|
||||
weaponMissileSwarm = new AmmoType(MissileBullets.swarm){{
|
||||
shootEffect = BulletFx.hitBulletSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
reloadMultiplier = 1.2f;
|
||||
}};
|
||||
|
||||
//bullets
|
||||
|
||||
bulletCopper = new AmmoType(Items.copper, StandardBullets.copper, 5){{
|
||||
|
||||
@@ -11,9 +11,7 @@ import io.anuke.mindustry.type.Upgrade;
|
||||
public class Mechs implements ContentList{
|
||||
public static Mech alpha, delta, tau, omega, dart, javelin, trident, halberd;
|
||||
|
||||
/**
|
||||
* These are not new mechs, just re-assignments for convenience.
|
||||
*/
|
||||
/**These are not new mechs, just re-assignments for convenience.*/
|
||||
public static Mech starterDesktop, starterMobile;
|
||||
|
||||
@Override
|
||||
@@ -25,7 +23,6 @@ public class Mechs implements ContentList{
|
||||
speed = 0.5f;
|
||||
boostSpeed = 0.85f;
|
||||
weapon = Weapons.blaster;
|
||||
trailColor = Palette.lightTrail;
|
||||
maxSpeed = 4f;
|
||||
}};
|
||||
|
||||
@@ -36,23 +33,37 @@ public class Mechs implements ContentList{
|
||||
itemCapacity = 15;
|
||||
armor = 30f;
|
||||
weaponOffsetX = -1;
|
||||
itemCapacity = 15;
|
||||
weaponOffsetY = -1;
|
||||
weapon = Weapons.shockgun;
|
||||
ammoCapacity = 50;
|
||||
trailColor = Color.valueOf("d3ddff");
|
||||
trailColorTo = Color.valueOf("d3ddff");
|
||||
maxSpeed = 5f;
|
||||
}};
|
||||
|
||||
tau = new Mech("tau-mech", false){{
|
||||
drillPower = 2;
|
||||
speed = 0.5f;
|
||||
drillPower = 3;
|
||||
mineSpeed = 3f;
|
||||
itemCapacity = 70;
|
||||
speed = 0.44f;
|
||||
drag = 0.35f;
|
||||
boostSpeed = 0.8f;
|
||||
weapon = Weapons.blaster;
|
||||
maxSpeed = 5f;
|
||||
armor = 30f;
|
||||
}};
|
||||
|
||||
omega = new Mech("omega-mech", false){{
|
||||
drillPower = 1;
|
||||
speed = 0.4f;
|
||||
maxSpeed = 3f;
|
||||
drillPower = 2;
|
||||
mineSpeed = 1.5f;
|
||||
itemCapacity = 50;
|
||||
speed = 0.36f;
|
||||
boostSpeed = 0.6f;
|
||||
shake = 4f;
|
||||
weaponOffsetX = 1;
|
||||
weaponOffsetY = 0;
|
||||
weapon = Weapons.swarmer;
|
||||
maxSpeed = 3.5f;
|
||||
armor = 70f;
|
||||
}};
|
||||
|
||||
dart = new Mech("dart-ship", true){{
|
||||
|
||||
@@ -128,6 +128,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.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.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.omegaFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
|
||||
|
||||
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
|
||||
|
||||
|
||||
@@ -33,6 +33,19 @@ public class Weapons implements ContentList{
|
||||
ammo = AmmoTypes.weaponMissile;
|
||||
}};
|
||||
|
||||
swarmer = new Weapon("swarmer"){{
|
||||
length = 1.5f;
|
||||
recoil = 4f;
|
||||
reload = 60f;
|
||||
shots = 4;
|
||||
inaccuracy = 8f;
|
||||
roundrobin = false;
|
||||
roundrobin = true;
|
||||
ejectEffect = Fx.none;
|
||||
shake = 3f;
|
||||
ammo = AmmoTypes.weaponMissileSwarm;
|
||||
}};
|
||||
|
||||
chainBlaster = new Weapon("chain-blaster"){{
|
||||
length = 1.5f;
|
||||
reload = 28f;
|
||||
@@ -82,14 +95,6 @@ public class Weapons implements ContentList{
|
||||
ammo = AmmoTypes.bulletDense;
|
||||
}};
|
||||
|
||||
swarmer = new Weapon("swarmer"){{
|
||||
length = 1.5f;
|
||||
reload = 10f;
|
||||
roundrobin = true;
|
||||
ejectEffect = ShootFx.shellEjectSmall;
|
||||
ammo = AmmoTypes.bulletPyratite;
|
||||
}};
|
||||
|
||||
bomber = new Weapon("bomber"){{
|
||||
length = 0f;
|
||||
width = 2f;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.entities.bullet.MissileBulletType;
|
||||
@@ -7,7 +8,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, javelin;
|
||||
public static BulletType explosive, incindiary, surge, javelin, swarm;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -65,5 +66,23 @@ public class MissileBullets extends BulletList implements ContentList{
|
||||
despawneffect = BulletFx.blastExplosion;
|
||||
}
|
||||
};
|
||||
|
||||
swarm = new MissileBulletType(2.7f, 10, "missile"){
|
||||
{
|
||||
bulletWidth = 8f;
|
||||
bulletHeight = 8f;
|
||||
bulletShrink = 0f;
|
||||
drag = -0.003f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 15f;
|
||||
lifetime = 120f;
|
||||
trailColor = Color.GRAY;
|
||||
backColor = Palette.bulletYellowBack;
|
||||
frontColor = Palette.bulletYellow;
|
||||
hiteffect = BulletFx.blastExplosion;
|
||||
despawneffect = BulletFx.blastExplosion;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
});
|
||||
|
||||
missileTrail = new Effect(50, e -> {
|
||||
Draw.color(Palette.missileYellowBack);
|
||||
Draw.color(e.color);
|
||||
Fill.circle(e.x, e.y, e.rotation * e.fout());
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
@@ -50,12 +50,12 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
private static final float liftoffBoost = 0.2f;
|
||||
|
||||
//region instance variables, constructor
|
||||
public float baseRotation;
|
||||
|
||||
public float baseRotation;
|
||||
public float pointerX, pointerY;
|
||||
public String name = "name";
|
||||
public String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isAlt, isMobile;
|
||||
public float boostHeat;
|
||||
public boolean achievedFlight;
|
||||
public Color color = new Color();
|
||||
@@ -300,7 +300,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.rect(mech.legRegion,
|
||||
x + Angles.trnsx(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
y + Angles.trnsy(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90 + boostAng * i);
|
||||
mech.legRegion.getRegionWidth() * i, mech.legRegion.getRegionHeight() - Mathf.clamp(ft * i, 0, 2), baseRotation - 90 + boostAng * i);
|
||||
}
|
||||
|
||||
Draw.rect(mech.baseRegion, x, y, baseRotation - 90);
|
||||
@@ -316,10 +316,10 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
for(int i : Mathf.signs){
|
||||
float tra = rotation - 90, trY = -mech.weapon.getRecoil(this, i > 0) + mech.weaponOffsetY;
|
||||
float w = i > 0 ? -12 : 12;
|
||||
float w = i > 0 ? -mech.weapon.equipRegion.getRegionWidth() : mech.weapon.equipRegion.getRegionWidth();
|
||||
Draw.rect(mech.weapon.equipRegion,
|
||||
x + Angles.trnsx(tra, mech.weaponOffsetX * i, trY),
|
||||
y + Angles.trnsy(tra, mech.weaponOffsetX * i, trY), w, 12, rotation - 90);
|
||||
y + Angles.trnsy(tra, mech.weaponOffsetX * i, trY), w, mech.weapon.equipRegion.getRegionHeight(), rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
@@ -496,11 +496,17 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}
|
||||
|
||||
if(boostHeat <= liftoffBoost + 0.05f && achievedFlight){
|
||||
if(tile != null) Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
|
||||
if(tile != null){
|
||||
if(mech.shake > 1f){
|
||||
Effects.shake(mech.shake, mech.shake, this);
|
||||
}
|
||||
Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
|
||||
}
|
||||
achievedFlight = false;
|
||||
}
|
||||
|
||||
isBoosting = Inputs.keyDown("dash") && !mech.flying;
|
||||
isAlt = Inputs.keyDown("ability") && !mech.flying;
|
||||
|
||||
//if player is in solid block
|
||||
if(tile != null && tile.solid()){
|
||||
|
||||
@@ -3,8 +3,8 @@ package io.anuke.mindustry.entities.bullet;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.entities.Damage;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@@ -70,7 +70,7 @@ public class BasicBulletType extends BulletType{
|
||||
super.update(b);
|
||||
|
||||
if(homingPower > 0.0001f){
|
||||
Unit target = Units.getClosestEnemy(b.getTeam(), b.x, b.y, homingRange, unit -> true);
|
||||
TargetTrait target = Units.getClosestTarget(b.getTeam(), b.x, b.y, homingRange);
|
||||
if(target != null){
|
||||
b.getVelocity().setAngle(Angles.moveToward(b.getVelocity().angle(), b.angleTo(target), homingPower * Timers.delta()));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package io.anuke.mindustry.entities.bullet;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class MissileBulletType extends BasicBulletType{
|
||||
protected Color trailColor = Palette.missileYellowBack;
|
||||
|
||||
public MissileBulletType(float speed, float damage, String bulletSprite){
|
||||
super(speed, damage, bulletSprite);
|
||||
@@ -17,8 +21,8 @@ public class MissileBulletType extends BasicBulletType{
|
||||
public void update(Bullet b){
|
||||
super.update(b);
|
||||
|
||||
if(b.timer.get(0, 4f)){
|
||||
Effects.effect(BulletFx.missileTrail, b.x, b.y, 2f);
|
||||
if(Mathf.chance(Timers.delta() * 0.2)){
|
||||
Effects.effect(BulletFx.missileTrail, trailColor, b.x, b.y, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public class DefaultKeybinds{
|
||||
//"shoot", Input.MOUSE_LEFT,
|
||||
"rotate", new Axis(Input.SCROLL),
|
||||
"dash", Input.SHIFT_LEFT,
|
||||
"ability", Input.SPACE,
|
||||
"drop_unit", Input.SHIFT_LEFT,
|
||||
new Category("view"),
|
||||
"zoom_hold", Input.CONTROL_LEFT,
|
||||
|
||||
@@ -18,6 +18,7 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
public float boostSpeed = 0.75f;
|
||||
public float drag = 0.4f;
|
||||
public float mass = 1f;
|
||||
public float shake = 0f;
|
||||
public float armor = 1f;
|
||||
|
||||
public float mineSpeed = 1f;
|
||||
@@ -26,14 +27,12 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
public float buildPower = 1f;
|
||||
public Color trailColor = Palette.boostFrom;
|
||||
public Color trailColorTo = Palette.boostTo;
|
||||
public int itemCapacity = 30;
|
||||
|
||||
public float weaponOffsetX, weaponOffsetY;
|
||||
|
||||
public Weapon weapon = Weapons.blaster;
|
||||
|
||||
public int itemCapacity = 30;
|
||||
public int ammoCapacity = 100;
|
||||
|
||||
public TextureRegion baseRegion, legRegion, region, iconRegion;
|
||||
|
||||
public Mech(String name, boolean flying){
|
||||
|
||||
@@ -257,7 +257,7 @@ public class Tile implements PosTrait, TargetTrait{
|
||||
if(link == 0){
|
||||
return (block.destructible || block.breakable || block.update);
|
||||
}else{
|
||||
return getLinked().breakable();
|
||||
return getLinked() != this && getLinked().breakable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user