X-Git-Url: https://mudpy.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmudpy%2Fmisc.py;h=02f2fbad8fa0a9f3dbac52dd3873702cf4046dc4;hb=1d3b34b7ef4678e60c24d79acfa9120e98d23a43;hp=c5e1d1b34d9f762a2b9738eb958859b8120954c3;hpb=aa9c3e17f4d7e76ed5f5b7000b5a3a82f29a77f0;p=mudpy.git diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index c5e1d1b..02f2fba 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -252,48 +252,17 @@ class Element: 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.""" @@ -331,14 +300,9 @@ class 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]) @@ -379,6 +343,7 @@ class Universe: self.categories = {} self.contents = {} self.default_origins = {} + self.directions = set() self.loglines = [] self.private_files = [] self.reload_flag = False @@ -477,8 +442,8 @@ class Universe: """Create and open the listening socket.""" # need to know the local address and port number for the listener - host = self.categories["internal"]["network"].get("host") - port = self.categories["internal"]["network"].get("port") + host = self.contents["mudpy.network"].get("host") + port = self.contents["mudpy.network"].get("port") # if no host was specified, bind to all local addresses (preferring # ipv6)