Add 'disinfect' command for DMs, removing diseases on the current map.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@14525 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
b99884bb7f
commit
43041fec06
|
@ -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)
|
|
@ -0,0 +1,2 @@
|
|||
import Crossfire
|
||||
Crossfire.RegisterCommand("disinfect", "/python/commands/disinfect", 0)
|
Loading…
Reference in New Issue