mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 00:29:23 +00:00
Moved [capture_village] to lua and added support for SLF.
This commit is contained in:
parent
4a3bdd4972
commit
6ac2bf0f5e
@ -497,3 +497,13 @@ function wml_actions.move_unit(cfg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function wml_actions.capture_village(cfg)
|
||||||
|
local side = cfg.side
|
||||||
|
if side then side = tonumber(side) or helper.wml_error("invalid side in [capture_village]") end
|
||||||
|
local locs = wesnoth.get_locations(cfg)
|
||||||
|
|
||||||
|
for i, loc in ipairs(locs) do
|
||||||
|
wesnoth.set_village_owner(loc[1], loc[2], side)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -2189,17 +2189,6 @@ WML_HANDLER_FUNCTION(store_villages, /*event_info*/, cfg)
|
|||||||
varinfo.vars->append(to_store);
|
varinfo.vars->append(to_store);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command to take control of a village for a certain side
|
|
||||||
WML_HANDLER_FUNCTION(capture_village, /*event_info*/, cfg)
|
|
||||||
{
|
|
||||||
int side_num = cfg["side"].to_int();
|
|
||||||
foreach (const map_location &loc, parse_location_range(cfg["x"], cfg["y"])) {
|
|
||||||
if (resources::game_map->is_village(loc)) {
|
|
||||||
get_village(loc, side_num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WML_HANDLER_FUNCTION(end_turn, /*event_info*/, /*cfg*/)
|
WML_HANDLER_FUNCTION(end_turn, /*event_info*/, /*cfg*/)
|
||||||
{
|
{
|
||||||
resources::controller->force_end_turn();
|
resources::controller->force_end_turn();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user