From 0c09c10741d948f00c5e29c78bbb7f2d7dead768 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 8 Jul 2022 16:38:25 -0400 Subject: [PATCH] Misc minor bugfixes --- core/src/mindustry/ai/Pathfinder.java | 3 +-- core/src/mindustry/ai/WaveSpawner.java | 8 +++++++- core/src/mindustry/logic/LExecutor.java | 3 +-- core/src/mindustry/world/blocks/ConstructBlock.java | 2 ++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/ai/Pathfinder.java b/core/src/mindustry/ai/Pathfinder.java index 36ce0f4b2e..c4ca3a2f90 100644 --- a/core/src/mindustry/ai/Pathfinder.java +++ b/core/src/mindustry/ai/Pathfinder.java @@ -12,7 +12,6 @@ import mindustry.game.EventType.*; import mindustry.game.*; import mindustry.gen.*; import mindustry.world.*; -import mindustry.world.blocks.*; import mindustry.world.blocks.environment.*; import mindustry.world.blocks.storage.*; import mindustry.world.meta.*; @@ -153,7 +152,7 @@ public class Pathfinder implements Runnable{ /** Packs a tile into its internal representation. */ public int packTile(Tile tile){ - boolean nearLiquid = false, nearSolid = false, nearGround = false, solid = tile.solid() || tile.block() instanceof ConstructBlock, allDeep = tile.floor().isDeep(); + boolean nearLiquid = false, nearSolid = false, nearGround = false, solid = tile.solid(), allDeep = tile.floor().isDeep(); for(int i = 0; i < 4; i++){ Tile other = tile.nearby(i); diff --git a/core/src/mindustry/ai/WaveSpawner.java b/core/src/mindustry/ai/WaveSpawner.java index a5d35446a4..1fd4b73521 100644 --- a/core/src/mindustry/ai/WaveSpawner.java +++ b/core/src/mindustry/ai/WaveSpawner.java @@ -200,7 +200,12 @@ public class WaveSpawner{ /** Applies the standard wave spawn effects to a unit - invincibility, unmoving. */ public void spawnEffect(Unit unit){ - unit.rotation = unit.angleTo(world.width()/2f * tilesize, world.height()/2f * tilesize); + spawnEffect(unit, unit.angleTo(world.width()/2f * tilesize, world.height()/2f * tilesize)); + } + + /** Applies the standard wave spawn effects to a unit - invincibility, unmoving. */ + public void spawnEffect(Unit unit, float rotation){ + unit.rotation = rotation; unit.apply(StatusEffects.unmoving, 30f); unit.apply(StatusEffects.invincible, 60f); unit.add(); @@ -216,6 +221,7 @@ public class WaveSpawner{ @Remote(called = Loc.server, unreliable = true) public static void spawnEffect(float x, float y, float rotation, UnitType u){ + Fx.unitSpawn.at(x, y, rotation, u); Time.run(30f, () -> Fx.spawn.at(x, y)); diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index f564ed9004..625df32707 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1331,8 +1331,7 @@ public class LExecutor{ if(exec.obj(type) instanceof UnitType type && !type.hidden && t != null && Units.canCreate(t, type)){ //random offset to prevent stacking var unit = type.spawn(t, World.unconv(exec.numf(x)) + Mathf.range(0.01f), World.unconv(exec.numf(y)) + Mathf.range(0.01f)); - unit.rotation = exec.numf(rotation); - spawner.spawnEffect(unit); + spawner.spawnEffect(unit, exec.numf(rotation)); exec.setobj(result, unit); } } diff --git a/core/src/mindustry/world/blocks/ConstructBlock.java b/core/src/mindustry/world/blocks/ConstructBlock.java index 850821c4f7..a7694eb6a3 100644 --- a/core/src/mindustry/world/blocks/ConstructBlock.java +++ b/core/src/mindustry/world/blocks/ConstructBlock.java @@ -373,6 +373,7 @@ public class ConstructBlock extends Block{ this.buildCost = block.buildCost * state.rules.buildCostMultiplier; this.accumulator = new float[block.requirements.length]; this.totalAccumulator = new float[block.requirements.length]; + pathfinder.updateTile(tile); } public void setDeconstruct(Block previous){ @@ -386,6 +387,7 @@ public class ConstructBlock extends Block{ this.buildCost = previous.buildCost * state.rules.buildCostMultiplier; this.accumulator = new float[previous.requirements.length]; this.totalAccumulator = new float[previous.requirements.length]; + pathfinder.updateTile(tile); } @Override