From feeb57934db7ab72a23dcf1afe03393beb6c603a Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 16 Nov 2019 17:28:39 -0500 Subject: [PATCH] Allow writing to unit.loc on off-map units --- src/scripting/lua_unit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scripting/lua_unit.cpp b/src/scripting/lua_unit.cpp index ca2f0038b3d5..592fe7db0b3f 100644 --- a/src/scripting/lua_unit.cpp +++ b/src/scripting/lua_unit.cpp @@ -488,6 +488,11 @@ static int impl_unit_set(lua_State *L) modify_int_attrib("x", loc.set_wml_x(value); u.set_location(loc)); modify_int_attrib("y", loc.set_wml_y(value); u.set_location(loc)); modify_string_attrib("id", u.set_id(value)); + if(strcmp(m, "loc") == 0) { + luaW_tolocation(L, 3, loc); + u.set_location(loc); + return 0; + } } else { const bool is_key_x = strcmp(m, "x") == 0; const bool is_key_y = strcmp(m, "y") == 0;