Holy moley is it hard to do MUCK stuff relationally.

This commit is contained in:
Yaro Kasear 2025-09-04 14:36:00 -05:00
parent c72417e5e4
commit d9ed6d5cd7
8 changed files with 89 additions and 24 deletions

39
muck/init.py Normal file
View file

@ -0,0 +1,39 @@
from muck.models.room import Room
from muck.models.player import Player
def bootstrap_world(session):
if session.query(Room).first() or session.query(Player).first():
print("World already initialized.")
return
print("Bootstrapping world...")
room_zero = Room(
id=0,
name="Room Zero",
props={"_": {"de": "You are in Room Zero. It is very dark in here."}}
)
the_one = Player(
id=1,
name="One",
password="potrzebie",
props={"_": {"de": "You see The One."}}
)
the_one.location = room_zero
the_one.home = room_zero
the_one.creator = the_one
the_one.owner = the_one
the_one.modifier = the_one
the_one.last_user = the_one
room_zero.owner = the_one
room_zero.creator = the_one
room_zero.modifier = the_one
room_zero.last_user = the_one
session.add_all([room_zero, the_one])
session.commit()
print("World initialized.")