diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-04-01 19:50:33 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-04-01 19:50:33 +0300 |
| commit | f5908eddc683dd705d334c88377139e39bbfb54f (patch) | |
| tree | 75c0ff026fe13c0a507a4527b697aa212736998d /indra/newview/llviewerobject.cpp | |
| parent | d045f9aa32789a35628aced166145c182751acbf (diff) | |
| parent | f209affdfdf271098843ba400d7a75b00f827233 (diff) | |
Merge branch 'project/lua_editor' into marchcat/devlinux-slua
# Conflicts:
# indra/llcommon/llstl.h
# indra/newview/app_settings/settings.xml
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index dfb0521167..12583e81da 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2765,10 +2765,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 @@ -2797,6 +2802,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 |
