[wpdev-commits] xmlscripts/scripts/wolfpack/commands wipe.py,NONE,1.1
Brought to you by:
rip,
thiagocorrea
|
From: <thi...@us...> - 2003-09-01 04:56:48
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands
In directory sc8-pr-cvs1:/tmp/cvs-serv669/wolfpack/commands
Added Files:
wipe.py
Log Message:
moved 'nuke to python script. Also made 'wipe an alias to it.
--- NEW FILE: wipe.py ---
#===============================================================#
# ) (\_ | WOLFPACK 13.0.0 Scripts #
# (( _/{ "-; | Created by: Correa #
# )).-' {{ ;'` | Revised by: #
# ( ( ;._ \\ ctr | Last Modification: Created #
#===============================================================#
# .wipe/nuke Commands #
#===============================================================#
import wolfpack
import string
import wolfpack.gumps
from wolfpack.gumps import *
from wolfpack.utilities import *
from wolfpack import *
def getBoundingBox( socket, callback ) :
socket.attachtarget( "wolfpack.commands.wipe.getBoundingBoxResponse", [0, callback] )
def getBoundingBoxResponse( char, args, target ):
if args[0] == 0:
char.socket.attachtarget("wolfpack.commands.wipe.getBoundingBoxResponse", [1, args[1], target] )
else:
args[1]( char.socket, args[2], target )
def onLoad():
wolfpack.registercommand( "wipe", "wolfpack.commands.wipe" )
wolfpack.registercommand( "nuke", "wolfpack.commands.wipe" )
def onCommand( socket, command, argstring ):
if len( argstring ) > 0:
socket.sysmessage( "Argument handling not implemented [yet]")
else:
socket.sysmessage("Select the area to remove")
getBoundingBox( socket, wipeBoundingBox )
return 1
def wipeBoundingBox( socket, target1, target2 ):
count = 0
iterator = wolfpack.itemregion( target1.pos.x, target1.pos.y, target2.pos.x, target2.pos.y, target2.pos.map )
item = iterator.first
while item:
item.delete()
item = iterator.next
count += 1;
socket.sysmessage( "%i items removed" % count )
return 1
|