From 84f2fa2376d2202d09fea78e499fc644454a79ba Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 23 Apr 2014 11:16:46 +0000 Subject: [PATCH] Use area instead of location or room Since the term "location" was already used for the name of the facet identifying the area where an element is located, it was vague to also use that term for a class of elements which serve as those locations. Instead use the term "area" since it's as descriptive and shorter. Also avoid the term "room" as a synonym since areas can be outside as well as indoors. This further implies renaming the location.mpy sample file to become area.mpy instead. --- etc/mudpy.conf | 2 +- lib/mudpy/misc.py | 38 +++++++++++++++++++------------------- sample/__init__.mpy | 4 ++-- sample/{location.mpy => area.mpy} | 30 +++++++++++++++--------------- sample/prop.mpy | 4 ++-- share/archetype.mpy | 4 ++-- share/command.mpy | 6 +++--- 7 files changed, 44 insertions(+), 44 deletions(-) rename sample/{location.mpy => area.mpy} (65%) diff --git a/etc/mudpy.conf b/etc/mudpy.conf index 01db1e9..927b74b 100644 --- a/etc/mudpy.conf +++ b/etc/mudpy.conf @@ -3,7 +3,7 @@ # terms provided in the LICENSE file distributed with this software. [__control__] -default_files = { "account": "account.mpy", "actor": "actor.mpy", "command": "command.mpy", "internal": "internal.mpy", "location": "location.mpy", "menu": "menu.mpy", "other": "other.mpy", "prop": "prop.mpy" } +default_files = { "account": "account.mpy", "actor": "actor.mpy", "area": "area.mpy", "command": "command.mpy", "internal": "internal.mpy", "menu": "menu.mpy", "other": "other.mpy", "prop": "prop.mpy" } include_dirs = "sample" include_files = "archetype.mpy" private_files = "account.mpy" diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 02db563..28b92fb 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -263,9 +263,9 @@ class Element: def update_location(self): """Make sure the location's contents contain this element.""" - location = self.get("location") - if location in self.universe.contents: - self.universe.contents[location].contents[self.key] = self + area = self.get("location") + if area in self.universe.contents: + self.universe.contents[area].contents[self.key] = self def clean_contents(self): """Make sure the element's contents aren't bogus.""" @@ -273,15 +273,15 @@ class Element: if element.get("location") != self.key: del self.contents[element.key] - def go_to(self, location): - """Relocate the element to a specific location.""" + def go_to(self, area): + """Relocate the element to a specific area.""" current = self.get("location") if current and self.key in self.universe.contents[current].contents: del universe.contents[current].contents[self.key] - if location in self.universe.contents: - self.set("location", location) - self.universe.contents[location].contents[self.key] = self - self.look_at(location) + if area in self.universe.contents: + self.set("location", area) + self.universe.contents[area].contents[self.key] = self + self.look_at(area) def go_home(self): """Relocate the element to its default location.""" @@ -366,9 +366,9 @@ class Element: self.send(message) def portals(self): - """Map the portal directions for a room to neighbors.""" + """Map the portal directions for an area to neighbors.""" portals = {} - if re.match("""^location:-?\d+,-?\d+,-?\d+$""", self.key): + 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"] @@ -382,7 +382,7 @@ class Element: for portal in self.getlist("gridlinks"): adjacent = map(lambda c, o: c + o, coordinates, offsets[portal]) - neighbor = "location:" + ",".join( + neighbor = "area:" + ",".join( [(str(x)) for x in adjacent] ) if neighbor in self.universe.contents: @@ -479,12 +479,12 @@ class Universe: # go through all elements to clear out inactive avatar locations for element in self.contents.values(): - location = element.get("location") - if element in inactive_avatars and location: - if location in self.contents and element.key in self.contents[ - location + area = element.get("location") + if element in inactive_avatars and area: + if area in self.contents and element.key in self.contents[ + area ].contents: - del self.contents[location].contents[element.key] + del self.contents[area].contents[element.key] element.set("default_location", location) element.remove_facet("location") @@ -2065,7 +2065,7 @@ def command_look(actor, parameters): def command_say(actor, parameters): - """Speak to others in the same room.""" + """Speak to others in the same area.""" # check for replacement macros and escape them parameters = escape_macros(parameters) @@ -2129,7 +2129,7 @@ def command_say(actor, parameters): # capitalize the first letter message = message[0].upper() + message[1:] - # tell the room + # tell the area if message: actor.echo_to_location( actor.get("name") + " " + action + "s, \"" + message + "\"" diff --git a/sample/__init__.mpy b/sample/__init__.mpy index 4dd2e2b..b66fbca 100644 --- a/sample/__init__.mpy +++ b/sample/__init__.mpy @@ -1,8 +1,8 @@ -# Copyright (c) 2004-2010 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. [__control__] -include_files = [ "location.mpy", "prop.mpy" ] +include_files = [ "area.mpy", "prop.mpy" ] read_only = yes diff --git a/sample/location.mpy b/sample/area.mpy similarity index 65% rename from sample/location.mpy rename to sample/area.mpy index 5aaa30d..e4641eb 100644 --- a/sample/location.mpy +++ b/sample/area.mpy @@ -1,45 +1,45 @@ -# Copyright (c) 2004-2010 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. -[location:-1,0,0] -description = This is the West Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:0,-1,0] -description = This is the South Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:0,0,-1] -description = This is the Lower Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:0,0,0] -description = This is the Center Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:0,0,1] -description = This is the Upper Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:0,1,0] -description = This is the North Sample Location. It is merely provided as an example of what a location might look like. +[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 -[location:1,0,0] -description = This is the East Sample Location. It is merely provided as an example of what a location might look like. +[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 diff --git a/sample/prop.mpy b/sample/prop.mpy index 51a981e..1075eba 100644 --- a/sample/prop.mpy +++ b/sample/prop.mpy @@ -1,9 +1,9 @@ -# Copyright (c) 2004-2010 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. [prop:sample_prop] impression = A sample prop sits here. keywords = sample prop -location = location:0,0,0 +location = area:0,0,0 diff --git a/share/archetype.mpy b/share/archetype.mpy index 8ee9c3e..aefa4f8 100644 --- a/share/archetype.mpy +++ b/share/archetype.mpy @@ -1,4 +1,4 @@ -# Copyright (c) 2004-2010 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -9,6 +9,6 @@ read_only = yes is_actor = yes [archetype:avatar] -default_location = location:0,0,0 +default_location = area:0,0,0 inherit = archetype:actor diff --git a/share/command.mpy b/share/command.mpy index feec37c..eed6a74 100644 --- a/share/command.mpy +++ b/share/command.mpy @@ -1,4 +1,4 @@ -# Copyright (c) 2004-2010 Jeremy Stanley . Permission +# Copyright (c) 2004-2014 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -21,7 +21,7 @@ help = Ways to create an element:$(eol)$(eol) create actor:fred$(eol) create action = command_delete(actor, parameters) administrative = yes description = Delete an existing facet from an element. -help = You can delete any facet of an element as follows:$(eol)$(eol) delete location:boardroom terrain +help = You can delete any facet of an element as follows:$(eol)$(eol) delete area:boardroom terrain [command:destroy] action = command_destroy(actor, parameters) @@ -64,7 +64,7 @@ help = This will reload all python modules and read-only data files. [command:say] action = command_say(actor, parameters) description = State something out loud. -help = This allows you to speak to other characters within the same room. If you end your sentence with punctuation, the message displayed will incorporate an appropriate action (ask, exclaim, et cetera). It will also correct common typographical errors, add punctuation and capitalize your sentence as needed (assuming you speak one sentence per line). For example:$(eol)$(eol) > say youre sure i went teh wrong way?$(eol) You ask, "You're sure I went the wrong way?"$(eol)$(eol)If necessary, enclose literal statements in quotation marks:$(eol)$(eol) > say "youre sure i went teh wrong way?"$(eol) You say, "youre sure i went teh wrong way?" +help = This allows you to speak to other characters within the same area. If you end your sentence with punctuation, the message displayed will incorporate an appropriate action (ask, exclaim, et cetera). It will also correct common typographical errors, add punctuation and capitalize your sentence as needed (assuming you speak one sentence per line). For example:$(eol)$(eol) > say youre sure i went teh wrong way?$(eol) You ask, "You're sure I went the wrong way?"$(eol)$(eol)If necessary, enclose literal statements in quotation marks:$(eol)$(eol) > say "youre sure i went teh wrong way?"$(eol) You say, "youre sure i went teh wrong way?" see_also = chat [command:set] -- 2.11.0