Item editor: items of a mod in a searchable list, name/description in every language, price, icon, types, use action; GUI suite items_editor_edit

This commit is contained in:
cthangover committed 2026-10-23 19:09:45 +02:00
commit 138b0f689d
11 files changed
+423

No files matched your search

@@ -0,0 +1,33 @@
using System.Linq;
using Cthangover.Core.Mods;
using Cthangover.Core.Utils;
using Godot;
namespace Cthangover.Tools.ItemsEditor.Tests
{
/// <summary>Adds the editor test driver when <c>--itest=items_editor_edit</c> is given.</summary>
public class ItemEditorTestInitializer : IModInitializer
{
private static bool driverQueued;
/// <summary>Nothing per mod.</summary>
public void OnModLoaded(string modId)
{
}
/// <summary>Queues the driver once.</summary>
public void OnModResourcesReady()
{
var args = OS.GetCmdlineUserArgs();
if (driverQueued || !args.Any(a => a == "--itest=items_editor_edit"))
return;
driverQueued = true;
var shots = args.Where(a => a.StartsWith("--shots=", System.StringComparison.Ordinal))
.Select(a => a.Substring("--shots=".Length))
.FirstOrDefault();
GameLogger.Log("TEST", $"ItemEditorTestInitializer: activating items_editor_edit, shots={shots ?? "off"}");
(Godot.Engine.GetMainLoop() as SceneTree)?.Root?.CallDeferred("add_child", new ItemEditorTestDriver(shots));
}
}
}