Mantis 60004 problems with damage and llSetDamage. In damage enabled areas this patch - Deletes any objects that have damage set > 0 that deliver that damage to an avatar Stops Gods receiving damage, Stops volume detect objects causing damage Deletes NPCS when their helth reduces to zero Gradually "heals" damage to an avatar Resets health on going to a non damage area
parent
6096a1f30e
commit
92fde6ed26
|
@ -96,6 +96,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
ScenePresence killingAvatar = null;
|
ScenePresence killingAvatar = null;
|
||||||
// string killingAvatarMessage;
|
// string killingAvatarMessage;
|
||||||
|
|
||||||
|
// check to see if it is an NPC and just remove it
|
||||||
|
INPCModule NPCmodule = deadAvatar.Scene.RequestModuleInterface<INPCModule>();
|
||||||
|
if (NPCmodule != null && NPCmodule.DeleteNPC(deadAvatar.UUID, deadAvatar.Scene))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (killerObjectLocalID == 0)
|
if (killerObjectLocalID == 0)
|
||||||
deadAvatarMessage = "You committed suicide!";
|
deadAvatarMessage = "You committed suicide!";
|
||||||
else
|
else
|
||||||
|
@ -145,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
deadAvatar.Health = 100;
|
deadAvatar.setHealthWithUpdate(100.0f);
|
||||||
deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
|
deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,14 +161,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||||
|
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
|
||||||
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0)
|
|| avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
|
||||||
{
|
{
|
||||||
avatar.Invulnerable = false;
|
avatar.Invulnerable = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
avatar.Invulnerable = true;
|
avatar.Invulnerable = true;
|
||||||
|
if (avatar.Health < 100.0f)
|
||||||
|
{
|
||||||
|
avatar.setHealthWithUpdate(100.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
|
@ -3312,23 +3312,53 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Invulnerable)
|
// Gods do not take damage and Invulnerable is set depending on parcel/region flags
|
||||||
|
if (Invulnerable || GodLevel > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// The following may be better in the ICombatModule
|
||||||
|
// probably tweaking of the values for ground and normal prim collisions will be needed
|
||||||
float starthealth = Health;
|
float starthealth = Health;
|
||||||
uint killerObj = 0;
|
uint killerObj = 0;
|
||||||
|
SceneObjectPart part = null;
|
||||||
foreach (uint localid in coldata.Keys)
|
foreach (uint localid in coldata.Keys)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = Scene.GetSceneObjectPart(localid);
|
if (localid == 0)
|
||||||
|
{
|
||||||
if (part != null && part.ParentGroup.Damage != -1.0f)
|
part = null;
|
||||||
Health -= part.ParentGroup.Damage;
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (coldata[localid].PenetrationDepth >= 0.10f)
|
part = Scene.GetSceneObjectPart(localid);
|
||||||
|
}
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
// Ignore if it has been deleted or volume detect
|
||||||
|
if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect)
|
||||||
|
{
|
||||||
|
if (part.ParentGroup.Damage > 0.0f)
|
||||||
|
{
|
||||||
|
// Something with damage...
|
||||||
|
Health -= part.ParentGroup.Damage;
|
||||||
|
part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// An ordinary prim
|
||||||
|
if (coldata[localid].PenetrationDepth >= 0.10f)
|
||||||
|
Health -= coldata[localid].PenetrationDepth * 5.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 0 is the ground
|
||||||
|
// what about collisions with other avatars?
|
||||||
|
if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f)
|
||||||
Health -= coldata[localid].PenetrationDepth * 5.0f;
|
Health -= coldata[localid].PenetrationDepth * 5.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Health <= 0.0f)
|
if (Health <= 0.0f)
|
||||||
{
|
{
|
||||||
if (localid != 0)
|
if (localid != 0)
|
||||||
|
@ -3344,7 +3374,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ControllingClient.SendHealth(Health);
|
ControllingClient.SendHealth(Health);
|
||||||
}
|
}
|
||||||
if (Health <= 0)
|
if (Health <= 0)
|
||||||
|
{
|
||||||
m_scene.EventManager.TriggerAvatarKill(killerObj, this);
|
m_scene.EventManager.TriggerAvatarKill(killerObj, this);
|
||||||
|
}
|
||||||
|
if (starthealth == Health && Health < 100.0f)
|
||||||
|
{
|
||||||
|
Health += 0.03f;
|
||||||
|
if (Health > 100.0f)
|
||||||
|
Health = 100.0f;
|
||||||
|
ControllingClient.SendHealth(Health);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue