def demolish( char, item ): if not checkAccess(char, item.multi, ACCESS_OWNER): char.socket.sysmessage('You are not the owner of this house.') return # If Sign has no Multi, then we have problems here if not item.hastag( 'house' ): return # Assign the Multi multi = wolfpack.findobject( item.gettag( 'house' ) ) # Looking for the list of items in the Multi listitems = multi.objects # Now... the Loop to remove all items contador = 0 for multiitem in listitems: try: n = multiitem.player except: multiitem.delete() contador += 1 # Message about how many items are deleted in the house char.socket.sysmessage( "Deleted %i items in house!" % contador ) # Unregistering the House housing.unregisterHouse(multi) # Erasing Multi multi.delete()
def doRemovemulti(char, args, target): # finding the multi multi = wolfpack.findmulti(target.pos) # Now we have the multi... or not if not multi: char.socket.sysmessage("No Multi here for removal!") return True else: # Lets make similar to demolish: # Looking for the list of items in the Multi listitems = multi.objects # Now... the Loop to remove all items contador = 0 for multiitem in listitems: # A bad but necessary way to check if its Char or item for a while (IsChar and IsItem have some problems on objects list) try: dir = multiitem.direction except: multiitem.delete() contador += 1 # Message about how many items are deleted in the house char.socket.sysmessage("Deleted %i items in house!" % contador) # Unregistering the House housing.unregisterHouse(multi) # Erasing Multi multi.delete() return True
def demolish(char, item): if not checkAccess(char, item.multi, ACCESS_OWNER): char.socket.sysmessage("You are not the owner of this house.") return # If Sign has no Multi, then we have problems here if not item.hastag("house"): return # Assign the Multi multi = wolfpack.findobject(item.gettag("house")) # Looking for the list of items in the Multi listitems = multi.objects # Now... the Loop to remove all items contador = 0 for multiitem in listitems: try: n = multiitem.player except: multiitem.delete() contador += 1 # Message about how many items are deleted in the house char.socket.sysmessage("Deleted %i items in house!" % contador) # Unregistering the House housing.unregisterHouse(multi) # Erasing Multi multi.delete()
def onDetach(house): housing.unregisterHouse(house)