Test for MoveTo().
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@18353 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
be98bd0c32
commit
e91860091d
|
@ -5,6 +5,7 @@ width 5
|
|||
height 5
|
||||
msg
|
||||
Created: 2005-07-15
|
||||
Modified: 2012-07-08 Nicolas Weeger
|
||||
endmsg
|
||||
end
|
||||
arch cobblestones2
|
||||
|
@ -36,6 +37,10 @@ arch cobblestones2
|
|||
x 1
|
||||
y 3
|
||||
end
|
||||
arch awall_0
|
||||
x 1
|
||||
y 3
|
||||
end
|
||||
arch cobblestones2
|
||||
x 1
|
||||
y 4
|
||||
|
@ -73,6 +78,10 @@ arch event_timer
|
|||
title Python
|
||||
slaying /test/python_timer.py
|
||||
end
|
||||
arch event_time
|
||||
title Python
|
||||
slaying /test/python.py
|
||||
end
|
||||
end
|
||||
arch cobblestones2
|
||||
x 2
|
||||
|
|
|
@ -42,6 +42,7 @@ def do_help():
|
|||
help += ' - hook\n'
|
||||
help += ' - checkinventory\n'
|
||||
help += ' - nosave\n'
|
||||
help += ' - move_to\n'
|
||||
|
||||
whoami.Say(help)
|
||||
|
||||
|
@ -420,6 +421,18 @@ def do_no_save():
|
|||
item.NoSave = 1
|
||||
whoami.Say('no_save set, the food should not be saved')
|
||||
|
||||
def do_move_to():
|
||||
if whoami.X == 2 and whoami.Y == 2:
|
||||
whoami.WriteKey('dest_x', '0', 1)
|
||||
whoami.WriteKey('dest_y', '4', 1)
|
||||
else:
|
||||
whoami.WriteKey('dest_x', '2', 1)
|
||||
whoami.WriteKey('dest_y', '2', 1)
|
||||
|
||||
def handle_say():
|
||||
if whoami.ReadKey('dest_x') != '' or whoami.ReadKey('dest_y') != '':
|
||||
return
|
||||
|
||||
topic = Crossfire.WhatIsMessage().split()
|
||||
#whoami.Say('topic = %s'%topic)
|
||||
#whoami.Say('topic[0] = %s'%topic[0])
|
||||
|
@ -493,5 +506,28 @@ elif topic[0] == 'checkinventory':
|
|||
do_check_inventory()
|
||||
elif topic[0] == 'nosave':
|
||||
do_no_save()
|
||||
elif topic[0] == 'move_to':
|
||||
do_move_to()
|
||||
else:
|
||||
do_help()
|
||||
|
||||
def handle_time():
|
||||
x = whoami.ReadKey('dest_x')
|
||||
y = whoami.ReadKey('dest_y')
|
||||
if x == '' or y == '':
|
||||
return
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
result = whoami.MoveTo(x, y)
|
||||
if (result == 0):
|
||||
whoami.WriteKey('dest_x', '', 1)
|
||||
whoami.WriteKey('dest_y', '', 1)
|
||||
whoami.Say("I'm there")
|
||||
elif (result == 2):
|
||||
whoami.Say('blocked...')
|
||||
|
||||
event = Crossfire.WhatIsEvent()
|
||||
if event.Subtype == Crossfire.EventType.SAY:
|
||||
handle_say()
|
||||
elif event.Subtype == Crossfire.EventType.TIME:
|
||||
handle_time()
|
||||
|
|
Loading…
Reference in New Issue