aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-02-23 02:04:16 +0000
committerUbitUmarov2012-02-23 02:04:16 +0000
commite827bcaf2b4a621de79aa8d342fa2b2eb289dafa (patch)
tree29a632205a7fd1257625bc999d93aeafb001156e /OpenSim/Region
parent fix the last fix. Regions are square but... Also remove the 0.5 offset in ma... (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-e827bcaf2b4a621de79aa8d342fa2b2eb289dafa.zip
opensim-SC_OLD-e827bcaf2b4a621de79aa8d342fa2b2eb289dafa.tar.gz
opensim-SC_OLD-e827bcaf2b4a621de79aa8d342fa2b2eb289dafa.tar.bz2
opensim-SC_OLD-e827bcaf2b4a621de79aa8d342fa2b2eb289dafa.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs62
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
8 files changed, 84 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 6286689..2498705 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1660,19 +1660,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1660 } 1660 }
1661 1661
1662 // Offset the positions for the new region across the border 1662 // Offset the positions for the new region across the border
1663 // NOT here 1663 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1664 1664
1665 // If we fail to cross the border, then reset the position of the scene object on that border. 1665 // If we fail to cross the border, then reset the position of the scene object on that border.
1666 uint x = 0, y = 0; 1666 uint x = 0, y = 0;
1667 Utils.LongToUInts(newRegionHandle, out x, out y); 1667 Utils.LongToUInts(newRegionHandle, out x, out y);
1668 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1668 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1669 1669
1670 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1671
1672 if (destination != null) 1670 if (destination != null)
1673 { 1671 {
1674 grp.RootPart.GroupPosition = pos; // only change this if we think there is anywhere to go 1672 if (CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
1675 if (CrossPrimGroupIntoNewRegion(destination, grp, silent))
1676 return; // we did it 1673 return; // we did it
1677 } 1674 }
1678 1675
@@ -1701,7 +1698,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1701 /// true if the crossing itself was successful, false on failure 1698 /// true if the crossing itself was successful, false on failure
1702 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 1699 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
1703 /// </returns> 1700 /// </returns>
1704 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent) 1701 protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent)
1705 { 1702 {
1706 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 1703 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
1707 1704
@@ -1726,7 +1723,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1726 //if (m_interregionCommsOut != null) 1723 //if (m_interregionCommsOut != null)
1727 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 1724 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
1728 if (m_aScene.SimulationService != null) 1725 if (m_aScene.SimulationService != null)
1729 successYN = m_aScene.SimulationService.CreateObject(destination, grp, true); 1726 successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
1730 1727
1731 if (successYN) 1728 if (successYN)
1732 { 1729 {
@@ -1785,7 +1782,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1785 gobj.IsAttachment = false; 1782 gobj.IsAttachment = false;
1786 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 1783 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1787 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); 1784 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1788 CrossPrimGroupIntoNewRegion(destination, gobj, silent); 1785 CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
1789 } 1786 }
1790 } 1787 }
1791 1788
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index faa1def..6e75692 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
328 * Object-related communications 328 * Object-related communications
329 */ 329 */
330 330
331 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 331 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
332 { 332 {
333 if (destination == null) 333 if (destination == null)
334 return false; 334 return false;
@@ -343,12 +343,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
343 // We need to make a local copy of the object 343 // We need to make a local copy of the object
344 ISceneObject sogClone = sog.CloneForNewScene(); 344 ISceneObject sogClone = sog.CloneForNewScene();
345 sogClone.SetState(sog.GetStateSnapshot(), s); 345 sogClone.SetState(sog.GetStateSnapshot(), s);
346 return s.IncomingCreateObject(sogClone); 346 return s.IncomingCreateObject(newPosition, sogClone);
347 } 347 }
348 else 348 else
349 { 349 {
350 // Use the object as it came through the wire 350 // Use the object as it came through the wire
351 return s.IncomingCreateObject(sog); 351 return s.IncomingCreateObject(newPosition, sog);
352 } 352 }
353 } 353 }
354 } 354 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 391b1a1..4b70692 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -297,13 +297,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
297 * Object-related communications 297 * Object-related communications
298 */ 298 */
299 299
300 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 300 public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
301 { 301 {
302 if (destination == null) 302 if (destination == null)
303 return false; 303 return false;
304 304
305 // Try local first 305 // Try local first
306 if (m_localBackend.CreateObject(destination, sog, isLocalCall)) 306 if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
307 { 307 {
308 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); 308 //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
309 return true; 309 return true;
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
311 311
312 // else do the remote thing 312 // else do the remote thing
313 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 313 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
314 return m_remoteConnector.CreateObject(destination, sog, isLocalCall); 314 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
315 315
316 return false; 316 return false;
317 } 317 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a7cca44..b7162da 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2403,7 +2403,7 @@ namespace OpenSim.Region.Framework.Scenes
2403 /// </summary> 2403 /// </summary>
2404 /// <param name="sog"></param> 2404 /// <param name="sog"></param>
2405 /// <returns></returns> 2405 /// <returns></returns>
2406 public bool IncomingCreateObject(ISceneObject sog) 2406 public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
2407 { 2407 {
2408 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition, 2408 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2409 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment); 2409 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
@@ -2419,6 +2419,9 @@ namespace OpenSim.Region.Framework.Scenes
2419 return false; 2419 return false;
2420 } 2420 }
2421 2421
2422 if (newPosition != Vector3.Zero)
2423 newObject.RootPart.GroupPosition = newPosition;
2424
2422 if (!AddSceneObject(newObject)) 2425 if (!AddSceneObject(newObject))
2423 { 2426 {
2424 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2427 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
@@ -4431,10 +4434,7 @@ namespace OpenSim.Region.Framework.Scenes
4431 /// <param name="action"></param> 4434 /// <param name="action"></param>
4432 public void ForEachRootScenePresence(Action<ScenePresence> action) 4435 public void ForEachRootScenePresence(Action<ScenePresence> action)
4433 { 4436 {
4434 if (m_sceneGraph != null) 4437 m_sceneGraph.ForEachAvatar(action);
4435 {
4436 m_sceneGraph.ForEachAvatar(action);
4437 }
4438 } 4438 }
4439 4439
4440 /// <summary> 4440 /// <summary>
@@ -4443,10 +4443,7 @@ namespace OpenSim.Region.Framework.Scenes
4443 /// <param name="action"></param> 4443 /// <param name="action"></param>
4444 public void ForEachScenePresence(Action<ScenePresence> action) 4444 public void ForEachScenePresence(Action<ScenePresence> action)
4445 { 4445 {
4446 if (m_sceneGraph != null) 4446 m_sceneGraph.ForEachScenePresence(action);
4447 {
4448 m_sceneGraph.ForEachScenePresence(action);
4449 }
4450 } 4447 }
4451 4448
4452 /// <summary> 4449 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ec8716b..a3839c2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3297,7 +3297,7 @@ namespace OpenSim.Region.Framework.Scenes
3297 ((SceneObjectGroup)so).LocalId = 0; 3297 ((SceneObjectGroup)so).LocalId = 0;
3298 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); 3298 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
3299 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene); 3299 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3300 m_scene.IncomingCreateObject(so); 3300 m_scene.IncomingCreateObject(Vector3.Zero, so);
3301 } 3301 }
3302 } 3302 }
3303 } 3303 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 84792c0..d0430f4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2177,6 +2177,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2177 return real_vec; 2177 return real_vec;
2178 } 2178 }
2179 2179
2180 public LSL_Integer llSetRegionPos(LSL_Vector pos)
2181 {
2182 return new LSL_Integer(SetRegionPos(m_host, pos));
2183 }
2184
2185 protected int SetRegionPos(SceneObjectPart part, LSL_Vector targetPos)
2186 {
2187 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
2188 return 0;
2189
2190 SceneObjectGroup grp = part.ParentGroup;
2191
2192 if (grp.IsAttachment)
2193 return 0;
2194
2195 if (grp.RootPart.PhysActor != null && grp.RootPart.PhysActor.IsPhysical)
2196 return 0;
2197
2198 if (targetPos.x < -10.0f || targetPos.x >= (float)Constants.RegionSize || targetPos.y < -10.0f || targetPos.y >= (float)Constants.RegionSize || targetPos.z < 0 || targetPos.z >= 4096.0f)
2199 return 0;
2200
2201 float constrainedX = (float)targetPos.x;
2202 float constrainedY = (float)targetPos.y;
2203
2204 if (constrainedX < 0.0f)
2205 constrainedX = 0.0f;
2206 if (constrainedY < 0.0f)
2207 constrainedY = 0.0f;
2208 if (constrainedX >= (float)Constants.RegionSize)
2209 constrainedX = (float)Constants.RegionSize - 0.1f;
2210 if (constrainedY >= (float)Constants.RegionSize)
2211 constrainedY = (float)Constants.RegionSize -0.1f;
2212
2213 float ground = World.GetGroundHeight(constrainedX, constrainedY);
2214
2215 if (targetPos.z < ground)
2216 targetPos.z = ground;
2217
2218 Vector3 dest = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
2219
2220 if (!World.Permissions.CanObjectEntry(grp.UUID, false, dest))
2221 return 0;
2222
2223 grp.UpdateGroupPosition(dest);
2224
2225 return 1;
2226 }
2227
2180 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) 2228 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
2181 { 2229 {
2182 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 2230 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -2185,11 +2233,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2185 LSL_Vector currentPos = GetPartLocalPos(part); 2233 LSL_Vector currentPos = GetPartLocalPos(part);
2186 LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos); 2234 LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos);
2187 2235
2236
2188 if (part.ParentGroup.RootPart == part) 2237 if (part.ParentGroup.RootPart == part)
2189 { 2238 {
2190 SceneObjectGroup parent = part.ParentGroup; 2239 SceneObjectGroup parent = part.ParentGroup;
2240 Vector3 dest = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z);
2241 if (!World.Permissions.CanObjectEntry(parent.UUID, false, dest))
2242 return;
2191 Util.FireAndForget(delegate(object x) { 2243 Util.FireAndForget(delegate(object x) {
2192 parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z)); 2244 parent.UpdateGroupPosition(dest);
2193 }); 2245 });
2194 } 2246 }
2195 else 2247 else
@@ -5709,7 +5761,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5709 public LSL_Integer llGetRegionAgentCount() 5761 public LSL_Integer llGetRegionAgentCount()
5710 { 5762 {
5711 m_host.AddScriptLPS(1); 5763 m_host.AddScriptLPS(1);
5712 return new LSL_Integer(World.GetRootAgentCount()); 5764
5765 int count = 0;
5766 World.ForEachRootScenePresence(delegate(ScenePresence sp) {
5767 count++;
5768 });
5769
5770 return new LSL_Integer(count);
5713 } 5771 }
5714 5772
5715 public LSL_Vector llGetRegionCorner() 5773 public LSL_Vector llGetRegionCorner()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index f2d4399..9679798 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -346,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
346 void llSetParcelMusicURL(string url); 346 void llSetParcelMusicURL(string url);
347 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 347 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
348 void llSetPos(LSL_Vector pos); 348 void llSetPos(LSL_Vector pos);
349 LSL_Integer llSetRegionPos(LSL_Vector pos);
349 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); 350 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
350 void llSetPrimitiveParams(LSL_List rules); 351 void llSetPrimitiveParams(LSL_List rules);
351 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 352 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index fad6c35..dcaa3b4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1580,6 +1580,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1580 m_LSL_Functions.llSetPos(pos); 1580 m_LSL_Functions.llSetPos(pos);
1581 } 1581 }
1582 1582
1583 public LSL_Integer llSetRegionPos(LSL_Vector pos)
1584 {
1585 return m_LSL_Functions.llSetRegionPos(pos);
1586 }
1587
1583 public void llSetPrimitiveParams(LSL_List rules) 1588 public void llSetPrimitiveParams(LSL_List rules)
1584 { 1589 {
1585 m_LSL_Functions.llSetPrimitiveParams(rules); 1590 m_LSL_Functions.llSetPrimitiveParams(rules);