Removed mech ability key

This commit is contained in:
Anuken
2018-09-30 19:22:19 -04:00
parent fc8d9febf6
commit d5d90bde9a
10 changed files with 52 additions and 89 deletions

View File

@@ -394,7 +394,6 @@ keybind.zoom.name=Zoom
keybind.menu.name=Menu keybind.menu.name=Menu
keybind.pause.name=Pause keybind.pause.name=Pause
keybind.dash.name=Dash keybind.dash.name=Dash
keybind.ability.name=Ability
keybind.chat.name=Chat keybind.chat.name=Chat
keybind.player_list.name=Player list keybind.player_list.name=Player list
keybind.console.name=Console keybind.console.name=Console

View File

@@ -6,19 +6,17 @@ import com.badlogic.gdx.math.Rectangle;
import io.anuke.mindustry.content.fx.BulletFx; import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.fx.UnitFx; import io.anuke.mindustry.content.fx.UnitFx;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Lightning; import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.types.AlphaDrone; import io.anuke.mindustry.entities.units.types.AlphaDrone;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.maps.TutorialSector;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Graphics;
@@ -26,7 +24,7 @@ import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.unitGroups;
public class Mechs implements ContentList{ public class Mechs implements ContentList{
public static Mech alpha, delta, tau, omega, dart, javelin, trident, glaive; public static Mech alpha, delta, tau, omega, dart, javelin, trident, glaive;
@@ -39,6 +37,8 @@ public class Mechs implements ContentList{
alpha = new Mech("alpha-mech", false){ alpha = new Mech("alpha-mech", false){
int maxDrones = 3; int maxDrones = 3;
float buildTime = 100f;
{ {
drillPower = 1; drillPower = 1;
mineSpeed = 1.5f; mineSpeed = 1.5f;
@@ -46,18 +46,14 @@ public class Mechs implements ContentList{
boostSpeed = 0.85f; boostSpeed = 0.85f;
weapon = Weapons.blaster; weapon = Weapons.blaster;
maxSpeed = 4f; maxSpeed = 4f;
altChargeAlpha = 0.02f;
trailColorTo = Color.valueOf("ffd37f"); trailColorTo = Color.valueOf("ffd37f");
armor = 20f; armor = 20f;
} }
@Override @Override
public void updateAlt(Player player){ public void updateAlt(Player player){
if(getDrones(player) >= maxDrones){
player.altHeat = 0f;
}
if(player.altHeat >= 0.91f){ if(getDrones(player) < maxDrones && !TutorialSector.supressDrone() && player.timer.get(Player.timerAbility, buildTime)){
if(!Net.client()) { if(!Net.client()) {
AlphaDrone drone = (AlphaDrone) UnitTypes.alphaDrone.create(player.getTeam()); AlphaDrone drone = (AlphaDrone) UnitTypes.alphaDrone.create(player.getTeam());
drone.leader = player; drone.leader = player;
@@ -65,14 +61,6 @@ public class Mechs implements ContentList{
drone.add(); drone.add();
} }
Effects.effect(UnitFx.unitLand, player); Effects.effect(UnitFx.unitLand, player);
player.altHeat = 0f;
}
}
@Override
public void draw(Player player){
if(getDrones(player) < maxDrones){
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
} }
} }
@@ -86,6 +74,8 @@ public class Mechs implements ContentList{
}; };
delta = new Mech("delta-mech", false){ delta = new Mech("delta-mech", false){
float cooldown = 120;
{ {
drillPower = -1; drillPower = -1;
speed = 0.75f; speed = 0.75f;
@@ -98,32 +88,26 @@ public class Mechs implements ContentList{
weapon = Weapons.shockgun; weapon = Weapons.shockgun;
trailColorTo = Color.valueOf("d3ddff"); trailColorTo = Color.valueOf("d3ddff");
maxSpeed = 5f; maxSpeed = 5f;
altChargeAlpha = 0.03f;
} }
@Override @Override
public void updateAlt(Player player){ public void onLand(Player player){
if(player.altHeat >= 0.91f){ if(player.timer.get(Player.timerAbility, cooldown)){
Effects.shake(3f, 3f, player); Effects.shake(1f, 1f, player);
Effects.effect(UnitFx.landShock, player);
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Timers.run(Mathf.random(5f), () -> Lightning.create(player.getTeam(), BulletFx.hitLancer, player.getTeam().color, 15f, player.x, player.y, Mathf.random(360f), 20)); Timers.run(Mathf.random(8f), () -> Lightning.create(player.getTeam(), BulletFx.hitLancer, player.getTeam().color, 17f, player.x, player.y, Mathf.random(360f), 14));
} }
player.altHeat = 0f;
} }
} }
@Override
public void draw(Player player){
super.draw(player);
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
}
}; };
tau = new Mech("tau-mech", false){ tau = new Mech("tau-mech", false){
protected float healRange = 60f; float healRange = 60f;
protected float healAmount = 10f; float healAmount = 10f;
float healReload = 160f;
protected Rectangle rect = new Rectangle(); Rectangle rect = new Rectangle();
boolean wasHeadled;
{ {
drillPower = 4; drillPower = 4;
@@ -137,44 +121,29 @@ public class Mechs implements ContentList{
weapon = Weapons.healBlaster; weapon = Weapons.healBlaster;
maxSpeed = 5f; maxSpeed = 5f;
armor = 15f; armor = 15f;
altChargeAlpha = 0.05f;
trailColorTo = Palette.heal; trailColorTo = Palette.heal;
} }
@Override
public void draw(Player player){
super.draw(player);
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
}
@Override @Override
public void updateAlt(Player player){ public void updateAlt(Player player){
if(player.altHeat >= 0.91f){ if(player.timer.get(Player.timerAbility, healReload)){
Effects.effect(UnitFx.healWave, player); wasHeadled = false;
rect.setSize(healRange*2f).setCenter(player.x, player.y); rect.setSize(healRange*2f).setCenter(player.x, player.y);
Units.getNearby(player.getTeam(), rect, unit -> { Units.getNearby(player.getTeam(), rect, unit -> {
if(unit.distanceTo(player) <= healRange){ if(unit.distanceTo(player) <= healRange){
if(unit.health < unit.maxHealth()){ if(unit.health < unit.maxHealth()){
Effects.effect(UnitFx.heal, unit); Effects.effect(UnitFx.heal, unit);
wasHeadled = true;
} }
unit.healBy(healAmount); unit.healBy(healAmount);
} }
}); });
int blockRange = (int)(healRange/tilesize); if(wasHeadled){
int px = world.toTile(player.x), py = world.toTile(player.y); Effects.effect(UnitFx.healWave, player);
for(int x = -blockRange; x <= blockRange; x++){
for(int y = -blockRange; y <= blockRange; y++){
if(Mathf.dst(x, y) > blockRange) continue;
Tile tile = world.tile(px + x, py + y);
if(tile != null){
Fire.extinguish(tile, 1000f);
}
}
} }
player.altHeat = 0f;
} }
} }
}; };
@@ -199,12 +168,12 @@ public class Mechs implements ContentList{
@Override @Override
public float getRotationAlpha(Player player){ public float getRotationAlpha(Player player){
return 0.6f - player.altHeat * 0.3f; return 0.6f - player.shootHeat * 0.3f;
} }
@Override @Override
public float spreadX(Player player){ public float spreadX(Player player){
return player.altHeat*2f; return player.shootHeat*2f;
} }
@Override @Override
@@ -215,24 +184,24 @@ public class Mechs implements ContentList{
@Override @Override
public void updateAlt(Player player){ public void updateAlt(Player player){
float scl = 1f - player.altHeat/2f; float scl = 1f - player.shootHeat/2f;
player.getVelocity().scl(scl); player.getVelocity().scl(scl);
} }
@Override @Override
public float getExtraArmor(Player player){ public float getExtraArmor(Player player){
return player.altHeat * 30f; return player.shootHeat * 30f;
} }
@Override @Override
public void draw(Player player){ public void draw(Player player){
if(player.altHeat <= 0.01f) return; if(player.shootHeat <= 0.01f) return;
float alpha = Core.batch.getColor().a; float alpha = Core.batch.getColor().a;
Shaders.build.progress = player.altHeat; Shaders.build.progress = player.shootHeat;
Shaders.build.region = armorRegion; Shaders.build.region = armorRegion;
Shaders.build.time = Timers.time() / 10f; Shaders.build.time = Timers.time() / 10f;
Shaders.build.color.set(Palette.accent).a = player.altHeat; Shaders.build.color.set(Palette.accent).a = player.shootHeat;
Graphics.shader(Shaders.build); Graphics.shader(Shaders.build);
Draw.alpha(1f); Draw.alpha(1f);
Draw.rect(armorRegion, player.snappedX(), player.snappedY(), player.rotation); Draw.rect(armorRegion, player.snappedX(), player.snappedY(), player.rotation);

View File

@@ -208,12 +208,12 @@ public class CraftingBlocks extends BlockList implements ContentList{
output = Items.sand; output = Items.sand;
health = 80; health = 80;
craftEffect = BlockFx.pulverize; craftEffect = BlockFx.pulverize;
craftTime = 50f; craftTime = 40f;
updateEffect = BlockFx.pulverizeSmall; updateEffect = BlockFx.pulverizeSmall;
hasItems = hasPower = true; hasItems = hasPower = true;
consumes.item(Items.stone, 2); consumes.item(Items.stone, 1);
consumes.power(0.1f); consumes.power(0.05f);
}}; }};
solidifier = new GenericCrafter("solidifer"){{ solidifier = new GenericCrafter("solidifer"){{

View File

@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public class UnitFx extends FxList implements ContentList{ public class UnitFx extends FxList implements ContentList{
public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal; public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock;
@Override @Override
public void load(){ public void load(){
@@ -47,6 +47,13 @@ public class UnitFx extends FxList implements ContentList{
Draw.reset(); Draw.reset();
}); });
landShock = new GroundEffect(12, e -> {
Draw.color(Palette.lancerLaser);
Lines.stroke(e.fout() * 3f);
Lines.poly(e.x, e.y, 12, 20f * e.fout());
Draw.reset();
});
pickup = new Effect(18, e -> { pickup = new Effect(18, e -> {
Draw.color(Palette.lightishGray); Draw.color(Palette.lightishGray);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);

View File

@@ -419,7 +419,7 @@ public class NetClient extends Module{
player.pointerX, player.pointerY, player.rotation, player.baseRotation, player.pointerX, player.pointerY, player.rotation, player.baseRotation,
player.getVelocity().x, player.getVelocity().y, player.getVelocity().x, player.getVelocity().y,
player.getMineTile(), player.getMineTile(),
player.isBoosting, player.isShooting, player.isAlt, requests, player.isBoosting, player.isShooting, requests,
Core.camera.position.x, Core.camera.position.y, Core.camera.position.x, Core.camera.position.y,
Core.camera.viewportWidth * Core.camera.zoom * viewScale, Core.camera.viewportHeight * Core.camera.zoom * viewScale); Core.camera.viewportWidth * Core.camera.zoom * viewScale, Core.camera.viewportHeight * Core.camera.zoom * viewScale);
} }

View File

@@ -296,7 +296,7 @@ public class NetServer extends Module{
float rotation, float baseRotation, float rotation, float baseRotation,
float xVelocity, float yVelocity, float xVelocity, float yVelocity,
Tile mining, Tile mining,
boolean boosting, boolean shooting, boolean alting, boolean boosting, boolean shooting,
BuildRequest[] requests, BuildRequest[] requests,
float viewX, float viewY, float viewWidth, float viewHeight float viewX, float viewY, float viewWidth, float viewHeight
){ ){
@@ -322,7 +322,6 @@ public class NetServer extends Module{
player.setMineTile(mining); player.setMineTile(mining);
player.isBoosting = boosting; player.isBoosting = boosting;
player.isShooting = shooting; player.isShooting = shooting;
player.isAlt = alting;
player.getPlaceQueue().clear(); player.getPlaceQueue().clear();
for(BuildRequest req : requests){ for(BuildRequest req : requests){
//auto-skip done requests //auto-skip done requests

View File

@@ -53,8 +53,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
public float pointerX, pointerY; public float pointerX, pointerY;
public String name = "name"; public String name = "name";
public String uuid, usid; public String uuid, usid;
public boolean isAdmin, isTransferring, isShooting, isBoosting, isAlt, isMobile; public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile;
public float boostHeat, altHeat; public float boostHeat, shootHeat;
public boolean achievedFlight; public boolean achievedFlight;
public Color color = new Color(); public Color color = new Color();
public Mech mech; public Mech mech;
@@ -435,8 +435,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
//region update methods //region update methods
float lastx, lasty;
@Override @Override
public void update(){ public void update(){
hitTime -= Timers.delta(); hitTime -= Timers.delta();
@@ -459,8 +457,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
altHeat = Mathf.lerpDelta(altHeat, isAlt ? 1f : 0f, mech.altChargeAlpha);
boostHeat = Mathf.lerpDelta(boostHeat, (tile != null && tile.solid()) || (isBoosting && ((!movement.isZero() && moved) || !isLocal)) ? 1f : 0f, 0.08f); boostHeat = Mathf.lerpDelta(boostHeat, (tile != null && tile.solid()) || (isBoosting && ((!movement.isZero() && moved) || !isLocal)) ? 1f : 0f, 0.08f);
shootHeat = Mathf.lerpDelta(shootHeat, isShooting() ? 1f : 0f, 0.06f);
mech.updateAlt(this); //updated regardless mech.updateAlt(this); //updated regardless
if(!isLocal){ if(!isLocal){
@@ -513,11 +511,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
} }
Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f); Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
} }
mech.onLand(this);
achievedFlight = false; achievedFlight = false;
} }
isBoosting = Inputs.keyDown("dash") && !mech.flying; isBoosting = Inputs.keyDown("dash") && !mech.flying;
isAlt = Inputs.keyDown("ability") && !mech.flying && !isBoosting;
//if player is in solid block //if player is in solid block
if(tile != null && tile.solid()){ if(tile != null && tile.solid()){
@@ -712,7 +710,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
trail.clear(); trail.clear();
carrier = null; carrier = null;
health = maxHealth(); health = maxHealth();
altHeat = boostHeat = drownTime = hitTime = 0f; boostHeat = drownTime = hitTime = 0f;
mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop); mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
placeQueue.clear(); placeQueue.clear();
@@ -794,7 +792,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
public void write(DataOutput buffer) throws IOException{ public void write(DataOutput buffer) throws IOException{
super.writeSave(buffer, !isLocal); super.writeSave(buffer, !isLocal);
buffer.writeUTF(name); //TODO writing strings is very inefficient buffer.writeUTF(name); //TODO writing strings is very inefficient
buffer.writeByte(Bits.toByte(isAdmin) | (Bits.toByte(dead) << 1) | (Bits.toByte(isBoosting) << 2)| (Bits.toByte(isAlt) << 3)); buffer.writeByte(Bits.toByte(isAdmin) | (Bits.toByte(dead) << 1) | (Bits.toByte(isBoosting) << 2));
buffer.writeInt(Color.rgba8888(color)); buffer.writeInt(Color.rgba8888(color));
buffer.writeByte(mech.id); buffer.writeByte(mech.id);
buffer.writeInt(mining == null ? -1 : mining.packedPosition()); buffer.writeInt(mining == null ? -1 : mining.packedPosition());
@@ -813,7 +811,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
isAdmin = (bools & 1) != 0; isAdmin = (bools & 1) != 0;
dead = (bools & 2) != 0; dead = (bools & 2) != 0;
boolean boosting = (bools & 4) != 0; boolean boosting = (bools & 4) != 0;
boolean alt = (bools & 8) != 0;
color.set(buffer.readInt()); color.set(buffer.readInt());
mech = content.getByID(ContentType.mech, buffer.readByte()); mech = content.getByID(ContentType.mech, buffer.readByte());
int mine = buffer.readInt(); int mine = buffer.readInt();
@@ -831,7 +828,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}else{ }else{
mining = world.tile(mine); mining = world.tile(mine);
isBoosting = boosting; isBoosting = boosting;
isAlt = alt;
} }
} }

View File

@@ -24,7 +24,6 @@ public class DefaultKeybinds{
"break", Input.MOUSE_RIGHT, "break", Input.MOUSE_RIGHT,
"rotate", new Axis(Input.SCROLL), "rotate", new Axis(Input.SCROLL),
"dash", Input.SHIFT_LEFT, "dash", Input.SHIFT_LEFT,
"ability", Input.E,
"drop_unit", Input.SHIFT_LEFT, "drop_unit", Input.SHIFT_LEFT,
new Category("view"), new Category("view"),
"zoom_hold", Input.CONTROL_LEFT, "zoom_hold", Input.CONTROL_LEFT,

View File

@@ -23,7 +23,6 @@ public class TutorialSector{
private static int droneIndex; private static int droneIndex;
public static Array<Mission> getMissions(){ public static Array<Mission> getMissions(){
//int x = sectorSize/2, y = sectorSize/2;
Array<Mission> missions = Array.with( Array<Mission> missions = Array.with(
new ItemMission(Items.copper, 60).setMessage("$tutorial.begin"), new ItemMission(Items.copper, 60).setMessage("$tutorial.begin"),
@@ -153,15 +152,9 @@ public class TutorialSector{
private static void generateBase(){ private static void generateBase(){
int x = sectorSize/2 + sectorSize, y = sectorSize/2; int x = sectorSize/2 + sectorSize, y = sectorSize/2;
world.setBlock(world.tile(x, y), StorageBlocks.core, waveTeam); world.setBlock(world.tile(x, y), StorageBlocks.core, waveTeam);
// world.setBlock(world.tile(x + 1, y + 2), TurretBlocks.duo, waveTeam);
//world.setBlock(world.tile(x + 1, y - 2), TurretBlocks.duo, waveTeam);
world.setBlock(world.tile(x - 1, y + 2), UnitBlocks.daggerFactory, waveTeam); world.setBlock(world.tile(x - 1, y + 2), UnitBlocks.daggerFactory, waveTeam);
world.setBlock(world.tile(x - 1, y - 3), UnitBlocks.daggerFactory, waveTeam); world.setBlock(world.tile(x - 1, y - 3), UnitBlocks.daggerFactory, waveTeam);
//fill turret ammo
//world.tile(x + 1, y + 2).block().handleStack(Items.copper, 1, world.tile(x + 1, y + 2), null);
//world.tile(x + 1, y - 2).block().handleStack(Items.copper, 1, world.tile(x + 1, y - 2), null);
//since placed() is not called here, add core manually //since placed() is not called here, add core manually
state.teams.get(waveTeam).cores.add(world.tile(x, y)); state.teams.get(waveTeam).cores.add(world.tile(x, y));
} }

View File

@@ -27,7 +27,6 @@ public class Mech extends UnlockableContent{
public float shake = 0f; public float shake = 0f;
public float armor = 1f; public float armor = 1f;
public float altChargeAlpha = 0.1f;
public float cellTrnsY = 0f; public float cellTrnsY = 0f;
public float mineSpeed = 1f; public float mineSpeed = 1f;
public int drillPower = -1; public int drillPower = -1;
@@ -36,7 +35,7 @@ public class Mech extends UnlockableContent{
public Color trailColor = Palette.boostFrom; public Color trailColor = Palette.boostFrom;
public Color trailColorTo = Palette.boostTo; public Color trailColorTo = Palette.boostTo;
public int itemCapacity = 30; public int itemCapacity = 30;
public boolean turnCursor = true; public boolean turnCursor = true;
public float weaponOffsetX, weaponOffsetY; public float weaponOffsetX, weaponOffsetY;
public Weapon weapon = Weapons.blaster; public Weapon weapon = Weapons.blaster;
@@ -71,6 +70,8 @@ public class Mech extends UnlockableContent{
return true; return true;
} }
public void onLand(Player player){}
@Override @Override
public boolean isHidden() { public boolean isHidden() {
return !flying && mobile; return !flying && mobile;