strip trailing whitespace
This commit is contained in:
parent
9a12e95c41
commit
7ce40d876b
1 changed files with 11 additions and 11 deletions
|
@ -841,42 +841,42 @@ function wml_actions.store_side(cfg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function wml_actions.add_ai_behavior(cfg)
|
function wml_actions.add_ai_behavior(cfg)
|
||||||
local unit = wesnoth.get_units(helper.get_child(cfg, "filter"))[1]
|
local unit = wesnoth.get_units(helper.get_child(cfg, "filter"))[1]
|
||||||
|
|
||||||
if not unit then
|
if not unit then
|
||||||
helper.wml_error("[add_ai_behavior]: no unit specified")
|
helper.wml_error("[add_ai_behavior]: no unit specified")
|
||||||
end
|
end
|
||||||
|
|
||||||
local side = cfg.side
|
local side = cfg.side
|
||||||
local sticky = cfg.sticky or false
|
local sticky = cfg.sticky or false
|
||||||
local loop_id = cfg.loop_id or "main_loop"
|
local loop_id = cfg.loop_id or "main_loop"
|
||||||
local eval = cfg.evaluation
|
local eval = cfg.evaluation
|
||||||
local exec = cfg.execution
|
local exec = cfg.execution
|
||||||
|
|
||||||
local ux = unit.x -- @note: did I get it right that coordinates in C++ differ by 1 from thos in-game(and in Lua)?
|
local ux = unit.x -- @note: did I get it right that coordinates in C++ differ by 1 from thos in-game(and in Lua)?
|
||||||
local uy = unit.y
|
local uy = unit.y
|
||||||
|
|
||||||
if not side then
|
if not side then
|
||||||
helper.wml_error("[add_ai_behavior]: no side attribute given")
|
helper.wml_error("[add_ai_behavior]: no side attribute given")
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (eval and exec) then
|
if not (eval and exec) then
|
||||||
helper.wml_error("[add_ai_behavior]: invalid execution/evaluation handler(s)")
|
helper.wml_error("[add_ai_behavior]: invalid execution/evaluation handler(s)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = "bca-" .. ca_counter
|
local id = "bca-" .. ca_counter
|
||||||
local path = "stage[" .. loop_id .. "].candidate_action[" .. id .. "]" -- bca: behavior candidate action
|
local path = "stage[" .. loop_id .. "].candidate_action[" .. id .. "]" -- bca: behavior candidate action
|
||||||
|
|
||||||
ca_counter = ca_counter + 1
|
ca_counter = ca_counter + 1
|
||||||
|
|
||||||
local conf = {
|
local conf = {
|
||||||
["action"] = "add",
|
["action"] = "add",
|
||||||
["engine"] = "lua",
|
["engine"] = "lua",
|
||||||
["id"] = id,
|
["id"] = id,
|
||||||
["name"] = id,
|
["name"] = id,
|
||||||
["path"] = path,
|
["path"] = path,
|
||||||
|
|
||||||
{"candidate_action", {
|
{"candidate_action", {
|
||||||
["id"] = id,
|
["id"] = id,
|
||||||
["name"] = id,
|
["name"] = id,
|
||||||
|
@ -888,7 +888,7 @@ function wml_actions.add_ai_behavior(cfg)
|
||||||
["evaluation"] = eval,
|
["evaluation"] = eval,
|
||||||
["execution"] = exec
|
["execution"] = exec
|
||||||
}},
|
}},
|
||||||
|
|
||||||
["side"] = side
|
["side"] = side
|
||||||
}
|
}
|
||||||
wesnoth.wml_actions.modify_ai(conf)
|
wesnoth.wml_actions.modify_ai(conf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue