29 using System.Collections.Generic;
31 using System.Reflection;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Console;
39 using OpenSim.Framework.Monitoring;
40 using OpenSim.Region.ClientStack.LindenUDP;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
45 namespace OpenSim.
Region.OptionalModules.
Avatar.Attachments
47 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"TempAttachmentsModule")]
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private Scene m_scene;
74 comms.RegisterScriptInvocation(
this,
"llAttachToAvatarTemp");
75 m_log.DebugFormat(
"[TEMP ATTACHS]: Registered script functions");
78 if (m_console != null)
80 m_console.AddCommand(
"TempAttachModule",
false,
"set auto_grant_attach_perms",
"set auto_grant_attach_perms true|false",
"Allow objects owned by the region owner or estate managers to obtain attach permissions without asking the user", SetAutoGrantAttachPerms);
85 m_log.ErrorFormat(
"[TEMP ATTACHS]: Failed to register script functions");
93 public Type ReplaceableInterface
100 get {
return "TempAttachmentsModule"; }
103 private void SendConsoleOutput(UUID agentID,
string text)
105 if (m_console == null)
108 m_console.SendConsoleOutput(agentID, text);
111 private void SetAutoGrantAttachPerms(
string module,
string[] parms)
113 UUID agentID =
new UUID(parms[parms.Length - 1]);
114 Array.Resize(ref parms, parms.Length - 1);
116 if (parms.Length != 3)
118 SendConsoleOutput(agentID,
"Command parameter error");
122 string val = parms[2];
123 if (val !=
"true" && val !=
"false")
125 SendConsoleOutput(agentID,
"Command parameter error");
129 m_scene.StoreExtraSetting(
"auto_grant_attach_perms", val);
131 SendConsoleOutput(agentID,
String.Format(
"auto_grant_attach_perms set to {0}", val));
134 private int llAttachToAvatarTemp(UUID host, UUID script,
int attachmentPoint)
138 if (hostPart == null)
145 if (attachmentsModule == null)
156 if (!m_scene.TryGetScenePresence(item.
PermsGranter, out target))
161 uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions();
163 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
166 hostPart.ParentGroup.SetOwnerId(target.UUID);
167 hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
169 if (m_scene.Permissions.PropagatePermissions())
173 child.Inventory.ChangeInventoryOwner(target.UUID);
174 child.TriggerScriptChangedEvent(Changed.OWNER);
175 child.ApplyNextOwnerPermissions();
179 hostPart.ParentGroup.RootPart.ObjectSaleType = 0;
180 hostPart.ParentGroup.RootPart.SalePrice = 10;
182 hostPart.ParentGroup.HasGroupChanged =
true;
183 hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient);
184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint,
false,
false,
true) ? 1 : 0;
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
Represents an item in a task inventory
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
Interface for communication between OpenSim modules and in-world scripts
OpenSim.Framework.PermissionMask PermissionMask
void Initialise(IConfigSource configSource)
This is called to initialize the region module. For shared modules, this is called exactly once...
SceneObjectGroup ParentGroup
bool IsAttachment
Is this scene object acting as an attachment?