[wpdev-commits] xmlscripts/scripts door.py,1.12,1.13
Brought to you by:
rip,
thiagocorrea
From: Richard M. <dr...@us...> - 2004-07-13 20:25:36
|
Update of /cvsroot/wpdev/xmlscripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3414 Modified Files: door.py Log Message: Improved door blocking check speed. Made it so players can not close on others if the path is blocked. Index: door.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/door.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** door.py 9 Jul 2004 21:47:45 -0000 1.12 --- door.py 13 Jul 2004 20:25:24 -0000 1.13 *************** *** 255,274 **** # char.message( 'You refresh the house' ) ! return 1 # Return to the original state elif door[1] == item.id: ! # Change the door id and update the clients around it ! item.id = door[0] ! item.moveto( pos.x - door[2], pos.y - door[3], pos.z ) ! if item.hastag('opened'): ! item.deltag( 'opened' ) ! item.update() ! # Soundeffect (close) ! char.soundeffect( door[5] ) ! return 1 ! return 0 def autoclose( item, args ): --- 255,294 ---- # char.message( 'You refresh the house' ) ! return True # Return to the original state elif door[1] == item.id: ! blocked = 0 ! chars = None ! chars = wolfpack.chars( item.pos.x - door[2], item.pos.y - door[3], item.pos.map, 0 ) ! if chars: ! for bchar in chars: ! if bchar.pos.z == item.pos.z: ! blocked = 1 ! break ! elif bchar.pos.z < item.pos.z and bchar.pos.z >= ( item.pos.z - 5): ! blocked = 1 ! break ! elif bchar.pos.z > item.pos.z and bchar.pos.z <= ( item.pos.z + 5): ! blocked = 1 ! break ! if blocked == 1: ! char.socket.sysmessage( "There is someone blocking the door!" ) ! return False ! else: ! pos = item.pos ! # Change the door id and update the clients around it ! item.id = door[0] ! item.moveto( pos.x - door[2], pos.y - door[3], pos.z ) ! if item.hastag('opened'): ! item.deltag( 'opened' ) ! item.update() ! # Soundeffect (close) ! char.soundeffect( door[5] ) ! return True ! ! return False def autoclose( item, args ): *************** *** 293,303 **** if door[1] == item.id: chars = wolfpack.chars( item.pos.x - door[2], item.pos.y - door[3], item.pos.map, 0 ) ! for char in chars: ! if char.pos.z == item.pos.z: blocked = 1 ! elif char.pos.z < item.pos.z and char.pos.z >= ( item.pos.z - 5): blocked = 1 ! elif char.pos.z > item.pos.z and char.pos.z <= ( item.pos.z + 5): blocked = 1 if blocked == 1: --- 313,326 ---- if door[1] == item.id: chars = wolfpack.chars( item.pos.x - door[2], item.pos.y - door[3], item.pos.map, 0 ) ! for bchar in chars: ! if bchar.pos.z == item.pos.z: blocked = 1 ! break ! elif bchar.pos.z < item.pos.z and bchar.pos.z >= ( item.pos.z - 5): blocked = 1 ! break ! elif bchar.pos.z > item.pos.z and bchar.pos.z <= ( item.pos.z + 5): blocked = 1 + break if blocked == 1: *************** *** 308,312 **** if door[1] == item.id: pos = item.pos - # Change the door id and update the clients around it item.id = door[0] --- 331,334 ---- |