aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDiva Canto2010-01-16 07:46:07 -0800
committerDiva Canto2010-01-16 07:46:07 -0800
commitbd6d1a24448dafea5be7ddbcd591b352040e4412 (patch)
treee0416f8cc144cde7220412abec211f010e5c5344 /OpenSim/Region/Framework
parentMerge branch 'master' into presence-refactor (diff)
downloadopensim-SC-bd6d1a24448dafea5be7ddbcd591b352040e4412.zip
opensim-SC-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.gz
opensim-SC-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.bz2
opensim-SC-bd6d1a24448dafea5be7ddbcd591b352040e4412.tar.xz
Moved prim crossing to EntityTransferModule. Not complete yet.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs353
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs4
3 files changed, 185 insertions, 174 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 96884b3..a0505df 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -46,5 +46,7 @@ namespace OpenSim.Region.Framework.Interfaces
46 void EnableChildAgents(ScenePresence agent); 46 void EnableChildAgents(ScenePresence agent);
47 47
48 void EnableChildAgent(ScenePresence agent, GridRegion region); 48 void EnableChildAgent(ScenePresence agent, GridRegion region);
49
50 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
49 } 51 }
50} 52}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7b582a9..bd753cc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1655,7 +1655,9 @@ namespace OpenSim.Region.Framework.Scenes
1655 GridRegion region = new GridRegion(RegionInfo); 1655 GridRegion region = new GridRegion(RegionInfo);
1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1656 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1657 if (error != String.Empty) 1657 if (error != String.Empty)
1658 {
1658 throw new Exception(error); 1659 throw new Exception(error);
1660 }
1659 1661
1660 m_sceneGridService.SetScene(this); 1662 m_sceneGridService.SetScene(this);
1661 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1663 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
@@ -2049,202 +2051,205 @@ namespace OpenSim.Region.Framework.Scenes
2049 if (grp.IsDeleted) 2051 if (grp.IsDeleted)
2050 return; 2052 return;
2051 2053
2052 if (grp.RootPart.DIE_AT_EDGE) 2054 if (m_teleportModule != null)
2053 { 2055 m_teleportModule.Cross(grp, attemptedPosition, silent);
2054 // We remove the object here 2056
2055 try 2057 //if (grp.RootPart.DIE_AT_EDGE)
2056 { 2058 //{
2057 DeleteSceneObject(grp, false); 2059 // // We remove the object here
2058 } 2060 // try
2059 catch (Exception) 2061 // {
2060 { 2062 // DeleteSceneObject(grp, false);
2061 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2063 // }
2062 } 2064 // catch (Exception)
2063 return; 2065 // {
2064 } 2066 // m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
2067 // }
2068 // return;
2069 //}
2065 2070
2066 int thisx = (int)RegionInfo.RegionLocX; 2071 //int thisx = (int)RegionInfo.RegionLocX;
2067 int thisy = (int)RegionInfo.RegionLocY; 2072 //int thisy = (int)RegionInfo.RegionLocY;
2068 Vector3 EastCross = new Vector3(0.1f,0,0); 2073 //Vector3 EastCross = new Vector3(0.1f,0,0);
2069 Vector3 WestCross = new Vector3(-0.1f, 0, 0); 2074 //Vector3 WestCross = new Vector3(-0.1f, 0, 0);
2070 Vector3 NorthCross = new Vector3(0, 0.1f, 0); 2075 //Vector3 NorthCross = new Vector3(0, 0.1f, 0);
2071 Vector3 SouthCross = new Vector3(0, -0.1f, 0); 2076 //Vector3 SouthCross = new Vector3(0, -0.1f, 0);
2072 2077
2073 2078
2074 // use this if no borders were crossed! 2079 //// use this if no borders were crossed!
2075 ulong newRegionHandle 2080 //ulong newRegionHandle
2076 = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), 2081 // = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize),
2077 (uint)((thisy) * Constants.RegionSize)); 2082 // (uint)((thisy) * Constants.RegionSize));
2078 2083
2079 Vector3 pos = attemptedPosition; 2084 //Vector3 pos = attemptedPosition;
2080 2085
2081 int changeX = 1; 2086 //int changeX = 1;
2082 int changeY = 1; 2087 //int changeY = 1;
2083 2088
2084 if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W)) 2089 //if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
2085 { 2090 //{
2086 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2091 // if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2087 { 2092 // {
2088 2093
2089 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2094 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2090 2095
2091 if (crossedBorderx.BorderLine.Z > 0) 2096 // if (crossedBorderx.BorderLine.Z > 0)
2092 { 2097 // {
2093 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2098 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2094 changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize); 2099 // changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
2095 } 2100 // }
2096 else 2101 // else
2097 pos.X = ((pos.X + Constants.RegionSize)); 2102 // pos.X = ((pos.X + Constants.RegionSize));
2098 2103
2099 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2104 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2100 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2105 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2101 2106
2102 if (crossedBordery.BorderLine.Z > 0) 2107 // if (crossedBordery.BorderLine.Z > 0)
2103 { 2108 // {
2104 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2109 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2105 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2110 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2106 } 2111 // }
2107 else 2112 // else
2108 pos.Y = ((pos.Y + Constants.RegionSize)); 2113 // pos.Y = ((pos.Y + Constants.RegionSize));
2109 2114
2110 2115
2111 2116
2112 newRegionHandle 2117 // newRegionHandle
2113 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2118 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2114 (uint)((thisy - changeY) * Constants.RegionSize)); 2119 // (uint)((thisy - changeY) * Constants.RegionSize));
2115 // x - 1 2120 // // x - 1
2116 // y - 1 2121 // // y - 1
2117 } 2122 // }
2118 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2123 // else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2119 { 2124 // {
2120 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2125 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2121 2126
2122 if (crossedBorderx.BorderLine.Z > 0) 2127 // if (crossedBorderx.BorderLine.Z > 0)
2123 { 2128 // {
2124 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2129 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2125 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); 2130 // changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2126 } 2131 // }
2127 else 2132 // else
2128 pos.X = ((pos.X + Constants.RegionSize)); 2133 // pos.X = ((pos.X + Constants.RegionSize));
2129 2134
2130 2135
2131 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2136 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2132 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2137 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2133 2138
2134 if (crossedBordery.BorderLine.Z > 0) 2139 // if (crossedBordery.BorderLine.Z > 0)
2135 { 2140 // {
2136 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2141 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2137 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2142 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2138 } 2143 // }
2139 else 2144 // else
2140 pos.Y = ((pos.Y + Constants.RegionSize)); 2145 // pos.Y = ((pos.Y + Constants.RegionSize));
2141 2146
2142 newRegionHandle 2147 // newRegionHandle
2143 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2148 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2144 (uint)((thisy + changeY) * Constants.RegionSize)); 2149 // (uint)((thisy + changeY) * Constants.RegionSize));
2145 // x - 1 2150 // // x - 1
2146 // y + 1 2151 // // y + 1
2147 } 2152 // }
2148 else 2153 // else
2149 { 2154 // {
2150 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); 2155 // Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2151 2156
2152 if (crossedBorderx.BorderLine.Z > 0) 2157 // if (crossedBorderx.BorderLine.Z > 0)
2153 { 2158 // {
2154 pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); 2159 // pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2155 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); 2160 // changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2156 } 2161 // }
2157 else 2162 // else
2158 pos.X = ((pos.X + Constants.RegionSize)); 2163 // pos.X = ((pos.X + Constants.RegionSize));
2159 2164
2160 newRegionHandle 2165 // newRegionHandle
2161 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2166 // = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2162 (uint) (thisy*Constants.RegionSize)); 2167 // (uint) (thisy*Constants.RegionSize));
2163 // x - 1 2168 // // x - 1
2164 } 2169 // }
2165 } 2170 //}
2166 else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E)) 2171 //else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
2167 { 2172 //{
2168 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2173 // if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2169 { 2174 // {
2170 2175
2171 pos.X = ((pos.X - Constants.RegionSize)); 2176 // pos.X = ((pos.X - Constants.RegionSize));
2172 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2177 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2173 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2178 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2174 2179
2175 if (crossedBordery.BorderLine.Z > 0) 2180 // if (crossedBordery.BorderLine.Z > 0)
2176 { 2181 // {
2177 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2182 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2178 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2183 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2179 } 2184 // }
2180 else 2185 // else
2181 pos.Y = ((pos.Y + Constants.RegionSize)); 2186 // pos.Y = ((pos.Y + Constants.RegionSize));
2182 2187
2183 2188
2184 newRegionHandle 2189 // newRegionHandle
2185 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2190 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2186 (uint)((thisy - changeY) * Constants.RegionSize)); 2191 // (uint)((thisy - changeY) * Constants.RegionSize));
2187 // x + 1 2192 // // x + 1
2188 // y - 1 2193 // // y - 1
2189 } 2194 // }
2190 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2195 // else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2191 { 2196 // {
2192 pos.X = ((pos.X - Constants.RegionSize)); 2197 // pos.X = ((pos.X - Constants.RegionSize));
2193 pos.Y = ((pos.Y - Constants.RegionSize)); 2198 // pos.Y = ((pos.Y - Constants.RegionSize));
2194 newRegionHandle 2199 // newRegionHandle
2195 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2200 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2196 (uint)((thisy + changeY) * Constants.RegionSize)); 2201 // (uint)((thisy + changeY) * Constants.RegionSize));
2197 // x + 1 2202 // // x + 1
2198 // y + 1 2203 // // y + 1
2199 } 2204 // }
2200 else 2205 // else
2201 { 2206 // {
2202 pos.X = ((pos.X - Constants.RegionSize)); 2207 // pos.X = ((pos.X - Constants.RegionSize));
2203 newRegionHandle 2208 // newRegionHandle
2204 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2209 // = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2205 (uint) (thisy*Constants.RegionSize)); 2210 // (uint) (thisy*Constants.RegionSize));
2206 // x + 1 2211 // // x + 1
2207 } 2212 // }
2208 } 2213 //}
2209 else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2214 //else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2210 { 2215 //{
2211 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2216 // Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2212 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2217 // //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2213 2218
2214 if (crossedBordery.BorderLine.Z > 0) 2219 // if (crossedBordery.BorderLine.Z > 0)
2215 { 2220 // {
2216 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2221 // pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2217 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2222 // changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2218 } 2223 // }
2219 else 2224 // else
2220 pos.Y = ((pos.Y + Constants.RegionSize)); 2225 // pos.Y = ((pos.Y + Constants.RegionSize));
2221 2226
2222 newRegionHandle 2227 // newRegionHandle
2223 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize)); 2228 // = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
2224 // y - 1 2229 // // y - 1
2225 } 2230 //}
2226 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) 2231 //else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2227 { 2232 //{
2228 2233
2229 pos.Y = ((pos.Y - Constants.RegionSize)); 2234 // pos.Y = ((pos.Y - Constants.RegionSize));
2230 newRegionHandle 2235 // newRegionHandle
2231 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize)); 2236 // = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
2232 // y + 1 2237 // // y + 1
2233 } 2238 //}
2234 2239
2235 // Offset the positions for the new region across the border 2240 //// Offset the positions for the new region across the border
2236 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 2241 //Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
2237 grp.OffsetForNewRegion(pos); 2242 //grp.OffsetForNewRegion(pos);
2238 2243
2239 // If we fail to cross the border, then reset the position of the scene object on that border. 2244 //// If we fail to cross the border, then reset the position of the scene object on that border.
2240 uint x = 0, y = 0; 2245 //uint x = 0, y = 0;
2241 Utils.LongToUInts(newRegionHandle, out x, out y); 2246 //Utils.LongToUInts(newRegionHandle, out x, out y);
2242 GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); 2247 //GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2243 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 2248 //if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
2244 { 2249 //{
2245 grp.OffsetForNewRegion(oldGroupPosition); 2250 // grp.OffsetForNewRegion(oldGroupPosition);
2246 grp.ScheduleGroupForFullUpdate(); 2251 // grp.ScheduleGroupForFullUpdate();
2247 } 2252 //}
2248 } 2253 }
2249 2254
2250 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 2255 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2c8c675..d185fba 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -218,6 +218,10 @@ namespace OpenSim.Region.Framework.Scenes
218 protected AvatarAppearance m_appearance; 218 protected AvatarAppearance m_appearance;
219 219
220 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 220 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
221 public List<SceneObjectGroup> Attachments
222 {
223 get { return m_attachments; }
224 }
221 225
222 // neighbouring regions we have enabled a child agent in 226 // neighbouring regions we have enabled a child agent in
223 // holds the seed cap for the child agent in that region 227 // holds the seed cap for the child agent in that region