diff --git a/python/commands/disinfect.py b/python/commands/disinfect.py new file mode 100644 index 000000000..628188f43 --- /dev/null +++ b/python/commands/disinfect.py @@ -0,0 +1,22 @@ +import Crossfire + +whoami = Crossfire.WhoAmI() +map = whoami.Map + +if map != None and whoami.DungeonMaster: + count = 0 + map.Print('%s disinfecting %s'%(whoami.Name, map.Path)) + for x in range(0, map.Width): + for y in range(0, map.Height): + o = map.ObjectAt(x, y) + while o != None: + a = o.Above + if o.Type == Crossfire.Type.DISEASE: + whoami.Message(' removing %s at %d,%d'%(o.Name, x, y)) + count = count + 1 + o.Remove() + o = a + if count == 0: + map.Print(' => nothing removed') + else: + map.Print(' => %d diseases removed'%count) \ No newline at end of file diff --git a/python/events/init/disinfect_command.py b/python/events/init/disinfect_command.py new file mode 100644 index 000000000..e38ad4634 --- /dev/null +++ b/python/events/init/disinfect_command.py @@ -0,0 +1,2 @@ +import Crossfire +Crossfire.RegisterCommand("disinfect", "/python/commands/disinfect", 0)