From 14869041b887997a7bae43713d8406b2340fb73b Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 30 Oct 2020 10:36:07 -0400 Subject: [PATCH] Cleanup --- core/src/mindustry/content/Blocks.java | 2 +- ...tningAbility.java => MoveLightningAbility.java} | 14 +++++++------- .../ui/fragments/BlockInventoryFragment.java | 2 +- core/src/mindustry/ui/fragments/HudFragment.java | 12 +++++++++++- core/src/mindustry/world/meta/BuildVisibility.java | 1 + gradle.properties | 2 +- 6 files changed, 22 insertions(+), 11 deletions(-) rename core/src/mindustry/entities/abilities/{MovementLightningAbility.java => MoveLightningAbility.java} (75%) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 7bc5c25761..36f856c939 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1328,7 +1328,7 @@ public class Blocks implements ContentList{ //region storage coreShard = new CoreBlock("core-shard"){{ - requirements(Category.effect, BuildVisibility.debugOnly, with(Items.copper, 2000, Items.lead, 1000)); + requirements(Category.effect, BuildVisibility.editorOnly, with(Items.copper, 2000, Items.lead, 1000)); alwaysUnlocked = true; unitType = UnitTypes.alpha; diff --git a/core/src/mindustry/entities/abilities/MovementLightningAbility.java b/core/src/mindustry/entities/abilities/MoveLightningAbility.java similarity index 75% rename from core/src/mindustry/entities/abilities/MovementLightningAbility.java rename to core/src/mindustry/entities/abilities/MoveLightningAbility.java index b482afb8dc..17d3eaa23a 100644 --- a/core/src/mindustry/entities/abilities/MovementLightningAbility.java +++ b/core/src/mindustry/entities/abilities/MoveLightningAbility.java @@ -8,7 +8,7 @@ import mindustry.content.*; import mindustry.entities.*; import mindustry.gen.*; -public class MovementLightningAbility extends Ability{ +public class MoveLightningAbility extends Ability{ //Lightning damage public float damage = 35f; //Chance of firing every tick. Set >= 1 to always fire lightning every tick at max speed. @@ -17,15 +17,15 @@ public class MovementLightningAbility extends Ability{ public int length = 12; //Speeds for when to start lightninging and when to stop getting faster public float minSpeed = 0.8f, maxSpeed = 1.2f; - //Lightning Color + //Lightning color public Color color = Color.valueOf("a9d8ff"); public Effect shootEffect = Fx.sparkShoot; public Sound shootSound = Sounds.spark; - MovementLightningAbility(){} + MoveLightningAbility(){} - public MovementLightningAbility(float damage, int length, float chance, float minSpeed, float maxSpeed, Color color){ + public MoveLightningAbility(float damage, int length, float chance, float minSpeed, float maxSpeed, Color color){ this.damage = damage; this.length = length; this.chance = chance; @@ -37,10 +37,10 @@ public class MovementLightningAbility extends Ability{ @Override public void update(Unit unit){ float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed)); - if(Mathf.chance(Time.delta * (chance * scl))){ + if(Mathf.chance(Time.delta * chance * scl)){ shootEffect.at(unit.x, unit.y, unit.rotation, color); - Lightning.create(unit.team, color, damage, unit.x + unit.vel().x, unit.y + unit.vel().y, unit.rotation, length); - shootSound.at(unit.x, unit.y); + Lightning.create(unit.team, color, damage, unit.x + unit.vel.x, unit.y + unit.vel.y, unit.rotation, length); + shootSound.at(unit); } } } diff --git a/core/src/mindustry/ui/fragments/BlockInventoryFragment.java b/core/src/mindustry/ui/fragments/BlockInventoryFragment.java index a4a97553bd..504359678e 100644 --- a/core/src/mindustry/ui/fragments/BlockInventoryFragment.java +++ b/core/src/mindustry/ui/fragments/BlockInventoryFragment.java @@ -141,7 +141,7 @@ public class BlockInventoryFragment extends Fragment{ Boolp canPick = () -> player.unit().acceptsItem(item) && !state.isPaused() && player.within(tile, itemTransferRange); HandCursorListener l = new HandCursorListener(); - l.setEnabled(canPick); + l.enabled = canPick; Element image = itemImage(item.icon(Cicon.xlarge), () -> { if(tile == null || !tile.isValid()){ diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 8af32b3832..6514a12a5d 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -714,7 +714,17 @@ public class HudFragment extends Fragment{ t.margin(0); t.add(new SideBar(() -> player.unit().healthf(), () -> true, true)).width(bw).growY().padRight(pad); - t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f); + t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f).with(i -> { + if(mobile){ + //on mobile, cause a respawn on tap + i.clicked(() -> { + if(!player.unit().spawnedByCore && !player.dead()){ + Call.unitClear(player); + control.input.controlledType = null; + } + }); + } + }); t.add(new SideBar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), () -> !player.displayAmmo(), false)).width(bw).growY().padLeft(pad).update(b -> { b.color.set(player.displayAmmo() ? player.dead() || player.unit() instanceof BlockUnitc ? Pal.ammo : player.unit().type.ammoType.color : Pal.health); }); diff --git a/core/src/mindustry/world/meta/BuildVisibility.java b/core/src/mindustry/world/meta/BuildVisibility.java index 9e08a023ef..2402b0238b 100644 --- a/core/src/mindustry/world/meta/BuildVisibility.java +++ b/core/src/mindustry/world/meta/BuildVisibility.java @@ -7,6 +7,7 @@ public enum BuildVisibility{ hidden(() -> false), shown(() -> true), debugOnly(() -> false), + editorOnly(() -> false), sandboxOnly(() -> Vars.state == null || Vars.state.rules.infiniteResources), campaignOnly(() -> Vars.state == null || Vars.state.isCampaign()), lightingOnly(() -> Vars.state == null || Vars.state.rules.lighting || Vars.state.isCampaign()), diff --git a/gradle.properties b/gradle.properties index c0255c10a9..44d84c3995 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=64d0a3b6aee8ac3da5ae0db6e0ec2074349e996a +archash=392916100da348316b514af0af19fc48a04255b9