aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs69
1 files changed, 56 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 35c920b..5e275f6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1250,9 +1250,19 @@ namespace OpenSim.Region.Framework.Scenes
1250 1250
1251 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1251 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1252 MakeRootAgent(AbsolutePosition, flying); 1252 MakeRootAgent(AbsolutePosition, flying);
1253 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1254
1255// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1253 1256
1254 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1257 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1255 { 1258 {
1259 // We cannot sleep here since this would hold up the inbound packet processing thread, as
1260 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
1261 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
1262 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
1263 // region as the current region, meaning that a close sent before then will fail the teleport.
1264// System.Threading.Thread.Sleep(2000);
1265
1256 m_log.DebugFormat( 1266 m_log.DebugFormat(
1257 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", 1267 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
1258 client.Name, client.AgentId, m_callbackURI); 1268 client.Name, client.AgentId, m_callbackURI);
@@ -1261,9 +1271,6 @@ namespace OpenSim.Region.Framework.Scenes
1261 m_callbackURI = null; 1271 m_callbackURI = null;
1262 } 1272 }
1263 1273
1264// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1265
1266 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1267 ValidateAndSendAppearanceAndAgentData(); 1274 ValidateAndSendAppearanceAndAgentData();
1268 1275
1269 // Create child agents in neighbouring regions 1276 // Create child agents in neighbouring regions
@@ -1278,7 +1285,6 @@ namespace OpenSim.Region.Framework.Scenes
1278 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1285 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1279 } 1286 }
1280 1287
1281
1282// m_log.DebugFormat( 1288// m_log.DebugFormat(
1283// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1289// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1284// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1290// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
@@ -3453,25 +3459,53 @@ namespace OpenSim.Region.Framework.Scenes
3453 } 3459 }
3454 } 3460 }
3455 3461
3456 RaiseCollisionScriptEvents(coldata); 3462 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
3457 3463 if (Invulnerable || GodLevel > 0)
3458 if (Invulnerable)
3459 return; 3464 return;
3460 3465
3466 // The following may be better in the ICombatModule
3467 // probably tweaking of the values for ground and normal prim collisions will be needed
3461 float starthealth = Health; 3468 float starthealth = Health;
3462 uint killerObj = 0; 3469 uint killerObj = 0;
3470 SceneObjectPart part = null;
3463 foreach (uint localid in coldata.Keys) 3471 foreach (uint localid in coldata.Keys)
3464 { 3472 {
3465 SceneObjectPart part = Scene.GetSceneObjectPart(localid); 3473 if (localid == 0)
3466 3474 {
3467 if (part != null && part.ParentGroup.Damage != -1.0f) 3475 part = null;
3468 Health -= part.ParentGroup.Damage; 3476 }
3469 else 3477 else
3470 { 3478 {
3471 if (coldata[localid].PenetrationDepth >= 0.10f) 3479 part = Scene.GetSceneObjectPart(localid);
3480 }
3481 if (part != null)
3482 {
3483 // Ignore if it has been deleted or volume detect
3484 if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect)
3485 {
3486 if (part.ParentGroup.Damage > 0.0f)
3487 {
3488 // Something with damage...
3489 Health -= part.ParentGroup.Damage;
3490 part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false);
3491 }
3492 else
3493 {
3494 // An ordinary prim
3495 if (coldata[localid].PenetrationDepth >= 0.10f)
3496 Health -= coldata[localid].PenetrationDepth * 5.0f;
3497 }
3498 }
3499 }
3500 else
3501 {
3502 // 0 is the ground
3503 // what about collisions with other avatars?
3504 if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f)
3472 Health -= coldata[localid].PenetrationDepth * 5.0f; 3505 Health -= coldata[localid].PenetrationDepth * 5.0f;
3473 } 3506 }
3474 3507
3508
3475 if (Health <= 0.0f) 3509 if (Health <= 0.0f)
3476 { 3510 {
3477 if (localid != 0) 3511 if (localid != 0)
@@ -3487,7 +3521,16 @@ namespace OpenSim.Region.Framework.Scenes
3487 ControllingClient.SendHealth(Health); 3521 ControllingClient.SendHealth(Health);
3488 } 3522 }
3489 if (Health <= 0) 3523 if (Health <= 0)
3524 {
3490 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3525 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3526 }
3527 if (starthealth == Health && Health < 100.0f)
3528 {
3529 Health += 0.03f;
3530 if (Health > 100.0f)
3531 Health = 100.0f;
3532 ControllingClient.SendHealth(Health);
3533 }
3491 } 3534 }
3492 } 3535 }
3493 3536