From ff993a353d5e5e9c2b3cafb255495e4e2bdca74c Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 29 Nov 2017 23:20:15 -0500 Subject: [PATCH] Added new map --- core/assets/maps/blankmap.png | Bin 0 -> 757 bytes core/assets/maps/fortress.png | Bin 0 -> 4505 bytes core/src/io/anuke/mindustry/core/Control.java | 3 +- .../mindustry/entities/effect/DamageArea.java | 5 ++-- .../entities/enemies/BlastEnemy.java | 1 + .../mindustry/entities/enemies/Enemy.java | 3 +- core/src/io/anuke/mindustry/world/Map.java | 9 +++--- core/src/io/anuke/mindustry/world/World.java | 28 ++++++++++-------- .../types/production/NuclearReactor.java | 6 ++++ 9 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 core/assets/maps/blankmap.png create mode 100644 core/assets/maps/fortress.png diff --git a/core/assets/maps/blankmap.png b/core/assets/maps/blankmap.png new file mode 100644 index 0000000000000000000000000000000000000000..52073f2a27431b06c7b93f1876839d524c31530f GIT binary patch literal 757 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6&6|H(?D8gCb z5n0T@z%2~Ij105pNB{-dOFVsD*&lMtifd{){kE3@3Q3l@MwB?`=jNv7l`uFLr6!i7 zrYMwWmSiZnd-?{1H}Z)yFfhe>x;TbZ+pri4&U4Rs?(2D-WEW?=q_~1O06@~-4(AF0B)mcZ zg%E;AX!&I!AiN#%I3W1nen2bB5;9`Jc4xu>kl6CSfIz|htwItRZtrA+{4Sva#~d($ zFoQyBTeyu|_+esT;H98&a5(hR`S42@)vo)6`>NsXom@`GNy!6%f$VWsCn81{3-xnl zy5tg4&sK=121&fBe7{@4;th|R$dPV;gl|No(kfbV+6S*y=4Btr#I@_sgs4nLSWCN8BuSRm6f#? zhtNEK*-=1*M$FH@Xcz_TQ;Yt+rUnC0FfK|zXv&wY9*v?zPSa_E)tSCxV%1PnTuw{^ zr>jFEO=Llfub_vaDs3aJ%3D)Fo(?$~ZKv6Gn~gfAChD>`Bdn8H(U;@X8?x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*r4>06KZX!<1@~yS(tT*g@-H zG71KIa6FIcC%*;nk6mLN0uSU~C(y^o1=H0A6cNzytp%R~+r?FN-LNR^i?|gJgv;K> K8CPjdxbc6;b3Gpb literal 0 HcmV?d00001 diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 7d78f2e6c6..993a4e48b5 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -465,7 +465,8 @@ public class Control extends Module{ if(Inputs.keyDown(Keys.SHIFT_LEFT)){ new HealerEnemy(0).set(player.x, player.y).add(); }else{ - new FortressEnemy(0).set(player.x, player.y).add(); + float px = player.x, py = player.y; + Timers.run(30f, ()->new BlastEnemy(0).set(px, py).add()); } } } diff --git a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java index e49c0e988b..9ba2140c3f 100644 --- a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java +++ b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java @@ -14,7 +14,8 @@ public class DamageArea{ public static void damageEntities(float x, float y, float radius, int damage){ damage(true, x, y, radius, damage); - if(!Vars.android){ + + if(!Vars.android && Vars.player.distanceTo(x, y) < radius){ Player player = Vars.player; int amount = calculateDamage(x, y, player.x, player.y, radius, damage); player.damage(amount); @@ -46,7 +47,7 @@ public class DamageArea{ } } - if(!Vars.android){ + if(!Vars.android && Vars.player.distanceTo(x, y) < radius){ Player player = Vars.player; int amount = calculateDamage(x, y, player.x, player.y, radius, damage); player.damage(amount); diff --git a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java index 9bf13cc50d..9a40debd03 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java @@ -14,6 +14,7 @@ public class BlastEnemy extends Enemy{ bullet = null; turretrotatespeed = 0f; mass = 0.8f; + stopNearCore = false; heal(); } diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index 539648be3c..e87552cb22 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -36,6 +36,7 @@ public class Enemy extends DestructibleEntity{ protected int spawned = 0; protected float angle; protected boolean targetCore = false; + protected boolean stopNearCore = true; protected float mass = 1f; public int spawn; @@ -63,7 +64,7 @@ public class Enemy extends DestructibleEntity{ void move(){ Tile core = Vars.control.getCore(); - boolean nearCore = distanceTo(core.worldx(), core.worldy()) <= range - 18f; + boolean nearCore = distanceTo(core.worldx(), core.worldy()) <= range - 18f && stopNearCore; Vector2 vec; diff --git a/core/src/io/anuke/mindustry/world/Map.java b/core/src/io/anuke/mindustry/world/Map.java index 95bbdf52f7..6ab0013d87 100644 --- a/core/src/io/anuke/mindustry/world/Map.java +++ b/core/src/io/anuke/mindustry/world/Map.java @@ -6,18 +6,19 @@ public enum Map{ canyon("the canyon"), maze("it's okay."), volcano("desc"), + fortress("desc", true), tutorial(false), test1(false), test2(false); public final boolean visible; - public final boolean sandbox; public final String description; + public final boolean flipBase; public int width, height; private Map(boolean visible){ this.visible = visible; - this.sandbox = false; + this.flipBase = false; this.description = "Test map!"; } @@ -25,9 +26,9 @@ public enum Map{ this(description, false); } - private Map(String description, boolean sandbox){ + private Map(String description, boolean flipBase){ this.visible = true; - this.sandbox = sandbox; + this.flipBase = flipBase; this.description = description; } } diff --git a/core/src/io/anuke/mindustry/world/World.java b/core/src/io/anuke/mindustry/world/World.java index fff4ef6546..e2891fd724 100644 --- a/core/src/io/anuke/mindustry/world/World.java +++ b/core/src/io/anuke/mindustry/world/World.java @@ -184,26 +184,28 @@ public class World extends Module{ void setDefaultBlocks(){ int x = control.getCore().x, y = control.getCore().y; + int flip = Mathf.sign(!currentMap.flipBase); + int fr = currentMap.flipBase ? 2 : 0; - set(x, y-2, DistributionBlocks.conveyor, 1); - set(x, y-3, DistributionBlocks.conveyor, 1); + set(x, y-2*flip, DistributionBlocks.conveyor, 1 + fr); + set(x, y-3*flip, DistributionBlocks.conveyor, 1 + fr); for(int i = 0; i < 2; i ++){ int d = Mathf.sign(i-0.5f); - set(x+2*d, y-2, ProductionBlocks.stonedrill, d); - set(x+2*d, y-1, DistributionBlocks.conveyor, 1); - set(x+2*d, y, DistributionBlocks.conveyor, 1); - set(x+2*d, y+1, WeaponBlocks.doubleturret, 0); + set(x+2*d, y-2*flip, ProductionBlocks.stonedrill, d); + set(x+2*d, y-1*flip, DistributionBlocks.conveyor, 1 + fr); + set(x+2*d, y, DistributionBlocks.conveyor, 1 + fr); + set(x+2*d, y+1*flip, WeaponBlocks.doubleturret, 0 + fr); - set(x+1*d, y-3, DistributionBlocks.conveyor, 2*d); - set(x+2*d, y-3, DistributionBlocks.conveyor, 2*d); - set(x+2*d, y-4, DistributionBlocks.conveyor, 1); - set(x+2*d, y-5, DistributionBlocks.conveyor, 1); + set(x+1*d, y-3*flip, DistributionBlocks.conveyor, 2*d); + set(x+2*d, y-3*flip, DistributionBlocks.conveyor, 2*d); + set(x+2*d, y-4*flip, DistributionBlocks.conveyor, 1 + fr); + set(x+2*d, y-5*flip, DistributionBlocks.conveyor, 1 + fr); - set(x+3*d, y-5, ProductionBlocks.stonedrill, 0); - set(x+3*d, y-4, ProductionBlocks.stonedrill, 0); - set(x+3*d, y-3, ProductionBlocks.stonedrill, 0); + set(x+3*d, y-5*flip, ProductionBlocks.stonedrill, 0 + fr); + set(x+3*d, y-4*flip, ProductionBlocks.stonedrill, 0 + fr); + set(x+3*d, y-3*flip, ProductionBlocks.stonedrill, 0 + fr); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java index e0bcacbf29..bd1879e331 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java @@ -87,6 +87,12 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ public void onDestroyed(Tile tile){ super.onDestroyed(tile); + NuclearReactorEntity entity = tile.entity(); + + int fuel = entity.getItem(generateItem); + + if(fuel < 5) return; + int waves = 6; float delay = 8f;