aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Application/OpenSim.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs98
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs226
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs3
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs27
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs48
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs41
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs139
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs340
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs79
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs6
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs5
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs5
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs5
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs19
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/VehicleConstants.cs12
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs401
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs5
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs2
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPrim.cs2
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs257
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs32
45 files changed, 1494 insertions, 525 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 693aedc..acd6a14 100755
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -1055,14 +1055,14 @@ namespace OpenSim
1055 } 1055 }
1056 if (cmdparams.Length > 4) 1056 if (cmdparams.Length > 4)
1057 { 1057 {
1058 loadOffset.X = (float) Convert.ToDecimal(cmdparams[4]); 1058 loadOffset.X = (float)Convert.ToDecimal(cmdparams[4], Culture.NumberFormatInfo);
1059 if (cmdparams.Length > 5) 1059 if (cmdparams.Length > 5)
1060 { 1060 {
1061 loadOffset.Y = (float) Convert.ToDecimal(cmdparams[5]); 1061 loadOffset.Y = (float)Convert.ToDecimal(cmdparams[5], Culture.NumberFormatInfo);
1062 } 1062 }
1063 if (cmdparams.Length > 6) 1063 if (cmdparams.Length > 6)
1064 { 1064 {
1065 loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); 1065 loadOffset.Z = (float)Convert.ToDecimal(cmdparams[6], Culture.NumberFormatInfo);
1066 } 1066 }
1067 MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); 1067 MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z));
1068 } 1068 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4e2a0b7..0df1748 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -232,6 +232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
232 public event ObjectBuy OnObjectBuy; 232 public event ObjectBuy OnObjectBuy;
233 public event BuyObjectInventory OnBuyObjectInventory; 233 public event BuyObjectInventory OnBuyObjectInventory;
234 public event AgentSit OnUndo; 234 public event AgentSit OnUndo;
235 public event AgentSit OnRedo;
236 public event LandUndo OnLandUndo;
235 public event ForceReleaseControls OnForceReleaseControls; 237 public event ForceReleaseControls OnForceReleaseControls;
236 public event GodLandStatRequest OnLandStatRequest; 238 public event GodLandStatRequest OnLandStatRequest;
237 public event RequestObjectPropertiesFamily OnObjectGroupRequest; 239 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
@@ -3307,9 +3309,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3307 awb.ItemID = wearables[i].ItemID; 3309 awb.ItemID = wearables[i].ItemID;
3308 aw.WearableData[i] = awb; 3310 aw.WearableData[i] = awb;
3309 3311
3310 // m_log.DebugFormat( 3312// m_log.DebugFormat(
3311 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3313// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3312 // awb.ItemID, awb.AssetID, i, Name); 3314// awb.ItemID, awb.AssetID, i, Name);
3313 } 3315 }
3314 3316
3315 OutPacket(aw, ThrottleOutPacketType.Task); 3317 OutPacket(aw, ThrottleOutPacketType.Task);
@@ -4668,6 +4670,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4668 AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName, false); 4670 AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName, false);
4669 AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions, false); 4671 AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions, false);
4670 AddLocalPacketHandler(PacketType.Undo, HandleUndo, false); 4672 AddLocalPacketHandler(PacketType.Undo, HandleUndo, false);
4673 AddLocalPacketHandler(PacketType.UndoLand, HandleLandUndo, false);
4674 AddLocalPacketHandler(PacketType.Redo, HandleRedo, false);
4671 AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay); 4675 AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay);
4672 AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily, false); 4676 AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily, false);
4673 AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch); 4677 AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch);
@@ -5838,7 +5842,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5838 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, 5842 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
5839 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, 5843 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID,
5840 soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, 5844 soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position,
5841 soundTriggerPacket.SoundData.Handle); 5845 soundTriggerPacket.SoundData.Handle, 0);
5842 5846
5843 } 5847 }
5844 return true; 5848 return true;
@@ -6736,6 +6740,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6736 return true; 6740 return true;
6737 } 6741 }
6738 6742
6743 private bool HandleLandUndo(IClientAPI sender, Packet Pack)
6744 {
6745 UndoLandPacket undolanditem = (UndoLandPacket)Pack;
6746
6747 #region Packet Session and User Check
6748 if (m_checkPackets)
6749 {
6750 if (undolanditem.AgentData.SessionID != SessionId ||
6751 undolanditem.AgentData.AgentID != AgentId)
6752 return true;
6753 }
6754 #endregion
6755
6756 LandUndo handlerOnUndo = OnLandUndo;
6757 if (handlerOnUndo != null)
6758 {
6759 handlerOnUndo(this);
6760 }
6761 return true;
6762 }
6763
6764 private bool HandleRedo(IClientAPI sender, Packet Pack)
6765 {
6766 RedoPacket redoitem = (RedoPacket)Pack;
6767
6768 #region Packet Session and User Check
6769 if (m_checkPackets)
6770 {
6771 if (redoitem.AgentData.SessionID != SessionId ||
6772 redoitem.AgentData.AgentID != AgentId)
6773 return true;
6774 }
6775 #endregion
6776
6777 if (redoitem.ObjectData.Length > 0)
6778 {
6779 for (int i = 0; i < redoitem.ObjectData.Length; i++)
6780 {
6781 UUID objiD = redoitem.ObjectData[i].ObjectID;
6782 AgentSit handlerOnRedo = OnRedo;
6783 if (handlerOnRedo != null)
6784 {
6785 handlerOnRedo(this, objiD);
6786 }
6787
6788 }
6789 }
6790 return true;
6791 }
6792
6739 private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack) 6793 private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack)
6740 { 6794 {
6741 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; 6795 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
@@ -8311,8 +8365,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8311 { 8365 {
8312 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), 8366 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
8313 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), 8367 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
8314 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), 8368 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)),
8315 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), 8369 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo),
8316 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), 8370 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
8317 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); 8371 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
8318 } 8372 }
@@ -8360,8 +8414,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8360 if (splitField.Length == 3) 8414 if (splitField.Length == 3)
8361 { 8415 {
8362 Int16 corner = Convert.ToInt16(splitField[0]); 8416 Int16 corner = Convert.ToInt16(splitField[0]);
8363 float lowValue = (float)Convert.ToDecimal(splitField[1]); 8417 float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo);
8364 float highValue = (float)Convert.ToDecimal(splitField[2]); 8418 float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo);
8365 8419
8366 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); 8420 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
8367 } 8421 }
@@ -8384,19 +8438,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8384 { 8438 {
8385 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); 8439 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
8386 if (!tmp.Contains(".")) tmp += ".00"; 8440 if (!tmp.Contains(".")) tmp += ".00";
8387 float WaterHeight = (float)Convert.ToDecimal(tmp); 8441 float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
8388 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); 8442 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
8389 if (!tmp.Contains(".")) tmp += ".00"; 8443 if (!tmp.Contains(".")) tmp += ".00";
8390 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); 8444 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
8391 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); 8445 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
8392 if (!tmp.Contains(".")) tmp += ".00"; 8446 if (!tmp.Contains(".")) tmp += ".00";
8393 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); 8447 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
8394 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); 8448 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
8395 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); 8449 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
8396 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); 8450 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo);
8397 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); 8451 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
8398 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); 8452 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
8399 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); 8453 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo);
8400 8454
8401 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); 8455 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
8402 8456
@@ -13928,8 +13982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13928 { 13982 {
13929 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), 13983 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
13930 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), 13984 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
13931 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), 13985 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)),
13932 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), 13986 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo),
13933 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), 13987 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
13934 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); 13988 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
13935 } 13989 }
@@ -13977,8 +14031,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13977 if (splitField.Length == 3) 14031 if (splitField.Length == 3)
13978 { 14032 {
13979 Int16 corner = Convert.ToInt16(splitField[0]); 14033 Int16 corner = Convert.ToInt16(splitField[0]);
13980 float lowValue = (float)Convert.ToDecimal(splitField[1]); 14034 float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo);
13981 float highValue = (float)Convert.ToDecimal(splitField[2]); 14035 float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo);
13982 14036
13983 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); 14037 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
13984 } 14038 }
@@ -14001,19 +14055,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
14001 { 14055 {
14002 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); 14056 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
14003 if (!tmp.Contains(".")) tmp += ".00"; 14057 if (!tmp.Contains(".")) tmp += ".00";
14004 float WaterHeight = (float)Convert.ToDecimal(tmp); 14058 float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
14005 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); 14059 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
14006 if (!tmp.Contains(".")) tmp += ".00"; 14060 if (!tmp.Contains(".")) tmp += ".00";
14007 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); 14061 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
14008 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); 14062 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
14009 if (!tmp.Contains(".")) tmp += ".00"; 14063 if (!tmp.Contains(".")) tmp += ".00";
14010 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); 14064 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
14011 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); 14065 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
14012 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); 14066 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
14013 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); 14067 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo);
14014 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); 14068 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
14015 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); 14069 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
14016 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); 14070 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo);
14017 14071
14018 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); 14072 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
14019 14073
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
deleted file mode 100644
index 9c646b6..0000000
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
+++ /dev/null
@@ -1,226 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28//using System.Reflection;
29//using log4net;
30
31namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
32{
33 /*
34 public class AgentAssetTransactionsManager
35 {
36 //private static readonly ILog m_log
37 // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38
39 /// <summary>
40 /// Each agent has its own singleton collection of transactions
41 /// </summary>
42 private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
43 new Dictionary<UUID, AgentAssetTransactions>();
44
45 /// <summary>
46 /// Should we dump uploaded assets to the filesystem?
47 /// </summary>
48 private bool m_dumpAssetsToFile;
49
50 public Scene MyScene;
51
52 public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
53 {
54 MyScene = scene;
55 m_dumpAssetsToFile = dumpAssetsToFile;
56 }
57
58 /// <summary>
59 /// Get the collection of asset transactions for the given user. If one does not already exist, it
60 /// is created.
61 /// </summary>
62 /// <param name="userID"></param>
63 /// <returns></returns>
64 private AgentAssetTransactions GetUserTransactions(UUID userID)
65 {
66 lock (AgentTransactions)
67 {
68 if (!AgentTransactions.ContainsKey(userID))
69 {
70 AgentAssetTransactions transactions = null;
71 //= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
72 AgentTransactions.Add(userID, transactions);
73 }
74
75 return AgentTransactions[userID];
76 }
77 }
78
79 /// <summary>
80 /// Remove the given agent asset transactions. This should be called when a client is departing
81 /// from a scene (and hence won't be making any more transactions here).
82 /// </summary>
83 /// <param name="userID"></param>
84 public void RemoveAgentAssetTransactions(UUID userID)
85 {
86 // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
87
88 lock (AgentTransactions)
89 {
90 AgentTransactions.Remove(userID);
91 }
92 }
93
94 /// <summary>
95 /// Create an inventory item from data that has been received through a transaction.
96 ///
97 /// This is called when new clothing or body parts are created. It may also be called in other
98 /// situations.
99 /// </summary>
100 /// <param name="remoteClient"></param>
101 /// <param name="transactionID"></param>
102 /// <param name="folderID"></param>
103 /// <param name="callbackID"></param>
104 /// <param name="description"></param>
105 /// <param name="name"></param>
106 /// <param name="invType"></param>
107 /// <param name="type"></param>
108 /// <param name="wearableType"></param>
109 /// <param name="nextOwnerMask"></param>
110 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID,
111 uint callbackID, string description, string name, sbyte invType,
112 sbyte type, byte wearableType, uint nextOwnerMask)
113 {
114// m_log.DebugFormat(
115// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
116
117 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
118
119 transactions.RequestCreateInventoryItem(
120 remoteClient, transactionID, folderID, callbackID, description,
121 name, invType, type, wearableType, nextOwnerMask);
122 }
123
124 /// <summary>
125 /// Update an inventory item with data that has been received through a transaction.
126 ///
127 /// This is called when clothing or body parts are updated (for instance, with new textures or
128 /// colours). It may also be called in other situations.
129 /// </summary>
130 /// <param name="remoteClient"></param>
131 /// <param name="transactionID"></param>
132 /// <param name="item"></param>
133 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID,
134 InventoryItemBase item)
135 {
136// m_log.DebugFormat(
137// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
138// item.Name);
139
140 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
141
142 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
143 }
144
145 /// <summary>
146 /// Update a task inventory item with data that has been received through a transaction.
147 ///
148 /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent
149 /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction
150 /// and comes through this method.
151 /// </summary>
152 /// <param name="remoteClient"></param>
153 /// <param name="transactionID"></param>
154 /// <param name="item"></param>
155 public void HandleTaskItemUpdateFromTransaction(
156 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
157 {
158// m_log.DebugFormat(
159// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}",
160// item.Name);
161
162 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
163
164 transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
165 }
166
167 /// <summary>
168 /// Request that a client (agent) begin an asset transfer.
169 /// </summary>
170 /// <param name="remoteClient"></param>
171 /// <param name="assetID"></param>
172 /// <param name="transaction"></param>
173 /// <param name="type"></param>
174 /// <param name="data"></param></param>
175 /// <param name="tempFile"></param>
176 public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
177 byte[] data, bool storeLocal, bool tempFile)
178 {
179 //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile);
180 if (((AssetType)type == AssetType.Texture ||
181 (AssetType)type == AssetType.Sound ||
182 (AssetType)type == AssetType.TextureTGA ||
183 (AssetType)type == AssetType.Animation) &&
184 tempFile == false)
185 {
186 Scene scene = (Scene)remoteClient.Scene;
187 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
188
189 if (mm != null)
190 {
191 if (!mm.UploadCovered(remoteClient))
192 {
193 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
194 return;
195 }
196 }
197 }
198
199 //m_log.Debug("asset upload of " + assetID);
200 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
201
202 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
203 if (uploader != null)
204 {
205 uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
206 }
207 }
208
209 /// <summary>
210 /// Handle asset transfer data packets received in response to the asset upload request in
211 /// HandleUDPUploadRequest()
212 /// </summary>
213 /// <param name="remoteClient"></param>
214 /// <param name="xferID"></param>
215 /// <param name="packetID"></param>
216 /// <param name="data"></param>
217 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
218 {
219 //m_log.Debug("xferID: " + xferID + " packetID: " + packetID + " data!");
220 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
221
222 transactions.HandleXfer(xferID, packetID, data);
223 }
224 }
225 */
226}
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 1077f4a..7e08ecf 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
30using Nini.Config; 32using Nini.Config;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
@@ -37,6 +39,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
37{ 39{
38 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions 40 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
39 { 41 {
42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
40 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); 44 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
41 private bool m_dumpAssetsToFile = false; 45 private bool m_dumpAssetsToFile = false;
42 private Scene m_scene = null; 46 private Scene m_scene = null;
@@ -226,7 +230,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
226 public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, 230 public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type,
227 byte[] data, bool storeLocal, bool tempFile) 231 byte[] data, bool storeLocal, bool tempFile)
228 { 232 {
229 //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); 233// m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile);
234
230 if (((AssetType)type == AssetType.Texture || 235 if (((AssetType)type == AssetType.Texture ||
231 (AssetType)type == AssetType.Sound || 236 (AssetType)type == AssetType.Sound ||
232 (AssetType)type == AssetType.TextureTGA || 237 (AssetType)type == AssetType.TextureTGA ||
@@ -246,7 +251,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
246 } 251 }
247 } 252 }
248 253
249 //m_log.Debug("asset upload of " + assetID);
250 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 254 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
251 255
252 AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 256 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index fbd0ed1..ebe93d5 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -154,7 +154,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
154 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); 154 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
155 } 155 }
156 156
157 m_log.DebugFormat("[ASSET TRANSACTIONS]: Uploaded asset data for transaction {0}", TransactionID); 157 m_log.DebugFormat(
158 "[ASSET TRANSACTIONS]: Uploaded asset {0} for transaction {1}", m_asset.FullID, TransactionID);
158 159
159 if (m_dumpAssetToFile) 160 if (m_dumpAssetToFile)
160 { 161 {
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 1add0ab..1903eb9 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset
91 /// </example> 91 /// </example>
92 public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule 92 public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule
93 { 93 {
94 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
95
94 /// <summary> 96 /// <summary>
95 /// Cache's default maximal asset count. 97 /// Cache's default maximal asset count.
96 /// </summary> 98 /// </summary>
@@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset
115 /// Asset's default expiration time in the cache. 117 /// Asset's default expiration time in the cache.
116 /// </summary> 118 /// </summary>
117 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); 119 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0);
118 120
119 /// <summary>
120 /// Log manager instance.
121 /// </summary>
122 private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
123
124 /// <summary> 121 /// <summary>
125 /// Cache object. 122 /// Cache object.
126 /// </summary> 123 /// </summary>
@@ -170,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Asset
170 { 167 {
171 if (maximalSize <= 0 || maximalCount <= 0) 168 if (maximalSize <= 0 || maximalCount <= 0)
172 { 169 {
173 //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); 170 //m_log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled.");
174 m_enabled = false; 171 m_enabled = false;
175 return; 172 return;
176 } 173 }
@@ -186,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Asset
186 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( 183 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
187 maximalSize, maximalCount, expirationTime)); 184 maximalSize, maximalCount, expirationTime));
188 m_enabled = true; 185 m_enabled = true;
189 Log.DebugFormat( 186 m_log.DebugFormat(
190 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", 187 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})",
191 maximalSize, 188 maximalSize,
192 maximalCount, 189 maximalCount,
@@ -205,6 +202,8 @@ namespace OpenSim.Region.CoreModules.Asset
205 { 202 {
206 if (asset != null) 203 if (asset != null)
207 { 204 {
205// m_log.DebugFormat("[CENOME ASSET CACHE]: Caching asset {0}", asset.ID);
206
208 long size = asset.Data != null ? asset.Data.Length : 1; 207 long size = asset.Data != null ? asset.Data.Length : 1;
209 m_cache.Set(asset.ID, asset, size); 208 m_cache.Set(asset.ID, asset, size);
210 m_cachedCount++; 209 m_cachedCount++;
@@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Asset
255 254
256 if (m_getCount == m_debugEpoch) 255 if (m_getCount == m_debugEpoch)
257 { 256 {
258 Log.DebugFormat( 257 m_log.DebugFormat(
259 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", 258 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes",
260 m_cachedCount, 259 m_cachedCount,
261 m_getCount, 260 m_getCount,
@@ -267,6 +266,9 @@ namespace OpenSim.Region.CoreModules.Asset
267 m_cachedCount = 0; 266 m_cachedCount = 0;
268 } 267 }
269 268
269// if (null == assetBase)
270// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
271
270 return assetBase; 272 return assetBase;
271 } 273 }
272 274
@@ -325,12 +327,11 @@ namespace OpenSim.Region.CoreModules.Asset
325 return; 327 return;
326 328
327 string name = moduleConfig.GetString("AssetCaching"); 329 string name = moduleConfig.GetString("AssetCaching");
328 //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 330 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
329 331
330 if (name != Name) 332 if (name != Name)
331 return; 333 return;
332 334
333 // This module is used
334 long maxSize = DefaultMaxSize; 335 long maxSize = DefaultMaxSize;
335 int maxCount = DefaultMaxCount; 336 int maxCount = DefaultMaxCount;
336 TimeSpan expirationTime = DefaultExpirationTime; 337 TimeSpan expirationTime = DefaultExpirationTime;
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index db94d2a..0bd68dd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -148,13 +148,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
148 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) 148 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
149 { 149 {
150 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 150 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
151 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) 151 try
152 { 152 {
153 avatar.Invulnerable = false; 153 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0)
154 {
155 avatar.Invulnerable = false;
156 }
157 else
158 {
159 avatar.Invulnerable = true;
160 }
154 } 161 }
155 else 162 catch (Exception ex)
156 { 163 {
157 avatar.Invulnerable = true;
158 } 164 }
159 } 165 }
160 } 166 }
diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
index 9fe669a..4004135 100644
--- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
+++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
147 m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); 147 m_args[i].ArgumentValue = Int32.Parse(arg.ToString());
148 break; 148 break;
149 case "Double": 149 case "Double":
150 m_args[i].ArgumentValue = Double.Parse(arg.ToString()); 150 m_args[i].ArgumentValue = Double.Parse(arg.ToString(), OpenSim.Framework.Culture.NumberFormatInfo);
151 break; 151 break;
152 case "Boolean": 152 case "Boolean":
153 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); 153 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString());
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index fd3aaf4..2f21e6d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -38,12 +38,9 @@ using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset 39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
40{ 40{
41 public class LocalAssetServicesConnector : 41 public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService
42 ISharedRegionModule, IAssetService
43 { 42 {
44 private static readonly ILog m_log = 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47 44
48 private IImprovedAssetCache m_Cache = null; 45 private IImprovedAssetCache m_Cache = null;
49 46
@@ -72,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
72 IConfig assetConfig = source.Configs["AssetService"]; 69 IConfig assetConfig = source.Configs["AssetService"];
73 if (assetConfig == null) 70 if (assetConfig == null)
74 { 71 {
75 m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); 72 m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: AssetService missing from OpenSim.ini");
76 return; 73 return;
77 } 74 }
78 75
@@ -81,22 +78,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
81 78
82 if (serviceDll == String.Empty) 79 if (serviceDll == String.Empty)
83 { 80 {
84 m_log.Error("[ASSET CONNECTOR]: No LocalServiceModule named in section AssetService"); 81 m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService");
85 return; 82 return;
86 } 83 }
87 84
88 Object[] args = new Object[] { source }; 85 Object[] args = new Object[] { source };
89 m_AssetService = 86 m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args);
90 ServerUtils.LoadPlugin<IAssetService>(serviceDll,
91 args);
92 87
93 if (m_AssetService == null) 88 if (m_AssetService == null)
94 { 89 {
95 m_log.Error("[ASSET CONNECTOR]: Can't load asset service"); 90 m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: Can't load asset service");
96 return; 91 return;
97 } 92 }
98 m_Enabled = true; 93 m_Enabled = true;
99 m_log.Info("[ASSET CONNECTOR]: Local asset connector enabled"); 94 m_log.Info("[LOCAL ASSET SERVICES CONNECTOR]: Local asset connector enabled");
100 } 95 }
101 } 96 }
102 } 97 }
@@ -134,11 +129,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
134 m_Cache = null; 129 m_Cache = null;
135 } 130 }
136 131
137 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); 132 m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName);
138 133
139 if (m_Cache != null) 134 if (m_Cache != null)
140 { 135 {
141 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); 136 m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
142 } 137 }
143 else 138 else
144 { 139 {
@@ -151,6 +146,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
151 146
152 public AssetBase Get(string id) 147 public AssetBase Get(string id)
153 { 148 {
149// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id);
150
154 AssetBase asset = null; 151 AssetBase asset = null;
155 if (m_Cache != null) 152 if (m_Cache != null)
156 asset = m_Cache.Get(id); 153 asset = m_Cache.Get(id);
@@ -160,7 +157,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
160 asset = m_AssetService.Get(id); 157 asset = m_AssetService.Get(id);
161 if ((m_Cache != null) && (asset != null)) 158 if ((m_Cache != null) && (asset != null))
162 m_Cache.Cache(asset); 159 m_Cache.Cache(asset);
160
161// if (null == asset)
162// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id);
163 } 163 }
164
164 return asset; 165 return asset;
165 } 166 }
166 167
@@ -204,15 +205,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
204 205
205 public bool Get(string id, Object sender, AssetRetrieved handler) 206 public bool Get(string id, Object sender, AssetRetrieved handler)
206 { 207 {
207 AssetBase asset = null; 208// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id);
208 209
209 if (m_Cache != null) 210 if (m_Cache != null)
210 m_Cache.Get(id);
211
212 if (asset != null)
213 { 211 {
214 Util.FireAndForget(delegate { handler(id, sender, asset); }); 212 AssetBase asset = m_Cache.Get(id);
215 return true; 213
214 if (asset != null)
215 {
216 Util.FireAndForget(delegate { handler(id, sender, asset); });
217 return true;
218 }
216 } 219 }
217 220
218 return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) 221 return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
@@ -220,6 +223,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
220 if ((a != null) && (m_Cache != null)) 223 if ((a != null) && (m_Cache != null))
221 m_Cache.Cache(a); 224 m_Cache.Cache(a);
222 225
226// if (null == a)
227// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
228
223 Util.FireAndForget(delegate { handler(assetID, s, a); }); 229 Util.FireAndForget(delegate { handler(assetID, s, a); });
224 }); 230 });
225 } 231 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 9d6da4f..54e62e2 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
73 IConfig inventoryConfig = source.Configs["InventoryService"]; 73 IConfig inventoryConfig = source.Configs["InventoryService"];
74 if (inventoryConfig == null) 74 if (inventoryConfig == null)
75 { 75 {
76 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 76 m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: InventoryService missing from OpenSim.ini");
77 return; 77 return;
78 } 78 }
79 79
@@ -81,18 +81,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
81 81
82 if (serviceDll == String.Empty) 82 if (serviceDll == String.Empty)
83 { 83 {
84 m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); 84 m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: No LocalServiceModule named in section InventoryService");
85 return; 85 return;
86 } 86 }
87 87
88 Object[] args = new Object[] { source }; 88 Object[] args = new Object[] { source };
89 m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); 89 m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Service dll = {0}", serviceDll);
90 90
91 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); 91 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args);
92 92
93 if (m_InventoryService == null) 93 if (m_InventoryService == null)
94 { 94 {
95 m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); 95 m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service");
96 //return; 96 //return;
97 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); 97 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
98 } 98 }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
111 Init(source); 111 Init(source);
112 112
113 m_Enabled = true; 113 m_Enabled = true;
114 m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); 114 m_log.Info("[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled");
115 } 115 }
116 } 116 }
117 } 117 }
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
135 } 135 }
136 136
137// m_log.DebugFormat( 137// m_log.DebugFormat(
138// "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); 138// "[LOCAL INVENTORY SERVICES CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName);
139 139
140 scene.RegisterModuleInterface<IInventoryService>(this); 140 scene.RegisterModuleInterface<IInventoryService>(this);
141 m_cache.AddRegion(scene); 141 m_cache.AddRegion(scene);
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
155 return; 155 return;
156 156
157 m_log.InfoFormat( 157 m_log.InfoFormat(
158 "[INVENTORY CONNECTOR]: Enabled local invnetory for region {0}", scene.RegionInfo.RegionName); 158 "[LOCAL INVENTORY SERVICES CONNECTOR]: Enabled local inventory for region {0}", scene.RegionInfo.RegionName);
159 } 159 }
160 160
161 #region IInventoryService 161 #region IInventoryService
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
210 return folders; 210 return folders;
211 } 211 }
212 } 212 }
213 m_log.WarnFormat("[INVENTORY CONNECTOR]: System folders for {0} not found", userID); 213 m_log.WarnFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: System folders for {0} not found", userID);
214 return new Dictionary<AssetType, InventoryFolderBase>(); 214 return new Dictionary<AssetType, InventoryFolderBase>();
215 } 215 }
216 216
@@ -309,7 +309,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
309 309
310 public override InventoryItemBase GetItem(InventoryItemBase item) 310 public override InventoryItemBase GetItem(InventoryItemBase item)
311 { 311 {
312 return m_InventoryService.GetItem(item); 312// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
313
314 item = m_InventoryService.GetItem(item);
315
316 if (null == item)
317 m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}");
318
319 return item;
313 } 320 }
314 321
315 public override InventoryFolderBase GetFolder(InventoryFolderBase folder) 322 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 189efdc..e3bab2d 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
955 if (y == -1 || m_scene.RegionInfo.RegionLocY == y) 955 if (y == -1 || m_scene.RegionInfo.RegionLocY == y)
956 { 956 {
957 int corner = int.Parse(num); 957 int corner = int.Parse(num);
958 float lowValue = float.Parse(min); 958 float lowValue = float.Parse(min, Culture.NumberFormatInfo);
959 float highValue = float.Parse(max); 959 float highValue = float.Parse(max, Culture.NumberFormatInfo);
960 960
961 m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + 961 m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName +
962 string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); 962 string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue));
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 37f1f2e..1f5a4ff 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
60 } 60 }
61 61
62 public virtual void PlayAttachedSound( 62 public virtual void PlayAttachedSound(
63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) 63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
64 { 64 {
65 foreach (ScenePresence p in m_scene.GetAvatars()) 65 foreach (ScenePresence p in m_scene.GetAvatars())
66 { 66 {
@@ -69,14 +69,17 @@ namespace OpenSim.Region.CoreModules.World.Sound
69 continue; 69 continue;
70 70
71 // Scale by distance 71 // Scale by distance
72 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 72 if (radius == 0)
73 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
74 else
75 gain = (float)((double)gain * ((radius - dis) / radius));
73 76
74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 77 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
75 } 78 }
76 } 79 }
77 80
78 public virtual void TriggerSound( 81 public virtual void TriggerSound(
79 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) 82 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
80 { 83 {
81 foreach (ScenePresence p in m_scene.GetAvatars()) 84 foreach (ScenePresence p in m_scene.GetAvatars())
82 { 85 {
@@ -85,7 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Sound
85 continue; 88 continue;
86 89
87 // Scale by distance 90 // Scale by distance
88 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 91 if (radius == 0)
92 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
93 else
94 gain = (float)((double)gain * ((radius - dis) / radius));
89 95
90 p.ControllingClient.SendTriggeredSound( 96 p.ControllingClient.SendTriggeredSound(
91 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 97 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index a40828b..1e7ea7b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
84 private ITerrainChannel m_revert; 84 private ITerrainChannel m_revert;
85 private Scene m_scene; 85 private Scene m_scene;
86 private volatile bool m_tainted; 86 private volatile bool m_tainted;
87 private readonly UndoStack<LandUndoState> m_undo = new UndoStack<LandUndoState>(5);
87 88
88 #region ICommandableModule Members 89 #region ICommandableModule Members
89 90
@@ -174,6 +175,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
174 175
175 #region ITerrainModule Members 176 #region ITerrainModule Members
176 177
178 public void UndoTerrain(ITerrainChannel channel)
179 {
180 m_channel = channel;
181 }
182
177 /// <summary> 183 /// <summary>
178 /// Loads a terrain file from disk and installs it in the scene. 184 /// Loads a terrain file from disk and installs it in the scene.
179 /// </summary> 185 /// </summary>
@@ -574,6 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
574 { 580 {
575 client.OnModifyTerrain += client_OnModifyTerrain; 581 client.OnModifyTerrain += client_OnModifyTerrain;
576 client.OnBakeTerrain += client_OnBakeTerrain; 582 client.OnBakeTerrain += client_OnBakeTerrain;
583 client.OnLandUndo += client_OnLandUndo;
577 } 584 }
578 585
579 /// <summary> 586 /// <summary>
@@ -664,6 +671,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
664 return changesLimited; 671 return changesLimited;
665 } 672 }
666 673
674 private void client_OnLandUndo(IClientAPI client)
675 {
676 lock (m_undo)
677 {
678 if (m_undo.Count > 0)
679 {
680 LandUndoState goback = m_undo.Pop();
681 if (goback != null)
682 goback.PlaybackState();
683 }
684 }
685 }
686
667 /// <summary> 687 /// <summary>
668 /// Sends a copy of the current terrain to the scenes clients 688 /// Sends a copy of the current terrain to the scenes clients
669 /// </summary> 689 /// </summary>
@@ -718,6 +738,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
718 } 738 }
719 if (allowed) 739 if (allowed)
720 { 740 {
741 StoreUndoState();
721 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 742 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
722 m_channel, allowMask, west, south, height, size, seconds); 743 m_channel, allowMask, west, south, height, size, seconds);
723 744
@@ -758,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
758 779
759 if (allowed) 780 if (allowed)
760 { 781 {
782 StoreUndoState();
761 m_floodeffects[(StandardTerrainEffects) action].FloodEffect( 783 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(
762 m_channel, fillArea, size); 784 m_channel, fillArea, size);
763 785
@@ -782,6 +804,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain
782 } 804 }
783 } 805 }
784 806
807 private void StoreUndoState()
808 {
809 lock (m_undo)
810 {
811 if (m_undo.Count > 0)
812 {
813 LandUndoState last = m_undo.Peek();
814 if (last != null)
815 {
816 if (last.Compare(m_channel))
817 return;
818 }
819 }
820
821 LandUndoState nUndo = new LandUndoState(this, m_channel);
822 m_undo.Push(nUndo);
823 }
824 }
825
785 #region Console Commands 826 #region Console Commands
786 827
787 private void InterfaceLoadFile(Object[] args) 828 private void InterfaceLoadFile(Object[] args)
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index fb29353..2c5c6e9 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -194,6 +194,8 @@ namespace OpenSim.Region.Examples.SimpleModule
194 public event ObjectBuy OnObjectBuy; 194 public event ObjectBuy OnObjectBuy;
195 public event BuyObjectInventory OnBuyObjectInventory; 195 public event BuyObjectInventory OnBuyObjectInventory;
196 public event AgentSit OnUndo; 196 public event AgentSit OnUndo;
197 public event AgentSit OnRedo;
198 public event LandUndo OnLandUndo;
197 199
198 public event ForceReleaseControls OnForceReleaseControls; 200 public event ForceReleaseControls OnForceReleaseControls;
199 201
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 379fabd..6117a80 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -32,9 +32,9 @@ namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface ISoundModule 33 public interface ISoundModule
34 { 34 {
35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags); 35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius);
36 36
37 void TriggerSound( 37 void TriggerSound(
38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle); 38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius);
39 } 39 }
40} \ No newline at end of file 40} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index 7caac55..5947afb 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -62,5 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
62 void SaveToStream(string filename, Stream stream); 62 void SaveToStream(string filename, Stream stream);
63 63
64 void InstallPlugin(string name, ITerrainEffect plug); 64 void InstallPlugin(string name, ITerrainEffect plug);
65
66 void UndoTerrain(ITerrainChannel channel);
65 } 67 }
66} 68}
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index fd526eb..712dcc7 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -418,15 +418,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
418 { 418 {
419 if (m_scenePresence.IsChildAgent) 419 if (m_scenePresence.IsChildAgent)
420 return; 420 return;
421
422 UUID[] animIDs;
423 int[] sequenceNums;
424 UUID[] objectIDs;
425 421
426 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); 422 m_scenePresence.Scene.ForEachScenePresence(
427 423 delegate(ScenePresence SP)
428 m_scenePresence.ControllingClient.SendAnimations( 424 {
429 animIDs, sequenceNums, m_scenePresence.ControllingClient.AgentId, objectIDs); 425 SP.Animator.SendAnimPack();
426 });
430 } 427 }
431 428
432 /// <summary> 429 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e032a07..ded001b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -528,6 +528,9 @@ namespace OpenSim.Region.Framework.Scenes
528 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); 528 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
529 return; 529 return;
530 } 530 }
531
532 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
533 return;
531 } 534 }
532 535
533 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 536 AssetBase asset = AssetService.Get(item.AssetID.ToString());
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 669720a..72ece10 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2054,9 +2054,39 @@ namespace OpenSim.Region.Framework.Scenes
2054 if (grp.IsDeleted) 2054 if (grp.IsDeleted)
2055 return; 2055 return;
2056 2056
2057 if (grp.RootPart.DIE_AT_EDGE)
2058 {
2059 // We remove the object here
2060 try
2061 {
2062 DeleteSceneObject(grp, false);
2063 }
2064 catch (Exception)
2065 {
2066 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
2067 }
2068 return;
2069 }
2070
2071 if (grp.RootPart.RETURN_AT_EDGE)
2072 {
2073 // We remove the object here
2074 try
2075 {
2076 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
2077 objects.Add(grp);
2078 SceneObjectGroup[] objectsArray = objects.ToArray();
2079 returnObjects(objectsArray, UUID.Zero);
2080 }
2081 catch (Exception)
2082 {
2083 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
2084 }
2085 return;
2086 }
2087
2057 if (m_teleportModule != null) 2088 if (m_teleportModule != null)
2058 m_teleportModule.Cross(grp, attemptedPosition, silent); 2089 m_teleportModule.Cross(grp, attemptedPosition, silent);
2059
2060 } 2090 }
2061 2091
2062 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 2092 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
@@ -2552,6 +2582,7 @@ namespace OpenSim.Region.Framework.Scenes
2552 client.OnGrabUpdate += ProcessObjectGrabUpdate; 2582 client.OnGrabUpdate += ProcessObjectGrabUpdate;
2553 client.OnDeGrabObject += ProcessObjectDeGrab; 2583 client.OnDeGrabObject += ProcessObjectDeGrab;
2554 client.OnUndo += m_sceneGraph.HandleUndo; 2584 client.OnUndo += m_sceneGraph.HandleUndo;
2585 client.OnRedo += m_sceneGraph.HandleRedo;
2555 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2586 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2556 client.OnObjectDrop += m_sceneGraph.DropObject; 2587 client.OnObjectDrop += m_sceneGraph.DropObject;
2557 client.OnObjectSaleInfo += ObjectSaleInfo; 2588 client.OnObjectSaleInfo += ObjectSaleInfo;
@@ -2705,6 +2736,7 @@ namespace OpenSim.Region.Framework.Scenes
2705 client.OnGrabObject -= ProcessObjectGrab; 2736 client.OnGrabObject -= ProcessObjectGrab;
2706 client.OnDeGrabObject -= ProcessObjectDeGrab; 2737 client.OnDeGrabObject -= ProcessObjectDeGrab;
2707 client.OnUndo -= m_sceneGraph.HandleUndo; 2738 client.OnUndo -= m_sceneGraph.HandleUndo;
2739 client.OnRedo -= m_sceneGraph.HandleRedo;
2708 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2740 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2709 client.OnObjectDrop -= m_sceneGraph.DropObject; 2741 client.OnObjectDrop -= m_sceneGraph.DropObject;
2710 client.OnObjectSaleInfo -= ObjectSaleInfo; 2742 client.OnObjectSaleInfo -= ObjectSaleInfo;
@@ -2953,7 +2985,6 @@ namespace OpenSim.Region.Framework.Scenes
2953 m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); 2985 m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
2954 appearance = new AvatarAppearance(client.AgentId); 2986 appearance = new AvatarAppearance(client.AgentId);
2955 } 2987 }
2956
2957 } 2988 }
2958 2989
2959 /// <summary> 2990 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 7bd4329..0132252 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -453,6 +453,15 @@ namespace OpenSim.Region.Framework.Scenes
453 part.Undo(); 453 part.Undo();
454 } 454 }
455 } 455 }
456 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
457 {
458 if (primId != UUID.Zero)
459 {
460 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
461 if (part != null)
462 part.Redo();
463 }
464 }
456 465
457 protected internal void HandleObjectGroupUpdate( 466 protected internal void HandleObjectGroupUpdate(
458 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) 467 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index af46659..fe9dd9b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -298,7 +298,16 @@ namespace OpenSim.Region.Framework.Scenes
298 { 298 {
299 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 299 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
300 } 300 }
301 301 if (RootPart.GetStatusSandbox())
302 {
303 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
304 {
305 RootPart.ScriptSetPhysicsStatus(false);
306 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
307 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
308 return;
309 }
310 }
302 lock (m_parts) 311 lock (m_parts)
303 { 312 {
304 foreach (SceneObjectPart part in m_parts.Values) 313 foreach (SceneObjectPart part in m_parts.Values)
@@ -398,6 +407,34 @@ namespace OpenSim.Region.Framework.Scenes
398 } 407 }
399 } 408 }
400 409
410 private SceneObjectPart m_PlaySoundMasterPrim = null;
411 public SceneObjectPart PlaySoundMasterPrim
412 {
413 get { return m_PlaySoundMasterPrim; }
414 set { m_PlaySoundMasterPrim = value; }
415 }
416
417 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
418 public List<SceneObjectPart> PlaySoundSlavePrims
419 {
420 get { return m_LoopSoundSlavePrims; }
421 set { m_LoopSoundSlavePrims = value; }
422 }
423
424 private SceneObjectPart m_LoopSoundMasterPrim = null;
425 public SceneObjectPart LoopSoundMasterPrim
426 {
427 get { return m_LoopSoundMasterPrim; }
428 set { m_LoopSoundMasterPrim = value; }
429 }
430
431 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
432 public List<SceneObjectPart> LoopSoundSlavePrims
433 {
434 get { return m_LoopSoundSlavePrims; }
435 set { m_LoopSoundSlavePrims = value; }
436 }
437
401 // The UUID for the Region this Object is in. 438 // The UUID for the Region this Object is in.
402 public UUID RegionUUID 439 public UUID RegionUUID
403 { 440 {
@@ -1779,32 +1816,6 @@ namespace OpenSim.Region.Framework.Scenes
1779 } 1816 }
1780 } 1817 }
1781 1818
1782 public void rotLookAt(Quaternion target, float strength, float damping)
1783 {
1784 SceneObjectPart rootpart = m_rootPart;
1785 if (rootpart != null)
1786 {
1787 if (IsAttachment)
1788 {
1789 /*
1790 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1791 if (avatar != null)
1792 {
1793 Rotate the Av?
1794 } */
1795 }
1796 else
1797 {
1798 if (rootpart.PhysActor != null)
1799 {
1800 rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
1801 rootpart.PhysActor.APIDStrength = strength;
1802 rootpart.PhysActor.APIDDamping = damping;
1803 rootpart.PhysActor.APIDActive = true;
1804 }
1805 }
1806 }
1807 }
1808 public void stopLookAt() 1819 public void stopLookAt()
1809 { 1820 {
1810 SceneObjectPart rootpart = m_rootPart; 1821 SceneObjectPart rootpart = m_rootPart;
@@ -1963,6 +1974,8 @@ namespace OpenSim.Region.Framework.Scenes
1963 1974
1964 foreach (SceneObjectPart part in m_parts.Values) 1975 foreach (SceneObjectPart part in m_parts.Values)
1965 { 1976 {
1977 if (!IsSelected)
1978 part.UpdateLookAt();
1966 part.SendScheduledUpdates(); 1979 part.SendScheduledUpdates();
1967 } 1980 }
1968 } 1981 }
@@ -2452,11 +2465,14 @@ namespace OpenSim.Region.Framework.Scenes
2452 { 2465 {
2453 if (m_rootPart.PhysActor.IsPhysical) 2466 if (m_rootPart.PhysActor.IsPhysical)
2454 { 2467 {
2455 Vector3 llmoveforce = pos - AbsolutePosition; 2468 if (!m_rootPart.BlockGrab)
2456 Vector3 grabforce = llmoveforce; 2469 {
2457 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2470 Vector3 llmoveforce = pos - AbsolutePosition;
2458 m_rootPart.PhysActor.AddForce(grabforce,true); 2471 Vector3 grabforce = llmoveforce;
2459 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2472 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2473 m_rootPart.PhysActor.AddForce(grabforce, true);
2474 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2475 }
2460 } 2476 }
2461 else 2477 else
2462 { 2478 {
@@ -2812,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes
2812 SceneObjectPart part = GetChildPart(localID); 2828 SceneObjectPart part = GetChildPart(localID);
2813 if (part != null) 2829 if (part != null)
2814 { 2830 {
2831 part.IgnoreUndoUpdate = true;
2815 if (scale.X > m_scene.m_maxNonphys) 2832 if (scale.X > m_scene.m_maxNonphys)
2816 scale.X = m_scene.m_maxNonphys; 2833 scale.X = m_scene.m_maxNonphys;
2817 if (scale.Y > m_scene.m_maxNonphys) 2834 if (scale.Y > m_scene.m_maxNonphys)
@@ -2839,6 +2856,7 @@ namespace OpenSim.Region.Framework.Scenes
2839 { 2856 {
2840 if (obPart.UUID != m_rootPart.UUID) 2857 if (obPart.UUID != m_rootPart.UUID)
2841 { 2858 {
2859 obPart.IgnoreUndoUpdate = true;
2842 Vector3 oldSize = new Vector3(obPart.Scale); 2860 Vector3 oldSize = new Vector3(obPart.Scale);
2843 2861
2844 float f = 1.0f; 2862 float f = 1.0f;
@@ -2898,6 +2916,8 @@ namespace OpenSim.Region.Framework.Scenes
2898 z *= a; 2916 z *= a;
2899 } 2917 }
2900 } 2918 }
2919 obPart.IgnoreUndoUpdate = false;
2920 obPart.StoreUndoState();
2901 } 2921 }
2902 } 2922 }
2903 } 2923 }
@@ -2913,6 +2933,7 @@ namespace OpenSim.Region.Framework.Scenes
2913 { 2933 {
2914 foreach (SceneObjectPart obPart in m_parts.Values) 2934 foreach (SceneObjectPart obPart in m_parts.Values)
2915 { 2935 {
2936 obPart.IgnoreUndoUpdate = true;
2916 if (obPart.UUID != m_rootPart.UUID) 2937 if (obPart.UUID != m_rootPart.UUID)
2917 { 2938 {
2918 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 2939 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -2926,6 +2947,8 @@ namespace OpenSim.Region.Framework.Scenes
2926 obPart.Resize(newSize); 2947 obPart.Resize(newSize);
2927 obPart.UpdateOffSet(currentpos); 2948 obPart.UpdateOffSet(currentpos);
2928 } 2949 }
2950 obPart.IgnoreUndoUpdate = false;
2951 obPart.StoreUndoState();
2929 } 2952 }
2930 } 2953 }
2931 2954
@@ -2935,6 +2958,8 @@ namespace OpenSim.Region.Framework.Scenes
2935 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2958 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2936 } 2959 }
2937 2960
2961 part.IgnoreUndoUpdate = false;
2962 part.StoreUndoState();
2938 HasGroupChanged = true; 2963 HasGroupChanged = true;
2939 ScheduleGroupForTerseUpdate(); 2964 ScheduleGroupForTerseUpdate();
2940 } 2965 }
@@ -2950,13 +2975,26 @@ namespace OpenSim.Region.Framework.Scenes
2950 /// <param name="pos"></param> 2975 /// <param name="pos"></param>
2951 public void UpdateGroupPosition(Vector3 pos) 2976 public void UpdateGroupPosition(Vector3 pos)
2952 { 2977 {
2978 foreach (SceneObjectPart part in Children.Values)
2979 {
2980 part.StoreUndoState();
2981 }
2953 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 2982 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
2954 { 2983 {
2955 if (IsAttachment) 2984 if (IsAttachment)
2956 { 2985 {
2957 m_rootPart.AttachedPos = pos; 2986 m_rootPart.AttachedPos = pos;
2958 } 2987 }
2959 2988 if (RootPart.GetStatusSandbox())
2989 {
2990 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
2991 {
2992 RootPart.ScriptSetPhysicsStatus(false);
2993 pos = AbsolutePosition;
2994 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
2995 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
2996 }
2997 }
2960 AbsolutePosition = pos; 2998 AbsolutePosition = pos;
2961 2999
2962 HasGroupChanged = true; 3000 HasGroupChanged = true;
@@ -2975,7 +3013,10 @@ namespace OpenSim.Region.Framework.Scenes
2975 public void UpdateSinglePosition(Vector3 pos, uint localID) 3013 public void UpdateSinglePosition(Vector3 pos, uint localID)
2976 { 3014 {
2977 SceneObjectPart part = GetChildPart(localID); 3015 SceneObjectPart part = GetChildPart(localID);
2978 3016 foreach (SceneObjectPart parts in Children.Values)
3017 {
3018 parts.StoreUndoState();
3019 }
2979 if (part != null) 3020 if (part != null)
2980 { 3021 {
2981 if (part.UUID == m_rootPart.UUID) 3022 if (part.UUID == m_rootPart.UUID)
@@ -2997,6 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes
2997 /// <param name="pos"></param> 3038 /// <param name="pos"></param>
2998 private void UpdateRootPosition(Vector3 pos) 3039 private void UpdateRootPosition(Vector3 pos)
2999 { 3040 {
3041 foreach (SceneObjectPart part in Children.Values)
3042 {
3043 part.StoreUndoState();
3044 }
3000 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3045 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3001 Vector3 oldPos = 3046 Vector3 oldPos =
3002 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3047 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3040,6 +3085,10 @@ namespace OpenSim.Region.Framework.Scenes
3040 /// <param name="rot"></param> 3085 /// <param name="rot"></param>
3041 public void UpdateGroupRotationR(Quaternion rot) 3086 public void UpdateGroupRotationR(Quaternion rot)
3042 { 3087 {
3088 foreach (SceneObjectPart parts in Children.Values)
3089 {
3090 parts.StoreUndoState();
3091 }
3043 m_rootPart.UpdateRotation(rot); 3092 m_rootPart.UpdateRotation(rot);
3044 3093
3045 PhysicsActor actor = m_rootPart.PhysActor; 3094 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3060,6 +3109,10 @@ namespace OpenSim.Region.Framework.Scenes
3060 /// <param name="rot"></param> 3109 /// <param name="rot"></param>
3061 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 3110 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
3062 { 3111 {
3112 foreach (SceneObjectPart parts in Children.Values)
3113 {
3114 parts.StoreUndoState();
3115 }
3063 m_rootPart.UpdateRotation(rot); 3116 m_rootPart.UpdateRotation(rot);
3064 3117
3065 PhysicsActor actor = m_rootPart.PhysActor; 3118 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3083,6 +3136,10 @@ namespace OpenSim.Region.Framework.Scenes
3083 public void UpdateSingleRotation(Quaternion rot, uint localID) 3136 public void UpdateSingleRotation(Quaternion rot, uint localID)
3084 { 3137 {
3085 SceneObjectPart part = GetChildPart(localID); 3138 SceneObjectPart part = GetChildPart(localID);
3139 foreach (SceneObjectPart parts in Children.Values)
3140 {
3141 parts.StoreUndoState();
3142 }
3086 if (part != null) 3143 if (part != null)
3087 { 3144 {
3088 if (part.UUID == m_rootPart.UUID) 3145 if (part.UUID == m_rootPart.UUID)
@@ -3113,8 +3170,11 @@ namespace OpenSim.Region.Framework.Scenes
3113 } 3170 }
3114 else 3171 else
3115 { 3172 {
3173 part.IgnoreUndoUpdate = true;
3116 part.UpdateRotation(rot); 3174 part.UpdateRotation(rot);
3117 part.OffsetPosition = pos; 3175 part.OffsetPosition = pos;
3176 part.IgnoreUndoUpdate = false;
3177 part.StoreUndoState();
3118 } 3178 }
3119 } 3179 }
3120 } 3180 }
@@ -3128,6 +3188,7 @@ namespace OpenSim.Region.Framework.Scenes
3128 Quaternion axRot = rot; 3188 Quaternion axRot = rot;
3129 Quaternion oldParentRot = m_rootPart.RotationOffset; 3189 Quaternion oldParentRot = m_rootPart.RotationOffset;
3130 3190
3191 m_rootPart.StoreUndoState();
3131 m_rootPart.UpdateRotation(rot); 3192 m_rootPart.UpdateRotation(rot);
3132 if (m_rootPart.PhysActor != null) 3193 if (m_rootPart.PhysActor != null)
3133 { 3194 {
@@ -3141,6 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes
3141 { 3202 {
3142 if (prim.UUID != m_rootPart.UUID) 3203 if (prim.UUID != m_rootPart.UUID)
3143 { 3204 {
3205 prim.IgnoreUndoUpdate = true;
3144 Vector3 axPos = prim.OffsetPosition; 3206 Vector3 axPos = prim.OffsetPosition;
3145 axPos *= oldParentRot; 3207 axPos *= oldParentRot;
3146 axPos *= Quaternion.Inverse(axRot); 3208 axPos *= Quaternion.Inverse(axRot);
@@ -3153,7 +3215,14 @@ namespace OpenSim.Region.Framework.Scenes
3153 } 3215 }
3154 } 3216 }
3155 } 3217 }
3156 3218 foreach (SceneObjectPart childpart in Children.Values)
3219 {
3220 if (childpart != m_rootPart)
3221 {
3222 childpart.IgnoreUndoUpdate = false;
3223 childpart.StoreUndoState();
3224 }
3225 }
3157 m_rootPart.ScheduleTerseUpdate(); 3226 m_rootPart.ScheduleTerseUpdate();
3158 } 3227 }
3159 3228
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index dd797fc..d339208 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -133,6 +133,18 @@ namespace OpenSim.Region.Framework.Scenes
133 [XmlIgnore] 133 [XmlIgnore]
134 public bool DIE_AT_EDGE; 134 public bool DIE_AT_EDGE;
135 135
136 [XmlIgnore]
137 public bool RETURN_AT_EDGE;
138
139 [XmlIgnore]
140 public bool BlockGrab;
141
142 [XmlIgnore]
143 public bool StatusSandbox;
144
145 [XmlIgnore]
146 public Vector3 StatusSandboxPos;
147
136 // TODO: This needs to be persisted in next XML version update! 148 // TODO: This needs to be persisted in next XML version update!
137 [XmlIgnore] 149 [XmlIgnore]
138 public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; 150 public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
@@ -219,6 +231,15 @@ namespace OpenSim.Region.Framework.Scenes
219 [XmlIgnore] 231 [XmlIgnore]
220 public Quaternion SpinOldOrientation = Quaternion.Identity; 232 public Quaternion SpinOldOrientation = Quaternion.Identity;
221 233
234 [XmlIgnore]
235 public Quaternion m_APIDTarget = Quaternion.Identity;
236
237 [XmlIgnore]
238 public float m_APIDDamp = 0;
239
240 [XmlIgnore]
241 public float m_APIDStrength = 0;
242
222 /// <summary> 243 /// <summary>
223 /// This part's inventory 244 /// This part's inventory
224 /// </summary> 245 /// </summary>
@@ -233,6 +254,9 @@ namespace OpenSim.Region.Framework.Scenes
233 public bool Undoing; 254 public bool Undoing;
234 255
235 [XmlIgnore] 256 [XmlIgnore]
257 public bool IgnoreUndoUpdate = false;
258
259 [XmlIgnore]
236 private PrimFlags LocalFlags; 260 private PrimFlags LocalFlags;
237 [XmlIgnore] 261 [XmlIgnore]
238 private float m_damage = -1.0f; 262 private float m_damage = -1.0f;
@@ -253,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes
253 private string m_text = String.Empty; 277 private string m_text = String.Empty;
254 private string m_touchName = String.Empty; 278 private string m_touchName = String.Empty;
255 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 279 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
280 private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5);
256 private UUID _creatorID; 281 private UUID _creatorID;
257 282
258 private bool m_passTouches; 283 private bool m_passTouches;
@@ -501,6 +526,27 @@ namespace OpenSim.Region.Framework.Scenes
501 } 526 }
502 } 527 }
503 528
529 [XmlIgnore]
530 public Quaternion APIDTarget
531 {
532 get { return m_APIDTarget; }
533 set { m_APIDTarget = value; }
534 }
535
536 [XmlIgnore]
537 public float APIDDamp
538 {
539 get { return m_APIDDamp; }
540 set { m_APIDDamp = value; }
541 }
542
543 [XmlIgnore]
544 public float APIDStrength
545 {
546 get { return m_APIDStrength; }
547 set { m_APIDStrength = value; }
548 }
549
504 public ulong RegionHandle 550 public ulong RegionHandle
505 { 551 {
506 get { return m_regionHandle; } 552 get { return m_regionHandle; }
@@ -512,6 +558,33 @@ namespace OpenSim.Region.Framework.Scenes
512 get { return m_scriptAccessPin; } 558 get { return m_scriptAccessPin; }
513 set { m_scriptAccessPin = (int)value; } 559 set { m_scriptAccessPin = (int)value; }
514 } 560 }
561 private SceneObjectPart m_PlaySoundMasterPrim = null;
562 public SceneObjectPart PlaySoundMasterPrim
563 {
564 get { return m_PlaySoundMasterPrim; }
565 set { m_PlaySoundMasterPrim = value; }
566 }
567
568 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
569 public List<SceneObjectPart> PlaySoundSlavePrims
570 {
571 get { return m_LoopSoundSlavePrims; }
572 set { m_LoopSoundSlavePrims = value; }
573 }
574
575 private SceneObjectPart m_LoopSoundMasterPrim = null;
576 public SceneObjectPart LoopSoundMasterPrim
577 {
578 get { return m_LoopSoundMasterPrim; }
579 set { m_LoopSoundMasterPrim = value; }
580 }
581
582 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
583 public List<SceneObjectPart> LoopSoundSlavePrims
584 {
585 get { return m_LoopSoundSlavePrims; }
586 set { m_LoopSoundSlavePrims = value; }
587 }
515 588
516 [XmlIgnore] 589 [XmlIgnore]
517 public Byte[] TextureAnimation 590 public Byte[] TextureAnimation
@@ -573,8 +646,6 @@ namespace OpenSim.Region.Framework.Scenes
573 } 646 }
574 set 647 set
575 { 648 {
576 StoreUndoState();
577
578 m_groupPosition = value; 649 m_groupPosition = value;
579 650
580 PhysicsActor actor = PhysActor; 651 PhysicsActor actor = PhysActor;
@@ -1401,6 +1472,10 @@ namespace OpenSim.Region.Framework.Scenes
1401 { 1472 {
1402 m_undo.Clear(); 1473 m_undo.Clear();
1403 } 1474 }
1475 lock (m_redo)
1476 {
1477 m_redo.Clear();
1478 }
1404 StoreUndoState(); 1479 StoreUndoState();
1405 } 1480 }
1406 1481
@@ -1711,6 +1786,66 @@ namespace OpenSim.Region.Framework.Scenes
1711 return m_parentGroup.RootPart.DIE_AT_EDGE; 1786 return m_parentGroup.RootPart.DIE_AT_EDGE;
1712 } 1787 }
1713 1788
1789 public bool GetReturnAtEdge()
1790 {
1791 if (m_parentGroup == null)
1792 return false;
1793 if (m_parentGroup.IsDeleted)
1794 return false;
1795
1796 return m_parentGroup.RootPart.RETURN_AT_EDGE;
1797 }
1798
1799 public void SetReturnAtEdge(bool p)
1800 {
1801 if (m_parentGroup == null)
1802 return;
1803 if (m_parentGroup.IsDeleted)
1804 return;
1805
1806 m_parentGroup.RootPart.RETURN_AT_EDGE = p;
1807 }
1808
1809 public bool GetBlockGrab()
1810 {
1811 if (m_parentGroup == null)
1812 return false;
1813 if (m_parentGroup.IsDeleted)
1814 return false;
1815
1816 return m_parentGroup.RootPart.BlockGrab;
1817 }
1818
1819 public void SetBlockGrab(bool p)
1820 {
1821 if (m_parentGroup == null)
1822 return;
1823 if (m_parentGroup.IsDeleted)
1824 return;
1825
1826 m_parentGroup.RootPart.BlockGrab = p;
1827 }
1828
1829 public void SetStatusSandbox(bool p)
1830 {
1831 if (m_parentGroup == null)
1832 return;
1833 if (m_parentGroup.IsDeleted)
1834 return;
1835 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
1836 m_parentGroup.RootPart.StatusSandbox = p;
1837 }
1838
1839 public bool GetStatusSandbox()
1840 {
1841 if (m_parentGroup == null)
1842 return false;
1843 if (m_parentGroup.IsDeleted)
1844 return false;
1845
1846 return m_parentGroup.RootPart.StatusSandbox;
1847 }
1848
1714 public int GetAxisRotation(int axis) 1849 public int GetAxisRotation(int axis)
1715 { 1850 {
1716 //Cannot use ScriptBaseClass constants as no referance to it currently. 1851 //Cannot use ScriptBaseClass constants as no referance to it currently.
@@ -1917,7 +2052,7 @@ namespace OpenSim.Region.Framework.Scenes
1917 // play the sound. 2052 // play the sound.
1918 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2053 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
1919 { 2054 {
1920 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); 2055 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
1921 } 2056 }
1922 2057
1923 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) 2058 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
@@ -2491,9 +2626,8 @@ namespace OpenSim.Region.Framework.Scenes
2491 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2626 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
2492 foreach (ScenePresence p in avatarts) 2627 foreach (ScenePresence p in avatarts)
2493 { 2628 {
2494 // TODO: some filtering by distance of avatar 2629 if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100))
2495 2630 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2496 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2497 } 2631 }
2498 } 2632 }
2499 2633
@@ -2554,7 +2688,38 @@ namespace OpenSim.Region.Framework.Scenes
2554 2688
2555 public void RotLookAt(Quaternion target, float strength, float damping) 2689 public void RotLookAt(Quaternion target, float strength, float damping)
2556 { 2690 {
2557 m_parentGroup.rotLookAt(target, strength, damping); 2691 rotLookAt(target, strength, damping);
2692 }
2693
2694 public void rotLookAt(Quaternion target, float strength, float damping)
2695 {
2696 if (IsAttachment)
2697 {
2698 /*
2699 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2700 if (avatar != null)
2701 {
2702 Rotate the Av?
2703 } */
2704 }
2705 else
2706 {
2707 APIDDamp = damping;
2708 APIDStrength = strength;
2709 APIDTarget = target;
2710 }
2711 }
2712
2713 public void startLookAt(Quaternion rot, float damp, float strength)
2714 {
2715 APIDDamp = damp;
2716 APIDStrength = strength;
2717 APIDTarget = rot;
2718 }
2719
2720 public void stopLookAt()
2721 {
2722 APIDTarget = Quaternion.Identity;
2558 } 2723 }
2559 2724
2560 /// <summary> 2725 /// <summary>
@@ -2814,7 +2979,7 @@ namespace OpenSim.Region.Framework.Scenes
2814 /// <param name="volume"></param> 2979 /// <param name="volume"></param>
2815 /// <param name="triggered"></param> 2980 /// <param name="triggered"></param>
2816 /// <param name="flags"></param> 2981 /// <param name="flags"></param>
2817 public void SendSound(string sound, double volume, bool triggered, byte flags) 2982 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2818 { 2983 {
2819 if (volume > 1) 2984 if (volume > 1)
2820 volume = 1; 2985 volume = 1;
@@ -2850,10 +3015,51 @@ namespace OpenSim.Region.Framework.Scenes
2850 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); 3015 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>();
2851 if (soundModule != null) 3016 if (soundModule != null)
2852 { 3017 {
2853 if (triggered) 3018 if (useMaster)
2854 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); 3019 {
3020 if (isMaster)
3021 {
3022 if (triggered)
3023 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3024 else
3025 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3026 ParentGroup.PlaySoundMasterPrim = this;
3027 ownerID = this._ownerID;
3028 objectID = this.UUID;
3029 parentID = this.GetRootPartUUID();
3030 position = this.AbsolutePosition; // region local
3031 regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle;
3032 if (triggered)
3033 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3034 else
3035 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3036 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
3037 {
3038 ownerID = prim._ownerID;
3039 objectID = prim.UUID;
3040 parentID = prim.GetRootPartUUID();
3041 position = prim.AbsolutePosition; // region local
3042 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
3043 if (triggered)
3044 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3045 else
3046 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3047 }
3048 ParentGroup.PlaySoundSlavePrims.Clear();
3049 ParentGroup.PlaySoundMasterPrim = null;
3050 }
3051 else
3052 {
3053 ParentGroup.PlaySoundSlavePrims.Add(this);
3054 }
3055 }
2855 else 3056 else
2856 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); 3057 {
3058 if (triggered)
3059 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3060 else
3061 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3062 }
2857 } 3063 }
2858 } 3064 }
2859 3065
@@ -3156,6 +3362,14 @@ namespace OpenSim.Region.Framework.Scenes
3156 hasProfileCut = hasDimple; // is it the same thing? 3362 hasProfileCut = hasDimple; // is it the same thing?
3157 } 3363 }
3158 3364
3365 public void SetVehicleFlags(int param, bool remove)
3366 {
3367 if (PhysActor != null)
3368 {
3369 PhysActor.VehicleFlags(param, remove);
3370 }
3371 }
3372
3159 public void SetGroup(UUID groupID, IClientAPI client) 3373 public void SetGroup(UUID groupID, IClientAPI client)
3160 { 3374 {
3161 _groupID = groupID; 3375 _groupID = groupID;
@@ -3260,27 +3474,30 @@ namespace OpenSim.Region.Framework.Scenes
3260 { 3474 {
3261 if (!Undoing) 3475 if (!Undoing)
3262 { 3476 {
3263 if (m_parentGroup != null) 3477 if (!IgnoreUndoUpdate)
3264 { 3478 {
3265 lock (m_undo) 3479 if (m_parentGroup != null)
3266 { 3480 {
3267 if (m_undo.Count > 0) 3481 lock (m_undo)
3268 { 3482 {
3269 UndoState last = m_undo.Peek(); 3483 if (m_undo.Count > 0)
3270 if (last != null)
3271 { 3484 {
3272 if (last.Compare(this)) 3485 UndoState last = m_undo.Peek();
3273 return; 3486 if (last != null)
3487 {
3488 if (last.Compare(this))
3489 return;
3490 }
3274 } 3491 }
3275 }
3276 3492
3277 if (m_parentGroup.GetSceneMaxUndo() > 0) 3493 if (m_parentGroup.GetSceneMaxUndo() > 0)
3278 { 3494 {
3279 UndoState nUndo = new UndoState(this); 3495 UndoState nUndo = new UndoState(this);
3280 3496
3281 m_undo.Push(nUndo); 3497 m_undo.Push(nUndo);
3282 } 3498 }
3283 3499
3500 }
3284 } 3501 }
3285 } 3502 }
3286 } 3503 }
@@ -3751,11 +3968,36 @@ namespace OpenSim.Region.Framework.Scenes
3751 lock (m_undo) 3968 lock (m_undo)
3752 { 3969 {
3753 if (m_undo.Count > 0) 3970 if (m_undo.Count > 0)
3971 {
3972 UndoState nUndo = null;
3973 if (m_parentGroup.GetSceneMaxUndo() > 0)
3754 { 3974 {
3755 UndoState goback = m_undo.Pop(); 3975 nUndo = new UndoState(this);
3756 if (goback != null) 3976 }
3757 goback.PlaybackState(this); 3977 UndoState goback = m_undo.Pop();
3978 if (goback != null)
3979 {
3980 goback.PlaybackState(this);
3981 if (nUndo != null)
3982 m_redo.Push(nUndo);
3983 }
3984 }
3985 }
3986 }
3987
3988 public void Redo()
3989 {
3990 lock (m_redo)
3991 {
3992 if (m_parentGroup.GetSceneMaxUndo() > 0)
3993 {
3994 UndoState nUndo = new UndoState(this);
3995
3996 m_undo.Push(nUndo);
3758 } 3997 }
3998 UndoState gofwd = m_redo.Pop();
3999 if (gofwd != null)
4000 gofwd.PlayfwdState(this);
3759 } 4001 }
3760 } 4002 }
3761 4003
@@ -3802,6 +4044,18 @@ namespace OpenSim.Region.Framework.Scenes
3802 (pos.Z != OffsetPosition.Z)) 4044 (pos.Z != OffsetPosition.Z))
3803 { 4045 {
3804 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 4046 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4047
4048 if (ParentGroup.RootPart.GetStatusSandbox())
4049 {
4050 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
4051 {
4052 ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
4053 newPos = OffsetPosition;
4054 ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
4055 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
4056 }
4057 }
4058
3805 OffsetPosition = newPos; 4059 OffsetPosition = newPos;
3806 ScheduleTerseUpdate(); 4060 ScheduleTerseUpdate();
3807 } 4061 }
@@ -4094,7 +4348,6 @@ namespace OpenSim.Region.Framework.Scenes
4094 (rot.Z != RotationOffset.Z) || 4348 (rot.Z != RotationOffset.Z) ||
4095 (rot.W != RotationOffset.W)) 4349 (rot.W != RotationOffset.W))
4096 { 4350 {
4097 //StoreUndoState();
4098 RotationOffset = rot; 4351 RotationOffset = rot;
4099 ParentGroup.HasGroupChanged = true; 4352 ParentGroup.HasGroupChanged = true;
4100 ScheduleTerseUpdate(); 4353 ScheduleTerseUpdate();
@@ -4396,5 +4649,36 @@ namespace OpenSim.Region.Framework.Scenes
4396 4649
4397 Inventory.ApplyNextOwnerPermissions(); 4650 Inventory.ApplyNextOwnerPermissions();
4398 } 4651 }
4652 public void UpdateLookAt()
4653 {
4654 try
4655 {
4656 if (APIDTarget != Quaternion.Identity)
4657 {
4658 if (Single.IsNaN(APIDTarget.W) == true)
4659 {
4660 APIDTarget = Quaternion.Identity;
4661 return;
4662 }
4663 Quaternion rot = RotationOffset;
4664 Quaternion dir = (rot - APIDTarget);
4665 float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f));
4666 if (dir.Z > speed)
4667 {
4668 rot.Z -= speed;
4669 }
4670 if (dir.Z < -speed)
4671 {
4672 rot.Z += speed;
4673 }
4674 rot.Normalize();
4675 UpdateRotation(rot);
4676 }
4677 }
4678 catch (Exception ex)
4679 {
4680 m_log.Error("[Physics] " + ex);
4681 }
4682 }
4399 } 4683 }
4400} 4684}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b8a937a..6b6fa7c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -164,6 +164,8 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 private Quaternion m_bodyRot= Quaternion.Identity; 165 private Quaternion m_bodyRot= Quaternion.Identity;
166 166
167 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
168
167 private const int LAND_VELOCITYMAG_MAX = 12; 169 private const int LAND_VELOCITYMAG_MAX = 12;
168 170
169 public bool IsRestrictedToRegion; 171 public bool IsRestrictedToRegion;
@@ -510,6 +512,12 @@ namespace OpenSim.Region.Framework.Scenes
510 set { m_bodyRot = value; } 512 set { m_bodyRot = value; }
511 } 513 }
512 514
515 public Quaternion PreviousRotation
516 {
517 get { return m_bodyRotPrevious; }
518 set { m_bodyRotPrevious = value; }
519 }
520
513 /// <summary> 521 /// <summary>
514 /// If this is true, agent doesn't have a representation in this scene. 522 /// If this is true, agent doesn't have a representation in this scene.
515 /// this is an agent 'looking into' this scene from a nearby scene(region) 523 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -826,6 +834,31 @@ namespace OpenSim.Region.Framework.Scenes
826 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 834 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
827 { 835 {
828 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 836 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
837
838 if (pos.X < 0)
839 {
840 emergencyPos.X = (int)Constants.RegionSize + pos.X;
841 if (!(pos.Y < 0))
842 emergencyPos.Y = pos.Y;
843 if (!(pos.Z < 0))
844 emergencyPos.X = pos.X;
845 }
846 if (pos.Y < 0)
847 {
848 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
849 if (!(pos.X < 0))
850 emergencyPos.X = pos.X;
851 if (!(pos.Z < 0))
852 emergencyPos.Z = pos.Z;
853 }
854 if (pos.Z < 0)
855 {
856 if (!(pos.X < 0))
857 emergencyPos.X = pos.X;
858 if (!(pos.Y < 0))
859 emergencyPos.Y = pos.Y;
860 //Leave as 128
861 }
829 862
830 m_log.WarnFormat( 863 m_log.WarnFormat(
831 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 864 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -1208,6 +1241,14 @@ namespace OpenSim.Region.Framework.Scenes
1208 } 1241 }
1209 else 1242 else
1210 { 1243 {
1244 if (m_pos.X < 0)
1245 m_pos.X = 128;
1246 if (m_pos.Y < 0)
1247 m_pos.Y = 128;
1248 if (m_pos.X > Scene.WestBorders[0].BorderLine.X)
1249 m_pos.X = 128;
1250 if (m_pos.Y > Scene.NorthBorders[0].BorderLine.Y)
1251 m_pos.Y = 128;
1211 m_LastFinitePos = m_pos; 1252 m_LastFinitePos = m_pos;
1212 } 1253 }
1213 1254
@@ -2518,6 +2559,8 @@ namespace OpenSim.Region.Framework.Scenes
2518 /// </summary> 2559 /// </summary>
2519 public void SendWearables() 2560 public void SendWearables()
2520 { 2561 {
2562 m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
2563
2521 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2564 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2522 } 2565 }
2523 2566
@@ -2721,36 +2764,72 @@ namespace OpenSim.Region.Framework.Scenes
2721 { 2764 {
2722 // Checks if where it's headed exists a region 2765 // Checks if where it's headed exists a region
2723 2766
2767 bool needsTransit = false;
2724 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2768 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2725 { 2769 {
2726 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2770 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2771 {
2772 needsTransit = true;
2727 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2773 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2774 }
2728 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2775 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2776 {
2777 needsTransit = true;
2729 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2778 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2779 }
2730 else 2780 else
2781 {
2782 needsTransit = true;
2731 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2783 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2784 }
2732 } 2785 }
2733 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2786 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2734 { 2787 {
2735 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2788 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2789 {
2790 needsTransit = true;
2736 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2791 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2792 }
2737 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2793 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2794 {
2795 needsTransit = true;
2738 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2796 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2797 }
2739 else 2798 else
2799 {
2800 needsTransit = true;
2740 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2801 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2802 }
2741 } 2803 }
2742 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2804 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2805 {
2806 needsTransit = true;
2743 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2807 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2808 }
2744 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2809 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2810 {
2811 needsTransit = true;
2745 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2812 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2813 }
2814
2746 2815
2747
2748 // Makes sure avatar does not end up outside region 2816 // Makes sure avatar does not end up outside region
2749 if (neighbor < 0) 2817 if (neighbor <= 0)
2750 AbsolutePosition = new Vector3( 2818 {
2751 AbsolutePosition.X + 3*fix[0], 2819 if (!needsTransit)
2752 AbsolutePosition.Y + 3*fix[1], 2820 {
2753 AbsolutePosition.Z); 2821 Vector3 pos = AbsolutePosition;
2822 if (AbsolutePosition.X < 0)
2823 pos.X += Velocity.Y;
2824 else if (AbsolutePosition.X > Constants.RegionSize)
2825 pos.X -= Velocity.Y;
2826 if (AbsolutePosition.Y < 0)
2827 pos.Y += Velocity.Y;
2828 else if (AbsolutePosition.Y > Constants.RegionSize)
2829 pos.Y -= Velocity.Y;
2830 AbsolutePosition = pos;
2831 }
2832 }
2754 else if (neighbor > 0) 2833 else if (neighbor > 0)
2755 CrossToNewRegion(); 2834 CrossToNewRegion();
2756 } 2835 }
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 713ff69..55e407e 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Region.Framework.Interfaces;
29 30
30namespace OpenSim.Region.Framework.Scenes 31namespace OpenSim.Region.Framework.Scenes
31{ 32{
@@ -35,29 +36,21 @@ namespace OpenSim.Region.Framework.Scenes
35 public Vector3 Scale = Vector3.Zero; 36 public Vector3 Scale = Vector3.Zero;
36 public Quaternion Rotation = Quaternion.Identity; 37 public Quaternion Rotation = Quaternion.Identity;
37 38
38 public UndoState(Vector3 pos, Quaternion rot, Vector3 scale)
39 {
40 Position = pos;
41 Rotation = rot;
42 Scale = scale;
43 }
44
45 public UndoState(SceneObjectPart part) 39 public UndoState(SceneObjectPart part)
46 { 40 {
47 if (part != null) 41 if (part != null)
48 { 42 {
49 if (part.ParentID == 0) 43 if (part.ParentID == 0)
50 { 44 {
51 Position = part.AbsolutePosition; 45 Position = part.ParentGroup.AbsolutePosition;
52 Rotation = part.RotationOffset; 46 Rotation = part.RotationOffset;
53 47 Scale = part.Shape.Scale;
54 } 48 }
55 else 49 else
56 { 50 {
57 Position = part.OffsetPosition; 51 Position = part.OffsetPosition;
58 Rotation = part.RotationOffset; 52 Rotation = part.RotationOffset;
59 Scale = part.Shape.Scale; 53 Scale = part.Shape.Scale;
60
61 } 54 }
62 } 55 }
63 } 56 }
@@ -68,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
68 { 61 {
69 if (part.ParentID == 0) 62 if (part.ParentID == 0)
70 { 63 {
71 if (Position == part.AbsolutePosition && Rotation == part.RotationOffset) 64 if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation)
72 return true; 65 return true;
73 else 66 else
74 return false; 67 return false;
@@ -93,24 +86,78 @@ namespace OpenSim.Region.Framework.Scenes
93 86
94 if (part.ParentID == 0) 87 if (part.ParentID == 0)
95 { 88 {
96 part.ParentGroup.AbsolutePosition = Position; 89 if (Position != Vector3.Zero)
97 part.UpdateRotation(Rotation); 90 part.ParentGroup.AbsolutePosition = Position;
91 part.RotationOffset = Rotation;
92 if (Scale != Vector3.Zero)
93 part.Resize(Scale);
98 part.ParentGroup.ScheduleGroupForTerseUpdate(); 94 part.ParentGroup.ScheduleGroupForTerseUpdate();
99 } 95 }
100 else 96 else
101 { 97 {
102 part.OffsetPosition = Position; 98 if (Position != Vector3.Zero)
99 part.OffsetPosition = Position;
103 part.UpdateRotation(Rotation); 100 part.UpdateRotation(Rotation);
104 part.Resize(Scale); 101 if (Scale != Vector3.Zero)
102 part.Resize(Scale); part.ScheduleTerseUpdate();
103 }
104 part.Undoing = false;
105
106 }
107 }
108 public void PlayfwdState(SceneObjectPart part)
109 {
110 if (part != null)
111 {
112 part.Undoing = true;
113
114 if (part.ParentID == 0)
115 {
116 if (Position != Vector3.Zero)
117 part.ParentGroup.AbsolutePosition = Position;
118 if (Rotation != Quaternion.Identity)
119 part.UpdateRotation(Rotation);
120 if (Scale != Vector3.Zero)
121 part.Resize(Scale);
122 part.ParentGroup.ScheduleGroupForTerseUpdate();
123 }
124 else
125 {
126 if (Position != Vector3.Zero)
127 part.OffsetPosition = Position;
128 if (Rotation != Quaternion.Identity)
129 part.UpdateRotation(Rotation);
130 if (Scale != Vector3.Zero)
131 part.Resize(Scale);
105 part.ScheduleTerseUpdate(); 132 part.ScheduleTerseUpdate();
106 } 133 }
107 part.Undoing = false; 134 part.Undoing = false;
108 135
109 } 136 }
110 } 137 }
138 }
139 public class LandUndoState
140 {
141 public ITerrainModule m_terrainModule;
142 public ITerrainChannel m_terrainChannel;
143
144 public LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel)
145 {
146 m_terrainModule = terrainModule;
147 m_terrainChannel = terrainChannel;
148 }
149
150 public bool Compare(ITerrainChannel terrainChannel)
151 {
152 if (m_terrainChannel != terrainChannel)
153 return false;
154 else
155 return false;
156 }
111 157
112 public UndoState() 158 public void PlaybackState()
113 { 159 {
160 m_terrainModule.UndoTerrain(m_terrainChannel);
114 } 161 }
115 } 162 }
116} 163}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index a781a1d..f54733d 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -780,6 +780,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
780 public event UUIDNameRequest OnTeleportHomeRequest; 780 public event UUIDNameRequest OnTeleportHomeRequest;
781 public event ScriptAnswer OnScriptAnswer; 781 public event ScriptAnswer OnScriptAnswer;
782 public event AgentSit OnUndo; 782 public event AgentSit OnUndo;
783 public event AgentSit OnRedo;
784 public event LandUndo OnLandUndo;
783 public event ForceReleaseControls OnForceReleaseControls; 785 public event ForceReleaseControls OnForceReleaseControls;
784 public event GodLandStatRequest OnLandStatRequest; 786 public event GodLandStatRequest OnLandStatRequest;
785 public event DetailedEstateDataRequest OnDetailedEstateDataRequest; 787 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 31f28e0..5bfe4be 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -767,7 +767,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
767 if (!CanEdit()) 767 if (!CanEdit())
768 return; 768 return;
769 769
770 GetSOP().SendSound(asset.ToString(), volume, true, 0); 770 GetSOP().SendSound(asset.ToString(), volume, true, 0, 0, false, false);
771 } 771 }
772 772
773 #endregion 773 #endregion
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index c7cd37b..45bb005 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
231 if (soundModule != null) 231 if (soundModule != null)
232 { 232 {
233 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position, 233 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position,
234 m_internalScene.RegionInfo.RegionHandle); 234 m_internalScene.RegionInfo.RegionHandle, 0);
235 } 235 }
236 } 236 }
237 237
@@ -241,7 +241,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
241 if (soundModule != null) 241 if (soundModule != null)
242 { 242 {
243 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position, 243 soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position,
244 m_internalScene.RegionInfo.RegionHandle); 244 m_internalScene.RegionInfo.RegionHandle, 0);
245 } 245 }
246 } 246 }
247 247
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 57ab6ad..ea46945 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -298,6 +298,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
298 public event ObjectBuy OnObjectBuy; 298 public event ObjectBuy OnObjectBuy;
299 public event BuyObjectInventory OnBuyObjectInventory; 299 public event BuyObjectInventory OnBuyObjectInventory;
300 public event AgentSit OnUndo; 300 public event AgentSit OnUndo;
301 public event AgentSit OnRedo;
302 public event LandUndo OnLandUndo;
301 303
302 public event ForceReleaseControls OnForceReleaseControls; 304 public event ForceReleaseControls OnForceReleaseControls;
303 public event GodLandStatRequest OnLandStatRequest; 305 public event GodLandStatRequest OnLandStatRequest;
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index 92a205b..3ed338b 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -104,9 +104,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
104 this.m_name = field[1].Trim(); 104 this.m_name = field[1].Trim();
105 this.m_frozen = (copsedef[0] == 'F'); 105 this.m_frozen = (copsedef[0] == 'F');
106 this.m_tree_quantity = int.Parse(field[2]); 106 this.m_tree_quantity = int.Parse(field[2]);
107 this.m_treeline_high = float.Parse(field[3]); 107 this.m_treeline_high = float.Parse(field[3], Culture.NumberFormatInfo);
108 this.m_treeline_low = float.Parse(field[4]); 108 this.m_treeline_low = float.Parse(field[4], Culture.NumberFormatInfo);
109 this.m_range = double.Parse(field[5]); 109 this.m_range = double.Parse(field[5], Culture.NumberFormatInfo);
110 this.m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]); 110 this.m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]);
111 this.m_seed_point = Vector3.Parse(field[7]); 111 this.m_seed_point = Vector3.Parse(field[7]);
112 this.m_initial_scale = Vector3.Parse(field[8]); 112 this.m_initial_scale = Vector3.Parse(field[8]);
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 31366db..5e2eeeb 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -185,6 +185,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
185 185
186 } 186 }
187 187
188 public override void VehicleFlags(int param, bool remove)
189 {
190
191 }
192
188 public override void SetVolumeDetect(int param) 193 public override void SetVolumeDetect(int param)
189 { 194 {
190 195
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
index 97eb6a2..6a54705 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
@@ -362,6 +362,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
362 362
363 } 363 }
364 364
365 public override void VehicleFlags(int param, bool remove)
366 {
367
368 }
369
365 public override void SetVolumeDetect(int param) 370 public override void SetVolumeDetect(int param)
366 { 371 {
367 372
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
index 9603ea4..920ed96 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
@@ -397,6 +397,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
397 //TODO: 397 //TODO:
398 } 398 }
399 399
400 public override void VehicleFlags(int param, bool remove)
401 {
402
403 }
404
400 public override void SetVolumeDetect(int param) 405 public override void SetVolumeDetect(int param)
401 { 406 {
402 //TODO: GhostObject 407 //TODO: GhostObject
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index d5d146e..e2a6a2e 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -500,6 +500,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin
500 public BulletXScene(String sceneIdentifier) 500 public BulletXScene(String sceneIdentifier)
501 { 501 {
502 //identifier = sceneIdentifier; 502 //identifier = sceneIdentifier;
503 cDispatcher = new CollisionDispatcherLocal(this);
504 Vector3 worldMinDim = new Vector3((float)minXY, (float)minXY, (float)minZ);
505 Vector3 worldMaxDim = new Vector3((float)maxXY, (float)maxXY, (float)maxZ);
506 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles);
507 sicSolver = new SequentialImpulseConstraintSolver();
508
509 lock (BulletXLock)
510 {
511 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver);
512 ddWorld.Gravity = new Vector3(0, 0, -gravity);
513 }
514 //this._heightmap = new float[65536];
503 } 515 }
504 516
505 public static float Gravity 517 public static float Gravity
@@ -582,12 +594,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
582 pos.Y = position.Y; 594 pos.Y = position.Y;
583 pos.Z = position.Z + 20; 595 pos.Z = position.Z + 20;
584 BulletXCharacter newAv = null; 596 BulletXCharacter newAv = null;
585 newAv.Flying = isFlying;
586 lock (BulletXLock) 597 lock (BulletXLock)
587 { 598 {
588 newAv = new BulletXCharacter(avName, this, pos); 599 newAv = new BulletXCharacter(avName, this, pos);
589 _characters.Add(newAv.RigidBody, newAv); 600 _characters.Add(newAv.RigidBody, newAv);
590 } 601 }
602 newAv.Flying = isFlying;
591 return newAv; 603 return newAv;
592 } 604 }
593 605
@@ -984,6 +996,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
984 { 996 {
985 997
986 } 998 }
999
1000 public override void VehicleFlags(int param, bool remove)
1001 {
1002
1003 }
987 1004
988 public override void SetVolumeDetect(int param) 1005 public override void SetVolumeDetect(int param)
989 { 1006 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 9c192ed..880c3ea 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -208,6 +208,7 @@ namespace OpenSim.Region.Physics.Manager
208 public abstract void VehicleFloatParam(int param, float value); 208 public abstract void VehicleFloatParam(int param, float value);
209 public abstract void VehicleVectorParam(int param, Vector3 value); 209 public abstract void VehicleVectorParam(int param, Vector3 value);
210 public abstract void VehicleRotationParam(int param, Quaternion rotation); 210 public abstract void VehicleRotationParam(int param, Quaternion rotation);
211 public abstract void VehicleFlags(int param, bool remove);
211 212
212 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 213 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
213 214
@@ -352,6 +353,11 @@ namespace OpenSim.Region.Physics.Manager
352 353
353 } 354 }
354 355
356 public override void VehicleFlags(int param, bool remove)
357 {
358
359 }
360
355 public override void SetVolumeDetect(int param) 361 public override void SetVolumeDetect(int param)
356 { 362 {
357 363
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs
index 532e55e..f0775c1 100644
--- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs
+++ b/OpenSim/Region/Physics/Manager/VehicleConstants.cs
@@ -91,7 +91,9 @@ namespace OpenSim.Region.Physics.Manager
91 BANKING_EFFICIENCY = 38, 91 BANKING_EFFICIENCY = 38,
92 BANKING_MIX = 39, 92 BANKING_MIX = 39,
93 BANKING_TIMESCALE = 40, 93 BANKING_TIMESCALE = 40,
94 REFERENCE_FRAME = 44 94 REFERENCE_FRAME = 44,
95 BLOCK_EXIT = 45,
96 ROLL_FRAME = 46
95 97
96 } 98 }
97 99
@@ -107,7 +109,13 @@ namespace OpenSim.Region.Physics.Manager
107 LIMIT_MOTOR_UP = 64, 109 LIMIT_MOTOR_UP = 64,
108 MOUSELOOK_STEER = 128, 110 MOUSELOOK_STEER = 128,
109 MOUSELOOK_BANK = 256, 111 MOUSELOOK_BANK = 256,
110 CAMERA_DECOUPLED = 512 112 CAMERA_DECOUPLED = 512,
113 NO_X = 1024,
114 NO_Y = 2048,
115 NO_Z = 4096,
116 LOCK_HOVER_HEIGHT = 8192,
117 NO_DEFLECTION = 16392,
118 LOCK_ROTATION = 32784
111 } 119 }
112 120
113} 121}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 06ed8fb..a2229e8 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -734,6 +734,11 @@ namespace OpenSim.Region.Physics.OdePlugin
734 734
735 } 735 }
736 736
737 public override void VehicleFlags(int param, bool remove)
738 {
739
740 }
741
737 public override void SetVolumeDetect(int param) 742 public override void SetVolumeDetect(int param)
738 { 743 {
739 744
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 008070b..6ae0c8a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -82,7 +82,9 @@ namespace OpenSim.Region.Physics.OdePlugin
82 // HOVER_UP_ONLY 82 // HOVER_UP_ONLY
83 // LIMIT_MOTOR_UP 83 // LIMIT_MOTOR_UP
84 // LIMIT_ROLL_ONLY 84 // LIMIT_ROLL_ONLY
85 85 private VehicleFlag m_Hoverflags = (VehicleFlag)0;
86 private Vector3 m_BlockingEndPoint = Vector3.Zero;
87 private Quaternion m_RollreferenceFrame = Quaternion.Identity;
86 // Linear properties 88 // Linear properties
87 private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time 89 private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
88 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL 90 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
@@ -91,6 +93,7 @@ namespace OpenSim.Region.Physics.OdePlugin
91 private float m_linearMotorDecayTimescale = 0; 93 private float m_linearMotorDecayTimescale = 0;
92 private float m_linearMotorTimescale = 0; 94 private float m_linearMotorTimescale = 0;
93 private Vector3 m_lastLinearVelocityVector = Vector3.Zero; 95 private Vector3 m_lastLinearVelocityVector = Vector3.Zero;
96 private d.Vector3 m_lastPositionVector = new d.Vector3();
94 // private bool m_LinearMotorSetLastFrame = false; 97 // private bool m_LinearMotorSetLastFrame = false;
95 // private Vector3 m_linearMotorOffset = Vector3.Zero; 98 // private Vector3 m_linearMotorOffset = Vector3.Zero;
96 99
@@ -255,6 +258,9 @@ namespace OpenSim.Region.Physics.OdePlugin
255 case Vehicle.LINEAR_MOTOR_OFFSET: 258 case Vehicle.LINEAR_MOTOR_OFFSET:
256 // m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); 259 // m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
257 break; 260 break;
261 case Vehicle.BLOCK_EXIT:
262 m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z);
263 break;
258 } 264 }
259 }//end ProcessVectorVehicleParam 265 }//end ProcessVectorVehicleParam
260 266
@@ -265,15 +271,189 @@ namespace OpenSim.Region.Physics.OdePlugin
265 case Vehicle.REFERENCE_FRAME: 271 case Vehicle.REFERENCE_FRAME:
266 // m_referenceFrame = pValue; 272 // m_referenceFrame = pValue;
267 break; 273 break;
274 case Vehicle.ROLL_FRAME:
275 m_RollreferenceFrame = pValue;
276 break;
268 } 277 }
269 }//end ProcessRotationVehicleParam 278 }//end ProcessRotationVehicleParam
270 279
280 internal void ProcessVehicleFlags(int pParam, bool remove)
281 {
282 if (remove)
283 {
284 if (pParam == -1)
285 {
286 m_flags = (VehicleFlag)0;
287 m_Hoverflags = (VehicleFlag)0;
288 return;
289 }
290 if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT)
291 {
292 if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != (VehicleFlag)0)
293 m_Hoverflags &= ~(VehicleFlag.HOVER_GLOBAL_HEIGHT);
294 }
295 if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY)
296 {
297 if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != (VehicleFlag)0)
298 m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY);
299 }
300 if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY)
301 {
302 if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != (VehicleFlag)0)
303 m_Hoverflags &= ~(VehicleFlag.HOVER_UP_ONLY);
304 }
305 if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY)
306 {
307 if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != (VehicleFlag)0)
308 m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY);
309 }
310 if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP)
311 {
312 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != (VehicleFlag)0)
313 m_flags &= ~(VehicleFlag.LIMIT_MOTOR_UP);
314 }
315 if ((pParam & (int)VehicleFlag.LIMIT_ROLL_ONLY) == (int)VehicleFlag.LIMIT_ROLL_ONLY)
316 {
317 if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) != (VehicleFlag)0)
318 m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY);
319 }
320 if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK)
321 {
322 if ((m_flags & VehicleFlag.MOUSELOOK_BANK) != (VehicleFlag)0)
323 m_flags &= ~(VehicleFlag.MOUSELOOK_BANK);
324 }
325 if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER)
326 {
327 if ((m_flags & VehicleFlag.MOUSELOOK_STEER) != (VehicleFlag)0)
328 m_flags &= ~(VehicleFlag.MOUSELOOK_STEER);
329 }
330 if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP)
331 {
332 if ((m_flags & VehicleFlag.NO_DEFLECTION_UP) != (VehicleFlag)0)
333 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP);
334 }
335 if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED)
336 {
337 if ((m_flags & VehicleFlag.CAMERA_DECOUPLED) != (VehicleFlag)0)
338 m_flags &= ~(VehicleFlag.CAMERA_DECOUPLED);
339 }
340 if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X)
341 {
342 if ((m_flags & VehicleFlag.NO_X) != (VehicleFlag)0)
343 m_flags &= ~(VehicleFlag.NO_X);
344 }
345 if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y)
346 {
347 if ((m_flags & VehicleFlag.NO_Y) != (VehicleFlag)0)
348 m_flags &= ~(VehicleFlag.NO_Y);
349 }
350 if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z)
351 {
352 if ((m_flags & VehicleFlag.NO_Z) != (VehicleFlag)0)
353 m_flags &= ~(VehicleFlag.NO_Z);
354 }
355 if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT)
356 {
357 if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != (VehicleFlag)0)
358 m_Hoverflags &= ~(VehicleFlag.LOCK_HOVER_HEIGHT);
359 }
360 if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION)
361 {
362 if ((m_flags & VehicleFlag.NO_DEFLECTION) != (VehicleFlag)0)
363 m_flags &= ~(VehicleFlag.NO_DEFLECTION);
364 }
365 if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION)
366 {
367 if ((m_flags & VehicleFlag.LOCK_ROTATION) != (VehicleFlag)0)
368 m_flags &= ~(VehicleFlag.LOCK_ROTATION);
369 }
370 }
371 else
372 {
373 if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT)
374 {
375 m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT | m_flags);
376 }
377 if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY)
378 {
379 m_Hoverflags |= (VehicleFlag.HOVER_TERRAIN_ONLY | m_flags);
380 }
381 if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY)
382 {
383 m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY | m_flags);
384 }
385 if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY)
386 {
387 m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY | m_flags);
388 }
389 if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP)
390 {
391 m_flags |= (VehicleFlag.LIMIT_MOTOR_UP | m_flags);
392 }
393 if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK)
394 {
395 m_flags |= (VehicleFlag.MOUSELOOK_BANK | m_flags);
396 }
397 if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER)
398 {
399 m_flags |= (VehicleFlag.MOUSELOOK_STEER | m_flags);
400 }
401 if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP)
402 {
403 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | m_flags);
404 }
405 if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED)
406 {
407 m_flags |= (VehicleFlag.CAMERA_DECOUPLED | m_flags);
408 }
409 if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X)
410 {
411 m_flags |= (VehicleFlag.NO_X);
412 }
413 if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y)
414 {
415 m_flags |= (VehicleFlag.NO_Y);
416 }
417 if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z)
418 {
419 m_flags |= (VehicleFlag.NO_Z);
420 }
421 if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT)
422 {
423 m_Hoverflags |= (VehicleFlag.LOCK_HOVER_HEIGHT);
424 }
425 if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION)
426 {
427 m_flags |= (VehicleFlag.NO_DEFLECTION);
428 }
429 if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION)
430 {
431 m_flags |= (VehicleFlag.LOCK_ROTATION);
432 }
433 }
434 }//end ProcessVehicleFlags
435
271 internal void ProcessTypeChange(Vehicle pType) 436 internal void ProcessTypeChange(Vehicle pType)
272 { 437 {
273 // Set Defaults For Type 438 // Set Defaults For Type
274 m_type = pType; 439 m_type = pType;
275 switch (pType) 440 switch (pType)
276 { 441 {
442 case Vehicle.TYPE_NONE:
443 m_linearFrictionTimescale = new Vector3(0, 0, 0);
444 m_angularFrictionTimescale = new Vector3(0, 0, 0);
445 m_linearMotorDirection = Vector3.Zero;
446 m_linearMotorTimescale = 0;
447 m_linearMotorDecayTimescale = 0;
448 m_angularMotorDirection = Vector3.Zero;
449 m_angularMotorTimescale = 0;
450 m_angularMotorDecayTimescale = 0;
451 m_VhoverHeight = 0;
452 m_VhoverTimescale = 0;
453 m_VehicleBuoyancy = 0;
454 m_flags = (VehicleFlag)0;
455 break;
456
277 case Vehicle.TYPE_SLED: 457 case Vehicle.TYPE_SLED:
278 m_linearFrictionTimescale = new Vector3(30, 1, 1000); 458 m_linearFrictionTimescale = new Vector3(30, 1, 1000);
279 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); 459 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
@@ -295,9 +475,9 @@ namespace OpenSim.Region.Physics.OdePlugin
295 // m_bankingMix = 1; 475 // m_bankingMix = 1;
296 // m_bankingTimescale = 10; 476 // m_bankingTimescale = 10;
297 // m_referenceFrame = Quaternion.Identity; 477 // m_referenceFrame = Quaternion.Identity;
298 m_flags &= 478 m_Hoverflags &=
299 ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | 479 ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
300 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); 480 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
301 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); 481 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
302 break; 482 break;
303 case Vehicle.TYPE_CAR: 483 case Vehicle.TYPE_CAR:
@@ -323,9 +503,10 @@ namespace OpenSim.Region.Physics.OdePlugin
323 // m_bankingMix = 1; 503 // m_bankingMix = 1;
324 // m_bankingTimescale = 1; 504 // m_bankingTimescale = 1;
325 // m_referenceFrame = Quaternion.Identity; 505 // m_referenceFrame = Quaternion.Identity;
326 m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); 506 m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
327 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_UP_ONLY | 507 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY |
328 VehicleFlag.LIMIT_MOTOR_UP); 508 VehicleFlag.LIMIT_MOTOR_UP);
509 m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY);
329 break; 510 break;
330 case Vehicle.TYPE_BOAT: 511 case Vehicle.TYPE_BOAT:
331 m_linearFrictionTimescale = new Vector3(10, 3, 2); 512 m_linearFrictionTimescale = new Vector3(10, 3, 2);
@@ -350,10 +531,12 @@ namespace OpenSim.Region.Physics.OdePlugin
350 // m_bankingMix = 0.8f; 531 // m_bankingMix = 0.8f;
351 // m_bankingTimescale = 1; 532 // m_bankingTimescale = 1;
352 // m_referenceFrame = Quaternion.Identity; 533 // m_referenceFrame = Quaternion.Identity;
353 m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.LIMIT_ROLL_ONLY | 534 m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
354 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); 535 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
355 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | 536 m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY);
537 m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
356 VehicleFlag.LIMIT_MOTOR_UP); 538 VehicleFlag.LIMIT_MOTOR_UP);
539 m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY);
357 break; 540 break;
358 case Vehicle.TYPE_AIRPLANE: 541 case Vehicle.TYPE_AIRPLANE:
359 m_linearFrictionTimescale = new Vector3(200, 10, 5); 542 m_linearFrictionTimescale = new Vector3(200, 10, 5);
@@ -378,8 +561,9 @@ namespace OpenSim.Region.Physics.OdePlugin
378 // m_bankingMix = 0.7f; 561 // m_bankingMix = 0.7f;
379 // m_bankingTimescale = 2; 562 // m_bankingTimescale = 2;
380 // m_referenceFrame = Quaternion.Identity; 563 // m_referenceFrame = Quaternion.Identity;
381 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | 564 m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
382 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); 565 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
566 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP);
383 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); 567 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
384 break; 568 break;
385 case Vehicle.TYPE_BALLOON: 569 case Vehicle.TYPE_BALLOON:
@@ -405,9 +589,11 @@ namespace OpenSim.Region.Physics.OdePlugin
405 // m_bankingMix = 0.7f; 589 // m_bankingMix = 0.7f;
406 // m_bankingTimescale = 5; 590 // m_bankingTimescale = 5;
407 // m_referenceFrame = Quaternion.Identity; 591 // m_referenceFrame = Quaternion.Identity;
408 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | 592 m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
409 VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); 593 VehicleFlag.HOVER_UP_ONLY);
410 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); 594 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP);
595 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
596 m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT);
411 break; 597 break;
412 598
413 } 599 }
@@ -431,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin
431 617
432 MoveLinear(pTimestep, pParentScene); 618 MoveLinear(pTimestep, pParentScene);
433 MoveAngular(pTimestep); 619 MoveAngular(pTimestep);
620 LimitRotation(pTimestep);
434 }// end Step 621 }// end Step
435 622
436 private void MoveLinear(float pTimestep, OdeScene _pParentScene) 623 private void MoveLinear(float pTimestep, OdeScene _pParentScene)
@@ -477,61 +664,152 @@ namespace OpenSim.Region.Physics.OdePlugin
477 // .Z velocity and gravity. Therefore only 0g will used script-requested 664 // .Z velocity and gravity. Therefore only 0g will used script-requested
478 // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. 665 // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only.
479 Vector3 grav = Vector3.Zero; 666 Vector3 grav = Vector3.Zero;
480 if (m_VehicleBuoyancy < 1.0f) 667 // There is some gravity, make a gravity force vector
668 // that is applied after object velocity.
669 d.Mass objMass;
670 d.BodyGetMass(Body, out objMass);
671 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
672 grav.Z = _pParentScene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy);
673 // Preserve the current Z velocity
674 d.Vector3 vel_now = d.BodyGetLinearVel(Body);
675 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
676
677 d.Vector3 pos = d.BodyGetPosition(Body);
678 Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
679 Vector3 posChange = new Vector3();
680 posChange.X = pos.X - m_lastPositionVector.X;
681 posChange.Y = pos.Y - m_lastPositionVector.Y;
682 posChange.Z = pos.Z - m_lastPositionVector.Z;
683 double Zchange = Math.Abs(posChange.Z);
684 if (m_BlockingEndPoint != Vector3.Zero)
685 {
686 if (pos.X >= (m_BlockingEndPoint.X - (float)1))
687 {
688 pos.X -= posChange.X + 1;
689 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
690 }
691 if (pos.Y >= (m_BlockingEndPoint.Y - (float)1))
692 {
693 pos.Y -= posChange.Y + 1;
694 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
695 }
696 if (pos.Z >= (m_BlockingEndPoint.Z - (float)1))
697 {
698 pos.Z -= posChange.Z + 1;
699 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
700 }
701 if (pos.X <= 0)
702 {
703 pos.X += posChange.X + 1;
704 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
705 }
706 if (pos.Y <= 0)
707 {
708 pos.Y += posChange.Y + 1;
709 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
710 }
711 }
712 if (pos.Z < _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y))
481 { 713 {
482 // There is some gravity, make a gravity force vector 714 pos.Z = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2;
483 // that is applied after object velocity. 715 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
484 d.Mass objMass; 716 }
485 d.BodyGetMass(Body, out objMass);
486 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
487 grav.Z = _pParentScene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy);
488 // Preserve the current Z velocity
489 d.Vector3 vel_now = d.BodyGetLinearVel(Body);
490 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
491 } // else its 1.0, no gravity.
492 717
493 // Check if hovering 718 // Check if hovering
494 if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0) 719 if ((m_Hoverflags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
495 { 720 {
496 // We should hover, get the target height 721 // We should hover, get the target height
497 d.Vector3 pos = d.BodyGetPosition(Body); 722 if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0)
498 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) == VehicleFlag.HOVER_WATER_ONLY)
499 { 723 {
500 m_VhoverTargetHeight = _pParentScene.GetWaterLevel() + m_VhoverHeight; 724 m_VhoverTargetHeight = _pParentScene.GetWaterLevel() + m_VhoverHeight;
501 } 725 }
502 else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) == VehicleFlag.HOVER_TERRAIN_ONLY) 726 if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
503 { 727 {
504 m_VhoverTargetHeight = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight; 728 m_VhoverTargetHeight = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
505 } 729 }
506 else if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == VehicleFlag.HOVER_GLOBAL_HEIGHT) 730 if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
507 { 731 {
508 m_VhoverTargetHeight = m_VhoverHeight; 732 m_VhoverTargetHeight = m_VhoverHeight;
509 } 733 }
510 734
511 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == VehicleFlag.HOVER_UP_ONLY) 735 if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != 0)
512 { 736 {
513 // If body is aready heigher, use its height as target height 737 // If body is aready heigher, use its height as target height
514 if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z; 738 if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z;
515 } 739 }
740 if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)
741 {
742 if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2)
743 {
744 d.BodySetPosition(Body, pos.X, pos.Y, m_VhoverTargetHeight);
745 }
746 }
747 else
748 {
749 float herr0 = pos.Z - m_VhoverTargetHeight;
750 // Replace Vertical speed with correction figure if significant
751 if (Math.Abs(herr0) > 0.01f)
752 {
753 m_dir.Z = -((herr0 * pTimestep * 50.0f) / m_VhoverTimescale);
754 //KF: m_VhoverEfficiency is not yet implemented
755 }
756 else
757 {
758 m_dir.Z = 0f;
759 }
760 }
516 761
517// m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped 762// m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped
518// m_VhoverTimescale = 0f; // time to acheive height 763// m_VhoverTimescale = 0f; // time to acheive height
519// pTimestep is time since last frame,in secs 764// pTimestep is time since last frame,in secs
520 float herr0 = pos.Z - m_VhoverTargetHeight; 765 }
521 // Replace Vertical speed with correction figure if significant 766
522 if (Math.Abs(herr0) > 0.01f) 767 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
768 {
769 //Start Experimental Values
770 if (Zchange > .3)
523 { 771 {
524 d.Mass objMass; 772 grav.Z = (float)(grav.Z * 3);
525 d.BodyGetMass(Body, out objMass);
526 m_dir.Z = - ((herr0 * pTimestep * 50.0f) / m_VhoverTimescale);
527 //KF: m_VhoverEfficiency is not yet implemented
528 } 773 }
529 else 774 if (Zchange > .15)
775 {
776 grav.Z = (float)(grav.Z * 2);
777 }
778 if (Zchange > .75)
779 {
780 grav.Z = (float)(grav.Z * 1.5);
781 }
782 if (Zchange > .05)
783 {
784 grav.Z = (float)(grav.Z * 1.25);
785 }
786 if (Zchange > .025)
787 {
788 grav.Z = (float)(grav.Z * 1.125);
789 }
790 float terraintemp = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y);
791 float postemp = (pos.Z - terraintemp);
792 if (postemp > 2.5f)
530 { 793 {
531 m_dir.Z = 0f; 794 grav.Z = (float)(grav.Z * 1.037125);
532 } 795 }
796 //End Experimental Values
797 }
798 if ((m_flags & (VehicleFlag.NO_X)) != 0)
799 {
800 m_dir.X = 0;
801 }
802 if ((m_flags & (VehicleFlag.NO_Y)) != 0)
803 {
804 m_dir.Y = 0;
805 }
806 if ((m_flags & (VehicleFlag.NO_Z)) != 0)
807 {
808 m_dir.Z = 0;
533 } 809 }
534 810
811 m_lastPositionVector = d.BodyGetPosition(Body);
812
535 // Apply velocity 813 // Apply velocity
536 d.BodySetLinearVel(Body, m_dir.X, m_dir.Y, m_dir.Z); 814 d.BodySetLinearVel(Body, m_dir.X, m_dir.Y, m_dir.Z);
537 // apply gravity force 815 // apply gravity force
@@ -629,6 +907,12 @@ namespace OpenSim.Region.Physics.OdePlugin
629 907
630 // Sum velocities 908 // Sum velocities
631 m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection 909 m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection
910
911 if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
912 {
913 m_lastAngularVelocity.X = 0;
914 m_lastAngularVelocity.Y = 0;
915 }
632 916
633 if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) 917 if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
634 { 918 {
@@ -647,5 +931,44 @@ namespace OpenSim.Region.Physics.OdePlugin
647 d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z); 931 d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z);
648 932
649 } //end MoveAngular 933 } //end MoveAngular
934 internal void LimitRotation(float timestep)
935 {
936 d.Quaternion rot = d.BodyGetQuaternion(Body);
937 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
938 d.Quaternion m_rot = new d.Quaternion();
939 bool changed = false;
940 m_rot.X = rotq.X;
941 m_rot.Y = rotq.Y;
942 m_rot.Z = rotq.Z;
943 m_rot.W = rotq.W;
944 if (m_RollreferenceFrame != Quaternion.Identity)
945 {
946 if (rotq.X >= m_RollreferenceFrame.X)
947 {
948 m_rot.X = rotq.X - (m_RollreferenceFrame.X / 2);
949 }
950 if (rotq.Y >= m_RollreferenceFrame.Y)
951 {
952 m_rot.Y = rotq.Y - (m_RollreferenceFrame.Y / 2);
953 }
954 if (rotq.X <= -m_RollreferenceFrame.X)
955 {
956 m_rot.X = rotq.X + (m_RollreferenceFrame.X / 2);
957 }
958 if (rotq.Y <= -m_RollreferenceFrame.Y)
959 {
960 m_rot.Y = rotq.Y + (m_RollreferenceFrame.Y / 2);
961 }
962 changed = true;
963 }
964 if ((m_flags & VehicleFlag.LOCK_ROTATION) != 0)
965 {
966 m_rot.X = 0;
967 m_rot.Y = 0;
968 changed = true;
969 }
970 if (changed)
971 d.BodySetQuaternion(Body, ref m_rot);
972 }
650 } 973 }
651} 974}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 44b2727..03736d1 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2355,6 +2355,11 @@ Console.WriteLine(" JointCreateFixed");
2355 m_vehicle.ProcessRotationVehicleParam((Vehicle) param, rotation); 2355 m_vehicle.ProcessRotationVehicleParam((Vehicle) param, rotation);
2356 } 2356 }
2357 2357
2358 public override void VehicleFlags(int param, bool remove)
2359 {
2360 m_vehicle.ProcessVehicleFlags(param, remove);
2361 }
2362
2358 public override void SetVolumeDetect(int param) 2363 public override void SetVolumeDetect(int param)
2359 { 2364 {
2360 lock (_parent_scene.OdeLock) 2365 lock (_parent_scene.OdeLock)
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 566b4e7..a70179b 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -182,6 +182,8 @@ namespace OpenSim.Region.Physics.POSPlugin
182 182
183 } 183 }
184 184
185 public override void VehicleFlags(int param, bool remove) { }
186
185 public override void SetVolumeDetect(int param) 187 public override void SetVolumeDetect(int param)
186 { 188 {
187 189
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index 7447f76..91ec3df 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -139,6 +139,8 @@ namespace OpenSim.Region.Physics.POSPlugin
139 139
140 } 140 }
141 141
142 public override void VehicleFlags(int param, bool remove) { }
143
142 public override void SetVolumeDetect(int param) 144 public override void SetVolumeDetect(int param)
143 { 145 {
144 146
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 24eb6b1..dd2c686 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -371,6 +371,8 @@ namespace OpenSim.Region.Physics.PhysXPlugin
371 371
372 } 372 }
373 373
374 public override void VehicleFlags(int param, bool remove) { }
375
374 public override void SetVolumeDetect(int param) 376 public override void SetVolumeDetect(int param)
375 { 377 {
376 378
@@ -775,6 +777,8 @@ namespace OpenSim.Region.Physics.PhysXPlugin
775 777
776 } 778 }
777 779
780 public override void VehicleFlags(int param, bool remove) { }
781
778 public override void SetVolumeDetect(int param) 782 public override void SetVolumeDetect(int param)
779 { 783 {
780 784
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e77425a..a421484 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1182,7 +1182,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1182 1182
1183 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) 1183 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
1184 { 1184 {
1185 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); 1185 if (value != 0)
1186 m_host.SetBlockGrab(true);
1187 else
1188 m_host.SetBlockGrab(false);
1186 } 1189 }
1187 1190
1188 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) 1191 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
@@ -1195,12 +1198,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1195 1198
1196 if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) 1199 if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE)
1197 { 1200 {
1198 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); 1201 if (value != 0)
1202 m_host.SetReturnAtEdge(true);
1203 else
1204 m_host.SetReturnAtEdge(false);
1199 } 1205 }
1200 1206
1201 if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) 1207 if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX)
1202 { 1208 {
1203 NotImplemented("llSetStatus - STATUS_SANDBOX"); 1209 if (value != 0)
1210 m_host.SetStatusSandbox(true);
1211 else
1212 m_host.SetStatusSandbox(false);
1204 } 1213 }
1205 1214
1206 if (statusrotationaxis != 0) 1215 if (statusrotationaxis != 0)
@@ -1237,8 +1246,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1237 return 0; 1246 return 0;
1238 1247
1239 case ScriptBaseClass.STATUS_BLOCK_GRAB: 1248 case ScriptBaseClass.STATUS_BLOCK_GRAB:
1240 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); 1249 if (m_host.GetBlockGrab())
1241 return 0; 1250 return 1;
1251 else
1252 return 0;
1242 1253
1243 case ScriptBaseClass.STATUS_DIE_AT_EDGE: 1254 case ScriptBaseClass.STATUS_DIE_AT_EDGE:
1244 if (m_host.GetDieAtEdge()) 1255 if (m_host.GetDieAtEdge())
@@ -1247,24 +1258,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1247 return 0; 1258 return 0;
1248 1259
1249 case ScriptBaseClass.STATUS_RETURN_AT_EDGE: 1260 case ScriptBaseClass.STATUS_RETURN_AT_EDGE:
1250 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 1261 if (m_host.GetReturnAtEdge())
1251 return 0; 1262 return 1;
1263 else
1264 return 0;
1252 1265
1253 case ScriptBaseClass.STATUS_ROTATE_X: 1266 case ScriptBaseClass.STATUS_ROTATE_X:
1254 NotImplemented("llGetStatus - STATUS_ROTATE_X"); 1267 if (m_host.GetAxisRotation(2) == 2)
1255 return 0; 1268 return 1;
1269 else
1270 return 0;
1256 1271
1257 case ScriptBaseClass.STATUS_ROTATE_Y: 1272 case ScriptBaseClass.STATUS_ROTATE_Y:
1258 NotImplemented("llGetStatus - STATUS_ROTATE_Y"); 1273 if (m_host.GetAxisRotation(4) == 4)
1259 return 0; 1274 return 1;
1275 else
1276 return 0;
1260 1277
1261 case ScriptBaseClass.STATUS_ROTATE_Z: 1278 case ScriptBaseClass.STATUS_ROTATE_Z:
1262 NotImplemented("llGetStatus - STATUS_ROTATE_Z"); 1279 if (m_host.GetAxisRotation(8) == 8)
1263 return 0; 1280 return 1;
1281 else
1282 return 0;
1264 1283
1265 case ScriptBaseClass.STATUS_SANDBOX: 1284 case ScriptBaseClass.STATUS_SANDBOX:
1266 NotImplemented("llGetStatus - STATUS_SANDBOX"); 1285 if (m_host.GetStatusSandbox())
1267 return 0; 1286 return 1;
1287 else
1288 return 0;
1268 } 1289 }
1269 return 0; 1290 return 0;
1270 } 1291 }
@@ -2202,7 +2223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2202 m_host.AddScriptLPS(1); 2223 m_host.AddScriptLPS(1);
2203 2224
2204 // send the sound, once, to all clients in range 2225 // send the sound, once, to all clients in range
2205 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); 2226 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false);
2206 } 2227 }
2207 2228
2208 // Xantor 20080528 we should do this differently. 2229 // Xantor 20080528 we should do this differently.
@@ -2232,42 +2253,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2232 public void llLoopSoundMaster(string sound, double volume) 2253 public void llLoopSoundMaster(string sound, double volume)
2233 { 2254 {
2234 m_host.AddScriptLPS(1); 2255 m_host.AddScriptLPS(1);
2235 NotImplemented("llLoopSoundMaster"); 2256 m_host.ParentGroup.LoopSoundMasterPrim = m_host;
2257 lock (m_host.ParentGroup.LoopSoundSlavePrims)
2258 {
2259 foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims)
2260 {
2261 if (prim.Sound != UUID.Zero)
2262 llStopSound();
2263
2264 prim.Sound = KeyOrName(sound);
2265 prim.SoundGain = volume;
2266 prim.SoundFlags = 1; // looping
2267 prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
2268
2269 prim.ScheduleFullUpdate();
2270 prim.SendFullUpdateToAllClients();
2271 }
2272 }
2273 if (m_host.Sound != UUID.Zero)
2274 llStopSound();
2275
2276 m_host.Sound = KeyOrName(sound);
2277 m_host.SoundGain = volume;
2278 m_host.SoundFlags = 1; // looping
2279 m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
2280
2281 m_host.ScheduleFullUpdate();
2282 m_host.SendFullUpdateToAllClients();
2236 } 2283 }
2237 2284
2238 public void llLoopSoundSlave(string sound, double volume) 2285 public void llLoopSoundSlave(string sound, double volume)
2239 { 2286 {
2240 m_host.AddScriptLPS(1); 2287 m_host.AddScriptLPS(1);
2241 NotImplemented("llLoopSoundSlave"); 2288 lock (m_host.ParentGroup.LoopSoundSlavePrims)
2289 {
2290 m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host);
2291 }
2242 } 2292 }
2243 2293
2244 public void llPlaySoundSlave(string sound, double volume) 2294 public void llPlaySoundSlave(string sound, double volume)
2245 { 2295 {
2246 m_host.AddScriptLPS(1); 2296 m_host.AddScriptLPS(1);
2247 NotImplemented("llPlaySoundSlave"); 2297
2298 // send the sound, once, to all clients in range
2299 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false);
2248 } 2300 }
2249 2301
2250 public void llTriggerSound(string sound, double volume) 2302 public void llTriggerSound(string sound, double volume)
2251 { 2303 {
2252 m_host.AddScriptLPS(1); 2304 m_host.AddScriptLPS(1);
2253 // send the sound, once, to all clients in range 2305 // send the sound, once, to all clients in range
2254 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0); 2306 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false);
2255 } 2307 }
2256 2308
2257 // Xantor 20080528: Clear prim data of sound instead 2309 // Xantor 20080528: Clear prim data of sound instead
2258 public void llStopSound() 2310 public void llStopSound()
2259 { 2311 {
2260 m_host.AddScriptLPS(1); 2312 m_host.AddScriptLPS(1);
2261 2313 if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host))
2262 m_host.Sound = UUID.Zero; 2314 {
2263 m_host.SoundGain = 0; 2315 if (m_host.ParentGroup.LoopSoundMasterPrim == m_host)
2264 m_host.SoundFlags = 0; 2316 {
2265 m_host.SoundRadius = 0; 2317 foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims)
2266 2318 {
2267 m_host.ScheduleFullUpdate(); 2319 part.Sound = UUID.Zero;
2268 m_host.SendFullUpdateToAllClients(); 2320 part.SoundGain = 0;
2269 2321 part.SoundFlags = 0;
2270 // m_host.SendSound(UUID.Zero.ToString(), 1.0, false, 2); 2322 part.SoundRadius = 0;
2323 part.ScheduleFullUpdate();
2324 part.SendFullUpdateToAllClients();
2325 }
2326 m_host.ParentGroup.LoopSoundMasterPrim = null;
2327 m_host.ParentGroup.LoopSoundSlavePrims.Clear();
2328 }
2329 else
2330 {
2331 m_host.Sound = UUID.Zero;
2332 m_host.SoundGain = 0;
2333 m_host.SoundFlags = 0;
2334 m_host.SoundRadius = 0;
2335 m_host.ScheduleFullUpdate();
2336 m_host.SendFullUpdateToAllClients();
2337 }
2338 }
2339 else
2340 {
2341 m_host.Sound = UUID.Zero;
2342 m_host.SoundGain = 0;
2343 m_host.SoundFlags = 0;
2344 m_host.SoundRadius = 0;
2345 m_host.ScheduleFullUpdate();
2346 m_host.SendFullUpdateToAllClients();
2347 }
2271 } 2348 }
2272 2349
2273 public void llPreloadSound(string sound) 2350 public void llPreloadSound(string sound)
@@ -2661,8 +2738,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2661 2738
2662 public void llLookAt(LSL_Vector target, double strength, double damping) 2739 public void llLookAt(LSL_Vector target, double strength, double damping)
2663 { 2740 {
2664 // partial implementation, rotates objects correctly but does not apply strength or damping attributes
2665
2666 m_host.AddScriptLPS(1); 2741 m_host.AddScriptLPS(1);
2667 // Determine where we are looking from 2742 // Determine where we are looking from
2668 LSL_Vector from = llGetPos(); 2743 LSL_Vector from = llGetPos();
@@ -2682,9 +2757,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2682 // the angles of rotation in radians into rotation value 2757 // the angles of rotation in radians into rotation value
2683 2758
2684 LSL_Types.Quaternion rot = llEuler2Rot(angle); 2759 LSL_Types.Quaternion rot = llEuler2Rot(angle);
2685 2760 Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
2761 m_host.startLookAt(rotation, (float)damping, (float)strength);
2686 // Orient the object to the angle calculated 2762 // Orient the object to the angle calculated
2687 llSetRot(rot); 2763 //llSetRot(rot);
2688 } 2764 }
2689 2765
2690 public void llStopLookAt() 2766 public void llStopLookAt()
@@ -3046,8 +3122,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3046 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 3122 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
3047 { 3123 {
3048 m_host.AddScriptLPS(1); 3124 m_host.AddScriptLPS(1);
3049// NotImplemented("llRotLookAt"); 3125 Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s);
3050 m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); 3126 m_host.RotLookAt(rot, (float)strength, (float)damping);
3051 } 3127 }
3052 3128
3053 public LSL_Integer llStringLength(string str) 3129 public LSL_Integer llStringLength(string str)
@@ -3145,13 +3221,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3145 public void llPointAt(LSL_Vector pos) 3221 public void llPointAt(LSL_Vector pos)
3146 { 3222 {
3147 m_host.AddScriptLPS(1); 3223 m_host.AddScriptLPS(1);
3148 NotImplemented("llPointAt"); 3224 ScenePresence Owner = World.GetScenePresence(m_host.UUID);
3225 LSL_Rotation rot = llEuler2Rot(pos);
3226 Owner.PreviousRotation = Owner.Rotation;
3227 Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s));
3149 } 3228 }
3150 3229
3151 public void llStopPointAt() 3230 public void llStopPointAt()
3152 { 3231 {
3153 m_host.AddScriptLPS(1); 3232 m_host.AddScriptLPS(1);
3154 NotImplemented("llStopPointAt"); 3233 ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID);
3234 Owner.Rotation = Owner.PreviousRotation;
3155 } 3235 }
3156 3236
3157 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) 3237 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
@@ -3946,8 +4026,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3946 public void llCollisionSound(string impact_sound, double impact_volume) 4026 public void llCollisionSound(string impact_sound, double impact_volume)
3947 { 4027 {
3948 m_host.AddScriptLPS(1); 4028 m_host.AddScriptLPS(1);
3949 //NotImplemented("llCollisionSound");
3950
3951 // TODO: Parameter check logic required. 4029 // TODO: Parameter check logic required.
3952 UUID soundId = UUID.Zero; 4030 UUID soundId = UUID.Zero;
3953 if (!UUID.TryParse(impact_sound, out soundId)) 4031 if (!UUID.TryParse(impact_sound, out soundId))
@@ -4535,8 +4613,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4535 public LSL_Vector llGetCenterOfMass() 4613 public LSL_Vector llGetCenterOfMass()
4536 { 4614 {
4537 m_host.AddScriptLPS(1); 4615 m_host.AddScriptLPS(1);
4538 NotImplemented("llGetCenterOfMass"); 4616 Vector3 center = m_host.GetGeometricCenter();
4539 return new LSL_Vector(); 4617 return new LSL_Vector(center.X,center.Y,center.Z);
4540 } 4618 }
4541 4619
4542 public LSL_List llListSort(LSL_List src, int stride, int ascending) 4620 public LSL_List llListSort(LSL_List src, int stride, int ascending)
@@ -5269,8 +5347,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5269 flags |= ScriptBaseClass.AGENT_SITTING; 5347 flags |= ScriptBaseClass.AGENT_SITTING;
5270 } 5348 }
5271 5349
5272 //NotImplemented("llGetAgentInfo");
5273
5274 return flags; 5350 return flags;
5275 } 5351 }
5276 5352
@@ -5353,7 +5429,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5353 LSL_Vector bottom_south_west) 5429 LSL_Vector bottom_south_west)
5354 { 5430 {
5355 m_host.AddScriptLPS(1); 5431 m_host.AddScriptLPS(1);
5356 NotImplemented("llTriggerSoundLimited"); 5432 float radius1 = (float)llVecDist(llGetPos(), top_north_east);
5433 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
5434 float radius = Math.Abs(radius1 - radius2);
5435 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false);
5357 } 5436 }
5358 5437
5359 public void llEjectFromLand(string pest) 5438 public void llEjectFromLand(string pest)
@@ -5892,7 +5971,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5892 public void llGroundRepel(double height, int water, double tau) 5971 public void llGroundRepel(double height, int water, double tau)
5893 { 5972 {
5894 m_host.AddScriptLPS(1); 5973 m_host.AddScriptLPS(1);
5895 NotImplemented("llGroundRepel"); 5974 if (m_host.PhysActor != null)
5975 {
5976 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
5977 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0));
5978 PIDHoverType hoverType = PIDHoverType.Ground;
5979 if (water != 0)
5980 {
5981 hoverType = PIDHoverType.GroundAndWater;
5982 if (ground < waterLevel)
5983 height += waterLevel;
5984 else
5985 height += ground;
5986 }
5987 else
5988 {
5989 height += ground;
5990 }
5991
5992 m_host.SetHoverHeight((float)height, hoverType, (float)tau);
5993 }
5896 } 5994 }
5897 5995
5898 protected UUID GetTaskInventoryItem(string name) 5996 protected UUID GetTaskInventoryItem(string name)
@@ -6021,13 +6119,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6021 public void llSetVehicleFlags(int flags) 6119 public void llSetVehicleFlags(int flags)
6022 { 6120 {
6023 m_host.AddScriptLPS(1); 6121 m_host.AddScriptLPS(1);
6024 NotImplemented("llSetVehicleFlags"); 6122 if (m_host.ParentGroup != null)
6123 {
6124 if (!m_host.ParentGroup.IsDeleted)
6125 {
6126 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6127 }
6128 }
6025 } 6129 }
6026 6130
6027 public void llRemoveVehicleFlags(int flags) 6131 public void llRemoveVehicleFlags(int flags)
6028 { 6132 {
6029 m_host.AddScriptLPS(1); 6133 m_host.AddScriptLPS(1);
6030 NotImplemented("llRemoveVehicleFlags"); 6134 if (m_host.ParentGroup != null)
6135 {
6136 if (!m_host.ParentGroup.IsDeleted)
6137 {
6138 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6139 }
6140 }
6031 } 6141 }
6032 6142
6033 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) 6143 public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
@@ -7049,7 +7159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7049 public void llRemoteDataSetRegion() 7159 public void llRemoteDataSetRegion()
7050 { 7160 {
7051 m_host.AddScriptLPS(1); 7161 m_host.AddScriptLPS(1);
7052 NotImplemented("llRemoteDataSetRegion"); 7162 Deprecated("llRemoteDataSetRegion");
7053 } 7163 }
7054 7164
7055 public LSL_Float llLog10(double val) 7165 public LSL_Float llLog10(double val)
@@ -8081,7 +8191,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8081 public void llSetInventoryPermMask(string item, int mask, int value) 8191 public void llSetInventoryPermMask(string item, int mask, int value)
8082 { 8192 {
8083 m_host.AddScriptLPS(1); 8193 m_host.AddScriptLPS(1);
8084 NotImplemented("llSetInventoryPermMask"); 8194 if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
8195 {
8196 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
8197 {
8198 lock (m_host.TaskInventory)
8199 {
8200 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8201 {
8202 if (inv.Value.Name == item)
8203 {
8204 switch (mask)
8205 {
8206 case 0:
8207 inv.Value.BasePermissions = (uint)value;
8208 break;
8209 case 1:
8210 inv.Value.CurrentPermissions = (uint)value;
8211 break;
8212 case 2:
8213 inv.Value.GroupPermissions = (uint)value;
8214 break;
8215 case 3:
8216 inv.Value.EveryonePermissions = (uint)value;
8217 break;
8218 case 4:
8219 inv.Value.NextPermissions = (uint)value;
8220 break;
8221 }
8222 }
8223 }
8224 }
8225 }
8226 }
8085 } 8227 }
8086 8228
8087 public LSL_String llGetInventoryCreator(string item) 8229 public LSL_String llGetInventoryCreator(string item)
@@ -8515,6 +8657,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8515 // we send to all 8657 // we send to all
8516 landData.MediaID = new UUID(texture); 8658 landData.MediaID = new UUID(texture);
8517 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; 8659 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0;
8660 landData.MediaSize[0] = width;
8661 landData.MediaSize[1] = height;
8662 landData.MediaType = mediaType;
8518 8663
8519 // do that one last, it will cause a ParcelPropertiesUpdate 8664 // do that one last, it will cause a ParcelPropertiesUpdate
8520 landObject.SetMediaUrl(url); 8665 landObject.SetMediaUrl(url);
@@ -8574,11 +8719,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8574 m_host.AddScriptLPS(1); 8719 m_host.AddScriptLPS(1);
8575 LSL_List list = new LSL_List(); 8720 LSL_List list = new LSL_List();
8576 //TO DO: make the implementation for the missing commands 8721 //TO DO: make the implementation for the missing commands
8577 //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture.
8578 //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url.
8579 //PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later)
8580 //PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later)
8581 //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later)
8582 //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) 8722 //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
8583 for (int i = 0; i < aList.Data.Length; i++) 8723 for (int i = 0; i < aList.Data.Length; i++)
8584 { 8724 {
@@ -8596,6 +8736,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8596 case ParcelMediaCommandEnum.Texture: 8736 case ParcelMediaCommandEnum.Texture:
8597 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); 8737 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString()));
8598 break; 8738 break;
8739 case ParcelMediaCommandEnum.Type:
8740 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType));
8741 break;
8742 case ParcelMediaCommandEnum.Size:
8743 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0]));
8744 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1]));
8745 break;
8599 default: 8746 default:
8600 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 8747 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
8601 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); 8748 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 13b855f..7cf82b2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -160,6 +160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
160 public const int VEHICLE_BANKING_MIX = 39; 160 public const int VEHICLE_BANKING_MIX = 39;
161 public const int VEHICLE_BANKING_TIMESCALE = 40; 161 public const int VEHICLE_BANKING_TIMESCALE = 40;
162 public const int VEHICLE_REFERENCE_FRAME = 44; 162 public const int VEHICLE_REFERENCE_FRAME = 44;
163 public const int VEHICLE_RANGE_BLOCK = 45;
164 public const int VEHICLE_ROLL_FRAME = 46;
163 public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; 165 public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1;
164 public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; 166 public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2;
165 public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; 167 public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4;
@@ -170,6 +172,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
170 public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; 172 public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128;
171 public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; 173 public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256;
172 public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; 174 public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512;
175 public const int VEHICLE_FLAG_NO_X = 1024;
176 public const int VEHICLE_FLAG_NO_Y = 2048;
177 public const int VEHICLE_FLAG_NO_Z = 4096;
178 public const int VEHICLE_FLAG_LOCK_HOVER_HEIGHT = 8192;
179 public const int VEHICLE_FLAG_NO_DEFLECTION = 16392;
180 public const int VEHICLE_FLAG_LOCK_ROTATION = 32784;
173 181
174 public const int INVENTORY_ALL = -1; 182 public const int INVENTORY_ALL = -1;
175 public const int INVENTORY_NONE = -1; 183 public const int INVENTORY_NONE = -1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
index bf3d335..bcdc7bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
@@ -389,7 +389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
389 break; 389 break;
390 case "MinEventDelay": 390 case "MinEventDelay":
391 double minEventDelay = 0.0; 391 double minEventDelay = 0.0;
392 double.TryParse(part.InnerText, out minEventDelay); 392 double.TryParse(part.InnerText, NumberStyles.Float, Culture.NumberFormatInfo, out minEventDelay);
393 instance.MinEventDelay = minEventDelay; 393 instance.MinEventDelay = minEventDelay;
394 break; 394 break;
395 } 395 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index faf9c40..e87b1f4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -72,9 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
72 return; 72 return;
73 } 73 }
74 bool res; 74 bool res;
75 res = Double.TryParse(tmps[0], out x); 75 res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x);
76 res = res & Double.TryParse(tmps[1], out y); 76 res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y);
77 res = res & Double.TryParse(tmps[2], out z); 77 res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z);
78 } 78 }
79 79
80 #endregion 80 #endregion
@@ -309,10 +309,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
309 return; 309 return;
310 } 310 }
311 bool res; 311 bool res;
312 res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.FormatProvider, out x); 312 res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x);
313 res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.FormatProvider, out y); 313 res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y);
314 res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.FormatProvider, out z); 314 res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z);
315 res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.FormatProvider, out s); 315 res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.NumberFormatInfo, out s);
316 if (x == 0 && y == 0 && z == 0 && s == 0) 316 if (x == 0 && y == 0 && z == 0 && s == 0)
317 s = 1; 317 s = 1;
318 } 318 }
@@ -1015,7 +1015,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1015 double entry; 1015 double entry;
1016 for (int i = 0; i < Data.Length; i++) 1016 for (int i = 0; i < Data.Length; i++)
1017 { 1017 {
1018 if (double.TryParse(Data[i].ToString(), out entry)) 1018 if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1019 { 1019 {
1020 if (entry < minimum) minimum = entry; 1020 if (entry < minimum) minimum = entry;
1021 } 1021 }
@@ -1029,7 +1029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1029 double entry; 1029 double entry;
1030 for (int i = 0; i < Data.Length; i++) 1030 for (int i = 0; i < Data.Length; i++)
1031 { 1031 {
1032 if (double.TryParse(Data[i].ToString(), out entry)) 1032 if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1033 { 1033 {
1034 if (entry > maximum) maximum = entry; 1034 if (entry > maximum) maximum = entry;
1035 } 1035 }
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1048 double entry; 1048 double entry;
1049 for (int i = 0; i < Data.Length; i++) 1049 for (int i = 0; i < Data.Length; i++)
1050 { 1050 {
1051 if (double.TryParse(Data[i].ToString(), out entry)) 1051 if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1052 { 1052 {
1053 count++; 1053 count++;
1054 } 1054 }
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1062 double entry; 1062 double entry;
1063 for (int i = 0; i < src.Data.Length - 1; i++) 1063 for (int i = 0; i < src.Data.Length - 1; i++)
1064 { 1064 {
1065 if (double.TryParse(src.Data[i].ToString(), out entry)) 1065 if (double.TryParse(src.Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1066 { 1066 {
1067 ret.Add(entry); 1067 ret.Add(entry);
1068 } 1068 }
@@ -1076,7 +1076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1076 double entry; 1076 double entry;
1077 for (int i = 0; i < Data.Length; i++) 1077 for (int i = 0; i < Data.Length; i++)
1078 { 1078 {
1079 if (double.TryParse(Data[i].ToString(), out entry)) 1079 if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1080 { 1080 {
1081 sum = sum + entry; 1081 sum = sum + entry;
1082 } 1082 }
@@ -1090,7 +1090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1090 double entry; 1090 double entry;
1091 for (int i = 0; i < Data.Length; i++) 1091 for (int i = 0; i < Data.Length; i++)
1092 { 1092 {
1093 if (double.TryParse(Data[i].ToString(), out entry)) 1093 if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
1094 { 1094 {
1095 sum = sum + Math.Pow(entry, 2); 1095 sum = sum + Math.Pow(entry, 2);
1096 } 1096 }
@@ -1213,11 +1213,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
1213 { 1213 {
1214 double a; 1214 double a;
1215 double b; 1215 double b;
1216 if (!double.TryParse(x.ToString(), out a)) 1216 if (!double.TryParse(x.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out a))
1217 { 1217 {
1218 a = 0.0; 1218 a = 0.0;
1219 } 1219 }
1220 if (!double.TryParse(y.ToString(), out b)) 1220 if (!double.TryParse(y.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out b))
1221 { 1221 {
1222 b = 0.0; 1222 b = 0.0;
1223 } 1223 }
@@ -1857,7 +1857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
1857 else 1857 else
1858 if (v.EndsWith(".")) 1858 if (v.EndsWith("."))
1859 v = v + "0"; 1859 v = v + "0";
1860 this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.FormatProvider); 1860 this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.NumberFormatInfo);
1861 } 1861 }
1862 1862
1863 #endregion 1863 #endregion