Update of /cvsroot/wpdev/xmlscripts/scripts/commands
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4583/commands
Modified Files:
addtree.py
Log Message:
socket tags prevent the same tree from placing twice, a lot more random.
Index: addtree.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** addtree.py 14 Aug 2004 06:29:36 -0000 1.9
--- addtree.py 14 Aug 2004 08:07:50 -0000 1.10
***************
*** 29,33 ****
jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ]
! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01', 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8']
trees = \
--- 29,36 ----
jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ]
! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01','d94','d98','d9c','da0','da4','da8']
! forestlist = ['ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6']
! swamplist = ['cf8','cfe','d01']
! fruitlist = ['d94', 'd98', 'd9c', 'da0', 'da4', 'da8']
trees = \
***************
*** 247,251 ****
item = str( arguments.strip() )
if item == 'forest':
! item = treeindex[ random.randint(0, 12) ]
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
--- 250,264 ----
item = str( arguments.strip() )
if item == 'forest':
! if socket.hastag( 'last_foresttree' ):
! templist = []
! for choice in forestlist:
! if choice != str( socket.gettag( 'last_foresttree' ) ):
! templist += [ choice ]
! item = random.choice( templist )
! socket.settag( 'last_foresttree', str( item ) )
! else:
! item = random.choice( forestlist )
! socket.settag( 'last_foresttree', str( item ) )
!
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
***************
*** 254,258 ****
return
elif item == 'fruit':
! item = treeindex[ random.randint( 16, 21 ) ]
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
--- 267,271 ----
return
elif item == 'fruit':
! item = random.choice( fruitlist )
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
***************
*** 261,265 ****
return
elif item == 'swamp':
! item = treeindex[ random.randint(13, 15) ]
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
--- 274,278 ----
return
elif item == 'swamp':
! item = random.choice( swamplist )
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
***************
*** 268,272 ****
return
elif item == 'random':
! item = random.choice( treeindex )
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
--- 281,295 ----
return
elif item == 'random':
! if socket.hastag( 'last_randomtree' ):
! templist = []
! for choice in treeindex:
! if choice != str( socket.gettag( 'last_randomtree' ) ):
! templist += [ choice ]
! item = random.choice( templist )
! socket.settag( 'last_randomtree', str( item ) )
! else:
! item = random.choice( treeindex )
! socket.settag( 'last_randomtree', str( item ) )
!
if item in trees:
if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ):
|