From 0ee137fe05d27dd6c5ca10634a08eb65f63b73e7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 24 Jul 2021 12:48:25 -0400 Subject: [PATCH] Added hint & tooltip for derelict structures --- core/assets/bundles/bundle.properties | 2 ++ core/src/mindustry/content/Blocks.java | 2 +- core/src/mindustry/entities/comp/BuildingComp.java | 4 +++- core/src/mindustry/ui/fragments/HintsFragment.java | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 80d41b2dac..6104dac106 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1352,6 +1352,7 @@ hint.placeTurret = Place \uf861 [accent]Turrets[] to defend your base from enemi hint.breaking = [accent]Right-click[] and drag to break blocks. hint.breaking.mobile = Activate the \ue817 [accent]hammer[] in the bottom right and tap to break blocks.\n\nHold down your finger for a second and drag to break in a selection. hint.blockInfo = View information of a block by selecting it in the [accent]build menu[], then selecting the [accent][[?][] button at the right. +hint.derelict = [accent]Derelict[] structures are broken remnants of old bases that no longer function.\n\nThese structures can be [accent]deconstructed[] for resources. hint.research = Use the \ue875 [accent]Research[] button to research new technology. hint.research.mobile = Use the \ue875 [accent]Research[] button in the \ue88c [accent]Menu[] to research new technology. hint.unitControl = Hold [accent][[L-ctrl][] and [accent]click[] to control friendly units or turrets. @@ -1403,6 +1404,7 @@ liquid.slag.description = Refined in separators into constituent metals, or spra liquid.oil.description = Used in advanced material production and as incendiary ammunition. liquid.cryofluid.description = Used as coolant in reactors, turrets and factories. +block.derelict = [lightgray] Derelict block.resupply-point.description = Resupplies nearby units with copper ammunition. Not compatible with units that require battery power. block.armored-conveyor.description = Moves items forward. Does not accept inputs from the sides. block.illuminator.description = Emits light. diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index a43108db74..e2069e22b1 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2032,7 +2032,7 @@ public class Blocks implements ContentList{ size = 5; reloadTime = 140f; chargeTime = 100f; - range = 500f; + range = 600f; maxPayloadSize = 3.5f; consumes.power(6f); }}; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index b98b8bf470..47de632e6b 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1071,7 +1071,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } public String getDisplayName(){ - return block.localizedName; + return team == Team.derelict ? + block.localizedName + "\n" + Core.bundle.get("block.derelict"): + block.localizedName; } public TextureRegion getDisplayIcon(){ diff --git a/core/src/mindustry/ui/fragments/HintsFragment.java b/core/src/mindustry/ui/fragments/HintsFragment.java index f4f677e720..b548a5536c 100644 --- a/core/src/mindustry/ui/fragments/HintsFragment.java +++ b/core/src/mindustry/ui/fragments/HintsFragment.java @@ -12,6 +12,7 @@ import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.content.*; +import mindustry.game.*; import mindustry.game.EventType.*; import mindustry.gen.*; import mindustry.input.*; @@ -54,6 +55,12 @@ public class HintsFragment extends Fragment{ hints.remove(hint); }else if(hint != null){ display(hint); + }else{ + //moused over a derelict structure + var build = world.buildWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY()); + if(build != null && build.team == Team.derelict){ + events.add("derelictmouse"); + } } } }); @@ -157,6 +164,7 @@ public class HintsFragment extends Fragment{ conveyorPathfind(() -> control.input.block == Blocks.titaniumConveyor, () -> Core.input.keyRelease(Binding.diagonal_placement) || (mobile && Core.settings.getBool("swapdiagonal"))), boost(visibleDesktop, () -> !player.dead() && player.unit().type.canBoost, () -> Core.input.keyDown(Binding.boost)), blockInfo(() -> true, () -> ui.content.isShown()), + derelict(() -> ui.hints.events.contains("derelictmouse"), () -> false), command(() -> state.rules.defaultTeam.data().units.size > 3 && !net.active(), () -> player.unit().isCommanding()), payloadPickup(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().isEmpty(), () -> player.unit() instanceof Payloadc p && p.payloads().any()), payloadDrop(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().any(), () -> player.unit() instanceof Payloadc p && p.payloads().isEmpty()),