it never ends
This commit is contained in:
@@ -19,7 +19,6 @@ import arc.util.pooling.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.effect.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -317,7 +316,7 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
|
||||
public void drawTeam(Tile tile){
|
||||
Draw.color(tile.getTeam().color);
|
||||
Draw.color(tile.team().color);
|
||||
Draw.rect("block-border", tile.drawx() - size * tilesize / 2f + 4, tile.drawy() - size * tilesize / 2f + 4);
|
||||
Draw.color();
|
||||
}
|
||||
@@ -372,7 +371,7 @@ public class Block extends BlockStorage{
|
||||
/** Call when some content is produced. This unlocks the content if it is applicable. */
|
||||
public void useContent(Tile tile, UnlockableContent content){
|
||||
//only unlocks content in zones
|
||||
if(!headless && tile.getTeam() == player.team() && world.isZone()){
|
||||
if(!headless && tile.team() == player.team() && world.isZone()){
|
||||
logic.handleContent(content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.effect.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.consumers.*;
|
||||
@@ -48,7 +47,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
|
||||
/** Returns the amount of items this block can accept. */
|
||||
public int acceptStack(Item item, int amount, Tile tile, Teamc source){
|
||||
if(acceptItem(item, tile, tile) && hasItems && (source == null || source.team() == tile.getTeam())){
|
||||
if(acceptItem(item, tile, tile) && hasItems && (source == null || source.team() == tile.team())){
|
||||
return Math.min(getMaximumAccepted(tile, item) - tile.entity.items().get(item), amount);
|
||||
}else{
|
||||
return 0;
|
||||
@@ -114,7 +113,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
|
||||
other = other.block().getLiquidDestination(other, in, liquid);
|
||||
|
||||
if(other != null && other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids() != null){
|
||||
if(other != null && other.team() == tile.team() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids() != null){
|
||||
float ofract = other.entity.liquids().get(liquid) / other.block().liquidCapacity;
|
||||
float fract = tile.entity.liquids().get(liquid) / liquidCapacity;
|
||||
|
||||
@@ -147,7 +146,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
next = next.link();
|
||||
next = next.block().getLiquidDestination(next, tile, liquid);
|
||||
|
||||
if(next.getTeam() == tile.getTeam() && next.block().hasLiquids && tile.entity.liquids().get(liquid) > 0f){
|
||||
if(next.team() == tile.team() && next.block().hasLiquids && tile.entity.liquids().get(liquid) > 0f){
|
||||
|
||||
if(next.block().acceptLiquid(next, tile, liquid, 0f)){
|
||||
float ofract = next.entity.liquids().get(liquid) / next.block().liquidCapacity;
|
||||
@@ -199,7 +198,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
incrementDump(tile, proximity.size);
|
||||
Tile other = proximity.get((i + dump) % proximity.size);
|
||||
Tile in = Edges.getFacingEdge(tile, other);
|
||||
if(other.getTeam() == tile.getTeam() && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
|
||||
if(other.team() == tile.team() && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
|
||||
other.block().handleItem(item, other, in);
|
||||
return;
|
||||
}
|
||||
@@ -236,7 +235,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
for(int ii = 0; ii < Vars.content.items().size; ii++){
|
||||
Item item = Vars.content.item(ii);
|
||||
|
||||
if(other.getTeam() == tile.getTeam() && entity.items().has(item) && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
|
||||
if(other.team() == tile.team() && entity.items().has(item) && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
|
||||
other.block().handleItem(item, other, in);
|
||||
tile.entity.items().remove(item, 1);
|
||||
incrementDump(tile, proximity.size);
|
||||
@@ -245,7 +244,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
}
|
||||
}else{
|
||||
|
||||
if(other.getTeam() == tile.getTeam() && other.block().acceptItem(todump, other, in) && canDump(tile, other, todump)){
|
||||
if(other.team() == tile.team() && other.block().acceptItem(todump, other, in) && canDump(tile, other, todump)){
|
||||
other.block().handleItem(todump, other, in);
|
||||
tile.entity.items().remove(todump, 1);
|
||||
incrementDump(tile, proximity.size);
|
||||
@@ -271,7 +270,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
/** Try offloading an item to a nearby container in its facing direction. Returns true if success. */
|
||||
public boolean offloadDir(Tile tile, Item item){
|
||||
Tile other = tile.front();
|
||||
if(other != null && other.getTeam() == tile.getTeam() && other.block().acceptItem(item, other, tile)){
|
||||
if(other != null && other.team() == tile.team() && other.block().acceptItem(item, other, tile)){
|
||||
other.block().handleItem(item, other, tile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CachedTile extends Tile{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Team getTeam(){
|
||||
public Team team(){
|
||||
return Team.get(getTeamID());
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ public class Tile implements Position{
|
||||
return (T)block;
|
||||
}
|
||||
|
||||
public Team getTeam(){
|
||||
public Team team(){
|
||||
return Team.get(link().team);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public class Tile implements Position{
|
||||
}
|
||||
|
||||
public boolean isEnemyCheat(){
|
||||
return getTeam() == state.rules.waveTeam && state.rules.enemyCheat;
|
||||
return team() == state.rules.waveTeam && state.rules.enemyCheat;
|
||||
}
|
||||
|
||||
public boolean isLinked(){
|
||||
@@ -385,7 +385,7 @@ public class Tile implements Position{
|
||||
}
|
||||
|
||||
public boolean interactable(Team team){
|
||||
return state.teams.canInteract(team, getTeam());
|
||||
return state.teams.canInteract(team, team());
|
||||
}
|
||||
|
||||
public @Nullable Item drop(){
|
||||
@@ -497,7 +497,7 @@ public class Tile implements Position{
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return floor.name + ":" + block.name + ":" + overlay + "[" + x + "," + y + "] " + "entity=" + (entity == null ? "null" : (entity.getClass())) + ":" + getTeam();
|
||||
return floor.name + ":" + block.name + ":" + overlay + "[" + x + "," + y + "] " + "entity=" + (entity == null ? "null" : (entity.getClass())) + ":" + team();
|
||||
}
|
||||
|
||||
//remote utility methods
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BuildBlock extends Block{
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onDeconstructFinish(Tile tile, Block block, int builderID){
|
||||
Team team = tile.getTeam();
|
||||
Team team = tile.team();
|
||||
Fx.breakBlock.at(tile.drawx(), tile.drawy(), block.size);
|
||||
Events.fire(new BlockBuildEndEvent(tile, Groups.player.getByID(builderID), team, true));
|
||||
tile.remove();
|
||||
|
||||
@@ -4,6 +4,7 @@ import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -11,7 +12,7 @@ import static mindustry.Vars.net;
|
||||
|
||||
public class RespawnBlock{
|
||||
|
||||
public static void drawRespawn(Tile tile, float heat, float progress, float time, Playerc player, Mech to){
|
||||
public static void drawRespawn(Tile tile, float heat, float progress, float time, Playerc player, UnitDef to){
|
||||
progress = Mathf.clamp(progress);
|
||||
|
||||
Draw.color(Pal.darkMetal);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DeflectorWall extends Wall{
|
||||
}
|
||||
|
||||
//bullet.updateVelocity();
|
||||
bullet.resetOwner(entity, entity.getTeam());
|
||||
bullet.resetOwner(entity, entity.team());
|
||||
bullet.scaleTime(1f);
|
||||
bullet.deflect();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ForceProjector extends Block{
|
||||
private static ForceProjector paramBlock;
|
||||
private static ForceEntity paramEntity;
|
||||
private static Cons<Shielderc> shieldConsumer = trait -> {
|
||||
if(trait.team() != paramTile.getTeam() && Intersector.isInsideHexagon(trait.x(), trait.y(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
|
||||
if(trait.team() != paramTile.team() && Intersector.isInsideHexagon(trait.x(), trait.y(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
|
||||
trait.absorb();
|
||||
Fx.absorb.at(trait);
|
||||
paramEntity.hit = 1f;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ShockMine extends Block{
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
super.draw(tile);
|
||||
Draw.color(tile.getTeam().color);
|
||||
Draw.color(tile.team().color);
|
||||
Draw.alpha(0.22f);
|
||||
Fill.rect(tile.drawx(), tile.drawy(), 2f, 2f);
|
||||
Draw.color();
|
||||
@@ -49,9 +49,9 @@ public class ShockMine extends Block{
|
||||
|
||||
@Override
|
||||
public void unitOn(Tile tile, Unitc unit){
|
||||
if(unit.getTeam() != tile.getTeam() && tile.entity.timer(timerDamage, cooldown)){
|
||||
if(unit.team() != tile.team() && tile.entity.timer(timerDamage, cooldown)){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(tile.getTeam(), Pal.lancerLaser, damage, tile.drawx(), tile.drawy(), Mathf.random(360f), length);
|
||||
Lightning.create(tile.team(), Pal.lancerLaser, damage, tile.drawx(), tile.drawy(), Mathf.random(360f), length);
|
||||
}
|
||||
tile.entity.damage(tileDamage);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package mindustry.world.blocks.defense;
|
||||
|
||||
import arc.math.Mathf;
|
||||
import mindustry.entities.effect.Lightning;
|
||||
import arc.math.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class SurgeWall extends Wall{
|
||||
public float lightningChance = 0.05f;
|
||||
@@ -15,10 +15,10 @@ public class SurgeWall extends Wall{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleBulletHit(Tilec entity, Bullet bullet){
|
||||
public void handleBulletHit(Tilec entity, Bulletc bullet){
|
||||
super.handleBulletHit(entity, bullet);
|
||||
if(Mathf.chance(lightningChance)){
|
||||
Lightning.create(entity.team(), Pal.surge, lightningDamage, bullet.x, bullet.y, bullet.rotation() + 180f, lightningLength);
|
||||
Lightning.create(entity.team(), Pal.surge, lightningDamage, bullet.x(), bullet.y(), bullet.rotation() + 180f, lightningLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ArtilleryTurret extends ItemTurret{
|
||||
float maxTraveled = type.lifetime * type.speed;
|
||||
|
||||
for(int i = 0; i < shots; i++){
|
||||
Bullet.create(ammo, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
|
||||
Bullet.create(ammo, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y,
|
||||
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), (dst / maxTraveled));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.world.blocks.defense.turrets;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.consumers.*;
|
||||
@@ -94,7 +95,7 @@ public class LaserTurret extends PowerTurret{
|
||||
protected void bullet(Tile tile, BulletType type, float angle){
|
||||
LaserTurretEntity entity = tile.ent();
|
||||
|
||||
entity.bullet = Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
entity.bullet = Bullet.create(type, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
entity.bulletLife = shootDuration;
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ public class LaserTurret extends PowerTurret{
|
||||
}
|
||||
|
||||
class LaserTurretEntity extends TurretEntity{
|
||||
Bullet bullet;
|
||||
Bulletc bullet;
|
||||
float bulletLife;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import arc.graphics.g2d.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.entities.effect.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@@ -131,7 +131,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), range, tile.getTeam().color);
|
||||
Drawf.dashCircle(tile.drawx(), tile.drawy(), range, tile.team().color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,16 +184,16 @@ public abstract class Turret extends Block{
|
||||
|
||||
protected boolean validateTarget(Tile tile){
|
||||
TurretEntity entity = tile.ent();
|
||||
return !Units.invalidateTarget(entity.target, tile.getTeam(), tile.drawx(), tile.drawy());
|
||||
return !Units.invalidateTarget(entity.target, tile.team(), tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
protected void findTarget(Tile tile){
|
||||
TurretEntity entity = tile.ent();
|
||||
|
||||
if(targetAir && !targetGround){
|
||||
entity.target = Units.closestEnemy(tile.getTeam(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && e.isFlying());
|
||||
entity.target = Units.closestEnemy(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && e.isFlying());
|
||||
}else{
|
||||
entity.target = Units.closestTarget(tile.getTeam(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && (!e.isFlying() || targetAir) && (e.isFlying() || targetGround));
|
||||
entity.target = Units.closestTarget(tile.team(), tile.drawx(), tile.drawy(), range, e -> !e.dead() && (!e.isFlying() || targetAir) && (e.isFlying() || targetGround));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void bullet(Tile tile, BulletType type, float angle){
|
||||
Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
Bullet.create(type, tile.entity, tile.team(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
}
|
||||
|
||||
protected void effects(Tile tile){
|
||||
|
||||
@@ -95,7 +95,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
|
||||
if(tile.front() != null && tile.front().entity != null){
|
||||
entity.next = tile.front().entity;
|
||||
entity.nextc = entity.next instanceof ConveyorEntity && entity.next.team() == tile.getTeam() ? (ConveyorEntity)entity.next : null;
|
||||
entity.nextc = entity.next instanceof ConveyorEntity && entity.next.team() == tile.team() ? (ConveyorEntity)entity.next : null;
|
||||
entity.aligned = entity.nextc != null && tile.rotation() == entity.next.tile.rotation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
if(tile.getTeam() != source.getTeam()) return false;
|
||||
if(tile.team() != source.team()) return false;
|
||||
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
Tile other = world.tile(entity.link);
|
||||
@@ -301,7 +301,7 @@ public class ItemBridge extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
if(tile.getTeam() != source.getTeam() || !hasLiquids) return false;
|
||||
if(tile.team() != source.team() || !hasLiquids) return false;
|
||||
|
||||
ItemBridgeEntity entity = tile.ent();
|
||||
Tile other = world.tile(entity.link);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Junction extends Block{
|
||||
if(dest != null) dest = dest.link();
|
||||
|
||||
//skip blocks that don't want the item, keep waiting until they do
|
||||
if(dest == null || !dest.block().acceptItem(item, dest, tile) || dest.getTeam() != tile.getTeam()){
|
||||
if(dest == null || !dest.block().acceptItem(item, dest, tile) || dest.team() != tile.team()){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Junction extends Block{
|
||||
|
||||
if(entity == null || relative == -1 || !entity.buffer.accepts(relative)) return false;
|
||||
Tile to = tile.getNearby(relative);
|
||||
return to != null && to.link().entity != null && to.getTeam() == tile.getTeam();
|
||||
return to != null && to.link().entity != null && to.team() == tile.team();
|
||||
}
|
||||
|
||||
class JunctionEntity extends Tilec{
|
||||
|
||||
@@ -214,7 +214,7 @@ public class MassDriver extends Block{
|
||||
if(entity.link == other.pos()){
|
||||
tile.configure(-1);
|
||||
return false;
|
||||
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.getTeam() == tile.getTeam()){
|
||||
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.team() == tile.team()){
|
||||
tile.configure(other.pos());
|
||||
return false;
|
||||
}
|
||||
@@ -248,9 +248,9 @@ public class MassDriver extends Block{
|
||||
|
||||
float angle = tile.angleTo(target);
|
||||
|
||||
Bullet.create(Bullets.driverBolt, entity, entity.getTeam(),
|
||||
Bullets.driverBolt.create(entity, entity.team(),
|
||||
tile.drawx() + Angles.trnsx(angle, translation), tile.drawy() + Angles.trnsy(angle, translation),
|
||||
angle, 1f, 1f, data);
|
||||
angle, -1f, 1f, 1f, data);
|
||||
|
||||
shootEffect.at(tile.drawx() + Angles.trnsx(angle, translation),
|
||||
tile.drawy() + Angles.trnsy(angle, translation), angle);
|
||||
@@ -261,7 +261,7 @@ public class MassDriver extends Block{
|
||||
Effects.shake(shake, shake, entity);
|
||||
}
|
||||
|
||||
protected void handlePayload(MassDriverEntity entity, Bullet bullet, DriverBulletData data){
|
||||
protected void handlePayload(MassDriverEntity entity, Bulletc bullet, DriverBulletData data){
|
||||
int totalItems = entity.items().total();
|
||||
|
||||
//add all the items possible
|
||||
@@ -297,7 +297,7 @@ public class MassDriver extends Block{
|
||||
if(entity == null || entity.link == -1) return false;
|
||||
Tile link = world.tile(entity.link);
|
||||
|
||||
return link != null && link.block() instanceof MassDriver && link.getTeam() == tile.getTeam() && tile.dst(link) <= range;
|
||||
return link != null && link.block() instanceof MassDriver && link.team() == tile.team() && tile.dst(link) <= range;
|
||||
}
|
||||
|
||||
public static class DriverBulletData implements Poolable{
|
||||
@@ -322,8 +322,8 @@ public class MassDriver extends Block{
|
||||
return waitingShooters.isEmpty() ? null : waitingShooters.first();
|
||||
}
|
||||
|
||||
public void handlePayload(Bullet bullet, DriverBulletData data){
|
||||
((MassDriver)block).handlePayload(this, bullet, data);
|
||||
public void handlePayload(Bulletc bullet, DriverBulletData data){
|
||||
((MassDriver)block()).handlePayload(this, bullet, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class OverflowGate extends Block{
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
OverflowGateEntity entity = tile.ent();
|
||||
|
||||
return tile.getTeam() == source.getTeam() && entity.lastItem == null && entity.items().total() == 0;
|
||||
return tile.team() == source.team() && entity.lastItem == null && entity.items().total() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +83,13 @@ public class OverflowGate extends Block{
|
||||
Tile to = tile.getNearby((from + 2) % 4);
|
||||
if(to == null) return null;
|
||||
Tile edge = Edges.getFacingEdge(tile, to);
|
||||
boolean canForward = to.block().acceptItem(item, to, edge) && to.getTeam() == tile.getTeam() && !(to.block() instanceof OverflowGate);
|
||||
boolean canForward = to.block().acceptItem(item, to, edge) && to.team() == tile.team() && !(to.block() instanceof OverflowGate);
|
||||
|
||||
if(!canForward || invert){
|
||||
Tile a = tile.getNearby(Mathf.mod(from - 1, 4));
|
||||
Tile b = tile.getNearby(Mathf.mod(from + 1, 4));
|
||||
boolean ac = a != null && a.block().acceptItem(item, a, edge) && !(a.block() instanceof OverflowGate) && a.getTeam() == tile.getTeam();
|
||||
boolean bc = b != null && b.block().acceptItem(item, b, edge) && !(b.block() instanceof OverflowGate) && b.getTeam() == tile.getTeam();
|
||||
boolean ac = a != null && a.block().acceptItem(item, a, edge) && !(a.block() instanceof OverflowGate) && a.team() == tile.team();
|
||||
boolean bc = b != null && b.block().acceptItem(item, b, edge) && !(b.block() instanceof OverflowGate) && b.team() == tile.team();
|
||||
|
||||
if(!ac && !bc){
|
||||
return invert && canForward ? to : null;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Router extends Block{
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
RouterEntity entity = tile.ent();
|
||||
|
||||
return tile.getTeam() == source.getTeam() && entity.lastItem == null && entity.items().total() == 0;
|
||||
return tile.team() == source.team() && entity.lastItem == null && entity.items().total() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,7 +74,7 @@ public class Sorter extends Block{
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
Tile to = getTileTarget(item, tile, source, false);
|
||||
|
||||
return to != null && to.block().acceptItem(item, to, tile) && to.getTeam() == tile.getTeam();
|
||||
return to != null && to.block().acceptItem(item, to, tile) && to.team() == tile.team();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ArmoredConduit extends Conduit{
|
||||
|
||||
// draw the cap when a conduit would normally leak
|
||||
Tile next = tile.front();
|
||||
if(next != null && next.getTeam() == tile.getTeam() && next.block().hasLiquids) return;
|
||||
if(next != null && next.team() == tile.team() && next.block().hasLiquids) return;
|
||||
|
||||
Draw.rect(capRegion, tile.drawx(), tile.drawy(), tile.rotation() * 90);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PowerDiode extends Block{
|
||||
public void update(Tile tile){
|
||||
super.update(tile);
|
||||
|
||||
if(tile.front() == null || tile.back() == null || !tile.back().block().hasPower || !tile.front().block().hasPower || tile.back().getTeam() != tile.front().getTeam()) return;
|
||||
if(tile.front() == null || tile.back() == null || !tile.back().block().hasPower || !tile.front().block().hasPower || tile.back().team() != tile.front().team()) return;
|
||||
|
||||
PowerGraph backGraph = tile.back().entity.power().graph;
|
||||
PowerGraph frontGraph = tile.front().entity.power().graph;
|
||||
|
||||
@@ -134,7 +134,7 @@ public class PowerNode extends PowerBlock{
|
||||
private void getPotentialLinks(Tile tile, Cons<Tile> others){
|
||||
Boolf<Tile> valid = other -> other != null && other != tile && other.entity != null && other.entity.power() != null &&
|
||||
((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower) || other.block() instanceof PowerNode) &&
|
||||
overlaps(tile.x * tilesize + offset(), tile.y * tilesize + offset(), other, laserRange * tilesize) && other.getTeam() == player.team()
|
||||
overlaps(tile.x * tilesize + offset(), tile.y * tilesize + offset(), other, laserRange * tilesize) && other.team() == player.team()
|
||||
&& !other.entity.proximity().contains(tile) && !graphs.contains(other.entity.power().graph);
|
||||
|
||||
tempTiles.clear();
|
||||
@@ -289,7 +289,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
public boolean linkValid(Tile tile, Tile link, boolean checkMaxNodes){
|
||||
if(tile == link || link == null || link.entity == null || tile.entity == null || !link.block().hasPower || tile.getTeam() != link.getTeam()) return false;
|
||||
if(tile == link || link == null || link.entity == null || tile.entity == null || !link.block().hasPower || tile.team() != link.team()) return false;
|
||||
|
||||
if(overlaps(tile, link, laserRange * tilesize) || (link.block() instanceof PowerNode && overlaps(link, tile, link.<PowerNode>cblock().laserRange * tilesize))){
|
||||
if(checkMaxNodes && link.block() instanceof PowerNode){
|
||||
|
||||
@@ -83,7 +83,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public void onProximityUpdate(Tile tile){
|
||||
CoreEntity entity = tile.ent();
|
||||
|
||||
for(Tilec other : state.teams.cores(tile.getTeam())){
|
||||
for(Tilec other : state.teams.cores(tile.team())){
|
||||
if(other.tile() != tile){
|
||||
entity.items(other.items());
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class CoreBlock extends StorageBlock{
|
||||
t.<StorageBlockEntity>ent().linkedCore = tile;
|
||||
});
|
||||
|
||||
for(Tilec other : state.teams.cores(tile.getTeam())){
|
||||
for(Tilec other : state.teams.cores(tile.team())){
|
||||
if(other.tile() == tile) continue;
|
||||
entity.storageCapacity += other.block().itemCapacity + other.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
}
|
||||
|
||||
for(CoreEntity other : state.teams.cores(tile.getTeam())){
|
||||
for(CoreEntity other : state.teams.cores(tile.team())){
|
||||
other.storageCapacity = entity.storageCapacity;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class CoreBlock extends StorageBlock{
|
||||
@Override
|
||||
public float handleDamage(Tile tile, float amount){
|
||||
//TODO implement
|
||||
//if(player != null && tile.getTeam() == player.team()){
|
||||
//if(player != null && tile.team() == player.team()){
|
||||
// Events.fire(Trigger.teamCoreDamage);
|
||||
//}
|
||||
return amount;
|
||||
@@ -152,7 +152,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public void removed(Tile tile){
|
||||
CoreEntity entity = tile.ent();
|
||||
int total = tile.entity.proximity().count(e -> e.entity != null && e.entity.items() != null && e.entity.items() == tile.entity.items());
|
||||
float fract = 1f / total / state.teams.cores(tile.getTeam()).size;
|
||||
float fract = 1f / total / state.teams.cores(tile.team()).size;
|
||||
|
||||
tile.entity.proximity().each(e -> isContainer(e) && e.entity.items() == tile.entity.items(), t -> {
|
||||
StorageBlockEntity ent = (StorageBlockEntity)t.entity;
|
||||
@@ -165,12 +165,12 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
state.teams.unregisterCore(entity);
|
||||
|
||||
int max = itemCapacity * state.teams.cores(tile.getTeam()).size;
|
||||
int max = itemCapacity * state.teams.cores(tile.team()).size;
|
||||
for(Item item : content.items()){
|
||||
tile.entity.items().set(item, Math.min(tile.entity.items().get(item), max));
|
||||
}
|
||||
|
||||
for(CoreEntity other : state.teams.cores(tile.getTeam())){
|
||||
for(CoreEntity other : state.teams.cores(tile.team())){
|
||||
other.block().onProximityUpdate(other.tile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Unloader extends Block{
|
||||
|
||||
if(tile.entity.timer(timerUnload, speed / entity.timeScale) && tile.entity.items().total() == 0){
|
||||
for(Tile other : tile.entity.proximity()){
|
||||
if(other.interactable(tile.getTeam()) && other.block().unloadable && other.block().hasItems && entity.items().total() == 0 &&
|
||||
if(other.interactable(tile.team()) && other.block().unloadable && other.block().hasItems && entity.items().total() == 0 &&
|
||||
((entity.sortItem == null && other.entity.items().total() > 0) || hasItem(other, entity.sortItem))){
|
||||
offloadNear(tile, removeItem(other, entity.sortItem));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CommandCenter extends Block{
|
||||
@Override
|
||||
public void placed(Tile tile){
|
||||
super.placed(tile);
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.getTeam(), BlockFlag.comandCenter);
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.team(), BlockFlag.comandCenter);
|
||||
|
||||
if(set.size > 0){
|
||||
CommandCenterEntity entity = tile.ent();
|
||||
@@ -54,10 +54,10 @@ public class CommandCenter extends Block{
|
||||
public void removed(Tile tile){
|
||||
super.removed(tile);
|
||||
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.getTeam(), BlockFlag.comandCenter);
|
||||
ObjectSet<Tile> set = indexer.getAllied(tile.team(), BlockFlag.comandCenter);
|
||||
|
||||
if(set.size == 1){
|
||||
Units.each(tile.getTeam(), u -> u.onCommand(UnitCommand.all[0]));
|
||||
Groups.unit.each(t -> t.team() == tile.team(), u -> u.onCommand(UnitCommand.all[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,14 +106,14 @@ public class CommandCenter extends Block{
|
||||
UnitCommand command = UnitCommand.all[value];
|
||||
((CommandCenter)tile.block()).effect.at(tile);
|
||||
|
||||
for(Tile center : indexer.getAllied(tile.getTeam(), BlockFlag.comandCenter)){
|
||||
for(Tile center : indexer.getAllied(tile.team(), BlockFlag.comandCenter)){
|
||||
if(center.block() instanceof CommandCenter){
|
||||
CommandCenterEntity entity = center.ent();
|
||||
entity.command = command;
|
||||
}
|
||||
}
|
||||
|
||||
Units.each(tile.getTeam(), u -> u.onCommand(command));
|
||||
Groups.unit.each(t -> t.team() == tile.team(), u -> u.onCommand(command));
|
||||
Events.fire(new CommandIssueEvent(tile, command));
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
if(entity.timer(timerTarget, 20)){
|
||||
rect.setSize(repairRadius * 2).setCenter(tile.drawx(), tile.drawy());
|
||||
entity.target = Units.closest(tile.getTeam(), tile.drawx(), tile.drawy(), repairRadius,
|
||||
entity.target = Units.closest(tile.team(), tile.drawx(), tile.drawy(), repairRadius,
|
||||
unit -> unit.health < unit.maxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class UnitFactory extends Block{
|
||||
if(!net.client()){
|
||||
//TODO create the unit
|
||||
/*
|
||||
Unitc unit = factory.unitType.create(tile.getTeam());
|
||||
Unitc unit = factory.unitType.create(tile.team());
|
||||
unit.setSpawner(tile);
|
||||
unit.set(tile.drawx() + Mathf.range(4), tile.drawy() + Mathf.range(4));
|
||||
unit.add();
|
||||
|
||||
@@ -4,6 +4,7 @@ import arc.struct.*;
|
||||
import arc.func.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.Cicon;
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.world.consumers;
|
||||
import arc.struct.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.Cicon;
|
||||
|
||||
Reference in New Issue
Block a user