Massive amount of bugfixes, too many to list in commit log
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 219 B |
@@ -533,3 +533,4 @@ block.liquid-tank.name=Liquid Tank
|
|||||||
block.liquid-junction.name=Liquid Junction
|
block.liquid-junction.name=Liquid Junction
|
||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
@@ -21,11 +21,13 @@ public class Items implements ContentList{
|
|||||||
tungsten = new Item("tungsten", Color.valueOf("a0b0c8")) {{
|
tungsten = new Item("tungsten", Color.valueOf("a0b0c8")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
hardness = 1;
|
hardness = 1;
|
||||||
|
cost = 0.75f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
lead = new Item("lead", Color.valueOf("8e85a2")) {{
|
lead = new Item("lead", Color.valueOf("8e85a2")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
hardness = 1;
|
hardness = 1;
|
||||||
|
cost = 0.6f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
coal = new Item("coal", Color.valueOf("272727")) {{
|
coal = new Item("coal", Color.valueOf("272727")) {{
|
||||||
@@ -41,6 +43,7 @@ public class Items implements ContentList{
|
|||||||
titanium = new Item("titanium", Color.valueOf("8da1e3")) {{
|
titanium = new Item("titanium", Color.valueOf("8da1e3")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
hardness = 3;
|
hardness = 3;
|
||||||
|
cost = 1.1f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
thorium = new Item("thorium", Color.valueOf("f9a3c7")) {{
|
thorium = new Item("thorium", Color.valueOf("f9a3c7")) {{
|
||||||
@@ -48,20 +51,24 @@ public class Items implements ContentList{
|
|||||||
explosiveness = 0.1f;
|
explosiveness = 0.1f;
|
||||||
hardness = 4;
|
hardness = 4;
|
||||||
radioactivity = 0.5f;
|
radioactivity = 0.5f;
|
||||||
|
cost = 1.2f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
silicon = new Item("silicon", Color.valueOf("53565c")) {{
|
silicon = new Item("silicon", Color.valueOf("53565c")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
|
cost = 0.9f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
plastanium = new Item("plastanium", Color.valueOf("e9ead3")) {{
|
plastanium = new Item("plastanium", Color.valueOf("e9ead3")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
flammability = 0.1f;
|
flammability = 0.1f;
|
||||||
explosiveness = 0.1f;
|
explosiveness = 0.1f;
|
||||||
|
cost = 1.5f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
phasematter = new Item("phase-matter", Color.valueOf("f4ba6e")) {{
|
phasematter = new Item("phase-matter", Color.valueOf("f4ba6e")) {{
|
||||||
type = ItemType.material;
|
type = ItemType.material;
|
||||||
|
cost = 1.5f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
surgealloy = new Item("surge-alloy", Color.valueOf("b4d5c7")) {{
|
surgealloy = new Item("surge-alloy", Color.valueOf("b4d5c7")) {{
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(power, PowerBlocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
|
new Recipe(power, PowerBlocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
|
||||||
new Recipe(power, PowerBlocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasematter, 30));
|
new Recipe(power, PowerBlocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasematter, 30));
|
||||||
|
|
||||||
|
//generators - other
|
||||||
|
new Recipe(power, PowerBlocks.nuclearReactor, new ItemStack(Items.lead, 600), new ItemStack(Items.silicon, 400), new ItemStack(Items.carbide, 300), new ItemStack(Items.thorium, 300));
|
||||||
|
|
||||||
//new Recipe(distribution, StorageBlocks.core, new ItemStack(Items.carbide, 50));
|
//new Recipe(distribution, StorageBlocks.core, new ItemStack(Items.carbide, 50));
|
||||||
new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.carbide, 40), new ItemStack(Items.silicon, 50));
|
new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.carbide, 40), new ItemStack(Items.silicon, 50));
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class PowerBlocks extends BlockList implements ContentList {
|
|||||||
maxLiquidGenerate = 0.5f;
|
maxLiquidGenerate = 0.5f;
|
||||||
powerPerLiquid = 0.08f;
|
powerPerLiquid = 0.08f;
|
||||||
powerCapacity = 40f;
|
powerCapacity = 40f;
|
||||||
|
powerPerLiquid = 0.25f;
|
||||||
generateEffect = BlockFx.redgeneratespark;
|
generateEffect = BlockFx.redgeneratespark;
|
||||||
size = 2;
|
size = 2;
|
||||||
}};
|
}};
|
||||||
@@ -30,6 +31,7 @@ public class PowerBlocks extends BlockList implements ContentList {
|
|||||||
powerOutput = 0.28f;
|
powerOutput = 0.28f;
|
||||||
powerCapacity = 40f;
|
powerCapacity = 40f;
|
||||||
itemDuration = 30f;
|
itemDuration = 30f;
|
||||||
|
powerPerLiquid = 0.7f;
|
||||||
auxLiquidUse = 0.05f;
|
auxLiquidUse = 0.05f;
|
||||||
size = 2;
|
size = 2;
|
||||||
}};
|
}};
|
||||||
@@ -51,7 +53,8 @@ public class PowerBlocks extends BlockList implements ContentList {
|
|||||||
|
|
||||||
nuclearReactor = new NuclearReactor("nuclear-reactor") {{
|
nuclearReactor = new NuclearReactor("nuclear-reactor") {{
|
||||||
size = 3;
|
size = 3;
|
||||||
health = 600;
|
health = 700;
|
||||||
|
powerMultiplier = 0.8f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fusionReactor = new FusionReactor("fusion-reactor") {{
|
fusionReactor = new FusionReactor("fusion-reactor") {{
|
||||||
|
|||||||
@@ -83,13 +83,13 @@ public class TurretBlocks extends BlockList implements ContentList {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
lancer = new LaserTurret("lancer") {{
|
lancer = new LaserTurret("lancer") {{
|
||||||
range = 70f;
|
range = 90f;
|
||||||
chargeTime = 70f;
|
chargeTime = 60f;
|
||||||
chargeMaxDelay = 30f;
|
chargeMaxDelay = 30f;
|
||||||
chargeEffects = 7;
|
chargeEffects = 7;
|
||||||
shootType = AmmoTypes.lancerLaser;
|
shootType = AmmoTypes.lancerLaser;
|
||||||
recoil = 2f;
|
recoil = 2f;
|
||||||
reload = 130f;
|
reload = 100f;
|
||||||
cooldown = 0.03f;
|
cooldown = 0.03f;
|
||||||
powerUsed = 20f;
|
powerUsed = 20f;
|
||||||
powerCapacity = 60f;
|
powerCapacity = 60f;
|
||||||
@@ -131,7 +131,7 @@ public class TurretBlocks extends BlockList implements ContentList {
|
|||||||
|
|
||||||
salvo = new BurstTurret("salvo") {{
|
salvo = new BurstTurret("salvo") {{
|
||||||
size = 2;
|
size = 2;
|
||||||
range = 110f;
|
range = 120f;
|
||||||
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
|
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
|
||||||
reload = 40f;
|
reload = 40f;
|
||||||
restitution = 0.03f;
|
restitution = 0.03f;
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class TurretBullets extends BulletList implements ContentList {
|
|||||||
Color[] colors = {Palette.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Palette.lancerLaser, Color.WHITE};
|
Color[] colors = {Palette.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Palette.lancerLaser, Color.WHITE};
|
||||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||||
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
||||||
float length = 70f;
|
float length = 90f;
|
||||||
|
|
||||||
{
|
{
|
||||||
hiteffect = BulletFx.hitLancer;
|
hiteffect = BulletFx.hitLancer;
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class Control extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(int index){
|
public void addPlayer(int index){
|
||||||
if(players.length < index + 1){
|
if(players.length != index + 1){
|
||||||
Player[] old = players;
|
Player[] old = players;
|
||||||
players = new Player[index + 1];
|
players = new Player[index + 1];
|
||||||
System.arraycopy(old, 0, players, 0, old.length);
|
System.arraycopy(old, 0, players, 0, old.length);
|
||||||
@@ -288,6 +288,8 @@ public class Control extends Module{
|
|||||||
ContentLoader.dispose();
|
ContentLoader.dispose();
|
||||||
Net.dispose();
|
Net.dispose();
|
||||||
ui.editor.dispose();
|
ui.editor.dispose();
|
||||||
|
inputs = new InputHandler[]{};
|
||||||
|
players = new Player[]{};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ public class Renderer extends RendererModule{
|
|||||||
if(group.count(p -> p.isFlying() == flying) +
|
if(group.count(p -> p.isFlying() == flying) +
|
||||||
playerGroup.count(p -> p.isFlying() == flying && p.getTeam() == team) == 0 && flying) continue;
|
playerGroup.count(p -> p.isFlying() == flying && p.getTeam() == team) == 0 && flying) continue;
|
||||||
|
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying, Unit::drawUnder);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawUnder);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawUnder);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawUnder);
|
||||||
|
|
||||||
Shaders.outline.color.set(team.color);
|
Shaders.outline.color.set(team.color);
|
||||||
@@ -266,13 +266,13 @@ public class Renderer extends RendererModule{
|
|||||||
|
|
||||||
Graphics.beginShaders(Shaders.outline);
|
Graphics.beginShaders(Shaders.outline);
|
||||||
Graphics.shader(Shaders.mix, true);
|
Graphics.shader(Shaders.mix, true);
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead());
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team);
|
||||||
Graphics.shader();
|
Graphics.shader();
|
||||||
blocks.drawTeamBlocks(Layer.turret, team);
|
blocks.drawTeamBlocks(Layer.turret, team);
|
||||||
Graphics.endShaders();
|
Graphics.endShaders();
|
||||||
|
|
||||||
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying, Unit::drawOver);
|
drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawOver);
|
||||||
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawOver);
|
drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawOver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
public float boostHeat;
|
public float boostHeat;
|
||||||
public Color color = new Color();
|
public Color color = new Color();
|
||||||
public Mech mech;
|
public Mech mech;
|
||||||
|
public int spawner;
|
||||||
|
|
||||||
public NetConnection con;
|
public NetConnection con;
|
||||||
public int playerIndex = 0;
|
public int playerIndex = 0;
|
||||||
@@ -63,7 +64,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
public TargetTrait target;
|
public TargetTrait target;
|
||||||
public TargetTrait moveTarget;
|
public TargetTrait moveTarget;
|
||||||
|
|
||||||
private boolean respawning;
|
|
||||||
private float walktime;
|
private float walktime;
|
||||||
private Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
private Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
||||||
private Tile mining;
|
private Tile mining;
|
||||||
@@ -175,6 +175,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
return mech.weapon.getAmmoType(item) != null && inventory.canAcceptAmmo(mech.weapon.getAmmoType(item));
|
return mech.weapon.getAmmoType(item) != null && inventory.canAcceptAmmo(mech.weapon.getAmmoType(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void added() {
|
||||||
|
baseRotation = 90f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAmmo(Item item) {
|
public void addAmmo(Item item) {
|
||||||
inventory.addAmmo(mech.weapon.getAmmoType(item));
|
inventory.addAmmo(mech.weapon.getAmmoType(item));
|
||||||
@@ -222,7 +227,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
if(player == null) return;
|
if(player == null) return;
|
||||||
|
|
||||||
player.dead = true;
|
player.dead = true;
|
||||||
player.respawning = false;
|
|
||||||
player.placeQueue.clear();
|
player.placeQueue.clear();
|
||||||
|
|
||||||
player.dropCarry();
|
player.dropCarry();
|
||||||
@@ -435,11 +439,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
if(isDead()){
|
if(isDead()){
|
||||||
isBoosting = false;
|
isBoosting = false;
|
||||||
boostHeat = 0f;
|
boostHeat = 0f;
|
||||||
CoreEntity entity = (CoreEntity)getClosestCore();
|
updateRespawning();
|
||||||
|
|
||||||
if (!respawning && entity != null) {
|
|
||||||
entity.trySetPlayer(this);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +656,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
inventory.clear();
|
inventory.clear();
|
||||||
placeQueue.clear();
|
placeQueue.clear();
|
||||||
dead = true;
|
dead = true;
|
||||||
respawning = false;
|
|
||||||
trail.clear();
|
trail.clear();
|
||||||
health = maxHealth();
|
health = maxHealth();
|
||||||
|
|
||||||
@@ -667,12 +666,18 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
return isShooting && inventory.hasAmmo() && (!isBoosting || mech.flying);
|
return isShooting && inventory.hasAmmo() && (!isBoosting || mech.flying);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawning(){
|
public void updateRespawning(){
|
||||||
respawning = true;
|
CoreEntity entity = (CoreEntity)getClosestCore();
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
this.spawner = entity.tile.id();
|
||||||
|
entity.updateSpawning(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawning(boolean respawning){
|
public void beginRespawning(SpawnerTrait spawner){
|
||||||
this.respawning = respawning;
|
this.spawner = spawner.getTile().packedPosition();
|
||||||
|
this.dead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -735,6 +740,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
buffer.writeByte(mech.id);
|
buffer.writeByte(mech.id);
|
||||||
buffer.writeBoolean(isBoosting);
|
buffer.writeBoolean(isBoosting);
|
||||||
buffer.writeInt(mining == null ? -1 : mining.packedPosition());
|
buffer.writeInt(mining == null ? -1 : mining.packedPosition());
|
||||||
|
buffer.writeInt(spawner);
|
||||||
|
|
||||||
writeBuilding(buffer);
|
writeBuilding(buffer);
|
||||||
}
|
}
|
||||||
@@ -750,6 +756,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
mech = Upgrade.getByID(buffer.readByte());
|
mech = Upgrade.getByID(buffer.readByte());
|
||||||
boolean boosting = buffer.readBoolean();
|
boolean boosting = buffer.readBoolean();
|
||||||
int mine = buffer.readInt();
|
int mine = buffer.readInt();
|
||||||
|
spawner = buffer.readInt();
|
||||||
|
|
||||||
readBuilding(buffer, !isLocal);
|
readBuilding(buffer, !isLocal);
|
||||||
|
|
||||||
interpolator.read(lastx, lasty, x, y, time, rotation);
|
interpolator.read(lastx, lasty, x, y, time, rotation);
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ public class TileEntity extends BaseEntity implements TargetTrait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Tile getTile(){
|
||||||
|
return tile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Team getTeam() {
|
public Team getTeam() {
|
||||||
return tile.getTeam();
|
return tile.getTeam();
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
@Override
|
@Override
|
||||||
public void readSave(DataInput stream) throws IOException {
|
public void readSave(DataInput stream) throws IOException {
|
||||||
byte team = stream.readByte();
|
byte team = stream.readByte();
|
||||||
|
boolean dead = stream.readBoolean();
|
||||||
float x = stream.readFloat();
|
float x = stream.readFloat();
|
||||||
float y = stream.readFloat();
|
float y = stream.readFloat();
|
||||||
byte xv = stream.readByte();
|
byte xv = stream.readByte();
|
||||||
@@ -141,6 +142,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
|
|
||||||
this.status.readSave(stream);
|
this.status.readSave(stream);
|
||||||
this.inventory.readSave(stream);
|
this.inventory.readSave(stream);
|
||||||
|
this.dead = dead;
|
||||||
this.team = Team.all[team];
|
this.team = Team.all[team];
|
||||||
this.health = health;
|
this.health = health;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@@ -151,6 +153,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
|
|
||||||
public void writeSave(DataOutput stream, boolean net) throws IOException {
|
public void writeSave(DataOutput stream, boolean net) throws IOException {
|
||||||
stream.writeByte(team.ordinal());
|
stream.writeByte(team.ordinal());
|
||||||
|
stream.writeBoolean(isDead());
|
||||||
stream.writeFloat(net ? interpolator.target.x : x);
|
stream.writeFloat(net ? interpolator.target.x : x);
|
||||||
stream.writeFloat(net ? interpolator.target.y : y);
|
stream.writeFloat(net ? interpolator.target.y : y);
|
||||||
stream.writeByte((byte)(Mathf.clamp(velocity.x, -maxAbsVelocity, maxAbsVelocity) * velocityPercision));
|
stream.writeByte((byte)(Mathf.clamp(velocity.x, -maxAbsVelocity, maxAbsVelocity) * velocityPercision));
|
||||||
|
|||||||
@@ -192,7 +192,9 @@ public interface BuilderTrait extends Entity{
|
|||||||
entity.construct(unit, core, 1f / entity.buildCost * Timers.delta() * getBuildPower(tile));
|
entity.construct(unit, core, 1f / entity.buildCost * Timers.delta() * getBuildPower(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(entity), 0.4f);
|
if(unit.distanceTo(tile) <= placeDistance){
|
||||||
|
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(entity), 0.4f);
|
||||||
|
}
|
||||||
current.progress = entity.progress();
|
current.progress = entity.progress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +241,11 @@ public interface BuilderTrait extends Entity{
|
|||||||
|
|
||||||
Tile tile = world.tile(request.x, request.y);
|
Tile tile = world.tile(request.x, request.y);
|
||||||
|
|
||||||
Draw.color(unit.distanceTo(tile) > placeDistance || request.remove ? Palette.remove : Palette.accent);
|
if(unit.distanceTo(tile) > placeDistance){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.color(Palette.accent);
|
||||||
float focusLen = 3.8f + Mathf.absin(Timers.time(), 1.1f, 0.6f);
|
float focusLen = 3.8f + Mathf.absin(Timers.time(), 1.1f, 0.6f);
|
||||||
float px = unit.x + Angles.trnsx(unit.rotation, focusLen);
|
float px = unit.x + Angles.trnsx(unit.rotation, focusLen);
|
||||||
float py = unit.y + Angles.trnsy(unit.rotation, focusLen);
|
float py = unit.y + Angles.trnsy(unit.rotation, focusLen);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package io.anuke.mindustry.entities.traits;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.entities.Unit;
|
||||||
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
|
public interface SpawnerTrait {
|
||||||
|
Tile getTile();
|
||||||
|
void updateSpawning(Unit unit);
|
||||||
|
float getSpawnProgress();
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import io.anuke.mindustry.entities.Unit;
|
|||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||||
import io.anuke.mindustry.entities.traits.ShooterTrait;
|
import io.anuke.mindustry.entities.traits.ShooterTrait;
|
||||||
|
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||||
@@ -52,7 +53,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
|
|
||||||
protected boolean isWave;
|
protected boolean isWave;
|
||||||
protected Squad squad;
|
protected Squad squad;
|
||||||
protected int spawner = -1;
|
protected int spawner;
|
||||||
|
|
||||||
/**Initialize the type and team of this unit. Only call once!*/
|
/**Initialize the type and team of this unit. Only call once!*/
|
||||||
public void init(UnitType type, Team team){
|
public void init(UnitType type, Team team){
|
||||||
@@ -62,8 +63,8 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
this.team = team;
|
this.team = team;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpawner(UnitFactoryEntity spawner) {
|
public void setSpawner(Tile tile) {
|
||||||
this.spawner = spawner.tile.packedPosition();
|
this.spawner = tile.packedPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnitType getType() {
|
public UnitType getType() {
|
||||||
@@ -92,6 +93,19 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
((TileEntity)target).tile.block().flags.contains(flag);
|
((TileEntity)target).tile.block().flags.contains(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRespawning(){
|
||||||
|
if(spawner == -1) return;
|
||||||
|
|
||||||
|
Tile tile = world.tile(spawner);
|
||||||
|
if(tile != null && tile.entity != null){
|
||||||
|
if(tile.entity instanceof SpawnerTrait){
|
||||||
|
((SpawnerTrait) tile.entity).updateSpawning(this);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
spawner = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setState(UnitState state){
|
public void setState(UnitState state){
|
||||||
this.state.set(state);
|
this.state.set(state);
|
||||||
}
|
}
|
||||||
@@ -254,6 +268,11 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
|
|
||||||
if(hitTime < 0) hitTime = 0;
|
if(hitTime < 0) hitTime = 0;
|
||||||
|
|
||||||
|
if(isDead()){
|
||||||
|
updateRespawning();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(Net.client()){
|
if(Net.client()){
|
||||||
interpolate();
|
interpolate();
|
||||||
status.update(this);
|
status.update(this);
|
||||||
@@ -322,7 +341,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
hitboxTile.setSize(type.hitsizeTile);
|
hitboxTile.setSize(type.hitsizeTile);
|
||||||
state.set(getStartState());
|
state.set(getStartState());
|
||||||
|
|
||||||
heal();
|
health(maxHealth());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -353,6 +372,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
public void write(DataOutput data) throws IOException{
|
public void write(DataOutput data) throws IOException{
|
||||||
super.writeSave(data);
|
super.writeSave(data);
|
||||||
data.writeByte(type.id);
|
data.writeByte(type.id);
|
||||||
|
data.writeInt(spawner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -360,6 +380,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
float lastx = x, lasty = y, lastrot = rotation;
|
float lastx = x, lasty = y, lastrot = rotation;
|
||||||
super.readSave(data);
|
super.readSave(data);
|
||||||
this.type = UnitType.getByID(data.readByte());
|
this.type = UnitType.getByID(data.readByte());
|
||||||
|
this.spawner = data.readInt();
|
||||||
|
|
||||||
interpolator.read(lastx, lasty, x, y, time, rotation);
|
interpolator.read(lastx, lasty, x, y, time, rotation);
|
||||||
rotation = lastrot;
|
rotation = lastrot;
|
||||||
|
|||||||
@@ -65,30 +65,30 @@ public class BlockRenderer{
|
|||||||
int worldy = Mathf.scl(camera.position.y, tilesize) + y;
|
int worldy = Mathf.scl(camera.position.y, tilesize) + y;
|
||||||
boolean expanded = (x < -rangex || x > rangex || y < -rangey || y > rangey);
|
boolean expanded = (x < -rangex || x > rangex || y < -rangey || y > rangey);
|
||||||
|
|
||||||
Tile tile = world.tile(worldx, worldy);
|
synchronized (Tile.tileSetLock) {
|
||||||
|
Tile tile = world.tile(worldx, worldy);
|
||||||
|
|
||||||
if(tile != null){
|
if (tile != null) {
|
||||||
Block block = tile.block();
|
Block block = tile.block();
|
||||||
|
|
||||||
if(!expanded && block != Blocks.air && world.isAccessible(worldx, worldy)){
|
if (!expanded && block != Blocks.air && world.isAccessible(worldx, worldy)) {
|
||||||
synchronized (Tile.tileSetLock) {
|
|
||||||
tile.block().drawShadow(tile);
|
tile.block().drawShadow(tile);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!(block instanceof StaticBlock)){
|
if (!(block instanceof StaticBlock)) {
|
||||||
if(block != Blocks.air){
|
if (block != Blocks.air) {
|
||||||
if(!expanded){
|
if (!expanded) {
|
||||||
addRequest(tile, Layer.block);
|
addRequest(tile, Layer.block);
|
||||||
}
|
|
||||||
|
|
||||||
if(block.expanded || !expanded){
|
|
||||||
if(block.layer != null && block.isLayer(tile)){
|
|
||||||
addRequest(tile, block.layer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block.layer2 != null && block.isLayer2(tile)){
|
if (block.expanded || !expanded) {
|
||||||
addRequest(tile, block.layer2);
|
if (block.layer != null && block.isLayer(tile)) {
|
||||||
|
addRequest(tile, block.layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block.layer2 != null && block.isLayer2(tile)) {
|
||||||
|
addRequest(tile, block.layer2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import io.anuke.ucore.core.Graphics;
|
|||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.function.Callable;
|
import io.anuke.ucore.function.Callable;
|
||||||
import io.anuke.ucore.graphics.CapStyle;
|
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
@@ -123,11 +122,11 @@ public class OverlayRenderer {
|
|||||||
drawbars.run();
|
drawbars.run();
|
||||||
|
|
||||||
if(values[0] > 0){
|
if(values[0] > 0){
|
||||||
drawEncloser(target.drawx(), target.drawy() + block.size * tilesize/2f + 2f + values[0]/2f - 0.5f + (values[0] > 1 ? 0.75f : 0), values[0]);
|
drawEncloser(target.drawx(), target.drawy() + block.size * tilesize/2f + 2f, values[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(values[1] > 0){
|
if(values[1] > 0){
|
||||||
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1]/2f - 0.5f, values[1]);
|
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1], values[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
doDraw[0] = true;
|
doDraw[0] = true;
|
||||||
@@ -208,15 +207,11 @@ public class OverlayRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawEncloser(float x, float y, float height){
|
void drawEncloser(float x, float y, float height){
|
||||||
x -= 0.5f;
|
|
||||||
y += 0.5f - (height-1f)/2f;
|
|
||||||
|
|
||||||
float len = 3;
|
float len = 3;
|
||||||
|
|
||||||
Lines.stroke(2f + height);
|
|
||||||
Draw.color(Palette.bar);
|
Draw.color(Palette.bar);
|
||||||
Lines.line(x - len - 0.5f, y, x + len + 1.5f, y, CapStyle.none);
|
Fill.crect(x - len - 1, y - 1, len*2f + 2f, height + 2f);
|
||||||
|
Draw.color();
|
||||||
Draw.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.graphics;
|
package io.anuke.mindustry.graphics;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Fill;
|
import io.anuke.ucore.graphics.Fill;
|
||||||
@@ -9,14 +10,20 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
|
|
||||||
/**Class that renders a trail.*/
|
/**Class that renders a trail.*/
|
||||||
public class Trail {
|
public class Trail {
|
||||||
|
private final static float maxJump = 15f;
|
||||||
private final int length;
|
private final int length;
|
||||||
private final FloatArray points = new FloatArray();
|
private final FloatArray points = new FloatArray();
|
||||||
|
private float lastX, lastY;
|
||||||
|
|
||||||
public Trail(int length){
|
public Trail(int length){
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void update(float curx, float cury){
|
public synchronized void update(float curx, float cury){
|
||||||
|
if(Vector2.dst(curx, cury, lastX, lastY) >= maxJump){
|
||||||
|
points.clear();
|
||||||
|
}
|
||||||
|
|
||||||
points.add(curx, cury);
|
points.add(curx, cury);
|
||||||
|
|
||||||
if(points.size > length*2) {
|
if(points.size > length*2) {
|
||||||
@@ -24,6 +31,9 @@ public class Trail {
|
|||||||
System.arraycopy(items, 2, items, 0, points.size - 2);
|
System.arraycopy(items, 2, items, 0, points.size - 2);
|
||||||
points.size -= 2;
|
points.size -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastX = curx;
|
||||||
|
lastY = cury;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clear(){
|
public synchronized void clear(){
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public class DefaultKeybinds {
|
|||||||
new Category("General"),
|
new Category("General"),
|
||||||
"move_x", new Axis(Input.A, Input.D),
|
"move_x", new Axis(Input.A, Input.D),
|
||||||
"move_y", new Axis(Input.S, Input.W),
|
"move_y", new Axis(Input.S, Input.W),
|
||||||
"select", Input.MOUSE_LEFT,
|
//"select", Input.MOUSE_LEFT,
|
||||||
"break", Input.MOUSE_RIGHT,
|
//"break", Input.MOUSE_RIGHT,
|
||||||
"shoot", Input.MOUSE_LEFT,
|
//"shoot", Input.MOUSE_LEFT,
|
||||||
"rotate", new Axis(Input.SCROLL),
|
"rotate", new Axis(Input.SCROLL),
|
||||||
"dash", Input.SHIFT_LEFT,
|
"dash", Input.SHIFT_LEFT,
|
||||||
"drop_unit", Input.SHIFT_LEFT,
|
"drop_unit", Input.SHIFT_LEFT,
|
||||||
@@ -39,8 +39,7 @@ public class DefaultKeybinds {
|
|||||||
"chat_history_prev", Input.UP,
|
"chat_history_prev", Input.UP,
|
||||||
"chat_history_next", Input.DOWN,
|
"chat_history_next", Input.DOWN,
|
||||||
"chat_scroll", new Axis(Input.SCROLL),
|
"chat_scroll", new Axis(Input.SCROLL),
|
||||||
"console", Input.GRAVE,
|
"console", Input.GRAVE
|
||||||
"block_logs", Input.I
|
|
||||||
);
|
);
|
||||||
|
|
||||||
KeyBinds.defaultSection(section, DeviceType.controller,
|
KeyBinds.defaultSection(section, DeviceType.controller,
|
||||||
@@ -49,9 +48,9 @@ public class DefaultKeybinds {
|
|||||||
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
|
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
|
||||||
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
|
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
|
||||||
"cursor_y", new Axis(Input.CONTROLLER_R_STICK_VERTICAL_AXIS),
|
"cursor_y", new Axis(Input.CONTROLLER_R_STICK_VERTICAL_AXIS),
|
||||||
"select", Input.CONTROLLER_R_BUMPER,
|
//"select", Input.CONTROLLER_R_BUMPER,
|
||||||
"break", Input.CONTROLLER_L_BUMPER,
|
//"break", Input.CONTROLLER_L_BUMPER,
|
||||||
"shoot", Input.CONTROLLER_R_TRIGGER,
|
//"shoot", Input.CONTROLLER_R_TRIGGER,
|
||||||
"dash", Input.CONTROLLER_Y,
|
"dash", Input.CONTROLLER_Y,
|
||||||
"rotate_alt", new Axis(Input.CONTROLLER_DPAD_RIGHT, Input.CONTROLLER_DPAD_LEFT),
|
"rotate_alt", new Axis(Input.CONTROLLER_DPAD_RIGHT, Input.CONTROLLER_DPAD_LEFT),
|
||||||
"rotate", new Axis(Input.CONTROLLER_A, Input.CONTROLLER_B),
|
"rotate", new Axis(Input.CONTROLLER_A, Input.CONTROLLER_B),
|
||||||
|
|||||||
@@ -300,14 +300,14 @@ public class DesktopInput extends InputHandler{
|
|||||||
if(player.playerIndex > 0){
|
if(player.playerIndex > 0){
|
||||||
controlling = true;
|
controlling = true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(Inputs.keyTap(section,"select")){
|
if(Inputs.keyTap(section,"select")){
|
||||||
Inputs.getProcessor().touchDown((int)getMouseX(), (int)getMouseY(), player.playerIndex, Buttons.LEFT);
|
Inputs.getProcessor().touchDown((int)getMouseX(), (int)getMouseY(), player.playerIndex, Buttons.LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyRelease(section,"select")){
|
if(Inputs.keyRelease(section,"select")){
|
||||||
Inputs.getProcessor().touchUp((int)getMouseX(), (int)getMouseY(), player.playerIndex, Buttons.LEFT);
|
Inputs.getProcessor().touchUp((int)getMouseX(), (int)getMouseY(), player.playerIndex, Buttons.LEFT);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
float xa = Inputs.getAxis(section, "cursor_x");
|
float xa = Inputs.getAxis(section, "cursor_x");
|
||||||
float ya = Inputs.getAxis(section, "cursor_y");
|
float ya = Inputs.getAxis(section, "cursor_y");
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
|||||||
import com.badlogic.gdx.math.Interpolation;
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.Player;
|
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.input.InputHandler;
|
import io.anuke.mindustry.input.InputHandler;
|
||||||
import io.anuke.mindustry.type.Category;
|
import io.anuke.mindustry.type.Category;
|
||||||
@@ -190,7 +189,7 @@ public class BlocksFragment extends Fragment{
|
|||||||
Stack istack = new Stack();
|
Stack istack = new Stack();
|
||||||
for(TextureRegion region : regions){
|
for(TextureRegion region : regions){
|
||||||
Image u = new Image(region);
|
Image u = new Image(region);
|
||||||
u.update(() -> u.setColor(image.isDisabled() ? Color.GRAY : Color.WHITE));
|
u.update(() -> u.setColor(istack.getColor()));
|
||||||
istack.add(u);
|
istack.add(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,35 +235,21 @@ public class BlocksFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
image.setDisabled(() -> {
|
|
||||||
TileEntity entity = players[0].getClosestCore();
|
|
||||||
|
|
||||||
if(entity == null) return true;
|
|
||||||
|
|
||||||
for(ItemStack s : r.requirements){
|
|
||||||
if(!entity.items.hasItem(s.item, Mathf.ceil(s.amount/2f))){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
recipeTable.add(image).size(size + 8);
|
recipeTable.add(image).size(size + 8);
|
||||||
|
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
if(!image.isDisabled()) {
|
image.setChecked(r == control.input(0).recipe);
|
||||||
for (Player player : players) {
|
TileEntity entity = players[0].getClosestCore();
|
||||||
if (control.input(player.playerIndex).recipe == r) {
|
|
||||||
image.setChecked(true);
|
if(entity == null) return;
|
||||||
return;
|
|
||||||
}
|
for(ItemStack s : r.requirements){
|
||||||
|
if(!entity.items.hasItem(s.item, Mathf.ceil(s.amount))){
|
||||||
|
istack.setColor(Color.GRAY);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}/*else{
|
}
|
||||||
if(control.input(0).recipe == r){
|
istack.setColor(Color.WHITE);
|
||||||
control.input(0).recipe = null;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
image.setChecked(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (i % rows == rows - 1) {
|
if (i % rows == rows - 1) {
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ public abstract class BaseBlock {
|
|||||||
|
|
||||||
/**Try dumping a specific item near the tile.*/
|
/**Try dumping a specific item near the tile.*/
|
||||||
public boolean tryDump(Tile tile, Item todump){
|
public boolean tryDump(Tile tile, Item todump){
|
||||||
|
if(tile.entity == null || !hasItems) return false;
|
||||||
|
|
||||||
int size = tile.block().size;
|
int size = tile.block().size;
|
||||||
|
|
||||||
GridPoint2[] nearby = Edges.getEdges(size);
|
GridPoint2[] nearby = Edges.getEdges(size);
|
||||||
|
|||||||
@@ -146,13 +146,17 @@ public class Build {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!type.canPlaceOn(tile)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int offsetx = -(type.size - 1) / 2;
|
int offsetx = -(type.size - 1) / 2;
|
||||||
int offsety = -(type.size - 1) / 2;
|
int offsety = -(type.size - 1) / 2;
|
||||||
for (int dx = 0; dx < type.size; dx++) {
|
for (int dx = 0; dx < type.size; dx++) {
|
||||||
for (int dy = 0; dy < type.size; dy++) {
|
for (int dy = 0; dy < type.size; dy++) {
|
||||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||||
if (other == null || (other.block() != Blocks.air && !other.block().alwaysReplace)
|
if (other == null || (other.block() != Blocks.air && !other.block().alwaysReplace)
|
||||||
|| !type.canPlaceOn(other) || other.cliffs != 0 || !other.floor().placeableOn ||
|
|| other.cliffs != 0 || !other.floor().placeableOn ||
|
||||||
(tile.floor().liquidDrop != null && !type.floating)) {
|
(tile.floor().liquidDrop != null && !type.floating)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,25 @@ public class Tile implements PosTrait, TargetTrait {
|
|||||||
return tmpArray;
|
return tmpArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Returns the list of all tiles linked to this multiblock if it were this block, or an empty array if it's not a multiblock.
|
||||||
|
* This array contains all linked tiles, including this tile itself.*/
|
||||||
|
public synchronized Array<Tile> getLinkedTilesAs(Block block, Array<Tile> tmpArray){
|
||||||
|
tmpArray.clear();
|
||||||
|
if(block.isMultiblock()){
|
||||||
|
int offsetx = -(block.size-1)/2;
|
||||||
|
int offsety = -(block.size-1)/2;
|
||||||
|
for(int dx = 0; dx < block.size; dx ++){
|
||||||
|
for(int dy = 0; dy < block.size; dy ++){
|
||||||
|
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||||
|
tmpArray.add(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
tmpArray.add(this);
|
||||||
|
}
|
||||||
|
return tmpArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**Returns the block the multiblock is linked to, or null if it is not linked to any block.*/
|
/**Returns the block the multiblock is linked to, or null if it is not linked to any block.*/
|
||||||
public Tile getLinked(){
|
public Tile getLinked(){
|
||||||
if(link == 0){
|
if(link == 0){
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.meta.BlockBar;
|
import io.anuke.mindustry.world.meta.BlockBar;
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
import io.anuke.mindustry.world.meta.StatUnit;
|
||||||
|
import io.anuke.mindustry.world.meta.values.LiquidFilterValue;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
@@ -38,6 +39,7 @@ public class NuclearReactor extends PowerGenerator {
|
|||||||
protected float heating = 0.009f; //heating per frame
|
protected float heating = 0.009f; //heating per frame
|
||||||
protected float coolantPower = 0.015f; //how much heat decreases per coolant unit
|
protected float coolantPower = 0.015f; //how much heat decreases per coolant unit
|
||||||
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
||||||
|
protected float maxLiquidUse = 1f; //max liquid use per frame
|
||||||
protected int explosionRadius = 19;
|
protected int explosionRadius = 19;
|
||||||
protected int explosionDamage = 135;
|
protected int explosionDamage = 135;
|
||||||
protected float flashThreshold = 0.46f; //heat threshold at which the lights start flashing
|
protected float flashThreshold = 0.46f; //heat threshold at which the lights start flashing
|
||||||
@@ -49,6 +51,7 @@ public class NuclearReactor extends PowerGenerator {
|
|||||||
liquidCapacity = 50;
|
liquidCapacity = 50;
|
||||||
powerCapacity = 80f;
|
powerCapacity = 80f;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
hasLiquids = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,6 +65,7 @@ public class NuclearReactor extends PowerGenerator {
|
|||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
stats.add(BlockStat.inputItem, generateItem);
|
stats.add(BlockStat.inputItem, generateItem);
|
||||||
|
stats.add(BlockStat.inputLiquid, new LiquidFilterValue(liquid -> liquid.temperature <= 0.5f));
|
||||||
stats.add(BlockStat.maxPowerGeneration, powerMultiplier*60f, StatUnit.powerSecond);
|
stats.add(BlockStat.maxPowerGeneration, powerMultiplier*60f, StatUnit.powerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,12 +89,12 @@ public class NuclearReactor extends PowerGenerator {
|
|||||||
|
|
||||||
if(entity.liquids.liquid.temperature <= 0.5f){ //is coolant
|
if(entity.liquids.liquid.temperature <= 0.5f){ //is coolant
|
||||||
float pow = coolantPower * entity.liquids.liquid.heatCapacity; //heat depleted per unit of liquid
|
float pow = coolantPower * entity.liquids.liquid.heatCapacity; //heat depleted per unit of liquid
|
||||||
float maxUsed = Math.min(entity.liquids.amount, entity.heat / pow); //max that can be cooled in terms of liquid
|
float maxUsed = Math.min(Math.min(entity.liquids.amount, entity.heat / pow), maxLiquidUse * Timers.delta()); //max that can be cooled in terms of liquid
|
||||||
entity.heat -= maxUsed * pow;
|
entity.heat -= maxUsed * pow;
|
||||||
entity.liquids.amount -= maxUsed;
|
entity.liquids.amount -= maxUsed;
|
||||||
}else{ //is heater
|
}else{ //is heater
|
||||||
float heat = coolantPower * entity.liquids.liquid.heatCapacity / 4f; //heat created per unit of liquid
|
float heat = coolantPower * entity.liquids.liquid.heatCapacity / 4f; //heat created per unit of liquid
|
||||||
float maxUsed = Math.min(entity.liquids.amount, (1f - entity.heat) / heat); //max liquid used
|
float maxUsed = Math.min(Math.min(entity.liquids.amount, (1f - entity.heat) / heat), maxLiquidUse * Timers.delta()); //max liquid used
|
||||||
entity.heat += maxUsed * heat;
|
entity.heat += maxUsed * heat;
|
||||||
entity.liquids.amount -= maxUsed;
|
entity.liquids.amount -= maxUsed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class Drill extends Block{
|
|||||||
protected Liquid inputLiquid = Liquids.water;
|
protected Liquid inputLiquid = Liquids.water;
|
||||||
/**Whether the liquid is required to drill. If false, then it will be used as a speed booster.*/
|
/**Whether the liquid is required to drill. If false, then it will be used as a speed booster.*/
|
||||||
protected boolean liquidRequired = false;
|
protected boolean liquidRequired = false;
|
||||||
/**How many times faster the drill will progress when booster by liquid.*/
|
/**How many times faster the drill will progress when boosted by liquid.*/
|
||||||
protected float liquidBoostIntensity = 1.3f;
|
protected float liquidBoostIntensity = 1.6f;
|
||||||
/**Speed at which the drill speeds up.*/
|
/**Speed at which the drill speeds up.*/
|
||||||
protected float warmupSpeed = 0.02f;
|
protected float warmupSpeed = 0.02f;
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ public class Drill extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlaceOn(Tile tile) {
|
public boolean canPlaceOn(Tile tile) {
|
||||||
if(isMultiblock()){
|
if(isMultiblock()){
|
||||||
for(Tile other : tile.getLinkedTiles(drawTiles)){
|
for(Tile other : tile.getLinkedTilesAs(this, drawTiles)){
|
||||||
if(isValid(other)){
|
if(isValid(other)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class Pump extends LiquidBlock{
|
|||||||
public boolean canPlaceOn(Tile tile) {
|
public boolean canPlaceOn(Tile tile) {
|
||||||
if(isMultiblock()){
|
if(isMultiblock()){
|
||||||
Liquid last = null;
|
Liquid last = null;
|
||||||
for(Tile other : tile.getLinkedTiles(drawTiles)){
|
for(Tile other : tile.getLinkedTilesAs(this, drawTiles)){
|
||||||
//can't place pump on block with multiple liquids
|
//can't place pump on block with multiple liquids
|
||||||
if(last != null && other.floor().liquidDrop != last){
|
if(last != null && other.floor().liquidDrop != last){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class SolidPump extends Pump {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlaceOn(Tile tile) {
|
public boolean canPlaceOn(Tile tile) {
|
||||||
if(isMultiblock()){
|
if(isMultiblock()){
|
||||||
for(Tile other : tile.getLinkedTiles(drawTiles)){
|
for(Tile other : tile.getLinkedTilesAs(this, drawTiles)){
|
||||||
if(isValid(other)){
|
if(isValid(other)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import io.anuke.mindustry.entities.Player;
|
|||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
import io.anuke.mindustry.gen.CallBlocks;
|
import io.anuke.mindustry.gen.CallBlocks;
|
||||||
@@ -21,6 +22,7 @@ import io.anuke.mindustry.net.In;
|
|||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemType;
|
import io.anuke.mindustry.type.ItemType;
|
||||||
|
import io.anuke.mindustry.world.BarType;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
@@ -64,6 +66,13 @@ public class CoreBlock extends StorageBlock {
|
|||||||
flags = EnumSet.of(BlockFlag.resupplyPoint, BlockFlag.target);
|
flags = EnumSet.of(BlockFlag.resupplyPoint, BlockFlag.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBars() {
|
||||||
|
super.setBars();
|
||||||
|
|
||||||
|
bars.remove(BarType.inventory);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
super.load();
|
super.load();
|
||||||
@@ -132,7 +141,7 @@ public class CoreBlock extends StorageBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source) {
|
public boolean acceptItem(Item item, Tile tile, Tile source) {
|
||||||
return tile.entity.items.items[item.id]< itemCapacity && item.type == ItemType.material;
|
return tile.entity.items.items[item.id] < itemCapacity && item.type == ItemType.material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,14 +201,13 @@ public class CoreBlock extends StorageBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found){
|
||||||
|
|
||||||
BaseUnit unit = droneType.create(tile.getTeam());
|
BaseUnit unit = droneType.create(tile.getTeam());
|
||||||
entity.droneID = unit.id;
|
unit.setSpawner(tile);
|
||||||
unit.setDead(true);
|
unit.setDead(true);
|
||||||
unit.setGroup(unitGroups[unit.getTeam().ordinal()]);
|
unit.add();
|
||||||
CallBlocks.onCoreUnitSet(tile, unit);
|
|
||||||
unit.setGroup(null);
|
entity.droneID = unit.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,18 +251,17 @@ public class CoreBlock extends StorageBlock {
|
|||||||
entity.currentUnit.rotation = 90f;
|
entity.currentUnit.rotation = 90f;
|
||||||
entity.currentUnit.setNet(tile.drawx(), tile.drawy());
|
entity.currentUnit.setNet(tile.drawx(), tile.drawy());
|
||||||
entity.currentUnit.add();
|
entity.currentUnit.add();
|
||||||
|
|
||||||
if(entity.currentUnit instanceof Player){
|
|
||||||
((Player) entity.currentUnit).baseRotation = 90f;
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.currentUnit = null;
|
entity.currentUnit = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Remote(called = Loc.server, in = In.blocks)
|
||||||
|
public static void setCoreSolid(Tile tile, boolean solid){
|
||||||
|
CoreEntity entity = tile.entity();
|
||||||
|
entity.solid = solid;
|
||||||
|
}
|
||||||
|
/*
|
||||||
@Remote(called = Loc.server, in = In.blocks)
|
@Remote(called = Loc.server, in = In.blocks)
|
||||||
public static void onCoreUnitSet(Tile tile, Unit player){
|
public static void onCoreUnitSet(Tile tile, Unit player){
|
||||||
if(player == null) return;
|
|
||||||
|
|
||||||
CoreEntity entity = tile.entity();
|
CoreEntity entity = tile.entity();
|
||||||
entity.currentUnit = player;
|
entity.currentUnit = player;
|
||||||
entity.progress = 0f;
|
entity.progress = 0f;
|
||||||
@@ -264,14 +271,8 @@ public class CoreBlock extends StorageBlock {
|
|||||||
((Player) player).setRespawning(true);
|
((Player) player).setRespawning(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Remote(called = Loc.server, in = In.blocks)
|
public class CoreEntity extends TileEntity implements SpawnerTrait{
|
||||||
public static void setCoreSolid(Tile tile, boolean solid){
|
|
||||||
CoreEntity entity = tile.entity();
|
|
||||||
entity.solid = solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CoreEntity extends TileEntity{
|
|
||||||
public Unit currentUnit;
|
public Unit currentUnit;
|
||||||
int droneID = -1;
|
int droneID = -1;
|
||||||
boolean solid = true;
|
boolean solid = true;
|
||||||
@@ -280,12 +281,20 @@ public class CoreBlock extends StorageBlock {
|
|||||||
float time;
|
float time;
|
||||||
float heat;
|
float heat;
|
||||||
|
|
||||||
public void trySetPlayer(Player player){
|
@Override
|
||||||
|
public void updateSpawning(Unit unit) {
|
||||||
if(currentUnit == null){
|
if(currentUnit == null){
|
||||||
CallBlocks.onCoreUnitSet(tile, player);
|
currentUnit = unit;
|
||||||
|
progress = 0f;
|
||||||
|
unit.set(tile.drawx(), tile.drawy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpawnProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream stream) throws IOException {
|
public void write(DataOutputStream stream) throws IOException {
|
||||||
stream.writeBoolean(solid);
|
stream.writeBoolean(solid);
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import io.anuke.mindustry.content.Mechs;
|
|||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||||
import io.anuke.mindustry.gen.CallBlocks;
|
import io.anuke.mindustry.gen.CallBlocks;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
@@ -52,7 +54,7 @@ public class MechFactory extends Block{
|
|||||||
public void tapped(Tile tile, Player player) {
|
public void tapped(Tile tile, Player player) {
|
||||||
|
|
||||||
if(checkValidTap(tile, player)){
|
if(checkValidTap(tile, player)){
|
||||||
CallBlocks.onMechFactoryBegin(player, tile);
|
CallBlocks.onMechFactoryTap(player, tile);
|
||||||
}else if(player.isLocal && mobile){
|
}else if(player.isLocal && mobile){
|
||||||
player.moveTarget = tile.entity;
|
player.moveTarget = tile.entity;
|
||||||
}
|
}
|
||||||
@@ -134,19 +136,12 @@ public class MechFactory extends Block{
|
|||||||
return new MechFactoryEntity();
|
return new MechFactoryEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true)
|
@Remote(targets = Loc.both, called = Loc.server, in = In.blocks)
|
||||||
public static void onMechFactoryBegin(Player player, Tile tile){
|
public static void onMechFactoryTap(Player player, Tile tile){
|
||||||
if(!checkValidTap(tile, player)) return;
|
if(!checkValidTap(tile, player)) return;
|
||||||
|
|
||||||
MechFactoryEntity entity = tile.entity();
|
MechFactoryEntity entity = tile.entity();
|
||||||
entity.progress = 0f;
|
player.beginRespawning(entity);
|
||||||
entity.player = player;
|
|
||||||
|
|
||||||
player.rotation = 90f;
|
|
||||||
player.baseRotation = 90f;
|
|
||||||
player.set(entity.x, entity.y);
|
|
||||||
player.setDead(true);
|
|
||||||
player.setRespawning(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server, in = In.blocks)
|
@Remote(called = Loc.server, in = In.blocks)
|
||||||
@@ -179,12 +174,32 @@ public class MechFactory extends Block{
|
|||||||
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize / 2f && entity.player == null;
|
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize / 2f && entity.player == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MechFactoryEntity extends TileEntity{
|
public class MechFactoryEntity extends TileEntity implements SpawnerTrait{
|
||||||
public Player player;
|
Player player;
|
||||||
public float progress;
|
float progress;
|
||||||
public float time;
|
float time;
|
||||||
public float heat;
|
float heat;
|
||||||
public boolean open;
|
boolean open;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSpawning(Unit unit) {
|
||||||
|
if(!(unit instanceof Player)) throw new IllegalArgumentException("Mech factories only accept player respawners.");
|
||||||
|
|
||||||
|
if(player == null){
|
||||||
|
progress = 0f;
|
||||||
|
player = (Player)unit;
|
||||||
|
|
||||||
|
player.rotation = 90f;
|
||||||
|
player.baseRotation = 90f;
|
||||||
|
player.set(x, y);
|
||||||
|
player.beginRespawning(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpawnProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream stream) throws IOException {
|
public void write(DataOutputStream stream) throws IOException {
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import io.anuke.mindustry.Vars;
|
|||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||||
import io.anuke.mindustry.gen.CallBlocks;
|
import io.anuke.mindustry.gen.CallBlocks;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
@@ -28,6 +30,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
|
//TODO re-implement properly
|
||||||
public class Reconstructor extends Block{
|
public class Reconstructor extends Block{
|
||||||
protected float departTime = 30f;
|
protected float departTime = 30f;
|
||||||
protected float arriveTime = 40f;
|
protected float arriveTime = 40f;
|
||||||
@@ -117,9 +120,9 @@ public class Reconstructor extends Block{
|
|||||||
if(entity.current != null){
|
if(entity.current != null){
|
||||||
float progress = entity.departing ? entity.updateTime : (1f - entity.updateTime);
|
float progress = entity.departing ? entity.updateTime : (1f - entity.updateTime);
|
||||||
|
|
||||||
Player player = entity.current;
|
//Player player = entity.current;
|
||||||
|
|
||||||
TextureRegion region = player.mech.iconRegion;
|
TextureRegion region = entity.current.getIconRegion();
|
||||||
|
|
||||||
Shaders.build.region = region;
|
Shaders.build.region = region;
|
||||||
Shaders.build.progress = progress;
|
Shaders.build.progress = progress;
|
||||||
@@ -157,7 +160,7 @@ public class Reconstructor extends Block{
|
|||||||
if(entity.departing){
|
if(entity.departing){
|
||||||
//force respawn if there's suddenly nothing to link to
|
//force respawn if there's suddenly nothing to link to
|
||||||
if(!validLink(tile, entity.link)){
|
if(!validLink(tile, entity.link)){
|
||||||
entity.current.setRespawning(false);
|
//entity.current.setRespawning(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +171,7 @@ public class Reconstructor extends Block{
|
|||||||
//no power? death.
|
//no power? death.
|
||||||
if(other.power.amount < powerPerTeleport){
|
if(other.power.amount < powerPerTeleport){
|
||||||
entity.current.setDead(true);
|
entity.current.setDead(true);
|
||||||
entity.current.setRespawning(false);
|
//entity.current.setRespawning(false);
|
||||||
entity.current = null;
|
entity.current = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -263,8 +266,8 @@ public class Reconstructor extends Block{
|
|||||||
player.rotation = 90f;
|
player.rotation = 90f;
|
||||||
player.baseRotation = 90f;
|
player.baseRotation = 90f;
|
||||||
player.setDead(true);
|
player.setDead(true);
|
||||||
player.setRespawning(true);
|
// player.setRespawning(true);
|
||||||
player.setRespawning();
|
//player.setRespawning();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true)
|
@Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true)
|
||||||
@@ -300,12 +303,22 @@ public class Reconstructor extends Block{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReconstructorEntity extends TileEntity{
|
public class ReconstructorEntity extends TileEntity implements SpawnerTrait{
|
||||||
public Player current;
|
Unit current;
|
||||||
public float updateTime;
|
float updateTime;
|
||||||
public float time;
|
float time;
|
||||||
public int link;
|
int link;
|
||||||
public boolean solid = true, departing;
|
boolean solid = true, departing;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSpawning(Unit unit) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpawnProgress() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream stream) throws IOException {
|
public void write(DataOutputStream stream) throws IOException {
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class UnitFactory extends Block {
|
|||||||
|
|
||||||
if(!Net.client()) {
|
if(!Net.client()) {
|
||||||
BaseUnit unit = factory.type.create(tile.getTeam());
|
BaseUnit unit = factory.type.create(tile.getTeam());
|
||||||
unit.setSpawner(entity);
|
unit.setSpawner(tile);
|
||||||
unit.set(tile.drawx(), tile.drawy());
|
unit.set(tile.drawx(), tile.drawy());
|
||||||
unit.add();
|
unit.add();
|
||||||
unit.getVelocity().y = factory.launchVelocity;
|
unit.getVelocity().y = factory.launchVelocity;
|
||||||
|
|||||||
Reference in New Issue
Block a user