All MAIs: add optional existing_engine parameter to engine init function
This lets us add the Micro AI candidate actions to an already existing Lua AI engine and thus combine several MAIs.
This commit is contained in:
parent
3e5e317954
commit
e6f69ae056
10 changed files with 20 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
local engine = {}
|
||||
init = function(ai, existing_engine)
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local W = H.set_wml_action_metatable {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local W = H.set_wml_action_metatable {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local W = H.set_wml_action_metatable {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local LS = wesnoth.require "lua/location_set.lua"
|
||||
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
-- Moves a messenger toward goal coordinates while protecting him and
|
||||
-- clearing his way with other units, if necessary
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local AH = wesnoth.require "ai/lua/ai_helper.lua"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
|
||||
local H = wesnoth.require "lua/helper.lua"
|
||||
local W = H.set_wml_action_metatable {}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
return {
|
||||
init = function(ai)
|
||||
init = function(ai, existing_engine)
|
||||
|
||||
local AH = wesnoth.require("ai/lua/ai_helper.lua")
|
||||
|
||||
local engine = {}
|
||||
local engine = existing_engine or {}
|
||||
local internal_recruit_cas = {}
|
||||
local internal_params = {}
|
||||
-- The following external engine creates the CA functions recruit_rushers_eval and recruit_rushers_exec
|
||||
|
|
Loading…
Add table
Reference in a new issue