Skip to content

Commit

Permalink
Add a few more attributes to the [modify_unit] optimized path
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Nov 16, 2019
1 parent 2cc7fe6 commit 1f36590
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -49,6 +49,7 @@
* New wesnoth.units.find gets units on either the map or any side's recall list.
* Moved to interface module: wesnoth.scroll, wesnoth.zoom, wesnoth.get_mouseover_tile
* wesnoth.interface.get_displayed_unit aliased to wesnoth.unit.get_hovered
* unit portrait is now writable
### WML engine
* Support upkeep in StandardUnitFilter
* [effect]apply_to=variation now supports heal_full
Expand Down
10 changes: 10 additions & 0 deletions data/lua/wml/modify_unit.lua
Expand Up @@ -53,6 +53,10 @@ local known_attributes = make_set {
"description",
"hidden",
"unrenamable",
"profile",
"zoc",
"usage",
"upkeep",
}

local known_tags = make_set {
Expand Down Expand Up @@ -105,6 +109,9 @@ local function simple_modify_unit(cfg)
"max_experience",
"resting",
"canrecruit",
"zoc",
"usage",
"upkeep",
}

local function handle_unit(u)
Expand All @@ -121,6 +128,9 @@ local function simple_modify_unit(cfg)
if cfg.ai_special == "guardian" then
u.status.guardian = true
end
if cfg.profile ~= nil then
u.portrait = profile
end
if cfg.unrenamable ~= nil then
u.renamable = not cfg.unrenamable
end
Expand Down
1 change: 1 addition & 0 deletions src/scripting/lua_unit.cpp
Expand Up @@ -440,6 +440,7 @@ static int impl_unit_set(lua_State *L)
modify_bool_attrib("resting", u.set_resting(value));
modify_tstring_attrib("name", u.set_name(value));
modify_tstring_attrib("description", u.set_unit_description(value));
modify_string_attrib("portrait", u.set_big_profile(value));
modify_string_attrib("role", u.set_role(value));
modify_string_attrib("facing", u.set_facing(map_location::parse_direction(value)));
modify_string_attrib("usage", u.set_usage(value));
Expand Down

0 comments on commit 1f36590

Please sign in to comment.