Less messy respawning / Standard starter mech / Bugfixes
This commit is contained in:
@@ -77,7 +77,7 @@ public class Blocks implements ContentList{
|
||||
fortressFactory, repairPoint,
|
||||
|
||||
//upgrades
|
||||
alphaDartPad, deltaPad, tauPad, omegaPad, javelinPad, tridentPad, glaivePad;
|
||||
dartPad, deltaPad, tauPad, omegaPad, javelinPad, tridentPad, glaivePad;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -1647,9 +1647,9 @@ public class Blocks implements ContentList{
|
||||
//endregion
|
||||
//region upgrades
|
||||
|
||||
alphaDartPad = new MechPad("alpha-dart-mech-pad"){{
|
||||
dartPad = new MechPad("dart-mech-pad"){{
|
||||
requirements(Category.upgrade, ItemStack.with(Items.lead, 200, Items.graphite, 100, Items.copper, 150));
|
||||
mech = Mechs.alpha;
|
||||
mech = Mechs.dart;
|
||||
size = 2;
|
||||
consumes.powerBuffered(50f);
|
||||
}};
|
||||
|
||||
@@ -730,7 +730,7 @@ public class Bullets implements ContentList{
|
||||
explode = new BombBulletType(2f, 3f, "clear"){
|
||||
{
|
||||
hitEffect = Fx.pulverize;
|
||||
lifetime = 23f;
|
||||
lifetime = 30f;
|
||||
speed = 1f;
|
||||
splashDamageRadius = 50f;
|
||||
splashDamage = 28f;
|
||||
|
||||
@@ -20,8 +20,7 @@ import io.anuke.mindustry.type.Weapon;
|
||||
public class Mechs implements ContentList{
|
||||
public static Mech alpha, delta, tau, omega, dart, javelin, trident, glaive;
|
||||
|
||||
/** These are not new mechs, just re-assignments for convenience. */
|
||||
public static Mech starterDesktop, starterMobile;
|
||||
public static Mech starter;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -33,7 +32,7 @@ public class Mechs implements ContentList{
|
||||
mineSpeed = 1.5f;
|
||||
mass = 1.2f;
|
||||
speed = 0.5f;
|
||||
boostSpeed = 0.85f;
|
||||
boostSpeed = 0.95f;
|
||||
buildPower = 1.2f;
|
||||
engineColor = Color.valueOf("ffd37f");
|
||||
health = 300f;
|
||||
@@ -225,7 +224,7 @@ public class Mechs implements ContentList{
|
||||
{
|
||||
drillPower = 1;
|
||||
mineSpeed = 0.9f;
|
||||
speed = 0.4f;
|
||||
speed = 0.45f;
|
||||
drag = 0.1f;
|
||||
health = 180f;
|
||||
weaponOffsetX = -1;
|
||||
@@ -366,7 +365,6 @@ public class Mechs implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
starterDesktop = alpha;
|
||||
starterMobile = dart;
|
||||
starter = alpha;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public class TechTree implements ContentList{
|
||||
node(phantomFactory);
|
||||
});
|
||||
|
||||
node(alphaDartPad, () -> {
|
||||
node(dartPad, () -> {
|
||||
node(deltaPad, () -> {
|
||||
|
||||
node(javelinPad, () -> {
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.anuke.arc.input.KeyCode;
|
||||
import io.anuke.arc.scene.ui.Dialog;
|
||||
import io.anuke.arc.scene.ui.TextField;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
@@ -172,7 +171,6 @@ public class Control implements ApplicationListener{
|
||||
void createPlayer(){
|
||||
player = new Player();
|
||||
player.name = Core.settings.getString("name");
|
||||
player.mech = mobile ? Mechs.starterMobile : Mechs.starterDesktop;
|
||||
player.color.set(Core.settings.getInt("color-0"));
|
||||
player.isLocal = true;
|
||||
player.isMobile = mobile;
|
||||
|
||||
@@ -4,7 +4,8 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.ApplicationListener;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.collection.IntMap;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.Colors;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
@@ -14,7 +15,6 @@ import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.io.ByteBufferOutput;
|
||||
import io.anuke.arc.util.io.CountableByteArrayOutputStream;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Entities;
|
||||
import io.anuke.mindustry.entities.EntityGroup;
|
||||
@@ -33,7 +33,6 @@ import io.anuke.mindustry.net.Packets.*;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.StringBuilder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
@@ -161,7 +160,6 @@ public class NetServer implements ApplicationListener{
|
||||
player.name = packet.name;
|
||||
player.uuid = uuid;
|
||||
player.isMobile = packet.mobile;
|
||||
player.mech = packet.mobile ? Mechs.starterMobile : Mechs.starterDesktop;
|
||||
player.dead = true;
|
||||
player.setNet(player.x, player.y);
|
||||
player.color.set(packet.color);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
public float boostHeat, shootHeat, destructTime;
|
||||
public boolean achievedFlight;
|
||||
public Color color = new Color();
|
||||
public Mech mech;
|
||||
public Mech mech = Mechs.starter;
|
||||
public SpawnerTrait spawner, lastSpawner;
|
||||
public int respawns;
|
||||
|
||||
@@ -82,7 +82,6 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
player.dead = true;
|
||||
player.placeQueue.clear();
|
||||
player.onDeath();
|
||||
player.mech = (player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,11 +101,18 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
|
||||
@Override
|
||||
public void onRespawn(Tile tile){
|
||||
velocity.setZero();
|
||||
boostHeat = 1f;
|
||||
achievedFlight = true;
|
||||
if(state.rules.limitedRespawns){
|
||||
respawns--;
|
||||
}
|
||||
rotation = 90f;
|
||||
baseRotation = 90f;
|
||||
dead = false;
|
||||
spawner = null;
|
||||
respawns --;
|
||||
|
||||
setNet(tile.drawx(), tile.drawy());
|
||||
clearItem();
|
||||
heal();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,12 +124,6 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesGrid(int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
return !isFlying() || (!mech.flying && tile != null && !tile.block().synthetic() && tile.block().solid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drag(){
|
||||
return mech.drag;
|
||||
@@ -519,7 +519,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
if(isDead()){
|
||||
isBoosting = false;
|
||||
boostHeat = 0f;
|
||||
if(respawns!=0){
|
||||
if(respawns > 0 || !state.rules.limitedRespawns){
|
||||
updateRespawning();
|
||||
}
|
||||
return;
|
||||
@@ -780,15 +780,11 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
spawner = lastSpawner = null;
|
||||
health = maxHealth();
|
||||
boostHeat = drownTime = hitTime = 0f;
|
||||
mech = getStarterMech();
|
||||
mech = Mechs.starter;
|
||||
placeQueue.clear();
|
||||
respawns = state.rules.respawns;
|
||||
}
|
||||
|
||||
public Mech getStarterMech(){
|
||||
return (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
return isShooting && (!isBoosting || mech.flying);
|
||||
}
|
||||
@@ -812,17 +808,13 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
this.spawner = spawner;
|
||||
this.lastSpawner = spawner;
|
||||
this.dead = true;
|
||||
}
|
||||
|
||||
public void endRespawning(){
|
||||
spawner = null;
|
||||
setNet(spawner.getX(), spawner.getY());
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region read and write methods
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isClipped(){
|
||||
return false;
|
||||
|
||||
@@ -22,6 +22,7 @@ public enum Binding implements KeyBind{
|
||||
zoom(new Axis(KeyCode.SCROLL)),
|
||||
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
|
||||
pause(KeyCode.SPACE),
|
||||
minimap(KeyCode.M),
|
||||
toggle_menus(KeyCode.C),
|
||||
screenshot(KeyCode.P),
|
||||
player_list(KeyCode.TAB, "multiplayer"),
|
||||
|
||||
@@ -130,6 +130,14 @@ public class DesktopInput extends InputHandler{
|
||||
player.isShooting = false;
|
||||
}
|
||||
|
||||
if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap)){
|
||||
if(!ui.minimap.isShown()){
|
||||
ui.minimap.show();
|
||||
}else{
|
||||
ui.minimap.hide();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.is(State.menu) || Core.scene.hasDialog()) return;
|
||||
|
||||
//zoom and rotate things
|
||||
|
||||
@@ -734,9 +734,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
if(player.isDead()) return;
|
||||
|
||||
Vector2 v = Core.camera.position;
|
||||
//change to 1/2 to clamp to viewport
|
||||
float scaling = 1f;
|
||||
|
||||
v.x = clerp(v.x, player.x - Core.camera.width/2f, player.x + Core.camera.width/2f);
|
||||
v.y = clerp(v.y, player.y - Core.camera.height/2f, player.y + Core.camera.height/2f);
|
||||
v.x = clerp(v.x, player.x - Core.camera.width*scaling, player.x + Core.camera.width*scaling);
|
||||
v.y = clerp(v.y, player.y - Core.camera.height*scaling, player.y + Core.camera.height*scaling);
|
||||
}
|
||||
|
||||
float clerp(float value, float min, float max){
|
||||
|
||||
@@ -8,8 +8,8 @@ import io.anuke.arc.scene.event.InputEvent;
|
||||
import io.anuke.arc.scene.event.InputListener;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
|
||||
import static io.anuke.mindustry.Vars.mobile;
|
||||
import static io.anuke.mindustry.Vars.renderer;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class MinimapDialog extends FloatingDialog{
|
||||
|
||||
@@ -54,7 +54,8 @@ public class MinimapDialog extends FloatingDialog{
|
||||
@Override
|
||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
||||
if(mobile){
|
||||
renderer.minimap.zoomBy(Core.input.deltaY(pointer) / 30f / Unit.dp.scl(1f));
|
||||
float max = Math.min(world.width(), world.height()) / 16f / 2f;
|
||||
renderer.minimap.setZoom(1f + y / cont.getHeight() * (max - 1f));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,15 +40,15 @@ public class PlacementFragment extends Fragment{
|
||||
|
||||
//TODO make this configurable
|
||||
final KeyCode[] inputGrid = {
|
||||
KeyCode.NUM_1, KeyCode.NUM_2, KeyCode.NUM_3, KeyCode.NUM_4,
|
||||
KeyCode.Q, KeyCode.W, KeyCode.E, KeyCode.R,
|
||||
KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.F,
|
||||
KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V
|
||||
KeyCode.NUM_1, KeyCode.NUM_2, KeyCode.NUM_3, KeyCode.NUM_4,
|
||||
KeyCode.Q, KeyCode.W, KeyCode.E, KeyCode.R,
|
||||
KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.F,
|
||||
KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V
|
||||
}, inputCatGrid = {
|
||||
KeyCode.NUM_1, KeyCode.NUM_2,
|
||||
KeyCode.Q, KeyCode.W,
|
||||
KeyCode.A, KeyCode.S,
|
||||
KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V
|
||||
KeyCode.NUM_1, KeyCode.NUM_2,
|
||||
KeyCode.Q, KeyCode.W,
|
||||
KeyCode.A, KeyCode.S,
|
||||
KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V
|
||||
};
|
||||
|
||||
public PlacementFragment(){
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void linkPowerNodes(Player player, Tile tile, Tile other){
|
||||
if(tile.entity.power == null || !((PowerNode)tile.block()).linkValid(tile, other)
|
||||
if(tile.entity == null || other == null || tile.entity.power == null || !((PowerNode)tile.block()).linkValid(tile, other)
|
||||
|| tile.entity.power.links.size >= ((PowerNode)tile.block()).maxNodes) return;
|
||||
|
||||
TileEntity entity = tile.entity();
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
@@ -43,14 +44,8 @@ public class CoreBlock extends StorageBlock{
|
||||
entity.progress = 0;
|
||||
entity.currentUnit = player;
|
||||
entity.currentUnit.onRespawn(tile);
|
||||
entity.currentUnit.heal();
|
||||
entity.currentUnit.rotation = 90f;
|
||||
entity.currentUnit.applyImpulse(0, 8f);
|
||||
entity.currentUnit.setNet(tile.drawx(), tile.drawy());
|
||||
entity.currentUnit.add();
|
||||
entity.currentUnit = null;
|
||||
|
||||
player.endRespawning();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,10 +119,10 @@ public class CoreBlock extends StorageBlock{
|
||||
Draw.color(Pal.accent);
|
||||
|
||||
Lines.lineAngleCenter(
|
||||
tile.drawx() + Mathf.sin(entity.time, 6f, Vars.tilesize / 3f * size),
|
||||
tile.drawy(),
|
||||
90,
|
||||
size * Vars.tilesize / 2f);
|
||||
tile.drawx() + Mathf.sin(entity.time, 6f, Vars.tilesize / 3f * size),
|
||||
tile.drawy(),
|
||||
90,
|
||||
size * Vars.tilesize / 2f);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
@@ -148,6 +143,7 @@ public class CoreBlock extends StorageBlock{
|
||||
return;
|
||||
}
|
||||
|
||||
entity.currentUnit.set(tile.drawx(), tile.drawy());
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f);
|
||||
entity.time += entity.delta();
|
||||
entity.progress += 1f / state.rules.respawnTime * entity.delta();
|
||||
@@ -176,8 +172,8 @@ public class CoreBlock extends StorageBlock{
|
||||
if(!netServer.isWaitingForPlayers() && currentUnit == null){
|
||||
currentUnit = player;
|
||||
progress = 0f;
|
||||
player.mech = player.getStarterMech();
|
||||
player.set(tile.drawx(), tile.drawy());
|
||||
player.mech = Mechs.starter;
|
||||
player.beginRespawning(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.anuke.arc.math.geom.Geometry;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
@@ -33,8 +32,6 @@ public class MechPad extends Block{
|
||||
protected float buildTime = 60 * 5;
|
||||
protected float requiredSatisfaction = 0.999f;
|
||||
|
||||
protected TextureRegion openRegion;
|
||||
|
||||
public MechPad(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
@@ -49,11 +46,6 @@ public class MechPad extends Block{
|
||||
stats.add(BlockStat.productionTime, buildTime / 60f, StatUnit.seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(Tile tile){
|
||||
return false;
|
||||
@@ -81,25 +73,10 @@ public class MechPad extends Block{
|
||||
Effects.effect(Fx.spawn, entity);
|
||||
|
||||
if(entity.player == null) return;
|
||||
|
||||
Mech result = ((MechPad)tile.block()).mech;
|
||||
|
||||
if(entity.player.mech == result){
|
||||
Mech target = (entity.player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
if(entity.player.mech == target){
|
||||
entity.player.mech = (entity.player.isMobile ? Mechs.starterDesktop : Mechs.starterMobile);
|
||||
}else{
|
||||
entity.player.mech = target;
|
||||
}
|
||||
}else{
|
||||
entity.player.mech = result;
|
||||
}
|
||||
entity.player.mech = ((MechPad)tile.block()).mech;
|
||||
|
||||
entity.progress = 0;
|
||||
entity.player.heal();
|
||||
entity.player.endRespawning();
|
||||
entity.player.setDead(false);
|
||||
entity.player.clearItem();
|
||||
entity.player.onRespawn(tile);
|
||||
entity.player = null;
|
||||
}
|
||||
|
||||
@@ -131,12 +108,6 @@ public class MechPad extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
openRegion = Core.atlas.find(name + "-open");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
@@ -146,10 +117,6 @@ public class MechPad extends Block{
|
||||
if(entity.player != null){
|
||||
TextureRegion region = mech.iconRegion;
|
||||
|
||||
if(entity.player.mech == mech){
|
||||
region = (entity.player.mech == Mechs.starterDesktop ? Mechs.starterMobile : Mechs.starterDesktop).iconRegion;
|
||||
}
|
||||
|
||||
Shaders.build.region = region;
|
||||
Shaders.build.progress = entity.progress;
|
||||
Shaders.build.time = -entity.time / 5f;
|
||||
@@ -176,6 +143,7 @@ public class MechPad extends Block{
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
|
||||
if(entity.player != null){
|
||||
entity.player.set(tile.drawx(), tile.drawy());
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f);
|
||||
entity.progress += 1f / buildTime * entity.delta();
|
||||
|
||||
@@ -206,9 +174,6 @@ public class MechPad extends Block{
|
||||
progress = 0f;
|
||||
player = unit;
|
||||
|
||||
player.rotation = 90f;
|
||||
player.baseRotation = 90f;
|
||||
player.setNet(x, y);
|
||||
player.beginRespawning(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user