""" Core package - 核心功能模块 Keep package imports lazy so lightweight runtime contexts can import `core.script_system` without eagerly pulling in the editor stack. """ from importlib import import_module __all__ = [ "CoreWorld", "SelectionSystem", "EventHandler", "ToolManager", "ScriptManager", "ScriptBase", "ScriptComponent", ] _LAZY_IMPORTS = { "CoreWorld": ("core.world", "CoreWorld"), "SelectionSystem": ("core.selection", "SelectionSystem"), "EventHandler": ("core.event_handler", "EventHandler"), "ToolManager": ("core.tool_manager", "ToolManager"), "ScriptManager": ("core.script_system", "ScriptManager"), "ScriptBase": ("core.script_system", "ScriptBase"), "ScriptComponent": ("core.script_system", "ScriptComponent"), } def __getattr__(name): if name not in _LAZY_IMPORTS: raise AttributeError(f"module 'core' has no attribute {name!r}") module_name, attr_name = _LAZY_IMPORTS[name] module = import_module(module_name) value = getattr(module, attr_name) globals()[name] = value return value