From 4471752bafc4919a69a0a8bbe66b44428d553372 Mon Sep 17 00:00:00 2001 From: C09 <100433934+CI09@users.noreply.github.com> Date: Mon, 11 May 2026 17:24:13 +0200 Subject: [PATCH 1/4] Add extra cache for mutation points if infinite MP cheat was used --- src/general/base_stage/EditorBase.cs | 19 +++++++++++++++++++ src/microbe_stage/editor/MicrobeEditor.tscn | 3 ++- .../editor/MicrobeEditorCheatMenu.cs | 8 ++++++++ .../editor/MicrobeEditorCheatMenu.tscn | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/general/base_stage/EditorBase.cs b/src/general/base_stage/EditorBase.cs index c52bc30ac7c..149c5ee0d3a 100644 --- a/src/general/base_stage/EditorBase.cs +++ b/src/general/base_stage/EditorBase.cs @@ -80,6 +80,11 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad private double? mutationPointsCache; + /// + /// Extra cache for storing mutation points in case infinite MP cheat was used + /// + private double? mutationPointsCacheClean; + /// /// The fraction of daylight the editor is previewing things at /// @@ -608,6 +613,20 @@ public bool CheckEnoughMPForAction(double cost) return true; } + public void EnableCheatMP(bool value) + { + if (value) + { + mutationPointsCacheClean = mutationPointsCache; + } + else + { + mutationPointsCache = mutationPointsCacheClean; + } + + DirtyMutationPointsCache(); + } + public virtual void OnInsufficientMP(bool playSound = true) { foreach (var editorComponent in GetAllEditorComponents()) diff --git a/src/microbe_stage/editor/MicrobeEditor.tscn b/src/microbe_stage/editor/MicrobeEditor.tscn index 01afa2bf58d..b1b9f6fa604 100644 --- a/src/microbe_stage/editor/MicrobeEditor.tscn +++ b/src/microbe_stage/editor/MicrobeEditor.tscn @@ -64,10 +64,11 @@ offset_top = -54.0 offset_right = 154.0 grow_vertical = 0 -[node name="MicrobeEditorCheatMenu" parent="MicrobeEditorGUI" unique_id=1037789443 instance=ExtResource("39")] +[node name="MicrobeEditorCheatMenu" parent="MicrobeEditorGUI" unique_id=1037789443 node_paths=PackedStringArray("editor") instance=ExtResource("39")] layout_mode = 0 offset_left = 10.0 offset_top = 30.0 +editor = NodePath("../..") [node name="TutorialGUI" parent="." unique_id=1480772500 instance=ExtResource("85")] visible = false diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs index 5253ba66d11..d39fe845516 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs @@ -8,6 +8,9 @@ public partial class MicrobeEditorCheatMenu : CheatMenu #pragma warning disable CA2213 [Export] private CheckBox infiniteMp = null!; + + [Export] + private MicrobeEditor editor = null!; #pragma warning restore CA2213 public override void ReloadGUI() @@ -24,4 +27,9 @@ private void OnUnlockAllOrganellesPressed() { CheatManager.UnlockAllOrganelles(); } + + private void UpdateMutationPointsDisplay(bool value) + { + editor.EnableCheatMP(value); + } } diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn index 52cb38f8663..cb5f51346f9 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn @@ -42,6 +42,7 @@ theme_override_font_sizes/font_size = 14 text = "UNLOCK_ALL_ORGANELLES" [connection signal="toggled" from="VBoxContainer/InfiniteMP" to="." method="SetInfiniteMP"] +[connection signal="toggled" from="VBoxContainer/InfiniteMP" to="." method="UpdateMutationPointsDisplay"] [connection signal="toggled" from="VBoxContainer/MoveToAnyPatch" to="." method="SetMoveToAnyPatch"] [connection signal="pressed" from="VBoxContainer/RevealAllPatches" to="." method="OnRevealAllPatchesPressed"] [connection signal="pressed" from="VBoxContainer/UnlockAllOrganelles" to="." method="OnUnlockAllOrganellesPressed"] From 565c0ec9e22c73d4c6a76e3078ad730bd71140c0 Mon Sep 17 00:00:00 2001 From: C09 <100433934+CI09@users.noreply.github.com> Date: Mon, 11 May 2026 17:51:48 +0200 Subject: [PATCH 2/4] Remove unnecessary code --- src/general/base_stage/EditorBase.cs | 19 ------------------- .../editor/MicrobeEditorCheatMenu.cs | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/general/base_stage/EditorBase.cs b/src/general/base_stage/EditorBase.cs index 149c5ee0d3a..c52bc30ac7c 100644 --- a/src/general/base_stage/EditorBase.cs +++ b/src/general/base_stage/EditorBase.cs @@ -80,11 +80,6 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad private double? mutationPointsCache; - /// - /// Extra cache for storing mutation points in case infinite MP cheat was used - /// - private double? mutationPointsCacheClean; - /// /// The fraction of daylight the editor is previewing things at /// @@ -613,20 +608,6 @@ public bool CheckEnoughMPForAction(double cost) return true; } - public void EnableCheatMP(bool value) - { - if (value) - { - mutationPointsCacheClean = mutationPointsCache; - } - else - { - mutationPointsCache = mutationPointsCacheClean; - } - - DirtyMutationPointsCache(); - } - public virtual void OnInsufficientMP(bool playSound = true) { foreach (var editorComponent in GetAllEditorComponents()) diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs index d39fe845516..55fcb8aab77 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs @@ -30,6 +30,6 @@ private void OnUnlockAllOrganellesPressed() private void UpdateMutationPointsDisplay(bool value) { - editor.EnableCheatMP(value); + editor.DirtyMutationPointsCache(); } } From cc7dbfc13b43204a97794f18a24f40282bdc5c1f Mon Sep 17 00:00:00 2001 From: C09 <100433934+CI09@users.noreply.github.com> Date: Mon, 11 May 2026 19:00:30 +0200 Subject: [PATCH 3/4] Tweak --- src/microbe_stage/editor/MicrobeEditorCheatMenu.cs | 4 +++- src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs index 55fcb8aab77..509f116f8e9 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs @@ -28,8 +28,10 @@ private void OnUnlockAllOrganellesPressed() CheatManager.UnlockAllOrganelles(); } - private void UpdateMutationPointsDisplay(bool value) + private void InfiniteMPToggled(bool value) { + SetInfiniteMP(value); + editor.DirtyMutationPointsCache(); } } diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn index cb5f51346f9..7087b16a00f 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn @@ -41,8 +41,7 @@ layout_mode = 2 theme_override_font_sizes/font_size = 14 text = "UNLOCK_ALL_ORGANELLES" -[connection signal="toggled" from="VBoxContainer/InfiniteMP" to="." method="SetInfiniteMP"] -[connection signal="toggled" from="VBoxContainer/InfiniteMP" to="." method="UpdateMutationPointsDisplay"] +[connection signal="toggled" from="VBoxContainer/InfiniteMP" to="." method="InfiniteMPToggled"] [connection signal="toggled" from="VBoxContainer/MoveToAnyPatch" to="." method="SetMoveToAnyPatch"] [connection signal="pressed" from="VBoxContainer/RevealAllPatches" to="." method="OnRevealAllPatchesPressed"] [connection signal="pressed" from="VBoxContainer/UnlockAllOrganelles" to="." method="OnUnlockAllOrganellesPressed"] From 5bb374ab0cc9350b1693c31b9b06532724239694 Mon Sep 17 00:00:00 2001 From: C09 <100433934+CI09@users.noreply.github.com> Date: Tue, 12 May 2026 19:56:26 +0200 Subject: [PATCH 4/4] Mark mutation points dirty when enabling infinite MP for multicellular too --- src/general/base_stage/IEditor.cs | 2 ++ src/microbe_stage/editor/MicrobeEditor.tscn | 4 ++-- src/microbe_stage/editor/MicrobeEditorCheatMenu.cs | 8 +++++--- src/multicellular_stage/editor/MulticellularEditor.tscn | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/general/base_stage/IEditor.cs b/src/general/base_stage/IEditor.cs index 1c506e827b3..8c15be5f734 100644 --- a/src/general/base_stage/IEditor.cs +++ b/src/general/base_stage/IEditor.cs @@ -125,4 +125,6 @@ public interface IEditor : ISaveLoadedTracked /// /// Predicted next public double CalculateNextGenerationTimePoint(); + + public void DirtyMutationPointsCache(); } diff --git a/src/microbe_stage/editor/MicrobeEditor.tscn b/src/microbe_stage/editor/MicrobeEditor.tscn index b1b9f6fa604..7ac16000000 100644 --- a/src/microbe_stage/editor/MicrobeEditor.tscn +++ b/src/microbe_stage/editor/MicrobeEditor.tscn @@ -64,11 +64,11 @@ offset_top = -54.0 offset_right = 154.0 grow_vertical = 0 -[node name="MicrobeEditorCheatMenu" parent="MicrobeEditorGUI" unique_id=1037789443 node_paths=PackedStringArray("editor") instance=ExtResource("39")] +[node name="MicrobeEditorCheatMenu" parent="MicrobeEditorGUI" unique_id=1037789443 node_paths=PackedStringArray("editorNode") instance=ExtResource("39")] layout_mode = 0 offset_left = 10.0 offset_top = 30.0 -editor = NodePath("../..") +editorNode = NodePath("../..") [node name="TutorialGUI" parent="." unique_id=1480772500 instance=ExtResource("85")] visible = false diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs index 509f116f8e9..5902f6c6634 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.cs @@ -1,4 +1,5 @@ -using Godot; +using Arch.Core; +using Godot; /// /// Cheat menu for the @@ -10,7 +11,7 @@ public partial class MicrobeEditorCheatMenu : CheatMenu private CheckBox infiniteMp = null!; [Export] - private MicrobeEditor editor = null!; + private NodeWithInput editorNode = null!; #pragma warning restore CA2213 public override void ReloadGUI() @@ -32,6 +33,7 @@ private void InfiniteMPToggled(bool value) { SetInfiniteMP(value); - editor.DirtyMutationPointsCache(); + if (editorNode is IEditor editor) + editor.DirtyMutationPointsCache(); } } diff --git a/src/multicellular_stage/editor/MulticellularEditor.tscn b/src/multicellular_stage/editor/MulticellularEditor.tscn index 48a22a25bd3..dd7951fa37e 100644 --- a/src/multicellular_stage/editor/MulticellularEditor.tscn +++ b/src/multicellular_stage/editor/MulticellularEditor.tscn @@ -81,12 +81,13 @@ layout_mode = 2 text = "SELECT_CELL_TYPE_FROM_EDITOR" horizontal_alignment = 1 -[node name="MicrobeEditorCheatMenu" parent="EarlyMulticellularEditorGUI" unique_id=966094592 instance=ExtResource("10_xy0bv")] +[node name="MicrobeEditorCheatMenu" parent="EarlyMulticellularEditorGUI" unique_id=966094592 node_paths=PackedStringArray("editorNode") instance=ExtResource("10_xy0bv")] layout_mode = 0 offset_left = 10.0 offset_top = 30.0 offset_right = 10.0 offset_bottom = 30.0 +editorNode = NodePath("../..") [connection signal="OnCellTypeToEditSelected" from="EarlyMulticellularEditorGUI/CellBodyPlanEditorComponent" to="." method="OnStartEditingCellType"] [connection signal="OnTabSelected" from="EarlyMulticellularEditorGUI/MicrobeEditorTabButtons" to="." method="SetEditorTab"]