Correct names for buildings
This commit is contained in:
@@ -261,7 +261,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
}
|
||||
|
||||
//TODO move
|
||||
public void handleLaunch(CoreEntity tile){
|
||||
public void handleLaunch(CoreBuild tile){
|
||||
LaunchCorec ent = LaunchCore.create();
|
||||
ent.set(tile);
|
||||
ent.block(Blocks.coreShard);
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Logic implements ApplicationListener{
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
if(state.isCampaign()){
|
||||
long seconds = state.rules.sector.getSecondsPassed();
|
||||
CoreEntity core = state.rules.defaultTeam.core();
|
||||
CoreBuild core = state.rules.defaultTeam.core();
|
||||
|
||||
//apply fractional damage based on how many turns have passed for this sector
|
||||
float turnsPassed = seconds / (turnDuration / 60f);
|
||||
|
||||
@@ -803,11 +803,11 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
public void writeEntitySnapshot(Player player) throws IOException{
|
||||
syncStream.reset();
|
||||
Seq<CoreEntity> cores = state.teams.cores(player.team());
|
||||
Seq<CoreBuild> cores = state.teams.cores(player.team());
|
||||
|
||||
dataStream.writeByte(cores.size);
|
||||
|
||||
for(CoreEntity entity : cores){
|
||||
for(CoreBuild entity : cores){
|
||||
dataStream.writeInt(entity.tile().pos());
|
||||
entity.items.write(Writes.get(dataStream));
|
||||
}
|
||||
|
||||
@@ -54,11 +54,13 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
return unit instanceof Minerc;
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity closestCore(){
|
||||
public @Nullable
|
||||
CoreBuild closestCore(){
|
||||
return state.teams.closestCore(x, y, team);
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity core(){
|
||||
public @Nullable
|
||||
CoreBuild core(){
|
||||
return team.core();
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
clearUnit();
|
||||
}
|
||||
|
||||
CoreEntity core = closestCore();
|
||||
CoreBuild core = closestCore();
|
||||
|
||||
if(!dead()){
|
||||
set(unit);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SectorInfo{
|
||||
//update core items
|
||||
coreItems.clear();
|
||||
|
||||
CoreEntity entity = state.rules.defaultTeam.core();
|
||||
CoreBuild entity = state.rules.defaultTeam.core();
|
||||
|
||||
if(entity != null){
|
||||
ItemModule items = entity.items;
|
||||
@@ -97,7 +97,7 @@ public class SectorInfo{
|
||||
updateCoreDeltas();
|
||||
}
|
||||
|
||||
CoreEntity ent = state.rules.defaultTeam.core();
|
||||
CoreBuild ent = state.rules.defaultTeam.core();
|
||||
|
||||
//refresh throughput
|
||||
if(time.get(refreshPeriod)){
|
||||
@@ -141,7 +141,7 @@ public class SectorInfo{
|
||||
}
|
||||
|
||||
private void updateCoreDeltas(){
|
||||
CoreEntity ent = state.rules.defaultTeam.core();
|
||||
CoreBuild ent = state.rules.defaultTeam.core();
|
||||
for(int i = 0; i < lastCoreItems.length; i++){
|
||||
lastCoreItems[i] = ent == null ? 0 : ent.items.get(i);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ public class Team implements Comparable<Team>{
|
||||
return state.teams.get(this);
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity core(){
|
||||
public @Nullable
|
||||
CoreBuild core(){
|
||||
return data().core();
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ public class Team implements Comparable<Team>{
|
||||
return state.teams.areEnemies(this, other);
|
||||
}
|
||||
|
||||
public Seq<CoreEntity> cores(){
|
||||
public Seq<CoreBuild> cores(){
|
||||
return state.teams.cores(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,17 @@ public class Teams{
|
||||
active.add(get(Team.crux));
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity closestEnemyCore(float x, float y, Team team){
|
||||
public @Nullable
|
||||
CoreBuild closestEnemyCore(float x, float y, Team team){
|
||||
for(Team enemy : team.enemies()){
|
||||
CoreEntity tile = Geometry.findClosest(x, y, enemy.cores());
|
||||
CoreBuild tile = Geometry.findClosest(x, y, enemy.cores());
|
||||
if(tile != null) return tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity closestCore(float x, float y, Team team){
|
||||
public @Nullable
|
||||
CoreBuild closestCore(float x, float y, Team team){
|
||||
return Geometry.findClosest(x, y, get(team).cores);
|
||||
}
|
||||
|
||||
@@ -37,10 +39,10 @@ public class Teams{
|
||||
return get(team).enemies;
|
||||
}
|
||||
|
||||
public boolean eachEnemyCore(Team team, Boolf<CoreEntity> ret){
|
||||
public boolean eachEnemyCore(Team team, Boolf<CoreBuild> ret){
|
||||
for(TeamData data : active){
|
||||
if(areEnemies(team, data.team)){
|
||||
for(CoreEntity tile : data.cores){
|
||||
for(CoreBuild tile : data.cores){
|
||||
if(ret.get(tile)){
|
||||
return true;
|
||||
}
|
||||
@@ -68,12 +70,12 @@ public class Teams{
|
||||
return map[team.id];
|
||||
}
|
||||
|
||||
public Seq<CoreEntity> playerCores(){
|
||||
public Seq<CoreBuild> playerCores(){
|
||||
return get(state.rules.defaultTeam).cores;
|
||||
}
|
||||
|
||||
/** Do not modify! */
|
||||
public Seq<CoreEntity> cores(Team team){
|
||||
public Seq<CoreBuild> cores(Team team){
|
||||
return get(team).cores;
|
||||
}
|
||||
|
||||
@@ -98,7 +100,7 @@ public class Teams{
|
||||
return active;
|
||||
}
|
||||
|
||||
public void registerCore(CoreEntity core){
|
||||
public void registerCore(CoreBuild core){
|
||||
TeamData data = get(core.team());
|
||||
//add core if not present
|
||||
if(!data.cores.contains(core)){
|
||||
@@ -113,7 +115,7 @@ public class Teams{
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterCore(CoreEntity entity){
|
||||
public void unregisterCore(CoreBuild entity){
|
||||
TeamData data = get(entity.team());
|
||||
//remove core
|
||||
data.cores.remove(entity);
|
||||
@@ -143,7 +145,7 @@ public class Teams{
|
||||
}
|
||||
|
||||
public class TeamData{
|
||||
public final Seq<CoreEntity> cores = new Seq<>();
|
||||
public final Seq<CoreBuild> cores = new Seq<>();
|
||||
public final Team team;
|
||||
public final BaseAI ai;
|
||||
public Team[] enemies = {};
|
||||
@@ -166,7 +168,8 @@ public class Teams{
|
||||
return cores.isEmpty();
|
||||
}
|
||||
|
||||
public @Nullable CoreEntity core(){
|
||||
public @Nullable
|
||||
CoreBuild core(){
|
||||
return cores.isEmpty() ? null : cores.first();
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void unitControl(Player player, @Nullable Unit unit){
|
||||
//clear player unit when they possess a core
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreEntity)){
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreBuild)){
|
||||
Fx.spawn.at(player);
|
||||
player.clearUnit();
|
||||
player.deathTimer(60f); //for instant respawn
|
||||
|
||||
@@ -178,8 +178,8 @@ public class LExecutor{
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
if(from instanceof MemoryEntity){
|
||||
MemoryEntity mem = (MemoryEntity)from;
|
||||
if(from instanceof MemoryBuild){
|
||||
MemoryBuild mem = (MemoryBuild)from;
|
||||
|
||||
exec.setnum(output, address < 0 || address >= mem.memory.length ? 0 : mem.memory[address]);
|
||||
}
|
||||
@@ -203,8 +203,8 @@ public class LExecutor{
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
if(from instanceof MemoryEntity){
|
||||
MemoryEntity mem = (MemoryEntity)from;
|
||||
if(from instanceof MemoryBuild){
|
||||
MemoryBuild mem = (MemoryBuild)from;
|
||||
|
||||
if(address >= 0 && address < mem.memory.length){
|
||||
mem.memory[address] = exec.num(value);
|
||||
@@ -449,8 +449,8 @@ public class LExecutor{
|
||||
if(Vars.headless) return;
|
||||
|
||||
Building build = exec.building(target);
|
||||
if(build instanceof LogicDisplayEntity){
|
||||
LogicDisplayEntity d = (LogicDisplayEntity)build;
|
||||
if(build instanceof LogicDisplayBuild){
|
||||
LogicDisplayBuild d = (LogicDisplayBuild)build;
|
||||
for(int i = 0; i < exec.graphicsBuffer.size; i++){
|
||||
d.commands.addLast(exec.graphicsBuffer.items[i]);
|
||||
}
|
||||
@@ -504,8 +504,8 @@ public class LExecutor{
|
||||
public void run(LExecutor exec){
|
||||
|
||||
Building build = exec.building(target);
|
||||
if(build instanceof MessageBlockEntity){
|
||||
MessageBlockEntity d = (MessageBlockEntity)build;
|
||||
if(build instanceof MessageBuild){
|
||||
MessageBuild d = (MessageBuild)build;
|
||||
|
||||
d.message.setLength(0);
|
||||
d.message.append(exec.textBuffer, 0, Math.min(exec.textBuffer.length(), maxTextBuffer));
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CoreItemsDisplay extends Table{
|
||||
margin(4);
|
||||
|
||||
update(() -> {
|
||||
CoreEntity core = Vars.player.team().core();
|
||||
CoreBuild core = Vars.player.team().core();
|
||||
|
||||
for(Item item : content.items()){
|
||||
if(core != null && core.items.get(item) > 0 && usedItems.add(item)){
|
||||
@@ -38,7 +38,7 @@ public class CoreItemsDisplay extends Table{
|
||||
|
||||
int i = 0;
|
||||
|
||||
CoreEntity core = Vars.player.team().core();
|
||||
CoreBuild core = Vars.player.team().core();
|
||||
for(Item item : content.items()){
|
||||
if(usedItems.contains(item)){
|
||||
image(item.icon(Cicon.small)).padRight(3);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
private int launchRange;
|
||||
private float zoom = 1f, selectAlpha = 1f;
|
||||
private @Nullable Sector selected, hovered, launchSector;
|
||||
private CoreEntity launcher;
|
||||
private CoreBuild launcher;
|
||||
private Mode mode = look;
|
||||
private boolean launching;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
return super.show();
|
||||
}
|
||||
|
||||
public void show(Sector sector, CoreEntity launcher){
|
||||
public void show(Sector sector, CoreBuild launcher){
|
||||
this.launcher = launcher;
|
||||
selected = null;
|
||||
hovered = null;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class LaunchPad extends Block{
|
||||
bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity));
|
||||
}
|
||||
|
||||
public class LaunchPadEntity extends Building{
|
||||
public class LaunchPadBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
package mindustry.world.blocks.campaign;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ResearchBlock extends Block{
|
||||
public float researchSpeed = 1f;
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
|
||||
public ResearchBlock(String name){
|
||||
super(name);
|
||||
|
||||
update = true;
|
||||
solid = true;
|
||||
hasPower = true;
|
||||
hasItems = true;
|
||||
configurable = true;
|
||||
itemCapacity = 100;
|
||||
|
||||
//TODO requirements shrink as time goes on
|
||||
consumes.add(new ConsumeItemDynamic((ResearchBlockEntity entity) -> entity.researching != null ? entity.researching.requirements : ItemStack.empty));
|
||||
config(TechNode.class, ResearchBlockEntity::setTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outputsItems(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("progress", (ResearchBlockEntity e) -> new Bar("bar.progress", Pal.ammo, () -> e.researching == null ? 0f : e.researching.progress / e.researching.time));
|
||||
}
|
||||
|
||||
public class ResearchBlockEntity extends Building{
|
||||
public @Nullable TechNode researching;
|
||||
|
||||
public double[] accumulator;
|
||||
public double[] totalAccumulator;
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(researching != null){
|
||||
//don't research something that is already researched
|
||||
if(researching.content.unlocked()){
|
||||
setTo(null);
|
||||
}else{
|
||||
double totalTicks = researching.time * 60.0;
|
||||
double amount = researchSpeed * edelta() / totalTicks;
|
||||
|
||||
double maxProgress = checkRequired(amount, false);
|
||||
|
||||
for(int i = 0; i < researching.requirements.length; i++){
|
||||
int reqamount = Math.round(state.rules.buildCostMultiplier * researching.requirements[i].amount);
|
||||
accumulator[i] += Math.min(reqamount * maxProgress, reqamount - totalAccumulator[i] + 0.00001); //add min amount progressed to the accumulator
|
||||
totalAccumulator[i] = Math.min(totalAccumulator[i] + reqamount * maxProgress, reqamount);
|
||||
}
|
||||
|
||||
maxProgress = checkRequired(maxProgress, true);
|
||||
|
||||
float increment = (float)(maxProgress * researching.time);
|
||||
researching.progress += increment;
|
||||
|
||||
//check if it has been researched
|
||||
if(researching.progress >= researching.time){
|
||||
researching.content.unlock();
|
||||
|
||||
setTo(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double checkRequired(double amount, boolean remove){
|
||||
double maxProgress = amount;
|
||||
|
||||
for(int i = 0; i < researching.requirements.length; i++){
|
||||
int ramount = researching.requirements[i].amount;
|
||||
int required = (int)(accumulator[i]); //calculate items that are required now
|
||||
|
||||
if(!items.has(researching.requirements[i].item) && ramount > 0){
|
||||
maxProgress = 0f;
|
||||
}else if(required > 0){ //if this amount is positive...
|
||||
//calculate how many items it can actually use
|
||||
int maxUse = Math.min(required, items.get(researching.requirements[i].item));
|
||||
//get this as a fraction
|
||||
double fraction = maxUse / (double)required;
|
||||
|
||||
//move max progress down if this fraction is less than 1
|
||||
maxProgress = Math.min(maxProgress, maxProgress * fraction);
|
||||
|
||||
accumulator[i] -= maxUse;
|
||||
|
||||
//remove stuff that is actually used
|
||||
if(remove){
|
||||
items.remove(researching.requirements[i].item, maxUse);
|
||||
}
|
||||
}
|
||||
//else, no items are required yet, so just keep going
|
||||
}
|
||||
|
||||
return maxProgress;
|
||||
}
|
||||
|
||||
private void setTo(@Nullable TechNode value){
|
||||
researching = value;
|
||||
if(value != null){
|
||||
accumulator = new double[researching.requirements.length];
|
||||
totalAccumulator = new double[researching.requirements.length];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
super.display(table);
|
||||
|
||||
TextureRegionDrawable reg = new TextureRegionDrawable();
|
||||
|
||||
table.row();
|
||||
table.table(t -> {
|
||||
t.image().update(i -> {
|
||||
i.setDrawable(researching == null ? Icon.cancel : reg.set(researching.content.icon(Cicon.medium)));
|
||||
i.setScaling(Scaling.fit);
|
||||
i.setColor(researching == null ? Color.lightGray : Color.white);
|
||||
}).size(32).pad(3);
|
||||
t.label(() -> researching == null ? "@none" : researching.content.localizedName).color(Color.lightGray);
|
||||
}).left().padTop(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
Draw.mixcol(Color.white, Mathf.absin(10f, 0.2f));
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
return items.get(item) < getMaximumAccepted(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Item item){
|
||||
if(researching == null) return 0;
|
||||
for(int i = 0; i < researching.requirements.length; i++){
|
||||
if(researching.requirements[i].item == item) return researching.requirements[i].amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configTapped(){
|
||||
//configure with tech node
|
||||
ui.showInfo("this does nothing");
|
||||
//ui.research.show(node -> {
|
||||
// configure(node);
|
||||
// ui.research.hide();
|
||||
//});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
|
||||
if(researching != null){
|
||||
write.b(researching.content.getContentType().ordinal());
|
||||
write.s(researching.content.id);
|
||||
}else{
|
||||
write.b(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
|
||||
byte type = read.b();
|
||||
if(type != -1){
|
||||
setTo(TechTree.get(content.getByID(ContentType.all[type], read.s())));
|
||||
}else{
|
||||
researching = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.world.blocks.defense.Door.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -32,10 +31,10 @@ public class Door extends Wall{
|
||||
solidifes = true;
|
||||
consumesTap = true;
|
||||
|
||||
config(Boolean.class, (DoorEntity base, Boolean open) -> {
|
||||
config(Boolean.class, (DoorBuild base, Boolean open) -> {
|
||||
Sounds.door.at(base);
|
||||
|
||||
for(DoorEntity entity : base.chained){
|
||||
for(DoorBuild entity : base.chained){
|
||||
//skip doors with things in them
|
||||
if((Units.anyEntities(entity.tile) && !open) || entity.open == open){
|
||||
continue;
|
||||
@@ -53,9 +52,9 @@ public class Door extends Wall{
|
||||
return req.config == Boolean.TRUE ? openRegion : region;
|
||||
}
|
||||
|
||||
public class DoorEntity extends Building{
|
||||
public class DoorBuild extends Building{
|
||||
public boolean open = false;
|
||||
public ObjectSet<DoorEntity> chained = new ObjectSet<>();
|
||||
public ObjectSet<DoorBuild> chained = new ObjectSet<>();
|
||||
|
||||
@Override
|
||||
public void onProximityAdded(){
|
||||
@@ -68,8 +67,8 @@ public class Door extends Wall{
|
||||
super.onProximityRemoved();
|
||||
|
||||
for(Building b : proximity){
|
||||
if(b instanceof DoorEntity){
|
||||
((DoorEntity)b).updateChained();
|
||||
if(b instanceof DoorBuild){
|
||||
((DoorBuild)b).updateChained();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,14 +95,14 @@ public class Door extends Wall{
|
||||
flow(chained);
|
||||
}
|
||||
|
||||
public void flow(ObjectSet<DoorEntity> set){
|
||||
public void flow(ObjectSet<DoorBuild> set){
|
||||
if(!set.add(this)) return;
|
||||
|
||||
this.chained = set;
|
||||
|
||||
for(Building b : proximity){
|
||||
if(b instanceof DoorEntity){
|
||||
((DoorEntity)b).flow(set);
|
||||
if(b instanceof DoorBuild){
|
||||
((DoorBuild)b).flow(set);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Wall extends Block{
|
||||
return super.canReplace(other) && health > other.health && size == other.size;
|
||||
}
|
||||
|
||||
public class WallEntity extends Building{
|
||||
public class WallBuild extends Building{
|
||||
public float hit;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ChargeTurret extends PowerTurret{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public class ChargeTurretEntity extends PowerTurretEntity{
|
||||
public class ChargeTurretBuild extends PowerTurretBuild{
|
||||
public boolean shooting;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ItemTurret extends Turret{
|
||||
public void build(Building tile, Table table){
|
||||
MultiReqImage image = new MultiReqImage();
|
||||
content.items().each(i -> filter.get(i) && i.unlockedNow(), item -> image.add(new ReqImage(new ItemImage(item.icon(Cicon.medium)),
|
||||
() -> tile != null && !((ItemTurretEntity)tile).ammo.isEmpty() && ((ItemEntry)((ItemTurretEntity)tile).ammo.peek()).item == item)));
|
||||
() -> tile != null && !((ItemTurretBuild)tile).ammo.isEmpty() && ((ItemEntry)((ItemTurretBuild)tile).ammo.peek()).item == item)));
|
||||
|
||||
table.add(image).size(8 * 4);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class ItemTurret extends Turret{
|
||||
@Override
|
||||
public boolean valid(Building entity){
|
||||
//valid when there's any ammo in the turret
|
||||
return !((ItemTurretEntity)entity).ammo.isEmpty();
|
||||
return !((ItemTurretBuild)entity).ammo.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +61,7 @@ public class ItemTurret extends Turret{
|
||||
});
|
||||
}
|
||||
|
||||
public class ItemTurretEntity extends TurretEntity{
|
||||
public class ItemTurretBuild extends TurretBuild{
|
||||
@Override
|
||||
public void onProximityAdded(){
|
||||
super.onProximityAdded();
|
||||
|
||||
@@ -25,7 +25,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
consumes.powerCond(powerUse, entity -> ((LaserTurretEntity)entity).bullet != null || ((LaserTurretEntity)entity).target != null);
|
||||
consumes.powerCond(powerUse, entity -> ((LaserTurretBuild)entity).bullet != null || ((LaserTurretBuild)entity).target != null);
|
||||
super.init();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class LaserTurret extends PowerTurret{
|
||||
stats.add(BlockStat.damage, shootType.damage * 60f / 5f, StatUnit.perSecond);
|
||||
}
|
||||
|
||||
public class LaserTurretEntity extends PowerTurretEntity{
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
Bullet bullet;
|
||||
float bulletLife;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class LiquidTurret extends Turret{
|
||||
});
|
||||
}
|
||||
|
||||
public class LiquidTurretEntity extends TurretEntity{
|
||||
public class LiquidTurretBuild extends TurretBuild{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
|
||||
@@ -22,11 +22,11 @@ public class PowerTurret extends Turret{
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
consumes.powerCond(powerUse, entity -> ((TurretEntity)entity).target != null);
|
||||
consumes.powerCond(powerUse, entity -> ((TurretBuild)entity).target != null);
|
||||
super.init();
|
||||
}
|
||||
|
||||
public class PowerTurretEntity extends TurretEntity{
|
||||
public class PowerTurretBuild extends TurretBuild{
|
||||
|
||||
@Override
|
||||
public BulletType useAmmo(){
|
||||
|
||||
@@ -74,8 +74,8 @@ public abstract class Turret extends Block{
|
||||
public @Load("block-@size") TextureRegion baseRegion;
|
||||
public @Load("@-heat") TextureRegion heatRegion;
|
||||
|
||||
public Cons<TurretEntity> drawer = tile -> Draw.rect(region, tile.x + tr2.x, tile.y + tr2.y, tile.rotation - 90);
|
||||
public Cons<TurretEntity> heatDrawer = tile -> {
|
||||
public Cons<TurretBuild> drawer = tile -> Draw.rect(region, tile.x + tr2.x, tile.y + tr2.y, tile.rotation - 90);
|
||||
public Cons<TurretBuild> heatDrawer = tile -> {
|
||||
if(tile.heat <= 0.00001f) return;
|
||||
Draw.color(heatColor, tile.heat);
|
||||
Draw.blend(Blending.additive);
|
||||
@@ -141,7 +141,7 @@ public abstract class Turret extends Block{
|
||||
public abstract BulletType type();
|
||||
}
|
||||
|
||||
public class TurretEntity extends Building implements ControlBlock, Ranged{
|
||||
public class TurretBuild extends Building implements ControlBlock, Ranged{
|
||||
public Seq<AmmoEntry> ammo = new Seq<>();
|
||||
public int totalAmmo;
|
||||
public float reload, rotation = 90, recoil, heat, logicControlTime = -1;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ArmoredConveyor extends Conveyor{
|
||||
return otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}
|
||||
|
||||
public class ArmoredConveyorEntity extends ConveyorEntity{
|
||||
public class ArmoredConveyorBuild extends ConveyorBuild{
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
return super.acceptItem(source, item) && (source.block() instanceof Conveyor || Edges.getFacingEdge(source.tile(), tile).relativeTo(tile) == rotation);
|
||||
|
||||
@@ -19,7 +19,7 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
||||
canOverdrive = true;
|
||||
}
|
||||
|
||||
public class BufferedItemBridgeEntity extends ExtendingItemBridgeEntity{
|
||||
public class BufferedItemBridgeBuild extends ExtendingItemBridgeBuild{
|
||||
ItemBuffer buffer = new ItemBuffer(bufferCapacity);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,7 +92,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
Mathf.mod(req.tile().build.rotation - req.rotation, 2) == 1 ? Blocks.junction : this;
|
||||
}
|
||||
|
||||
public class ConveyorEntity extends Building{
|
||||
public class ConveyorBuild extends Building{
|
||||
//parallel array data
|
||||
public Item[] ids = new Item[capacity];
|
||||
public float[] xs = new float[capacity];
|
||||
@@ -101,7 +101,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
public int len = 0;
|
||||
//next entity
|
||||
public @Nullable Building next;
|
||||
public @Nullable ConveyorEntity nextc;
|
||||
public @Nullable ConveyorBuild nextc;
|
||||
//whether the next conveyor's rotation == tile rotation
|
||||
public boolean aligned;
|
||||
|
||||
@@ -163,7 +163,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
if(front() != null && front() != null){
|
||||
next = front();
|
||||
nextc = next instanceof ConveyorEntity && next.team() == team ? (ConveyorEntity)next : null;
|
||||
nextc = next instanceof ConveyorBuild && next.team() == team ? (ConveyorBuild)next : null;
|
||||
aligned = nextc != null && rotation == next.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
public class ExtendingItemBridgeEntity extends ItemBridgeEntity{
|
||||
public class ExtendingItemBridgeBuild extends ItemBridgeBuild{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
|
||||
@@ -44,9 +44,9 @@ public class ItemBridge extends Block{
|
||||
canOverdrive = false;
|
||||
|
||||
//point2 config is relative
|
||||
config(Point2.class, (ItemBridgeEntity tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY()));
|
||||
config(Point2.class, (ItemBridgeBuild tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY()));
|
||||
//integer is not
|
||||
config(Integer.class, (ItemBridgeEntity tile, Integer i) -> tile.link = i);
|
||||
config(Integer.class, (ItemBridgeBuild tile, Integer i) -> tile.link = i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,7 +114,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
return ((other.block() == tile.block() && tile.block() == this) || (!(tile.block() instanceof ItemBridge) && other.block() == this))
|
||||
&& (other.team() == tile.team() || tile.block() != this)
|
||||
&& (!checkDouble || other.<ItemBridgeEntity>bc().link != tile.pos());
|
||||
&& (!checkDouble || other.<ItemBridgeBuild>bc().link != tile.pos());
|
||||
}
|
||||
|
||||
public Tile findLink(int x, int y){
|
||||
@@ -124,7 +124,7 @@ public class ItemBridge extends Block{
|
||||
return null;
|
||||
}
|
||||
|
||||
public class ItemBridgeEntity extends Building{
|
||||
public class ItemBridgeBuild extends Building{
|
||||
public int link = -1;
|
||||
public IntSet incoming = new IntSet();
|
||||
public float uptime;
|
||||
@@ -208,7 +208,7 @@ public class ItemBridge extends Block{
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
//reverse connection
|
||||
if(other instanceof ItemBridgeEntity && ((ItemBridgeEntity)other).link == pos()){
|
||||
if(other instanceof ItemBridgeBuild && ((ItemBridgeBuild)other).link == pos()){
|
||||
configure(other.pos());
|
||||
other.configure(-1);
|
||||
return true;
|
||||
@@ -230,7 +230,7 @@ public class ItemBridge extends Block{
|
||||
while(it.hasNext){
|
||||
int i = it.next();
|
||||
Tile other = world.tile(i);
|
||||
if(!linkValid(tile, other, false) || other.<ItemBridgeEntity>bc().link != tile.pos()){
|
||||
if(!linkValid(tile, other, false) || other.<ItemBridgeBuild>bc().link != tile.pos()){
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class ItemBridge extends Block{
|
||||
dump();
|
||||
uptime = 0f;
|
||||
}else{
|
||||
((ItemBridgeEntity)other.build).incoming.add(tile.pos());
|
||||
((ItemBridgeBuild)other.build).incoming.add(tile.pos());
|
||||
|
||||
if(consValid() && Mathf.zero(1f - efficiency())){
|
||||
uptime = Mathf.lerpDelta(uptime, 1f, 0.04f);
|
||||
@@ -358,7 +358,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
protected boolean linked(Building source){
|
||||
return source instanceof ItemBridgeEntity && linkValid(source.tile(), tile) && ((ItemBridgeEntity)source).link == pos();
|
||||
return source instanceof ItemBridgeBuild && linkValid(source.tile(), tile) && ((ItemBridgeBuild)source).link == pos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Junction extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
public class JunctionEntity extends Building{
|
||||
public class JunctionBuild extends Building{
|
||||
public DirectionalItemBuffer buffer = new DirectionalItemBuffer(capacity);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,8 +42,8 @@ public class MassDriver extends Block{
|
||||
hasPower = true;
|
||||
outlineIcon = true;
|
||||
//point2 is relative
|
||||
config(Point2.class, (MassDriverEntity tile, Point2 point) -> tile.link = Point2.pack(point.x + tile.tileX(), point.y + tile.tileY()));
|
||||
config(Integer.class, (MassDriverEntity tile, Integer point) -> tile.link = point);
|
||||
config(Point2.class, (MassDriverBuild tile, Point2 point) -> tile.link = Point2.pack(point.x + tile.tileX(), point.y + tile.tileY()));
|
||||
config(Integer.class, (MassDriverBuild tile, Integer point) -> tile.link = point);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +75,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
public class DriverBulletData implements Poolable{
|
||||
public MassDriverEntity from, to;
|
||||
public MassDriverBuild from, to;
|
||||
public int[] items = new int[content.items().size];
|
||||
|
||||
@Override
|
||||
@@ -85,7 +85,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
public class MassDriverEntity extends Building{
|
||||
public class MassDriverBuild extends Building{
|
||||
public int link = -1;
|
||||
public float rotation = 90;
|
||||
public float reload = 0f;
|
||||
@@ -153,7 +153,7 @@ public class MassDriver extends Block{
|
||||
items.total() >= minDistribute && //must shoot minimum amount of items
|
||||
link.block().itemCapacity - link.items.total() >= minDistribute //must have minimum amount of space
|
||||
){
|
||||
MassDriverEntity other = (MassDriverEntity)link;
|
||||
MassDriverBuild other = (MassDriverBuild)link;
|
||||
other.waitingShooters.add(tile);
|
||||
|
||||
if(reload <= 0.0001f){
|
||||
@@ -235,7 +235,7 @@ public class MassDriver extends Block{
|
||||
return items.total() < itemCapacity && linkValid();
|
||||
}
|
||||
|
||||
protected void fire(MassDriverEntity target){
|
||||
protected void fire(MassDriverBuild target){
|
||||
//reset reload, use power.
|
||||
reload = 1f;
|
||||
|
||||
@@ -290,7 +290,7 @@ 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.bc();
|
||||
MassDriverBuild entity = other.bc();
|
||||
return entity.link == tile.pos() && tile.dst(other) <= range;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class OverflowGate extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
public class OverflowGateEntity extends Building{
|
||||
public class OverflowGateBuild extends Building{
|
||||
public Item lastItem;
|
||||
public Tile lastInput;
|
||||
public float time;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PayloadConveyor extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
public class PayloadConveyorEntity extends Building{
|
||||
public class PayloadConveyorBuild extends Building{
|
||||
public @Nullable Payload item;
|
||||
public float progress, itemRotation, animation;
|
||||
public @Nullable Building next;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class PayloadRouter extends PayloadConveyor{
|
||||
Draw.rect(overRegion, req.drawx(), req.drawy());
|
||||
}
|
||||
|
||||
public class PayloadRouterEntity extends PayloadConveyorEntity{
|
||||
public class PayloadRouterBuild extends PayloadConveyorBuild{
|
||||
public float smoothRot;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Router extends Block{
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
public class RouterEntity extends Building{
|
||||
public class RouterBuild extends Building{
|
||||
public Item lastItem;
|
||||
public Tile lastInput;
|
||||
public float time;
|
||||
|
||||
@@ -28,8 +28,8 @@ public class Sorter extends Block{
|
||||
unloadable = false;
|
||||
saveConfig = true;
|
||||
|
||||
config(Item.class, (SorterEntity tile, Item item) -> tile.sortItem = item);
|
||||
configClear((SorterEntity tile) -> tile.sortItem = null);
|
||||
config(Item.class, (SorterBuild tile, Item item) -> tile.sortItem = item);
|
||||
configClear((SorterBuild tile) -> tile.sortItem = null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,10 +44,10 @@ public class Sorter extends Block{
|
||||
|
||||
@Override
|
||||
public int minimapColor(Tile tile){
|
||||
return tile.<SorterEntity>bc().sortItem == null ? 0 : tile.<SorterEntity>bc().sortItem.color.rgba();
|
||||
return tile.<SorterBuild>bc().sortItem == null ? 0 : tile.<SorterBuild>bc().sortItem.color.rgba();
|
||||
}
|
||||
|
||||
public class SorterEntity extends Building{
|
||||
public class SorterBuild extends Building{
|
||||
public @Nullable Item sortItem;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,16 +52,16 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
if(tile.build instanceof StackConveyorEntity){
|
||||
int state = ((StackConveyorEntity)tile.build).state;
|
||||
if(tile.build instanceof StackConveyorBuild){
|
||||
int state = ((StackConveyorBuild)tile.build).state;
|
||||
if(state == stateLoad){ //standard conveyor mode
|
||||
return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}else if(state == stateUnload){ //router mode
|
||||
return otherblock.acceptsItems &&
|
||||
(notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) ||
|
||||
(otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorEntity && ((StackConveyorEntity)world.build(otherx, othery)).state == stateUnload) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorEntity && ((StackConveyorEntity)world.build(otherx, othery)).state == stateMove &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild && ((StackConveyorBuild)world.build(otherx, othery)).state == stateUnload) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild && ((StackConveyorBuild)world.build(otherx, othery)).state == stateMove &&
|
||||
!facing(otherx, othery, otherrot, tile.x, tile.y));
|
||||
}
|
||||
}
|
||||
@@ -87,13 +87,13 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
@Override
|
||||
public boolean rotatedOutput(int x, int y){
|
||||
Building tile = world.build(x, y);
|
||||
if(tile instanceof StackConveyorEntity){
|
||||
return ((StackConveyorEntity)tile).state != stateUnload;
|
||||
if(tile instanceof StackConveyorBuild){
|
||||
return ((StackConveyorBuild)tile).state != stateUnload;
|
||||
}
|
||||
return super.rotatedOutput(x, y);
|
||||
}
|
||||
|
||||
public class StackConveyorEntity extends Building{
|
||||
public class StackConveyorBuild extends Building{
|
||||
public int state, blendprox;
|
||||
|
||||
public int link = -1;
|
||||
@@ -159,10 +159,10 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
//update other conveyor state when this conveyor's state changes
|
||||
if(state != lastState){
|
||||
for(Building near : proximity){
|
||||
if(near instanceof StackConveyorEntity){
|
||||
if(near instanceof StackConveyorBuild){
|
||||
near.onProximityUpdate();
|
||||
for(Building other : near.proximity){
|
||||
if(!(other instanceof StackConveyorEntity)) other.onProximityUpdate();
|
||||
if(!(other instanceof StackConveyorBuild)) other.onProximityUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
if(front() != null
|
||||
&& front().team == team
|
||||
&& front().block instanceof StackConveyor){
|
||||
StackConveyorEntity e = (StackConveyorEntity)front();
|
||||
StackConveyorBuild e = (StackConveyorBuild)front();
|
||||
|
||||
// sleep if its occupied
|
||||
if(e.link == -1){
|
||||
|
||||
@@ -33,16 +33,16 @@ public class BlockForge extends PayloadAcceptor{
|
||||
hasPower = true;
|
||||
rotate = true;
|
||||
|
||||
config(Block.class, (BlockForgeEntity tile, Block block) -> tile.recipe = block);
|
||||
config(Block.class, (BlockForgeBuild tile, Block block) -> tile.recipe = block);
|
||||
|
||||
consumes.add(new ConsumeItemDynamic((BlockForgeEntity e) -> e.recipe != null ? e.recipe.requirements : ItemStack.empty));
|
||||
consumes.add(new ConsumeItemDynamic((BlockForgeBuild e) -> e.recipe != null ? e.recipe.requirements : ItemStack.empty));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("progress", entity -> new Bar("bar.progress", Pal.ammo, () -> ((BlockForgeEntity)entity).progress));
|
||||
bars.add("progress", entity -> new Bar("bar.progress", Pal.ammo, () -> ((BlockForgeBuild)entity).progress));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,7 +51,7 @@ public class BlockForge extends PayloadAcceptor{
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
}
|
||||
|
||||
public class BlockForgeEntity extends PayloadAcceptorEntity<BlockPayload>{
|
||||
public class BlockForgeBuild extends PayloadAcceptorBuild<BlockPayload>{
|
||||
public @Nullable Block recipe;
|
||||
public float progress, time, heat;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BlockLoader extends PayloadAcceptor{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("progress", entity -> new Bar("bar.progress", Pal.ammo, ((BlockLoaderEntity)entity)::fraction));
|
||||
bars.add("progress", entity -> new Bar("bar.progress", Pal.ammo, ((BlockLoaderBuild)entity)::fraction));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +50,7 @@ public class BlockLoader extends PayloadAcceptor{
|
||||
Draw.rect(topRegion, req.drawx(), req.drawy());
|
||||
}
|
||||
|
||||
public class BlockLoaderEntity extends PayloadAcceptorEntity<BlockPayload>{
|
||||
public class BlockLoaderBuild extends PayloadAcceptorBuild<BlockPayload>{
|
||||
|
||||
@Override
|
||||
public boolean acceptPayload(Building source, Payload payload){
|
||||
|
||||
@@ -16,7 +16,7 @@ public class BlockUnloader extends BlockLoader{
|
||||
return true;
|
||||
}
|
||||
|
||||
public class BlockUnloaderEntity extends BlockLoaderEntity{
|
||||
public class BlockUnloaderBuild extends BlockLoaderBuild{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
|
||||
@@ -10,7 +10,7 @@ public class LegacyCommandCenter extends LegacyBlock{
|
||||
update = true;
|
||||
}
|
||||
|
||||
public class LegacyCommandCenterEntity extends Building{
|
||||
public class LegacyCommandCenterBuild extends Building{
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
|
||||
@@ -11,7 +11,7 @@ public class LegacyMechPad extends LegacyBlock{
|
||||
hasPower = true;
|
||||
}
|
||||
|
||||
public class LegacyMechPadEntity extends Building{
|
||||
public class LegacyMechPadBuild extends Building{
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
|
||||
@@ -13,7 +13,7 @@ public class LegacyUnitFactory extends LegacyBlock{
|
||||
solid = false;
|
||||
}
|
||||
|
||||
public class LegacyUnitFactoryEntity extends Building{
|
||||
public class LegacyUnitFactoryBuild extends Building{
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ArmoredConduit extends Conduit{
|
||||
return otherblock.outputsLiquid && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}
|
||||
|
||||
public class ArmoredConduitEntity extends ConduitEntity{
|
||||
public class ArmoredConduitBuild extends ConduitBuild{
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
return new TextureRegion[]{Core.atlas.find("conduit-bottom"), topRegions[0]};
|
||||
}
|
||||
|
||||
public class ConduitEntity extends LiquidBlockEntity{
|
||||
public class ConduitBuild extends LiquidBuild{
|
||||
public float smoothLiquid;
|
||||
public int blendbits, xscl, yscl, blending;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class LiquidBlock extends Block{
|
||||
return new TextureRegion[]{bottomRegion, topRegion};
|
||||
}
|
||||
|
||||
public class LiquidBlockEntity extends Building{
|
||||
public class LiquidBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
float rotation = rotate ? rotdeg() : 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LiquidBridge extends ItemBridge{
|
||||
group = BlockGroup.liquids;
|
||||
}
|
||||
|
||||
public class LiquidBridgeEntity extends ItemBridgeEntity{
|
||||
public class LiquidBridgeBuild extends ItemBridgeBuild{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
time += cycleSpeed * delta();
|
||||
@@ -30,7 +30,7 @@ public class LiquidBridge extends ItemBridge{
|
||||
if(other == null || !linkValid(tile, other.tile())){
|
||||
dumpLiquid(liquids.current());
|
||||
}else{
|
||||
((ItemBridgeEntity)other).incoming.add(tile.pos());
|
||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
||||
|
||||
if(consValid()){
|
||||
float alpha = 0.04f;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
||||
group = BlockGroup.liquids;
|
||||
}
|
||||
|
||||
public class LiquidExtendingBridgeEntity extends ExtendingItemBridgeEntity{
|
||||
public class LiquidExtendingBridgeBuild extends ExtendingItemBridgeBuild{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
time += cycleSpeed * delta();
|
||||
@@ -30,7 +30,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
||||
if(other == null || !linkValid(tile, other.tile())){
|
||||
dumpLiquid(liquids.current());
|
||||
}else{
|
||||
((ItemBridgeEntity)other).incoming.add(tile.pos());
|
||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
||||
|
||||
if(consValid()){
|
||||
uptime = Mathf.lerpDelta(uptime, 1f, 0.04f);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class LiquidJunction extends LiquidBlock{
|
||||
return new TextureRegion[]{region};
|
||||
}
|
||||
|
||||
public class LiquidJunctionEntity extends Building{
|
||||
public class LiquidJunctionBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
|
||||
@@ -9,7 +9,7 @@ public class LiquidRouter extends LiquidBlock{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public class LiquidRouterEntity extends LiquidBlockEntity{
|
||||
public class LiquidRouterEntity extends LiquidBuild{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(liquids.total() > 0.01f){
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LogicBlock extends Block{
|
||||
update = true;
|
||||
configurable = true;
|
||||
|
||||
config(String.class, (LogicEntity entity, String value) -> {
|
||||
config(String.class, (LogicBuild entity, String value) -> {
|
||||
if(value.startsWith("{")){ //it's json
|
||||
try{
|
||||
LogicConfig conf = JsonIO.read(LogicConfig.class, value);
|
||||
@@ -49,7 +49,7 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
});
|
||||
|
||||
config(Integer.class, (LogicEntity entity, Integer pos) -> {
|
||||
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
||||
if(entity.connections.contains(pos)){
|
||||
entity.connections.removeValue(pos);
|
||||
}else{
|
||||
@@ -60,7 +60,7 @@ public class LogicBlock extends Block{
|
||||
});
|
||||
}
|
||||
|
||||
public class LogicEntity extends Building{
|
||||
public class LogicBuild extends Building{
|
||||
/** logic "source code" as list of asm statements */
|
||||
public String code = "";
|
||||
public LExecutor executor = new LExecutor();
|
||||
|
||||
@@ -30,16 +30,12 @@ public class LogicDisplay extends Block{
|
||||
update = true;
|
||||
}
|
||||
|
||||
public class LogicDisplayEntity extends Building{
|
||||
public class LogicDisplayBuild extends Building{
|
||||
public FrameBuffer buffer;
|
||||
public float color = Color.whiteFloatBits;
|
||||
public float stroke = 1f;
|
||||
public LongQueue commands = new LongQueue();
|
||||
|
||||
public LogicDisplayEntity(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MemoryBlock extends Block{
|
||||
destructible = true;
|
||||
}
|
||||
|
||||
public class MemoryEntity extends Building{
|
||||
public class MemoryBuild extends Building{
|
||||
public double[] memory = new double[memoryCapacity];
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class MessageBlock extends Block{
|
||||
solid = true;
|
||||
destructible = true;
|
||||
|
||||
config(String.class, (MessageBlockEntity tile, String text) -> {
|
||||
config(String.class, (MessageBuild tile, String text) -> {
|
||||
if(net.server() && text.length() > maxTextLength){
|
||||
throw new ValidateException(player, "Player has gone above text limit.");
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class MessageBlock extends Block{
|
||||
});
|
||||
}
|
||||
|
||||
public class MessageBlockEntity extends Building{
|
||||
public class MessageBuild extends Building{
|
||||
public StringBuilder message = new StringBuilder();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,10 +14,10 @@ public class SwitchBlock extends Block{
|
||||
configurable = true;
|
||||
update = true;
|
||||
|
||||
config(Boolean.class, (ButtonEntity entity, Boolean b) -> entity.on = b);
|
||||
config(Boolean.class, (SwitchBuild entity, Boolean b) -> entity.on = b);
|
||||
}
|
||||
|
||||
public class ButtonEntity extends Building{
|
||||
public class SwitchBuild extends Building{
|
||||
public boolean on;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Battery extends PowerDistributor{
|
||||
consumesPower = true;
|
||||
}
|
||||
|
||||
public class BatteryEntity extends Building{
|
||||
public class BatteryBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.color(emptyLightColor, fullLightColor, power.status);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BurnerGenerator extends ItemLiquidGenerator{
|
||||
return turbineRegions[0].found() ? new TextureRegion[]{region, turbineRegions[0], turbineRegions[1], capRegion} : super.icons();
|
||||
}
|
||||
|
||||
public class BurnerGeneratorEntity extends ItemLiquidGeneratorEntity{
|
||||
public class BurnerGeneratorBuild extends ItemLiquidGeneratorBuild{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("poweroutput", (GeneratorEntity entity) -> new Bar(() ->
|
||||
bars.add("poweroutput", (GeneratorBuild entity) -> new Bar(() ->
|
||||
Core.bundle.format("bar.poweroutput",
|
||||
Strings.fixed(Math.max(entity.getPowerProduction() - consumes.getPower().usage, 0) * 60 * entity.timeScale(), 1)),
|
||||
() -> Pal.powerBar,
|
||||
@@ -64,7 +64,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
return new TextureRegion[]{bottomRegion, region};
|
||||
}
|
||||
|
||||
public class FusionReactorEntity extends GeneratorEntity{
|
||||
public class FusionReactorBuild extends GeneratorBuild{
|
||||
public float warmup;
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public class ItemLiquidGeneratorEntity extends GeneratorEntity{
|
||||
public class ItemLiquidGeneratorBuild extends GeneratorBuild{
|
||||
public float explosiveness, heat, totalTime;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,10 +25,10 @@ public class LightBlock extends Block{
|
||||
configurable = true;
|
||||
saveConfig = true;
|
||||
|
||||
config(Integer.class, (LightEntity tile, Integer value) -> tile.color = value);
|
||||
config(Integer.class, (LightBuild tile, Integer value) -> tile.color = value);
|
||||
}
|
||||
|
||||
public class LightEntity extends Building{
|
||||
public class LightBuild extends Building{
|
||||
public int color = Pal.accent.rgba();
|
||||
public float smoothTime = 1f;
|
||||
|
||||
|
||||
@@ -61,10 +61,10 @@ public class NuclearReactor extends PowerGenerator{
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("heat", (NuclearReactorEntity entity) -> new Bar("bar.heat", Pal.lightOrange, () -> entity.heat));
|
||||
bars.add("heat", (NuclearReactorBuild entity) -> new Bar("bar.heat", Pal.lightOrange, () -> entity.heat));
|
||||
}
|
||||
|
||||
public class NuclearReactorEntity extends GeneratorEntity{
|
||||
public class NuclearReactorBuild extends GeneratorBuild{
|
||||
public float heat;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PowerDiode extends Block{
|
||||
return (tile != null && tile.block().hasPower) ? tile.power.graph.getLastPowerStored() / tile.power.graph.getTotalBatteryCapacity() : 0f;
|
||||
}
|
||||
|
||||
public class PowerDiodeEntity extends Building{
|
||||
public class PowerDiodeBuild extends Building{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y, 0);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
super.setBars();
|
||||
|
||||
if(hasPower && outputsPower && !consumes.hasPower()){
|
||||
bars.add("power", (GeneratorEntity entity) -> new Bar(() ->
|
||||
bars.add("power", (GeneratorBuild entity) -> new Bar(() ->
|
||||
Core.bundle.format("bar.poweroutput",
|
||||
Strings.fixed(entity.getPowerProduction() * 60 * entity.timeScale(), 1)),
|
||||
() -> Pal.powerBar,
|
||||
@@ -45,7 +45,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
return false;
|
||||
}
|
||||
|
||||
public class GeneratorEntity extends Building{
|
||||
public class GeneratorBuild extends Building{
|
||||
public float generateTime;
|
||||
/** The efficiency of the producer. An efficiency of 1.0 means 100% */
|
||||
public float productionEfficiency = 0.0f;
|
||||
|
||||
@@ -272,7 +272,7 @@ public class PowerNode extends PowerBlock{
|
||||
});
|
||||
}
|
||||
|
||||
public class PowerNodeEntity extends Building{
|
||||
public class PowerNodeBuild extends Building{
|
||||
|
||||
@Override
|
||||
public void placed(){
|
||||
|
||||
@@ -21,7 +21,7 @@ public class SolarGenerator extends PowerGenerator{
|
||||
stats.add(generationType, powerProduction * 60.0f, StatUnit.powerSecond);
|
||||
}
|
||||
|
||||
public class SolarGeneratorEntity extends GeneratorEntity{
|
||||
public class SolarGeneratorBuild extends GeneratorBuild{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
productionEfficiency =
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
return tile.getLinkedTilesAs(this, tempTiles).sumf(other -> other.floor().attributes.get(attribute)) > 0.01f;
|
||||
}
|
||||
|
||||
public class ThermalGeneratorEntity extends GeneratorEntity{
|
||||
public class ThermalGeneratorBuild extends GeneratorBuild{
|
||||
public float sum;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AttributeSmelter extends GenericSmelter{
|
||||
stats.add(BlockStat.affinities, attribute, boostScale);
|
||||
}
|
||||
|
||||
public class AttributeSmelterEntity extends SmelterEntity{
|
||||
public class AttributeSmelterBuild extends SmelterBuild{
|
||||
public float attrsum;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Cultivator extends GenericCrafter{
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("multiplier", (CultivatorEntity entity) -> new Bar(() ->
|
||||
bars.add("multiplier", (CultivatorBuild entity) -> new Bar(() ->
|
||||
Core.bundle.formatFloat("bar.efficiency",
|
||||
((entity.boost + 1f + attribute.env()) * entity.warmup) * 100f, 1),
|
||||
() -> Pal.ammo,
|
||||
@@ -55,7 +55,7 @@ public class Cultivator extends GenericCrafter{
|
||||
return new TextureRegion[]{region, topRegion};
|
||||
}
|
||||
|
||||
public class CultivatorEntity extends GenericCrafterEntity{
|
||||
public class CultivatorBuild extends GenericCrafterBuild{
|
||||
public float warmup;
|
||||
public float boost;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Drill extends Block{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("drillspeed", (DrillEntity e) ->
|
||||
bars.add("drillspeed", (DrillBuild e) ->
|
||||
new Bar(() -> Core.bundle.format("bar.drillspeed", Strings.fixed(e.lastDrillSpeed * 60 * e.timeScale(), 2)), () -> Pal.ammo, () -> e.warmup));
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class Drill extends Block{
|
||||
return drops != null && drops.hardness <= tier;
|
||||
}
|
||||
|
||||
public class DrillEntity extends Building{
|
||||
public class DrillBuild extends Building{
|
||||
public float progress;
|
||||
public int index;
|
||||
public float warmup;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Fracker extends SolidPump{
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
public class FrackerEntity extends SolidPumpEntity{
|
||||
public class FrackerBuild extends SolidPumpBuild{
|
||||
public float accumulator;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,7 +78,7 @@ public class GenericCrafter extends Block{
|
||||
return outputItem != null;
|
||||
}
|
||||
|
||||
public class GenericCrafterEntity extends Building{
|
||||
public class GenericCrafterBuild extends Building{
|
||||
public float progress;
|
||||
public float totalProgress;
|
||||
public float warmup;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class GenericSmelter extends GenericCrafter{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public class SmelterEntity extends GenericCrafterEntity{
|
||||
public class SmelterBuild extends GenericCrafterBuild{
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Incinerator extends Block{
|
||||
solid = true;
|
||||
}
|
||||
|
||||
public class IncineratorEntity extends Building{
|
||||
public class IncineratorBuild extends Building{
|
||||
public float heat;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LiquidConverter extends GenericCrafter{
|
||||
stats.add(BlockStat.output, outputLiquid.liquid, outputLiquid.amount * craftTime, false);
|
||||
}
|
||||
|
||||
public class LiquidConverterEntity extends GenericCrafterEntity{
|
||||
public class LiquidConverterBuild extends GenericCrafterBuild{
|
||||
@Override
|
||||
public void drawLight(){
|
||||
if(hasLiquids && drawLiquidLight && outputLiquid.liquid.lightColor.a > 0.001f){
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PayloadAcceptor extends Block{
|
||||
);
|
||||
}
|
||||
|
||||
public class PayloadAcceptorEntity<T extends Payload> extends Building{
|
||||
public class PayloadAcceptorBuild<T extends Payload> extends Building{
|
||||
public @Nullable T payload;
|
||||
public Vec2 payVector = new Vec2();
|
||||
public float payRotation;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class Pump extends LiquidBlock{
|
||||
return tile != null && tile.floor().liquidDrop != null;
|
||||
}
|
||||
|
||||
public class PumpEntity extends LiquidBlockEntity{
|
||||
public class PumpBuild extends LiquidBuild{
|
||||
public float amount = 0f;
|
||||
public Liquid liquidDrop = null;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Separator extends Block{
|
||||
stats.add(BlockStat.productionTime, craftTime / 60f, StatUnit.seconds);
|
||||
}
|
||||
|
||||
public class SeparatorEntity extends Building{
|
||||
public class SeparatorBuild extends Building{
|
||||
public float progress;
|
||||
public float totalProgress;
|
||||
public float warmup;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SolidPump extends Pump{
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("efficiency", (SolidPumpEntity entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed",
|
||||
bars.add("efficiency", (SolidPumpBuild entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed",
|
||||
entity.lastPump / Time.delta * 60, 1),
|
||||
() -> Pal.ammo,
|
||||
() -> entity.warmup));
|
||||
@@ -77,7 +77,7 @@ public class SolidPump extends Pump{
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
public class SolidPumpEntity extends PumpEntity{
|
||||
public class SolidPumpBuild extends PumpBuild{
|
||||
public float warmup;
|
||||
public float pumpTime;
|
||||
public float boost;
|
||||
|
||||
@@ -24,8 +24,8 @@ public class ItemSource extends Block{
|
||||
configurable = true;
|
||||
saveConfig = true;
|
||||
|
||||
config(Item.class, (ItemSourceEntity tile, Item item) -> tile.outputItem = item);
|
||||
configClear((ItemSourceEntity tile) -> tile.outputItem = null);
|
||||
config(Item.class, (ItemSourceBuild tile, Item item) -> tile.outputItem = item);
|
||||
configClear((ItemSourceBuild tile) -> tile.outputItem = null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,7 +44,7 @@ public class ItemSource extends Block{
|
||||
return true;
|
||||
}
|
||||
|
||||
public class ItemSourceEntity extends Building{
|
||||
public class ItemSourceBuild extends Building{
|
||||
Item outputItem;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ItemVoid extends Block{
|
||||
update = solid = acceptsItems = true;
|
||||
}
|
||||
|
||||
public class ItemVoidEntity extends Building{
|
||||
public class ItemVoidBuild extends Building{
|
||||
@Override
|
||||
public void handleItem(Building source, Item item){}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public class LiquidSource extends Block{
|
||||
outputsLiquid = true;
|
||||
saveConfig = true;
|
||||
|
||||
config(Liquid.class, (LiquidSourceEntity tile, Liquid l) -> tile.source = l);
|
||||
configClear((LiquidSourceEntity tile) -> tile.source = null);
|
||||
config(Liquid.class, (LiquidSourceBuild tile, Liquid l) -> tile.source = l);
|
||||
configClear((LiquidSourceBuild tile) -> tile.source = null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +41,7 @@ public class LiquidSource extends Block{
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
}
|
||||
|
||||
public class LiquidSourceEntity extends Building{
|
||||
public class LiquidSourceBuild extends Building{
|
||||
public @Nullable Liquid source = null;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LiquidVoid extends Block{
|
||||
bars.remove("liquid");
|
||||
}
|
||||
|
||||
public class LiquidVoidEntity extends Building{
|
||||
public class LiquidVoidBuild extends Building{
|
||||
@Override
|
||||
public boolean acceptLiquid(Building source, Liquid liquid, float amount){
|
||||
return true;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class PowerSource extends PowerNode{
|
||||
consumesPower = false;
|
||||
}
|
||||
|
||||
public class PowerSourceEntity extends PowerNodeEntity{
|
||||
public class PowerSourceBuild extends PowerNodeBuild{
|
||||
@Override
|
||||
public float getPowerProduction(){
|
||||
return 10000f;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public static void playerSpawn(Tile tile, Player player){
|
||||
if(player == null || tile == null) return;
|
||||
|
||||
CoreEntity entity = tile.bc();
|
||||
CoreBuild entity = tile.bc();
|
||||
CoreBlock block = (CoreBlock)tile.block();
|
||||
Fx.spawn.at(entity);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
bars.add("capacity", (CoreEntity e) ->
|
||||
bars.add("capacity", (CoreBuild e) ->
|
||||
new Bar(
|
||||
() -> Core.bundle.format("bar.capacity", UI.formatAmount(e.storageCapacity)),
|
||||
() -> Pal.items,
|
||||
@@ -98,7 +98,7 @@ public class CoreBlock extends StorageBlock{
|
||||
@Override
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
if(tile == null) return false;
|
||||
CoreEntity core = team.core();
|
||||
CoreBuild core = team.core();
|
||||
//must have all requirements
|
||||
if(core == null || (!state.rules.infiniteResources && !core.items.has(requirements))) return false;
|
||||
return canReplace(tile.block());
|
||||
@@ -126,7 +126,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void beforePlaceBegan(Tile tile, Block previous){
|
||||
if(tile.build instanceof CoreEntity){
|
||||
if(tile.build instanceof CoreBuild){
|
||||
//right before placing, create a "destination" item array which is all the previous items minus core requirements
|
||||
ItemModule items = tile.build.items.copy();
|
||||
if(!state.rules.infiniteResources){
|
||||
@@ -151,7 +151,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
}
|
||||
|
||||
public class CoreEntity extends Building implements ControlBlock{
|
||||
public class CoreBuild extends Building implements ControlBlock{
|
||||
public int storageCapacity;
|
||||
//note that this unit is never actually used for control; the possession handler makes the player respawn when this unit is controlled
|
||||
public @NonNull BlockUnitc unit = Nulls.blockUnit;
|
||||
@@ -207,7 +207,7 @@ public class CoreBlock extends StorageBlock{
|
||||
storageCapacity = itemCapacity + proximity().sum(e -> isContainer(e) && owns(e) ? e.block().itemCapacity : 0);
|
||||
proximity.each(e -> isContainer(e) && owns(e), t -> {
|
||||
t.items = items;
|
||||
((StorageBlockEntity)t).linkedCore = this;
|
||||
((StorageBuild)t).linkedCore = this;
|
||||
});
|
||||
|
||||
for(Building other : state.teams.cores(team)){
|
||||
@@ -221,7 +221,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
}
|
||||
|
||||
for(CoreEntity other : state.teams.cores(team)){
|
||||
for(CoreBuild other : state.teams.cores(team)){
|
||||
other.storageCapacity = storageCapacity;
|
||||
}
|
||||
}
|
||||
@@ -245,15 +245,15 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
|
||||
public boolean isContainer(Building tile){
|
||||
return tile instanceof StorageBlockEntity && (((StorageBlockEntity)tile).linkedCore == this || ((StorageBlockEntity)tile).linkedCore == null);
|
||||
return tile instanceof StorageBuild && (((StorageBuild)tile).linkedCore == this || ((StorageBuild)tile).linkedCore == null);
|
||||
}
|
||||
|
||||
public boolean owns(Building tile){
|
||||
return tile instanceof StorageBlockEntity && (((StorageBlockEntity)tile).linkedCore == this || ((StorageBlockEntity)tile).linkedCore == null);
|
||||
return tile instanceof StorageBuild && (((StorageBuild)tile).linkedCore == this || ((StorageBuild)tile).linkedCore == null);
|
||||
}
|
||||
|
||||
public boolean owns(Building core, Building tile){
|
||||
return tile instanceof StorageBlockEntity && (((StorageBlockEntity)tile).linkedCore == core || ((StorageBlockEntity)tile).linkedCore == null);
|
||||
return tile instanceof StorageBuild && (((StorageBuild)tile).linkedCore == core || ((StorageBuild)tile).linkedCore == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,7 +270,7 @@ public class CoreBlock extends StorageBlock{
|
||||
float fract = 1f / total / state.teams.cores(team).size;
|
||||
|
||||
proximity.each(e -> isContainer(e) && e.items == items && owns(e), t -> {
|
||||
StorageBlockEntity ent = (StorageBlockEntity)t;
|
||||
StorageBuild ent = (StorageBuild)t;
|
||||
ent.linkedCore = null;
|
||||
ent.items = new ItemModule();
|
||||
for(Item item : content.items()){
|
||||
@@ -285,7 +285,7 @@ public class CoreBlock extends StorageBlock{
|
||||
items.set(item, Math.min(items.get(item), max));
|
||||
}
|
||||
|
||||
for(CoreEntity other : state.teams.cores(team)){
|
||||
for(CoreBuild other : state.teams.cores(team)){
|
||||
other.onProximityUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class StorageBlock extends Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
public class StorageBlockEntity extends Building{
|
||||
public class StorageBuild extends Building{
|
||||
protected @Nullable Building linkedCore;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,8 +27,8 @@ public class Unloader extends Block{
|
||||
saveConfig = true;
|
||||
itemCapacity = 0;
|
||||
|
||||
config(Item.class, (UnloaderEntity tile, Item item) -> tile.sortItem = item);
|
||||
configClear((UnloaderEntity tile) -> tile.sortItem = null);
|
||||
config(Item.class, (UnloaderBuild tile, Item item) -> tile.sortItem = item);
|
||||
configClear((UnloaderBuild tile) -> tile.sortItem = null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +42,7 @@ public class Unloader extends Block{
|
||||
bars.remove("items");
|
||||
}
|
||||
|
||||
public class UnloaderEntity extends Building{
|
||||
public class UnloaderBuild extends Building{
|
||||
public Item sortItem = null;
|
||||
public Building dumpingTo;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class Unloader extends Block{
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
ItemSelection.buildTable(table, content.items(), () -> tile.<UnloaderEntity>bc().sortItem, item -> configure(item));
|
||||
ItemSelection.buildTable(table, content.items(), () -> tile.<UnloaderBuild>bc().sortItem, item -> configure(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,8 +43,8 @@ public class Reconstructor extends UnitBlock{
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("progress", (ReconstructorEntity entity) -> new Bar("bar.progress", Pal.ammo, entity::fraction));
|
||||
bars.add("units", (ReconstructorEntity e) ->
|
||||
bars.add("progress", (ReconstructorBuild entity) -> new Bar("bar.progress", Pal.ammo, entity::fraction));
|
||||
bars.add("units", (ReconstructorBuild e) ->
|
||||
new Bar(
|
||||
() -> e.unit() == null ? "[lightgray]" + Iconc.cancel :
|
||||
Core.bundle.format("bar.unitcap",
|
||||
@@ -77,7 +77,7 @@ public class Reconstructor extends UnitBlock{
|
||||
super.init();
|
||||
}
|
||||
|
||||
public class ReconstructorEntity extends UnitBlockEntity{
|
||||
public class ReconstructorBuild extends UnitBuild{
|
||||
|
||||
public float fraction(){
|
||||
return progress / constructTime;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
consumes.powerCond(powerUse, entity -> ((RepairPointEntity)entity).target != null);
|
||||
consumes.powerCond(powerUse, entity -> ((RepairPointBuild)entity).target != null);
|
||||
super.init();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class RepairPoint extends Block{
|
||||
return new TextureRegion[]{baseRegion, region};
|
||||
}
|
||||
|
||||
public class RepairPointEntity extends Building{
|
||||
public class RepairPointBuild extends Building{
|
||||
public Unit target;
|
||||
public float strength, rotation = 90;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ResupplyPoint extends Block{
|
||||
Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, Pal.placing);
|
||||
}
|
||||
|
||||
public class ResupplyPointEntity extends Building{
|
||||
public class ResupplyPointBuild extends Building{
|
||||
|
||||
@Override
|
||||
public void drawSelect(){
|
||||
|
||||
@@ -26,11 +26,11 @@ public class UnitBlock extends PayloadAcceptor{
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void unitBlockSpawn(Tile tile){
|
||||
if(!(tile.build instanceof UnitBlockEntity)) return;
|
||||
tile.<UnitBlockEntity>bc().spawned();
|
||||
if(!(tile.build instanceof UnitBuild)) return;
|
||||
tile.<UnitBuild>bc().spawned();
|
||||
}
|
||||
|
||||
public class UnitBlockEntity extends PayloadAcceptorEntity<UnitPayload>{
|
||||
public class UnitBuild extends PayloadAcceptorBuild<UnitPayload>{
|
||||
public float progress, time, speedScl;
|
||||
|
||||
public void spawned(){
|
||||
|
||||
@@ -41,12 +41,12 @@ public class UnitFactory extends UnitBlock{
|
||||
outputsPayload = true;
|
||||
rotate = true;
|
||||
|
||||
config(Integer.class, (UnitFactoryEntity tile, Integer i) -> {
|
||||
config(Integer.class, (UnitFactoryBuild tile, Integer i) -> {
|
||||
tile.currentPlan = i < 0 || i >= plans.length ? -1 : i;
|
||||
tile.progress = 0;
|
||||
});
|
||||
|
||||
consumes.add(new ConsumeItemDynamic((UnitFactoryEntity e) -> e.currentPlan != -1 ? plans[e.currentPlan].requirements : ItemStack.empty));
|
||||
consumes.add(new ConsumeItemDynamic((UnitFactoryBuild e) -> e.currentPlan != -1 ? plans[e.currentPlan].requirements : ItemStack.empty));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,9 +65,9 @@ public class UnitFactory extends UnitBlock{
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("progress", (UnitFactoryEntity e) -> new Bar("bar.progress", Pal.ammo, e::fraction));
|
||||
bars.add("progress", (UnitFactoryBuild e) -> new Bar("bar.progress", Pal.ammo, e::fraction));
|
||||
|
||||
bars.add("units", (UnitFactoryEntity e) ->
|
||||
bars.add("units", (UnitFactoryBuild e) ->
|
||||
new Bar(
|
||||
() -> e.unit() == null ? "[lightgray]" + Iconc.cancel :
|
||||
Core.bundle.format("bar.unitcap",
|
||||
@@ -118,7 +118,7 @@ public class UnitFactory extends UnitBlock{
|
||||
UnitPlan(){}
|
||||
}
|
||||
|
||||
public class UnitFactoryEntity extends UnitBlockEntity{
|
||||
public class UnitFactoryBuild extends UnitBuild{
|
||||
public int currentPlan = -1;
|
||||
|
||||
public float fraction(){
|
||||
|
||||
@@ -15,7 +15,7 @@ public class DrawAnimation extends DrawBlock{
|
||||
public TextureRegion liquid, top;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
Draw.rect(entity.block.region, entity.x, entity.y);
|
||||
Draw.rect(
|
||||
sine ?
|
||||
|
||||
@@ -9,7 +9,7 @@ import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
public class DrawBlock{
|
||||
|
||||
/** Draws the block. */
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
Draw.rect(entity.block.region, entity.x, entity.y, entity.block.rotate ? entity.rotdeg() : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class DrawGlow extends DrawBlock{
|
||||
public TextureRegion top;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
Draw.rect(entity.block.region, entity.x, entity.y);
|
||||
Draw.alpha(Mathf.absin(entity.totalProgress, glowScale, glowAmount) * entity.warmup);
|
||||
Draw.rect(top, entity.x, entity.y);
|
||||
|
||||
@@ -10,7 +10,7 @@ public class DrawMixer extends DrawBlock{
|
||||
public TextureRegion liquid, top, bottom;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
float rotation = entity.block.rotate ? entity.rotdeg() : 0;
|
||||
|
||||
Draw.rect(bottom, entity.x, entity.y, rotation);
|
||||
|
||||
@@ -9,7 +9,7 @@ public class DrawRotator extends DrawBlock{
|
||||
public TextureRegion rotator;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
Draw.rect(entity.block.region, entity.x, entity.y);
|
||||
Draw.rect(rotator, entity.x, entity.y, entity.totalProgress * 2f);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DrawWeave extends DrawBlock{
|
||||
public TextureRegion weave, bottom;
|
||||
|
||||
@Override
|
||||
public void draw(GenericCrafterEntity entity){
|
||||
public void draw(GenericCrafterBuild entity){
|
||||
Draw.rect(bottom, entity.x, entity.y);
|
||||
Draw.rect(weave, entity.x, entity.y, entity.totalProgress);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user