Make sure copied inventory items have the intended perms

This commit is contained in:
Casper Warden
2023-11-22 03:48:39 +00:00
parent ad3a8c8e2e
commit 81264e36c5
4 changed files with 66 additions and 73 deletions

View File

@@ -73,6 +73,19 @@ class Inventory extends ExampleBot
// Delete the copy
await copy.delete();
// Let's set some perms
const copyOnly = await exampleNotecard.copyTo(exampleFolder, exampleNotecard.name + ' - Copy Only ' + UUID.random().toString().substring(0, 8));
copyOnly.permissions.nextOwnerMask = PermissionMask.Copy;
await copyOnly.update();
const modOnly = await exampleNotecard.copyTo(exampleFolder, exampleNotecard.name + ' - Mod Only ' + UUID.random().toString().substring(0, 8));
modOnly.permissions.nextOwnerMask = PermissionMask.Modify;
await modOnly.update();
const transOnly = await exampleNotecard.copyTo(exampleFolder, exampleNotecard.name + ' - Trans Only ' + UUID.random().toString().substring(0, 8));
transOnly.permissions.nextOwnerMask = PermissionMask.Transfer;
await transOnly.update();
let exampleScript = exampleFolder.items.find(f => f.name === exampleScriptName);
if (exampleScript === undefined)
{

View File

@@ -846,15 +846,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -869,15 +867,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -893,15 +889,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -916,15 +910,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -939,15 +931,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -962,15 +952,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -986,15 +974,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -1009,15 +995,13 @@ export class RegionCommands extends CommandsBase
if (item !== null)
{
await object.dropInventoryIntoContents(item);
if (invItem.name !== item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === item.name)
{
if (taskItem.name === item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -1032,15 +1016,13 @@ export class RegionCommands extends CommandsBase
if (inventoryItem !== null)
{
await object.dropInventoryIntoContents(inventoryItem);
if (invItem.name !== inventoryItem.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === inventoryItem.name)
{
if (taskItem.name === inventoryItem.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}
@@ -1060,15 +1042,13 @@ export class RegionCommands extends CommandsBase
if (texItem.item !== null)
{
await object.dropInventoryIntoContents(texItem.item);
if (invItem.name !== texItem.item.name)
await object.updateInventory();
for (const taskItem of object.inventory)
{
await object.updateInventory();
for (const taskItem of object.inventory)
if (taskItem.name === texItem.item.name)
{
if (taskItem.name === texItem.item.name)
{
await taskItem.renameInTask(object, invItem.name);
}
taskItem.permissions = invItem.permissions;
await taskItem.renameInTask(object, invItem.name);
}
}
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@caspertech/node-metaverse",
"version": "0.7.11",
"version": "0.7.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@caspertech/node-metaverse",
"version": "0.7.11",
"version": "0.7.12",
"license": "MIT",
"dependencies": {
"@caspertech/llsd": "^1.0.5",

View File

@@ -1,6 +1,6 @@
{
"name": "@caspertech/node-metaverse",
"version": "0.7.11",
"version": "0.7.12",
"description": "A node.js interface for Second Life.",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",