Payload support

This commit is contained in:
Anuken
2020-05-27 18:11:42 -04:00
parent bcadcb18bc
commit 92d265402b
39 changed files with 889 additions and 715 deletions
@@ -287,19 +287,16 @@ public class MassDriver extends Block{
}
protected boolean shooterValid(Tile other){
if(other == null) return true;
if(!(other.block() instanceof MassDriver)) return false;
MassDriverEntity entity = other.ent();
return link == tile.pos() && tile.dst(other) <= range;
return entity.link == tile.pos() && tile.dst(other) <= range;
}
protected boolean linkValid(){
if(tile == null) return false;
if(link == -1) return false;
Tilec link = world.ent(this.link);
return link != null && link.block() instanceof MassDriver && link.team() == team && tile.dst(link) <= range;
Tile link = world.tile(this.link);
return link != null && link.block() instanceof MassDriver && link.team() == tile.team() && tile.dst(link) <= range;
}
@Override
@@ -17,6 +17,10 @@ public class BlockPayload implements Payload{
this.entity = block.newEntity().create(block, team);
}
public BlockPayload(Tilec entity){
this.entity = entity;
}
public Block block(){
return entity.block();
}
@@ -1,5 +1,6 @@
package mindustry.world.blocks.production;
import arc.scene.ui.layout.*;
import arc.util.ArcAnnotate.*;
import arc.util.io.*;
import mindustry.*;
@@ -16,6 +17,7 @@ public class ResearchBlock extends Block{
solid = true;
hasPower = true;
hasItems = true;
configurable = true;
}
public class ResearchBlockEntity extends TileEntity{
@@ -26,6 +28,11 @@ public class ResearchBlock extends Block{
}
@Override
public void buildConfiguration(Table table){
}
@Override
public void write(Writes write){
super.write(write);
@@ -54,6 +54,8 @@ public class LaunchPad extends Block{
public void draw(){
super.draw();
if(!Vars.state.isCampaign()) return;
if(lightRegion.found()){
Draw.color(lightColor);
float progress = Math.min((float)items.total() / itemCapacity, timer.getTime(timerLaunch) / (launchTime / timeScale));
@@ -89,6 +91,7 @@ public class LaunchPad extends Block{
@Override
public void updateTile(){
if(!Vars.state.isCampaign()) return;
//launch when full and base conditions are met
if(items.total() >= itemCapacity && efficiency() >= 1f && timer(timerLaunch, launchTime / timeScale)){