diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 320 |
1 files changed, 225 insertions, 95 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f3ea89a..40de870 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -346,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | 346 | ||
347 | ForEachScenePresence(delegate(ScenePresence agent) | 347 | ForEachScenePresence(delegate(ScenePresence agent) |
348 | { | 348 | { |
349 | if (!(agent.IsChildAgent)) | 349 | if (!agent.IsChildAgent) |
350 | { | 350 | { |
351 | //agent.ControllingClient.new | 351 | //agent.ControllingClient.new |
352 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 352 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); |
@@ -368,24 +368,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
368 | public override void Close() | 368 | public override void Close() |
369 | { | 369 | { |
370 | ForEachScenePresence(delegate(ScenePresence avatar) | 370 | ForEachScenePresence(delegate(ScenePresence avatar) |
371 | { | 371 | { |
372 | if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) | 372 | if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) |
373 | avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); | 373 | avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); |
374 | 374 | ||
375 | if (!avatar.IsChildAgent) | 375 | if (!avatar.IsChildAgent) |
376 | avatar.ControllingClient.Kick("The simulator is going down."); | 376 | avatar.ControllingClient.Kick("The simulator is going down."); |
377 | 377 | ||
378 | avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); | 378 | avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); |
379 | |||
380 | }); | 379 | }); |
381 | 380 | ||
382 | Thread.Sleep(500); | 381 | Thread.Sleep(500); |
383 | 382 | ||
384 | ForEachScenePresence(delegate(ScenePresence avatar) | 383 | ForEachScenePresence(delegate(ScenePresence avatar) |
385 | { | 384 | { |
386 | |||
387 | avatar.ControllingClient.Stop(); | 385 | avatar.ControllingClient.Stop(); |
388 | |||
389 | }); | 386 | }); |
390 | 387 | ||
391 | m_heartbeatTimer.Close(); | 388 | m_heartbeatTimer.Close(); |
@@ -837,7 +834,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
837 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 834 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
838 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 835 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) |
839 | { | 836 | { |
840 | |||
841 | rootPart.PhysActor = | 837 | rootPart.PhysActor = |
842 | PhysicsScene.AddPrimShape( | 838 | PhysicsScene.AddPrimShape( |
843 | rootPart.Name, | 839 | rootPart.Name, |
@@ -912,8 +908,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
912 | /// <summary> | 908 | /// <summary> |
913 | /// | 909 | /// |
914 | /// </summary> | 910 | /// </summary> |
915 | /// <param name="remoteClient"></param | 911 | /// <param name="client"></param |
916 | /// <param name="agentID"></param> | ||
917 | /// <param name="child"></param> | 912 | /// <param name="child"></param> |
918 | public override void AddNewClient(IClientAPI client, bool child) | 913 | public override void AddNewClient(IClientAPI client, bool child) |
919 | { | 914 | { |
@@ -1029,17 +1024,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1029 | 1024 | ||
1030 | ScenePresence avatar = GetScenePresence(agentID); | 1025 | ScenePresence avatar = GetScenePresence(agentID); |
1031 | 1026 | ||
1032 | Broadcast(delegate(IClientAPI client) { | 1027 | Broadcast(delegate(IClientAPI client) |
1033 | try | 1028 | { |
1034 | { | 1029 | try |
1035 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | 1030 | { |
1036 | } | 1031 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); |
1037 | catch (System.NullReferenceException) | 1032 | } |
1038 | { | 1033 | catch (System.NullReferenceException) |
1039 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | 1034 | { |
1040 | 1035 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | |
1041 | } | 1036 | } |
1042 | }); | 1037 | }); |
1043 | 1038 | ||
1044 | ForEachScenePresence( | 1039 | ForEachScenePresence( |
1045 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); | 1040 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
@@ -1061,7 +1056,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1061 | catch (System.NullReferenceException) | 1056 | catch (System.NullReferenceException) |
1062 | { | 1057 | { |
1063 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | 1058 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. |
1064 | |||
1065 | } | 1059 | } |
1066 | catch (Exception e) | 1060 | catch (Exception e) |
1067 | { | 1061 | { |
@@ -1117,7 +1111,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1117 | m_sceneGridService.KillObject = SendKillObject; | 1111 | m_sceneGridService.KillObject = SendKillObject; |
1118 | } | 1112 | } |
1119 | 1113 | ||
1120 | 1114 | /// <summary> | |
1115 | /// | ||
1116 | /// </summary> | ||
1121 | public void UnRegisterReginWithComms() | 1117 | public void UnRegisterReginWithComms() |
1122 | { | 1118 | { |
1123 | m_sceneGridService.OnRegionUp -= OtherRegionUp; | 1119 | m_sceneGridService.OnRegionUp -= OtherRegionUp; |
@@ -1163,6 +1159,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1163 | } | 1159 | } |
1164 | } | 1160 | } |
1165 | 1161 | ||
1162 | /// <summary> | ||
1163 | /// | ||
1164 | /// </summary> | ||
1165 | /// <param name="regionHandle"></param> | ||
1166 | /// <param name="agentID"></param> | ||
1167 | /// <param name="position"></param> | ||
1168 | /// <param name="isFlying"></param> | ||
1166 | public virtual void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | 1169 | public virtual void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
1167 | { | 1170 | { |
1168 | if (regionHandle == m_regInfo.RegionHandle) | 1171 | if (regionHandle == m_regInfo.RegionHandle) |
@@ -1174,6 +1177,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1174 | } | 1177 | } |
1175 | } | 1178 | } |
1176 | 1179 | ||
1180 | /// <summary> | ||
1181 | /// | ||
1182 | /// </summary> | ||
1183 | /// <param name="regionHandle"></param> | ||
1184 | /// <param name="agentID"></param> | ||
1177 | public void CloseConnection(ulong regionHandle, LLUUID agentID) | 1185 | public void CloseConnection(ulong regionHandle, LLUUID agentID) |
1178 | { | 1186 | { |
1179 | if (regionHandle == m_regionHandle) | 1187 | if (regionHandle == m_regionHandle) |
@@ -1187,15 +1195,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1187 | } | 1195 | } |
1188 | } | 1196 | } |
1189 | 1197 | ||
1190 | |||
1191 | /// <summary> | 1198 | /// <summary> |
1192 | /// | 1199 | /// |
1193 | /// </summary> | 1200 | /// </summary> |
1201 | /// <param name="presence"></param> | ||
1194 | public void InformClientOfNeighbours(ScenePresence presence) | 1202 | public void InformClientOfNeighbours(ScenePresence presence) |
1195 | { | 1203 | { |
1196 | m_sceneGridService.EnableNeighbourChildAgents(presence); | 1204 | m_sceneGridService.EnableNeighbourChildAgents(presence); |
1197 | } | 1205 | } |
1198 | 1206 | ||
1207 | /// <summary> | ||
1208 | /// | ||
1209 | /// </summary> | ||
1210 | /// <param name="presence"></param> | ||
1211 | /// <param name="region"></param> | ||
1199 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | 1212 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) |
1200 | { | 1213 | { |
1201 | m_sceneGridService.InformNeighborChildAgent(presence, region); | 1214 | m_sceneGridService.InformNeighborChildAgent(presence, region); |
@@ -1214,6 +1227,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1214 | /// <summary> | 1227 | /// <summary> |
1215 | /// | 1228 | /// |
1216 | /// </summary> | 1229 | /// </summary> |
1230 | /// <param name="remoteClient"></param> | ||
1217 | /// <param name="minX"></param> | 1231 | /// <param name="minX"></param> |
1218 | /// <param name="minY"></param> | 1232 | /// <param name="minY"></param> |
1219 | /// <param name="maxX"></param> | 1233 | /// <param name="maxX"></param> |
@@ -1227,7 +1241,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1227 | /// | 1241 | /// |
1228 | /// </summary> | 1242 | /// </summary> |
1229 | /// <param name="remoteClient"></param> | 1243 | /// <param name="remoteClient"></param> |
1230 | /// <param name="RegionHandle"></param> | 1244 | /// <param name="regionHandle"></param> |
1231 | /// <param name="position"></param> | 1245 | /// <param name="position"></param> |
1232 | /// <param name="lookAt"></param> | 1246 | /// <param name="lookAt"></param> |
1233 | /// <param name="flags"></param> | 1247 | /// <param name="flags"></param> |
@@ -1243,18 +1257,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1243 | /// <summary> | 1257 | /// <summary> |
1244 | /// | 1258 | /// |
1245 | /// </summary> | 1259 | /// </summary> |
1246 | /// <param name="regionhandle"></param> | 1260 | /// <param name="regionHandle"></param> |
1247 | /// <param name="agentID"></param> | 1261 | /// <param name="agentID"></param> |
1248 | /// <param name="position"></param> | 1262 | /// <param name="position"></param> |
1249 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) | 1263 | /// <param name="isFlying"></param> |
1264 | /// <returns></returns> | ||
1265 | public bool InformNeighbourOfCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) | ||
1250 | { | 1266 | { |
1251 | return m_sceneGridService.CrossToNeighbouringRegion(regionhandle, agentID, position, isFlying); | 1267 | return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); |
1252 | } | 1268 | } |
1253 | 1269 | ||
1254 | #endregion | 1270 | #endregion |
1255 | 1271 | ||
1256 | #region Module Methods | 1272 | #region Module Methods |
1257 | 1273 | ||
1274 | /// <summary> | ||
1275 | /// | ||
1276 | /// </summary> | ||
1277 | /// <param name="name"></param> | ||
1278 | /// <param name="module"></param> | ||
1258 | public void AddModule(string name, IRegionModule module) | 1279 | public void AddModule(string name, IRegionModule module) |
1259 | { | 1280 | { |
1260 | if (!Modules.ContainsKey(name)) | 1281 | if (!Modules.ContainsKey(name)) |
@@ -1263,6 +1284,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1263 | } | 1284 | } |
1264 | } | 1285 | } |
1265 | 1286 | ||
1287 | /// <summary> | ||
1288 | /// | ||
1289 | /// </summary> | ||
1290 | /// <param name="mod"></param> | ||
1266 | public void RegisterModuleInterface<M>(M mod) | 1291 | public void RegisterModuleInterface<M>(M mod) |
1267 | { | 1292 | { |
1268 | if (!ModuleInterfaces.ContainsKey(typeof(M))) | 1293 | if (!ModuleInterfaces.ContainsKey(typeof(M))) |
@@ -1271,6 +1296,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1271 | } | 1296 | } |
1272 | } | 1297 | } |
1273 | 1298 | ||
1299 | /// <summary> | ||
1300 | /// | ||
1301 | /// </summary> | ||
1302 | /// <returns></returns> | ||
1274 | public T RequestModuleInterface<T>() | 1303 | public T RequestModuleInterface<T>() |
1275 | { | 1304 | { |
1276 | if (ModuleInterfaces.ContainsKey(typeof(T))) | 1305 | if (ModuleInterfaces.ContainsKey(typeof(T))) |
@@ -1287,21 +1316,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
1287 | 1316 | ||
1288 | #region Other Methods | 1317 | #region Other Methods |
1289 | 1318 | ||
1319 | /// <summary> | ||
1320 | /// | ||
1321 | /// </summary> | ||
1322 | /// <param name="phase"></param> | ||
1290 | public void SetTimePhase(int phase) | 1323 | public void SetTimePhase(int phase) |
1291 | { | 1324 | { |
1292 | m_timePhase = phase; | 1325 | m_timePhase = phase; |
1293 | } | 1326 | } |
1294 | 1327 | ||
1295 | public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, | 1328 | /// <summary> |
1329 | /// | ||
1330 | /// </summary> | ||
1331 | /// <param name="avatarID"></param> | ||
1332 | /// <param name="objectName"></param> | ||
1333 | /// <param name="objectID"></param> | ||
1334 | /// <param name="ownerID"></param> | ||
1335 | /// <param name="groupOwned"></param> | ||
1336 | /// <param name="message"></param> | ||
1337 | /// <param name="url"></param> | ||
1338 | public void SendUrlToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, bool groupOwned, | ||
1296 | string message, string url) | 1339 | string message, string url) |
1297 | { | 1340 | { |
1298 | if (m_scenePresences.ContainsKey(avatarID)) | 1341 | if (m_scenePresences.ContainsKey(avatarID)) |
1299 | { | 1342 | { |
1300 | m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, | 1343 | m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, |
1301 | message, url); | 1344 | message, url); |
1302 | } | 1345 | } |
1303 | } | 1346 | } |
1304 | 1347 | ||
1348 | /// <summary> | ||
1349 | /// | ||
1350 | /// </summary> | ||
1351 | /// <param name="url"></param> | ||
1352 | /// <param name="type"></param> | ||
1353 | /// <param name="body"></param> | ||
1354 | /// <returns></returns> | ||
1305 | public LLUUID MakeHttpRequest(string url, string type, string body) | 1355 | public LLUUID MakeHttpRequest(string url, string type, string body) |
1306 | { | 1356 | { |
1307 | if (m_httpRequestModule != null) | 1357 | if (m_httpRequestModule != null) |
@@ -1311,6 +1361,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1311 | return LLUUID.Zero; | 1361 | return LLUUID.Zero; |
1312 | } | 1362 | } |
1313 | 1363 | ||
1364 | /// <summary> | ||
1365 | /// | ||
1366 | /// </summary> | ||
1314 | public void performParcelPrimCountUpdate() | 1367 | public void performParcelPrimCountUpdate() |
1315 | { | 1368 | { |
1316 | m_LandManager.resetAllLandPrimCounts(); | 1369 | m_LandManager.resetAllLandPrimCounts(); |
@@ -1319,6 +1372,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1319 | m_LandManager.landPrimCountTainted = false; | 1372 | m_LandManager.landPrimCountTainted = false; |
1320 | } | 1373 | } |
1321 | 1374 | ||
1375 | /// <summary> | ||
1376 | /// | ||
1377 | /// </summary> | ||
1322 | public void addPrimsToParcelCounts() | 1378 | public void addPrimsToParcelCounts() |
1323 | { | 1379 | { |
1324 | foreach (EntityBase obj in Entities.Values) | 1380 | foreach (EntityBase obj in Entities.Values) |
@@ -1340,6 +1396,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1340 | SendAlertToUser(user, reason, false); | 1396 | SendAlertToUser(user, reason, false); |
1341 | } | 1397 | } |
1342 | 1398 | ||
1399 | /// <summary> | ||
1400 | /// | ||
1401 | /// </summary> | ||
1402 | /// <param name="message"></param> | ||
1343 | public void SendGeneralAlert(string message) | 1403 | public void SendGeneralAlert(string message) |
1344 | { | 1404 | { |
1345 | foreach (ScenePresence presence in m_scenePresences.Values) | 1405 | foreach (ScenePresence presence in m_scenePresences.Values) |
@@ -1348,6 +1408,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1348 | } | 1408 | } |
1349 | } | 1409 | } |
1350 | 1410 | ||
1411 | /// <summary> | ||
1412 | /// | ||
1413 | /// </summary> | ||
1414 | /// <param name="agentID"></param> | ||
1415 | /// <param name="message"></param> | ||
1416 | /// <param name="modal"></param> | ||
1351 | public void SendAlertToUser(LLUUID agentID, string message, bool modal) | 1417 | public void SendAlertToUser(LLUUID agentID, string message, bool modal) |
1352 | { | 1418 | { |
1353 | if (m_scenePresences.ContainsKey(agentID)) | 1419 | if (m_scenePresences.ContainsKey(agentID)) |
@@ -1356,13 +1422,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1356 | } | 1422 | } |
1357 | } | 1423 | } |
1358 | 1424 | ||
1359 | public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingclient) | 1425 | /// <summary> |
1426 | /// | ||
1427 | /// </summary> | ||
1428 | /// <param name="agentID"></param> | ||
1429 | /// <param name="sessionID"></param> | ||
1430 | /// <param name="token"></param> | ||
1431 | /// <param name="controllingClient"></param> | ||
1432 | public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingClient) | ||
1360 | { | 1433 | { |
1361 | // First check that this is the sim owner | 1434 | // First check that this is the sim owner |
1362 | |||
1363 | if (agentID == RegionInfo.MasterAvatarAssignedUUID) | 1435 | if (agentID == RegionInfo.MasterAvatarAssignedUUID) |
1364 | { | 1436 | { |
1365 | |||
1366 | // User needs to be logged into this sim | 1437 | // User needs to be logged into this sim |
1367 | if (m_scenePresences.ContainsKey(agentID)) | 1438 | if (m_scenePresences.ContainsKey(agentID)) |
1368 | { | 1439 | { |
@@ -1370,14 +1441,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1370 | LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; | 1441 | LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; |
1371 | if (sessionID == testSessionID) | 1442 | if (sessionID == testSessionID) |
1372 | { | 1443 | { |
1373 | if (sessionID == controllingclient.SessionId) | 1444 | if (sessionID == controllingClient.SessionId) |
1374 | { | 1445 | { |
1375 | m_scenePresences[agentID].GrantGodlikePowers(agentID, testSessionID, token); | 1446 | m_scenePresences[agentID].GrantGodlikePowers(agentID, testSessionID, token); |
1376 | |||
1377 | } | 1447 | } |
1378 | |||
1379 | } | 1448 | } |
1380 | |||
1381 | } | 1449 | } |
1382 | } | 1450 | } |
1383 | else | 1451 | else |
@@ -1386,82 +1454,94 @@ namespace OpenSim.Region.Environment.Scenes | |||
1386 | } | 1454 | } |
1387 | } | 1455 | } |
1388 | 1456 | ||
1389 | public void handleGodlikeKickUser(LLUUID godid, LLUUID sessionid, LLUUID agentid, uint kickflags, byte[] reason) | 1457 | /// <summary> |
1458 | /// | ||
1459 | /// </summary> | ||
1460 | /// <param name="godID"></param> | ||
1461 | /// <param name="sessionID"></param> | ||
1462 | /// <param name="agentID"></param> | ||
1463 | /// <param name="kickflags"></param> | ||
1464 | /// <param name="reason"></param> | ||
1465 | public void handleGodlikeKickUser(LLUUID godID, LLUUID sessionID, LLUUID agentID, uint kickflags, byte[] reason) | ||
1390 | { | 1466 | { |
1391 | // For some reason the client sends the seemingly hard coded, 44e87126e7944ded05b37c42da3d5cdb | 1467 | // For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know. |
1392 | // for kicking everyone. Dun-know. | 1468 | LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); |
1393 | if (m_scenePresences.ContainsKey(agentid) || agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) | 1469 | if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) |
1394 | { | 1470 | { |
1395 | if (godid == RegionInfo.MasterAvatarAssignedUUID) | 1471 | if (godID == RegionInfo.MasterAvatarAssignedUUID) |
1396 | { | 1472 | { |
1397 | if (agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) | 1473 | if (agentID == kickUserID) |
1398 | { | 1474 | { |
1399 | |||
1400 | ClientManager.ForEachClient(delegate(IClientAPI controller) | 1475 | ClientManager.ForEachClient(delegate(IClientAPI controller) |
1401 | { | 1476 | { |
1402 | ScenePresence p = GetScenePresence(controller.AgentId); | 1477 | ScenePresence p = GetScenePresence(controller.AgentId); |
1403 | bool childagent = false; | 1478 | bool childagent = !p.Equals(null) && p.IsChildAgent; |
1404 | if (!p.Equals(null)) | 1479 | if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? |
1405 | if (p.IsChildAgent) | 1480 | { |
1406 | childagent = true; | 1481 | controller.Kick(Helpers.FieldToUTF8String(reason)); |
1407 | if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? | 1482 | } |
1408 | { | 1483 | } |
1409 | controller.Kick(Helpers.FieldToUTF8String(reason)); | 1484 | ); |
1410 | |||
1411 | } | ||
1412 | } | ||
1413 | ); | ||
1414 | // This is a bit crude. It seems the client will be null before it actually stops the thread | 1485 | // This is a bit crude. It seems the client will be null before it actually stops the thread |
1415 | // The thread will kill itself eventually :/ | 1486 | // The thread will kill itself eventually :/ |
1416 | // Is there another way to make sure *all* clients get this 'inter region' message? | 1487 | // Is there another way to make sure *all* clients get this 'inter region' message? |
1417 | ClientManager.ForEachClient(delegate(IClientAPI controller) | 1488 | ClientManager.ForEachClient(delegate(IClientAPI controller) |
1418 | { | 1489 | { |
1419 | ScenePresence p = GetScenePresence(controller.AgentId); | 1490 | ScenePresence p = GetScenePresence(controller.AgentId); |
1420 | bool childagent = false; | 1491 | bool childagent = !p.Equals(null) && p.IsChildAgent; |
1421 | if (!p.Equals(null)) | 1492 | if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? |
1422 | if (p.IsChildAgent) | 1493 | { |
1423 | childagent = true; | 1494 | controller.Close(); |
1424 | 1495 | } | |
1425 | if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? | 1496 | } |
1426 | { | 1497 | ); |
1427 | controller.Close(); | ||
1428 | } | ||
1429 | } | ||
1430 | ); | ||
1431 | } | 1498 | } |
1432 | else | 1499 | else |
1433 | { | 1500 | { |
1434 | m_scenePresences[agentid].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); | 1501 | m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); |
1435 | m_scenePresences[agentid].ControllingClient.Close(); | 1502 | m_scenePresences[agentID].ControllingClient.Close(); |
1436 | } | 1503 | } |
1437 | } | 1504 | } |
1438 | else | 1505 | else |
1439 | { | 1506 | { |
1440 | if (m_scenePresences.ContainsKey(godid)) | 1507 | if (m_scenePresences.ContainsKey(godID)) |
1441 | m_scenePresences[godid].ControllingClient.SendAgentAlertMessage("Kick request denied", false); | 1508 | m_scenePresences[godID].ControllingClient.SendAgentAlertMessage("Kick request denied", false); |
1442 | } | 1509 | } |
1443 | } | 1510 | } |
1444 | } | 1511 | } |
1445 | public void HandleObjectPermissionsUpdate (IClientAPI controller, LLUUID AgentID, LLUUID SessionID, List<libsecondlife.Packets.ObjectPermissionsPacket.ObjectDataBlock> permChanges) | 1512 | |
1513 | /// <summary> | ||
1514 | /// | ||
1515 | /// </summary> | ||
1516 | /// <param name="controller"></param> | ||
1517 | /// <param name="agentID"></param> | ||
1518 | /// <param name="sessionID"></param> | ||
1519 | /// <param name="permChanges"></param> | ||
1520 | public void HandleObjectPermissionsUpdate (IClientAPI controller, LLUUID agentID, LLUUID sessionID, List<libsecondlife.Packets.ObjectPermissionsPacket.ObjectDataBlock> permChanges) | ||
1446 | { | 1521 | { |
1447 | // Check for spoofing.. since this is permissions we're talking about here! | 1522 | // Check for spoofing.. since this is permissions we're talking about here! |
1448 | if ((controller.SessionId == SessionID) && (controller.AgentId == AgentID)) | 1523 | if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) |
1449 | { | 1524 | { |
1450 | for (int i = 0; i < permChanges.Count; i++) | 1525 | for (int i = 0; i < permChanges.Count; i++) |
1451 | { | 1526 | { |
1452 | |||
1453 | // Tell the object to do permission update | 1527 | // Tell the object to do permission update |
1454 | byte field = permChanges[i].Field; | 1528 | byte field = permChanges[i].Field; |
1455 | uint localID = permChanges[i].ObjectLocalID; | 1529 | uint localID = permChanges[i].ObjectLocalID; |
1456 | uint mask = permChanges[i].Mask; | 1530 | uint mask = permChanges[i].Mask; |
1457 | byte addRemTF = permChanges[i].Set; | 1531 | byte addRemTF = permChanges[i].Set; |
1458 | SceneObjectGroup chObjectGroup = GetGroupByPrim(localID); | 1532 | SceneObjectGroup chObjectGroup = GetGroupByPrim(localID); |
1459 | chObjectGroup.UpdatePermissions(AgentID, field, localID, mask, addRemTF); | 1533 | chObjectGroup.UpdatePermissions(agentID, field, localID, mask, addRemTF); |
1460 | |||
1461 | } | 1534 | } |
1462 | } | 1535 | } |
1463 | |||
1464 | } | 1536 | } |
1537 | |||
1538 | /// <summary> | ||
1539 | /// | ||
1540 | /// </summary> | ||
1541 | /// <param name="firstName"></param> | ||
1542 | /// <param name="lastName"></param> | ||
1543 | /// <param name="message"></param> | ||
1544 | /// <param name="modal"></param> | ||
1465 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) | 1545 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) |
1466 | { | 1546 | { |
1467 | foreach (ScenePresence presence in m_scenePresences.Values) | 1547 | foreach (ScenePresence presence in m_scenePresences.Values) |
@@ -1474,6 +1554,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1474 | } | 1554 | } |
1475 | } | 1555 | } |
1476 | 1556 | ||
1557 | /// <summary> | ||
1558 | /// | ||
1559 | /// </summary> | ||
1560 | /// <param name="commandParams"></param> | ||
1477 | public void HandleAlertCommand(string[] commandParams) | 1561 | public void HandleAlertCommand(string[] commandParams) |
1478 | { | 1562 | { |
1479 | if (commandParams[0] == "general") | 1563 | if (commandParams[0] == "general") |
@@ -1500,6 +1584,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1500 | 1584 | ||
1501 | #endregion | 1585 | #endregion |
1502 | 1586 | ||
1587 | /// <summary> | ||
1588 | /// | ||
1589 | /// </summary> | ||
1503 | public void ForceClientUpdate() | 1590 | public void ForceClientUpdate() |
1504 | { | 1591 | { |
1505 | foreach (EntityBase ent in Entities.Values) | 1592 | foreach (EntityBase ent in Entities.Values) |
@@ -1511,9 +1598,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1511 | } | 1598 | } |
1512 | } | 1599 | } |
1513 | 1600 | ||
1514 | public void HandleEditCommand(string[] cmmdparams) | 1601 | /// <summary> |
1602 | /// | ||
1603 | /// </summary> | ||
1604 | /// <param name="cmdparams"></param> | ||
1605 | public void HandleEditCommand(string[] cmdparams) | ||
1515 | { | 1606 | { |
1516 | Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); | 1607 | Console.WriteLine("Searching for Primitive: '" + cmdparams[0] + "'"); |
1517 | foreach (EntityBase ent in Entities.Values) | 1608 | foreach (EntityBase ent in Entities.Values) |
1518 | { | 1609 | { |
1519 | if (ent is SceneObjectGroup) | 1610 | if (ent is SceneObjectGroup) |
@@ -1521,11 +1612,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1521 | SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); | 1612 | SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); |
1522 | if (part != null) | 1613 | if (part != null) |
1523 | { | 1614 | { |
1524 | if (part.Name == cmmdparams[0]) | 1615 | if (part.Name == cmdparams[0]) |
1525 | { | 1616 | { |
1526 | part.Resize( | 1617 | part.Resize( |
1527 | new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), | 1618 | new LLVector3(Convert.ToSingle(cmdparams[1]), Convert.ToSingle(cmdparams[2]), |
1528 | Convert.ToSingle(cmmdparams[3]))); | 1619 | Convert.ToSingle(cmdparams[3]))); |
1529 | 1620 | ||
1530 | Console.WriteLine("Edited scale of Primitive: " + part.Name); | 1621 | Console.WriteLine("Edited scale of Primitive: " + part.Name); |
1531 | } | 1622 | } |
@@ -1534,9 +1625,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1534 | } | 1625 | } |
1535 | } | 1626 | } |
1536 | 1627 | ||
1537 | public void Show(string ShowWhat) | 1628 | /// <summary> |
1629 | /// | ||
1630 | /// </summary> | ||
1631 | /// <param name="showWhat"></param> | ||
1632 | public void Show(string showWhat) | ||
1538 | { | 1633 | { |
1539 | switch (ShowWhat) | 1634 | switch (showWhat) |
1540 | { | 1635 | { |
1541 | case "users": | 1636 | case "users": |
1542 | MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); | 1637 | MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); |
@@ -1574,6 +1669,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1574 | 1669 | ||
1575 | #region Script Handling Methods | 1670 | #region Script Handling Methods |
1576 | 1671 | ||
1672 | /// <summary> | ||
1673 | /// | ||
1674 | /// </summary> | ||
1675 | /// <param name="args"></param> | ||
1577 | public void SendCommandToPlugins(string[] args) | 1676 | public void SendCommandToPlugins(string[] args) |
1578 | { | 1677 | { |
1579 | m_eventManager.TriggerOnPluginConsole(args); | 1678 | m_eventManager.TriggerOnPluginConsole(args); |
@@ -1586,22 +1685,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
1586 | private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); | 1685 | private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); |
1587 | private bool m_dumpAssetsToFile; | 1686 | private bool m_dumpAssetsToFile; |
1588 | 1687 | ||
1589 | public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger) | 1688 | /// <summary> |
1689 | /// | ||
1690 | /// </summary> | ||
1691 | /// <param name="scriptEngine"></param> | ||
1692 | /// <param name="logger"></param> | ||
1693 | public void AddScriptEngine(ScriptEngineInterface scriptEngine, LogBase logger) | ||
1590 | { | 1694 | { |
1591 | ScriptEngines.Add(ScriptEngine); | 1695 | ScriptEngines.Add(scriptEngine); |
1592 | 1696 | scriptEngine.InitializeEngine(this, logger); | |
1593 | ScriptEngine.InitializeEngine(this, m_logger); | ||
1594 | } | 1697 | } |
1595 | 1698 | ||
1596 | #endregion | 1699 | #endregion |
1597 | 1700 | ||
1598 | #region InnerScene wrapper methods | 1701 | #region InnerScene wrapper methods |
1599 | 1702 | ||
1703 | /// <summary> | ||
1704 | /// | ||
1705 | /// </summary> | ||
1706 | /// <param name="localID"></param> | ||
1707 | /// <returns></returns> | ||
1600 | public LLUUID ConvertLocalIDToFullID(uint localID) | 1708 | public LLUUID ConvertLocalIDToFullID(uint localID) |
1601 | { | 1709 | { |
1602 | return m_innerScene.ConvertLocalIDToFullID(localID); | 1710 | return m_innerScene.ConvertLocalIDToFullID(localID); |
1603 | } | 1711 | } |
1604 | 1712 | ||
1713 | /// <summary> | ||
1714 | /// | ||
1715 | /// </summary> | ||
1716 | /// <param name="presence"></param> | ||
1605 | public void SendAllSceneObjectsToClient(ScenePresence presence) | 1717 | public void SendAllSceneObjectsToClient(ScenePresence presence) |
1606 | { | 1718 | { |
1607 | m_innerScene.SendAllSceneObjectsToClient(presence); | 1719 | m_innerScene.SendAllSceneObjectsToClient(presence); |
@@ -1610,6 +1722,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1610 | //The idea is to have a group of method that return a list of avatars meeting some requirement | 1722 | //The idea is to have a group of method that return a list of avatars meeting some requirement |
1611 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. | 1723 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. |
1612 | 1724 | ||
1725 | /// <summary> | ||
1726 | /// | ||
1727 | /// </summary> | ||
1728 | /// <returns></returns> | ||
1613 | public List<ScenePresence> GetAvatars() | 1729 | public List<ScenePresence> GetAvatars() |
1614 | { | 1730 | { |
1615 | return m_innerScene.GetAvatars(); | 1731 | return m_innerScene.GetAvatars(); |
@@ -1627,6 +1743,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1627 | /// <summary> | 1743 | /// <summary> |
1628 | /// Request a filtered list of m_scenePresences in this World | 1744 | /// Request a filtered list of m_scenePresences in this World |
1629 | /// </summary> | 1745 | /// </summary> |
1746 | /// <param name="filter"></param> | ||
1630 | /// <returns></returns> | 1747 | /// <returns></returns> |
1631 | public List<ScenePresence> GetScenePresences(FilterAvatarList filter) | 1748 | public List<ScenePresence> GetScenePresences(FilterAvatarList filter) |
1632 | { | 1749 | { |
@@ -1659,6 +1776,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1659 | } | 1776 | } |
1660 | } | 1777 | } |
1661 | 1778 | ||
1779 | /// <summary> | ||
1780 | /// | ||
1781 | /// </summary> | ||
1782 | /// <param name="action"></param> | ||
1662 | public void ForEachObject(Action<SceneObjectGroup> action) | 1783 | public void ForEachObject(Action<SceneObjectGroup> action) |
1663 | { | 1784 | { |
1664 | foreach (SceneObjectGroup presence in m_sceneObjects.Values) | 1785 | foreach (SceneObjectGroup presence in m_sceneObjects.Values) |
@@ -1667,11 +1788,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1667 | } | 1788 | } |
1668 | } | 1789 | } |
1669 | 1790 | ||
1791 | /// <summary> | ||
1792 | /// | ||
1793 | /// </summary> | ||
1794 | /// <param name="localID"></param> | ||
1795 | /// <returns></returns> | ||
1670 | public SceneObjectPart GetSceneObjectPart(uint localID) | 1796 | public SceneObjectPart GetSceneObjectPart(uint localID) |
1671 | { | 1797 | { |
1672 | return m_innerScene.GetSceneObjectPart(localID); | 1798 | return m_innerScene.GetSceneObjectPart(localID); |
1673 | } | 1799 | } |
1674 | 1800 | ||
1801 | /// <summary> | ||
1802 | /// | ||
1803 | /// </summary> | ||
1804 | /// <param name="fullID"></param> | ||
1805 | /// <returns></returns> | ||
1675 | public SceneObjectPart GetSceneObjectPart(LLUUID fullID) | 1806 | public SceneObjectPart GetSceneObjectPart(LLUUID fullID) |
1676 | { | 1807 | { |
1677 | return m_innerScene.GetSceneObjectPart(fullID); | 1808 | return m_innerScene.GetSceneObjectPart(fullID); |
@@ -1682,7 +1813,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1682 | return m_innerScene.TryGetAvatar(avatarId, out avatar); | 1813 | return m_innerScene.TryGetAvatar(avatarId, out avatar); |
1683 | } | 1814 | } |
1684 | 1815 | ||
1685 | |||
1686 | internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 1816 | internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
1687 | { | 1817 | { |
1688 | return m_innerScene.TryGetAvatarByName(avatarName, out avatar); | 1818 | return m_innerScene.TryGetAvatarByName(avatarName, out avatar); |