summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinventory.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2025-03-17 18:56:07 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2025-03-17 19:19:14 +0200
commitfe5d7d41335ca22c8078ddaeb9fe40e6b0d57b6d (patch)
tree27d59622a17022e55ec2fb50430b0e997e8d315a /indra/newview/llviewerinventory.cpp
parenta0e8b5ffc7cea8ce73a4e6a594eef9e87714972d (diff)
#3731 Follow-up: Use SLua defaults only on SLua-enabled regions (#3753)
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rw-r--r--indra/newview/llviewerinventory.cpp52
1 files changed, 31 insertions, 21 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 7c0143623b..0066d662a3 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1024,29 +1024,39 @@ void create_script_cb(const LLUUID& inv_item)
// This temporary workaround should be removed after a server-side fix.
// See https://github.com/secondlife/viewer/issues/3731 for more information.
//
- const std::string hello_lua_script =
- "function state_entry()\n"
- " ll.Say(0, \"Hello, Avatar!\")\n"
- "end\n"
- "\n"
- "function touch_start(total_number)\n"
- " ll.Say(0, \"Touched.\")\n"
- "end\n"
- "\n"
- "-- Simulate the state_entry event\n"
- "state_entry()\n";
-
- std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
- if (!url.empty())
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region && region->simulatorFeaturesReceived())
{
- LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(
- item->getUUID(),
- "luau",
- hello_lua_script,
- nullptr,
- nullptr));
+ LLSD simulatorFeatures;
+ region->getSimulatorFeatures(simulatorFeatures);
+ if (simulatorFeatures["LuaScriptsEnabled"].asBoolean())
+ {
+
+ const std::string hello_lua_script =
+ "function state_entry()\n"
+ " ll.Say(0, \"Hello, Avatar!\")\n"
+ "end\n"
+ "\n"
+ "function touch_start(total_number)\n"
+ " ll.Say(0, \"Touched.\")\n"
+ "end\n"
+ "\n"
+ "-- Simulate the state_entry event\n"
+ "state_entry()\n";
- LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
+ std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
+ if (!url.empty())
+ {
+ LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLScriptAssetUpload>(
+ item->getUUID(),
+ "luau",
+ hello_lua_script,
+ nullptr,
+ nullptr));
+
+ LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
+ }
+ }
}
//
// End hack