From 0e6155c529b1cc710025b2cc8a138516eb987068 Mon Sep 17 00:00:00 2001 From: Tobias Tribble Date: Thu, 8 Jun 2023 23:50:54 -0500 Subject: [PATCH] Added delayed action --- apps/openmw/mwlua/objectbindings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwlua/objectbindings.cpp b/apps/openmw/mwlua/objectbindings.cpp index ab7f967af7..abe78219b9 100644 --- a/apps/openmw/mwlua/objectbindings.cpp +++ b/apps/openmw/mwlua/objectbindings.cpp @@ -280,8 +280,9 @@ namespace MWLua if constexpr (std::is_same_v) { // Only for global scripts - objectT["setScale"] = [](const GObject& object, float scale) { - MWBase::Environment::get().getWorld()->scaleObject(object.ptr(), scale); + objectT["setScale"] = [context](const GObject& object, float scale) { + context.mLuaManager->addAction( + [object, scale] { MWBase::Environment::get().getWorld()->scaleObject(object.ptr(), scale); }); }; objectT["addScript"] = [context](const GObject& object, std::string_view path, sol::object initData) { const LuaUtil::ScriptsConfiguration& cfg = context.mLua->getConfiguration();