aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Attachments
diff options
context:
space:
mode:
authorMelanie2012-08-14 02:11:13 +0100
committerMelanie2012-08-14 02:11:13 +0100
commit053e7279ca5d9be8f2ae2f79d0a2c74ab056f147 (patch)
tree772fd824cbbe5a6bc594875ac3ee03c00115cef5 /OpenSim/Region/OptionalModules/Avatar/Attachments
parentMerge branch 'master' into careminster (diff)
parentImplement the temp attachments. UNTESTED (diff)
downloadopensim-SC_OLD-053e7279ca5d9be8f2ae2f79d0a2c74ab056f147.zip
opensim-SC_OLD-053e7279ca5d9be8f2ae2f79d0a2c74ab056f147.tar.gz
opensim-SC_OLD-053e7279ca5d9be8f2ae2f79d0a2c74ab056f147.tar.bz2
opensim-SC_OLD-053e7279ca5d9be8f2ae2f79d0a2c74ab056f147.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs126
1 files changed, 126 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
new file mode 100644
index 0000000..b166588
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -0,0 +1,126 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
32using System.Text;
33using log4net;
34using Mono.Addins;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Framework.Monitoring;
40using OpenSim.Region.ClientStack.LindenUDP;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes;
43
44namespace OpenSim.Region.OptionalModules.Avatar.Attachments
45{
46 /// <summary>
47 /// A module that just holds commands for inspecting avatar appearance.
48 /// </summary>
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")]
50 public class TempAttachmentsModule : INonSharedRegionModule
51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 private Scene m_scene;
55
56 public void Initialise(IConfigSource configSource)
57 {
58 }
59
60 public void AddRegion(Scene scene)
61 {
62 m_scene = scene;
63
64 IScriptModuleComms comms = scene.RequestModuleInterface<IScriptModuleComms>();
65 if (comms != null)
66 {
67 comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp");
68 m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions");
69 }
70 else
71 {
72 m_log.ErrorFormat("[TEMP ATTACHS]: Failed to register script functions");
73 }
74 }
75
76 public void RemoveRegion(Scene scene)
77 {
78 }
79
80 public void RegionLoaded(Scene scene)
81 {
82 }
83
84 public void Close()
85 {
86 }
87
88 public Type ReplaceableInterface
89 {
90 get { return null; }
91 }
92
93 public string Name
94 {
95 get { return "TempAttachmentsModule"; }
96 }
97
98 private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
99 {
100 SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
101
102 if (hostPart == null)
103 return;
104
105 if (hostPart.ParentGroup.IsAttachment)
106 return;
107
108 IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
109 if (attachmentsModule == null)
110 return;
111
112 TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script);
113 if (item == null)
114 return;
115
116 if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH
117 return;
118
119 ScenePresence target;
120 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
121 return;
122
123 attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true);
124 }
125 }
126}