.mudpy.log.stdout: true
#.mudpy.log.syslog: mudpy
+.mudpy.movement.down.enter_term: above
+.mudpy.movement.down.exit_term: downward
+.mudpy.movement.down.vector: [0,0,-1]
+.mudpy.movement.east.enter_term: the west
+.mudpy.movement.east.exit_term: to the east
+.mudpy.movement.east.vector: [1,0,0]
+.mudpy.movement.north.enter_term: the south
+.mudpy.movement.north.exit_term: to the north
+.mudpy.movement.north.vector: [0,1,0]
+.mudpy.movement.south.enter_term: the north
+.mudpy.movement.south.exit_term: to the south
+.mudpy.movement.south.vector: [0,-1,0]
+.mudpy.movement.up.enter_term: below
+.mudpy.movement.up.exit_term: upward
+.mudpy.movement.up.vector: [0,0,1]
+.mudpy.movement.west.enter_term: the east
+.mudpy.movement.west.exit_term: to the west
+.mudpy.movement.west.vector: [-1,0,0]
+
internal:network:
host: ::1
#host: 127.0.0.1
linkdead: { "default": 6000, "entering_account_name": 600, "active": 6048000 }
idle: { "default": 5000, "entering_account_name": 500, "active": 5040000 }
increment: 0.1
-
-internal:directions:
- down: { "vector": [0,0,-1], "exit": "downward", "enter": "above" }
- east: { "vector": [1,0,0], "exit": "to the east", "enter": "the west" }
- north: { "vector": [0,1,0], "exit": "to the north", "enter": "the south" }
- south: { "vector": [0,-1,0], "exit": "to the south", "enter": "the north" }
- up: { "vector": [0,0,1], "exit": "upward", "enter": "below" }
- west: { "vector": [-1,0,0], "exit": "to the west", "enter": "the east" }
element = mudpy.misc.Element(prefix, self.universe,
self.filename)
element.set(node[facet_pos:], self.data[node])
+ if prefix.startswith("mudpy.movement."):
+ self.universe.directions.add(
+ prefix[prefix.rfind(".") + 1:])
for include_file in includes:
if not os.path.isabs(include_file):
include_file = find_file(
def move_direction(self, direction):
"""Relocate the element in a specified direction."""
- self.echo_to_location(
- self.get(
- "name"
- ) + " exits " + self.universe.categories[
- "internal"
- ][
- "directions"
- ].get(
- direction
- )[
- "exit"
- ] + "."
- )
- self.send(
- "You exit " + self.universe.categories[
- "internal"
- ][
- "directions"
- ].get(
- direction
- )[
- "exit"
- ] + ".",
- add_prompt=False
- )
+ motion = self.universe.contents["mudpy.movement.%s" % direction]
+ enter_term = motion.get("enter_term")
+ exit_term = motion.get("exit_term")
+ self.echo_to_location("%s exits %s." % (self.get("name"), exit_term))
+ self.send("You exit %s." % exit_term, add_prompt=False)
self.go_to(
self.universe.contents[
self.get("location")].link_neighbor(direction)
)
- self.echo_to_location(
- self.get(
- "name"
- ) + " arrives from " + self.universe.categories[
- "internal"
- ][
- "directions"
- ].get(
- direction
- )[
- "enter"
- ] + "."
- )
+ self.echo_to_location("%s arrives from %s." % (
+ self.get("name"), enter_term))
def look_at(self, key):
"""Show an element to another element."""
if re.match("""^area:-?\d+,-?\d+,-?\d+$""", self.key):
coordinates = [(int(x))
for x in self.key.split(":")[1].split(",")]
- directions = self.universe.categories["internal"]["directions"]
- offsets = dict(
- [
- (
- x, directions.get(x)["vector"]
- ) for x in directions.facets()
- ]
- )
+ offsets = dict((x,
+ self.universe.contents["mudpy.movement.%s" % x].get("vector")
+ ) for x in self.universe.directions)
for portal in self.get("gridlinks"):
adjacent = map(lambda c, o: c + o,
coordinates, offsets[portal])
self.categories = {}
self.contents = {}
self.default_origins = {}
+ self.directions = set()
self.loglines = []
self.private_files = []
self.reload_flag = False