aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs53
2 files changed, 60 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 0babeb5..3a91465 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -96,6 +96,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
96 ScenePresence killingAvatar = null; 96 ScenePresence killingAvatar = null;
97// string killingAvatarMessage; 97// string killingAvatarMessage;
98 98
99 // check to see if it is an NPC and just remove it
100 INPCModule NPCmodule = deadAvatar.Scene.RequestModuleInterface<INPCModule>();
101 if (NPCmodule != null && NPCmodule.DeleteNPC(deadAvatar.UUID, deadAvatar.Scene))
102 {
103 return;
104 }
105
99 if (killerObjectLocalID == 0) 106 if (killerObjectLocalID == 0)
100 deadAvatarMessage = "You committed suicide!"; 107 deadAvatarMessage = "You committed suicide!";
101 else 108 else
@@ -145,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
145 catch (InvalidOperationException) 152 catch (InvalidOperationException)
146 { } 153 { }
147 154
148 deadAvatar.Health = 100; 155 deadAvatar.setHealthWithUpdate(100.0f);
149 deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient); 156 deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
150 } 157 }
151 158
@@ -154,14 +161,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
154 try 161 try
155 { 162 {
156 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 163 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
157 164 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
158 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) 165 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
159 { 166 {
160 avatar.Invulnerable = false; 167 avatar.Invulnerable = false;
161 } 168 }
162 else 169 else
163 { 170 {
164 avatar.Invulnerable = true; 171 avatar.Invulnerable = true;
172 if (avatar.Health < 100.0f)
173 {
174 avatar.setHealthWithUpdate(100.0f);
175 }
165 } 176 }
166 } 177 }
167 catch (Exception) 178 catch (Exception)
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