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 01afa2bf58d..7ac16000000 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("editorNode") instance=ExtResource("39")] layout_mode = 0 offset_left = 10.0 offset_top = 30.0 +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 5253ba66d11..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 @@ -8,6 +9,9 @@ public partial class MicrobeEditorCheatMenu : CheatMenu #pragma warning disable CA2213 [Export] private CheckBox infiniteMp = null!; + + [Export] + private NodeWithInput editorNode = null!; #pragma warning restore CA2213 public override void ReloadGUI() @@ -24,4 +28,12 @@ private void OnUnlockAllOrganellesPressed() { CheatManager.UnlockAllOrganelles(); } + + private void InfiniteMPToggled(bool value) + { + SetInfiniteMP(value); + + if (editorNode is IEditor editor) + editor.DirtyMutationPointsCache(); + } } diff --git a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn index 52cb38f8663..7087b16a00f 100644 --- a/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn +++ b/src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn @@ -41,7 +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="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"] 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"]