From 46f43a345609330d7a23f3c3c7a9febaafc731fe Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 6 May 2022 18:28:51 -0400 Subject: [PATCH] Bugfixes --- core/src/mindustry/content/SectorPresets.java | 2 +- core/src/mindustry/core/Control.java | 26 ++++++++++++------- .../world/blocks/storage/CoreBlock.java | 8 +++--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/core/src/mindustry/content/SectorPresets.java b/core/src/mindustry/content/SectorPresets.java index 42b4f3381a..c008d7ef5e 100644 --- a/core/src/mindustry/content/SectorPresets.java +++ b/core/src/mindustry/content/SectorPresets.java @@ -172,7 +172,7 @@ public class SectorPresets{ new BuildCountObjective(Blocks.coreBastion, 1).withMarkers( new ShapeTextMarker("New cores can be placed on [accent]core tiles[].\nNew cores function as forward bases and share a resource inventory with other cores.\nPlace a core.", 287.5f * 8f, 197.5f * 8f, 9f * 2.6f, 0f, 12f) ), - new TimerObjective("Set up defenses", 120 * 60).withMarkers( + new TimerObjective("[accent]Set up defenses:[lightgray] {0}", 120 * 60).withMarkers( new TextMarker("The enemy will be able to detect you in 2 minutes.\nSet up defenses, mining, and production.", 288f * 8f, 202f * 8f) ).withFlags("openMap") ); diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 05d16ac26c..b926ee5e75 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -213,6 +213,7 @@ public class Control implements ApplicationListener, Loadable{ if(state.isCampaign()){ + //don't run when hosting, that doesn't really work. if(state.rules.sector.planet.prebuildBase){ toBePlaced.clear(); float unitsPerTick = 2f; @@ -225,19 +226,26 @@ public class Control implements ApplicationListener, Loadable{ var ccore = build.closestCore(); if(ccore != null && build.within(ccore, buildRadius)){ - build.pickedUp(); - build.tile.remove(); anyBuilds = true; - toBePlaced.add(build); + if(!net.active()){ + build.pickedUp(); + build.tile.remove(); - Time.run(build.dst(ccore) / unitsPerTick + coreDelay, () -> { - if(build.tile.build != build){ - placeLandBuild(build); + toBePlaced.add(build); - toBePlaced.remove(build); - } - }); + Time.run(build.dst(ccore) / unitsPerTick + coreDelay, () -> { + if(build.tile.build != build){ + placeLandBuild(build); + + toBePlaced.remove(build); + } + }); + }else{ + //when already hosting, instantly build everything. this looks bad but it's better than a desync + Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block); + Fx.placeBlock.at(build.x, build.y, build.block.size); + } } } } diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 707276b377..28bfd63b32 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -495,15 +495,15 @@ public class CoreBlock extends StorageBlock{ public void handleItem(Building source, Item item){ boolean incinerate = incinerateNonBuildable && !item.buildable; + if(team == state.rules.defaultTeam){ + state.stats.coreItemCount.increment(item); + } + if(net.server() || !net.active()){ if(team == state.rules.defaultTeam && state.isCampaign() && !incinerate){ state.rules.sector.info.handleCoreItem(item, 1); } - if(team == state.rules.defaultTeam){ - state.stats.coreItemCount.increment(item); - } - if(items.get(item) >= storageCapacity || incinerate){ //create item incineration effect at random intervals if(!noEffect){