def do_zinstance(zone): '''create a new instance of the specified zone.''' # sanitize the zone key if sum([(not v in string.ascii_letters + string.digits + "_") for v in zone]): return None elif len(zone) == 0: return None # find all of our room keys rnames = mudsys.list_zone_contents(zone, "rproto") if len(rnames) == 0: return None to_instance = [] for name in rnames: key = name + "@" + zone if not mudroom.is_abstract(key): to_instance.append(name) # instantiate and reset all of the relevant rooms uid = mudsys.next_uid() inszone = zone + str(uid) for name in to_instance: key = name + "@" + zone ins = name + "@" + inszone rm = mudroom.instance(key, ins) rm.reset() # append this to the list of instanced zones curr_instances.append((inszone, zone)) # success return inszone
def do_zinstance(zone): '''create a new instance of the specified zone.''' # sanitize the zone key if sum([(not v in string.ascii_letters+string.digits+"_") for v in zone]): return None elif len(zone) == 0: return None # find all of our room keys rnames = mudsys.list_zone_contents(zone, "rproto") if len(rnames) == 0: return None to_instance = [ ] for name in rnames: key = name + "@" + zone if not mudroom.is_abstract(key): to_instance.append(name) # instantiate and reset all of the relevant rooms uid = mudsys.next_uid() inszone = zone + str(uid) for name in to_instance: key = name + "@" + zone ins = name + "@" + inszone rm = mudroom.instance(key, ins) rm.reset() # append this to the list of instanced zones curr_instances.append((inszone, zone)) # success return inszone
def cmd_instance(ch, cmd, arg): '''Create an instanced version of the specified room''' try: source, dest = mud.parse_args(ch, True, cmd, arg, "word(source) [as] word(dest)") except: return room = mudroom.instance(source, dest) ch.send("You instance " + source + " as " + room.proto + ".")