From 5cc461edb07827ef98ba75b9f31b731239414f7f Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 26 Aug 2021 17:47:35 -0700 Subject: [PATCH] Make hiding details optional (#5871) * Make hiding details optional * Sandbox blocks shouldn't have their details hidden. --- core/src/mindustry/ctype/UnlockableContent.java | 2 ++ core/src/mindustry/ui/dialogs/ContentInfoDialog.java | 2 +- core/src/mindustry/world/Block.java | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ctype/UnlockableContent.java b/core/src/mindustry/ctype/UnlockableContent.java index c45f076061..0c1c610b9a 100644 --- a/core/src/mindustry/ctype/UnlockableContent.java +++ b/core/src/mindustry/ctype/UnlockableContent.java @@ -27,6 +27,8 @@ public abstract class UnlockableContent extends MappableContent{ public boolean alwaysUnlocked = false; /** Whether to show the description in the research dialog preview. */ public boolean inlineDescription = true; + /** Whether details of blocks are hidden in custom games if they haven't been unlocked in campaign mode. */ + public boolean hideDetails = true; /** Special logic icon ID. */ public int iconId = 0; /** Icon of the content to use in UI. */ diff --git a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java index f62ede3957..9e120155b4 100644 --- a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java +++ b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java @@ -81,7 +81,7 @@ public class ContentInfoDialog extends BaseDialog{ } if(content.details != null){ - table.add("[gray]" + (content.unlocked() ? content.details : Iconc.lock + " " + Core.bundle.get("unlock.incampaign"))).pad(6).padTop(20).width(400f).wrap().fillX(); + table.add("[gray]" + (content.unlocked() || !content.hideDetails ? content.details : Iconc.lock + " " + Core.bundle.get("unlock.incampaign"))).pad(6).padTop(20).width(400f).wrap().fillX(); table.row(); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index f0f5e979d8..be8837463a 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -847,6 +847,10 @@ public class Block extends UnlockableContent{ if(!outputsPower && consumes.hasPower() && consumes.getPower().buffered){ throw new IllegalArgumentException("Consumer using buffered power: " + name); } + + if(buildVisibility == BuildVisibility.sandboxOnly){ + hideDetails = false; + } } @Override