From 366f4f490c175c7ea68bbfbe8fc701a77599b034 Mon Sep 17 00:00:00 2001 From: smol <75618732+SMOLKEYS@users.noreply.github.com> Date: Wed, 29 Jun 2022 11:27:51 +0800 Subject: [PATCH 1/4] BulletType despawnUnit field (#7088) * a * i guess so * despawnUnitCount, which i forgot to include --- core/src/mindustry/entities/bullet/BulletType.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 8ef0d5dfb2..0067716f1a 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -184,6 +184,10 @@ public class BulletType extends Content implements Cloneable{ public Seq spawnBullets = new Seq<>(); /** Unit spawned _instead of_ this bullet. Useful for missiles. */ public @Nullable UnitType spawnUnit; + /** Unit spawned when this bullet hits something or despawns due to it hitting the end of its lifetime. */ + public @Nullable UnitType despawnUnit; + /** Amount of units spawned when this bullet despawns. */ + public int despawnUnitCount = 1; /** Color of trail behind bullet. */ public Color trailColor = Pal.missileYellowBack; @@ -443,6 +447,12 @@ public class BulletType extends Content implements Cloneable{ createFrags(b, b.x, b.y); } + if(despawnUnit != null){ + for(int i = 0; i < despawnUnitCount; i++){ + despawnUnit.spawn(b.team, b.x + Mathf.range(0.1f), b.y); + } + } + despawnEffect.at(b.x, b.y, b.rotation(), hitColor); despawnSound.at(b); From 8d6807a79d5fc9924fc8407b0c66ed7c4a782c3b Mon Sep 17 00:00:00 2001 From: Lucky Clover <55009845+Jackson11500@users.noreply.github.com> Date: Wed, 29 Jun 2022 23:32:48 +0800 Subject: [PATCH 2/4] Fix Rules-initialWaveSpacing comment (#7093) (In fact I'm not sure if this should be edited to "<=0" to correspond with the actual codes. --- core/src/mindustry/game/Rules.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index a9854a3c81..cdf63cc21a 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -94,7 +94,7 @@ public class Rules{ public float dropZoneRadius = 300f; /** Time between waves in ticks. */ public float waveSpacing = 2 * Time.toMinutes; - /** Starting wave spacing; if <0, uses waveSpacing * 2. */ + /** Starting wave spacing; if <=0, uses waveSpacing * 2. */ public float initialWaveSpacing = 0f; /** Wave after which the player 'wins'. Used in sectors. Use a value <= 0 to disable. */ public int winWave = 0; From a5cb7b09eb7a38d263e588fdacf21cb652f6cea2 Mon Sep 17 00:00:00 2001 From: JniTrRny <85090668+JniTrRny@users.noreply.github.com> Date: Wed, 29 Jun 2022 22:33:04 +0700 Subject: [PATCH 3/4] Deconstructable Core in Editor Mode (#7090) * Deconstructable Core in Editor Mode * I hate it when --- core/src/mindustry/world/blocks/defense/ShieldBreaker.java | 2 +- core/src/mindustry/world/blocks/storage/CoreBlock.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/defense/ShieldBreaker.java b/core/src/mindustry/world/blocks/defense/ShieldBreaker.java index 0368f1557e..4980cfed6d 100644 --- a/core/src/mindustry/world/blocks/defense/ShieldBreaker.java +++ b/core/src/mindustry/world/blocks/defense/ShieldBreaker.java @@ -20,7 +20,7 @@ public class ShieldBreaker extends Block{ @Override public boolean canBreak(Tile tile){ - return false; + return Vars.state.isEditor(); } public class ShieldBreakerBuild extends Building{ diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index afcfb74d2e..fc68d7f555 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -115,7 +115,7 @@ public class CoreBlock extends StorageBlock{ @Override public boolean canBreak(Tile tile){ - return false; + return state.isEditor(); } @Override From 1c1b1295d193c879e0bc69de0e12f80933c9bbe9 Mon Sep 17 00:00:00 2001 From: smol <75618732+SMOLKEYS@users.noreply.github.com> Date: Thu, 30 Jun 2022 00:39:10 +0800 Subject: [PATCH 4/4] changes (#7089) * a * i guess so * despawnUnitCount, which i forgot to include * changes + despawnUnitRadius field * enter? * no * can you not --- core/assets/contributors | 1 + .../mindustry/entities/bullet/BulletType.java | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/assets/contributors b/core/assets/contributors index 2851d455ca..c15001e0e8 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -143,3 +143,4 @@ BlueWolf [Error_27] code-explorer786 KayAyeAre +SMOLKEYS \ No newline at end of file diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 0067716f1a..476ea38614 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -188,6 +188,8 @@ public class BulletType extends Content implements Cloneable{ public @Nullable UnitType despawnUnit; /** Amount of units spawned when this bullet despawns. */ public int despawnUnitCount = 1; + /** Random offset distance from the original bullet despawn/hit coordinate. */ + public float despawnUnitRadius = 0.1f; /** Color of trail behind bullet. */ public Color trailColor = Pal.missileYellowBack; @@ -377,6 +379,7 @@ public class BulletType extends Content implements Cloneable{ } createPuddles(b, x, y); createIncend(b, x, y); + createUnits(b, x, y); if(suppressionRange > 0){ //bullets are pooled, require separate Vec2 instance @@ -436,23 +439,26 @@ public class BulletType extends Content implements Cloneable{ } } + public void createUnits(Bullet b, float x, float y){ + if(despawnUnit != null){ + for(int i = 0; i < despawnUnitCount; i++){ + despawnUnit.spawn(b.team, x + Mathf.range(despawnUnitRadius), y + Mathf.range(despawnUnitRadius)); + } + } + } /** Called when the bullet reaches the end of its lifetime or is destroyed by something external. */ public void despawned(Bullet b){ if(despawnHit){ hit(b); + }else{ + createUnits(b, b.x, b.y); } if(!fragOnHit){ createFrags(b, b.x, b.y); } - - if(despawnUnit != null){ - for(int i = 0; i < despawnUnitCount; i++){ - despawnUnit.spawn(b.team, b.x + Mathf.range(0.1f), b.y); - } - } - + despawnEffect.at(b.x, b.y, b.rotation(), hitColor); despawnSound.at(b);