Mech palette change, delta mech implementation

This commit is contained in:
Anuken
2018-06-26 16:01:40 -04:00
parent a6ca84308e
commit 20b3bb8f13
34 changed files with 674 additions and 660 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -9,6 +9,7 @@ import io.anuke.mindustry.type.ContentList;
public class AmmoTypes implements ContentList { public class AmmoTypes implements ContentList {
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletThermite, public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletThermite,
shotgunTungsten,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge, flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
artilleryCarbide, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryCarbide, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid; basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@@ -54,6 +55,14 @@ public class AmmoTypes implements ContentList {
inaccuracy = 3f; inaccuracy = 3f;
}}; }};
//shotgun (delta mech)
shotgunTungsten = new AmmoType(Items.tungsten, WeaponBullets.tungstenShotgun, 2) {{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
recoil = 1f;
}};
//flak //flak
flakLead = new AmmoType(Items.lead, FlakBullets.lead, 5) {{ flakLead = new AmmoType(Items.lead, FlakBullets.lead, 5) {{

View File

@@ -1,7 +1,9 @@
package io.anuke.mindustry.content; package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.game.Content; import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.type.Upgrade;
@@ -18,11 +20,21 @@ public class Mechs implements ContentList {
alpha = new Mech("alpha-mech", false){{ alpha = new Mech("alpha-mech", false){{
drillPower = 1; drillPower = 1;
speed = 0.5f; speed = 0.5f;
weapon = Weapons.blaster;
trailColor = Palette.lightTrail;
}}; }};
delta = new Mech("delta-mech", false){{ delta = new Mech("delta-mech", false){{
drillPower = -1; drillPower = -1;
speed = 0.6f; speed = 0.63f;
boostSpeed = 0.86f;
itemCapacity = 15;
armor = 30f;
weaponOffsetX = -1;
weaponOffsetY = -1;
weapon = Weapons.shockgun;
ammoCapacity = 50;
trailColor = Color.valueOf("d3ddff");
}}; }};
tau = new Mech("tau-mech", false){{ tau = new Mech("tau-mech", false){{
@@ -42,6 +54,7 @@ public class Mechs implements ContentList {
drag = 0.1f; drag = 0.1f;
weaponOffsetX = -1; weaponOffsetX = -1;
weaponOffsetY = -1; weaponOffsetY = -1;
trailColor = Palette.lightTrail;
}}; }};
trident = new Mech("trident-ship", true){{ trident = new Mech("trident-ship", true){{

View File

@@ -59,7 +59,7 @@ public class Recipes implements ContentList{
new Recipe(crafting, CraftingBlocks.siliconsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50)); new Recipe(crafting, CraftingBlocks.siliconsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
//other crafting //other crafting
new Recipe(crafting, CraftingBlocks.phaseweaver, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 150)); new Recipe(crafting, CraftingBlocks.phaseweaver, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 240), new ItemStack(Items.thorium, 150));
//TODO implement alloy smelter //TODO implement alloy smelter
// new Recipe(crafting, CraftingBlocks.alloySmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140)); // new Recipe(crafting, CraftingBlocks.alloySmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140));
@@ -69,6 +69,7 @@ public class Recipes implements ContentList{
new Recipe(crafting, CraftingBlocks.pulverizer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50)); new Recipe(crafting, CraftingBlocks.pulverizer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.thermiteMixer, new ItemStack(Items.tungsten, 100), new ItemStack(Items.lead, 50)); new Recipe(crafting, CraftingBlocks.thermiteMixer, new ItemStack(Items.tungsten, 100), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.blastMixer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 60), new ItemStack(Items.carbide, 40)); new Recipe(crafting, CraftingBlocks.blastMixer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 60), new ItemStack(Items.carbide, 40));
new Recipe(crafting, CraftingBlocks.cryofluidmixer, new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 80), new ItemStack(Items.titanium, 90));
//processing //processing
new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60)); new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
@@ -107,6 +108,8 @@ 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)) 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 .setDesktop(); //dart is desktop only, because it's the starter mobile ship
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.carbide, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30)); //new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
//actual unit related stuff //actual unit related stuff

View File

