Converted the MOVE_UNIT macro to use the new [move_unit] tag.

This commit is contained in:
Lari Nieminen 2010-08-23 07:44:42 +00:00
parent 21902879b4
commit ccb35966ec

View file

@ -264,79 +264,17 @@
#enddef
#define MOVE_UNIT FILTER TO_X TO_Y
# Moves a unit from its current location to the given location along a
# relatively straight line displaying the movement just like
# [move_unit_fake] does.
# Moves a unit from its current location to the given location, displaying
# movement normally.
#
# Note that setting the destination on an existing unit does not kill either
# one, but causes the unit to move to the nearest vacant hex instead.
[store_unit]
[filter]
{FILTER}
[/filter]
variable=MOVE_UNIT_temp
kill=no
[/store_unit]
[scroll_to]
x=$MOVE_UNIT_temp.x
y=$MOVE_UNIT_temp.y
[/scroll_to]
{VARIABLE_OP MOVE_UNIT_path_coords_x value ("$MOVE_UNIT_temp.x|,{TO_X}")}
{VARIABLE_OP MOVE_UNIT_path_coords_y value ("$MOVE_UNIT_temp.y|,{TO_Y}")}
[if]
[variable]
name=MOVE_UNIT_temp.x
less_than={TO_X}
[/variable]
[then]
{VARIABLE MOVE_UNIT_temp.facing se}
[/then]
[else]
[if]
[variable]
name=MOVE_UNIT_temp.x
greater_than={TO_X}
[/variable]
[then]
{VARIABLE MOVE_UNIT_temp.facing sw}
[/then]
[/if]
[/else]
[/if]
{VARIABLE MOVE_UNIT_temp.x {TO_X}}
{VARIABLE MOVE_UNIT_temp.y {TO_Y}}
[kill]
[move_unit]
{FILTER}
animate=no
to_x={TO_X}
to_y={TO_Y}
fire_event=no
[/kill]
[move_unit_fake]
type=$MOVE_UNIT_temp.type
gender=$MOVE_UNIT_temp.gender
variation=$MOVE_UNIT_temp.variation
side=$MOVE_UNIT_temp.side
x=$MOVE_UNIT_path_coords_x
y=$MOVE_UNIT_path_coords_y
[/move_unit_fake]
[unstore_unit]
variable=MOVE_UNIT_temp
find_vacant=yes
[/unstore_unit]
[redraw][/redraw]
{CLEAR_VARIABLE MOVE_UNIT_temp,MOVE_UNIT_path_coords_x,MOVE_UNIT_path_coords_y}
[/move_unit]
#enddef
#define FULL_HEAL FILTER