-
Notifications
You must be signed in to change notification settings - Fork 31
Indicate nodes not supported by current event #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,14 @@ Comment metadata entry reference (metadata block is indicated by a keyword which | |||||||||||||||||||||||||
| new line. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - **!Section "SECTION"** - this will define where the node will be found inside Tomb Editor. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - **!Supported "TYPE" "TYPE" "..." - defines supported event types for a given node. Each event type should be | ||||||||||||||||||||||||||
| enclosed in quotes. If event is not supported by a node, it will display a warning message when misplaced. | ||||||||||||||||||||||||||
| Possible event types are: **OnVolumeEnter, OnVolumeInside, OnVolumeLeave, OnLoop, OnLoadGame, OnSaveGame, | ||||||||||||||||||||||||||
| OnLevelStart, OnLevelEnd, OnUseItem, OnFreeze**. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - **!Unsupported "TYPE" "TYPE" "..." - defines unsupported event types for a given node. Acts in an opposite way | ||||||||||||||||||||||||||
|
Comment on lines
+44
to
+49
|
||||||||||||||||||||||||||
| - **!Supported "TYPE" "TYPE" "..." - defines supported event types for a given node. Each event type should be | |
| enclosed in quotes. If event is not supported by a node, it will display a warning message when misplaced. | |
| Possible event types are: **OnVolumeEnter, OnVolumeInside, OnVolumeLeave, OnLoop, OnLoadGame, OnSaveGame, | |
| OnLevelStart, OnLevelEnd, OnUseItem, OnFreeze**. | |
| - **!Unsupported "TYPE" "TYPE" "..." - defines unsupported event types for a given node. Acts in an opposite way | |
| - **!Supported "TYPE" "TYPE" "..."** - defines supported event types for a given node. Each event type should be | |
| enclosed in quotes. If an event is not supported by a node, it will display a warning message when misplaced. | |
| Possible event types are: **OnVolumeEnter, OnVolumeInside, OnVolumeLeave, OnLoop, OnLoadGame, OnSaveGame, | |
| OnLevelStart, OnLevelEnd, OnUseItem, OnFreeze**. | |
| - **!Unsupported "TYPE" "TYPE" "..."** - defines unsupported event types for a given node. Acts in an opposite way |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||||
| using System.Collections.Generic; | ||||||
| using System.IO; | ||||||
| using System.Linq; | ||||||
| using TombLib.LevelData; | ||||||
| using TombLib.LevelData.VisualScripting; | ||||||
|
|
||||||
| namespace TombLib.Utils | ||||||
|
|
@@ -59,6 +60,8 @@ public static class ScriptingUtils | |||||
| private const string _nodeTypeId = _metadataPrefix + "condition"; | ||||||
| private const string _nodeArgumentId = _metadataPrefix + "arguments"; | ||||||
| private const string _nodeDescriptionId = _metadataPrefix + "description"; | ||||||
| private const string _nodeSupportedId = _metadataPrefix + "supported"; | ||||||
| private const string _nodeUnsupportedId = _metadataPrefix + "unsupported"; | ||||||
| private const string _nodeLayoutNewLine = "newline"; | ||||||
|
|
||||||
| public static string GameNodeScriptPath = Path.Combine("Scripts", "Engine", "NodeCatalogs"); | ||||||
|
|
@@ -156,6 +159,16 @@ private static List<NodeFunction> GetAllNodeFunctions(string path, List<NodeFunc | |||||
| } | ||||||
| continue; | ||||||
| } | ||||||
| else if (comment.StartsWith(_nodeSupportedId, StringComparison.InvariantCultureIgnoreCase)) | ||||||
| { | ||||||
| ParseEventTypeList(comment, _nodeSupportedId, nodeFunction.SupportedEvents); | ||||||
| continue; | ||||||
| } | ||||||
| else if (comment.StartsWith(_nodeUnsupportedId, StringComparison.InvariantCultureIgnoreCase)) | ||||||
| { | ||||||
| ParseEventTypeList(comment, _nodeUnsupportedId, nodeFunction.UnsupportedEvents); | ||||||
| continue; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| if (cPoint > 0) | ||||||
|
|
@@ -257,6 +270,16 @@ private static List<NodeFunction> GetAllNodeFunctions(string path, List<NodeFunc | |||||
| return result.OrderBy(n => n.Section).ToList(); | ||||||
| } | ||||||
|
|
||||||
| private static void ParseEventTypeList(string comment, string tagId, List<EventType> targetList) | ||||||
| { | ||||||
| var values = TextExtensions.ExtractValues(comment.Substring(tagId.Length, comment.Length - tagId.Length)); | ||||||
|
||||||
| var values = TextExtensions.ExtractValues(comment.Substring(tagId.Length, comment.Length - tagId.Length)); | |
| var values = TextExtensions.ExtractValues(comment.Substring(tagId.Length)); |
Copilot
AI
Mar 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum.TryParse here is case-sensitive, while the metadata tag match uses case-insensitive comparison. This can cause valid values (e.g., different casing in scripts) to be silently ignored. Use the Enum.TryParse(string, bool ignoreCase, out TEnum) overload with ignoreCase: true, and consider avoiding duplicates when adding to targetList to prevent repeated entries if multiple tags are present.
| if (Enum.TryParse(v.Trim(), out EventType eventType)) | |
| if (Enum.TryParse(v.Trim(), true, out EventType eventType) && !targetList.Contains(eventType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImageAttributesis created in the paint path but never disposed, which can leak GDI resources over time (especially during frequent repaints). Also, settingMatrix22 = 0.0fzeroes the blue channel; if the intent is only to apply opacity, keep the RGB diagonal at 1.0 and only changeMatrix33. Fix by disposingImageAttributes(e.g., via ausing) and correcting the color matrix so it doesn’t unintentionally alter colors.