Certain team-specific rules
This commit is contained in:
@@ -342,11 +342,11 @@ public class Block extends UnlockableContent{
|
||||
}
|
||||
|
||||
/** @return a possible replacement for this block when placed in a line by the player. */
|
||||
public Block getReplacement(BuildRequest req, Seq<BuildRequest> requests){
|
||||
public Block getReplacement(BuildPlan req, Seq<BuildPlan> requests){
|
||||
return this;
|
||||
}
|
||||
|
||||
public void drawRequest(BuildRequest req, Eachable<BuildRequest> list, boolean valid){
|
||||
public void drawRequest(BuildPlan req, Eachable<BuildPlan> list, boolean valid){
|
||||
Draw.reset();
|
||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime(), 6f, 0.28f));
|
||||
Draw.alpha(1f);
|
||||
@@ -357,7 +357,7 @@ public class Block extends UnlockableContent{
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
TextureRegion reg = getRequestRegion(req, list);
|
||||
Draw.rect(reg, req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90);
|
||||
|
||||
@@ -366,15 +366,15 @@ public class Block extends UnlockableContent{
|
||||
}
|
||||
}
|
||||
|
||||
public TextureRegion getRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public TextureRegion getRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
return icon(Cicon.full);
|
||||
}
|
||||
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
public void drawRequestConfigCenter(BuildRequest req, Object content, String region){
|
||||
public void drawRequestConfigCenter(BuildPlan req, Object content, String region){
|
||||
Color color = content instanceof Item ? ((Item)content).color : content instanceof Liquid ? ((Liquid)content).color : null;
|
||||
if(color == null) return;
|
||||
|
||||
@@ -383,7 +383,7 @@ public class Block extends UnlockableContent{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawRequestConfigTop(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -346,10 +346,6 @@ public class Tile implements Position, QuadTreeObject{
|
||||
return block.destructible || block.breakable || block.update;
|
||||
}
|
||||
|
||||
public boolean isEnemyCheat(){
|
||||
return team() == state.rules.waveTeam && state.rules.enemyCheat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of all tiles linked to this multiblock, or just itself if it's not a multiblock.
|
||||
* This array contains all linked tiles, including this tile itself.
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface Autotiler{
|
||||
//holds some static temporary variables, required due to some RoboVM bugs
|
||||
class AutotilerHolder{
|
||||
static final int[] blendresult = new int[5];
|
||||
static final BuildRequest[] directionals = new BuildRequest[4];
|
||||
static final BuildPlan[] directionals = new BuildPlan[4];
|
||||
}
|
||||
|
||||
/** slices a texture region:
|
||||
@@ -44,9 +44,9 @@ public interface Autotiler{
|
||||
return region;
|
||||
}
|
||||
|
||||
default @Nullable int[] getTiling(BuildRequest req, Eachable<BuildRequest> list){
|
||||
default @Nullable int[] getTiling(BuildPlan req, Eachable<BuildPlan> list){
|
||||
if(req.tile() == null) return null;
|
||||
BuildRequest[] directionals = AutotilerHolder.directionals;
|
||||
BuildPlan[] directionals = AutotilerHolder.directionals;
|
||||
|
||||
Arrays.fill(directionals, null);
|
||||
list.each(other -> {
|
||||
@@ -78,7 +78,7 @@ public interface Autotiler{
|
||||
* [3]: a 4-bit mask with bits 0-3 indicating blend state in that direction (0 being 0 degrees, 1 being 90, etc)
|
||||
* [4]: same as [3] but only blends with non-square sprites
|
||||
* */
|
||||
default int[] buildBlending(Tile tile, int rotation, BuildRequest[] directional, boolean world){
|
||||
default int[] buildBlending(Tile tile, int rotation, BuildPlan[] directional, boolean world){
|
||||
int[] blendresult = AutotilerHolder.blendresult;
|
||||
blendresult[0] = 0;
|
||||
blendresult[1] = blendresult[2] = 1;
|
||||
@@ -134,10 +134,10 @@ public interface Autotiler{
|
||||
return Point2.equals(x + Geometry.d4(rotation).x,y + Geometry.d4(rotation).y, x2, y2);
|
||||
}
|
||||
|
||||
default boolean blends(Tile tile, int rotation, @Nullable BuildRequest[] directional, int direction, boolean checkWorld){
|
||||
default boolean blends(Tile tile, int rotation, @Nullable BuildPlan[] directional, int direction, boolean checkWorld){
|
||||
int realDir = Mathf.mod(rotation - direction, 4);
|
||||
if(directional != null && directional[realDir] != null){
|
||||
BuildRequest req = directional[realDir];
|
||||
BuildPlan req = directional[realDir];
|
||||
if(blends(tile, rotation, req.x, req.y, req.rotation, req.block)){
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class BuildBlock extends Block{
|
||||
if(control.input.buildWasAutoPaused && !control.input.isBuilding && player.isBuilder()){
|
||||
control.input.isBuilding = true;
|
||||
}
|
||||
player.builder().addBuild(new BuildRequest(tile.x, tile.y, tile.rotation(), cblock), false);
|
||||
player.builder().addBuild(new BuildPlan(tile.x, tile.y, tile.rotation(), cblock), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Door extends Wall{
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public TextureRegion getRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
return req.config == Boolean.TRUE ? openRegion : region;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class MendProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
heat = Mathf.lerpDelta(heat, consValid() || tile.isEnemyCheat() ? 1f : 0f, 0.08f);
|
||||
heat = Mathf.lerpDelta(heat, consValid() || cheating() ? 1f : 0f, 0.08f);
|
||||
charge += heat * delta();
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(cons().optionalValid()), 0.1f);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ItemTurret extends Turret{
|
||||
super.onProximityAdded();
|
||||
|
||||
//add first ammo item to cheaty blocks so they can shoot properly
|
||||
if(tile.isEnemyCheat() && ammo.size > 0){
|
||||
if(cheating() && ammo.size > 0){
|
||||
handleItem(this, ammoTypes.entries().next().key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class LaserTurret extends PowerTurret{
|
||||
Liquid liquid = liquids().current();
|
||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||
|
||||
float used = (tile.isEnemyCheat() ? maxUsed * Time.delta() : Math.min(liquids.get(liquid), maxUsed * Time.delta())) * liquid.heatCapacity * coolantMultiplier;
|
||||
float used = (cheating() ? maxUsed * Time.delta() : Math.min(liquids.get(liquid), maxUsed * Time.delta())) * liquid.heatCapacity * coolantMultiplier;
|
||||
reload -= used;
|
||||
liquids.remove(liquid, used);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class LaserTurret extends PowerTurret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && (consValid() || tile.isEnemyCheat())){
|
||||
if(reload <= 0 && (consValid() || cheating())){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class LiquidTurret extends Turret{
|
||||
|
||||
@Override
|
||||
public BulletType useAmmo(){
|
||||
if(tile.isEnemyCheat()) return ammoTypes.get(liquids.current());
|
||||
if(cheating()) return ammoTypes.get(liquids.current());
|
||||
BulletType type = ammoTypes.get(liquids.current());
|
||||
liquids.remove(liquids.current(), type.ammoMultiplier);
|
||||
return type;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PowerTurret extends Turret{
|
||||
|
||||
@Override
|
||||
protected float baseReloadSpeed(){
|
||||
return tile.isEnemyCheat() ? 1f : power.status;
|
||||
return cheating() ? 1f : power.status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
/** Consume ammo and return a type. */
|
||||
public BulletType useAmmo(){
|
||||
if(tile.isEnemyCheat()) return peekAmmo();
|
||||
if(cheating()) return peekAmmo();
|
||||
|
||||
AmmoEntry entry = ammo.peek();
|
||||
entry.amount -= ammoPerShot;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(req, list);
|
||||
|
||||
if(bits == null) return;
|
||||
@@ -81,7 +81,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getReplacement(BuildRequest req, Seq<BuildRequest> requests){
|
||||
public Block getReplacement(BuildPlan req, Seq<BuildPlan> requests){
|
||||
Boolf<Point2> cont = p -> requests.contains(o -> o.x == req.x + p.x && o.y == req.y + p.y && o.rotation == req.rotation && (req.block instanceof Conveyor || req.block instanceof Junction));
|
||||
return cont.get(Geometry.d4(req.rotation)) &&
|
||||
cont.get(Geometry.d4(req.rotation - 2)) &&
|
||||
|
||||
@@ -20,7 +20,7 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ItemBridge extends Block{
|
||||
private static BuildRequest otherReq;
|
||||
private static BuildPlan otherReq;
|
||||
|
||||
public final int timerTransport = timers++;
|
||||
public int range;
|
||||
@@ -50,7 +50,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||
otherReq = null;
|
||||
list.each(other -> {
|
||||
if(other.block == this && req != other && req.config instanceof Point2 && ((Point2)req.config).equals(other.x - req.x, other.y - req.y)){
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PayloadRouter extends PayloadConveyor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
super.drawRequestRegion(req, list);
|
||||
|
||||
Draw.rect(overRegion, req.drawx(), req.drawy());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Sorter extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(req, list);
|
||||
|
||||
if(bits == null) return;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BlockForge extends PayloadAcceptor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, req.drawx(), req.drawy());
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BlockLoader extends PayloadAcceptor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, req.drawx(), req.drawy());
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
Draw.rect(topRegion, req.drawx(), req.drawy());
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(req, list);
|
||||
|
||||
if(bits == null) return;
|
||||
@@ -53,7 +53,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getReplacement(BuildRequest req, Seq<BuildRequest> requests){
|
||||
public Block getReplacement(BuildPlan req, Seq<BuildPlan> requests){
|
||||
Boolf<Point2> cont = p -> requests.contains(o -> o.x == req.x + p.x && o.y == req.y + p.y && o.rotation == req.rotation && (req.block instanceof Conduit || req.block instanceof LiquidJunction));
|
||||
return cont.get(Geometry.d4(req.rotation)) &&
|
||||
cont.get(Geometry.d4(req.rotation - 2)) &&
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PowerDiode extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
Draw.rect(icon(Cicon.full), req.drawx(), req.drawy());
|
||||
Draw.rect(arrow, req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public class PowerGraph{
|
||||
public void update(){
|
||||
if(Core.graphics.getFrameId() == lastFrameUpdated){
|
||||
return;
|
||||
}else if(!consumers.isEmpty() && consumers.first().tile().isEnemyCheat()){
|
||||
}else if(!consumers.isEmpty() && consumers.first().cheating()){
|
||||
//when cheating, just set status to 1
|
||||
for(Tilec tile : consumers){
|
||||
tile.power().status = 1f;
|
||||
|
||||
@@ -22,7 +22,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class PowerNode extends PowerBlock{
|
||||
protected static boolean returnValue = false;
|
||||
protected static BuildRequest otherReq;
|
||||
protected static BuildPlan otherReq;
|
||||
|
||||
protected final ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
||||
protected final Vec2 t1 = new Vec2(), t2 = new Vec2();
|
||||
@@ -201,7 +201,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||
if(req.config instanceof Point2[]){
|
||||
for(Point2 point : (Point2[])req.config){
|
||||
otherReq = null;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfigTop(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||
if(!req.worldContext) return;
|
||||
Tile tile = req.tile();
|
||||
if(tile == null) return;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ItemSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LiquidSource extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Unloader extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "unloader-center");
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Reconstructor extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, req.drawx(), req.drawy());
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
Draw.rect(topRegion, req.drawx(), req.drawy());
|
||||
|
||||
@@ -90,7 +90,7 @@ public class UnitFactory extends UnitBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildRequest req, Eachable<BuildRequest> list){
|
||||
public void drawRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
Draw.rect(region, req.drawx(), req.drawy());
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
Draw.rect(topRegion, req.drawx(), req.drawy());
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ConsumeModule extends BlockModule{
|
||||
}
|
||||
|
||||
public void update(){
|
||||
//everything is valid here
|
||||
if(entity.tile().isEnemyCheat()){
|
||||
//everything is valid when cheating
|
||||
if(entity.cheating()){
|
||||
valid = optionalValid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user