From ab022c09aee8a924938c03e47c252d660a43f70b Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 8 Sep 2024 00:53:36 -0400 Subject: [PATCH] Lua API: Add unit:rebuild Fixes #9314 --- data/lua/core/units.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/lua/core/units.lua b/data/lua/core/units.lua index 8209ccf208e..a5d90f7d3c8 100644 --- a/data/lua/core/units.lua +++ b/data/lua/core/units.lua @@ -20,6 +20,12 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then end end + ---Force a unit to be rebuilt, reverting its stats to the base unit_type plus any modifications. + ---@param unit unit The unit to rebuild + function wesnoth.units.rebuild(unit) + unit:transform(unit.type) + end + ---Find an attack on the unit that matches a filter ---@param unit unit The unit to search ---@param filter WML The filter to match