aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs44
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs62
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
3 files changed, 85 insertions, 46 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index b166588..68a484a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -59,6 +59,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
59 59
60 public void AddRegion(Scene scene) 60 public void AddRegion(Scene scene)
61 { 61 {
62 }
63
64 public void RemoveRegion(Scene scene)
65 {
66 }
67
68 public void RegionLoaded(Scene scene)
69 {
62 m_scene = scene; 70 m_scene = scene;
63 71
64 IScriptModuleComms comms = scene.RequestModuleInterface<IScriptModuleComms>(); 72 IScriptModuleComms comms = scene.RequestModuleInterface<IScriptModuleComms>();
@@ -73,14 +81,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
73 } 81 }
74 } 82 }
75 83
76 public void RemoveRegion(Scene scene)
77 {
78 }
79
80 public void RegionLoaded(Scene scene)
81 {
82 }
83
84 public void Close() 84 public void Close()
85 { 85 {
86 } 86 }
@@ -120,6 +120,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
120 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) 120 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
121 return; 121 return;
122 122
123 if (target.UUID != hostPart.ParentGroup.OwnerID)
124 {
125 uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions();
126
127 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
128 return;
129
130 hostPart.ParentGroup.SetOwnerId(target.UUID);
131 hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
132
133 if (m_scene.Permissions.PropagatePermissions())
134 {
135 foreach (SceneObjectPart child in hostPart.ParentGroup.Parts)
136 {
137 child.Inventory.ChangeInventoryOwner(target.UUID);
138 child.TriggerScriptChangedEvent(Changed.OWNER);
139 child.ApplyNextOwnerPermissions();
140 }
141 }
142
143 hostPart.ParentGroup.RootPart.ObjectSaleType = 0;
144 hostPart.ParentGroup.RootPart.SalePrice = 10;
145
146 hostPart.ParentGroup.HasGroupChanged = true;
147 hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient);
148 hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
149 }
150
123 attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true); 151 attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true);
124 } 152 }
125 } 153 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 3f19370..cef2cfd 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -177,16 +177,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
177 if (m_avatars.ContainsKey(agentID)) 177 if (m_avatars.ContainsKey(agentID))
178 { 178 {
179 ScenePresence sp; 179 ScenePresence sp;
180 scene.TryGetScenePresence(agentID, out sp); 180 if (scene.TryGetScenePresence(agentID, out sp))
181 181 {
182// m_log.DebugFormat( 182 m_log.DebugFormat(
183// "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", 183 "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
184// sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); 184 sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
185
186 sp.MoveToTarget(pos, noFly, landAtTarget);
187 sp.SetAlwaysRun = running;
188 185
189 return true; 186 sp.MoveToTarget(pos, noFly, landAtTarget);
187 sp.SetAlwaysRun = running;
188
189 return true;
190 }
190 } 191 }
191 } 192 }
192 193
@@ -200,12 +201,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
200 if (m_avatars.ContainsKey(agentID)) 201 if (m_avatars.ContainsKey(agentID))
201 { 202 {
202 ScenePresence sp; 203 ScenePresence sp;
203 scene.TryGetScenePresence(agentID, out sp); 204 if (scene.TryGetScenePresence(agentID, out sp))
204 205 {
205 sp.Velocity = Vector3.Zero; 206 sp.Velocity = Vector3.Zero;
206 sp.ResetMoveToTarget(); 207 sp.ResetMoveToTarget();
207 208
208 return true; 209 return true;
210 }
209 } 211 }
210 } 212 }
211 213
@@ -223,9 +225,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
223 { 225 {
224 if (m_avatars.ContainsKey(agentID)) 226 if (m_avatars.ContainsKey(agentID))
225 { 227 {
226 ScenePresence sp;
227 scene.TryGetScenePresence(agentID, out sp);
228
229 m_avatars[agentID].Say(channel, text); 228 m_avatars[agentID].Say(channel, text);
230 229
231 return true; 230 return true;
@@ -241,9 +240,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
241 { 240 {
242 if (m_avatars.ContainsKey(agentID)) 241 if (m_avatars.ContainsKey(agentID))
243 { 242 {
244 ScenePresence sp;
245 scene.TryGetScenePresence(agentID, out sp);
246
247 m_avatars[agentID].Shout(channel, text); 243 m_avatars[agentID].Shout(channel, text);
248 244
249 return true; 245 return true;
@@ -260,11 +256,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
260 if (m_avatars.ContainsKey(agentID)) 256 if (m_avatars.ContainsKey(agentID))
261 { 257 {
262 ScenePresence sp; 258 ScenePresence sp;
263 scene.TryGetScenePresence(agentID, out sp); 259 if (scene.TryGetScenePresence(agentID, out sp))
264 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); 260 {
265// sp.HandleAgentSit(m_avatars[agentID], agentID); 261 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
266 262 // sp.HandleAgentSit(m_avatars[agentID], agentID);
267 return true; 263
264 return true;
265 }
268 } 266 }
269 } 267 }
270 268
@@ -277,9 +275,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
277 { 275 {
278 if (m_avatars.ContainsKey(agentID)) 276 if (m_avatars.ContainsKey(agentID))
279 { 277 {
280 ScenePresence sp;
281 scene.TryGetScenePresence(agentID, out sp);
282
283 m_avatars[agentID].Whisper(channel, text); 278 m_avatars[agentID].Whisper(channel, text);
284 279
285 return true; 280 return true;
@@ -296,10 +291,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
296 if (m_avatars.ContainsKey(agentID)) 291 if (m_avatars.ContainsKey(agentID))
297 { 292 {
298 ScenePresence sp; 293 ScenePresence sp;
299 scene.TryGetScenePresence(agentID, out sp); 294 if (scene.TryGetScenePresence(agentID, out sp))
300 sp.StandUp(); 295 {
296 sp.StandUp();
301 297
302 return true; 298 return true;
299 }
303 } 300 }
304 } 301 }
305 302
@@ -312,6 +309,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
312 { 309 {
313 if (m_avatars.ContainsKey(agentID)) 310 if (m_avatars.ContainsKey(agentID))
314 return m_avatars[agentID].Touch(objectID); 311 return m_avatars[agentID].Touch(objectID);
312
315 return false; 313 return false;
316 } 314 }
317 } 315 }
@@ -322,9 +320,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
322 { 320 {
323 NPCAvatar av; 321 NPCAvatar av;
324 if (m_avatars.TryGetValue(agentID, out av)) 322 if (m_avatars.TryGetValue(agentID, out av))
325 {
326 return av.OwnerID; 323 return av.OwnerID;
327 }
328 } 324 }
329 325
330 return UUID.Zero; 326 return UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0bb933c..2f02f1f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2466,8 +2466,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2466 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) 2466 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
2467 return new LSL_Vector(0, 0, 0); 2467 return new LSL_Vector(0, 0, 0);
2468 2468
2469 Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; 2469 ScenePresence sp = World.GetScenePresence(npcId);
2470 return new LSL_Vector(pos.X, pos.Y, pos.Z); 2470
2471 if (sp != null)
2472 {
2473 Vector3 pos = sp.AbsolutePosition;
2474 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2475 }
2471 } 2476 }
2472 2477
2473 return new LSL_Vector(0, 0, 0); 2478 return new LSL_Vector(0, 0, 0);
@@ -2535,9 +2540,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2535 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2540 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
2536 2541
2537 ScenePresence sp = World.GetScenePresence(npcId); 2542 ScenePresence sp = World.GetScenePresence(npcId);
2538 Quaternion rot = sp.Rotation;
2539 2543
2540 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); 2544 if (sp != null)
2545 {
2546 Quaternion rot = sp.Rotation;
2547 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2548 }
2541 } 2549 }
2542 2550
2543 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2551 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
@@ -2559,7 +2567,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2559 return; 2567 return;
2560 2568
2561 ScenePresence sp = World.GetScenePresence(npcId); 2569 ScenePresence sp = World.GetScenePresence(npcId);
2562 sp.Rotation = LSL_Api.Rot2Quaternion(rotation); 2570
2571 if (sp != null)
2572 sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
2563 } 2573 }
2564 } 2574 }
2565 2575
@@ -2737,6 +2747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2737 { 2747 {
2738 CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); 2748 CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
2739 m_host.AddScriptLPS(1); 2749 m_host.AddScriptLPS(1);
2750
2740 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2751 INPCModule module = World.RequestModuleInterface<INPCModule>();
2741 int linkNum = link_num.value; 2752 int linkNum = link_num.value;
2742 if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS)) 2753 if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
@@ -2744,12 +2755,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2744 UUID npcId; 2755 UUID npcId;
2745 if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID)) 2756 if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
2746 return; 2757 return;
2758
2747 SceneObjectPart part = null; 2759 SceneObjectPart part = null;
2748 UUID objectId; 2760 UUID objectId;
2749 if (UUID.TryParse(LSL_String.ToString(object_key), out objectId)) 2761 if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
2750 part = World.GetSceneObjectPart(objectId); 2762 part = World.GetSceneObjectPart(objectId);
2763
2751 if (part == null) 2764 if (part == null)
2752 return; 2765 return;
2766
2753 if (linkNum != ScriptBaseClass.LINK_THIS) 2767 if (linkNum != ScriptBaseClass.LINK_THIS)
2754 { 2768 {
2755 if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT) 2769 if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
@@ -2764,6 +2778,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2764 return; 2778 return;
2765 } 2779 }
2766 } 2780 }
2781
2767 module.Touch(npcId, part.UUID); 2782 module.Touch(npcId, part.UUID);
2768 } 2783 }
2769 } 2784 }