From ddaf9e24cafa5c40610ff978b820327409f20217 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 22 Oct 2025 08:56:41 -0400 Subject: [PATCH] Copy button for content patches --- core/src/mindustry/editor/MapPatchesDialog.java | 5 +++++ core/src/mindustry/mod/ContentPatcher.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/editor/MapPatchesDialog.java b/core/src/mindustry/editor/MapPatchesDialog.java index 5e0122986d..46667502c4 100644 --- a/core/src/mindustry/editor/MapPatchesDialog.java +++ b/core/src/mindustry/editor/MapPatchesDialog.java @@ -78,6 +78,11 @@ public class MapPatchesDialog extends BaseDialog{ b.getLabel().setAlignment(Align.left, Align.left); }); + t.button(Icon.copy, Styles.graySquarei, Vars.iconMed, () -> { + Core.app.setClipboardText(patch.patch); + ui.showInfoFade("@copied"); + }).size(h); + t.button(Icon.refresh, Styles.graySquarei, Vars.iconMed, () -> { showImport(str -> addPatch(str, patches.indexOf(patch))); }).size(h); diff --git a/core/src/mindustry/mod/ContentPatcher.java b/core/src/mindustry/mod/ContentPatcher.java index 7f69ac5c2b..6474c7b684 100644 --- a/core/src/mindustry/mod/ContentPatcher.java +++ b/core/src/mindustry/mod/ContentPatcher.java @@ -23,7 +23,7 @@ public class ContentPatcher{ private Json json; private boolean applied; private ContentLoader contentLoader; - private ObjectSet usedpatches = new ObjectSet<>(); + private ObjectSet usedpatches = new ObjectSet<>(); private Seq resetters = new Seq<>(); private Seq afterCallbacks = new Seq<>(); private @Nullable PatchSet currentlyApplying; @@ -122,7 +122,7 @@ public class ContentPatcher{ field = path[path.length - 1]; } - if(object instanceof Content c){ + if(object instanceof Content c && usedpatches.add(c)){ after(c::afterPatch); }