class_name ToolRegistry extends RefCounted ## Registry of `EditorTool` instances, keyed by id ## (docs/architecture/editor.md ยง7.1: "brush / object-place / select / ## erase, etc."). `EditorCore.use_tool()` is the single choke point every ## chunk mutation goes through -- UI code and tests both call tools by id ## through here rather than reaching into `ChunkEditorModel` directly. var _tools: Dictionary = {} var _active_id: String = "" func register_tool(tool: EditorTool) -> void: _tools[tool.tool_id] = tool func get_tool(tool_id: String) -> EditorTool: return _tools.get(tool_id, null) func has_tool(tool_id: String) -> bool: return _tools.has(tool_id) func get_tool_ids() -> Array: return _tools.keys() func set_active_tool(tool_id: String) -> bool: if not _tools.has(tool_id): return false _active_id = tool_id return true func get_active_tool_id() -> String: return _active_id func get_active_tool() -> EditorTool: return _tools.get(_active_id, null)