Omega mech ability / Rendering fix
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.type.ContentList;
|
||||
import io.anuke.mindustry.type.Mech;
|
||||
import io.anuke.mindustry.type.Upgrade;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
|
||||
public class Mechs implements ContentList{
|
||||
public static Mech alpha, delta, tau, omega, dart, javelin, trident, halberd;
|
||||
@@ -52,19 +59,61 @@ public class Mechs implements ContentList{
|
||||
armor = 30f;
|
||||
}};
|
||||
|
||||
omega = new Mech("omega-mech", false){{
|
||||
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;
|
||||
}};
|
||||
omega = new Mech("omega-mech", false){
|
||||
protected TextureRegion armorRegion;
|
||||
{
|
||||
drillPower = 2;
|
||||
mineSpeed = 1.5f;
|
||||
itemCapacity = 50;
|
||||
speed = 0.36f;
|
||||
boostSpeed = 0.6f;
|
||||
shake = 4f;
|
||||
weaponOffsetX = 1;
|
||||
weaponOffsetY = 0;
|
||||
weapon = Weapons.swarmer;
|
||||
trailColorTo = Color.valueOf("feb380");
|
||||
maxSpeed = 3.5f;
|
||||
armor = 50f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spreadX(Player player){
|
||||
return player.altHeat*2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
armorRegion = Draw.region(name + "-armor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAlt(Player player){
|
||||
float scl = 1f - player.altHeat/2f;
|
||||
player.getVelocity().scl(scl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExtraArmor(Player player){
|
||||
return player.altHeat * 40f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Player player){
|
||||
if(player.altHeat <= 0.01f) return;
|
||||
|
||||
float alpha = Core.batch.getColor().a;
|
||||
Shaders.build.progress = player.altHeat;
|
||||
Shaders.build.region = armorRegion;
|
||||
Shaders.build.time = Timers.time() / 10f;
|
||||
Shaders.build.color.set(Palette.accent).a = player.altHeat;
|
||||
Graphics.shader(Shaders.build);
|
||||
Draw.alpha(1f);
|
||||
Draw.rect(armorRegion, player.snappedX(), player.snappedY(), player.rotation);
|
||||
Graphics.shader(Shaders.mix);
|
||||
Draw.color(1f, 1f, 1f, alpha);
|
||||
}
|
||||
};
|
||||
|
||||
dart = new Mech("dart-ship", true){{
|
||||
drillPower = 1;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MissileBullets extends BulletList implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
javelin = new MissileBulletType(2.5f, 10, "missile"){
|
||||
javelin = new MissileBulletType(2.5f, 14, "missile"){
|
||||
{
|
||||
bulletWidth = 8f;
|
||||
bulletHeight = 8f;
|
||||
@@ -60,22 +60,23 @@ public class MissileBullets extends BulletList implements ContentList{
|
||||
drag = -0.02f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 15f;
|
||||
splashDamage = 11f;
|
||||
lifetime = 90f;
|
||||
hiteffect = BulletFx.blastExplosion;
|
||||
despawneffect = BulletFx.blastExplosion;
|
||||
}
|
||||
};
|
||||
|
||||
swarm = new MissileBulletType(2.7f, 10, "missile"){
|
||||
swarm = new MissileBulletType(2.7f, 14, "missile"){
|
||||
{
|
||||
bulletWidth = 8f;
|
||||
bulletHeight = 8f;
|
||||
bulletShrink = 0f;
|
||||
drag = -0.003f;
|
||||
homingRange = 60f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 15f;
|
||||
splashDamage = 11f;
|
||||
lifetime = 120f;
|
||||
trailColor = Color.GRAY;
|
||||
backColor = Palette.bulletYellowBack;
|
||||
|
||||
@@ -159,7 +159,11 @@ public class Renderer extends RendererModule{
|
||||
Vector2 position = averagePosition();
|
||||
|
||||
if(!mobile){
|
||||
setCamera(position.x + 0.0001f, position.y + 0.0001f);
|
||||
if(players[0].isDead()){
|
||||
smoothCamera(position.x + 0.0001f, position.y + 0.0001f, 0.08f);
|
||||
}else{
|
||||
setCamera(position.x + 0.0001f, position.y + 0.0001f);
|
||||
}
|
||||
}
|
||||
|
||||
if(world.getSector() == null){
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public String name = "name";
|
||||
public String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isAlt, isMobile;
|
||||
public float boostHeat;
|
||||
public float boostHeat, altHeat;
|
||||
public boolean achievedFlight;
|
||||
public Color color = new Color();
|
||||
public Mech mech;
|
||||
@@ -183,7 +183,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
@Override
|
||||
public float getArmor(){
|
||||
return mech.armor;
|
||||
return mech.armor + mech.getExtraArmor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,7 +210,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void damage(float amount){
|
||||
hitTime = hitDuration;
|
||||
if(!Net.client()){
|
||||
health -= amount;
|
||||
health -= calculateDamage(amount);
|
||||
}
|
||||
|
||||
if(health <= 0 && !dead){
|
||||
@@ -314,12 +314,14 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
Draw.rect(mech.region, x, y, rotation - 90);
|
||||
|
||||
mech.draw(this);
|
||||
|
||||
for(int i : Mathf.signs){
|
||||
float tra = rotation - 90, trY = -mech.weapon.getRecoil(this, i > 0) + mech.weaponOffsetY;
|
||||
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, mech.weapon.equipRegion.getRegionHeight(), rotation - 90);
|
||||
x + Angles.trnsx(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY),
|
||||
y + Angles.trnsy(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY), w, mech.weapon.equipRegion.getRegionHeight(), rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
@@ -366,11 +368,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}
|
||||
}
|
||||
|
||||
float snappedX(){
|
||||
public float snappedX(){
|
||||
return snapCamera && isLocal ? (int) (x + 0.0001f) : x;
|
||||
}
|
||||
|
||||
float snappedY(){
|
||||
public float snappedY(){
|
||||
return snapCamera && isLocal ? (int) (y + 0.0001f) : y;
|
||||
}
|
||||
|
||||
@@ -489,8 +491,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
protected void updateMech(){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
altHeat = Mathf.lerpDelta(altHeat, isAlt ? 1f : 0f, mech.altChargeAlpha);
|
||||
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && ((!movement.isZero() && moved) || !isLocal) ? 1f : 0f, 0.08f);
|
||||
|
||||
mech.updateAlt(this);
|
||||
|
||||
if(boostHeat > liftoffBoost + 0.1f){
|
||||
achievedFlight = true;
|
||||
}
|
||||
@@ -505,7 +510,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
achievedFlight = false;
|
||||
}
|
||||
|
||||
isBoosting = Inputs.keyDown("dash") && !mech.flying;
|
||||
isBoosting = Inputs.keyDown("dash") && !mech.flying && !isAlt;
|
||||
isAlt = Inputs.keyDown("ability") && !mech.flying;
|
||||
|
||||
//if player is in solid block
|
||||
@@ -771,7 +776,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void write(DataOutput buffer) throws IOException{
|
||||
super.writeSave(buffer, !isLocal);
|
||||
buffer.writeUTF(name); //TODO writing strings is very inefficient
|
||||
buffer.writeByte(Bits.toByte(isAdmin) | (Bits.toByte(dead) << 1) | (Bits.toByte(isBoosting) << 2));
|
||||
buffer.writeByte(Bits.toByte(isAdmin) | (Bits.toByte(dead) << 1) | (Bits.toByte(isBoosting) << 2)| (Bits.toByte(isAlt) << 3));
|
||||
buffer.writeInt(Color.rgba8888(color));
|
||||
buffer.writeByte(mech.id);
|
||||
buffer.writeInt(mining == null ? -1 : mining.packedPosition());
|
||||
@@ -790,6 +795,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
isAdmin = (bools & 1) != 0;
|
||||
dead = (bools & 2) != 0;
|
||||
boolean boosting = (bools & 4) != 0;
|
||||
boolean alt = (bools & 8) != 0;
|
||||
color.set(buffer.readInt());
|
||||
mech = Upgrade.getByID(buffer.readByte());
|
||||
int mine = buffer.readInt();
|
||||
@@ -807,6 +813,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}else{
|
||||
mining = world.tile(mine);
|
||||
isBoosting = boosting;
|
||||
isAlt = alt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,14 +88,13 @@ public class BlockRenderer{
|
||||
|
||||
int shadowW = rangex * tilesize*2, shadowH = rangey * tilesize*2;
|
||||
|
||||
if(shadows.width() != shadowW || shadows.height() != shadowH){
|
||||
shadows.setSize(shadowW, shadowH);
|
||||
}
|
||||
|
||||
teamChecks.clear();
|
||||
requestidx = 0;
|
||||
|
||||
Graphics.end();
|
||||
if(shadows.width() != shadowW || shadows.height() != shadowH){
|
||||
shadows.setSize(shadowW, shadowH);
|
||||
}
|
||||
Core.batch.getProjectionMatrix().setToOrtho2D(Mathf.round(Core.camera.position.x, tilesize)-shadowW/2f, Mathf.round(Core.camera.position.y, tilesize)-shadowH/2f, shadowW, shadowH);
|
||||
Graphics.surface(shadows);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DefaultKeybinds{
|
||||
//"shoot", Input.MOUSE_LEFT,
|
||||
"rotate", new Axis(Input.SCROLL),
|
||||
"dash", Input.SHIFT_LEFT,
|
||||
"ability", Input.SPACE,
|
||||
"ability", Input.CONTROL_LEFT,
|
||||
"drop_unit", Input.SHIFT_LEFT,
|
||||
new Category("view"),
|
||||
"zoom_hold", Input.CONTROL_LEFT,
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.type;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.ui.ContentDisplay;
|
||||
@@ -21,6 +22,7 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
public float shake = 0f;
|
||||
public float armor = 1f;
|
||||
|
||||
public float altChargeAlpha = 0.1f;
|
||||
public float mineSpeed = 1f;
|
||||
public int drillPower = -1;
|
||||
public float carryWeight = 10f;
|
||||
@@ -30,7 +32,6 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
public int itemCapacity = 30;
|
||||
|
||||
public float weaponOffsetX, weaponOffsetY;
|
||||
|
||||
public Weapon weapon = Weapons.blaster;
|
||||
|
||||
public TextureRegion baseRegion, legRegion, region, iconRegion;
|
||||
@@ -40,6 +41,18 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
this.flying = flying;
|
||||
}
|
||||
|
||||
public void updateAlt(Player player){}
|
||||
|
||||
public void draw(Player player){}
|
||||
|
||||
public float getExtraArmor(Player player){
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public float spreadX(Player player){
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayInfo(Table table){
|
||||
ContentDisplay.displayMech(table, this);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.storage;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -38,12 +37,6 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class CoreBlock extends StorageBlock{
|
||||
private static Rectangle rect = new Rectangle();
|
||||
|
||||
protected int timerSupply = timers++;
|
||||
|
||||
protected float supplyRadius = 50f;
|
||||
protected float supplyInterval = 5f;
|
||||
protected float droneRespawnDuration = 60 * 6;
|
||||
protected UnitType droneType = UnitTypes.drone;
|
||||
|
||||
@@ -164,13 +157,6 @@ public class CoreBlock extends StorageBlock{
|
||||
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
Draw.color(Palette.accent);
|
||||
Lines.dashCircle(tile.drawx(), tile.drawy(), supplyRadius);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyed(Tile tile){
|
||||
//TODO more dramatic effects
|
||||
|
||||
Reference in New Issue
Block a user