summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2026-03-04 15:08:11 -0800
committerGitHub <noreply@github.com>2026-03-04 15:08:11 -0800
commitccc10aeda7a3db0fd53cb249b24d22049bae1b94 (patch)
tree0e8c853be11efac8a3ab9f7155ba32238b3635fd /indra/newview/llviewerobject.cpp
parent2d77fdc672f52f36e511af52ae5b1f678799171d (diff)
parent0c289bf27dcc40b9f41152b60408fa047ccf6f65 (diff)
Merge pull request #5383 from secondlife/rider/default_script
Rider/default script
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 0f4cbdd25c..d280f74fc7 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2762,10 +2762,15 @@ void LLViewerObject::doUpdateInventory(
// save a script, which involves removing the old one, and rezzing
// in the new one. This method should be called with the asset id
// of the new and old script AFTER the bytecode has been saved.
-void LLViewerObject::saveScript(
- const LLViewerInventoryItem* item,
- bool active,
- bool is_new)
+// When creating a new script, the asset should be null. The server
+// will create the new script based on the script_language (LSL or Lua)
+// If a template_id is provided, the new script will be a copy of that item.
+//
+// *IMPORTANT* If template_id is provided, it must be the ITEM ID of a
+// copy/mod-able script in the user's inventory. The simulator will verify
+// permissions.
+void LLViewerObject::saveScript(const LLViewerInventoryItem* item,
+ bool active, bool is_new, const LLUUID& template_id)
{
/*
* XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the
@@ -2794,6 +2799,15 @@ void LLViewerObject::saveScript(
msg->addBOOLFast(_PREHASH_Enabled, enabled);
msg->nextBlockFast(_PREHASH_InventoryBlock);
task_item->packMessage(msg);
+
+ // This is a completely new script (no asset id) and we've provided a template.
+ // Note that the script subtype on the template will override any subtype on the item.
+ if (task_item->getAssetUUID().isNull() && template_id.notNull())
+ {
+ msg->nextBlock("NewScriptInfo");
+ msg->addUUID("TemplateID", template_id);
+ }
+
msg->sendReliable(mRegionp->getHost());
// do the internal logic