diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 21 |
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 |
