Edge cleanup / Spawn warn / Bugfixes

This commit is contained in:
Anuken 2019-01-29 11:51:41 -05:00
parent 76af3e3077
commit d268d94f76
8 changed files with 48 additions and 8 deletions

View File

@ -33,6 +33,7 @@ deconstruction.title = Block Deconstruction Guide
deconstruction = You've just selected [accent]block deconstruction mode[].\n\nTo begin breaking, simply tap a block near your ship.\nOnce you have selected some blocks, press the checkbox to confirm, and your ship will begin de-constructing them.\n\n- [accent]Remove blocks[] from your selection by tapping them.\n- [accent]Remove blocks in an area[] by tapping and holding an empty spot, then dragging in a direction.\n- [accent]Cancel deconstruction or selection[] by pressing the X at the bottom left.
showagain = Don't show again next session
coreattack = < Core is under attack! >
nearpoint = [[ [scarlet]LEAVE DROP POINT IMMEDIATELY[] ]\nannihilation imminent
database = Core Database
savegame = Save Game
loadgame = Load Game

Binary file not shown.

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
public class WaveSpawner{
private static final float shockwaveBase = 350f, shockwaveRand = 10f, maxShockwaveDst = shockwaveBase + shockwaveRand;
private Array<SpawnGroup> groups;
private Array<FlyerSpawn> flySpawns = new Array<>();
private Array<GroundSpawn> groundSpawns = new Array<>();
@ -52,6 +53,11 @@ public class WaveSpawner{
}
}
/**@return true if the player is near a ground spawn point.*/
public boolean playerNear(){
return groundSpawns.count(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, players[0].x, players[0].y) < maxShockwaveDst) > 0;
}
public void spawnEnemies(){
for(SpawnGroup group : groups){
@ -98,7 +104,7 @@ public class WaveSpawner{
}
Time.run(20f, () -> Effects.effect(Fx.spawnShockwave, spawn.x * tilesize, spawn.y * tilesize));
//would be interesting to see player structures survive this without hacks
Time.run(40f, () -> Damage.damage(waveTeam, spawn.x * tilesize, spawn.y * tilesize, 350f + Mathf.random(80f), 99999999f));
Time.run(40f, () -> Damage.damage(waveTeam, spawn.x * tilesize, spawn.y * tilesize, shockwaveBase + Mathf.random(shockwaveRand), 99999999f));
}
}
}

View File

@ -107,8 +107,8 @@ public class Zones implements ContentList{
}};
}};
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest")
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.05))){{
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 2)
.decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.02))){{
alwaysUnlocked = true;
deployCost = ItemStack.with(Items.copper, 300);
startingItems = ItemStack.with(Items.copper, 200);
@ -119,6 +119,11 @@ public class Zones implements ContentList{
waves = true;
waveTimer = true;
waveSpacing = 60 * 60 * 2;
spawns = Array.with(
new SpawnGroup(UnitTypes.dagger){{
unitScaling = 2;
}}
);
}};
}};

View File

@ -152,7 +152,7 @@ public class DeployDialog extends FloatingDialog{
}
void buildButton(Zone zone, TextButton button){
button.setDisabled(() -> !canUnlock(zone));
button.setDisabled(() -> !canUnlock(zone) || !data.hasItems(zone.itemRequirements));
button.clicked(() -> {
if(!data.isUnlocked(zone)){
data.removeItems(zone.itemRequirements);

View File

@ -154,6 +154,16 @@ public class HudFragment extends Fragment{
t.table("button", top -> top.add("$paused").pad(6f));
});
parent.fill(t -> {
t.visible(() -> !state.is(State.menu));
t.table("flat", c -> c.add("$nearpoint")
.update(l -> l.setColor(Tmp.c1.set(Color.WHITE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 10f, 1f))))
.get().setAlignment(Align.center, Align.center))
.margin(6).update(u -> {
u.color.a = Mathf.lerpDelta(u.color.a, Mathf.num(world.spawner.playerNear()), 0.1f);
}).get().color.a = 0f;
});
parent.fill(t -> {
t.visible(() -> netServer.isWaitingForPlayers() && !state.is(State.menu));
t.table("button", c -> c.add("$waiting.players"));
@ -199,7 +209,7 @@ public class HudFragment extends Fragment{
});
parent.fill(t -> {
t.top().right();
t.top().right().visible(() -> !state.is(State.menu));
TextButton button = Elements.newButton("$launch", Call::launchZone);

View File

@ -113,12 +113,10 @@ public class Floor extends Block{
protected void drawEdges(Tile tile){
eq = 0;
Floor floor = tile.floor();
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
if(other != null && other.floor().id < floor.id && other.floor().edges != null){
if(other != null && doEdge(other.floor()) && other.floor().edges != null){
eq |= (1 << i);
}
}
@ -134,6 +132,14 @@ public class Floor extends Block{
}
}
protected boolean doEdge(Floor other){
return (other.id < id || edges == null) && other.edgeOnto(this);
}
protected boolean edgeOnto(Floor other){
return true;
}
int type(int i){
if(!eq(i - 1) && !eq(i + 1)){
//case 0: touching

View File

@ -32,6 +32,18 @@ public class OreBlock extends Floor{
@Override
public void draw(Tile tile){
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy());
drawEdges(tile);
}
@Override
public boolean doEdge(Floor floor){
return floor != base && super.doEdge(floor);
}
@Override
protected boolean edgeOnto(Floor other){
return other != base;
}
public static Block get(Block floor, Item item){