From a3ece022638a2b45aba143433429b0517905a10c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:38:55 +0000 Subject: [PATCH 1/9] Initial plan From 92e476764c2b096569eb9022d60394eb055c914a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:45:27 +0000 Subject: [PATCH 2/9] Guard moveable paste in flipped rooms Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index a595f46c8..29e20fa4c 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2401,11 +2401,28 @@ public static void PlaceLight(LightType type) _editor.Action = new EditorActionPlace(false, (l, r) => new LightInstance(type) { Color = color }); } + private static bool MoveablePlacementInFlippedRoom(Room room, ObjectInstance instance) + { + if (room == null || instance == null || !room.Alternated || room.AlternateRoom != null) + return false; + + if (instance is ItemInstance item && !item.ItemType.IsStatic) + return true; + + return instance is ObjectGroup group && group.OfType().Any(itemInGroup => !itemInGroup.ItemType.IsStatic); + } + public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) { if (!(instance is ISpatial)) return; + if (MoveablePlacementInFlippedRoom(room, instance)) + { + _editor.SendMessage("You can't add moveables to a flipped room.", PopupType.Info); + return; + } + if (instance is ObjectGroup) { PlaceObjectGroupContents(room, pos, (ObjectGroup)instance); From 51e0d27ee45287d94be22a33c00b0bac71d05b77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:46:39 +0000 Subject: [PATCH 3/9] Refine flipped-room moveable placement guard Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index 29e20fa4c..cf20a6504 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2401,7 +2401,7 @@ public static void PlaceLight(LightType type) _editor.Action = new EditorActionPlace(false, (l, r) => new LightInstance(type) { Color = color }); } - private static bool MoveablePlacementInFlippedRoom(Room room, ObjectInstance instance) + private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instance) { if (room == null || instance == null || !room.Alternated || room.AlternateRoom != null) return false; @@ -2409,7 +2409,7 @@ private static bool MoveablePlacementInFlippedRoom(Room room, ObjectInstance ins if (instance is ItemInstance item && !item.ItemType.IsStatic) return true; - return instance is ObjectGroup group && group.OfType().Any(itemInGroup => !itemInGroup.ItemType.IsStatic); + return instance is ObjectGroup group && group.Any(itemInGroup => itemInGroup is ItemInstance itemInGroupItem && !itemInGroupItem.ItemType.IsStatic); } public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) @@ -2417,7 +2417,7 @@ public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instanc if (!(instance is ISpatial)) return; - if (MoveablePlacementInFlippedRoom(room, instance)) + if (IsInvalidMoveablePlacement(room, instance)) { _editor.SendMessage("You can't add moveables to a flipped room.", PopupType.Info); return; From 906798831cc87efcf5767063522574919b1b7ada Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:47:32 +0000 Subject: [PATCH 4/9] Clarify flipped-room moveable placement helper Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index cf20a6504..d59f50588 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2401,15 +2401,24 @@ public static void PlaceLight(LightType type) _editor.Action = new EditorActionPlace(false, (l, r) => new LightInstance(type) { Color = color }); } + private static bool ObjectGroupContainsMoveable(ObjectGroup group) + { + foreach (var itemInGroup in group) + if (itemInGroup is ItemInstance item && !item.ItemType.IsStatic) + return true; + + return false; + } + private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instance) { - if (room == null || instance == null || !room.Alternated || room.AlternateRoom != null) + if (room == null || instance == null || !room.IsAlternate) return false; if (instance is ItemInstance item && !item.ItemType.IsStatic) return true; - return instance is ObjectGroup group && group.Any(itemInGroup => itemInGroup is ItemInstance itemInGroupItem && !itemInGroupItem.ItemType.IsStatic); + return instance is ObjectGroup group && ObjectGroupContainsMoveable(group); } public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) From af66b3cb773757f508e7b410da39a6a34cf0efb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:48:26 +0000 Subject: [PATCH 5/9] Polish flipped-room placement helper style Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index d59f50588..bb60ed2ee 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2404,21 +2404,26 @@ public static void PlaceLight(LightType type) private static bool ObjectGroupContainsMoveable(ObjectGroup group) { foreach (var itemInGroup in group) + { if (itemInGroup is ItemInstance item && !item.ItemType.IsStatic) return true; + } return false; } + private static bool ObjectInstanceIsMoveable(ObjectInstance instance) => + instance is ItemInstance item && !item.ItemType.IsStatic; + private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instance) { if (room == null || instance == null || !room.IsAlternate) return false; - if (instance is ItemInstance item && !item.ItemType.IsStatic) - return true; + if (instance is ObjectGroup group) + return ObjectGroupContainsMoveable(group); - return instance is ObjectGroup group && ObjectGroupContainsMoveable(group); + return ObjectInstanceIsMoveable(instance); } public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) From 4ddcf63075da9a8ce146337871944409d350a08f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:49:29 +0000 Subject: [PATCH 6/9] Tighten flipped-room placement guard Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index bb60ed2ee..816062abf 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2417,7 +2417,7 @@ private static bool ObjectInstanceIsMoveable(ObjectInstance instance) => private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instance) { - if (room == null || instance == null || !room.IsAlternate) + if (!room.IsAlternate) return false; if (instance is ObjectGroup group) From 120f55a24daaeea73f4a6df15ce1d7ca27e8be23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:50:31 +0000 Subject: [PATCH 7/9] Simplify flipped-room group moveable helper Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index 816062abf..11abc3ccb 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2401,20 +2401,12 @@ public static void PlaceLight(LightType type) _editor.Action = new EditorActionPlace(false, (l, r) => new LightInstance(type) { Color = color }); } - private static bool ObjectGroupContainsMoveable(ObjectGroup group) - { - foreach (var itemInGroup in group) - { - if (itemInGroup is ItemInstance item && !item.ItemType.IsStatic) - return true; - } - - return false; - } - private static bool ObjectInstanceIsMoveable(ObjectInstance instance) => instance is ItemInstance item && !item.ItemType.IsStatic; + private static bool ObjectGroupContainsMoveable(ObjectGroup group) => + group.Any(ObjectInstanceIsMoveable); + private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instance) { if (!room.IsAlternate) From 6d5c4c178b26033b4b6340cbf9c0d8f3d3735eb0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:51:25 +0000 Subject: [PATCH 8/9] Align PlaceObject early return formatting Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index 11abc3ccb..02c2df503 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2421,7 +2421,9 @@ private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instanc public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) { if (!(instance is ISpatial)) + { return; + } if (IsInvalidMoveablePlacement(room, instance)) { From bdc5bcffdb41cc5eeb6c8840b907be884f573da8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 07:52:10 +0000 Subject: [PATCH 9/9] Restore standard single-line return style Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/ce7180ba-fb5c-4625-b6b6-eef475b1308f Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index 02c2df503..11abc3ccb 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -2421,9 +2421,7 @@ private static bool IsInvalidMoveablePlacement(Room room, ObjectInstance instanc public static void PlaceObject(Room room, VectorInt2 pos, ObjectInstance instance) { if (!(instance is ISpatial)) - { return; - } if (IsInvalidMoveablePlacement(room, instance)) {