Improved MOVE_UNIT to change the facing of the moved unit too,

and added a new LOYAL_UNIT macro (to obsolete UNIT, which is IMO
poorly named).
This commit is contained in:
Lari Nieminen 2007-08-10 12:55:30 +00:00
parent d040e7b740
commit 3316f43d01

View file

@ -306,6 +306,30 @@
{VARIABLE_OP MOVE_UNIT_path_coords_x format ("$MOVE_UNIT_temp.x|,{TO_X}")}
{VARIABLE_OP MOVE_UNIT_path_coords_y format ("$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}}
@ -329,9 +353,10 @@
[/unstore_unit]
[redraw][/redraw]
{CLEAR_VARIABLE MOVE_UNIT_temp}
{CLEAR_VARIABLE MOVE_UNIT_path_coords_x}
{CLEAR_VARIABLE MOVE_UNIT_path_coords_y}
{CLEAR_VARIABLE MOVE_UNIT_temp}
{CLEAR_VARIABLE MOVE_UNIT_path_coords_x}
{CLEAR_VARIABLE MOVE_UNIT_path_coords_y}
#enddef
#define PUT_TO_RECALL_LIST FILTER
@ -451,6 +476,26 @@
[/unit]
#enddef
#define LOYAL_UNIT SIDE TYPE X Y DESCRIPTION USER_DESCRIPTION
# Creates a unit with the Loyal trait. Should make the too vaguely named
# UNIT macro above obsolete.
#
# Example:
#! {LOYAL_UNIT 1 19 16 (Elvish Fighter) (Myname) ( _ "Myname")}
#
[unit]
type={TYPE}
description={DESCRIPTION}
user_description={USER_DESCRIPTION}
side={SIDE}
x={X}
y={Y}
[modifications]
{TRAIT_LOYAL}
[/modifications]
[/unit]
#enddef
#define UNDEAD_UNIT TYPE SIDE X Y
# Create a unit with the Undead and Loyal traits.
[unit]