mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 10:16:32 +01:00
Part 1 of initial database population re-factor, along with a comsys model change. DO NOT UPDATE TO THIS IN PRODUCTION ENVIRONMENTS YET! Wait for the all-clear.
This commit is contained in:
parent
8ebea8c22e
commit
c0ebbc3967
6 changed files with 29 additions and 10 deletions
|
|
@ -1,12 +1,23 @@
|
|||
from django.contrib.auth.models import User, Group
|
||||
from src.objects.models import Object
|
||||
from src.config.models import ConfigValue
|
||||
from src import comsys, defines_global
|
||||
|
||||
def handle_setup():
|
||||
# Set the initial user's username on the #1 object.
|
||||
god_user = User.objects.filter(id=1)[0]
|
||||
god_user_obj = Object.objects.filter(id=1)[0]
|
||||
god_user = User.objects.get(id=1)
|
||||
god_user_obj = Object(id=1, type=defines_global.OTYPE_PLAYER)
|
||||
god_user_obj.set_name(god_user.username)
|
||||
god_user_obj.save()
|
||||
|
||||
limbo_obj = Object()
|
||||
limbo_obj.type = defines_global.OTYPE_ROOM
|
||||
limbo_obj.owner = god_user_obj
|
||||
limbo_obj.set_name('Limbo')
|
||||
limbo_obj.save()
|
||||
|
||||
god_user_obj.home = limbo_obj
|
||||
god_user_obj.save()
|
||||
|
||||
groups = ("Immortals", "Wizards", "Builders", "Player Helpers")
|
||||
for group in groups:
|
||||
|
|
@ -14,5 +25,11 @@ def handle_setup():
|
|||
newgroup.name = group
|
||||
newgroup.save()
|
||||
|
||||
chan_pub = comsys.create_channel("Public", god_user_obj, description="Public Discussion")
|
||||
chan_pub.is_joined_by_default = True
|
||||
chan_pub.save()
|
||||
comsys.create_channel("Errors", god_user_obj, description="Error log")
|
||||
comsys.create_channel("Info", god_user_obj, description="Informative messages")
|
||||
|
||||
# We don't want to do initial setup tasks every startup, only the first.
|
||||
ConfigValue.objects.set_configvalue('game_firstrun', '0')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue