diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 91e6e5a..7e49a5e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3312,23 +3312,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3312 | } | 3312 | } |
3313 | } | 3313 | } |
3314 | 3314 | ||
3315 | if (Invulnerable) | 3315 | // Gods do not take damage and Invulnerable is set depending on parcel/region flags |
3316 | if (Invulnerable || GodLevel > 0) | ||
3316 | return; | 3317 | return; |
3317 | 3318 | ||
3319 | // The following may be better in the ICombatModule | ||
3320 | // probably tweaking of the values for ground and normal prim collisions will be needed | ||
3318 | float starthealth = Health; | 3321 | float starthealth = Health; |
3319 | uint killerObj = 0; | 3322 | uint killerObj = 0; |
3323 | SceneObjectPart part = null; | ||
3320 | foreach (uint localid in coldata.Keys) | 3324 | foreach (uint localid in coldata.Keys) |
3321 | { | 3325 | { |
3322 | SceneObjectPart part = Scene.GetSceneObjectPart(localid); | 3326 | if (localid == 0) |
3323 | 3327 | { | |
3324 | if (part != null && part.ParentGroup.Damage != -1.0f) | 3328 | part = null; |
3325 | Health -= part.ParentGroup.Damage; | 3329 | } |
3330 | else | ||
3331 | { | ||
3332 | part = Scene.GetSceneObjectPart(localid); | ||
3333 | } | ||
3334 | if (part != null) | ||
3335 | { | ||
3336 | // Ignore if it has been deleted or volume detect | ||
3337 | if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) | ||
3338 | { | ||
3339 | if (part.ParentGroup.Damage > 0.0f) | ||
3340 | { | ||
3341 | // Something with damage... | ||
3342 | Health -= part.ParentGroup.Damage; | ||
3343 | part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); | ||
3344 | } | ||
3345 | else | ||
3346 | { | ||
3347 | // An ordinary prim | ||
3348 | if (coldata[localid].PenetrationDepth >= 0.10f) | ||
3349 | Health -= coldata[localid].PenetrationDepth * 5.0f; | ||
3350 | } | ||
3351 | } | ||
3352 | } | ||
3326 | else | 3353 | else |
3327 | { | 3354 | { |
3328 | if (coldata[localid].PenetrationDepth >= 0.10f) | 3355 | // 0 is the ground |
3356 | // what about collisions with other avatars? | ||
3357 | if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f) | ||
3329 | Health -= coldata[localid].PenetrationDepth * 5.0f; | 3358 | Health -= coldata[localid].PenetrationDepth * 5.0f; |
3330 | } | 3359 | } |
3331 | 3360 | ||
3361 | |||
3332 | if (Health <= 0.0f) | 3362 | if (Health <= 0.0f) |
3333 | { | 3363 | { |
3334 | if (localid != 0) | 3364 | if (localid != 0) |
@@ -3344,7 +3374,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3344 | ControllingClient.SendHealth(Health); | 3374 | ControllingClient.SendHealth(Health); |
3345 | } | 3375 | } |
3346 | if (Health <= 0) | 3376 | if (Health <= 0) |
3377 | { | ||
3347 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3378 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3379 | } | ||
3380 | if (starthealth == Health && Health < 100.0f) | ||
3381 | { | ||
3382 | Health += 0.03f; | ||
3383 | if (Health > 100.0f) | ||
3384 | Health = 100.0f; | ||
3385 | ControllingClient.SendHealth(Health); | ||
3386 | } | ||
3348 | } | 3387 | } |
3349 | } | 3388 | } |
3350 | 3389 | ||