Guardian MAIs: rename internal engine functions and CAs

This shouldn't affect anything else, it is simply done for consistency
(to reflect the recent syntax changes).
This commit is contained in:
mattsc 2013-10-22 12:51:52 -07:00
parent ca1c99160a
commit e57d0945f0
5 changed files with 12 additions and 12 deletions

View file

@ -6,7 +6,7 @@ return {
local H = wesnoth.require "lua/helper.lua"
local AH = wesnoth.require "ai/lua/ai_helper.lua"
function engine:mai_guardian_coward_eval(cfg)
function engine:mai_coward_eval(cfg)
local unit = wesnoth.get_units{ id = cfg.id }[1]
-- Check if unit exists as sticky BCAs are not always removed successfully
@ -15,7 +15,7 @@ return {
end
-- cfg parameters: id, distance, seek_x, seek_y, avoid_x, avoid_y
function engine:mai_guardian_coward_exec(cfg)
function engine:mai_coward_exec(cfg)
--print("Coward exec " .. cfg.id)
local unit = wesnoth.get_units{ id = cfg.id }[1]
local reach = wesnoth.find_reach(unit)

View file

@ -5,7 +5,7 @@ return {
local AH = wesnoth.require "ai/lua/ai_helper.lua"
function engine:mai_guardian_return_eval(cfg)
function engine:mai_return_guardian_eval(cfg)
local unit = wesnoth.get_units { id = cfg.id }[1]
-- Check if unit exists as sticky BCAs are not always removed successfully
@ -19,7 +19,7 @@ return {
return 0
end
function engine:mai_guardian_return_exec(cfg)
function engine:mai_return_guardian_exec(cfg)
local unit = wesnoth.get_units { id = cfg.id }[1]
--print("Exec guardian move",unit.id)

View file

@ -6,7 +6,7 @@ return {
local H = wesnoth.require "lua/helper.lua"
local AH = wesnoth.require "ai/lua/ai_helper.lua"
function engine:mai_guardian_stationed_eval(cfg)
function engine:mai_stationed_guardian_eval(cfg)
local unit = wesnoth.get_units { id = cfg.id }[1]
-- Check if unit exists as sticky BCAs are not always removed successfully
@ -15,7 +15,7 @@ return {
end
-- cfg parameters: id, distance, s_x, s_y, g_x, g_y
function engine:mai_guardian_stationed_exec(cfg)
function engine:mai_stationed_guardian_exec(cfg)
-- (s_x,s_y): coordinates where unit is stationed; tries to move here if there is nobody to attack
-- (g_x,g_y): location that the unit guards

View file

@ -14,7 +14,7 @@ return {
-- it "detects" an enemy in filter_location_enemy (if specified) or in the filter_location (otherwise).
-- It then attacks this enemy until it goes out of the "attack zone"
function engine:mai_guardian_zone_eval(cfg)
function engine:mai_zone_guardian_eval(cfg)
local unit = wesnoth.get_units { id = cfg.id }[1]
-- Check if unit exists as sticky BCAs are not always removed successfully
@ -23,7 +23,7 @@ return {
end
--Check if an enemy is detected in filter_location_enemy (or filter_location) and attack it or start the "move" randomly function
function engine:mai_guardian_zone_exec(cfg)
function engine:mai_zone_guardian_exec(cfg)
local unit = wesnoth.get_units { id = cfg.id }[1]
local reach = wesnoth.find_reach(unit)
local zone_enemy = cfg.filter_location_enemy or cfg.filter_location

View file

@ -300,7 +300,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
H.wml_error("[micro_ai] tag (stationed_guardian) is missing required parameter: id")
end
required_keys = { "id", "distance", "station_x", "station_y", "guard_x", "guard_y" }
CA_parms = { { ca_id = 'mai_guardian_stationed', score = cfg.ca_score or 300000, sticky = true } }
CA_parms = { { ca_id = 'mai_stationed_guardian', score = cfg.ca_score or 300000, sticky = true } }
elseif (cfg.ai_type == 'zone_guardian') then
-- id= key is required also for CA deletion; needs to be checked separately
@ -309,7 +309,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
end
required_keys = { "id", "filter_location" }
optional_keys = { "filter_location_enemy", "station_x", "station_y" }
CA_parms = { { ca_id = 'mai_guardian_zone', score = cfg.ca_score or 300000, sticky = true } }
CA_parms = { { ca_id = 'mai_zone_guardian', score = cfg.ca_score or 300000, sticky = true } }
elseif (cfg.ai_type == 'return_guardian') then
-- id= key is required also for CA deletion; needs to be checked separately
@ -317,7 +317,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
H.wml_error("[micro_ai] tag (return_guardian) is missing required parameter: id")
end
required_keys = { "id", "return_x", "return_y" }
CA_parms = { { ca_id = 'mai_guardian_return', score = cfg.ca_score or 100010, sticky = true } }
CA_parms = { { ca_id = 'mai_return_guardian', score = cfg.ca_score or 100010, sticky = true } }
elseif (cfg.ai_type == 'coward') then
-- id= key is required also for CA deletion; needs to be checked separately
@ -326,7 +326,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
end
required_keys = { "id", "distance" }
optional_keys = { "seek_x", "seek_y","avoid_x","avoid_y" }
CA_parms = { { ca_id = 'mai_guardian_coward', score = cfg.ca_score or 300000, sticky = true } }
CA_parms = { { ca_id = 'mai_coward', score = cfg.ca_score or 300000, sticky = true } }
--------- Micro AI Animals - side-wide and BCA AIs ------------------------------------
elseif (cfg.ai_type == 'big_animals') then