Skip to content

Commit

Permalink
Merge pull request #45 from Brandanvimi/2.3.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Twcash authored Aug 19, 2024
2 parents 00ae727 + 5eb6a96 commit d8f678c
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/aquarion/blocks/AquaCrafters.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void loadContent(){
envEnabled|= Env.terrestrial | Env.underwater;
envDisabled|= Env.spores | Env.scorching;
squareSprite = false;
consume(new ConsumeRT(10));;
consume(new ConsumeRT(10));
}};
}
}
20 changes: 11 additions & 9 deletions src/aquarion/blocks/AquaDistribution.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ public static void loadContent() {
envDisabled |= Env.spores | Env.scorching;
}};

manganeseConveyor = new SealedConveyor("manganese-conveyor"){{
requirements(category.distribution, with(manganese, 1, gallium, 1, bauxite, 2));
speed = 4f;
stopSpeed = 45;
visualSpeed = 20;
envEnabled |= Env.terrestrial | Env.underwater;
envDisabled |= Env.spores | Env.scorching;
}};

sealedRouter = new Router("sealed-router"){{
requirements(category.distribution, with(lead, 10, bauxite, 5));
envEnabled |= Env.terrestrial | Env.underwater;
Expand All @@ -85,6 +76,17 @@ public static void loadContent() {
envEnabled |= Env.terrestrial | Env.underwater;
envDisabled |= Env.spores | Env.scorching;
}};

manganeseConveyor = new SealedConveyor("manganese-conveyor"){{
//Since `manganeseBridge instanceof DuctBridge` is false this doesn't work
//bridgeReplacement = manganeseBridge;
requirements(category.distribution, with(manganese, 1, gallium, 1, bauxite, 2));
speed = 4f;
stopSpeed = 45;
visualSpeed = 20;
envEnabled |= Env.terrestrial | Env.underwater;
envDisabled |= Env.spores | Env.scorching;
}};

sealedSorter = new Sorter("sealed-sorter"){{
requirements(category.distribution, with(lead, 5));
Expand Down
2 changes: 1 addition & 1 deletion src/aquarion/blocks/TorqueBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TorqueBlocks {

public static void loadContent() {
torqueSource = new RTGenericCrafter("torque-source"){{
buildVisibility = BuildVisibility.sandboxOnly;
requirements(Category.crafting, BuildVisibility.sandboxOnly, with());
size = 1;
output = 10;
ambientSound = Sounds.none;
Expand Down
4 changes: 2 additions & 2 deletions src/aquarion/world/blocks/ConsumeRT.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public ConsumeRT(float amount) {
this.amount = amount;
}
@Override public float efficiency(Building build) {
return build instanceof HasRT b ? Mathf.clamp(Math.abs(b.rotationPower) - amount) : 0f;
return build instanceof HasRT ? Mathf.clamp(Math.abs(((HasRT) build).rotationPower().rotationPower) - amount) : 0f;
}
@Override public float efficiencyMultiplier(Building build) {
return build instanceof HasRT b ? 1f + Mathf.map(Math.abs(b.rotationPower), amount, amount, 0, 1) : 0f;
return build instanceof HasRT ? 1f + Mathf.map(Math.abs(((HasRT) build).rotationPower().rotationPower), amount, amount, 0, 1) : 0f;
}

}
9 changes: 5 additions & 4 deletions src/aquarion/world/blocks/distribution/PayloadTram.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void updateTile() {
moveOutPayload();
}
Building link = world.build(this.link);
var other = (PayloadTramBuild) link;
PayloadTramBuild other = (PayloadTramBuild) link;
if(linkValid()){
if(payload != null) {
updatePayload();
Expand Down Expand Up @@ -252,7 +252,7 @@ public void draw() {
Draw.rect(capRegion, x, y);
if (linkValid()) {
Building link = world.build(this.link);
var other = (PayloadTramBuild) link;
PayloadTramBuild other = (PayloadTramBuild) link;
float x1 = this.x;
float x2 = other.x;
float y1 = this.y;
Expand Down Expand Up @@ -300,7 +300,7 @@ public void drawConfigure() {
Lines.stroke(1f);
Drawf.circles(x, y, (tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);

for (var shooter : waitingTram) {
for (Building shooter : waitingTram) {
Drawf.circles(shooter.x, shooter.y, (tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.place);
Drawf.arrow(shooter.x, shooter.y, x, y, size * tilesize + sin, 4f + sin, Pal.place);
}
Expand All @@ -314,7 +314,8 @@ public void drawConfigure() {
}

protected boolean linkValid() {
return link != -1 && world.build(this.link) instanceof PayloadTramBuild other && other.block == block && other.team == team && within(other, range);
Building other = world.build(this.link);
return link != -1 && other instanceof PayloadTramBuild && other.block == block && other.team == team && within(other, range);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/aquarion/world/blocks/distribution/SealedConveyor.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void onProximityUpdate(){
Building next = front(), prev = back();
capped = next == null || next.team != team || !next.block.hasItems;
backCapped = blendbits == 0 && (prev == null || prev.team != team || !prev.block.hasItems);
nextc = next instanceof Conveyor.ConveyorBuild d ? d : null;
nextc = next instanceof Conveyor.ConveyorBuild ? (Conveyor.ConveyorBuild) next : null;
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/aquarion/world/blocks/rotPower/RTWallCrafter.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void setBars() {

addBar("drillspeed", (WallCrafterBuild e) ->
new Bar(() -> Core.bundle.format("bar.drillspeed", Strings.fixed(e.lastEfficiency * 60 / drillTime, 2)), () -> Pal.ammo, () -> e.warmup));
rtConfig.addBars(this);
}

public class RTWallCrafterBuild extends WallCrafterBuild implements HasRT {
Expand Down
2 changes: 1 addition & 1 deletion src/aquarion/world/interfaces/HasRT.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ default float rotationConsumption() {
}

default Seq<HasRT> nextBuilds() {
return proximity().select(b -> b instanceof HasRT other && connects(other)).map(b -> ((HasRT) b).getRTDest(this)).removeAll(b -> !connects(b) && !b.connects(this));
return proximity().select(b -> b instanceof HasRT && connects((HasRT) b)).map(b -> ((HasRT) b).getRTDest(this)).removeAll(b -> !connects(b) && !b.connects(this));
}

RTModule rotationPower();
Expand Down
2 changes: 1 addition & 1 deletion src/aquarion/world/meta/RTModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* only holds a graph so that it's easier to change it
*/
public class RTModule extends BlockModule {
public RTGraph graph = new aquarion.world.graphs.RTGraph();
public RTGraph graph = new RTGraph();
public float rotationPower;

@Override
Expand Down

0 comments on commit d8f678c

Please sign in to comment.