From 95b58411eb627c2f6213844b579a315197b4085f Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 12 Nov 2017 01:35:15 +0000 Subject: [PATCH] Convert sample data to new style Use the new data model for the sample room and prop definitions. --- mudpy/misc.py | 6 ++--- sample/area.yaml | 75 ++++++++++++++++++++++++---------------------------- sample/prop.yaml | 7 +++-- share/archetype.yaml | 2 +- 4 files changed, 41 insertions(+), 49 deletions(-) diff --git a/mudpy/misc.py b/mudpy/misc.py index 170a4c3..b322afc 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -309,9 +309,9 @@ class Element: def portals(self): """Map the portal directions for an area to neighbors.""" portals = {} - if re.match(r"""^area:-?\d+,-?\d+,-?\d+$""", self.key): + if re.match(r"""^area\.-?\d+,-?\d+,-?\d+$""", self.key): coordinates = [(int(x)) - for x in self.key.split(":")[1].split(",")] + for x in self.key.split(".")[-1].split(",")] offsets = dict( (x, self.universe.contents["mudpy.movement.%s" % x].get("vector") @@ -319,7 +319,7 @@ class Element: for portal in self.get("gridlinks"): adjacent = map(lambda c, o: c + o, coordinates, offsets[portal]) - neighbor = "area:" + ",".join( + neighbor = "area." + ",".join( [(str(x)) for x in adjacent] ) if neighbor in self.universe.contents: diff --git a/sample/area.yaml b/sample/area.yaml index 8eb13c5..6bc13ce 100644 --- a/sample/area.yaml +++ b/sample/area.yaml @@ -5,44 +5,37 @@ _copy: Copyright (c) 2004-2017 Jeremy Stanley . _desc: This is a set of sample locations for testing and demonstration purposes. -area:-1,0,0: - description: This is the West Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['east'] - name: West Sample Location - terrain: inside - -area:0,-1,0: - description: This is the South Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['north'] - name: South Sample Location - terrain: inside - -area:0,0,-1: - description: This is the Lower Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['up'] - name: Lower Sample Location - terrain: inside - -area:0,0,0: - description: This is the Center Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['down', 'east', 'north', 'south', 'up', 'west'] - name: Center Sample Location - terrain: inside - -area:0,0,1: - description: This is the Upper Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['down'] - name: Upper Sample Location - terrain: inside - -area:0,1,0: - description: This is the North Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['south'] - name: North Sample Location - terrain: inside - -area:1,0,0: - description: This is the East Sample Location. It is merely provided as an example of what an area might look like. - gridlinks: ['west'] - name: East Sample Location - terrain: inside +area.-1,0,0.description: This is the West Sample Location. It is merely provided as an example of what an area might look like. +area.-1,0,0.gridlinks: ['east'] +area.-1,0,0.name: West Sample Location +area.-1,0,0.terrain: inside + +area.0,-1,0.description: This is the South Sample Location. It is merely provided as an example of what an area might look like. +area.0,-1,0.gridlinks: ['north'] +area.0,-1,0.name: South Sample Location +area.0,-1,0.terrain: inside + +area.0,0,-1.description: This is the Lower Sample Location. It is merely provided as an example of what an area might look like. +area.0,0,-1.gridlinks: ['up'] +area.0,0,-1.name: Lower Sample Location +area.0,0,-1.terrain: inside + +area.0,0,0.description: This is the Center Sample Location. It is merely provided as an example of what an area might look like. +area.0,0,0.gridlinks: ['down', 'east', 'north', 'south', 'up', 'west'] +area.0,0,0.name: Center Sample Location +area.0,0,0.terrain: inside + +area.0,0,1.description: This is the Upper Sample Location. It is merely provided as an example of what an area might look like. +area.0,0,1.gridlinks: ['down'] +area.0,0,1.name: Upper Sample Location +area.0,0,1.terrain: inside + +area.0,1,0.description: This is the North Sample Location. It is merely provided as an example of what an area might look like. +area.0,1,0.gridlinks: ['south'] +area.0,1,0.name: North Sample Location +area.0,1,0.terrain: inside + +area.1,0,0.description: This is the East Sample Location. It is merely provided as an example of what an area might look like. +area.1,0,0.gridlinks: ['west'] +area.1,0,0.name: East Sample Location +area.1,0,0.terrain: inside diff --git a/sample/prop.yaml b/sample/prop.yaml index 73b6e53..73576fb 100644 --- a/sample/prop.yaml +++ b/sample/prop.yaml @@ -4,7 +4,6 @@ _copy: Copyright (c) 2004-2017 Jeremy Stanley . _desc: This is a set of sample objects for testing and demonstration purposes. -prop:sample_prop: - impression: A sample prop sits here. - keywords: sample prop - location: area:0,0,0 +prop.sample_prop.impression: A sample prop sits here. +prop.sample_prop.keywords: sample prop +prop.sample_prop.location: area.0,0,0 diff --git a/share/archetype.yaml b/share/archetype.yaml index c7bc10f..f1c345e 100644 --- a/share/archetype.yaml +++ b/share/archetype.yaml @@ -8,5 +8,5 @@ _lock: true archetype.actor.is_actor: true -archetype.avatar.default_location: area:0,0,0 +archetype.avatar.default_location: area.0,0,0 archetype.avatar.inherit: [ archetype.actor ] -- 2.11.0