aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs25
10 files changed, 118 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 0ee7606..6587ead 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -39,6 +39,9 @@ using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.CoreModules.World.Archiver; 39using OpenSim.Region.CoreModules.World.Archiver;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
42using Ionic.Zlib;
43using GZipStream = Ionic.Zlib.GZipStream;
44using CompressionMode = Ionic.Zlib.CompressionMode;
42 45
43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 46namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
44{ 47{
@@ -99,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
99 scene, 102 scene,
100 userInfo, 103 userInfo,
101 invPath, 104 invPath,
102 new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress)) 105 new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress, CompressionLevel.BestCompression))
103 { 106 {
104 } 107 }
105 108
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index eb581b4..07ea35e 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -161,6 +161,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
161 161
162 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) 162 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
163 { 163 {
164 if (sp.Scene.Permissions.IsGridGod(sp.UUID))
165 {
166 // This user will be a God in the destination scene, too
167 teleportFlags |= (uint)TeleportFlags.Godlike;
168 }
169
164 if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) 170 if (!sp.Scene.Permissions.CanTeleport(sp.UUID))
165 return; 171 return;
166 172
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 12bd6bc..a9ffd8f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
173 if (sp.UserLevel < m_levelHGTeleport) 173 if (sp.UserLevel < m_levelHGTeleport)
174 { 174 {
175 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); 175 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
176 reason = "HyperGrid teleport not permitted"; 176 reason = "Hypergrid teleport not allowed";
177 return false; 177 return false;
178 } 178 }
179 179
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index 3b862da..6cd077a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -149,9 +149,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
149 lock (m_scenes) 149 lock (m_scenes)
150 m_scenes[scene.RegionInfo.RegionID] = scene; 150 m_scenes[scene.RegionInfo.RegionID] = scene;
151 151
152 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); 152 scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
153 } 153 }
154 154
155
155 ///<summary> 156 ///<summary>
156 /// 157 ///
157 ///</summary> 158 ///</summary>
@@ -166,9 +167,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
166 167
167 #endregion ISharedRegionModule 168 #endregion ISharedRegionModule
168 169
169 void EventManager_OnPrimsLoaded(Scene s) 170 void OnLoginsEnabled(string regionName)
170 { 171 {
171 UploadMapTile(s); 172 Scene scene = null;
173 foreach (Scene s in m_scenes.Values)
174 if (s.RegionInfo.RegionName == regionName)
175 {
176 scene = s;
177 break;
178 }
179 if (scene != null)
180 UploadMapTile(scene);
172 } 181 }
173 182
174 183
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index ab3cc41..eabe46e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -40,6 +40,9 @@ using OpenSim.Framework.Serialization;
40using OpenSim.Region.CoreModules.World.Terrain; 40using OpenSim.Region.CoreModules.World.Terrain;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using Ionic.Zlib;
44using GZipStream = Ionic.Zlib.GZipStream;
45using CompressionMode = Ionic.Zlib.CompressionMode;
43 46
44namespace OpenSim.Region.CoreModules.World.Archiver 47namespace OpenSim.Region.CoreModules.World.Archiver
45{ 48{
@@ -82,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
82 { 85 {
83 try 86 try
84 { 87 {
85 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress); 88 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress, CompressionLevel.BestCompression);
86 } 89 }
87 catch (EntryPointNotFoundException e) 90 catch (EntryPointNotFoundException e)
88 { 91 {
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 881b24a..190f63b 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -166,6 +166,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
166 m_scene.Permissions.OnDeedParcel += CanDeedParcel; 166 m_scene.Permissions.OnDeedParcel += CanDeedParcel;
167 m_scene.Permissions.OnDeedObject += CanDeedObject; 167 m_scene.Permissions.OnDeedObject += CanDeedObject;
168 m_scene.Permissions.OnIsGod += IsGod; 168 m_scene.Permissions.OnIsGod += IsGod;
169 m_scene.Permissions.OnIsGridGod += IsGridGod;
169 m_scene.Permissions.OnIsAdministrator += IsAdministrator; 170 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
170 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 171 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
171 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 172 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
@@ -466,22 +467,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions
466 if (IsEstateManager(user) && m_RegionManagerIsGod) 467 if (IsEstateManager(user) && m_RegionManagerIsGod)
467 return true; 468 return true;
468 469
470 if (IsGridGod(user, null))
471 return true;
472
473 return false;
474 }
475
476 /// <summary>
477 /// Is the given user a God throughout the grid (not just in the current scene)?
478 /// </summary>
479 /// <param name="user">The user</param>
480 /// <param name="scene">Unused, can be null</param>
481 /// <returns></returns>
482 protected bool IsGridGod(UUID user, Scene scene)
483 {
484 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
485 if (m_bypassPermissions) return m_bypassPermissionsValue;
486
487 if (user == UUID.Zero) return false;
488
469 if (m_allowGridGods) 489 if (m_allowGridGods)
470 { 490 {
471 ScenePresence sp = m_scene.GetScenePresence(user); 491 ScenePresence sp = m_scene.GetScenePresence(user);
472 if (sp != null) 492 if (sp != null)
473 { 493 return (sp.UserLevel >= 200);
474 if (sp.UserLevel >= 200)
475 return true;
476 return false;
477 }
478 494
479 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); 495 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user);
480 if (account != null) 496 if (account != null)
481 { 497 return (account.UserLevel >= 200);
482 if (account.UserLevel >= 200)
483 return true;
484 }
485 } 498 }
486 499
487 return false; 500 return false;
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index f5623bd..14ae287 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -278,6 +278,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
278 return "FALLDOWN"; 278 return "FALLDOWN";
279 } 279 }
280 280
281 // Check if the user has stopped walking just now
282 if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero))
283 return "STAND";
284
281 return CurrentMovementAnimation; 285 return CurrentMovementAnimation;
282 } 286 }
283 287
@@ -402,13 +406,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation
402 /// </summary> 406 /// </summary>
403 public void UpdateMovementAnimations() 407 public void UpdateMovementAnimations()
404 { 408 {
405 CurrentMovementAnimation = DetermineMovementAnimation(); 409 lock (m_animations)
410 {
411 CurrentMovementAnimation = DetermineMovementAnimation();
406 412
407// m_log.DebugFormat( 413// m_log.DebugFormat(
408// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", 414// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
409// CurrentMovementAnimation, m_scenePresence.Name); 415// CurrentMovementAnimation, m_scenePresence.Name);
410 416
411 TrySetMovementAnimation(CurrentMovementAnimation); 417 TrySetMovementAnimation(CurrentMovementAnimation);
418 }
412 } 419 }
413 420
414 public UUID[] GetAnimationArray() 421 public UUID[] GetAnimationArray()
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e1fedf4..535d87a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -67,6 +67,7 @@ namespace OpenSim.Region.Framework.Scenes
67 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); 67 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
68 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); 68 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
69 public delegate bool IsGodHandler(UUID user, Scene requestFromScene); 69 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
70 public delegate bool IsAdministratorHandler(UUID user); 71 public delegate bool IsAdministratorHandler(UUID user);
71 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
72 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); 73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene);
@@ -134,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
134 public event RunConsoleCommandHandler OnRunConsoleCommand; 135 public event RunConsoleCommandHandler OnRunConsoleCommand;
135 public event IssueEstateCommandHandler OnIssueEstateCommand; 136 public event IssueEstateCommandHandler OnIssueEstateCommand;
136 public event IsGodHandler OnIsGod; 137 public event IsGodHandler OnIsGod;
138 public event IsGridGodHandler OnIsGridGod;
137 public event IsAdministratorHandler OnIsAdministrator; 139 public event IsAdministratorHandler OnIsAdministrator;
138// public event EditParcelHandler OnEditParcel; 140// public event EditParcelHandler OnEditParcel;
139 public event EditParcelPropertiesHandler OnEditParcelProperties; 141 public event EditParcelPropertiesHandler OnEditParcelProperties;
@@ -728,6 +730,21 @@ namespace OpenSim.Region.Framework.Scenes
728 return true; 730 return true;
729 } 731 }
730 732
733 public bool IsGridGod(UUID user)
734 {
735 IsGridGodHandler handler = OnIsGridGod;
736 if (handler != null)
737 {
738 Delegate[] list = handler.GetInvocationList();
739 foreach (IsGridGodHandler h in list)
740 {
741 if (h(user, m_scene) == false)
742 return false;
743 }
744 }
745 return true;
746 }
747
731 public bool IsAdministrator(UUID user) 748 public bool IsAdministrator(UUID user)
732 { 749 {
733 IsAdministratorHandler handler = OnIsAdministrator; 750 IsAdministratorHandler handler = OnIsAdministrator;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e0d5055..311ba6a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
45 45
46namespace OpenSim.Region.Framework.Scenes 46namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 [Flags]
48 enum ScriptControlled : uint 49 enum ScriptControlled : uint
49 { 50 {
50 CONTROL_ZERO = 0, 51 CONTROL_ZERO = 0,
@@ -1295,7 +1296,7 @@ namespace OpenSim.Region.Framework.Scenes
1295 { 1296 {
1296// m_log.DebugFormat( 1297// m_log.DebugFormat(
1297// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", 1298// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
1298// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); 1299// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
1299 1300
1300 if (IsChildAgent) 1301 if (IsChildAgent)
1301 { 1302 {
@@ -1405,14 +1406,8 @@ namespace OpenSim.Region.Framework.Scenes
1405 } 1406 }
1406 } 1407 }
1407 1408
1408 lock (scriptedcontrols) 1409 uint flagsForScripts = (uint)flags;
1409 { 1410 flags = RemoveIgnoredControls(flags, IgnoredControls);
1410 if (scriptedcontrols.Count > 0)
1411 {
1412 SendControlToScripts((uint)flags);
1413 flags = RemoveIgnoredControls(flags, IgnoredControls);
1414 }
1415 }
1416 1411
1417 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) 1412 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
1418 HandleAgentSitOnGround(); 1413 HandleAgentSitOnGround();
@@ -1505,7 +1500,7 @@ namespace OpenSim.Region.Framework.Scenes
1505 MovementFlag |= (byte)nudgehack; 1500 MovementFlag |= (byte)nudgehack;
1506 } 1501 }
1507 1502
1508// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF); 1503 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with {1}", Name, DCF);
1509 MovementFlag += (byte)(uint)DCF; 1504 MovementFlag += (byte)(uint)DCF;
1510 update_movementflag = true; 1505 update_movementflag = true;
1511 } 1506 }
@@ -1518,7 +1513,7 @@ namespace OpenSim.Region.Framework.Scenes
1518 && ((MovementFlag & (byte)nudgehack) == nudgehack)) 1513 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1519 ) // This or is for Nudge forward 1514 ) // This or is for Nudge forward
1520 { 1515 {
1521// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF); 1516 //m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
1522 MovementFlag -= ((byte)(uint)DCF); 1517 MovementFlag -= ((byte)(uint)DCF);
1523 update_movementflag = true; 1518 update_movementflag = true;
1524 1519
@@ -1599,8 +1594,18 @@ namespace OpenSim.Region.Framework.Scenes
1599// } 1594// }
1600// } 1595// }
1601 1596
1602// if (update_movementflag && ParentID == 0) 1597 if (update_movementflag && ParentID == 0)
1603// Animator.UpdateMovementAnimations(); 1598 Animator.UpdateMovementAnimations();
1599
1600 lock (scriptedcontrols)
1601 {
1602 if (scriptedcontrols.Count > 0)
1603 {
1604 // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
1605 // (e.g., a walking script) checks which animation is active it will be the correct animation.
1606 SendControlToScripts(flagsForScripts);
1607 }
1608 }
1604 } 1609 }
1605 1610
1606 m_scene.EventManager.TriggerOnClientMovement(this); 1611 m_scene.EventManager.TriggerOnClientMovement(this);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 1373971..19f3ce1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
308 } 308 }
309 SceneObjectPart SensePoint = ts.host; 309 SceneObjectPart SensePoint = ts.host;
310 310
311 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 311 Vector3 fromRegionPos = SensePoint.GetWorldPosition();
312 312
313 // pre define some things to avoid repeated definitions in the loop body 313 // pre define some things to avoid repeated definitions in the loop body
314 Vector3 toRegionPos; 314 Vector3 toRegionPos;
@@ -323,13 +323,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
323 Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation! 323 Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation!
324 if (SensePoint.ParentGroup.IsAttachment) 324 if (SensePoint.ParentGroup.IsAttachment)
325 { 325 {
326 // In attachments, the sensor cone always orients with the 326 // In attachments, rotate the sensor cone with the
327 // avatar rotation. This may include a nonzero elevation if 327 // avatar rotation. This may include a nonzero elevation if
328 // in mouselook. 328 // in mouselook.
329 // This will not include the rotation and position of the
330 // attachment point (e.g. your head when a sensor is in your
331 // hair attached to your scull. Your hair will turn with
332 // your head but the sensor will stay with your (global)
333 // avatar rotation and position.
334 // Position of a sensor in a child prim attached to an avatar
335 // will be still wrong.
329 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 336 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
330 fromRegionPos = avatar.AbsolutePosition; 337 fromRegionPos = avatar.AbsolutePosition;
331 q = avatar.Rotation; 338 q = avatar.Rotation;
332 } 339 }
340
333 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 341 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
334 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 342 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
335 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 343 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
@@ -441,14 +449,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
441 return sensedEntities; 449 return sensedEntities;
442 450
443 SceneObjectPart SensePoint = ts.host; 451 SceneObjectPart SensePoint = ts.host;
444 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 452 Vector3 fromRegionPos = SensePoint.GetWorldPosition();
445 453
446 Quaternion q = SensePoint.RotationOffset; 454 Quaternion q = SensePoint.GetWorldRotation();
447 if (SensePoint.ParentGroup.IsAttachment) 455 if (SensePoint.ParentGroup.IsAttachment)
448 { 456 {
449 // In attachments, the sensor cone always orients with the 457 // In attachments, rotate the sensor cone with the
450 // avatar rotation. This may include a nonzero elevation if 458 // avatar rotation. This may include a nonzero elevation if
451 // in mouselook. 459 // in mouselook.
460 // This will not include the rotation and position of the
461 // attachment point (e.g. your head when a sensor is in your
462 // hair attached to your scull. Your hair will turn with
463 // your head but the sensor will stay with your (global)
464 // avatar rotation and position.
465 // Position of a sensor in a child prim attached to an avatar
466 // will be still wrong.
452 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 467 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
453 if (avatar == null) 468 if (avatar == null)
454 return sensedEntities; 469 return sensedEntities;