43 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""runtime 模块初始化:注册所有 ServerEnv 函数(三处同步注册之③)。
注册清单(与 ① runtime_service.py 实现、② __init__.py 导出 保持三处同步):
build_entity_tree / load_world_runtime / runtime_status /
runtime_event_dispatch / runtime_control
"""
from .runtime_service import (
build_entity_tree,
load_world_runtime,
runtime_status,
runtime_event_dispatch,
runtime_control,
)
def load_runtime(env):
"""挂载 runtime 模块到 ServerEnv(宿主应用 app/scense.py 在 init() 中调用)。
参数 env: ahserver.ServerEnv 单例。
返回值: env(供宿主链式调用)。
"""
env.build_entity_tree = build_entity_tree
env.load_world_runtime = load_world_runtime
env.runtime_status = runtime_status
env.runtime_event_dispatch = runtime_event_dispatch
env.runtime_control = runtime_control
return env
# ---- 规范标准出口(module-development-spec:scense_runtime.init 必须导出 load_scense_runtime)----
def load_scense_runtime(env=None):
"""标准出口:委托到本模块既有 loader load_runtime(env)。
[r13-start3 修复] 原 None 分支调 load_runtime() 缺必选位置参数 env → TypeError,
标准出口无参调用必炸(2743dc4 引入)。与 world/scene/scense 同口径:
env 缺省时取 ServerEnv() 单例。
"""
if env is None:
from ahserver.serverenv import ServerEnv
env = ServerEnv()
return load_runtime(env)