diff --git a/src/comsys.py b/src/comsys.py index 19f3b2f186..574c4ad6cc 100644 --- a/src/comsys.py +++ b/src/comsys.py @@ -240,16 +240,17 @@ def get_cobj_from_name(cname): """ return CommChannel.objects.get(name=cname) -def create_channel(name, owner): +def create_channel(name, owner, description=None): """ Create a new channel. name: (string) Name of the new channel - owner: (Object) Objec that owns the channel + owner: (Object) Object that owns the channel """ new_chan = CommChannel() new_chan.name = ansi.parse_ansi(name, strip_ansi=True) new_chan.ansi_name = "[%s]" % (ansi.parse_ansi(name),) new_chan.set_owner(owner) + new_chan.description = description new_chan.save() return new_chan diff --git a/src/config/fixtures/initial_data.json b/src/config/fixtures/initial_data.json index b6d659975e..fa98833340 100644 --- a/src/config/fixtures/initial_data.json +++ b/src/config/fixtures/initial_data.json @@ -1 +1 @@ -[{"pk": 1, "model": "config.connectscreen", "fields": {"is_active": 1, "name": "Default", "connect_screen_text": "%ch%cb==================================================================%cn\r\n Welcome to Evennia! Please type one of the following to begin:\r\n\r\n If you have an existing account, connect to it by typing:\r\n %chconnect %cn\r\n If you need to create an account, type (without the <>'s):\r\n %chcreate \"\" %cn\r\n%ch%cb==================================================================%cn\r\n"}}, {"pk": 9, "model": "config.commandalias", "fields": {"user_input": "@desc", "equiv_command": "@describe"}}, {"pk": 3, "model": "config.commandalias", "fields": {"user_input": "@dest", "equiv_command": "@destroy"}}, {"pk": 4, "model": "config.commandalias", "fields": {"user_input": "@nuke", "equiv_command": "@destroy"}}, {"pk": 6, "model": "config.commandalias", "fields": {"user_input": "@tel", "equiv_command": "@teleport"}}, {"pk": 2, "model": "config.commandalias", "fields": {"user_input": "ex", "equiv_command": "examine"}}, {"pk": 7, "model": "config.commandalias", "fields": {"user_input": "i", "equiv_command": "inventory"}}, {"pk": 8, "model": "config.commandalias", "fields": {"user_input": "inv", "equiv_command": "inventory"}}, {"pk": 1, "model": "config.commandalias", "fields": {"user_input": "l", "equiv_command": "look"}}, {"pk": 5, "model": "config.commandalias", "fields": {"user_input": "sa", "equiv_command": "say"}}, {"pk": 1, "model": "config.configvalue", "fields": {"conf_value": "Evennia Test Site", "conf_key": "site_name"}}, {"pk": 2, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "player_dbnum_start"}}, {"pk": 3, "model": "config.configvalue", "fields": {"conf_value": "Credits", "conf_key": "money_name_plural"}}, {"pk": 4, "model": "config.configvalue", "fields": {"conf_value": "Credit", "conf_key": "money_name_singular"}}, {"pk": 5, "model": "config.configvalue", "fields": {"conf_value": "0", "conf_key": "game_firstrun"}}, {"pk": 6, "model": "config.configvalue", "fields": {"conf_value": "1800", "conf_key": "idle_timeout"}}, {"pk": 7, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "default_home"}}] +[{"pk": 1, "model": "config.connectscreen", "fields": {"is_active": 1, "name": "Default", "connect_screen_text": "%ch%cb==================================================================%cn\r\n Welcome to Evennia! Please type one of the following to begin:\r\n\r\n If you have an existing account, connect to it by typing:\r\n %chconnect %cn\r\n If you need to create an account, type (without the <>'s):\r\n %chcreate \"\" %cn\r\n%ch%cb==================================================================%cn\r\n"}}, {"pk": 9, "model": "config.commandalias", "fields": {"user_input": "@desc", "equiv_command": "@describe"}}, {"pk": 3, "model": "config.commandalias", "fields": {"user_input": "@dest", "equiv_command": "@destroy"}}, {"pk": 4, "model": "config.commandalias", "fields": {"user_input": "@nuke", "equiv_command": "@destroy"}}, {"pk": 6, "model": "config.commandalias", "fields": {"user_input": "@tel", "equiv_command": "@teleport"}}, {"pk": 2, "model": "config.commandalias", "fields": {"user_input": "ex", "equiv_command": "examine"}}, {"pk": 7, "model": "config.commandalias", "fields": {"user_input": "i", "equiv_command": "inventory"}}, {"pk": 8, "model": "config.commandalias", "fields": {"user_input": "inv", "equiv_command": "inventory"}}, {"pk": 1, "model": "config.commandalias", "fields": {"user_input": "l", "equiv_command": "look"}}, {"pk": 5, "model": "config.commandalias", "fields": {"user_input": "sa", "equiv_command": "say"}}, {"pk": 1, "model": "config.configvalue", "fields": {"conf_value": "Evennia Test Site", "conf_key": "site_name"}}, {"pk": 2, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "player_dbnum_start"}}, {"pk": 3, "model": "config.configvalue", "fields": {"conf_value": "Credits", "conf_key": "money_name_plural"}}, {"pk": 4, "model": "config.configvalue", "fields": {"conf_value": "Credit", "conf_key": "money_name_singular"}}, {"pk": 5, "model": "config.configvalue", "fields": {"conf_value": "1", "conf_key": "game_firstrun"}}, {"pk": 6, "model": "config.configvalue", "fields": {"conf_value": "1800", "conf_key": "idle_timeout"}}, {"pk": 7, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "default_home"}}] diff --git a/src/initial_setup.py b/src/initial_setup.py index 948130bd8b..bdebec5d3d 100644 --- a/src/initial_setup.py +++ b/src/initial_setup.py @@ -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') diff --git a/src/objects/managers/object.py b/src/objects/managers/object.py index f570d9c4a3..43edaeff75 100644 --- a/src/objects/managers/object.py +++ b/src/objects/managers/object.py @@ -356,7 +356,7 @@ class ObjectManager(models.Manager): # Create a player object of the same ID in the Objects table. odat = {"id": uid, "name": uname, - "type": 1, + "type": defines_global.OTYPE_PLAYER, "location": start_room_obj, "owner": None} user_object = self.create_object(odat) diff --git a/src/objects/models.py b/src/objects/models.py index b08d8682aa..5f516d2901 100755 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -30,7 +30,7 @@ class Attribute(models.Model): """ attr_name = models.CharField(max_length=255) attr_value = models.CharField(max_length=255) - attr_hidden = models.BooleanField(default=0) + attr_hidden = models.BooleanField(default=False) attr_object = models.ForeignKey("Object") objects = AttributeManager() @@ -903,6 +903,7 @@ class CommChannel(models.Model): ansi_name = models.CharField(max_length=255) owner = models.ForeignKey(Object, related_name="chan_owner") description = models.CharField(max_length=80) + is_joined_by_default = models.BooleanField(default=False) req_grp = models.ManyToManyField(Group, blank=True, null=True) objects = CommChannelManager() diff --git a/src/objects/sql/object.sql b/src/objects/sql/object.sql index 1b834063bc..23d2e75fb6 100644 --- a/src/objects/sql/object.sql +++ b/src/objects/sql/object.sql @@ -1,5 +1,5 @@ INSERT INTO objects_object VALUES(1,'Wizard','Wizard',1,0,'',2,1,'',2,'','CONNECTED','2007-04-25'); INSERT INTO objects_object VALUES(2,'Limbo','Limbo',1,NULL,'',NULL,2,'Welcome to your new Evennia-based game. From here you are ready to begin development. If you should need help or would like to participate in community discussions, visit http://evennia.com.',NULL,'','','2007-04-25'); -INSERT INTO objects_commchannel VALUES(1,'Public','Public',1,'Public Discussion'); -INSERT INTO objects_commchannel VALUES(2,'Errors','Errors',1,'Error Log'); -INSERT INTO objects_commchannel VALUES(3,'Info','Info',1,'Info Log'); \ No newline at end of file +INSERT INTO objects_commchannel VALUES(1,'Public','Public',1,'Public Discussion', false); +INSERT INTO objects_commchannel VALUES(2,'Errors','Errors',1,'Error Log', false); +INSERT INTO objects_commchannel VALUES(3,'Info','Info',1,'Info Log', false);