diff options
Diffstat (limited to '')
4 files changed, 147 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index 966c5e2..aa7e690 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs | |||
@@ -186,6 +186,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
186 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 186 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
187 | scene.EventManager.OnValidateLandBuy += ValidateLandBuy; | 187 | scene.EventManager.OnValidateLandBuy += ValidateLandBuy; |
188 | scene.EventManager.OnLandBuy += processLandBuy; | 188 | scene.EventManager.OnLandBuy += processLandBuy; |
189 | scene.EventManager.OnAvatarKilled += KillAvatar; | ||
189 | } | 190 | } |
190 | } | 191 | } |
191 | 192 | ||
@@ -1390,7 +1391,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
1390 | { | 1391 | { |
1391 | if (avatar.Scene.RegionInfo.originRegionID != m_rootAgents[avatar.UUID]) | 1392 | if (avatar.Scene.RegionInfo.originRegionID != m_rootAgents[avatar.UUID]) |
1392 | { | 1393 | { |
1394 | |||
1395 | |||
1393 | m_rootAgents[avatar.UUID] = avatar.Scene.RegionInfo.originRegionID; | 1396 | m_rootAgents[avatar.UUID] = avatar.Scene.RegionInfo.originRegionID; |
1397 | |||
1398 | |||
1394 | //m_log.Info("[MONEY]: Claiming " + avatar.Firstname + " " + avatar.Lastname + " in region:" + avatar.RegionHandle + "."); | 1399 | //m_log.Info("[MONEY]: Claiming " + avatar.Firstname + " " + avatar.Lastname + " in region:" + avatar.RegionHandle + "."); |
1395 | // Claim User! my user! Mine mine mine! | 1400 | // Claim User! my user! Mine mine mine! |
1396 | if (m_MoneyAddress.Length > 0) | 1401 | if (m_MoneyAddress.Length > 0) |
@@ -1400,12 +1405,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
1400 | { | 1405 | { |
1401 | Hashtable hresult = | 1406 | Hashtable hresult = |
1402 | claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret); | 1407 | claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret); |
1403 | if ((bool) hresult["success"] == true) | 1408 | if ((bool)hresult["success"] == true) |
1404 | { | 1409 | { |
1405 | int funds = 0; | 1410 | int funds = 0; |
1406 | try | 1411 | try |
1407 | { | 1412 | { |
1408 | funds = (Int32) hresult["funds"]; | 1413 | funds = (Int32)hresult["funds"]; |
1409 | } | 1414 | } |
1410 | catch (InvalidCastException) | 1415 | catch (InvalidCastException) |
1411 | { | 1416 | { |
@@ -1414,11 +1419,23 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
1414 | } | 1419 | } |
1415 | else | 1420 | else |
1416 | { | 1421 | { |
1417 | avatar.ControllingClient.SendAgentAlertMessage((string) hresult["errorMessage"], true); | 1422 | avatar.ControllingClient.SendAgentAlertMessage((string)hresult["errorMessage"], true); |
1418 | } | 1423 | } |
1419 | } | 1424 | } |
1420 | } | 1425 | } |
1421 | } | 1426 | } |
1427 | else | ||
1428 | { | ||
1429 | ILandObject obj = avatar.Scene.LandChannel.getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
1430 | if ((obj.landData.landFlags & (uint)Parcel.ParcelFlags.AllowDamage) != 0) | ||
1431 | { | ||
1432 | avatar.Invulnerable = false; | ||
1433 | } | ||
1434 | else | ||
1435 | { | ||
1436 | avatar.Invulnerable = true; | ||
1437 | } | ||
1438 | } | ||
1422 | } | 1439 | } |
1423 | else | 1440 | else |
1424 | { | 1441 | { |
@@ -1457,6 +1474,60 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
1457 | //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); | 1474 | //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); |
1458 | } | 1475 | } |
1459 | 1476 | ||
1477 | private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) | ||
1478 | { | ||
1479 | if (killerObjectLocalID == 0) | ||
1480 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You committed suicide!", true); | ||
1481 | else | ||
1482 | { | ||
1483 | bool foundResult = false; | ||
1484 | string resultstring = ""; | ||
1485 | List<ScenePresence> allav = DeadAvatar.Scene.GetScenePresences(); | ||
1486 | try | ||
1487 | { | ||
1488 | foreach (ScenePresence av in allav) | ||
1489 | { | ||
1490 | if (av.LocalId == killerObjectLocalID) | ||
1491 | { | ||
1492 | av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname); | ||
1493 | resultstring = av.Firstname + " " + av.Lastname; | ||
1494 | foundResult = true; | ||
1495 | } | ||
1496 | } | ||
1497 | } catch (System.InvalidOperationException) | ||
1498 | { | ||
1499 | |||
1500 | } | ||
1501 | |||
1502 | if (!foundResult) | ||
1503 | { | ||
1504 | SceneObjectPart part = DeadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID); | ||
1505 | if (part != null) | ||
1506 | { | ||
1507 | ScenePresence av = DeadAvatar.Scene.GetScenePresence(part.OwnerID); | ||
1508 | if (av != null) | ||
1509 | { | ||
1510 | av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname); | ||
1511 | resultstring = av.Firstname + " " + av.Lastname; | ||
1512 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You got killed by " + resultstring + "!", true); | ||
1513 | } | ||
1514 | else | ||
1515 | { | ||
1516 | string killer = DeadAvatar.Scene.CommsManager.UUIDNameRequestString(part.OwnerID); | ||
1517 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You impailed yourself on " + part.Name + " owned by " + killer +"!", true); | ||
1518 | } | ||
1519 | //DeadAvatar.Scene. part.ObjectOwner | ||
1520 | } | ||
1521 | else | ||
1522 | { | ||
1523 | DeadAvatar.ControllingClient.SendAgentAlertMessage("You died!", true); | ||
1524 | } | ||
1525 | } | ||
1526 | } | ||
1527 | DeadAvatar.Health = 100; | ||
1528 | DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient); | ||
1529 | } | ||
1530 | |||
1460 | #endregion | 1531 | #endregion |
1461 | } | 1532 | } |
1462 | 1533 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index e297b10..628ea04 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs | |||
@@ -336,6 +336,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
336 | { | 336 | { |
337 | if (over.landData.localID == landData.localID) | 337 | if (over.landData.localID == landData.localID) |
338 | { | 338 | { |
339 | if ((over.landData.landFlags & (uint)Parcel.ParcelFlags.AllowDamage) != 0) | ||
340 | avatars[i].Invulnerable = false; | ||
341 | else | ||
342 | avatars[i].Invulnerable = true; | ||
343 | |||
339 | sendLandUpdateToClient(avatars[i].ControllingClient); | 344 | sendLandUpdateToClient(avatars[i].ControllingClient); |
340 | } | 345 | } |
341 | } | 346 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 002fc5d..53a8d0f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -151,6 +151,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
151 | 151 | ||
152 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; | 152 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; |
153 | 153 | ||
154 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | ||
155 | |||
156 | public event AvatarKillData OnAvatarKilled; | ||
157 | |||
154 | /// <summary> | 158 | /// <summary> |
155 | /// RegisterCapsEvent is called by Scene after the Caps object | 159 | /// RegisterCapsEvent is called by Scene after the Caps object |
156 | /// has been instantiated and before it is return to the | 160 | /// has been instantiated and before it is return to the |
@@ -267,6 +271,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | 271 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; |
268 | private LandBuy handlerLandBuy = null; | 272 | private LandBuy handlerLandBuy = null; |
269 | private LandBuy handlerValidateLandBuy = null; | 273 | private LandBuy handlerValidateLandBuy = null; |
274 | private AvatarKillData handlerAvatarKill = null; | ||
270 | 275 | ||
271 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 276 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
272 | { | 277 | { |
@@ -574,5 +579,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
574 | handlerScriptNotAtTargetEvent(localID); | 579 | handlerScriptNotAtTargetEvent(localID); |
575 | } | 580 | } |
576 | } | 581 | } |
582 | public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) | ||
583 | { | ||
584 | handlerAvatarKill = OnAvatarKilled; | ||
585 | if (handlerAvatarKill != null) | ||
586 | { | ||
587 | handlerAvatarKill(KillerObjectLocalID, DeadAvatar); | ||
588 | } | ||
589 | } | ||
577 | } | 590 | } |
578 | } | 591 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6a50336..453c18f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -67,6 +67,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | private LLVector3 m_requestedSitOffset = new LLVector3(); | 67 | private LLVector3 m_requestedSitOffset = new LLVector3(); |
68 | private float m_sitAvatarHeight = 2.0f; | 68 | private float m_sitAvatarHeight = 2.0f; |
69 | private float m_godlevel = 0; | 69 | private float m_godlevel = 0; |
70 | |||
71 | private bool m_invulnerable = true; | ||
72 | |||
70 | private LLVector3 m_LastChildAgentUpdatePosition = new LLVector3(); | 73 | private LLVector3 m_LastChildAgentUpdatePosition = new LLVector3(); |
71 | 74 | ||
72 | private int m_perfMonMS = 0; | 75 | private int m_perfMonMS = 0; |
@@ -83,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | private bool m_newForce = false; | 86 | private bool m_newForce = false; |
84 | private bool m_newCoarseLocations = true; | 87 | private bool m_newCoarseLocations = true; |
85 | private bool m_gotAllObjectsInScene = false; | 88 | private bool m_gotAllObjectsInScene = false; |
89 | private float m_health = 100f; | ||
86 | 90 | ||
87 | private LLVector3 m_lastVelocity = LLVector3.Zero; | 91 | private LLVector3 m_lastVelocity = LLVector3.Zero; |
88 | 92 | ||
@@ -183,6 +187,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
183 | set { m_updateflag = value; } | 187 | set { m_updateflag = value; } |
184 | get { return m_updateflag; } | 188 | get { return m_updateflag; } |
185 | } | 189 | } |
190 | public bool Invulnerable | ||
191 | { | ||
192 | set { m_invulnerable = value; } | ||
193 | get { return m_invulnerable; } | ||
194 | } | ||
186 | 195 | ||
187 | private readonly ulong m_regionHandle; | 196 | private readonly ulong m_regionHandle; |
188 | 197 | ||
@@ -334,6 +343,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
334 | get { return m_parentID; } | 343 | get { return m_parentID; } |
335 | set { m_parentID = value; } | 344 | set { m_parentID = value; } |
336 | } | 345 | } |
346 | public float Health | ||
347 | { | ||
348 | get { return m_health; } | ||
349 | set { m_health = value; } | ||
350 | } | ||
337 | 351 | ||
338 | /// <summary> | 352 | /// <summary> |
339 | /// These are the region handles known by the avatar. | 353 | /// These are the region handles known by the avatar. |
@@ -602,6 +616,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
602 | { | 616 | { |
603 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 617 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
604 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 618 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
619 | m_physicsActor.UnSubscribeEvents(); | ||
605 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | 620 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
606 | PhysicsActor = null; | 621 | PhysicsActor = null; |
607 | } | 622 | } |
@@ -1894,16 +1909,55 @@ namespace OpenSim.Region.Environment.Scenes | |||
1894 | } | 1909 | } |
1895 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 1910 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
1896 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 1911 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
1912 | m_physicsActor.SubscribeEvents(1000); | ||
1897 | m_physicsActor.LocalID = LocalId; | 1913 | m_physicsActor.LocalID = LocalId; |
1898 | } | 1914 | } |
1899 | 1915 | ||
1900 | // Event called by the physics plugin to tell the avatar about a collision. | 1916 | // Event called by the physics plugin to tell the avatar about a collision. |
1901 | private void PhysicsCollisionUpdate(EventArgs e) | 1917 | private void PhysicsCollisionUpdate(EventArgs e) |
1902 | { | 1918 | { |
1919 | if (e == null) | ||
1920 | return; | ||
1921 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | ||
1922 | Dictionary<uint, float> coldata = collisionData.m_objCollisionList; | ||
1923 | float starthealth = Health; | ||
1924 | uint killerObj = 0; | ||
1925 | foreach (uint localid in coldata.Keys) | ||
1926 | { | ||
1927 | if (coldata[localid] <= 0.10f || m_invulnerable) | ||
1928 | continue; | ||
1929 | //if (localid == 0) | ||
1930 | //continue; | ||
1931 | |||
1932 | Health -= coldata[localid] * 5; | ||
1933 | |||
1934 | if (Health <= 0) | ||
1935 | { | ||
1936 | if (localid != 0) | ||
1937 | killerObj = localid; | ||
1938 | } | ||
1939 | //m_log.Debug("[AVATAR]: Collision with localid: " + localid.ToString() + " at depth: " + coldata[localid].ToString()); | ||
1940 | } | ||
1941 | //Health = 100; | ||
1942 | if (!m_invulnerable) | ||
1943 | { | ||
1944 | if (starthealth != Health) | ||
1945 | { | ||
1946 | ControllingClient.SendHealth(Health); | ||
1947 | } | ||
1948 | if (m_health <= 0) | ||
1949 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | ||
1950 | } | ||
1951 | |||
1952 | |||
1903 | bool isUserMoving = Velocity.X > 0 || Velocity.Y > 0; | 1953 | bool isUserMoving = Velocity.X > 0 || Velocity.Y > 0; |
1904 | UpdateMovementAnimations(isUserMoving); | 1954 | UpdateMovementAnimations(isUserMoving); |
1905 | } | 1955 | } |
1906 | 1956 | public void setHealthWithUpdate(float health) | |
1957 | { | ||
1958 | Health = health; | ||
1959 | ControllingClient.SendHealth(Health); | ||
1960 | } | ||
1907 | internal void Close() | 1961 | internal void Close() |
1908 | { | 1962 | { |
1909 | lock (m_attachments) | 1963 | lock (m_attachments) |