File: disinfect.py

package info (click to toggle)
crossfire-maps 1.71.0-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 211,128 kB
  • sloc: python: 7,656; ansic: 2,143; perl: 744; sh: 73; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)