Fully implemented dart ship factory
|
After Width: | Height: | Size: 393 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 420 B |
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 123 KiB |
|
|
@ -40,6 +40,8 @@ public class Mechs implements ContentList {
|
|||
speed = 0.4f;
|
||||
maxSpeed = 3f;
|
||||
drag = 0.1f;
|
||||
weaponOffsetX = -1;
|
||||
weaponOffsetY = -1;
|
||||
}};
|
||||
|
||||
trident = new Mech("trident-ship", true){{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
|||
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.production.MechFactory;
|
||||
import io.anuke.mindustry.world.blocks.units.MechFactory;
|
||||
|
||||
public class UpgradeBlocks extends BlockList {
|
||||
public static Block deltaFactory, tauFactory, omegaFactory, dartFactory, tridentFactory, javelinFactory, halberdFactory;
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ public class Control extends Module{
|
|||
player.color.set(Settings.getInt("color-" + index));
|
||||
player.isLocal = true;
|
||||
player.playerIndex = index;
|
||||
player.isMobile = mobile;
|
||||
players[index] = player;
|
||||
|
||||
if(setTo != null){
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ public class NetServer extends Module{
|
|||
player.usid = packet.usid;
|
||||
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);
|
||||
|
|
@ -169,7 +170,7 @@ public class NetServer extends Module{
|
|||
|
||||
long elapsed = TimeUtils.timeSinceMillis(connection.lastRecievedTime);
|
||||
|
||||
float maxSpeed = packet.boosting ? player.mech.boostSpeed : player.mech.speed;
|
||||
float maxSpeed = packet.boosting && !player.mech.flying ? player.mech.boostSpeed : player.mech.speed;
|
||||
|
||||
//extra 1.1x multiplicaton is added just in case
|
||||
float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
public float pointerX, pointerY;
|
||||
public String name = "name";
|
||||
public String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile;
|
||||
public float boostHeat;
|
||||
public Color color = new Color();
|
||||
public Mech mech;
|
||||
|
|
@ -76,7 +76,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
private Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
||||
private Tile mining;
|
||||
private CarriableTrait carrying;
|
||||
private Trail trail = new Trail(16);
|
||||
private Trail trail = new Trail(12);
|
||||
private Vector2 movement = new Vector2();
|
||||
private boolean moved;
|
||||
|
||||
|
|
@ -317,11 +317,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
Draw.rect(mech.region, x, y, rotation -90);
|
||||
|
||||
for (int i : Mathf.signs) {
|
||||
float tra = rotation - 90, trY = - mech.weapon.getRecoil(this, i > 0)*1.5f;
|
||||
float tra = rotation - 90, trY = - mech.weapon.getRecoil(this, i > 0)*1.5f + mech.weaponOffsetY;
|
||||
float w = i > 0 ? -12 : 12;
|
||||
Draw.rect(mech.weapon.equipRegion,
|
||||
x + Angles.trnsx(tra, 0, trY),
|
||||
y + Angles.trnsy(tra, 0, trY), w, 12, rotation - 90);
|
||||
x + Angles.trnsx(tra, mech.weaponOffsetX * i, trY),
|
||||
y + Angles.trnsy(tra, mech.weaponOffsetX * i, trY), w, 12, rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
|
|
@ -347,7 +347,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
|
||||
@Override
|
||||
public void drawOver(){
|
||||
if(!isShooting() && !dead) {
|
||||
if(dead) return;
|
||||
|
||||
if(!isShooting()) {
|
||||
drawBuilding(this);
|
||||
}
|
||||
|
||||
|
|
@ -469,7 +471,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
|
||||
if(ui.chatfrag.chatOpen()) return;
|
||||
|
||||
float speed = isBoosting ? mech.boostSpeed : mech.speed;
|
||||
float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed;
|
||||
//fraction of speed when at max load
|
||||
float carrySlowdown = 0.7f;
|
||||
|
||||
|
|
@ -644,7 +646,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
|
|||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
return isShooting && inventory.hasAmmo() && !isBoosting;
|
||||
return isShooting && inventory.hasAmmo() && (!isBoosting || mech.flying);
|
||||
}
|
||||
|
||||
public void setRespawning(){
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ public class Mech extends Upgrade {
|
|||
public float buildPower = 1f;
|
||||
public boolean canRepair = false;
|
||||
|
||||
public float weaponOffsetX, weaponOffsetY;
|
||||
|
||||
public Weapon weapon = Weapons.blaster;
|
||||
|
||||
public int itemCapacity = 30;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package io.anuke.mindustry.world.blocks.production;
|
||||
package io.anuke.mindustry.world.blocks.units;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
|
|
@ -29,6 +30,7 @@ import static io.anuke.mindustry.Vars.tilesize;
|
|||
|
||||
public class MechFactory extends Block{
|
||||
protected Mech mech;
|
||||
protected float buildTime = 60*5;
|
||||
|
||||
protected TextureRegion openRegion;
|
||||
|
||||
|
|
@ -68,9 +70,13 @@ public class MechFactory extends Block{
|
|||
if(entity.player != null) {
|
||||
TextureRegion region = mech.iconRegion;
|
||||
|
||||
if(entity.player.mech == mech){
|
||||
region = (entity.player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop).iconRegion;
|
||||
}
|
||||
|
||||
Shaders.build.region = region;
|
||||
Shaders.build.progress = entity.progress;
|
||||
Shaders.build.time = -entity.time / 10f;
|
||||
Shaders.build.time = -entity.time / 4f;
|
||||
Shaders.build.color.set(Palette.accent);
|
||||
|
||||
Graphics.shader(Shaders.build, false);
|
||||
|
|
@ -84,7 +90,7 @@ public class MechFactory extends Block{
|
|||
tile.drawx() + Mathf.sin(entity.time, 6f, Vars.tilesize / 3f * size),
|
||||
tile.drawy(),
|
||||
90,
|
||||
size * Vars.tilesize / 2f);
|
||||
size * Vars.tilesize / 2f + 1f);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
|
@ -104,8 +110,7 @@ public class MechFactory extends Block{
|
|||
|
||||
if(entity.player != null){
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f);
|
||||
entity.progress += 1f / Vars.respawnduration;
|
||||
|
||||
entity.progress += 1f / buildTime;
|
||||
|
||||
entity.time += entity.heat;
|
||||
|
||||
|
|
@ -146,10 +151,17 @@ public class MechFactory extends Block{
|
|||
MechFactoryEntity entity = tile.entity();
|
||||
|
||||
Effects.effect(Fx.spawn, entity);
|
||||
Mech result = ((MechFactory)tile.block()).mech;
|
||||
|
||||
if(entity.player.mech == result){
|
||||
entity.player.mech = (entity.player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
}else{
|
||||
entity.player.mech = result;
|
||||
}
|
||||
|
||||
entity.player.mech = ((MechFactory)tile.block()).mech;
|
||||
entity.progress = 0;
|
||||
entity.player.heal();
|
||||
entity.open = true;
|
||||
entity.player.setDead(false);
|
||||
entity.player = null;
|
||||
}
|
||||