Using the new Crossfire.AttackMovement.PETMOVE constants.
Reduce the affected area to the surrounding 10x10 square. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@18831 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
e6249ddf84
commit
5eb73d7cbf
|
@ -10,9 +10,7 @@ def tame_angry_pets():
|
||||||
Others also have the wrong value for attack_movement which should be PETMOVE for pets.
|
Others also have the wrong value for attack_movement which should be PETMOVE for pets.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#Didn't find a way to access this constant from the Crossfire library. Is there?
|
PETMOVE = Crossfire.AttackMovement.PETMOVE
|
||||||
PETMOVE = 16
|
|
||||||
|
|
||||||
player = Crossfire.WhoIsActivator()
|
player = Crossfire.WhoIsActivator()
|
||||||
if player.Type != Crossfire.Type.PLAYER:
|
if player.Type != Crossfire.Type.PLAYER:
|
||||||
return
|
return
|
||||||
|
@ -24,8 +22,12 @@ def tame_angry_pets():
|
||||||
#those pets who are *not* in that list. So check for the monsters in the same map
|
#those pets who are *not* in that list. So check for the monsters in the same map
|
||||||
#as the player, owned by it, and yet not friendly.
|
#as the player, owned by it, and yet not friendly.
|
||||||
#Is there a better way than checking all _items_ in the map?
|
#Is there a better way than checking all _items_ in the map?
|
||||||
for w in range(player.Map.Width):
|
for w in range(player.X-5, player.X+5):
|
||||||
for h in range(player.Map.Height):
|
if w<1 or w>range(player.Map.Width):
|
||||||
|
continue
|
||||||
|
for h in range(player.Y-5, player.Y+5):
|
||||||
|
if h<1 or h>range(player.Map.Height):
|
||||||
|
continue
|
||||||
obj = player.Map.ObjectAt(w,h)
|
obj = player.Map.ObjectAt(w,h)
|
||||||
while obj != None:
|
while obj != None:
|
||||||
if obj.Monster and obj.Owner == player and not obj.Friendly: #angry pet
|
if obj.Monster and obj.Owner == player and not obj.Friendly: #angry pet
|
||||||
|
|
Loading…
Reference in New Issue