From 71961301478f8dc5a2030ad03fd50afdd5242665 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 14 Feb 2021 21:11:21 -0500 Subject: [PATCH] Move create_animator and create_weapon into the units module --- data/lua/core/units.lua | 2 ++ src/scripting/game_lua_kernel.cpp | 2 +- src/scripting/lua_unit_attacks.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/lua/core/units.lua b/data/lua/core/units.lua index 6a300ed733597..e4a742e213285 100644 --- a/data/lua/core/units.lua +++ b/data/lua/core/units.lua @@ -70,4 +70,6 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then wesnoth.get_unit = wesnoth.deprecate_api('wesnoth.get_unit', 'wesnoth.units.get', 1, nil, wesnoth.units.get) wesnoth.get_units = wesnoth.deprecate_api('wesnoth.get_units', 'wesnoth.units.find_on_map', 1, nil, wesnoth.units.find_on_map) wesnoth.get_recall_units = wesnoth.deprecate_api('wesnoth.get_units', 'wesnoth.units.find_on_recall', 1, nil, wesnoth.units.find_on_recall) + wesnoth.create_animator = wesnoth.deprecate_api('wesnoth.create_animator', 'wesnoth.units.create_animator', 1, nil, wesnoth.units.create_animator) + wesnoth.create_weapon = wesnoth.deprecate_api('wesnoth.create_weapon', 'wesnoth.units.create_weapon', 1, nil, wesnoth.units.create_weapon) end \ No newline at end of file diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index 742fc2ef26c2e..f4487dbdab490 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -4114,7 +4114,6 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports // Put some callback functions in the scripting environment. static luaL_Reg const callbacks[] { { "add_known_unit", &intf_add_known_unit }, - { "create_animator", &dispatch<&game_lua_kernel::intf_create_animator> }, { "eval_conditional", &intf_eval_conditional }, { "get_era", &intf_get_era }, { "get_resource", &intf_get_resource }, @@ -4278,6 +4277,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports {"find_on_recall", &dispatch<&game_lua_kernel::intf_get_recall_units>}, {"get", &dispatch<&game_lua_kernel::intf_get_unit>}, {"get_hovered", &dispatch<&game_lua_kernel::intf_get_displayed_unit>}, + {"create_animator", &dispatch<&game_lua_kernel::intf_create_animator>}, { nullptr, nullptr } }; lua_getglobal(L, "wesnoth"); diff --git a/src/scripting/lua_unit_attacks.cpp b/src/scripting/lua_unit_attacks.cpp index 782639e1e8625..0491220b2b336 100644 --- a/src/scripting/lua_unit_attacks.cpp +++ b/src/scripting/lua_unit_attacks.cpp @@ -391,7 +391,7 @@ namespace lua_units { lua_setfield(L, -2, "matches"); // Add create_attack - luaW_getglobal(L, "wesnoth"); + luaW_getglobal(L, "wesnoth", "units"); lua_pushcfunction(L, intf_create_attack); lua_setfield(L, -2, "create_weapon"); lua_pop(L, 1);