From 91a2dfab363188e574cd7594eed8451bffa316ed Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 18 Oct 2018 16:31:15 -0400 Subject: [PATCH] Fixed build block repair / Sectors in random maps / Editor unlocks --- .../io/anuke/mindustry/content/bullets/TurretBullets.java | 7 ++++--- core/src/io/anuke/mindustry/entities/bullet/Bullet.java | 4 +++- core/src/io/anuke/mindustry/game/Unlocks.java | 3 ++- core/src/io/anuke/mindustry/input/DesktopInput.java | 3 ++- .../io/anuke/mindustry/maps/generation/WorldGenerator.java | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java index 4a244c8a41..ba7cac85b8 100644 --- a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java @@ -16,6 +16,7 @@ import io.anuke.mindustry.entities.effect.Lightning; import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.BuildBlock; import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; @@ -63,11 +64,11 @@ public class TurretBullets extends BulletList implements ContentList{ @Override public void hitTile(Bullet b, Tile tile){ super.hit(b); + tile = tile.target(); - if(tile.getTeam() == b.getTeam()){ + if(tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){ Effects.effect(BlockFx.healBlock, tile.drawx(), tile.drawy(), tile.block().size); - tile.entity.health += healAmount; - tile.entity.health = Mathf.clamp(tile.entity.health, 0, tile.block().health); + tile.entity.healBy(healAmount); } } }; diff --git a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java index b777a5a8ae..f3d60b86f6 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/Bullet.java +++ b/core/src/io/anuke/mindustry/entities/bullet/Bullet.java @@ -210,7 +210,9 @@ public class Bullet extends BulletEntity implements TeamTrait, SyncT tile = tile.target(); if(tile.entity != null && tile.entity.collide(this) && !tile.entity.isDead() && (type.collidesTeam || tile.getTeam() != team)){ - tile.entity.collision(this); + if(tile.getTeam() != team){ + tile.entity.collision(this); + } if(!supressCollision){ type.hitTile(this, tile); diff --git a/core/src/io/anuke/mindustry/game/Unlocks.java b/core/src/io/anuke/mindustry/game/Unlocks.java index 7e61d1314a..0730c4af64 100644 --- a/core/src/io/anuke/mindustry/game/Unlocks.java +++ b/core/src/io/anuke/mindustry/game/Unlocks.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap.Entry; import com.badlogic.gdx.utils.ObjectSet; +import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.ContentType; import io.anuke.ucore.core.Settings; @@ -46,7 +47,7 @@ public class Unlocks{ //client connected to server: always return the IP-specific set if(Net.client()){ return getSet(Net.getLastIP()); - }else if(world.getSector() != null || state.mode.infiniteResources){ //sector-sandbox have shared set + }else if((world.getSector() != null || state.mode.infiniteResources) || state.is(State.menu)){ //sector-sandbox have shared set return rootSet(); }else{ //per-mode set return getSet(state.mode.name()); diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index f714fe3fa2..54de9d4da2 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -229,7 +229,8 @@ public class DesktopInput extends InputHandler{ }else{ //if it's out of bounds, shooting is just fine player.isShooting = true; } - }else if(Inputs.keyTap(section, "deselect") && (recipe != null || mode != none || player.isBuilding())){ + }else if(Inputs.keyTap(section, "deselect") && (recipe != null || mode != none || player.isBuilding()) && + !(player.getCurrentRequest() != null && player.getCurrentRequest().remove && KeyBinds.get(section, "deselect") == KeyBinds.get(section, "break"))){ if(recipe == null){ player.clearBuilding(); } diff --git a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java index d7d1301b04..2d9426984e 100644 --- a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java @@ -141,6 +141,7 @@ public class WorldGenerator{ public void playRandomMap(){ ui.loadLogic(() -> { + world.setSector(null); logic.reset(); int sx = (short)Mathf.range(Short.MAX_VALUE/2);