From ec127519aaad9a4a84e83013f54a1eeb311c7473 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 3 Jul 2018 09:26:04 -0400 Subject: [PATCH] Many various bugfixes --- build.gradle | 2 +- .../src/io/anuke/mindustry/ai/Pathfinder.java | 2 +- .../mindustry/content/StatusEffects.java | 2 +- .../mindustry/content/blocks/Blocks.java | 2 +- .../anuke/mindustry/core/ContentLoader.java | 2 ++ core/src/io/anuke/mindustry/core/Control.java | 2 +- .../src/io/anuke/mindustry/entities/Unit.java | 10 +++++---- .../mindustry/entities/effect/Lightning.java | 22 ++++++++++++++++++- .../io/anuke/mindustry/input/MobileInput.java | 6 ++--- .../ui/dialogs/SettingsMenuDialog.java | 6 ++--- .../mindustry/ui/dialogs/UnlocksDialog.java | 2 +- .../ui/fragments/BlocksFragment.java | 11 ++++++---- .../world/blocks/modules/InventoryModule.java | 7 ++++++ 13 files changed, 54 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index b1d44b0ab8..10830657eb 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ allprojects { gdxVersion = '1.9.8' roboVMVersion = '2.3.0' aiVersion = '1.8.1' - uCoreVersion = '7945183f17' + uCoreVersion = 'a048b25074' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 7a02b7c7a0..6bbf07522e 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -84,7 +84,7 @@ public class Pathfinder { } private boolean passable(Tile tile, Team team){ - return (tile.getWallID() == 0 && tile.cliffs == 0 && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0))) + return (tile.getWallID() == 0 && tile.cliffs == 0 && !tile.floor().solid && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0))) || (tile.breakable() && (tile.getTeam() != team)) || !tile.solid(); } diff --git a/core/src/io/anuke/mindustry/content/StatusEffects.java b/core/src/io/anuke/mindustry/content/StatusEffects.java index baca35c0b0..f9a7be4494 100644 --- a/core/src/io/anuke/mindustry/content/StatusEffects.java +++ b/core/src/io/anuke/mindustry/content/StatusEffects.java @@ -92,7 +92,7 @@ public class StatusEffects implements ContentList { @Override public void update(Unit unit, float time) { - unit.damagePeriodic(0.1f); + unit.damagePeriodic(0.3f); if (Mathf.chance(Timers.delta() * 0.2f)) { Effects.effect(EnvironmentFx.melting, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f)); diff --git a/core/src/io/anuke/mindustry/content/blocks/Blocks.java b/core/src/io/anuke/mindustry/content/blocks/Blocks.java index b4c8709f12..510e1d9991 100644 --- a/core/src/io/anuke/mindustry/content/blocks/Blocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/Blocks.java @@ -76,7 +76,7 @@ public class Blocks extends BlockList implements ContentList{ lava = new Floor("lava") {{ liquidColor = Color.valueOf("ed5334"); speedMultiplier = 0.2f; - damageTaken = 0.1f; + damageTaken = 0.5f; status = StatusEffects.melting; statusIntensity = 0.8f; variants = 0; diff --git a/core/src/io/anuke/mindustry/core/ContentLoader.java b/core/src/io/anuke/mindustry/core/ContentLoader.java index b54bde7c1d..829236302e 100644 --- a/core/src/io/anuke/mindustry/core/ContentLoader.java +++ b/core/src/io/anuke/mindustry/core/ContentLoader.java @@ -10,6 +10,7 @@ import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.entities.effect.Fire; import io.anuke.mindustry.entities.effect.ItemDrop; +import io.anuke.mindustry.entities.effect.Lightning; import io.anuke.mindustry.entities.effect.Puddle; import io.anuke.mindustry.entities.traits.TypeTrait; import io.anuke.mindustry.entities.units.UnitType; @@ -154,5 +155,6 @@ public class ContentLoader { TypeTrait.registerType(Fire.class, Fire::new); TypeTrait.registerType(Puddle.class, Puddle::new); TypeTrait.registerType(Bullet.class, Bullet::new); + TypeTrait.registerType(Lightning.class, Lightning::new); } } diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 048f52c02c..d340b98c15 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -274,7 +274,7 @@ public class Control extends Module{ for(int i = 0 ; i < Recipe.all().size; i ++){ Recipe recipe = Recipe.all().get(i); - if(!recipe.debugOnly && entity.items.hasItems(recipe.requirements)){ + if(!recipe.debugOnly && entity.items.hasItems(recipe.requirements, 1.4f)){ if(control.database().unlockContent(recipe)){ ui.hudfrag.showUnlock(recipe); } diff --git a/core/src/io/anuke/mindustry/entities/Unit.java b/core/src/io/anuke/mindustry/entities/Unit.java index c09b763c93..aef424e20b 100644 --- a/core/src/io/anuke/mindustry/entities/Unit.java +++ b/core/src/io/anuke/mindustry/entities/Unit.java @@ -280,10 +280,12 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ } public void damage(float amount, boolean withEffect){ - if(withEffect){ - damage(amount); - }else{ - super.damage(amount); + float pre = hitTime; + + damage(amount); + + if(!withEffect){ + hitTime = pre; } } diff --git a/core/src/io/anuke/mindustry/entities/effect/Lightning.java b/core/src/io/anuke/mindustry/entities/effect/Lightning.java index 2aad90944a..37cd52523c 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Lightning.java +++ b/core/src/io/anuke/mindustry/entities/effect/Lightning.java @@ -9,6 +9,7 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.content.StatusEffects; import io.anuke.mindustry.entities.Units; +import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.gen.CallEntity; import io.anuke.mindustry.graphics.Palette; @@ -26,10 +27,14 @@ import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Pooling; import io.anuke.ucore.util.SeedRandom; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + import static io.anuke.mindustry.Vars.bulletGroup; //TODO utterly broken -public class Lightning extends TimedEntity implements Poolable, DrawTrait{ +public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncTrait{ private static Array entities = new Array<>(); private static Rectangle rect = new Rectangle(); private static Rectangle hitrect = new Rectangle(); @@ -113,6 +118,21 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait{ /**For pooling use only. Do not call directly!*/ public Lightning(){} + @Override + public boolean isSyncing() { + return false; + } + + @Override + public void write(DataOutput data) throws IOException { + + } + + @Override + public void read(DataInput data, long time) throws IOException { + + } + @Override public float lifetime() { return 10; diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index 5e7e223841..f4244adfc6 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -299,9 +299,9 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public void drawOutlined(){ - Draw.color(Palette.placing); - Lines.poly(player.x, player.y, 100, Player.placeDistance); - Draw.color(); + //Draw.color(Palette.placing); + //Lines.poly(player.x, player.y, 100, Player.placeDistance); + //Draw.color(); Shaders.mix.color.set(Palette.accent); Graphics.shader(Shaders.mix); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java index 2c8e2784b7..72ebfe9ccb 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -129,9 +129,9 @@ public class SettingsMenuDialog extends SettingsDialog{ sound.volumePrefs(); game.screenshakePref(); - game.checkPref("smoothcam", true); + //game.checkPref("smoothcam", true); game.checkPref("effects", true); - game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%"); + //game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%"); game.sliderPref("saveinterval", 90, 10, 5*120, i -> Bundles.format("setting.seconds", i)); if(!gwt){ @@ -160,8 +160,6 @@ public class SettingsMenuDialog extends SettingsDialog{ graphics.checkPref("fps", false); graphics.checkPref("lasers", true); - graphics.sliderPref("previewopacity", 50, 0, 100, i -> i + "%"); - graphics.checkPref("indicators", true); graphics.checkPref("healthbars", true); graphics.checkPref("minimap", !mobile); //minimap is disabled by default on mobile devices } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java index 90e29226a0..ce2de1999d 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java @@ -45,7 +45,7 @@ public class UnlocksDialog extends FloatingDialog { table.table(list -> { list.left(); - int maxWidth = UIUtils.portrait() ? 6 : 14; + int maxWidth = UIUtils.portrait() ? 7 : 14; int size = 8*6; int count = 0; diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java index 0dc42e3615..6f8ec1be23 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java @@ -150,6 +150,7 @@ public class BlocksFragment extends Fragment{ } lastCategory = cat; stack.act(Gdx.graphics.getDeltaTime()); + stack.act(Gdx.graphics.getDeltaTime()); }).growX().height(54).group(group) .name("sectionbutton" + cat.name()).get(); @@ -251,10 +252,12 @@ public class BlocksFragment extends Fragment{ recipeTable.add(image).size(size + 8); image.update(() -> { - for(Player player : players){ - if(control.input(player.playerIndex).recipe == r){ - image.setChecked(true); - return; + if(!image.isDisabled()) { + for (Player player : players) { + if (control.input(player.playerIndex).recipe == r) { + image.setChecked(true); + return; + } } } image.setChecked(false); diff --git a/core/src/io/anuke/mindustry/world/blocks/modules/InventoryModule.java b/core/src/io/anuke/mindustry/world/blocks/modules/InventoryModule.java index 43a4b26b0a..b989c9b952 100644 --- a/core/src/io/anuke/mindustry/world/blocks/modules/InventoryModule.java +++ b/core/src/io/anuke/mindustry/world/blocks/modules/InventoryModule.java @@ -18,6 +18,13 @@ public class InventoryModule extends BlockModule{ return true; } + public boolean hasItems(ItemStack[] stacks, float amountScaling){ + for(ItemStack stack : stacks){ + if(!hasItem(stack.item, (int)(stack.amount * amountScaling))) return false; + } + return true; + } + /**Returns true if this entity has at least one of each item in each stack.*/ public boolean hasAtLeastOneOfItems(ItemStack[] stacks){ for(ItemStack stack : stacks){