p3he/games/triangleroom/__init__.py

18 lines
538 B
Python
Raw Normal View History

import importlib.resources as impr
import sys
import json
2024-04-07 11:50:37 +00:00
def init(modules, aoEngineEvents):
serialize = modules['serialize']
EngineEvent = modules['engineevents'].EngineEvent
curm = sys.modules[__name__]
files = impr.files(curm)
level = None
with files.joinpath("triangle.json").open('r') as leveldir:
level = json.loads(leveldir.read(), object_hook=serialize.object_hook)
2024-04-07 11:50:37 +00:00
aoEngineEvents.append(EngineEvent(
'level',
lambda _: level,
tsArguments=()
))