From 8de3e28994b1886eb71035b931de4e0879a5ae97 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 24 Apr 2025 11:18:24 -0400 Subject: [PATCH] Replaced some post calls with cancel-able time calls --- core/src/mindustry/entities/Damage.java | 2 +- core/src/mindustry/entities/bullet/BulletType.java | 2 +- core/src/mindustry/graphics/MinimapRenderer.java | 2 +- core/src/mindustry/world/blocks/storage/CoreBlock.java | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index 2648e37b86..767a7ace78 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -546,7 +546,7 @@ public class Damage{ } public static void tileDamage(Team team, int x, int y, float baseRadius, float damage, @Nullable Bullet source){ - Core.app.post(() -> { + Time.run(0f, () -> { var in = world.build(x, y); //spawned inside a multiblock. this means that damage needs to be dealt directly. //why? because otherwise the building would absorb everything in one cell, which means much less damage than a nearby explosion. diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index def5b7a9f3..44a75c783a 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -518,7 +518,7 @@ public class BulletType extends Content implements Cloneable{ if(fragOnHit){ if(delayFrags && fragBullet != null && fragBullet.delayFrags){ - Core.app.post(() -> createFrags(b, x, y)); + Time.run(0f, () -> createFrags(b, x, y)); }else{ createFrags(b, x, y); } diff --git a/core/src/mindustry/graphics/MinimapRenderer.java b/core/src/mindustry/graphics/MinimapRenderer.java index 449fc74406..de42d08957 100644 --- a/core/src/mindustry/graphics/MinimapRenderer.java +++ b/core/src/mindustry/graphics/MinimapRenderer.java @@ -60,7 +60,7 @@ public class MinimapRenderer{ if(e.tile.block().solid && e.tile.y > 0){ Tile tile = world.tile(e.tile.x, e.tile.y - 1); if(tile.block() == Blocks.air){ - Core.app.post(() -> update(tile)); + Time.run(0f, () -> update(tile)); } } }); diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 6860e39261..5bfab32686 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -624,11 +624,8 @@ public class CoreBlock extends StorageBlock{ if(net.server()){ //delay so clients don't destroy it afterwards - Core.app.post(() -> { - //make sure the world hasn't reloaded since - if(world.tile(tile.x, tile.y) == tile){ - tile.setNet(block, lastDamage, 0); - } + Time.run(0f, () -> { + tile.setNet(block, lastDamage, 0); }); } }