Many changes to improve scripting
This commit is contained in:
@@ -484,7 +484,7 @@ public class Blocks implements ContentList{
|
||||
drawer = tile -> {
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f) * entity.warmup);
|
||||
Draw.rect(reg(topRegion), tile.drawx(), tile.drawy());
|
||||
@@ -509,7 +509,7 @@ public class Blocks implements ContentList{
|
||||
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name), Core.atlas.find(name + "-weave")};
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(reg(bottomRegion), tile.drawx(), tile.drawy());
|
||||
Draw.rect(reg(weaveRegion), tile.drawx(), tile.drawy(), entity.totalProgress);
|
||||
@@ -659,7 +659,7 @@ public class Blocks implements ContentList{
|
||||
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top")};
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
Draw.rect(reg(frameRegions[(int)Mathf.absin(entity.totalProgress, 5f, 2.999f)]), tile.drawx(), tile.drawy());
|
||||
@@ -686,7 +686,7 @@ public class Blocks implements ContentList{
|
||||
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator")};
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
Draw.rect(reg(rotatorRegion), tile.drawx(), tile.drawy(), entity.totalProgress * 2f);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Logic implements ApplicationListener{
|
||||
|
||||
if(block instanceof BuildBlock){
|
||||
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
//update block to reflect the fact that something was being constructed
|
||||
if(entity.cblock != null && entity.cblock.synthetic()){
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Damage{
|
||||
}
|
||||
|
||||
for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){
|
||||
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f)));
|
||||
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), 1, 1));
|
||||
}
|
||||
|
||||
int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30);
|
||||
|
||||
@@ -10,10 +10,10 @@ import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.traits.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.entities.type.TimedEntity;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.type.TypeID;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
import java.io.*;
|
||||
@@ -144,7 +144,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait{
|
||||
create(other);
|
||||
|
||||
if(Mathf.chance(fireballChance * Time.delta() * Mathf.clamp(flammability / 10f))){
|
||||
Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f));
|
||||
Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.collection.IntMap;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Fill;
|
||||
import io.anuke.arc.math.Angles;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.pooling.Pool.Poolable;
|
||||
import io.anuke.arc.util.pooling.Pools;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.pooling.Pool.*;
|
||||
import io.anuke.arc.util.pooling.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.type.SolidEntity;
|
||||
import io.anuke.mindustry.entities.traits.*;
|
||||
import io.anuke.mindustry.type.TypeID;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -118,7 +115,7 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
|
||||
(liquid.flammability > 0.3f && dest.temperature > 0.7f)){ //flammable liquid + hot liquid
|
||||
Fire.create(tile);
|
||||
if(Mathf.chance(0.006 * amount)){
|
||||
Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f));
|
||||
Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), 1f, 1f);
|
||||
}
|
||||
}else if(dest.temperature > 0.7f && liquid.temperature < 0.55f){ //cold liquid poured onto hot puddle
|
||||
if(Mathf.chance(0.5f * amount)){
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.Queue;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
@@ -88,7 +87,7 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
||||
}
|
||||
|
||||
//otherwise, update it.
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
if(entity == null){
|
||||
return;
|
||||
@@ -210,7 +209,7 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
||||
}
|
||||
Tile tile = world.tile(place.x, place.y);
|
||||
if(tile != null && tile.entity instanceof BuildEntity){
|
||||
place.progress = tile.<BuildEntity>entity().progress;
|
||||
place.progress = tile.<BuildEntity>ent().progress;
|
||||
}
|
||||
if(tail){
|
||||
buildQueue().addLast(place);
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
|
||||
public @Nullable UnitCommand getCommand(){
|
||||
if(isCommanded()){
|
||||
return indexer.getAllied(team, BlockFlag.comandCenter).first().<CommandCenterEntity>entity().command;
|
||||
return indexer.getAllied(team, BlockFlag.comandCenter).first().<CommandCenterEntity>ent().command;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,16 +77,9 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
|
||||
return create(type, parent.owner, parent.team, x, y, angle, velocityScl);
|
||||
}
|
||||
|
||||
/** Internal use only. */
|
||||
@Remote(called = Loc.server, unreliable = true)
|
||||
public static void createBullet(BulletType type, float x, float y, float angle){
|
||||
create(type, null, Team.derelict, x, y, angle);
|
||||
}
|
||||
|
||||
/** ok */
|
||||
@Remote(called = Loc.server, unreliable = true)
|
||||
public static void createBullet(BulletType type, Team team, float x, float y, float angle){
|
||||
create(type, null, team, x, y, angle);
|
||||
public static void createBullet(BulletType type, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl){
|
||||
create(type, null, team, x, y, angle, velocityScl, lifetimeScl, null);
|
||||
}
|
||||
|
||||
public Entity getOwner(){
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
|
||||
public PowerModule power;
|
||||
public ItemModule items;
|
||||
public LiquidModule liquids;
|
||||
public ConsumeModule cons;
|
||||
public @Nullable ConsumeModule cons;
|
||||
|
||||
/** List of (cached) tiles with entities in proximity, used for outputting to */
|
||||
private Array<Tile> proximity = new Array<>(8);
|
||||
|
||||
@@ -171,7 +171,7 @@ public class BuilderDrone extends BaseDrone implements BuilderTrait{
|
||||
BuildRequest req = player.buildRequest();
|
||||
Tile tile = world.tile(req.x, req.y);
|
||||
if(tile != null && tile.entity instanceof BuildEntity){
|
||||
BuildEntity b = tile.entity();
|
||||
BuildEntity b = tile.ent();
|
||||
float dist = Math.min(b.dst(x, y) - placeDistance, 0);
|
||||
if(dist / type.maxVelocity < b.buildCost * 0.9f){
|
||||
target = b;
|
||||
|
||||
@@ -221,7 +221,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
public boolean requestMatches(BuildRequest request){
|
||||
Tile tile = world.tile(request.x, request.y);
|
||||
return tile != null && tile.block() instanceof BuildBlock && tile.<BuildEntity>entity().cblock == request.block;
|
||||
return tile != null && tile.block() instanceof BuildBlock && tile.<BuildEntity>ent().cblock == request.block;
|
||||
}
|
||||
|
||||
public void drawBreaking(int x, int y){
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -165,11 +165,11 @@ public class ContentParser{
|
||||
|
||||
Block block;
|
||||
|
||||
if(Vars.content.getByName(ContentType.block, name) != null){
|
||||
block = Vars.content.getByName(ContentType.block, name);
|
||||
if(locate(ContentType.block, name) != null){
|
||||
block = locate(ContentType.block, name);
|
||||
|
||||
if(value.has("type")){
|
||||
throw new IllegalArgumentException("When overwriting an existing block, you must not re-declare its type. The original type will be used. Block: " + name);
|
||||
throw new IllegalArgumentException("When defining properties for an existing block, you must not re-declare its type. The original type will be used. Block: " + name);
|
||||
}
|
||||
}else{
|
||||
//TODO generate dynamically instead of doing.. this
|
||||
@@ -386,16 +386,21 @@ public class ContentParser{
|
||||
}
|
||||
|
||||
currentMod = mod;
|
||||
boolean exists = Vars.content.getByName(type, name) != null;
|
||||
boolean located = locate(type, name) != null;
|
||||
Content c = parsers.get(type).parse(mod.name, name, value);
|
||||
toBeParsed.add(c);
|
||||
if(!exists){
|
||||
if(!located){
|
||||
c.sourceFile = file;
|
||||
c.mod = mod;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private <T extends MappableContent> T locate(ContentType type, String name){
|
||||
T first = Vars.content.getByName(type, name); //try vanilla replacement
|
||||
return first != null ? first : Vars.content.getByName(type, currentMod.name + "-" + name);
|
||||
}
|
||||
|
||||
private <T> T make(Class<T> type){
|
||||
try{
|
||||
Constructor<T> cons = type.getDeclaredConstructor();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Scripts implements Disposable{
|
||||
}
|
||||
|
||||
private String getError(Throwable t){
|
||||
t = Strings.getFinalCause(t);
|
||||
t.printStackTrace();
|
||||
return t.getClass().getSimpleName() + (t.getMessage() == null ? "" : ": " + t.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ItemStack implements Comparable<ItemStack>{
|
||||
public static ItemStack[] with(Object... items){
|
||||
ItemStack[] stacks = new ItemStack[items.length / 2];
|
||||
for(int i = 0; i < items.length; i += 2){
|
||||
stacks[i / 2] = new ItemStack((Item)items[i], (Integer)items[i + 1]);
|
||||
stacks[i / 2] = new ItemStack((Item)items[i], ((Number)items[i + 1]).intValue());
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class ItemStack implements Comparable<ItemStack>{
|
||||
public static Array<ItemStack> list(Object... items){
|
||||
Array<ItemStack> stacks = new Array<>(items.length / 2);
|
||||
for(int i = 0; i < items.length; i += 2){
|
||||
stacks.add(new ItemStack((Item)items[i], (Integer)items[i + 1]));
|
||||
stacks.add(new ItemStack((Item)items[i], ((Number)items[i + 1]).intValue()));
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
|
||||
table.visible(true);
|
||||
table.clear();
|
||||
tile.block().buildTable(tile, table);
|
||||
tile.block().buildConfiguration(tile, table);
|
||||
table.pack();
|
||||
table.setTransform(true);
|
||||
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ScriptConsoleFragment extends Table{
|
||||
clearChatInput();
|
||||
}
|
||||
|
||||
return shown && !Vars.net.client();
|
||||
return shown && !Vars.net.active();
|
||||
});
|
||||
|
||||
update(() -> {
|
||||
@@ -163,8 +163,8 @@ public class ScriptConsoleFragment extends Table{
|
||||
|
||||
history.insert(1, message);
|
||||
|
||||
addMessage("[lightgray]> " + message);
|
||||
addMessage(mods.getScripts().runConsole(message));
|
||||
addMessage("[lightgray]> " + message.replace("[", "[["));
|
||||
addMessage(mods.getScripts().runConsole(message).replace("[", "[["));
|
||||
}
|
||||
|
||||
public void toggle(){
|
||||
|
||||
@@ -184,7 +184,7 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
|
||||
protected void updatePowerGraph(Tile tile){
|
||||
TileEntity entity = tile.entity();
|
||||
TileEntity entity = tile.ent();
|
||||
|
||||
for(Tile other : getPowerConnections(tile, tempTiles)){
|
||||
if(other.entity.power != null){
|
||||
@@ -483,7 +483,7 @@ public class Block extends BlockStorage{
|
||||
* Called when this block is tapped to build a UI on the table.
|
||||
* {@link #configurable} must return true for this to be called.
|
||||
*/
|
||||
public void buildTable(Tile tile, Table table){
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
}
|
||||
|
||||
/** Update table alignment after configuring.*/
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Build{
|
||||
Block sub = BuildBlock.get(previous.size);
|
||||
|
||||
world.setBlock(tile, sub, team, rotation);
|
||||
tile.<BuildEntity>entity().setDeconstruct(previous);
|
||||
tile.<BuildEntity>ent().setDeconstruct(previous);
|
||||
tile.entity.health = tile.entity.maxHealth() * prevPercent;
|
||||
|
||||
Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, true)));
|
||||
@@ -61,7 +61,7 @@ public class Build{
|
||||
Block sub = BuildBlock.get(result.size);
|
||||
|
||||
world.setBlock(tile, sub, team, rotation);
|
||||
tile.<BuildEntity>entity().setConstruct(previous, result);
|
||||
tile.<BuildEntity>ent().setConstruct(previous, result);
|
||||
|
||||
Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, false)));
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class Tile implements Position, TargetTrait{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends TileEntity> T entity(){
|
||||
public <T extends TileEntity> T ent(){
|
||||
return (T)entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,19 +118,19 @@ public class BuildBlock extends Block{
|
||||
|
||||
@Override
|
||||
public String getDisplayName(Tile tile){
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
return Core.bundle.format("block.constructing", entity.cblock == null ? entity.previous.localizedName : entity.cblock.localizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getDisplayIcon(Tile tile){
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
return (entity.cblock == null ? entity.previous : entity.cblock).icon(io.anuke.mindustry.ui.Cicon.full);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidFor(Tile tile){
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
return entity == null || (entity.cblock != null && entity.cblock.solid) || entity.previous == null || entity.previous.solid;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class BuildBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player){
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
//if the target is constructible, begin constructing
|
||||
if(entity.cblock != null){
|
||||
@@ -164,7 +164,7 @@ public class BuildBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
//When breaking, don't draw the previous block... since it's the thing you were breaking
|
||||
if(entity.cblock != null && entity.previous == entity.cblock){
|
||||
@@ -181,7 +181,7 @@ public class BuildBlock extends Block{
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
|
||||
BuildEntity entity = tile.entity();
|
||||
BuildEntity entity = tile.ent();
|
||||
|
||||
Shaders.blockbuild.color = Pal.accent;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DeflectorWall extends Wall{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
DeflectorEntity entity = tile.entity();
|
||||
DeflectorEntity entity = tile.ent();
|
||||
|
||||
if(entity.hit < 0.0001f) return;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Door extends Wall{
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onDoorToggle(Player player, Tile tile, boolean open){
|
||||
DoorEntity entity = tile.entity();
|
||||
DoorEntity entity = tile.ent();
|
||||
if(entity != null){
|
||||
entity.open = open;
|
||||
Door door = (Door)tile.block();
|
||||
@@ -59,7 +59,7 @@ public class Door extends Wall{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
DoorEntity entity = tile.entity();
|
||||
DoorEntity entity = tile.ent();
|
||||
|
||||
if(!entity.open){
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
@@ -75,13 +75,13 @@ public class Door extends Wall{
|
||||
|
||||
@Override
|
||||
public boolean isSolidFor(Tile tile){
|
||||
DoorEntity entity = tile.entity();
|
||||
DoorEntity entity = tile.ent();
|
||||
return !entity.open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player){
|
||||
DoorEntity entity = tile.entity();
|
||||
DoorEntity entity = tile.ent();
|
||||
|
||||
if((Units.anyEntities(tile) && entity.open) || !tile.entity.timer.get(timerToggle, 30f)){
|
||||
return;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ForceProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ForceEntity entity = tile.entity();
|
||||
ForceEntity entity = tile.ent();
|
||||
|
||||
if(entity.shield == null){
|
||||
entity.shield = new ShieldEntity(tile);
|
||||
@@ -170,7 +170,7 @@ public class ForceProjector extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
ForceEntity entity = tile.entity();
|
||||
ForceEntity entity = tile.ent();
|
||||
|
||||
if(entity.buildup <= 0f) return;
|
||||
Draw.alpha(entity.buildup / breakage * 0.75f);
|
||||
@@ -214,7 +214,7 @@ public class ForceProjector extends Block{
|
||||
final ForceEntity entity;
|
||||
|
||||
public ShieldEntity(Tile tile){
|
||||
this.entity = tile.entity();
|
||||
this.entity = tile.ent();
|
||||
set(tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class MendProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
MendEntity entity = tile.entity();
|
||||
MendEntity entity = tile.ent();
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, entity.cons.valid() || tile.isEnemyCheat() ? 1f : 0f, 0.08f);
|
||||
entity.charge += entity.heat * entity.delta();
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MendProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
MendEntity entity = tile.entity();
|
||||
MendEntity entity = tile.ent();
|
||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||
|
||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor);
|
||||
@@ -116,7 +116,7 @@ public class MendProjector extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
MendEntity entity = tile.entity();
|
||||
MendEntity entity = tile.ent();
|
||||
float f = 1f - (Time.time() / 100f) % 1f;
|
||||
|
||||
Draw.color(baseColor, phaseColor, entity.phaseHeat);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class OverdriveProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
OverdriveEntity entity = tile.entity();
|
||||
OverdriveEntity entity = tile.ent();
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, entity.cons.valid() ? 1f : 0f, 0.08f);
|
||||
entity.charge += entity.heat * Time.delta();
|
||||
|
||||
@@ -115,7 +115,7 @@ public class OverdriveProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
OverdriveEntity entity = tile.entity();
|
||||
OverdriveEntity entity = tile.ent();
|
||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||
|
||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor);
|
||||
@@ -125,7 +125,7 @@ public class OverdriveProjector extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
OverdriveEntity entity = tile.entity();
|
||||
OverdriveEntity entity = tile.ent();
|
||||
float f = 1f - (Time.time() / 100f) % 1f;
|
||||
|
||||
Draw.color(baseColor, phaseColor, entity.phaseHeat);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ArtilleryTurret extends ItemTurret{
|
||||
|
||||
@Override
|
||||
protected void shoot(Tile tile, BulletType ammo){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
entity.recoil = recoil;
|
||||
entity.heat = 1f;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class BurstTurret extends ItemTurret{
|
||||
|
||||
@Override
|
||||
protected void shoot(Tile tile, BulletType ammo){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
entity.heat = 1f;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ChargeTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public void shoot(Tile tile, BulletType ammo){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
useAmmo(tile);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ChargeTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public boolean shouldTurn(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
return !entity.shooting;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class CooledTurret extends Turret{
|
||||
|
||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
Liquid liquid = entity.liquids.current();
|
||||
|
||||
float used = Math.min(Math.min(entity.liquids.get(liquid), maxUsed * Time.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity)) * baseReloadSpeed(tile);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class DoubleTurret extends ItemTurret{
|
||||
|
||||
@Override
|
||||
protected void shoot(Tile tile, BulletType ammo){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
entity.shots++;
|
||||
|
||||
int i = Mathf.signs[entity.shots % 2];
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemTurret extends CooledTurret{
|
||||
public void build(Tile tile, Table table){
|
||||
MultiReqImage image = new MultiReqImage();
|
||||
content.items().each(i -> filter.get(i) && (!world.isZone() || data.isUnlocked(i)), item -> image.add(new ReqImage(new ItemImage(item.icon(Cicon.medium)),
|
||||
() -> tile.entity != null && !((ItemTurretEntity)tile.entity).ammo.isEmpty() && ((ItemEntry)tile.<ItemTurretEntity>entity().ammo.peek()).item == item)));
|
||||
() -> tile.entity != null && !((ItemTurretEntity)tile.entity).ammo.isEmpty() && ((ItemEntry)tile.<ItemTurretEntity>ent().ammo.peek()).item == item)));
|
||||
|
||||
table.add(image).size(8 * 4);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class ItemTurret extends CooledTurret{
|
||||
public void displayBars(Tile tile, Table bars){
|
||||
super.displayBars(tile, bars);
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
bars.add(new Bar("blocks.ammo", Pal.ammo, () -> (float)entity.totalAmmo / maxAmmo)).growX();
|
||||
bars.row();
|
||||
@@ -87,7 +87,7 @@ public class ItemTurret extends CooledTurret{
|
||||
|
||||
@Override
|
||||
public int acceptStack(Item item, int amount, Tile tile, Unit source){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
BulletType type = ammo.get(item);
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ItemTurret extends CooledTurret{
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
if(entity == null) return;
|
||||
|
||||
if(item == Items.pyratite){
|
||||
@@ -144,7 +144,7 @@ public class ItemTurret extends CooledTurret{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
return ammo != null && ammo.get(item) != null && entity.totalAmmo + ammo.get(item).ammoMultiplier <= maxAmmo;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LaserTurret extends PowerTurret{
|
||||
public void update(Tile tile){
|
||||
super.update(tile);
|
||||
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
if(entity.bulletLife > 0 && entity.bullet != null){
|
||||
tr.trns(entity.rotation, size * tilesize / 2f, 0f);
|
||||
@@ -59,7 +59,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
protected void updateShooting(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
if(entity.bulletLife > 0 && entity.bullet != null){
|
||||
return;
|
||||
@@ -87,14 +87,14 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
protected void turnToTarget(Tile tile, float targetRot){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta() * (entity.bulletLife > 0f ? firingMoveFract : 1f));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bullet(Tile tile, BulletType type, float angle){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
entity.bullet = Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
entity.bulletLife = shootDuration;
|
||||
@@ -102,7 +102,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public boolean shouldActiveSound(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
return entity.bulletLife > 0 && entity.bullet != null;
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
public boolean shouldActiveSound(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
return entity.target != null && hasAmmo(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateTarget(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
if(entity.liquids.current().canExtinguish() && entity.target instanceof Tile){
|
||||
return Fire.has(((Tile)entity.target).x, ((Tile)entity.target).y);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
protected void findTarget(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
if(entity.liquids.current().canExtinguish()){
|
||||
int tr = (int)(range / tilesize);
|
||||
for(int x = -tr; x <= tr; x++){
|
||||
@@ -83,7 +83,7 @@ public class LiquidTurret extends Turret{
|
||||
protected void effects(Tile tile){
|
||||
BulletType type = peekAmmo(tile);
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
Effects.effect(type.shootEffect, entity.liquids.current().color, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
Effects.effect(type.smokeEffect, entity.liquids.current().color, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
@@ -98,7 +98,7 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
public BulletType useAmmo(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
if(tile.isEnemyCheat()) return ammo.get(entity.liquids.current());
|
||||
BulletType type = ammo.get(entity.liquids.current());
|
||||
entity.liquids.remove(entity.liquids.current(), type.ammoMultiplier);
|
||||
@@ -112,7 +112,7 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
public boolean hasAmmo(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
return ammo.get(entity.liquids.current()) != null && entity.liquids.total() >= ammo.get(entity.liquids.current()).ammoMultiplier;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
tr2.trns(entity.rotation, -entity.recoil);
|
||||
|
||||
@@ -143,7 +143,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
if(!validateTarget(tile)) entity.target = null;
|
||||
|
||||
@@ -185,12 +185,12 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected boolean validateTarget(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
return !Units.invalidateTarget(entity.target, tile.getTeam(), tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
protected void findTarget(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
if(targetAir && !targetGround){
|
||||
entity.target = Units.closestEnemy(tile.getTeam(), tile.drawx(), tile.drawy(), range, e -> !e.isDead() && e.isFlying());
|
||||
@@ -200,7 +200,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void turnToTarget(Tile tile, float targetRot){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta() * baseReloadSpeed(tile));
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public abstract class Turret extends Block{
|
||||
public BulletType useAmmo(Tile tile){
|
||||
if(tile.isEnemyCheat()) return peekAmmo(tile);
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
AmmoEntry entry = entity.ammo.peek();
|
||||
entry.amount -= ammoPerShot;
|
||||
if(entry.amount == 0) entity.ammo.pop();
|
||||
@@ -226,7 +226,7 @@ public abstract class Turret extends Block{
|
||||
* Get the ammo type that will be returned if useAmmo is called.
|
||||
*/
|
||||
public BulletType peekAmmo(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
return entity.ammo.peek().type();
|
||||
}
|
||||
|
||||
@@ -234,12 +234,12 @@ public abstract class Turret extends Block{
|
||||
* Returns whether the turret has ammo.
|
||||
*/
|
||||
public boolean hasAmmo(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
return entity.ammo.size > 0 && entity.ammo.peek().amount >= ammoPerShot;
|
||||
}
|
||||
|
||||
protected void updateShooting(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
if(entity.reload >= reload){
|
||||
BulletType type = peekAmmo(tile);
|
||||
@@ -253,7 +253,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void shoot(Tile tile, BulletType type){
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
entity.recoil = recoil;
|
||||
entity.heat = 1f;
|
||||
@@ -276,7 +276,7 @@ public abstract class Turret extends Block{
|
||||
Effect shootEffect = this.shootEffect == Fx.none ? peekAmmo(tile).shootEffect : this.shootEffect;
|
||||
Effect smokeEffect = this.smokeEffect == Fx.none ? peekAmmo(tile).smokeEffect : this.smokeEffect;
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
Effects.effect(shootEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
Effects.effect(smokeEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
@@ -291,7 +291,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
protected void ejectEffects(Tile tile){
|
||||
if(!isTurret(tile)) return;
|
||||
TurretEntity entity = tile.entity();
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
Effects.effect(ammoUseEffect, tile.drawx() - Angles.trnsx(entity.rotation, ammoEjectBack),
|
||||
tile.drawy() - Angles.trnsy(entity.rotation, ammoEjectBack), entity.rotation);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
||||
|
||||
@Override
|
||||
public void updateTransport(Tile tile, Tile other){
|
||||
BufferedItemBridgeEntity entity = tile.entity();
|
||||
BufferedItemBridgeEntity entity = tile.ent();
|
||||
|
||||
if(entity.buffer.accepts() && entity.items.total() > 0){
|
||||
entity.buffer.accept(entity.items.take());
|
||||
|
||||
@@ -75,7 +75,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
byte rotation = tile.rotation();
|
||||
|
||||
int frame = entity.clogHeat <= 0.5f ? (int)(((Time.time() * speed * 8f * entity.timeScale)) % 4) : 0;
|
||||
@@ -85,7 +85,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public boolean shouldIdleSound(Tile tile){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
return entity.clogHeat <= 0.5f ;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
public void onProximityUpdate(Tile tile){
|
||||
super.onProximityUpdate(tile);
|
||||
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
||||
entity.blendbits = bits[0];
|
||||
entity.blendsclx = bits[1];
|
||||
@@ -122,7 +122,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
|
||||
byte rotation = tile.rotation();
|
||||
|
||||
@@ -148,7 +148,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void unitOn(Tile tile, Unit unit){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
|
||||
if(entity.clogHeat > 0.5f){
|
||||
return;
|
||||
@@ -178,12 +178,12 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
entity.minitem = 1f;
|
||||
Tile next = tile.getNearby(tile.rotation());
|
||||
if(next != null) next = next.link();
|
||||
|
||||
float nextMax = next != null && next.block() instanceof Conveyor && next.block().acceptItem(null, next, tile) ? 1f - Math.max(itemSpace - next.<ConveyorEntity>entity().minitem, 0) : 1f;
|
||||
float nextMax = next != null && next.block() instanceof Conveyor && next.block().acceptItem(null, next, tile) ? 1f - Math.max(itemSpace - next.<ConveyorEntity>ent().minitem, 0) : 1f;
|
||||
int minremove = Integer.MAX_VALUE;
|
||||
|
||||
for(int i = entity.convey.size - 1; i >= 0; i--){
|
||||
@@ -211,7 +211,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
if(pos.y >= 0.9999f && offloadDir(tile, pos.item)){
|
||||
if(next != null && next.block() instanceof Conveyor){
|
||||
ConveyorEntity othere = next.entity();
|
||||
ConveyorEntity othere = next.ent();
|
||||
|
||||
ItemPos ni = pos2.set(othere.convey.get(othere.lastInserted), ItemPos.updateShorts);
|
||||
|
||||
@@ -263,7 +263,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public int removeStack(Tile tile, Item item, int amount){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
entity.noSleep();
|
||||
int removed = 0;
|
||||
|
||||
@@ -289,13 +289,13 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public int acceptStack(Item item, int amount, Tile tile, Unit source){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
return Math.min((int)(entity.minitem / itemSpace), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleStack(Item item, int amount, Tile tile, Unit source){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
|
||||
for(int i = amount - 1; i >= 0; i--){
|
||||
long result = ItemPos.packItem(item, 0f, i * itemSpace);
|
||||
@@ -309,7 +309,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
int direction = source == null ? 0 : Math.abs(source.relativeTo(tile.x, tile.y) - tile.rotation());
|
||||
float minitem = tile.<ConveyorEntity>entity().minitem;
|
||||
float minitem = tile.<ConveyorEntity>ent().minitem;
|
||||
return (((direction == 0) && minitem > itemSpace) ||
|
||||
((direction % 2 == 1) && minitem > 0.52f)) && (source == null || !(source.block().rotate && (source.rotation() + 2) % 4 == tile.rotation()));
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
float pos = ch == 0 ? 0 : ch % 2 == 1 ? 0.5f : 1f;
|
||||
float y = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0;
|
||||
|
||||
ConveyorEntity entity = tile.entity();
|
||||
ConveyorEntity entity = tile.ent();
|
||||
entity.noSleep();
|
||||
long result = ItemPos.packItem(item, y * 0.9f, pos);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)) return;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<ItemBridgeEntity>entity().link = value;
|
||||
tile.<ItemBridgeEntity>ent().link = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,7 +126,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public void drawConfigure(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Lines.stroke(1f);
|
||||
@@ -151,7 +151,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tile tile, Tile other){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
if(entity.link == other.pos()){
|
||||
@@ -166,7 +166,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
entity.time += entity.cycleSpeed * entity.delta();
|
||||
entity.time2 += (entity.cycleSpeed - 1f) * entity.delta();
|
||||
@@ -175,7 +175,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>entity().link != tile.pos()){
|
||||
if(!linkValid(tile, other, false) || other.<ItemBridgeEntity>ent().link != tile.pos()){
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
public void updateTransport(Tile tile, Tile other){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
if(entity.uptime >= 0.5f && entity.timer.get(timerTransport, transportTime)){
|
||||
Item item = entity.items.take();
|
||||
@@ -214,7 +214,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)) return;
|
||||
@@ -254,7 +254,7 @@ public class ItemBridge extends Block{
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
if(tile.getTeam() != source.getTeam()) return false;
|
||||
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
Tile other = world.tile(entity.link);
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
@@ -263,7 +263,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
if(rel == rel2) return false;
|
||||
}else{
|
||||
return source.block() instanceof ItemBridge && source.<ItemBridgeEntity>entity().link == tile.pos() && tile.entity.items.total() < itemCapacity;
|
||||
return source.block() instanceof ItemBridge && source.<ItemBridgeEntity>ent().link == tile.pos() && tile.entity.items.total() < itemCapacity;
|
||||
}
|
||||
|
||||
return tile.entity.items.total() < itemCapacity;
|
||||
@@ -272,7 +272,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)){
|
||||
@@ -300,7 +300,7 @@ public class ItemBridge extends Block{
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
if(tile.getTeam() != source.getTeam() || !hasLiquids) return false;
|
||||
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
Tile other = world.tile(entity.link);
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
@@ -308,7 +308,7 @@ public class ItemBridge extends Block{
|
||||
int rel2 = tile.relativeTo(source.x, source.y);
|
||||
|
||||
if(rel == rel2) return false;
|
||||
}else if(!(source.block() instanceof ItemBridge && source.<ItemBridgeEntity>entity().link == tile.pos())){
|
||||
}else if(!(source.block() instanceof ItemBridge && source.<ItemBridgeEntity>ent().link == tile.pos())){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public boolean canDump(Tile tile, Tile to, Item item){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)){
|
||||
@@ -355,7 +355,7 @@ public class ItemBridge extends Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
return other.block() == this && (!checkDouble || other.<ItemBridgeEntity>entity().link != tile.pos());
|
||||
return other.block() == this && (!checkDouble || other.<ItemBridgeEntity>ent().link != tile.pos());
|
||||
}
|
||||
|
||||
public static class ItemBridgeEntity extends TileEntity{
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Junction extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
JunctionEntity entity = tile.entity();
|
||||
JunctionEntity entity = tile.ent();
|
||||
DirectionalItemBuffer buffer = entity.buffer;
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
@@ -72,14 +72,14 @@ public class Junction extends Block{
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
JunctionEntity entity = tile.entity();
|
||||
JunctionEntity entity = tile.ent();
|
||||
int relative = source.relativeTo(tile.x, tile.y);
|
||||
entity.buffer.accept(relative, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
JunctionEntity entity = tile.entity();
|
||||
JunctionEntity entity = tile.ent();
|
||||
int relative = source.relativeTo(tile.x, tile.y);
|
||||
|
||||
if(entity == null || relative == -1 || !entity.buffer.accepts(relative))
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MassDriver extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<MassDriverEntity>entity().link = value;
|
||||
tile.<MassDriverEntity>ent().link = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +64,7 @@ public class MassDriver extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
Tile link = world.tile(entity.link);
|
||||
boolean hasLink = linkValid(tile);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class MassDriver extends Block{
|
||||
tile.entity.items.total() >= minDistribute && //must shoot minimum amount of items
|
||||
link.block().itemCapacity - link.entity.items.total() >= minDistribute //must have minimum amount of space
|
||||
){
|
||||
MassDriverEntity other = link.entity();
|
||||
MassDriverEntity other = link.ent();
|
||||
other.waitingShooters.add(tile);
|
||||
|
||||
if(entity.reload <= 0.0001f){
|
||||
@@ -152,7 +152,7 @@ public class MassDriver extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region,
|
||||
tile.drawx() + Angles.trnsx(entity.rotation + 180f, entity.reload * knockback),
|
||||
@@ -172,7 +172,7 @@ public class MassDriver extends Block{
|
||||
Lines.stroke(1f);
|
||||
Drawf.circles(tile.drawx(), tile.drawy(), (tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);
|
||||
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
|
||||
if(linkValid(tile)){
|
||||
Tile target = world.tile(entity.link);
|
||||
@@ -187,7 +187,7 @@ public class MassDriver extends Block{
|
||||
public boolean onConfigureTileTapped(Tile tile, Tile other){
|
||||
if(tile == other) return false;
|
||||
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
|
||||
if(entity.link == other.pos()){
|
||||
tile.configure(-1);
|
||||
@@ -207,8 +207,8 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
protected void fire(Tile tile, Tile target){
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity other = target.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
MassDriverEntity other = target.ent();
|
||||
|
||||
//reset reload, use power.
|
||||
entity.reload = 1f;
|
||||
@@ -264,13 +264,13 @@ public class MassDriver extends Block{
|
||||
protected boolean shooterValid(Tile tile, Tile other){
|
||||
if(other == null) return true;
|
||||
if(!(other.block() instanceof MassDriver)) return false;
|
||||
MassDriverEntity entity = other.entity();
|
||||
MassDriverEntity entity = other.ent();
|
||||
return entity.link == tile.pos() && tile.dst(other) <= range;
|
||||
}
|
||||
|
||||
protected boolean linkValid(Tile tile){
|
||||
if(tile == null) return false;
|
||||
MassDriverEntity entity = tile.entity();
|
||||
MassDriverEntity entity = tile.ent();
|
||||
if(entity == null || entity.link == -1) return false;
|
||||
Tile link = world.tile(entity.link);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class OverflowGate extends Block{
|
||||
|
||||
@Override
|
||||
public int removeStack(Tile tile, Item item, int amount){
|
||||
OverflowGateEntity entity = tile.entity();
|
||||
OverflowGateEntity entity = tile.ent();
|
||||
int result = super.removeStack(tile, item, amount);
|
||||
if(result != 0 && item == entity.lastItem){
|
||||
entity.lastItem = null;
|
||||
@@ -39,7 +39,7 @@ public class OverflowGate extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
OverflowGateEntity entity = tile.entity();
|
||||
OverflowGateEntity entity = tile.ent();
|
||||
|
||||
if(entity.lastItem == null && entity.items.total() > 0){
|
||||
entity.items.clear();
|
||||
@@ -60,14 +60,14 @@ public class OverflowGate extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
OverflowGateEntity entity = tile.entity();
|
||||
OverflowGateEntity entity = tile.ent();
|
||||
|
||||
return tile.getTeam() == source.getTeam() && entity.lastItem == null && entity.items.total() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
OverflowGateEntity entity = tile.entity();
|
||||
OverflowGateEntity entity = tile.ent();
|
||||
entity.items.add(item, 1);
|
||||
entity.lastItem = item;
|
||||
entity.time = 0f;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Router extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
RouterEntity entity = tile.entity();
|
||||
RouterEntity entity = tile.ent();
|
||||
|
||||
if(entity.lastItem == null && entity.items.total() > 0){
|
||||
entity.items.clear();
|
||||
@@ -45,14 +45,14 @@ public class Router extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
RouterEntity entity = tile.entity();
|
||||
RouterEntity entity = tile.ent();
|
||||
|
||||
return tile.getTeam() == source.getTeam() && entity.lastItem == null && entity.items.total() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
RouterEntity entity = tile.entity();
|
||||
RouterEntity entity = tile.ent();
|
||||
entity.items.add(item, 1);
|
||||
entity.lastItem = item;
|
||||
entity.time = 0f;
|
||||
@@ -75,7 +75,7 @@ public class Router extends Block{
|
||||
|
||||
@Override
|
||||
public int removeStack(Tile tile, Item item, int amount){
|
||||
RouterEntity entity = tile.entity();
|
||||
RouterEntity entity = tile.ent();
|
||||
int result = super.removeStack(tile, item, amount);
|
||||
if(result != 0 && item == entity.lastItem){
|
||||
entity.lastItem = null;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Sorter extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<SorterEntity>entity().sortItem = content.item(value);
|
||||
tile.<SorterEntity>ent().sortItem = content.item(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +57,7 @@ public class Sorter extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
SorterEntity entity = tile.entity();
|
||||
SorterEntity entity = tile.ent();
|
||||
if(entity.sortItem == null) return;
|
||||
|
||||
Draw.color(entity.sortItem.color);
|
||||
@@ -67,7 +67,7 @@ public class Sorter extends Block{
|
||||
|
||||
@Override
|
||||
public int minimapColor(Tile tile){
|
||||
return tile.<SorterEntity>entity().sortItem == null ? 0 : tile.<SorterEntity>entity().sortItem.color.rgba();
|
||||
return tile.<SorterEntity>ent().sortItem == null ? 0 : tile.<SorterEntity>ent().sortItem.color.rgba();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ public class Sorter extends Block{
|
||||
}
|
||||
|
||||
Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){
|
||||
SorterEntity entity = dest.entity();
|
||||
SorterEntity entity = dest.ent();
|
||||
|
||||
int dir = source.relativeTo(dest.x, dest.y);
|
||||
if(dir == -1) return null;
|
||||
@@ -130,8 +130,8 @@ public class Sorter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
SorterEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
SorterEntity entity = tile.ent();
|
||||
ItemSelection.buildItemTable(table, () -> entity.sortItem, item -> {
|
||||
lastItem = item;
|
||||
tile.configure(item == null ? -1 : item.id);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public void onProximityUpdate(Tile tile){
|
||||
super.onProximityUpdate(tile);
|
||||
|
||||
ConduitEntity entity = tile.entity();
|
||||
ConduitEntity entity = tile.ent();
|
||||
int[] bits = buildBlending(tile, tile.rotation(), null, true);
|
||||
entity.blendbits = bits[0];
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
ConduitEntity entity = tile.entity();
|
||||
ConduitEntity entity = tile.ent();
|
||||
LiquidModule mod = tile.entity.liquids;
|
||||
int rotation = tile.rotation() * 90;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ConduitEntity entity = tile.entity();
|
||||
ConduitEntity entity = tile.ent();
|
||||
entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquids.total() / liquidCapacity, 0.05f);
|
||||
|
||||
if(tile.entity.liquids.total() > 0.001f && tile.entity.timer.get(timerFlow, 1)){
|
||||
|
||||
@@ -21,7 +21,7 @@ public class LiquidBridge extends ItemBridge{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
entity.time += entity.cycleSpeed * Time.delta();
|
||||
entity.time2 += (entity.cycleSpeed - 1f) * Time.delta();
|
||||
|
||||
@@ -21,7 +21,7 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
|
||||
entity.time += entity.cycleSpeed * Time.delta();
|
||||
entity.time2 += (entity.cycleSpeed - 1f) * Time.delta();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class MessageBlock extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
MessageBlockEntity entity = tile.entity();
|
||||
MessageBlockEntity entity = tile.ent();
|
||||
if(entity != null){
|
||||
entity.message = result.toString();
|
||||
entity.lines = entity.message.split("\n");
|
||||
@@ -70,7 +70,7 @@ public class MessageBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
MessageBlockEntity entity = tile.entity();
|
||||
MessageBlockEntity entity = tile.ent();
|
||||
BitmapFont font = Fonts.outline;
|
||||
GlyphLayout l = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
boolean ints = font.usesIntegerPositions();
|
||||
@@ -95,8 +95,8 @@ public class MessageBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
MessageBlockEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
MessageBlockEntity entity = tile.ent();
|
||||
|
||||
table.addImageButton(Icon.pencilSmall, () -> {
|
||||
if(mobile){
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
FusionReactorEntity entity = tile.entity();
|
||||
FusionReactorEntity entity = tile.ent();
|
||||
|
||||
if(entity.cons.valid() && entity.power.status >= 0.99f){
|
||||
boolean prevOut = getPowerProduction(tile) <= consumes.getPower().requestedPower(entity);
|
||||
@@ -95,7 +95,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
FusionReactorEntity entity = tile.entity();
|
||||
FusionReactorEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(reg(bottomRegion), tile.drawx(), tile.drawy());
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
float fract = tile.<FusionReactorEntity>entity().warmup;
|
||||
float fract = tile.<FusionReactorEntity>ent().warmup;
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (110f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * fract);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
public void onDestroyed(Tile tile){
|
||||
super.onDestroyed(tile);
|
||||
|
||||
FusionReactorEntity entity = tile.entity();
|
||||
FusionReactorEntity entity = tile.ent();
|
||||
|
||||
if(entity.warmup < 0.4f || !state.rules.reactorExplosions) return;
|
||||
|
||||
|
||||
@@ -87,13 +87,13 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public boolean productionValid(Tile tile){
|
||||
ItemLiquidGeneratorEntity entity = tile.entity();
|
||||
ItemLiquidGeneratorEntity entity = tile.ent();
|
||||
return entity.generateTime > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemLiquidGeneratorEntity entity = tile.entity();
|
||||
ItemLiquidGeneratorEntity entity = tile.ent();
|
||||
|
||||
//Note: Do not use this delta when calculating the amount of power or the power efficiency, but use it for resource consumption if necessary.
|
||||
//Power amount is delta'd by PowerGraph class already.
|
||||
@@ -156,7 +156,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
ItemLiquidGeneratorEntity entity = tile.entity();
|
||||
ItemLiquidGeneratorEntity entity = tile.ent();
|
||||
|
||||
if(hasItems){
|
||||
Draw.color(heatColor);
|
||||
@@ -175,7 +175,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
ItemLiquidGeneratorEntity entity = tile.entity();
|
||||
ItemLiquidGeneratorEntity entity = tile.ent();
|
||||
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (60f + Mathf.absin(10f, 5f)) * entity.productionEfficiency * size, Color.orange, 0.5f);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class LightBlock extends Block{
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
LightEntity entity = tile.entity();
|
||||
LightEntity entity = tile.ent();
|
||||
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.color(Tmp.c1.set(entity.color), entity.efficiency() * 0.3f);
|
||||
@@ -49,8 +49,8 @@ public class LightBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
LightEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
LightEntity entity = tile.ent();
|
||||
|
||||
table.addImageButton(Icon.pencilSmall, () -> {
|
||||
ui.picker.show(Tmp.c1.set(entity.color).a(0.5f), false, res -> {
|
||||
@@ -63,12 +63,12 @@ public class LightBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<LightEntity>entity().color = value;
|
||||
tile.<LightEntity>ent().color = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
LightEntity entity = tile.entity();
|
||||
LightEntity entity = tile.ent();
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), radius, Tmp.c1.set(entity.color), brightness * tile.entity.efficiency());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
NuclearReactorEntity entity = tile.entity();
|
||||
NuclearReactorEntity entity = tile.ent();
|
||||
|
||||
ConsumeLiquid cliquid = consumes.get(ConsumeType.liquid);
|
||||
Item item = consumes.<ConsumeItems>get(ConsumeType.item).items[0].item;
|
||||
@@ -120,7 +120,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
|
||||
Sounds.explosionbig.at(tile);
|
||||
|
||||
NuclearReactorEntity entity = tile.entity();
|
||||
NuclearReactorEntity entity = tile.ent();
|
||||
|
||||
int fuel = entity.items.get(consumes.<ConsumeItems>get(ConsumeType.item).items[0].item);
|
||||
|
||||
@@ -151,7 +151,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
NuclearReactorEntity entity = tile.entity();
|
||||
NuclearReactorEntity entity = tile.ent();
|
||||
float fract = entity.productionEfficiency;
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, entity.heat), 0.6f * fract);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
NuclearReactorEntity entity = tile.entity();
|
||||
NuclearReactorEntity entity = tile.ent();
|
||||
|
||||
Draw.color(coolColor, hotColor, entity.heat);
|
||||
Fill.rect(tile.drawx(), tile.drawy(), size * tilesize, size * tilesize);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
|
||||
@Override
|
||||
public float getPowerProduction(Tile tile){
|
||||
return powerProduction * tile.<GeneratorEntity>entity().productionEfficiency;
|
||||
return powerProduction * tile.<GeneratorEntity>ent().productionEfficiency;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -296,7 +296,7 @@ public class PowerGraph{
|
||||
|
||||
private boolean otherConsumersAreValid(Tile tile, Consume consumePower){
|
||||
for(Consume cons : tile.block().consumes.all()){
|
||||
if(cons != consumePower && !cons.isOptional() && !cons.valid(tile.entity())){
|
||||
if(cons != consumePower && !cons.isOptional() && !cons.valid(tile.ent())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tile tile, Tile other){
|
||||
TileEntity entity = tile.entity();
|
||||
TileEntity entity = tile.ent();
|
||||
other = other.link();
|
||||
|
||||
if(linkValid(tile, other)){
|
||||
@@ -262,7 +262,7 @@ public class PowerNode extends PowerBlock{
|
||||
public void drawLayer(Tile tile){
|
||||
if(Core.settings.getInt("lasersopacity") == 0) return;
|
||||
|
||||
TileEntity entity = tile.entity();
|
||||
TileEntity entity = tile.ent();
|
||||
|
||||
for(int i = 0; i < entity.power.links.size; i++){
|
||||
Tile link = world.tile(entity.power.links.get(i));
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SolarGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
tile.<GeneratorEntity>entity().productionEfficiency = state.rules.lighting ? 1f - state.rules.ambientLight.a : 1f;
|
||||
tile.<GeneratorEntity>ent().productionEfficiency = state.rules.lighting ? 1f - state.rules.ambientLight.a : 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
GeneratorEntity entity = tile.entity();
|
||||
GeneratorEntity entity = tile.ent();
|
||||
|
||||
if(entity.productionEfficiency > 0.1f && Mathf.chance(0.05 * entity.delta())){
|
||||
Effects.effect(generateEffect, tile.drawx() + Mathf.range(3f), tile.drawy() + Mathf.range(3f));
|
||||
@@ -34,7 +34,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
GeneratorEntity entity = tile.entity();
|
||||
GeneratorEntity entity = tile.ent();
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (40f + Mathf.absin(10f, 5f)) * entity.productionEfficiency * size, Color.scarlet, 0.4f);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
public void onProximityAdded(Tile tile){
|
||||
super.onProximityAdded(tile);
|
||||
|
||||
GeneratorEntity entity = tile.entity();
|
||||
GeneratorEntity entity = tile.ent();
|
||||
entity.productionEfficiency = sumAttribute(Attribute.heat, tile.x, tile.y);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
public float getPowerProduction(Tile tile){
|
||||
//in this case, productionEfficiency means 'total heat'
|
||||
//thus, it may be greater than 1.0
|
||||
return powerProduction * tile.<GeneratorEntity>entity().productionEfficiency;
|
||||
return powerProduction * tile.<GeneratorEntity>ent().productionEfficiency;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Cultivator extends GenericCrafter{
|
||||
public void update(Tile tile){
|
||||
super.update(tile);
|
||||
|
||||
CultivatorEntity entity = tile.entity();
|
||||
CultivatorEntity entity = tile.ent();
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, entity.cons.valid() ? 1f : 0f, 0.015f);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Cultivator extends GenericCrafter{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
CultivatorEntity entity = tile.entity();
|
||||
CultivatorEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
|
||||
@@ -99,7 +99,7 @@ public class Cultivator extends GenericCrafter{
|
||||
public void onProximityAdded(Tile tile){
|
||||
super.onProximityAdded(tile);
|
||||
|
||||
CultivatorEntity entity = tile.entity();
|
||||
CultivatorEntity entity = tile.ent();
|
||||
entity.boost = sumAttribute(attribute, tile.x, tile.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Drill extends Block{
|
||||
float s = 0.3f;
|
||||
float ts = 0.6f;
|
||||
|
||||
DrillEntity entity = tile.entity();
|
||||
DrillEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
super.drawCracks(tile);
|
||||
@@ -163,7 +163,7 @@ public class Drill extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
DrillEntity entity = tile.entity();
|
||||
DrillEntity entity = tile.ent();
|
||||
|
||||
if(entity.dominantItem != null){
|
||||
float dx = tile.drawx() - size * tilesize/2f, dy = tile.drawy() + size * tilesize/2f;
|
||||
@@ -239,7 +239,7 @@ public class Drill extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
DrillEntity entity = tile.entity();
|
||||
DrillEntity entity = tile.ent();
|
||||
|
||||
if(entity.dominantItem == null){
|
||||
countOre(tile);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Fracker extends SolidPump{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
FrackerEntity entity = tile.entity();
|
||||
FrackerEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
super.drawCracks(tile);
|
||||
@@ -70,7 +70,7 @@ public class Fracker extends SolidPump{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
FrackerEntity entity = tile.entity();
|
||||
FrackerEntity entity = tile.ent();
|
||||
|
||||
if(entity.cons.valid()){
|
||||
if(entity.accumulator >= itemUseTime){
|
||||
|
||||
@@ -86,7 +86,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
if(entity.cons.valid()){
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GenericSmelter extends GenericCrafter{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
//draw glowing center
|
||||
if(entity.warmup > 0f && flameColor.a > 0.001f){
|
||||
@@ -50,7 +50,7 @@ public class GenericSmelter extends GenericCrafter{
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (60f + Mathf.absin(10f, 5f)) * entity.warmup * size, flameColor, 0.65f);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
IncineratorEntity entity = tile.entity();
|
||||
IncineratorEntity entity = tile.ent();
|
||||
|
||||
if(entity.cons.valid()){
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.04f);
|
||||
@@ -42,7 +42,7 @@ public class Incinerator extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
IncineratorEntity entity = tile.entity();
|
||||
IncineratorEntity entity = tile.ent();
|
||||
|
||||
if(entity.heat > 0f){
|
||||
float g = 0.3f;
|
||||
@@ -68,7 +68,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
IncineratorEntity entity = tile.entity();
|
||||
IncineratorEntity entity = tile.ent();
|
||||
return entity.heat > 0.5f;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
IncineratorEntity entity = tile.entity();
|
||||
IncineratorEntity entity = tile.ent();
|
||||
return entity.heat > 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LiquidConverter extends GenericCrafter{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
ConsumeLiquidBase cl = consumes.get(ConsumeType.liquid);
|
||||
|
||||
if(tile.entity.cons.valid()){
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Separator extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
Draw.color(tile.entity.liquids.current().color);
|
||||
Draw.alpha(tile.entity.liquids.total() / liquidCapacity);
|
||||
@@ -78,7 +78,7 @@ public class Separator extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
GenericCrafterEntity entity = tile.ent();
|
||||
|
||||
entity.totalProgress += entity.warmup * entity.delta();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SolidPump extends Pump{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
SolidPumpEntity entity = tile.entity();
|
||||
SolidPumpEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
Draw.color(tile.entity.liquids.current().color);
|
||||
@@ -85,7 +85,7 @@ public class SolidPump extends Pump{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
SolidPumpEntity entity = tile.entity();
|
||||
SolidPumpEntity entity = tile.ent();
|
||||
|
||||
float fraction = 0f;
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SolidPump extends Pump{
|
||||
super.onProximityAdded(tile);
|
||||
|
||||
if(attribute != null){
|
||||
SolidPumpEntity entity = tile.entity();
|
||||
SolidPumpEntity entity = tile.ent();
|
||||
entity.boost = sumAttribute(attribute, tile.x, tile.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ItemSource extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<ItemSourceEntity>entity().outputItem = content.item(value);
|
||||
tile.<ItemSourceEntity>ent().outputItem = content.item(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,7 +60,7 @@ public class ItemSource extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
ItemSourceEntity entity = tile.entity();
|
||||
ItemSourceEntity entity = tile.ent();
|
||||
if(entity.outputItem == null) return;
|
||||
|
||||
Draw.color(entity.outputItem.color);
|
||||
@@ -70,7 +70,7 @@ public class ItemSource extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ItemSourceEntity entity = tile.entity();
|
||||
ItemSourceEntity entity = tile.ent();
|
||||
if(entity.outputItem == null) return;
|
||||
|
||||
entity.items.set(entity.outputItem, 1);
|
||||
@@ -79,8 +79,8 @@ public class ItemSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
ItemSourceEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
ItemSourceEntity entity = tile.ent();
|
||||
ItemSelection.buildItemTable(table, () -> entity.outputItem, item -> {
|
||||
lastItem = item;
|
||||
tile.configure(item == null ? -1 : item.id);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class LiquidSource extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
LiquidSourceEntity entity = tile.ent();
|
||||
|
||||
if(entity.source == null){
|
||||
tile.entity.liquids.clear();
|
||||
@@ -69,7 +69,7 @@ public class LiquidSource extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
LiquidSourceEntity entity = tile.ent();
|
||||
|
||||
if(entity.source != null){
|
||||
Draw.color(entity.source.color);
|
||||
@@ -79,8 +79,8 @@ public class LiquidSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
LiquidSourceEntity entity = tile.ent();
|
||||
|
||||
Array<Liquid> items = content.liquids();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class LiquidSource extends Block{
|
||||
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.<LiquidSourceEntity>entity().source = value == -1 ? null : content.liquid(value);
|
||||
tile.<LiquidSourceEntity>ent().source = value == -1 ? null : content.liquid(value);
|
||||
}
|
||||
|
||||
class LiquidSourceEntity extends TileEntity{
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public static void onUnitRespawn(Tile tile, Player player){
|
||||
if(player == null || tile.entity == null) return;
|
||||
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
Effects.effect(Fx.spawn, entity);
|
||||
entity.progress = 0;
|
||||
entity.spawnPlayer = player;
|
||||
@@ -76,13 +76,13 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
return item.type == ItemType.material ? entity.storageCapacity : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProximityUpdate(Tile tile){
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
|
||||
for(Tile other : state.teams.get(tile.getTeam()).cores){
|
||||
if(other != tile){
|
||||
@@ -94,7 +94,7 @@ public class CoreBlock extends StorageBlock{
|
||||
entity.storageCapacity = itemCapacity + entity.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0);
|
||||
entity.proximity().each(this::isContainer, t -> {
|
||||
t.entity.items = entity.items;
|
||||
t.<StorageBlockEntity>entity().linkedCore = tile;
|
||||
t.<StorageBlockEntity>ent().linkedCore = tile;
|
||||
});
|
||||
|
||||
for(Tile other : state.teams.get(tile.getTeam()).cores){
|
||||
@@ -109,7 +109,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
|
||||
for(Tile other : state.teams.get(tile.getTeam()).cores){
|
||||
CoreEntity oe = other.entity();
|
||||
CoreEntity oe = other.ent();
|
||||
oe.storageCapacity = entity.storageCapacity;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
|
||||
if(entity.heat > 0.001f){
|
||||
RespawnBlock.drawRespawn(tile, entity.heat, entity.progress, entity.time, entity.spawnPlayer, mech);
|
||||
@@ -202,7 +202,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
|
||||
if(entity.spawnPlayer != null){
|
||||
if(!entity.spawnPlayer.isDead() || !entity.spawnPlayer.isAdded()){
|
||||
@@ -225,7 +225,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public boolean shouldActiveSound(Tile tile){
|
||||
CoreEntity entity = tile.entity();
|
||||
CoreEntity entity = tile.ent();
|
||||
|
||||
return entity.spawnPlayer != null;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public abstract class StorageBlock extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
StorageBlockEntity entity = tile.entity();
|
||||
StorageBlockEntity entity = tile.ent();
|
||||
return entity.linkedCore != null ? entity.linkedCore.block().acceptItem(item, entity.linkedCore, source) : tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class StorageBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
StorageBlockEntity entity = tile.entity();
|
||||
StorageBlockEntity entity = tile.ent();
|
||||
if(entity.linkedCore != null){
|
||||
entity.linkedCore.block().drawSelect(entity.linkedCore);
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ public class Unloader extends Block{
|
||||
@Override
|
||||
public void configured(Tile tile, Player player, int value){
|
||||
tile.entity.items.clear();
|
||||
tile.<UnloaderEntity>entity().sortItem = content.item(value);
|
||||
tile.<UnloaderEntity>ent().sortItem = content.item(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
UnloaderEntity entity = tile.entity();
|
||||
UnloaderEntity entity = tile.ent();
|
||||
|
||||
if(tile.entity.timer.get(timerUnload, speed / entity.timeScale) && tile.entity.items.total() == 0){
|
||||
for(Tile other : tile.entity.proximity()){
|
||||
@@ -113,7 +113,7 @@ public class Unloader extends Block{
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
UnloaderEntity entity = tile.entity();
|
||||
UnloaderEntity entity = tile.ent();
|
||||
|
||||
Draw.color(entity.sortItem == null ? Color.clear : entity.sortItem.color);
|
||||
Draw.rect("unloader-center", tile.worldx(), tile.worldy());
|
||||
@@ -121,8 +121,8 @@ public class Unloader extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
UnloaderEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
UnloaderEntity entity = tile.ent();
|
||||
ItemSelection.buildItemTable(table, () -> entity.sortItem, item -> {
|
||||
lastItem = item;
|
||||
tile.configure(item == null ? -1 : item.id);
|
||||
|
||||
@@ -45,8 +45,8 @@ public class CommandCenter extends Block{
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.getTeam(), BlockFlag.comandCenter);
|
||||
|
||||
if(set.size > 0){
|
||||
CommandCenterEntity entity = tile.entity();
|
||||
CommandCenterEntity oe = set.first().entity();
|
||||
CommandCenterEntity entity = tile.ent();
|
||||
CommandCenterEntity oe = set.first().ent();
|
||||
entity.command = oe.command;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class CommandCenter extends Block{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
CommandCenterEntity entity = tile.entity();
|
||||
CommandCenterEntity entity = tile.ent();
|
||||
super.draw(tile);
|
||||
|
||||
float size = IconSize.small.size/4f;
|
||||
@@ -88,8 +88,8 @@ public class CommandCenter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTable(Tile tile, Table table){
|
||||
CommandCenterEntity entity = tile.entity();
|
||||
public void buildConfiguration(Tile tile, Table table){
|
||||
CommandCenterEntity entity = tile.ent();
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Table buttons = new Table();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CommandCenter extends Block{
|
||||
|
||||
for(Tile center : indexer.getAllied(tile.getTeam(), BlockFlag.comandCenter)){
|
||||
if(center.block() instanceof CommandCenter){
|
||||
CommandCenterEntity entity = center.entity();
|
||||
CommandCenterEntity entity = center.ent();
|
||||
entity.command = command;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class MechPad extends Block{
|
||||
public static void onMechFactoryTap(Player player, Tile tile){
|
||||
if(player == null || !(tile.block() instanceof MechPad) || !checkValidTap(tile, player)) return;
|
||||
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
if(!entity.cons.valid()) return;
|
||||
player.beginRespawning(entity);
|
||||
@@ -60,7 +60,7 @@ public class MechPad extends Block{
|
||||
public static void onMechFactoryDone(Tile tile){
|
||||
if(!(tile.entity instanceof MechFactoryEntity)) return;
|
||||
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
Effects.effect(Fx.spawn, entity);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class MechPad extends Block{
|
||||
}
|
||||
|
||||
protected static boolean checkValidTap(Tile tile, Player player){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
return !player.isDead() && tile.interactable(player.getTeam()) && Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
|
||||
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.cons.valid() && entity.player == null;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class MechPad extends Block{
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
if(checkValidTap(tile, player)){
|
||||
Call.onMechFactoryTap(player, tile);
|
||||
@@ -109,7 +109,7 @@ public class MechPad extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
if(entity.player != null){
|
||||
RespawnBlock.drawRespawn(tile, entity.heat, entity.progress, entity.time, entity.player, (!entity.sameMech && entity.player.mech == mech ? mech : Mechs.starter));
|
||||
@@ -118,7 +118,7 @@ public class MechPad extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
MechFactoryEntity entity = tile.ent();
|
||||
|
||||
if(entity.player != null){
|
||||
entity.player.set(tile.drawx(), tile.drawy());
|
||||
|
||||
@@ -66,14 +66,14 @@ public class RepairPoint extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
RepairPointEntity entity = tile.entity();
|
||||
RepairPointEntity entity = tile.ent();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy(), entity.rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLayer2(Tile tile){
|
||||
RepairPointEntity entity = tile.entity();
|
||||
RepairPointEntity entity = tile.ent();
|
||||
|
||||
if(entity.target != null &&
|
||||
Angles.angleDist(entity.angleTo(entity.target), entity.rotation) < 30f){
|
||||
@@ -95,7 +95,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
RepairPointEntity entity = tile.entity();
|
||||
RepairPointEntity entity = tile.ent();
|
||||
|
||||
boolean targetIsBeingRepaired = false;
|
||||
if(entity.target != null && (entity.target.isDead() || entity.target.dst(tile) > repairRadius || entity.target.health >= entity.target.maxHealth())){
|
||||
@@ -122,7 +122,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(Tile tile){
|
||||
RepairPointEntity entity = tile.entity();
|
||||
RepairPointEntity entity = tile.ent();
|
||||
|
||||
return entity.target != null;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class UnitFactory extends Block{
|
||||
public static void onUnitFactorySpawn(Tile tile, int spawns){
|
||||
if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitFactory)) return;
|
||||
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
UnitFactory factory = (UnitFactory)tile.block();
|
||||
|
||||
entity.buildTime = 0f;
|
||||
@@ -110,7 +110,7 @@ public class UnitFactory extends Block{
|
||||
|
||||
@Override
|
||||
public void unitRemoved(Tile tile, Unit unit){
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
entity.spawned--;
|
||||
entity.spawned = Math.max(entity.spawned, 0);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class UnitFactory extends Block{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
TextureRegion region = unitType.icon(Cicon.full);
|
||||
|
||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||
@@ -153,7 +153,7 @@ public class UnitFactory extends Block{
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
|
||||
if(entity.spawned >= maxSpawn){
|
||||
return;
|
||||
@@ -184,7 +184,7 @@ public class UnitFactory extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(Tile tile){
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitFactoryEntity entity = tile.ent();
|
||||
return entity.spawned < maxSpawn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user