From 412b555c27330de5cba17b958f46f23280c3f957 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 2 Jul 2009 02:46:40 +0000 Subject: Restore some lost functionality tot he combat module. Code that used to reside in the economy module was lost in the shuffle when that was moved to forge. Now it's where it belongs. --- .../Region/CoreModules/Avatar/Combat/CombatModule.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 456164a..171add8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -9,7 +9,7 @@ * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the + * * Neither the name of the OpenSim Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -30,6 +30,7 @@ using System.Collections.Generic; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenMetaverse; namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule { @@ -67,6 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule } scene.EventManager.OnAvatarKilled += KillAvatar; + scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; } public void PostInitialise() @@ -140,5 +142,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule DeadAvatar.Health = 100; DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient); } + + private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) + { + ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); + if ((obj.landData.Flags & (uint)Parcel.ParcelFlags.AllowDamage) != 0) + { + avatar.Invulnerable = false; + } + else + { + avatar.Invulnerable = true; + } + } } } -- cgit v1.1