summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2026-02-06 11:01:23 -0800
committerRider Linden <rider@lindenlab.com>2026-02-06 11:01:23 -0800
commitecdb63651e4d94a8323d22114bb5db09c8078d61 (patch)
tree7d5f0e11e9427ecc5b8a3c4138345c4df6b53dbf /indra/newview/llviewerobject.cpp
parent5a49c9c2ddc7fd15c2333c0b3c85aaeee20ee896 (diff)
Allow viewer to specify what default script it wants to use, either by language ID or by supplying an inventory item as a template.
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 0f4cbdd25c..a07c64f252 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2762,10 +2762,14 @@ 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.
+void LLViewerObject::saveScript(const LLViewerInventoryItem* item,
+ bool active, bool is_new, U8 script_language, const LLUUID& template_id)
{
/*
* XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the
@@ -2794,6 +2798,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)
+ if (task_item->getAssetUUID().isNull())
+ {
+ msg->nextBlock("NewScriptInfo");
+ msg->addU8("Type", script_language);
+ msg->addUUID("TemplateID", template_id);
+ }
+
msg->sendReliable(mRegionp->getHost());
// do the internal logic