Add AI_CONTROLLER_ALLOW_UNIT_CONTROL macro

... to allow control of non-leader units of allied AI sides.
This commit is contained in:
mattsc 2013-10-04 08:08:23 -07:00
parent 0ef41090c0
commit 51e1a3f56b

View file

@ -1,5 +1,58 @@
#textdomain wesnoth
#define AI_CONTROLLER_ALLOW_UNIT_CONTROL CONTROLLER_SIDE UNIT_ID
[store_unit]
[filter]
id={UNIT_ID}
[/filter]
kill=no
variable=ai_controller_unit
[/store_unit]
[if]
[variable]
name=ai_controller_unit.length
greater_than=0
[/variable]
[then]
[set_menu_item]
id="ai_controller_unit_control_{UNIT_ID}"
description= _ "Ask $ai_controller_unit.name to move here"
[show_if]
side={CONTROLLER_SIDE}
[have_unit]
id={UNIT_ID}
[/have_unit]
[/show_if]
[command]
[modify_unit]
[filter]
id={UNIT_ID}
[/filter]
goto_x,goto_y=$x1,$y1
[/modify_unit]
[/command]
[/set_menu_item]
[/then]
[/if]
[event]
name=victory #TODO: any scenario change
[set_menu_item]
id="ai_controller_unit_control_{UNIT_ID}"
[show_if]
[not]
[/not]
[/show_if]
[/set_menu_item]
[/event]
{CLEAR_VARIABLE ai_controller_unit}
#enddef
#define AI_CONTROLLER_ALLOW_LEADER_CONTROL CONTROLLER_SIDE CONTROLLED_SIDE
[store_unit]