Minor cosmetic fixes
This commit is contained in:
parent
3935c0523b
commit
ba69be6682
2 changed files with 16 additions and 45 deletions
|
@ -273,9 +273,7 @@ Gs^Fp , Gs^Fp , Wwf , Wwf , Mm , Rd
|
|||
code= <<
|
||||
--! ==============================================================
|
||||
ai = ...
|
||||
for k,v in pairs(ai) do
|
||||
wesnoth.message("*" .. k .. " " ..tostring(v))
|
||||
end
|
||||
|
||||
local my_ai = { }
|
||||
|
||||
|
||||
|
@ -308,40 +306,12 @@ function my_ai:candidate_action_execution_hello2()
|
|||
self:do_moves()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--my_ai.patrol_exec = my_ai:patrol_gen(ai, "Rark", {{x=14, y=7}, {x=15, y=7}, {x=15, y=8}, {x=14, y=8}})
|
||||
|
||||
--wesnoth.modify_ai({side=2, action="delete", path="stage[ca_loop].candidate_action[firstca]"})
|
||||
|
||||
function my_ai:do_moves()
|
||||
--wesnoth.message('Passive leader: ', tostring(ai.get_passive_leader()))
|
||||
--wesnoth.message('Passive leader shares keep: ', tostring(ai.get_passive_leader_shares_keep()))
|
||||
--wesnoth.message('Simple targeting: ', tostring(ai.get_simple_targeting()))
|
||||
--wesnoth.message('Scout village targ.: ' , ai.get_scout_village_targeting())
|
||||
--wesnoth.message('Recruit. ignore bc: ' , tostring(ai.get_recruitment_ignore_bad_combat()))
|
||||
--wesnoth.message('Recruit. ignore bm: ' , tostring(ai.get_recruitment_ignore_bad_movement()))
|
||||
--wesnoth.message('nofprtfr: ' , ai.get_number_of_possible_recruits_to_force_recruit())
|
||||
--wesnoth.message('Grouping: ' .. ai.get_grouping())
|
||||
--wesnoth.message('Support villages: ' .. tostring(ai.get_support_villages()))
|
||||
--wesnoth.message('Village value: ' .. ai.get_village_value())
|
||||
--wesnoth.message('Villages per scout: ' .. ai.get_villages_per_scout())
|
||||
--local rp = ai.get_recruitment_pattern() -- rp is used like a simple array
|
||||
--wesnoth.message('pattern'.. rp[1] .. rp[2])
|
||||
--wesnoth.message('TOOD: ' .. wesnoth.get_time_of_day().id)
|
||||
--wesnoth.message('Leader goal' .. ai.get_leader_goal().x .. ' ' .. ai.get_leader_goal().y) -- fixed
|
||||
--wesnoth.message('Avoid ex. ' .. #ai.get_avoid() .. ' ' ..ai.get_avoid()[1]["x"] .. " " .. ai.get_avoid()[1]["y"]) -- fixed?
|
||||
--we wesnoth.message('DSTSRC fun: ' .. #ai.get_dstsrc())
|
||||
--for k,v in pairs(ai.get_enemy_dstsrc()) do
|
||||
--- for i,l in ipairs(v) do
|
||||
-- wesnoth.message("->" .. l.x .. " " .. l.y)
|
||||
-- end
|
||||
--end
|
||||
wesnoth.modify_ai({side=2, action="delete", path="stage[ca_loop].candidate_action[firstca]"})
|
||||
|
||||
my_leader = wesnoth.get_units({side = 1, can_recruit=yes})[1].name
|
||||
|
||||
--wesnoth.wml_actions.label({ text = "suitable_keep", x = x, y = y })
|
||||
--! move (partial move)
|
||||
--wesnoth.message("=>" .. my_leader)
|
||||
|
||||
--! full move. note that the my_leader still can be used altrough x and y are now different.
|
||||
--ai.move_full(my_leader, 11, 23)
|
||||
|
|
|
@ -3159,6 +3159,19 @@ static int intf_get_image_size(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lua frontend to the modify_ai functionality
|
||||
* - Arg 1: config.
|
||||
*/
|
||||
static int intf_modify_ai(lua_State *L)
|
||||
{
|
||||
config cfg;
|
||||
luaW_toconfig(L, 1, cfg);
|
||||
int side = cfg["side"];
|
||||
ai::manager::modify_active_ai_for_side(side, cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct lua_report_generator : reports::generator
|
||||
{
|
||||
lua_State *mState;
|
||||
|
@ -3218,18 +3231,6 @@ static int impl_theme_items_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lua frontend to the modify_ai functionality
|
||||
*/
|
||||
static int intf_modify_ai(lua_State *L)
|
||||
{
|
||||
config cfg;
|
||||
luaW_toconfig(L, -1, cfg);
|
||||
ERR_LUA << cfg.debug() << std::endl;
|
||||
int side = cfg["side"];
|
||||
ai::manager::modify_active_ai_for_side(side, cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LuaKernel::LuaKernel(const config &cfg)
|
||||
: mState(luaL_newstate()), level_(cfg)
|
||||
|
|
Loading…
Add table
Reference in a new issue