From b956919eba65c34c0885a58b602ab803ab4daa17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E5=BD=B1=E6=97=A7=E6=A2=A6?= <2589466905@qq.com> Date: Sun, 5 Jul 2026 18:27:02 +0800 Subject: [PATCH] bug fix --- .../expand/block/special/JumpGate.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/newhorizon/expand/block/special/JumpGate.java b/src/newhorizon/expand/block/special/JumpGate.java index 3c1f8c01..730aff6a 100644 --- a/src/newhorizon/expand/block/special/JumpGate.java +++ b/src/newhorizon/expand/block/special/JumpGate.java @@ -321,21 +321,33 @@ public void findTiles() { tiles = NHFunc.ableToSpawn(unitType(), x, y, maxRadius); } - public void spawnUnit() { - if (unitRecipe() == null) return; - if (unitType() == null) return; + public boolean spawnUnit() { + if (unitRecipe() == null) return false; + if (unitType() == null) return false; + + float spawnX, spawnY; + if (tiles.isEmpty()) { + if (!unitType().flying) return false; + spawnX = x; + spawnY = y; + } else { + Tile t = tiles.random(); + if (t == null) return false; + spawnX = t.worldx(); + spawnY = t.worldy(); + } if (!net.client()) { float rot = core() == null ? Angles.angle(x, y, command.x, command.y) : Angles.angle(core().x, core().y, x, y); Spawner spawner = new Spawner(); - Tile t = tiles.random(); - Tmp.v1.set(t.worldx(), t.worldy()); + Tmp.v1.set(spawnX, spawnY); spawner.init(unitType(), team, Tmp.v1, rot, Mathf.clamp(unitRecipe().craftTime / maxWarmupSpeed, 5f * 60, 15f * 60)); if (command != null) spawner.commandPos.set(command.cpy()); spawner.add(); } speedMultiplier = Mathf.clamp(speedMultiplier + warmupPerSpawn, 1, maxWarmupSpeed); + return true; } @Override @@ -353,11 +365,14 @@ public void updateTile() { } if (progress >= 1) { findTiles(); + boolean spawned = false; for (int i = 0; i < spawnCount; i++) { - spawnUnit(); + if (spawnUnit()) spawned = true; + } + if (spawned) { + consume(); + progress = 0f; } - consume(); - progress = 0f; } }