@@ -8,7 +8,7 @@ import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList { public class Weapons implements ContentList {
public static Weapon blaster, blaster2, blaster3, blaster4; public static Weapon blaster, shockgun, sapper, swarmer;
@Override @Override
public void load() { public void load() {
@@ -21,15 +21,19 @@ public class Weapons implements ContentList {
setAmmo(AmmoTypes.bulletLead); setAmmo(AmmoTypes.bulletLead);
}}; }};
blaster2 = new Weapon("clustergun") {{ shockgun = new Weapon("shockgun") {{
length = 1.5f; length = 1f;
reload = 13f; reload = 50f;
roundrobin = true; roundrobin = true;
shots = 6;
inaccuracy = 15f;
recoil = 2f;
velocityRnd = 0.7f;
ejectEffect = ShootFx.shellEjectSmall; ejectEffect = ShootFx.shellEjectSmall;
setAmmo(AmmoTypes.bulletLead); setAmmo(AmmoTypes.shotgunTungsten);
}}; }};
blaster3 = new Weapon("shockgun") {{ sapper = new Weapon("sapper") {{
length = 1.5f; length = 1.5f;
reload = 12f; reload = 12f;
roundrobin = true; roundrobin = true;
@@ -37,7 +41,7 @@ public class Weapons implements ContentList {
setAmmo(AmmoTypes.bulletCarbide); setAmmo(AmmoTypes.bulletCarbide);
}}; }};
blaster4 = new Weapon("vulcan") {{ swarmer = new Weapon("swarmer") {{
length = 1.5f; length = 1.5f;
reload = 10f; reload = 10f;
roundrobin = true; roundrobin = true;

View File

@@ -0,0 +1,21 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BulletType;
public class WeaponBullets extends BulletList {
public static BulletType tungstenShotgun;
@Override
public void load() {
tungstenShotgun = new BasicBulletType(5f, 8, "bullet") {
{
bulletWidth = 8f;
bulletHeight = 9f;
bulletShrink = 0.6f;
lifetime = 30f;
drag = 0.04f;
}
};
}
}

View File

@@ -58,6 +58,7 @@ public class ContentLoader {
new MissileBullets(), new MissileBullets(),
new StandardBullets(), new StandardBullets(),
new TurretBullets(), new TurretBullets(),
new WeaponBullets(),
//ammotypes //ammotypes
new AmmoTypes(), new AmmoTypes(),

View File

@@ -317,7 +317,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
Draw.rect(mech.region, x, y, rotation -90); Draw.rect(mech.region, x, y, rotation -90);
for (int i : Mathf.signs) { for (int i : Mathf.signs) {
float tra = rotation - 90, trY = - mech.weapon.getRecoil(this, i > 0)*1.5f + mech.weaponOffsetY; float tra = rotation - 90, trY = - mech.weapon.getRecoil(this, i > 0) + mech.weaponOffsetY;
float w = i > 0 ? -12 : 12; float w = i > 0 ? -12 : 12;
Draw.rect(mech.weapon.equipRegion, Draw.rect(mech.weapon.equipRegion,
x + Angles.trnsx(tra, mech.weaponOffsetX * i, trY), x + Angles.trnsx(tra, mech.weaponOffsetX * i, trY),
@@ -357,7 +357,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
float wobblyness = 0.6f; float wobblyness = 0.6f;
trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness), trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness),
y + Angles.trnsy(rotation + 180f, 5f) + Mathf.range(wobblyness)); y + Angles.trnsy(rotation + 180f, 5f) + Mathf.range(wobblyness));
trail.draw(Palette.lighterOrange, Palette.lightishOrange, 5f * (isFlying() ? 1f : boostHeat)); trail.draw(mech.trailColor, mech.trailColor, 5f * (isFlying() ? 1f : boostHeat));
}else{ }else{
trail.clear(); trail.clear();
} }
@@ -676,6 +676,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
stream.writeBoolean(isLocal); stream.writeBoolean(isLocal);
if(isLocal){ if(isLocal){
stream.writeByte(mech.id);
stream.writeByte(playerIndex); stream.writeByte(playerIndex);
super.writeSave(stream, false); super.writeSave(stream, false);
} }
@@ -686,8 +687,10 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
boolean local = stream.readBoolean(); boolean local = stream.readBoolean();
if(local){ if(local){
byte mechid = stream.readByte();
int index = stream.readByte(); int index = stream.readByte();
players[index].readSaveSuper(stream); players[index].readSaveSuper(stream);
players[index].mech = Upgrade.getByID(mechid);
players[index].dead = false; players[index].dead = false;
} }
} }

View File

@@ -88,7 +88,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
@Override @Override
public void drawOver() { public void drawOver() {
trail.draw(Palette.lightFlame, Palette.lightOrange, 5f); trail.draw(Palette.lightTrail, Palette.lightTrail, 5f);
} }
@Override @Override

View File

@@ -162,7 +162,7 @@ public class Drone extends FlyingUnit implements BuilderTrait {
@Override @Override
public void drawOver() { public void drawOver() {
trail.draw(Palette.lighterOrange, Palette.lightishOrange, 3f); trail.draw(Palette.lightTrail, Palette.lightTrail, 3f);
if(target instanceof TileEntity && state.is(repair)){ if(target instanceof TileEntity && state.is(repair)){
float len = 5f; float len = 5f;

View File

@@ -51,6 +51,8 @@ public class Palette {
public static final Color power = Color.valueOf("fbd367"); public static final Color power = Color.valueOf("fbd367");
public static final Color placing = Color.valueOf("616161"); public static final Color placing = Color.valueOf("616161");
public static final Color lightTrail = Color.valueOf("ffe2a9");
public static final Color redSpark = Color.valueOf("fbb97f"); public static final Color redSpark = Color.valueOf("fbb97f");
public static final Color orangeSpark = Color.valueOf("d2b29c"); public static final Color orangeSpark = Color.valueOf("d2b29c");

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.type; package io.anuke.mindustry.type;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.content.Weapons; import io.anuke.mindustry.content.Weapons;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
@@ -19,6 +20,7 @@ public class Mech extends Upgrade {
public float carryWeight = 10f; public float carryWeight = 10f;
public float buildPower = 1f; public float buildPower = 1f;
public boolean canRepair = false; public boolean canRepair = false;
public Color trailColor = Color.valueOf("ffd37f");
public float weaponOffsetX, weaponOffsetY; public float weaponOffsetX, weaponOffsetY;

View File

@@ -36,8 +36,12 @@ public class Weapon extends Upgrade {
protected float inaccuracy = 0f; protected float inaccuracy = 0f;
/**intensity and duration of each shot's screen shake*/ /**intensity and duration of each shot's screen shake*/
protected float shake = 0f; protected float shake = 0f;
/**visual weapon knockback.*/
protected float recoil = 1.5f;
/**shoot barrel length*/ /**shoot barrel length*/
protected float length = 3f; protected float length = 3f;
/**fraction of velocity that is random*/
protected float velocityRnd = 0f;
/**whether to shoot the weapons in different arms one after another, rather than all at once*/ /**whether to shoot the weapons in different arms one after another, rather than all at once*/
protected boolean roundrobin = false; protected boolean roundrobin = false;
/**translator for vector calulations*/ /**translator for vector calulations*/
@@ -76,7 +80,7 @@ public class Weapon extends Upgrade {
} }
public float getRecoil(Player player, boolean left){ public float getRecoil(Player player, boolean left){
return 1f-Mathf.clamp(player.timer.getTime(left ? Player.timerShootLeft : Player.timerShootRight)/reload); return (1f-Mathf.clamp(player.timer.getTime(left ? Player.timerShootLeft : Player.timerShootRight)/reload))*recoil;
} }
public float getReload(){ public float getReload(){
@@ -106,7 +110,7 @@ public class Weapon extends Upgrade {
void bullet(Unit owner, float x, float y, float angle){ void bullet(Unit owner, float x, float y, float angle){
tr.trns(angle, 3f); tr.trns(angle, 3f);
Bullet.create(owner.inventory.getAmmo().bullet, owner, x + tr.x, y + tr.y, angle); Bullet.create(owner.inventory.getAmmo().bullet, owner, owner.getTeam(), x + tr.x, y + tr.y, angle, (1f-velocityRnd) + Mathf.random(velocityRnd));
} }
@Remote(targets = Loc.server, called = Loc.both, in = In.entities, unreliable = true) @Remote(targets = Loc.server, called = Loc.both, in = In.entities, unreliable = true)

View File

@@ -163,6 +163,7 @@ public class MechFactory extends Block{
entity.player.heal(); entity.player.heal();
entity.open = true; entity.open = true;
entity.player.setDead(false); entity.player.setDead(false);
entity.player.inventory.clear();
entity.player = null; entity.player = null;
} }

View File

@@ -55,8 +55,8 @@ public class Generators {
image.draw(mech.region); image.draw(mech.region);
} }
image.draw(mech.weapon.equipRegion, false, false); image.draw(mech.weapon.equipRegion, -(int)mech.weaponOffsetX, (int)mech.weaponOffsetY, false, false);
image.draw(mech.weapon.equipRegion, true, false); image.draw(mech.weapon.equipRegion, (int)mech.weaponOffsetX, (int)mech.weaponOffsetY, true, false);
image.save("mech-icon-" + mech.name); image.save("mech-icon-" + mech.name);