Zone requirement changes / Bugfixes

This commit is contained in:
Anuken
2019-04-20 19:57:20 -04:00
parent af91979d4c
commit 75dcceff43
23 changed files with 2255 additions and 2077 deletions

View File

@@ -36,7 +36,7 @@ public class Blocks implements ContentList{
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock, saltRocks,
creeptree,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
pebbles,
pebbles, tendrils,
//ores
oreCopper, oreLead, oreScrap, oreCoal, oreTitanium, oreThorium,
@@ -379,6 +379,8 @@ public class Blocks implements ContentList{
pebbles = new OverlayFloor("pebbles");
tendrils = new OverlayFloor("tendrils");
//endregion
//region ore

View File

@@ -36,7 +36,7 @@ public class Zones implements ContentList{
desertWastes = new Zone("desertWastes", new DesertWastesGenerator(260, 260)){{
startingItems = ItemStack.list(Items.copper, 200);
conditionWave = 10;
zoneRequirements = ZoneRequirement.with(groundZero, 10);
zoneRequirements = ZoneRequirement.with(groundZero, 15);
blockRequirements = new Block[]{Blocks.router};
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.sand};
rules = () -> new Rules(){{
@@ -49,7 +49,7 @@ public class Zones implements ContentList{
saltFlats = new Zone("saltFlats", new DesertWastesGenerator(260, 260)){{
startingItems = ItemStack.list(Items.copper, 200);
conditionWave = 10;
zoneRequirements = ZoneRequirement.with(groundZero, 10);
zoneRequirements = ZoneRequirement.with(desertWastes, 25);
blockRequirements = new Block[]{Blocks.router};
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.sand};
rules = () -> new Rules(){{
@@ -62,7 +62,7 @@ public class Zones implements ContentList{
overgrowth = new Zone("overgrowth", new OvergrowthGenerator(320, 320)){{
startingItems = ItemStack.list(Items.copper, 200);
conditionWave = 10;
zoneRequirements = ZoneRequirement.with(groundZero, 10);
zoneRequirements = ZoneRequirement.with(craters, 15);
blockRequirements = new Block[]{Blocks.router};
resources = new Item[]{Items.copper, Items.lead, Items.coal};
rules = () -> new Rules(){{
@@ -106,7 +106,7 @@ public class Zones implements ContentList{
startingItems = ItemStack.list(Items.copper, 400);
conditionWave = 20;
launchPeriod = 20;
zoneRequirements = ZoneRequirement.with(frozenForest, 10, craters, 15);
zoneRequirements = ZoneRequirement.with(desertWastes, 10, craters, 15);
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator};
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
rules = () -> new Rules(){{

View File

@@ -76,21 +76,21 @@ public class UI implements ApplicationListener{
Core.input.addProcessor(Core.scene);
Dialog.setShowAction(() -> sequence(
alpha(0f),
originCenter(),
moveToAligned(Core.graphics.getWidth() / 2f, Core.graphics.getHeight() / 2f, Align.center),
scaleTo(0.0f, 1f),
parallel(
scaleTo(1f, 1f, 0.1f, Interpolation.fade),
fadeIn(0.1f, Interpolation.fade)
)
alpha(0f),
originCenter(),
moveToAligned(Core.graphics.getWidth() / 2f, Core.graphics.getHeight() / 2f, Align.center),
scaleTo(0.0f, 1f),
parallel(
scaleTo(1f, 1f, 0.1f, Interpolation.fade),
fadeIn(0.1f, Interpolation.fade)
)
));
Dialog.setHideAction(() -> sequence(
parallel(
scaleTo(0.01f, 0.01f, 0.1f, Interpolation.fade),
fadeOut(0.1f, Interpolation.fade)
)
parallel(
scaleTo(0.01f, 0.01f, 0.1f, Interpolation.fade),
fadeOut(0.1f, Interpolation.fade)
)
));
TooltipManager.getInstance().animations = false;

View File

@@ -86,6 +86,7 @@ public class Damage{
tr.trns(angle, length);
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
Tile tile = world.tile(cx, cy);
if(tile != null) tile = tile.target();
if(tile != null && tile.entity != null && tile.target().getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
tile.entity.collision(hitter);
hitter.getBulletType().hit(hitter, tile.worldx(), tile.worldy());
@@ -113,7 +114,7 @@ public class Damage{
rect.width += expand * 2;
rect.height += expand * 2;
Consumer<io.anuke.mindustry.entities.type.Unit> cons = e -> {
Consumer<Unit> cons = e -> {
e.hitbox(hitrect);
Rectangle other = hitrect;
other.y -= expand;
@@ -134,8 +135,8 @@ public class Damage{
}
/** Damages all entities and blocks in a radius that are enemies of the team. */
public static void damageUnits(Team team, float x, float y, float size, float damage, Predicate<io.anuke.mindustry.entities.type.Unit> predicate, Consumer<io.anuke.mindustry.entities.type.Unit> acceptor){
Consumer<io.anuke.mindustry.entities.type.Unit> cons = entity -> {
public static void damageUnits(Team team, float x, float y, float size, float damage, Predicate<Unit> predicate, Consumer<Unit> acceptor){
Consumer<Unit> cons = entity -> {
if(!predicate.test(entity)) return;
entity.hitbox(hitrect);

View File

@@ -24,7 +24,6 @@ public class Zone extends UnlockableContent{
public final Generator generator;
public Block[] blockRequirements = {};
public ZoneRequirement[] zoneRequirements = {};
//TODO debug verify resources.
public Item[] resources = {};
public Supplier<Rules> rules = Rules::new;
public boolean alwaysUnlocked;

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.scene.Group;
@@ -10,6 +11,7 @@ import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.Align;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.Zones;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Saves.SaveSlot;
@@ -97,6 +99,17 @@ public class DeployDialog extends FloatingDialog{
}).growX().height(50f).pad(-12).padTop(10);
}}, new ItemsDisplay()).grow();
//set up direct and indirect children
for(ZoneNode node : nodes){
node.allChildren.clear();
node.allChildren.addAll(node.children);
for(ZoneNode other : new ObjectSetIterator<>(nodes)){
if(Structs.contains(other.zone.zoneRequirements, req -> req.zone == node.zone)){
node.allChildren.add(other);
}
}
}
}
boolean hidden(Zone zone){
@@ -155,7 +168,7 @@ public class DeployDialog extends FloatingDialog{
float offsetX = panX + width / 2f + x, offsetY = panY + height / 2f + y;
for(ZoneNode node : nodes){
for(ZoneNode child : node.children){
for(ZoneNode child : node.allChildren){
Lines.stroke(Unit.dp.scl(3f), node.zone.locked() || child.zone.locked() ? Pal.locked : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}
@@ -168,6 +181,7 @@ public class DeployDialog extends FloatingDialog{
class ZoneNode extends TreeNode<ZoneNode>{
final Array<Zone> arr = new Array<>();
final Array<ZoneNode> allChildren = new Array<>();
final Zone zone;
ZoneNode(Zone zone, ZoneNode parent){

View File

@@ -45,7 +45,8 @@ public class StaticWall extends Rock{
}
boolean eq(int rx, int ry){
return world.tile(rx + 1, ry).block() == this
return rx < world.width() - 1 && ry < world.height() - 1
&& world.tile(rx + 1, ry).block() == this
&& world.tile(rx, ry + 1).block() == this
&& world.tile(rx, ry).block() == this
&& world.tile(rx + 1, ry + 1).block() == this;

View File

@@ -52,7 +52,7 @@ public class OverdriveProjector extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Draw.color(Pal.accent);
Lines.dashCircle(x * tilesize, y * tilesize, range);
Lines.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range);
Draw.color();
}
@@ -90,7 +90,7 @@ public class OverdriveProjector extends Block{
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
if(Mathf.dst(x, y, tile.x, tile.y) > realRange) continue;
if(Mathf.dst(x, y, tile.x, tile.y) > tileRange) continue;
Tile other = world.tile(x, y);

View File

@@ -152,9 +152,9 @@ public class MassDriver extends Block{
entity.rotation = Mathf.slerpDelta(entity.rotation, tile.angleTo(waiter), rotateSpeed);
}else if(tile.entity.items.total() >= minDistribute &&
linkValid(tile) && //only fire when at 100% power capacity
tile.entity.power.satisfaction >= powerPercentageUsed &&
link.block().itemCapacity - link.entity.items.total() >= minDistribute && entity.reload <= 0.0001f){
linkValid(tile) &&
tile.entity.power.satisfaction >= powerPercentageUsed &&
link.block().itemCapacity - link.entity.items.total() >= minDistribute && entity.reload <= 0.0001f){
MassDriverEntity other = link.entity();
other.waiting.add(tile);
@@ -187,6 +187,13 @@ public class MassDriver extends Block{
tile.drawy() + Angles.trnsy(entity.rotation + 180f, entity.reload * knockback), entity.rotation - 90);
}
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Draw.color(Pal.accent);
Lines.dashCircle(x * tilesize, y*tilesize, range);
Draw.color();
}
@Override
public void drawConfigure(Tile tile){
float sin = Mathf.absin(Time.time(), 6f, 1f);