aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Application/OpenSim.cs9
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4907
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs66
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs24
-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/IDynamicTextureManager.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.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/Interfaces/IWorldComm.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs182
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs347
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs92
-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/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs123
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs4
-rw-r--r--OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs10
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-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.cs20
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs8
-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.cs451
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs7
-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/PhysXCharacter.cs361
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs861
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs349
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs183
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs340
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs20
59 files changed, 2733 insertions, 6167 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a86a831..05e283e 100755
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -190,6 +190,8 @@ namespace OpenSim
190 190
191 PrintFileToConsole("startuplogo.txt"); 191 PrintFileToConsole("startuplogo.txt");
192 192
193 m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
194
193 // For now, start at the 'root' level by default 195 // For now, start at the 'root' level by default
194 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it 196 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
195 ChangeSelectedRegion("region", 197 ChangeSelectedRegion("region",
@@ -367,7 +369,6 @@ namespace OpenSim
367 m_console.Commands.AddCommand("hypergrid", false, "unlink-region", 369 m_console.Commands.AddCommand("hypergrid", false, "unlink-region",
368 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 370 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
369 "Unlink a hypergrid region", RunCommand); 371 "Unlink a hypergrid region", RunCommand);
370
371 } 372 }
372 373
373 public override void ShutdownSpecific() 374 public override void ShutdownSpecific()
@@ -433,7 +434,7 @@ namespace OpenSim
433 // kick client... 434 // kick client...
434 if (alert != null) 435 if (alert != null)
435 presence.ControllingClient.Kick(alert); 436 presence.ControllingClient.Kick(alert);
436 else 437 else
437 presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); 438 presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
438 439
439 // ...and close on our side 440 // ...and close on our side
@@ -640,7 +641,6 @@ namespace OpenSim
640 } 641 }
641 } 642 }
642 643
643
644 /// <summary> 644 /// <summary>
645 /// Load, Unload, and list Region modules in use 645 /// Load, Unload, and list Region modules in use
646 /// </summary> 646 /// </summary>
@@ -972,7 +972,6 @@ namespace OpenSim
972 scene.RegionInfo.RegionLocX, 972 scene.RegionInfo.RegionLocX,
973 scene.RegionInfo.RegionLocY, 973 scene.RegionInfo.RegionLocY,
974 scene.RegionInfo.InternalEndPoint.Port)); 974 scene.RegionInfo.InternalEndPoint.Port));
975
976 }); 975 });
977 break; 976 break;
978 977
@@ -1097,7 +1096,7 @@ namespace OpenSim
1097 } 1096 }
1098 else 1097 else
1099 { 1098 {
1100 MainConsole.Instance.Output(string.Format("A user with the name {0} {1} already exists!", firstName, lastName)); 1099 MainConsole.Instance.Output(string.Format("A user with the name {0} {1} already exists!", firstName, lastName));
1101 } 1100 }
1102 } 1101 }
1103 1102
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f98e741..ebcdd62 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -233,6 +233,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
233 public event ObjectBuy OnObjectBuy; 233 public event ObjectBuy OnObjectBuy;
234 public event BuyObjectInventory OnBuyObjectInventory; 234 public event BuyObjectInventory OnBuyObjectInventory;
235 public event AgentSit OnUndo; 235 public event AgentSit OnUndo;
236 public event AgentSit OnRedo;
237 public event LandUndo OnLandUndo;
236 public event ForceReleaseControls OnForceReleaseControls; 238 public event ForceReleaseControls OnForceReleaseControls;
237 public event GodLandStatRequest OnLandStatRequest; 239 public event GodLandStatRequest OnLandStatRequest;
238 public event RequestObjectPropertiesFamily OnObjectGroupRequest; 240 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
@@ -4653,6 +4655,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4653 AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName, false); 4655 AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName, false);
4654 AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions, false); 4656 AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions, false);
4655 AddLocalPacketHandler(PacketType.Undo, HandleUndo, false); 4657 AddLocalPacketHandler(PacketType.Undo, HandleUndo, false);
4658 AddLocalPacketHandler(PacketType.UndoLand, HandleLandUndo, false);
4659 AddLocalPacketHandler(PacketType.Redo, HandleRedo, false);
4656 AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay); 4660 AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay);
4657 AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily, false); 4661 AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily, false);
4658 AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch); 4662 AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch);
@@ -5199,7 +5203,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5199 args.Type = ChatTypeEnum.Shout; 5203 args.Type = ChatTypeEnum.Shout;
5200 args.Position = new Vector3(); 5204 args.Position = new Vector3();
5201 args.Scene = Scene; 5205 args.Scene = Scene;
5202 args.Sender = this; 5206 args.Sender = this;
5203 ChatMessage handlerChatFromClient2 = OnChatFromClient; 5207 ChatMessage handlerChatFromClient2 = OnChatFromClient;
5204 if (handlerChatFromClient2 != null) 5208 if (handlerChatFromClient2 != null)
5205 handlerChatFromClient2(this, args); 5209 handlerChatFromClient2(this, args);
@@ -5823,7 +5827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5823 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, 5827 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
5824 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, 5828 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID,
5825 soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, 5829 soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position,
5826 soundTriggerPacket.SoundData.Handle); 5830 soundTriggerPacket.SoundData.Handle, 0);
5827 5831
5828 } 5832 }
5829 return true; 5833 return true;
@@ -6721,6 +6725,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6721 return true; 6725 return true;
6722 } 6726 }
6723 6727
6728 private bool HandleLandUndo(IClientAPI sender, Packet Pack)
6729 {
6730 UndoLandPacket undolanditem = (UndoLandPacket)Pack;
6731
6732 #region Packet Session and User Check
6733 if (m_checkPackets)
6734 {
6735 if (undolanditem.AgentData.SessionID != SessionId ||
6736 undolanditem.AgentData.AgentID != AgentId)
6737 return true;
6738 }
6739 #endregion
6740
6741 LandUndo handlerOnUndo = OnLandUndo;
6742 if (handlerOnUndo != null)
6743 {
6744 handlerOnUndo(this);
6745 }
6746 return true;
6747 }
6748
6749 private bool HandleRedo(IClientAPI sender, Packet Pack)
6750 {
6751 RedoPacket redoitem = (RedoPacket)Pack;
6752
6753 #region Packet Session and User Check
6754 if (m_checkPackets)
6755 {
6756 if (redoitem.AgentData.SessionID != SessionId ||
6757 redoitem.AgentData.AgentID != AgentId)
6758 return true;
6759 }
6760 #endregion
6761
6762 if (redoitem.ObjectData.Length > 0)
6763 {
6764 for (int i = 0; i < redoitem.ObjectData.Length; i++)
6765 {
6766 UUID objiD = redoitem.ObjectData[i].ObjectID;
6767 AgentSit handlerOnRedo = OnRedo;
6768 if (handlerOnRedo != null)
6769 {
6770 handlerOnRedo(this, objiD);
6771 }
6772
6773 }
6774 }
6775 return true;
6776 }
6777
6724 private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack) 6778 private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack)
6725 { 6779 {
6726 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; 6780 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
@@ -10958,4855 +11012,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10958 /// <param name="Pack">OpenMetaverse.packet</param> 11012 /// <param name="Pack">OpenMetaverse.packet</param>
10959 public void ProcessInPacket(Packet Pack) 11013 public void ProcessInPacket(Packet Pack)
10960 { 11014 {
10961 11015// m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack);
10962 if (ProcessPacketMethod(Pack))
10963 {
10964 PacketPool.Instance.ReturnPacket(Pack);
10965 return;
10966 }
10967
10968 // Main packet processing conditional
10969 switch (Pack.Type)
10970 {
10971 #region CommentedOut
10972 /*
10973 #region Scene/Avatar
10974
10975
10976 case PacketType.AvatarPropertiesRequest:
10977 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
10978
10979 #region Packet Session and User Check
10980 if (m_checkPackets)
10981 {
10982 if (avatarProperties.AgentData.SessionID != SessionId ||
10983 avatarProperties.AgentData.AgentID != AgentId)
10984 break;
10985 }
10986 #endregion
10987
10988 RequestAvatarProperties handlerRequestAvatarProperties = OnRequestAvatarProperties;
10989 if (handlerRequestAvatarProperties != null)
10990 {
10991 handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
10992 }
10993
10994 break;
10995
10996 case PacketType.ChatFromViewer:
10997 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
10998
10999 #region Packet Session and User Check
11000 if (m_checkPackets)
11001 {
11002 if (inchatpack.AgentData.SessionID != SessionId ||
11003 inchatpack.AgentData.AgentID != AgentId)
11004 break;
11005 }
11006 #endregion
11007
11008 string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
11009 byte[] message = inchatpack.ChatData.Message;
11010 byte type = inchatpack.ChatData.Type;
11011 Vector3 fromPos = new Vector3(); // ClientAvatar.Pos;
11012 // UUID fromAgentID = AgentId;
11013
11014 int channel = inchatpack.ChatData.Channel;
11015
11016 if (OnChatFromClient != null)
11017 {
11018 OSChatMessage args = new OSChatMessage();
11019 args.Channel = channel;
11020 args.From = fromName;
11021 args.Message = Utils.BytesToString(message);
11022 args.Type = (ChatTypeEnum)type;
11023 args.Position = fromPos;
11024
11025 args.Scene = Scene;
11026 args.Sender = this;
11027 args.SenderUUID = this.AgentId;
11028
11029 ChatMessage handlerChatFromClient = OnChatFromClient;
11030 if (handlerChatFromClient != null)
11031 handlerChatFromClient(this, args);
11032 }
11033 break;
11034
11035 case PacketType.AvatarPropertiesUpdate:
11036 AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack;
11037
11038 #region Packet Session and User Check
11039 if (m_checkPackets)
11040 {
11041 if (avatarProps.AgentData.SessionID != SessionId ||
11042 avatarProps.AgentData.AgentID != AgentId)
11043 break;
11044 }
11045 #endregion
11046
11047 UpdateAvatarProperties handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
11048 if (handlerUpdateAvatarProperties != null)
11049 {
11050 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData;
11051 UserProfileData UserProfile = new UserProfileData();
11052 UserProfile.ID = AgentId;
11053 UserProfile.AboutText = Utils.BytesToString(Properties.AboutText);
11054 UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText);
11055 UserProfile.FirstLifeImage = Properties.FLImageID;
11056 UserProfile.Image = Properties.ImageID;
11057 UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL);
11058
11059 handlerUpdateAvatarProperties(this, UserProfile);
11060 }
11061 break;
11062
11063 case PacketType.ScriptDialogReply:
11064 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
11065
11066 #region Packet Session and User Check
11067 if (m_checkPackets)
11068 {
11069 if (rdialog.AgentData.SessionID != SessionId ||
11070 rdialog.AgentData.AgentID != AgentId)
11071 break;
11072 }
11073 #endregion
11074
11075 int ch = rdialog.Data.ChatChannel;
11076 byte[] msg = rdialog.Data.ButtonLabel;
11077 if (OnChatFromClient != null)
11078 {
11079 OSChatMessage args = new OSChatMessage();
11080 args.Channel = ch;
11081 args.From = String.Empty;
11082 args.Message = Utils.BytesToString(msg);
11083 args.Type = ChatTypeEnum.Shout;
11084 args.Position = new Vector3();
11085 args.Scene = Scene;
11086 args.Sender = this;
11087 ChatMessage handlerChatFromClient2 = OnChatFromClient;
11088 if (handlerChatFromClient2 != null)
11089 handlerChatFromClient2(this, args);
11090 }
11091
11092 break;
11093
11094 case PacketType.ImprovedInstantMessage:
11095 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
11096
11097 #region Packet Session and User Check
11098 if (m_checkPackets)
11099 {
11100 if (msgpack.AgentData.SessionID != SessionId ||
11101 msgpack.AgentData.AgentID != AgentId)
11102 break;
11103 }
11104 #endregion
11105
11106 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
11107 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message);
11108 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
11109
11110 if (handlerInstantMessage != null)
11111 {
11112 GridInstantMessage im = new GridInstantMessage(Scene,
11113 msgpack.AgentData.AgentID,
11114 IMfromName,
11115 msgpack.MessageBlock.ToAgentID,
11116 msgpack.MessageBlock.Dialog,
11117 msgpack.MessageBlock.FromGroup,
11118 IMmessage,
11119 msgpack.MessageBlock.ID,
11120 msgpack.MessageBlock.Offline != 0 ? true : false,
11121 msgpack.MessageBlock.Position,
11122 msgpack.MessageBlock.BinaryBucket);
11123
11124 handlerInstantMessage(this, im);
11125 }
11126 break;
11127
11128 case PacketType.AcceptFriendship:
11129 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
11130
11131 #region Packet Session and User Check
11132 if (m_checkPackets)
11133 {
11134 if (afriendpack.AgentData.SessionID != SessionId ||
11135 afriendpack.AgentData.AgentID != AgentId)
11136 break;
11137 }
11138 #endregion
11139
11140 // My guess is this is the folder to stick the calling card into
11141 List<UUID> callingCardFolders = new List<UUID>();
11142
11143 UUID agentID = afriendpack.AgentData.AgentID;
11144 UUID transactionID = afriendpack.TransactionBlock.TransactionID;
11145
11146 for (int fi = 0; fi < afriendpack.FolderData.Length; fi++)
11147 {
11148 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID);
11149 }
11150
11151 FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest;
11152 if (handlerApproveFriendRequest != null)
11153 {
11154 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
11155 }
11156 break;
11157
11158 case PacketType.DeclineFriendship:
11159 DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack;
11160
11161 #region Packet Session and User Check
11162 if (m_checkPackets)
11163 {
11164 if (dfriendpack.AgentData.SessionID != SessionId ||
11165 dfriendpack.AgentData.AgentID != AgentId)
11166 break;
11167 }
11168 #endregion
11169
11170 if (OnDenyFriendRequest != null)
11171 {
11172 OnDenyFriendRequest(this,
11173 dfriendpack.AgentData.AgentID,
11174 dfriendpack.TransactionBlock.TransactionID,
11175 null);
11176 }
11177 break;
11178
11179 case PacketType.TerminateFriendship:
11180 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
11181
11182 #region Packet Session and User Check
11183 if (m_checkPackets)
11184 {
11185 if (tfriendpack.AgentData.SessionID != SessionId ||
11186 tfriendpack.AgentData.AgentID != AgentId)
11187 break;
11188 }
11189 #endregion
11190
11191 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
11192 UUID exFriendID = tfriendpack.ExBlock.OtherID;
11193
11194 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship;
11195 if (handlerTerminateFriendship != null)
11196 {
11197 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
11198 }
11199 break;
11200
11201 case PacketType.RezObject:
11202 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
11203
11204 #region Packet Session and User Check
11205 if (m_checkPackets)
11206 {
11207 if (rezPacket.AgentData.SessionID != SessionId ||
11208 rezPacket.AgentData.AgentID != AgentId)
11209 break;
11210 }
11211 #endregion
11212
11213 RezObject handlerRezObject = OnRezObject;
11214 if (handlerRezObject != null)
11215 {
11216 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
11217 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
11218 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
11219 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
11220 rezPacket.RezData.FromTaskID);
11221 }
11222 break;
11223
11224 case PacketType.DeRezObject:
11225 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)Pack;
11226
11227 #region Packet Session and User Check
11228 if (m_checkPackets)
11229 {
11230 if (DeRezPacket.AgentData.SessionID != SessionId ||
11231 DeRezPacket.AgentData.AgentID != AgentId)
11232 break;
11233 }
11234 #endregion
11235
11236 DeRezObject handlerDeRezObject = OnDeRezObject;
11237 if (handlerDeRezObject != null)
11238 {
11239 List<uint> deRezIDs = new List<uint>();
11240
11241 foreach (DeRezObjectPacket.ObjectDataBlock data in
11242 DeRezPacket.ObjectData)
11243 {
11244 deRezIDs.Add(data.ObjectLocalID);
11245 }
11246 // It just so happens that the values on the DeRezAction enumerator match the Destination
11247 // values given by a Second Life client
11248 handlerDeRezObject(this, deRezIDs,
11249 DeRezPacket.AgentBlock.GroupID,
11250 (DeRezAction)DeRezPacket.AgentBlock.Destination,
11251 DeRezPacket.AgentBlock.DestinationID);
11252
11253 }
11254 break;
11255
11256 case PacketType.ModifyLand:
11257 ModifyLandPacket modify = (ModifyLandPacket)Pack;
11258
11259 #region Packet Session and User Check
11260 if (m_checkPackets)
11261 {
11262 if (modify.AgentData.SessionID != SessionId ||
11263 modify.AgentData.AgentID != AgentId)
11264 break;
11265 }
11266
11267 #endregion
11268 //m_log.Info("[LAND]: LAND:" + modify.ToString());
11269 if (modify.ParcelData.Length > 0)
11270 {
11271 if (OnModifyTerrain != null)
11272 {
11273 for (int i = 0; i < modify.ParcelData.Length; i++)
11274 {
11275 ModifyTerrain handlerModifyTerrain = OnModifyTerrain;
11276 if (handlerModifyTerrain != null)
11277 {
11278 handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
11279 modify.ModifyBlock.BrushSize,
11280 modify.ModifyBlock.Action, modify.ParcelData[i].North,
11281 modify.ParcelData[i].West, modify.ParcelData[i].South,
11282 modify.ParcelData[i].East, AgentId);
11283 }
11284 }
11285 }
11286 }
11287
11288 break;
11289
11290 case PacketType.RegionHandshakeReply:
11291
11292 Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply;
11293 if (handlerRegionHandShakeReply != null)
11294 {
11295 handlerRegionHandShakeReply(this);
11296 }
11297
11298 break;
11299
11300 case PacketType.AgentWearablesRequest:
11301 GenericCall2 handlerRequestWearables = OnRequestWearables;
11302
11303 if (handlerRequestWearables != null)
11304 {
11305 handlerRequestWearables();
11306 }
11307
11308 Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData;
11309
11310 if (handlerRequestAvatarsData != null)
11311 {
11312 handlerRequestAvatarsData(this);
11313 }
11314
11315 break;
11316
11317 case PacketType.AgentSetAppearance:
11318 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
11319
11320 #region Packet Session and User Check
11321 if (m_checkPackets)
11322 {
11323 if (appear.AgentData.SessionID != SessionId ||
11324 appear.AgentData.AgentID != AgentId)
11325 break;
11326 }
11327 #endregion
11328
11329 SetAppearance handlerSetAppearance = OnSetAppearance;
11330 if (handlerSetAppearance != null)
11331 {
11332 // Temporarily protect ourselves from the mantis #951 failure.
11333 // However, we could do this for several other handlers where a failure isn't terminal
11334 // for the client session anyway, in order to protect ourselves against bad code in plugins
11335 try
11336 {
11337 byte[] visualparams = new byte[appear.VisualParam.Length];
11338 for (int i = 0; i < appear.VisualParam.Length; i++)
11339 visualparams[i] = appear.VisualParam[i].ParamValue;
11340
11341 Primitive.TextureEntry te = null;
11342 if (appear.ObjectData.TextureEntry.Length > 1)
11343 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
11344
11345 handlerSetAppearance(te, visualparams);
11346 }
11347 catch (Exception e)
11348 {
11349 m_log.ErrorFormat(
11350 "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}",
11351 e);
11352 }
11353 }
11354
11355 break;
11356
11357 case PacketType.AgentIsNowWearing:
11358 if (OnAvatarNowWearing != null)
11359 {
11360 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
11361
11362 #region Packet Session and User Check
11363 if (m_checkPackets)
11364 {
11365 if (nowWearing.AgentData.SessionID != SessionId ||
11366 nowWearing.AgentData.AgentID != AgentId)
11367 break;
11368 }
11369 #endregion
11370
11371 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
11372 for (int i = 0; i < nowWearing.WearableData.Length; i++)
11373 {
11374 AvatarWearingArgs.Wearable wearable =
11375 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
11376 nowWearing.WearableData[i].WearableType);
11377 wearingArgs.NowWearing.Add(wearable);
11378 }
11379
11380 AvatarNowWearing handlerAvatarNowWearing = OnAvatarNowWearing;
11381 if (handlerAvatarNowWearing != null)
11382 {
11383 handlerAvatarNowWearing(this, wearingArgs);
11384 }
11385 }
11386 break;
11387
11388 case PacketType.RezSingleAttachmentFromInv:
11389 RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
11390 if (handlerRezSingleAttachment != null)
11391 {
11392 RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack;
11393
11394 #region Packet Session and User Check
11395 if (m_checkPackets)
11396 {
11397 if (rez.AgentData.SessionID != SessionId ||
11398 rez.AgentData.AgentID != AgentId)
11399 break;
11400 }
11401 #endregion
11402
11403 handlerRezSingleAttachment(this, rez.ObjectData.ItemID,
11404 rez.ObjectData.AttachmentPt);
11405 }
11406
11407 break;
11408
11409 case PacketType.RezMultipleAttachmentsFromInv:
11410 RezMultipleAttachmentsFromInv handlerRezMultipleAttachments = OnRezMultipleAttachmentsFromInv;
11411 if (handlerRezMultipleAttachments != null)
11412 {
11413 RezMultipleAttachmentsFromInvPacket rez = (RezMultipleAttachmentsFromInvPacket)Pack;
11414 handlerRezMultipleAttachments(this, rez.HeaderData,
11415 rez.ObjectData);
11416 }
11417
11418 break;
11419
11420 case PacketType.DetachAttachmentIntoInv:
11421 UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
11422 if (handlerDetachAttachmentIntoInv != null)
11423 {
11424 DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack;
11425
11426 #region Packet Session and User Check
11427 // UNSUPPORTED ON THIS PACKET
11428 #endregion
11429
11430 UUID itemID = detachtoInv.ObjectData.ItemID;
11431 // UUID ATTACH_agentID = detachtoInv.ObjectData.AgentID;
11432
11433 handlerDetachAttachmentIntoInv(itemID, this);
11434 }
11435 break;
11436
11437 case PacketType.ObjectAttach:
11438 if (OnObjectAttach != null)
11439 {
11440 ObjectAttachPacket att = (ObjectAttachPacket)Pack;
11441
11442 #region Packet Session and User Check
11443 if (m_checkPackets)
11444 {
11445 if (att.AgentData.SessionID != SessionId ||
11446 att.AgentData.AgentID != AgentId)
11447 break;
11448 }
11449 #endregion
11450
11451 ObjectAttach handlerObjectAttach = OnObjectAttach;
11452
11453 if (handlerObjectAttach != null)
11454 {
11455 if (att.ObjectData.Length > 0)
11456 {
11457 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false);
11458 }
11459 }
11460 }
11461 break;
11462
11463 case PacketType.ObjectDetach:
11464 ObjectDetachPacket dett = (ObjectDetachPacket)Pack;
11465
11466 #region Packet Session and User Check
11467 if (m_checkPackets)
11468 {
11469 if (dett.AgentData.SessionID != SessionId ||
11470 dett.AgentData.AgentID != AgentId)
11471 break;
11472 }
11473 #endregion
11474
11475 for (int j = 0; j < dett.ObjectData.Length; j++)
11476 {
11477 uint obj = dett.ObjectData[j].ObjectLocalID;
11478 ObjectDeselect handlerObjectDetach = OnObjectDetach;
11479 if (handlerObjectDetach != null)
11480 {
11481 handlerObjectDetach(obj, this);
11482 }
11483
11484 }
11485 break;
11486
11487 case PacketType.ObjectDrop:
11488 ObjectDropPacket dropp = (ObjectDropPacket)Pack;
11489
11490 #region Packet Session and User Check
11491 if (m_checkPackets)
11492 {
11493 if (dropp.AgentData.SessionID != SessionId ||
11494 dropp.AgentData.AgentID != AgentId)
11495 break;
11496 }
11497 #endregion
11498
11499 for (int j = 0; j < dropp.ObjectData.Length; j++)
11500 {
11501 uint obj = dropp.ObjectData[j].ObjectLocalID;
11502 ObjectDrop handlerObjectDrop = OnObjectDrop;
11503 if (handlerObjectDrop != null)
11504 {
11505 handlerObjectDrop(obj, this);
11506 }
11507 }
11508 break;
11509
11510 case PacketType.SetAlwaysRun:
11511 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
11512
11513 #region Packet Session and User Check
11514 if (m_checkPackets)
11515 {
11516 if (run.AgentData.SessionID != SessionId ||
11517 run.AgentData.AgentID != AgentId)
11518 break;
11519 }
11520 #endregion
11521
11522 SetAlwaysRun handlerSetAlwaysRun = OnSetAlwaysRun;
11523 if (handlerSetAlwaysRun != null)
11524 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
11525
11526 break;
11527
11528 case PacketType.CompleteAgentMovement:
11529 GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
11530 if (handlerCompleteMovementToRegion != null)
11531 {
11532 handlerCompleteMovementToRegion();
11533 }
11534 handlerCompleteMovementToRegion = null;
11535
11536 break;
11537
11538 case PacketType.AgentAnimation:
11539 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
11540
11541 #region Packet Session and User Check
11542 if (m_checkPackets)
11543 {
11544 if (AgentAni.AgentData.SessionID != SessionId ||
11545 AgentAni.AgentData.AgentID != AgentId)
11546 break;
11547 }
11548 #endregion
11549
11550 StartAnim handlerStartAnim = null;
11551 StopAnim handlerStopAnim = null;
11552
11553 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
11554 {
11555 if (AgentAni.AnimationList[i].StartAnim)
11556 {
11557 handlerStartAnim = OnStartAnim;
11558 if (handlerStartAnim != null)
11559 {
11560 handlerStartAnim(this, AgentAni.AnimationList[i].AnimID);
11561 }
11562 }
11563 else
11564 {
11565 handlerStopAnim = OnStopAnim;
11566 if (handlerStopAnim != null)
11567 {
11568 handlerStopAnim(this, AgentAni.AnimationList[i].AnimID);
11569 }
11570 }
11571 }
11572 break;
11573
11574 case PacketType.AgentRequestSit:
11575 if (OnAgentRequestSit != null)
11576 {
11577 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
11578
11579 #region Packet Session and User Check
11580 if (m_checkPackets)
11581 {
11582 if (agentRequestSit.AgentData.SessionID != SessionId ||
11583 agentRequestSit.AgentData.AgentID != AgentId)
11584 break;
11585 }
11586 #endregion
11587
11588 AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
11589 if (handlerAgentRequestSit != null)
11590 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
11591 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
11592 }
11593 break;
11594
11595 case PacketType.AgentSit:
11596 if (OnAgentSit != null)
11597 {
11598 AgentSitPacket agentSit = (AgentSitPacket)Pack;
11599
11600 #region Packet Session and User Check
11601 if (m_checkPackets)
11602 {
11603 if (agentSit.AgentData.SessionID != SessionId ||
11604 agentSit.AgentData.AgentID != AgentId)
11605 break;
11606 }
11607 #endregion
11608
11609 AgentSit handlerAgentSit = OnAgentSit;
11610 if (handlerAgentSit != null)
11611 {
11612 OnAgentSit(this, agentSit.AgentData.AgentID);
11613 }
11614 }
11615 break;
11616
11617 case PacketType.SoundTrigger:
11618 SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack;
11619
11620 #region Packet Session and User Check
11621 if (m_checkPackets)
11622 {
11623 // UNSUPPORTED ON THIS PACKET
11624 }
11625 #endregion
11626
11627 SoundTrigger handlerSoundTrigger = OnSoundTrigger;
11628 if (handlerSoundTrigger != null)
11629 {
11630 handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID,
11631 soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID,
11632 soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position,
11633 soundTriggerPacket.SoundData.Handle);
11634
11635 }
11636 break;
11637
11638 case PacketType.AvatarPickerRequest:
11639 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
11640
11641 #region Packet Session and User Check
11642 if (m_checkPackets)
11643 {
11644 if (avRequestQuery.AgentData.SessionID != SessionId ||
11645 avRequestQuery.AgentData.AgentID != AgentId)
11646 break;
11647 }
11648 #endregion
11649
11650 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
11651 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
11652 //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name));
11653
11654 AvatarPickerRequest handlerAvatarPickerRequest = OnAvatarPickerRequest;
11655 if (handlerAvatarPickerRequest != null)
11656 {
11657 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
11658 Utils.BytesToString(querydata.Name));
11659 }
11660 break;
11661
11662 case PacketType.AgentDataUpdateRequest:
11663 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
11664
11665 #region Packet Session and User Check
11666 if (m_checkPackets)
11667 {
11668 if (avRequestDataUpdatePacket.AgentData.SessionID != SessionId ||
11669 avRequestDataUpdatePacket.AgentData.AgentID != AgentId)
11670 break;
11671 }
11672 #endregion
11673
11674 FetchInventory handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest;
11675
11676 if (handlerAgentDataUpdateRequest != null)
11677 {
11678 handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID);
11679 }
11680
11681 break;
11682
11683 case PacketType.UserInfoRequest:
11684 UserInfoRequest handlerUserInfoRequest = OnUserInfoRequest;
11685 if (handlerUserInfoRequest != null)
11686 {
11687 handlerUserInfoRequest(this);
11688 }
11689 else
11690 {
11691 SendUserInfoReply(false, true, "");
11692 }
11693 break;
11694
11695 case PacketType.UpdateUserInfo:
11696 UpdateUserInfoPacket updateUserInfo = (UpdateUserInfoPacket)Pack;
11697
11698 #region Packet Session and User Check
11699 if (m_checkPackets)
11700 {
11701 if (updateUserInfo.AgentData.SessionID != SessionId ||
11702 updateUserInfo.AgentData.AgentID != AgentId)
11703 break;
11704 }
11705 #endregion
11706
11707 UpdateUserInfo handlerUpdateUserInfo = OnUpdateUserInfo;
11708 if (handlerUpdateUserInfo != null)
11709 {
11710 bool visible = true;
11711 string DirectoryVisibility =
11712 Utils.BytesToString(updateUserInfo.UserData.DirectoryVisibility);
11713 if (DirectoryVisibility == "hidden")
11714 visible = false;
11715
11716 handlerUpdateUserInfo(
11717 updateUserInfo.UserData.IMViaEMail,
11718 visible, this);
11719 }
11720 break;
11721
11722 case PacketType.SetStartLocationRequest:
11723 SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack;
11724
11725 #region Packet Session and User Check
11726 if (m_checkPackets)
11727 {
11728 if (avSetStartLocationRequestPacket.AgentData.SessionID != SessionId ||
11729 avSetStartLocationRequestPacket.AgentData.AgentID != AgentId)
11730 break;
11731 }
11732 #endregion
11733
11734 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
11735 {
11736 TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest;
11737 if (handlerSetStartLocationRequest != null)
11738 {
11739 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
11740 avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
11741 avSetStartLocationRequestPacket.StartLocationData.LocationID);
11742 }
11743 }
11744 break;
11745
11746 case PacketType.AgentThrottle:
11747 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
11748
11749 #region Packet Session and User Check
11750 if (m_checkPackets)
11751 {
11752 if (atpack.AgentData.SessionID != SessionId ||
11753 atpack.AgentData.AgentID != AgentId)
11754 break;
11755 }
11756 #endregion
11757
11758 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
11759 break;
11760
11761 case PacketType.AgentPause:
11762 m_udpClient.IsPaused = true;
11763 break;
11764
11765 case PacketType.AgentResume:
11766 m_udpClient.IsPaused = false;
11767 SendStartPingCheck(m_udpClient.CurrentPingSequence++);
11768
11769 break;
11770
11771 case PacketType.ForceScriptControlRelease:
11772 ForceReleaseControls handlerForceReleaseControls = OnForceReleaseControls;
11773 if (handlerForceReleaseControls != null)
11774 {
11775 handlerForceReleaseControls(this, AgentId);
11776 }
11777 break;
11778
11779 #endregion
11780
11781
11782 //#region Objects/m_sceneObjects
11783
11784 case PacketType.ObjectLink:
11785 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
11786
11787 #region Packet Session and User Check
11788 if (m_checkPackets)
11789 {
11790 if (link.AgentData.SessionID != SessionId ||
11791 link.AgentData.AgentID != AgentId)
11792 break;
11793 }
11794 #endregion
11795
11796 uint parentprimid = 0;
11797 List<uint> childrenprims = new List<uint>();
11798 if (link.ObjectData.Length > 1)
11799 {
11800 parentprimid = link.ObjectData[0].ObjectLocalID;
11801
11802 for (int i = 1; i < link.ObjectData.Length; i++)
11803 {
11804 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
11805 }
11806 }
11807 LinkObjects handlerLinkObjects = OnLinkObjects;
11808 if (handlerLinkObjects != null)
11809 {
11810 handlerLinkObjects(this, parentprimid, childrenprims);
11811 }
11812 break;
11813
11814 case PacketType.ObjectDelink:
11815 ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack;
11816
11817 #region Packet Session and User Check
11818 if (m_checkPackets)
11819 {
11820 if (delink.AgentData.SessionID != SessionId ||
11821 delink.AgentData.AgentID != AgentId)
11822 break;
11823 }
11824 #endregion
11825
11826 // It appears the prim at index 0 is not always the root prim (for
11827 // instance, when one prim of a link set has been edited independently
11828 // of the others). Therefore, we'll pass all the ids onto the delink
11829 // method for it to decide which is the root.
11830 List<uint> prims = new List<uint>();
11831 for (int i = 0; i < delink.ObjectData.Length; i++)
11832 {
11833 prims.Add(delink.ObjectData[i].ObjectLocalID);
11834 }
11835 DelinkObjects handlerDelinkObjects = OnDelinkObjects;
11836 if (handlerDelinkObjects != null)
11837 {
11838 handlerDelinkObjects(prims);
11839 }
11840
11841 break;
11842
11843 case PacketType.ObjectAdd:
11844 if (OnAddPrim != null)
11845 {
11846 ObjectAddPacket addPacket = (ObjectAddPacket)Pack;
11847
11848 #region Packet Session and User Check
11849 if (m_checkPackets)
11850 {
11851 if (addPacket.AgentData.SessionID != SessionId ||
11852 addPacket.AgentData.AgentID != AgentId)
11853 break;
11854 }
11855 #endregion
11856
11857 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
11858 // m_log.Info("[REZData]: " + addPacket.ToString());
11859 //BypassRaycast: 1
11860 //RayStart: <69.79469, 158.2652, 98.40343>
11861 //RayEnd: <61.97724, 141.995, 92.58341>
11862 //RayTargetID: 00000000-0000-0000-0000-000000000000
11863
11864 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the
11865 //object from rezing initially
11866
11867 AddNewPrim handlerAddPrim = OnAddPrim;
11868 if (handlerAddPrim != null)
11869 handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
11870 }
11871 break;
11872
11873 case PacketType.ObjectShape:
11874 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
11875
11876 #region Packet Session and User Check
11877 if (m_checkPackets)
11878 {
11879 if (shapePacket.AgentData.SessionID != SessionId ||
11880 shapePacket.AgentData.AgentID != AgentId)
11881 break;
11882 }
11883 #endregion
11884
11885 UpdateShape handlerUpdatePrimShape = null;
11886 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
11887 {
11888 handlerUpdatePrimShape = OnUpdatePrimShape;
11889 if (handlerUpdatePrimShape != null)
11890 {
11891 UpdateShapeArgs shapeData = new UpdateShapeArgs();
11892 shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID;
11893 shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin;
11894 shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve;
11895 shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd;
11896 shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset;
11897 shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions;
11898 shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX;
11899 shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY;
11900 shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX;
11901 shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY;
11902 shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew;
11903 shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX;
11904 shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY;
11905 shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist;
11906 shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin;
11907 shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin;
11908 shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve;
11909 shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd;
11910 shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow;
11911
11912 handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
11913 shapeData);
11914 }
11915 }
11916 break;
11917
11918 case PacketType.ObjectExtraParams:
11919 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack;
11920
11921 #region Packet Session and User Check
11922 if (m_checkPackets)
11923 {
11924 if (extraPar.AgentData.SessionID != SessionId ||
11925 extraPar.AgentData.AgentID != AgentId)
11926 break;
11927 }
11928 #endregion
11929
11930 ObjectExtraParams handlerUpdateExtraParams = OnUpdateExtraParams;
11931 if (handlerUpdateExtraParams != null)
11932 {
11933 for (int i = 0; i < extraPar.ObjectData.Length; i++)
11934 {
11935 handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[i].ObjectLocalID,
11936 extraPar.ObjectData[i].ParamType,
11937 extraPar.ObjectData[i].ParamInUse, extraPar.ObjectData[i].ParamData);
11938 }
11939 }
11940 break;
11941
11942 case PacketType.ObjectDuplicate:
11943 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
11944
11945 #region Packet Session and User Check
11946 if (m_checkPackets)
11947 {
11948 if (dupe.AgentData.SessionID != SessionId ||
11949 dupe.AgentData.AgentID != AgentId)
11950 break;
11951 }
11952 #endregion
11953
11954 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
11955
11956 ObjectDuplicate handlerObjectDuplicate = null;
11957
11958 for (int i = 0; i < dupe.ObjectData.Length; i++)
11959 {
11960 handlerObjectDuplicate = OnObjectDuplicate;
11961 if (handlerObjectDuplicate != null)
11962 {
11963 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
11964 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
11965 AgentandGroupData.GroupID);
11966 }
11967 }
11968
11969 break;
11970
11971 case PacketType.RequestMultipleObjects:
11972 RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack;
11973
11974 #region Packet Session and User Check
11975 if (m_checkPackets)
11976 {
11977 if (incomingRequest.AgentData.SessionID != SessionId ||
11978 incomingRequest.AgentData.AgentID != AgentId)
11979 break;
11980 }
11981 #endregion
11982
11983 ObjectRequest handlerObjectRequest = null;
11984
11985 for (int i = 0; i < incomingRequest.ObjectData.Length; i++)
11986 {
11987 handlerObjectRequest = OnObjectRequest;
11988 if (handlerObjectRequest != null)
11989 {
11990 handlerObjectRequest(incomingRequest.ObjectData[i].ID, this);
11991 }
11992 }
11993 break;
11994
11995 case PacketType.ObjectSelect:
11996 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
11997
11998 #region Packet Session and User Check
11999 if (m_checkPackets)
12000 {
12001 if (incomingselect.AgentData.SessionID != SessionId ||
12002 incomingselect.AgentData.AgentID != AgentId)
12003 break;
12004 }
12005 #endregion
12006
12007 ObjectSelect handlerObjectSelect = null;
12008
12009 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
12010 {
12011 handlerObjectSelect = OnObjectSelect;
12012 if (handlerObjectSelect != null)
12013 {
12014 handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
12015 }
12016 }
12017 break;
12018
12019 case PacketType.ObjectDeselect:
12020 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
12021
12022 #region Packet Session and User Check
12023 if (m_checkPackets)
12024 {
12025 if (incomingdeselect.AgentData.SessionID != SessionId ||
12026 incomingdeselect.AgentData.AgentID != AgentId)
12027 break;
12028 }
12029 #endregion
12030
12031 ObjectDeselect handlerObjectDeselect = null;
12032
12033 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
12034 {
12035 handlerObjectDeselect = OnObjectDeselect;
12036 if (handlerObjectDeselect != null)
12037 {
12038 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
12039 }
12040 }
12041 break;
12042
12043 case PacketType.ObjectPosition:
12044 // DEPRECATED: but till libsecondlife removes it, people will use it
12045 ObjectPositionPacket position = (ObjectPositionPacket)Pack;
12046
12047 #region Packet Session and User Check
12048 if (m_checkPackets)
12049 {
12050 if (position.AgentData.SessionID != SessionId ||
12051 position.AgentData.AgentID != AgentId)
12052 break;
12053 }
12054 #endregion
12055
12056
12057 for (int i = 0; i < position.ObjectData.Length; i++)
12058 {
12059 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition;
12060 if (handlerUpdateVector != null)
12061 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this);
12062 }
12063
12064 break;
12065
12066 case PacketType.ObjectScale:
12067 // DEPRECATED: but till libsecondlife removes it, people will use it
12068 ObjectScalePacket scale = (ObjectScalePacket)Pack;
12069
12070 #region Packet Session and User Check
12071 if (m_checkPackets)
12072 {
12073 if (scale.AgentData.SessionID != SessionId ||
12074 scale.AgentData.AgentID != AgentId)
12075 break;
12076 }
12077 #endregion
12078
12079 for (int i = 0; i < scale.ObjectData.Length; i++)
12080 {
12081 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
12082 if (handlerUpdatePrimGroupScale != null)
12083 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this);
12084 }
12085
12086 break;
12087
12088 case PacketType.ObjectRotation:
12089 // DEPRECATED: but till libsecondlife removes it, people will use it
12090 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack;
12091
12092 #region Packet Session and User Check
12093 if (m_checkPackets)
12094 {
12095 if (rotation.AgentData.SessionID != SessionId ||
12096 rotation.AgentData.AgentID != AgentId)
12097 break;
12098 }
12099 #endregion
12100
12101 for (int i = 0; i < rotation.ObjectData.Length; i++)
12102 {
12103 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
12104 if (handlerUpdatePrimRotation != null)
12105 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this);
12106 }
12107
12108 break;
12109
12110 case PacketType.ObjectFlagUpdate:
12111 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
12112
12113 #region Packet Session and User Check
12114 if (m_checkPackets)
12115 {
12116 if (flags.AgentData.SessionID != SessionId ||
12117 flags.AgentData.AgentID != AgentId)
12118 break;
12119 }
12120 #endregion
12121
12122 UpdatePrimFlags handlerUpdatePrimFlags = OnUpdatePrimFlags;
12123
12124 if (handlerUpdatePrimFlags != null)
12125 {
12126 byte[] data = Pack.ToBytes();
12127 // 46,47,48 are special positions within the packet
12128 // This may change so perhaps we need a better way
12129 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
12130 bool UsePhysics = (data[46] != 0) ? true : false;
12131 bool IsTemporary = (data[47] != 0) ? true : false;
12132 bool IsPhantom = (data[48] != 0) ? true : false;
12133 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
12134 }
12135 break;
12136 case PacketType.ObjectImage:
12137 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
12138
12139 UpdatePrimTexture handlerUpdatePrimTexture = null;
12140 for (int i = 0; i < imagePack.ObjectData.Length; i++)
12141 {
12142 handlerUpdatePrimTexture = OnUpdatePrimTexture;
12143 if (handlerUpdatePrimTexture != null)
12144 {
12145 handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
12146 imagePack.ObjectData[i].TextureEntry, this);
12147 }
12148 }
12149 break;
12150
12151 case PacketType.ObjectGrab:
12152 ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
12153
12154 #region Packet Session and User Check
12155 if (m_checkPackets)
12156 {
12157 if (grab.AgentData.SessionID != SessionId ||
12158 grab.AgentData.AgentID != AgentId)
12159 break;
12160 }
12161 #endregion
12162
12163 GrabObject handlerGrabObject = OnGrabObject;
12164
12165 if (handlerGrabObject != null)
12166 {
12167 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
12168 if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0))
12169 {
12170 foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo)
12171 {
12172 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
12173 arg.Binormal = surfaceInfo.Binormal;
12174 arg.FaceIndex = surfaceInfo.FaceIndex;
12175 arg.Normal = surfaceInfo.Normal;
12176 arg.Position = surfaceInfo.Position;
12177 arg.STCoord = surfaceInfo.STCoord;
12178 arg.UVCoord = surfaceInfo.UVCoord;
12179 touchArgs.Add(arg);
12180 }
12181 }
12182 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs);
12183 }
12184 break;
12185
12186 case PacketType.ObjectGrabUpdate:
12187 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack;
12188
12189 #region Packet Session and User Check
12190 if (m_checkPackets)
12191 {
12192 if (grabUpdate.AgentData.SessionID != SessionId ||
12193 grabUpdate.AgentData.AgentID != AgentId)
12194 break;
12195 }
12196 #endregion
12197
12198 MoveObject handlerGrabUpdate = OnGrabUpdate;
12199
12200 if (handlerGrabUpdate != null)
12201 {
12202 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
12203 if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0))
12204 {
12205 foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo)
12206 {
12207 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
12208 arg.Binormal = surfaceInfo.Binormal;
12209 arg.FaceIndex = surfaceInfo.FaceIndex;
12210 arg.Normal = surfaceInfo.Normal;
12211 arg.Position = surfaceInfo.Position;
12212 arg.STCoord = surfaceInfo.STCoord;
12213 arg.UVCoord = surfaceInfo.UVCoord;
12214 touchArgs.Add(arg);
12215 }
12216 }
12217 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
12218 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
12219 }
12220 break;
12221
12222 case PacketType.ObjectDeGrab:
12223 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack;
12224
12225 #region Packet Session and User Check
12226 if (m_checkPackets)
12227 {
12228 if (deGrab.AgentData.SessionID != SessionId ||
12229 deGrab.AgentData.AgentID != AgentId)
12230 break;
12231 }
12232 #endregion
12233
12234 DeGrabObject handlerDeGrabObject = OnDeGrabObject;
12235 if (handlerDeGrabObject != null)
12236 {
12237 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
12238 if ((deGrab.SurfaceInfo != null) && (deGrab.SurfaceInfo.Length > 0))
12239 {
12240 foreach (ObjectDeGrabPacket.SurfaceInfoBlock surfaceInfo in deGrab.SurfaceInfo)
12241 {
12242 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
12243 arg.Binormal = surfaceInfo.Binormal;
12244 arg.FaceIndex = surfaceInfo.FaceIndex;
12245 arg.Normal = surfaceInfo.Normal;
12246 arg.Position = surfaceInfo.Position;
12247 arg.STCoord = surfaceInfo.STCoord;
12248 arg.UVCoord = surfaceInfo.UVCoord;
12249 touchArgs.Add(arg);
12250 }
12251 }
12252 handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs);
12253 }
12254 break;
12255
12256 case PacketType.ObjectSpinStart:
12257 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet");
12258 ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack;
12259
12260 #region Packet Session and User Check
12261 if (m_checkPackets)
12262 {
12263 if (spinStart.AgentData.SessionID != SessionId ||
12264 spinStart.AgentData.AgentID != AgentId)
12265 break;
12266 }
12267 #endregion
12268
12269 SpinStart handlerSpinStart = OnSpinStart;
12270 if (handlerSpinStart != null)
12271 {
12272 handlerSpinStart(spinStart.ObjectData.ObjectID, this);
12273 }
12274 break;
12275 case PacketType.ObjectSpinUpdate:
12276 //m_log.Warn("[CLIENT]: unhandled ObjectSpinUpdate packet");
12277 ObjectSpinUpdatePacket spinUpdate = (ObjectSpinUpdatePacket)Pack;
12278
12279 #region Packet Session and User Check
12280 if (m_checkPackets)
12281 {
12282 if (spinUpdate.AgentData.SessionID != SessionId ||
12283 spinUpdate.AgentData.AgentID != AgentId)
12284 break;
12285 }
12286 #endregion
12287
12288 Vector3 axis;
12289 float angle;
12290 spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle);
12291 //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle);
12292
12293 SpinObject handlerSpinUpdate = OnSpinUpdate;
12294 if (handlerSpinUpdate != null)
12295 {
12296 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this);
12297 }
12298 break;
12299
12300
12301 case PacketType.ObjectSpinStop:
12302 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
12303 ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack;
12304
12305 #region Packet Session and User Check
12306 if (m_checkPackets)
12307 {
12308 if (spinStop.AgentData.SessionID != SessionId ||
12309 spinStop.AgentData.AgentID != AgentId)
12310 break;
12311 }
12312 #endregion
12313
12314 SpinStop handlerSpinStop = OnSpinStop;
12315 if (handlerSpinStop != null)
12316 {
12317 handlerSpinStop(spinStop.ObjectData.ObjectID, this);
12318 }
12319 break;
12320
12321 case PacketType.ObjectDescription:
12322 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
12323
12324 #region Packet Session and User Check
12325 if (m_checkPackets)
12326 {
12327 if (objDes.AgentData.SessionID != SessionId ||
12328 objDes.AgentData.AgentID != AgentId)
12329 break;
12330 }
12331 #endregion
12332
12333 GenericCall7 handlerObjectDescription = null;
12334
12335 for (int i = 0; i < objDes.ObjectData.Length; i++)
12336 {
12337 handlerObjectDescription = OnObjectDescription;
12338 if (handlerObjectDescription != null)
12339 {
12340 handlerObjectDescription(this, objDes.ObjectData[i].LocalID,
12341 Util.FieldToString(objDes.ObjectData[i].Description));
12342 }
12343 }
12344 break;
12345
12346 case PacketType.ObjectName:
12347 ObjectNamePacket objName = (ObjectNamePacket)Pack;
12348
12349 #region Packet Session and User Check
12350 if (m_checkPackets)
12351 {
12352 if (objName.AgentData.SessionID != SessionId ||
12353 objName.AgentData.AgentID != AgentId)
12354 break;
12355 }
12356 #endregion
12357
12358 GenericCall7 handlerObjectName = null;
12359 for (int i = 0; i < objName.ObjectData.Length; i++)
12360 {
12361 handlerObjectName = OnObjectName;
12362 if (handlerObjectName != null)
12363 {
12364 handlerObjectName(this, objName.ObjectData[i].LocalID,
12365 Util.FieldToString(objName.ObjectData[i].Name));
12366 }
12367 }
12368 break;
12369
12370 case PacketType.ObjectPermissions:
12371 if (OnObjectPermissions != null)
12372 {
12373 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
12374
12375 #region Packet Session and User Check
12376 if (m_checkPackets)
12377 {
12378 if (newobjPerms.AgentData.SessionID != SessionId ||
12379 newobjPerms.AgentData.AgentID != AgentId)
12380 break;
12381 }
12382 #endregion
12383
12384 UUID AgentID = newobjPerms.AgentData.AgentID;
12385 UUID SessionID = newobjPerms.AgentData.SessionID;
12386
12387 ObjectPermissions handlerObjectPermissions = null;
12388
12389 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
12390 {
12391 ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i];
12392
12393 byte field = permChanges.Field;
12394 uint localID = permChanges.ObjectLocalID;
12395 uint mask = permChanges.Mask;
12396 byte set = permChanges.Set;
12397
12398 handlerObjectPermissions = OnObjectPermissions;
12399
12400 if (handlerObjectPermissions != null)
12401 handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
12402 }
12403 }
12404
12405 // Here's our data,
12406 // PermField contains the field the info goes into
12407 // PermField determines which mask we're changing
12408 //
12409 // chmask is the mask of the change
12410 // setTF is whether we're adding it or taking it away
12411 //
12412 // objLocalID is the localID of the object.
12413
12414 // Unfortunately, we have to pass the event the packet because objData is an array
12415 // That means multiple object perms may be updated in a single packet.
12416
12417 break;
12418
12419 case PacketType.Undo:
12420 UndoPacket undoitem = (UndoPacket)Pack;
12421
12422 #region Packet Session and User Check
12423 if (m_checkPackets)
12424 {
12425 if (undoitem.AgentData.SessionID != SessionId ||
12426 undoitem.AgentData.AgentID != AgentId)
12427 break;
12428 }
12429 #endregion
12430
12431 if (undoitem.ObjectData.Length > 0)
12432 {
12433 for (int i = 0; i < undoitem.ObjectData.Length; i++)
12434 {
12435 UUID objiD = undoitem.ObjectData[i].ObjectID;
12436 AgentSit handlerOnUndo = OnUndo;
12437 if (handlerOnUndo != null)
12438 {
12439 handlerOnUndo(this, objiD);
12440 }
12441
12442 }
12443 }
12444 break;
12445
12446 case PacketType.ObjectDuplicateOnRay:
12447 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
12448
12449 #region Packet Session and User Check
12450 if (m_checkPackets)
12451 {
12452 if (dupeOnRay.AgentData.SessionID != SessionId ||
12453 dupeOnRay.AgentData.AgentID != AgentId)
12454 break;
12455 }
12456 #endregion
12457
12458 ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null;
12459
12460 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++)
12461 {
12462 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay;
12463 if (handlerObjectDuplicateOnRay != null)
12464 {
12465 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
12466 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
12467 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
12468 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
12469 }
12470 }
12471
12472 break;
12473
12474 case PacketType.RequestObjectPropertiesFamily:
12475 //This powers the little tooltip that appears when you move your mouse over an object
12476 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
12477
12478 #region Packet Session and User Check
12479 if (m_checkPackets)
12480 {
12481 if (packToolTip.AgentData.SessionID != SessionId ||
12482 packToolTip.AgentData.AgentID != AgentId)
12483 break;
12484 }
12485 #endregion
12486
12487 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
12488
12489 RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily;
12490
12491 if (handlerRequestObjectPropertiesFamily != null)
12492 {
12493 handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags,
12494 packObjBlock.ObjectID);
12495 }
12496
12497 break;
12498
12499 case PacketType.ObjectIncludeInSearch:
12500 //This lets us set objects to appear in search (stuff like DataSnapshot, etc)
12501 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
12502 ObjectIncludeInSearch handlerObjectIncludeInSearch = null;
12503
12504 #region Packet Session and User Check
12505 if (m_checkPackets)
12506 {
12507 if (packInSearch.AgentData.SessionID != SessionId ||
12508 packInSearch.AgentData.AgentID != AgentId)
12509 break;
12510 }
12511 #endregion
12512
12513 foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData)
12514 {
12515 bool inSearch = objData.IncludeInSearch;
12516 uint localID = objData.ObjectLocalID;
12517
12518 handlerObjectIncludeInSearch = OnObjectIncludeInSearch;
12519
12520 if (handlerObjectIncludeInSearch != null)
12521 {
12522 handlerObjectIncludeInSearch(this, inSearch, localID);
12523 }
12524 }
12525 break;
12526
12527 case PacketType.ScriptAnswerYes:
12528 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack;
12529
12530 #region Packet Session and User Check
12531 if (m_checkPackets)
12532 {
12533 if (scriptAnswer.AgentData.SessionID != SessionId ||
12534 scriptAnswer.AgentData.AgentID != AgentId)
12535 break;
12536 }
12537 #endregion
12538
12539 ScriptAnswer handlerScriptAnswer = OnScriptAnswer;
12540 if (handlerScriptAnswer != null)
12541 {
12542 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
12543 }
12544 break;
12545
12546 case PacketType.ObjectClickAction:
12547 ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack;
12548
12549 #region Packet Session and User Check
12550 if (m_checkPackets)
12551 {
12552 if (ocpacket.AgentData.SessionID != SessionId ||
12553 ocpacket.AgentData.AgentID != AgentId)
12554 break;
12555 }
12556 #endregion
12557
12558 GenericCall7 handlerObjectClickAction = OnObjectClickAction;
12559 if (handlerObjectClickAction != null)
12560 {
12561 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData)
12562 {
12563 byte action = odata.ClickAction;
12564 uint localID = odata.ObjectLocalID;
12565 handlerObjectClickAction(this, localID, action.ToString());
12566 }
12567 }
12568 break;
12569
12570 case PacketType.ObjectMaterial:
12571 ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack;
12572
12573 #region Packet Session and User Check
12574 if (m_checkPackets)
12575 {
12576 if (ompacket.AgentData.SessionID != SessionId ||
12577 ompacket.AgentData.AgentID != AgentId)
12578 break;
12579 }
12580 #endregion
12581
12582 GenericCall7 handlerObjectMaterial = OnObjectMaterial;
12583 if (handlerObjectMaterial != null)
12584 {
12585 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData)
12586 {
12587 byte material = odata.Material;
12588 uint localID = odata.ObjectLocalID;
12589 handlerObjectMaterial(this, localID, material.ToString());
12590 }
12591 }
12592 break;
12593
12594 //#endregion
12595
12596 //#region Inventory/Asset/Other related packets
12597
12598 case PacketType.RequestImage:
12599 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
12600 //m_log.Debug("image request: " + Pack.ToString());
12601
12602 #region Packet Session and User Check
12603 if (m_checkPackets)
12604 {
12605 if (imageRequest.AgentData.SessionID != SessionId ||
12606 imageRequest.AgentData.AgentID != AgentId)
12607 break;
12608 }
12609 #endregion
12610
12611 //handlerTextureRequest = null;
12612 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
12613 {
12614 if (OnRequestTexture != null)
12615 {
12616 TextureRequestArgs args = new TextureRequestArgs();
12617
12618 RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i];
12619
12620 args.RequestedAssetID = block.Image;
12621 args.DiscardLevel = block.DiscardLevel;
12622 args.PacketNumber = block.Packet;
12623 args.Priority = block.DownloadPriority;
12624 args.requestSequence = imageRequest.Header.Sequence;
12625
12626 // NOTE: This is not a built in part of the LLUDP protocol, but we double the
12627 // priority of avatar textures to get avatars rezzing in faster than the
12628 // surrounding scene
12629 if ((ImageType)block.Type == ImageType.Baked)
12630 args.Priority *= 2.0f;
12631
12632 //handlerTextureRequest = OnRequestTexture;
12633
12634 //if (handlerTextureRequest != null)
12635 //OnRequestTexture(this, args);
12636
12637 // in the end, we null this, so we have to check if it's null
12638 if (m_imageManager != null)
12639 {
12640 m_imageManager.EnqueueReq(args);
12641 }
12642 }
12643 }
12644 break;
12645
12646 case PacketType.TransferRequest:
12647 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
12648
12649 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
12650 //m_log.Debug("Transfer Request: " + transfer.ToString());
12651 // Validate inventory transfers
12652 // Has to be done here, because AssetCache can't do it
12653 //
12654 UUID taskID = UUID.Zero;
12655 if (transfer.TransferInfo.SourceType == 3)
12656 {
12657 taskID = new UUID(transfer.TransferInfo.Params, 48);
12658 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
12659 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
12660 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
12661 {
12662 if (taskID != UUID.Zero) // Prim
12663 {
12664 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
12665 if (part == null)
12666 break;
12667
12668 if (part.OwnerID != AgentId)
12669 break;
12670
12671 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
12672 break;
12673
12674 TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
12675 if (ti == null)
12676 break;
12677
12678 if (ti.OwnerID != AgentId)
12679 break;
12680
12681 if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
12682 break;
12683
12684 if (ti.AssetID != requestID)
12685 break;
12686 }
12687 else // Agent
12688 {
12689 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
12690 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
12691 assetRequestItem = invService.GetItem(assetRequestItem);
12692 if (assetRequestItem == null)
12693 {
12694 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
12695 if (assetRequestItem == null)
12696 return;
12697 }
12698
12699 // At this point, we need to apply perms
12700 // only to notecards and scripts. All
12701 // other asset types are always available
12702 //
12703 if (assetRequestItem.AssetType == 10)
12704 {
12705 if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
12706 {
12707 SendAgentAlertMessage("Insufficient permissions to view script", false);
12708 break;
12709 }
12710 }
12711 else if (assetRequestItem.AssetType == 7)
12712 {
12713 if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
12714 {
12715 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
12716 break;
12717 }
12718 }
12719
12720 if (assetRequestItem.AssetID != requestID)
12721 break;
12722 }
12723 }
12724 }
12725
12726 //m_assetCache.AddAssetRequest(this, transfer);
12727
12728 MakeAssetRequest(transfer, taskID);
12729
12730 // RequestAsset = OnRequestAsset;
12731 // if (RequestAsset != null)
12732 // {
12733 // RequestAsset(this, transfer);
12734 // }
12735
12736 break;
12737
12738 case PacketType.AssetUploadRequest:
12739 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
12740
12741
12742 // m_log.Debug("upload request " + request.ToString());
12743 // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
12744 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
12745
12746 UDPAssetUploadRequest handlerAssetUploadRequest = OnAssetUploadRequest;
12747
12748 if (handlerAssetUploadRequest != null)
12749 {
12750 handlerAssetUploadRequest(this, temp,
12751 request.AssetBlock.TransactionID, request.AssetBlock.Type,
12752 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal,
12753 request.AssetBlock.Tempfile);
12754 }
12755 break;
12756
12757 case PacketType.RequestXfer:
12758 RequestXferPacket xferReq = (RequestXferPacket)Pack;
12759
12760 RequestXfer handlerRequestXfer = OnRequestXfer;
12761
12762 if (handlerRequestXfer != null)
12763 {
12764 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
12765 }
12766 break;
12767
12768 case PacketType.SendXferPacket:
12769 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
12770
12771 XferReceive handlerXferReceive = OnXferReceive;
12772 if (handlerXferReceive != null)
12773 {
12774 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
12775 }
12776 break;
12777
12778 case PacketType.ConfirmXferPacket:
12779 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
12780
12781 ConfirmXfer handlerConfirmXfer = OnConfirmXfer;
12782 if (handlerConfirmXfer != null)
12783 {
12784 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
12785 }
12786 break;
12787
12788 case PacketType.AbortXfer:
12789 AbortXferPacket abortXfer = (AbortXferPacket)Pack;
12790 AbortXfer handlerAbortXfer = OnAbortXfer;
12791 if (handlerAbortXfer != null)
12792 {
12793 handlerAbortXfer(this, abortXfer.XferID.ID);
12794 }
12795
12796 break;
12797
12798 case PacketType.CreateInventoryFolder:
12799 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
12800
12801 #region Packet Session and User Check
12802 if (m_checkPackets)
12803 {
12804 if (invFolder.AgentData.SessionID != SessionId ||
12805 invFolder.AgentData.AgentID != AgentId)
12806 break;
12807 }
12808 #endregion
12809
12810 CreateInventoryFolder handlerCreateInventoryFolder = OnCreateNewInventoryFolder;
12811 if (handlerCreateInventoryFolder != null)
12812 {
12813 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID,
12814 (ushort)invFolder.FolderData.Type,
12815 Util.FieldToString(invFolder.FolderData.Name),
12816 invFolder.FolderData.ParentID);
12817 }
12818 break;
12819
12820 case PacketType.UpdateInventoryFolder:
12821 if (OnUpdateInventoryFolder != null)
12822 {
12823 UpdateInventoryFolderPacket invFolderx = (UpdateInventoryFolderPacket)Pack;
12824
12825 #region Packet Session and User Check
12826 if (m_checkPackets)
12827 {
12828 if (invFolderx.AgentData.SessionID != SessionId ||
12829 invFolderx.AgentData.AgentID != AgentId)
12830 break;
12831 }
12832 #endregion
12833
12834 UpdateInventoryFolder handlerUpdateInventoryFolder = null;
12835
12836 for (int i = 0; i < invFolderx.FolderData.Length; i++)
12837 {
12838 handlerUpdateInventoryFolder = OnUpdateInventoryFolder;
12839 if (handlerUpdateInventoryFolder != null)
12840 {
12841 OnUpdateInventoryFolder(this, invFolderx.FolderData[i].FolderID,
12842 (ushort)invFolderx.FolderData[i].Type,
12843 Util.FieldToString(invFolderx.FolderData[i].Name),
12844 invFolderx.FolderData[i].ParentID);
12845 }
12846 }
12847 }
12848 break;
12849
12850 case PacketType.MoveInventoryFolder:
12851 if (OnMoveInventoryFolder != null)
12852 {
12853 MoveInventoryFolderPacket invFoldery = (MoveInventoryFolderPacket)Pack;
12854
12855 #region Packet Session and User Check
12856 if (m_checkPackets)
12857 {
12858 if (invFoldery.AgentData.SessionID != SessionId ||
12859 invFoldery.AgentData.AgentID != AgentId)
12860 break;
12861 }
12862 #endregion
12863
12864 MoveInventoryFolder handlerMoveInventoryFolder = null;
12865
12866 for (int i = 0; i < invFoldery.InventoryData.Length; i++)
12867 {
12868 handlerMoveInventoryFolder = OnMoveInventoryFolder;
12869 if (handlerMoveInventoryFolder != null)
12870 {
12871 OnMoveInventoryFolder(this, invFoldery.InventoryData[i].FolderID,
12872 invFoldery.InventoryData[i].ParentID);
12873 }
12874 }
12875 }
12876 break;
12877
12878 case PacketType.CreateInventoryItem:
12879 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
12880
12881 #region Packet Session and User Check
12882 if (m_checkPackets)
12883 {
12884 if (createItem.AgentData.SessionID != SessionId ||
12885 createItem.AgentData.AgentID != AgentId)
12886 break;
12887 }
12888 #endregion
12889
12890 CreateNewInventoryItem handlerCreateNewInventoryItem = OnCreateNewInventoryItem;
12891 if (handlerCreateNewInventoryItem != null)
12892 {
12893 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
12894 createItem.InventoryBlock.FolderID,
12895 createItem.InventoryBlock.CallbackID,
12896 Util.FieldToString(createItem.InventoryBlock.Description),
12897 Util.FieldToString(createItem.InventoryBlock.Name),
12898 createItem.InventoryBlock.InvType,
12899 createItem.InventoryBlock.Type,
12900 createItem.InventoryBlock.WearableType,
12901 createItem.InventoryBlock.NextOwnerMask,
12902 Util.UnixTimeSinceEpoch());
12903 }
12904 break;
12905
12906 case PacketType.FetchInventory:
12907 if (OnFetchInventory != null)
12908 {
12909 FetchInventoryPacket FetchInventoryx = (FetchInventoryPacket)Pack;
12910
12911 #region Packet Session and User Check
12912 if (m_checkPackets)
12913 {
12914 if (FetchInventoryx.AgentData.SessionID != SessionId ||
12915 FetchInventoryx.AgentData.AgentID != AgentId)
12916 break;
12917 }
12918 #endregion
12919
12920 FetchInventory handlerFetchInventory = null;
12921
12922 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++)
12923 {
12924 handlerFetchInventory = OnFetchInventory;
12925
12926 if (handlerFetchInventory != null)
12927 {
12928 OnFetchInventory(this, FetchInventoryx.InventoryData[i].ItemID,
12929 FetchInventoryx.InventoryData[i].OwnerID);
12930 }
12931 }
12932 }
12933 break;
12934
12935 case PacketType.FetchInventoryDescendents:
12936 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
12937
12938 #region Packet Session and User Check
12939 if (m_checkPackets)
12940 {
12941 if (Fetch.AgentData.SessionID != SessionId ||
12942 Fetch.AgentData.AgentID != AgentId)
12943 break;
12944 }
12945 #endregion
12946
12947 FetchInventoryDescendents handlerFetchInventoryDescendents = OnFetchInventoryDescendents;
12948 if (handlerFetchInventoryDescendents != null)
12949 {
12950 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
12951 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
12952 Fetch.InventoryData.SortOrder);
12953 }
12954 break;
12955
12956 case PacketType.PurgeInventoryDescendents:
12957 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
12958
12959 #region Packet Session and User Check
12960 if (m_checkPackets)
12961 {
12962 if (Purge.AgentData.SessionID != SessionId ||
12963 Purge.AgentData.AgentID != AgentId)
12964 break;
12965 }
12966 #endregion
12967
12968 PurgeInventoryDescendents handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents;
12969 if (handlerPurgeInventoryDescendents != null)
12970 {
12971 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
12972 }
12973 break;
12974
12975 case PacketType.UpdateInventoryItem:
12976 UpdateInventoryItemPacket inventoryItemUpdate = (UpdateInventoryItemPacket)Pack;
12977
12978 #region Packet Session and User Check
12979 if (m_checkPackets)
12980 {
12981 if (inventoryItemUpdate.AgentData.SessionID != SessionId ||
12982 inventoryItemUpdate.AgentData.AgentID != AgentId)
12983 break;
12984 }
12985 #endregion
12986
12987 if (OnUpdateInventoryItem != null)
12988 {
12989 UpdateInventoryItem handlerUpdateInventoryItem = null;
12990 for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++)
12991 {
12992 handlerUpdateInventoryItem = OnUpdateInventoryItem;
12993
12994 if (handlerUpdateInventoryItem != null)
12995 {
12996 InventoryItemBase itemUpd = new InventoryItemBase();
12997 itemUpd.ID = inventoryItemUpdate.InventoryData[i].ItemID;
12998 itemUpd.Name = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Name);
12999 itemUpd.Description = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Description);
13000 itemUpd.GroupID = inventoryItemUpdate.InventoryData[i].GroupID;
13001 itemUpd.GroupOwned = inventoryItemUpdate.InventoryData[i].GroupOwned;
13002 itemUpd.GroupPermissions = inventoryItemUpdate.InventoryData[i].GroupMask;
13003 itemUpd.NextPermissions = inventoryItemUpdate.InventoryData[i].NextOwnerMask;
13004 itemUpd.EveryOnePermissions = inventoryItemUpdate.InventoryData[i].EveryoneMask;
13005 itemUpd.CreationDate = inventoryItemUpdate.InventoryData[i].CreationDate;
13006 itemUpd.Folder = inventoryItemUpdate.InventoryData[i].FolderID;
13007 itemUpd.InvType = inventoryItemUpdate.InventoryData[i].InvType;
13008 itemUpd.SalePrice = inventoryItemUpdate.InventoryData[i].SalePrice;
13009 itemUpd.SaleType = inventoryItemUpdate.InventoryData[i].SaleType;
13010 itemUpd.Flags = inventoryItemUpdate.InventoryData[i].Flags;
13011
13012 OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID,
13013 inventoryItemUpdate.InventoryData[i].ItemID,
13014 itemUpd);
13015 }
13016 }
13017 }
13018 break;
13019
13020 case PacketType.CopyInventoryItem:
13021 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
13022
13023 #region Packet Session and User Check
13024 if (m_checkPackets)
13025 {
13026 if (copyitem.AgentData.SessionID != SessionId ||
13027 copyitem.AgentData.AgentID != AgentId)
13028 break;
13029 }
13030 #endregion
13031
13032 CopyInventoryItem handlerCopyInventoryItem = null;
13033 if (OnCopyInventoryItem != null)
13034 {
13035 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
13036 {
13037 handlerCopyInventoryItem = OnCopyInventoryItem;
13038 if (handlerCopyInventoryItem != null)
13039 {
13040 handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
13041 datablock.OldItemID, datablock.NewFolderID,
13042 Util.FieldToString(datablock.NewName));
13043 }
13044 }
13045 }
13046 break;
13047
13048 case PacketType.MoveInventoryItem:
13049 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
13050
13051 #region Packet Session and User Check
13052 if (m_checkPackets)
13053 {
13054 if (moveitem.AgentData.SessionID != SessionId ||
13055 moveitem.AgentData.AgentID != AgentId)
13056 break;
13057 }
13058 #endregion
13059
13060 if (OnMoveInventoryItem != null)
13061 {
13062 MoveInventoryItem handlerMoveInventoryItem = null;
13063 InventoryItemBase itm = null;
13064 List<InventoryItemBase> items = new List<InventoryItemBase>();
13065 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
13066 {
13067 itm = new InventoryItemBase(datablock.ItemID, AgentId);
13068 itm.Folder = datablock.FolderID;
13069 itm.Name = Util.FieldToString(datablock.NewName);
13070 // weird, comes out as empty string
13071 //m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
13072 items.Add(itm);
13073 }
13074 handlerMoveInventoryItem = OnMoveInventoryItem;
13075 if (handlerMoveInventoryItem != null)
13076 {
13077 handlerMoveInventoryItem(this, items);
13078 }
13079 }
13080 break;
13081
13082 case PacketType.RemoveInventoryItem:
13083 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack;
13084
13085 #region Packet Session and User Check
13086 if (m_checkPackets)
13087 {
13088 if (removeItem.AgentData.SessionID != SessionId ||
13089 removeItem.AgentData.AgentID != AgentId)
13090 break;
13091 }
13092 #endregion
13093
13094 if (OnRemoveInventoryItem != null)
13095 {
13096 RemoveInventoryItem handlerRemoveInventoryItem = null;
13097 List<UUID> uuids = new List<UUID>();
13098 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
13099 {
13100 uuids.Add(datablock.ItemID);
13101 }
13102 handlerRemoveInventoryItem = OnRemoveInventoryItem;
13103 if (handlerRemoveInventoryItem != null)
13104 {
13105 handlerRemoveInventoryItem(this, uuids);
13106 }
13107
13108 }
13109 break;
13110
13111 case PacketType.RemoveInventoryFolder:
13112 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack;
13113
13114 #region Packet Session and User Check
13115 if (m_checkPackets)
13116 {
13117 if (removeFolder.AgentData.SessionID != SessionId ||
13118 removeFolder.AgentData.AgentID != AgentId)
13119 break;
13120 }
13121 #endregion
13122
13123 if (OnRemoveInventoryFolder != null)
13124 {
13125 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
13126 List<UUID> uuids = new List<UUID>();
13127 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
13128 {
13129 uuids.Add(datablock.FolderID);
13130 }
13131 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
13132 if (handlerRemoveInventoryFolder != null)
13133 {
13134 handlerRemoveInventoryFolder(this, uuids);
13135 }
13136 }
13137 break;
13138
13139 case PacketType.RemoveInventoryObjects:
13140 RemoveInventoryObjectsPacket removeObject = (RemoveInventoryObjectsPacket)Pack;
13141 #region Packet Session and User Check
13142 if (m_checkPackets)
13143 {
13144 if (removeObject.AgentData.SessionID != SessionId ||
13145 removeObject.AgentData.AgentID != AgentId)
13146 break;
13147 }
13148 #endregion
13149 if (OnRemoveInventoryFolder != null)
13150 {
13151 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
13152 List<UUID> uuids = new List<UUID>();
13153 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
13154 {
13155 uuids.Add(datablock.FolderID);
13156 }
13157 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
13158 if (handlerRemoveInventoryFolder != null)
13159 {
13160 handlerRemoveInventoryFolder(this, uuids);
13161 }
13162 }
13163
13164 if (OnRemoveInventoryItem != null)
13165 {
13166 RemoveInventoryItem handlerRemoveInventoryItem = null;
13167 List<UUID> uuids = new List<UUID>();
13168 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
13169 {
13170 uuids.Add(datablock.ItemID);
13171 }
13172 handlerRemoveInventoryItem = OnRemoveInventoryItem;
13173 if (handlerRemoveInventoryItem != null)
13174 {
13175 handlerRemoveInventoryItem(this, uuids);
13176 }
13177 }
13178 break;
13179
13180 case PacketType.RequestTaskInventory:
13181 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
13182
13183 #region Packet Session and User Check
13184 if (m_checkPackets)
13185 {
13186 if (requesttask.AgentData.SessionID != SessionId ||
13187 requesttask.AgentData.AgentID != AgentId)
13188 break;
13189 }
13190 #endregion
13191
13192 RequestTaskInventory handlerRequestTaskInventory = OnRequestTaskInventory;
13193 if (handlerRequestTaskInventory != null)
13194 {
13195 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID);
13196 }
13197 break;
13198
13199 case PacketType.UpdateTaskInventory:
13200 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
13201
13202 #region Packet Session and User Check
13203 if (m_checkPackets)
13204 {
13205 if (updatetask.AgentData.SessionID != SessionId ||
13206 updatetask.AgentData.AgentID != AgentId)
13207 break;
13208 }
13209 #endregion
13210
13211 if (OnUpdateTaskInventory != null)
13212 {
13213 if (updatetask.UpdateData.Key == 0)
13214 {
13215 UpdateTaskInventory handlerUpdateTaskInventory = OnUpdateTaskInventory;
13216 if (handlerUpdateTaskInventory != null)
13217 {
13218 TaskInventoryItem newTaskItem = new TaskInventoryItem();
13219 newTaskItem.ItemID = updatetask.InventoryData.ItemID;
13220 newTaskItem.ParentID = updatetask.InventoryData.FolderID;
13221 newTaskItem.CreatorID = updatetask.InventoryData.CreatorID;
13222 newTaskItem.OwnerID = updatetask.InventoryData.OwnerID;
13223 newTaskItem.GroupID = updatetask.InventoryData.GroupID;
13224 newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask;
13225 newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask;
13226 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
13227 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
13228 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
13229 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
13230 newTaskItem.Type = updatetask.InventoryData.Type;
13231 newTaskItem.InvType = updatetask.InventoryData.InvType;
13232 newTaskItem.Flags = updatetask.InventoryData.Flags;
13233 //newTaskItem.SaleType=updatetask.InventoryData.SaleType;
13234 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;;
13235 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
13236 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
13237 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
13238 handlerUpdateTaskInventory(this, updatetask.InventoryData.TransactionID,
13239 newTaskItem, updatetask.UpdateData.LocalID);
13240 }
13241 }
13242 }
13243
13244 break;
13245
13246 case PacketType.RemoveTaskInventory:
13247
13248 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
13249
13250 #region Packet Session and User Check
13251 if (m_checkPackets)
13252 {
13253 if (removeTask.AgentData.SessionID != SessionId ||
13254 removeTask.AgentData.AgentID != AgentId)
13255 break;
13256 }
13257 #endregion
13258
13259 RemoveTaskInventory handlerRemoveTaskItem = OnRemoveTaskItem;
13260
13261 if (handlerRemoveTaskItem != null)
13262 {
13263 handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
13264 }
13265
13266 break;
13267
13268 case PacketType.MoveTaskInventory:
13269
13270 MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack;
13271
13272 #region Packet Session and User Check
13273 if (m_checkPackets)
13274 {
13275 if (moveTaskInventoryPacket.AgentData.SessionID != SessionId ||
13276 moveTaskInventoryPacket.AgentData.AgentID != AgentId)
13277 break;
13278 }
13279 #endregion
13280
13281 MoveTaskInventory handlerMoveTaskItem = OnMoveTaskItem;
13282
13283 if (handlerMoveTaskItem != null)
13284 {
13285 handlerMoveTaskItem(
13286 this, moveTaskInventoryPacket.AgentData.FolderID,
13287 moveTaskInventoryPacket.InventoryData.LocalID,
13288 moveTaskInventoryPacket.InventoryData.ItemID);
13289 }
13290
13291 break;
13292
13293 case PacketType.RezScript:
13294 //m_log.Debug(Pack.ToString());
13295 RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
13296
13297 #region Packet Session and User Check
13298 if (m_checkPackets)
13299 {
13300 if (rezScriptx.AgentData.SessionID != SessionId ||
13301 rezScriptx.AgentData.AgentID != AgentId)
13302 break;
13303 }
13304 #endregion
13305
13306 RezScript handlerRezScript = OnRezScript;
13307 InventoryItemBase item = new InventoryItemBase();
13308 item.ID = rezScriptx.InventoryBlock.ItemID;
13309 item.Folder = rezScriptx.InventoryBlock.FolderID;
13310 item.CreatorId = rezScriptx.InventoryBlock.CreatorID.ToString();
13311 item.Owner = rezScriptx.InventoryBlock.OwnerID;
13312 item.BasePermissions = rezScriptx.InventoryBlock.BaseMask;
13313 item.CurrentPermissions = rezScriptx.InventoryBlock.OwnerMask;
13314 item.EveryOnePermissions = rezScriptx.InventoryBlock.EveryoneMask;
13315 item.NextPermissions = rezScriptx.InventoryBlock.NextOwnerMask;
13316 item.GroupPermissions = rezScriptx.InventoryBlock.GroupMask;
13317 item.GroupOwned = rezScriptx.InventoryBlock.GroupOwned;
13318 item.GroupID = rezScriptx.InventoryBlock.GroupID;
13319 item.AssetType = rezScriptx.InventoryBlock.Type;
13320 item.InvType = rezScriptx.InventoryBlock.InvType;
13321 item.Flags = rezScriptx.InventoryBlock.Flags;
13322 item.SaleType = rezScriptx.InventoryBlock.SaleType;
13323 item.SalePrice = rezScriptx.InventoryBlock.SalePrice;
13324 item.Name = Util.FieldToString(rezScriptx.InventoryBlock.Name);
13325 item.Description = Util.FieldToString(rezScriptx.InventoryBlock.Description);
13326 item.CreationDate = rezScriptx.InventoryBlock.CreationDate;
13327
13328 if (handlerRezScript != null)
13329 {
13330 handlerRezScript(this, item, rezScriptx.InventoryBlock.TransactionID, rezScriptx.UpdateBlock.ObjectLocalID);
13331 }
13332 break;
13333
13334 case PacketType.MapLayerRequest:
13335 RequestMapLayer();
13336 break;
13337 case PacketType.MapBlockRequest:
13338 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
13339
13340 #region Packet Session and User Check
13341 if (m_checkPackets)
13342 {
13343 if (MapRequest.AgentData.SessionID != SessionId ||
13344 MapRequest.AgentData.AgentID != AgentId)
13345 break;
13346 }
13347 #endregion
13348
13349 RequestMapBlocks handlerRequestMapBlocks = OnRequestMapBlocks;
13350 if (handlerRequestMapBlocks != null)
13351 {
13352 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
13353 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY, MapRequest.AgentData.Flags);
13354 }
13355 break;
13356 case PacketType.MapNameRequest:
13357 MapNameRequestPacket map = (MapNameRequestPacket)Pack;
13358
13359 #region Packet Session and User Check
13360 if (m_checkPackets)
13361 {
13362 if (map.AgentData.SessionID != SessionId ||
13363 map.AgentData.AgentID != AgentId)
13364 break;
13365 }
13366 #endregion
13367
13368 string mapName = Util.UTF8.GetString(map.NameData.Name, 0,
13369 map.NameData.Name.Length - 1);
13370 RequestMapName handlerMapNameRequest = OnMapNameRequest;
13371 if (handlerMapNameRequest != null)
13372 {
13373 handlerMapNameRequest(this, mapName);
13374 }
13375 break;
13376
13377 case PacketType.TeleportLandmarkRequest:
13378 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
13379
13380 #region Packet Session and User Check
13381 if (m_checkPackets)
13382 {
13383 if (tpReq.Info.SessionID != SessionId ||
13384 tpReq.Info.AgentID != AgentId)
13385 break;
13386 }
13387 #endregion
13388
13389 UUID lmid = tpReq.Info.LandmarkID;
13390 AssetLandmark lm;
13391 if (lmid != UUID.Zero)
13392 {
13393 //AssetBase lma = m_assetCache.GetAsset(lmid, false);
13394 AssetBase lma = m_assetService.Get(lmid.ToString());
13395
13396 if (lma == null)
13397 {
13398 // Failed to find landmark
13399 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
13400 tpCancel.Info.SessionID = tpReq.Info.SessionID;
13401 tpCancel.Info.AgentID = tpReq.Info.AgentID;
13402 OutPacket(tpCancel, ThrottleOutPacketType.Task);
13403 }
13404
13405 try
13406 {
13407 lm = new AssetLandmark(lma);
13408 }
13409 catch (NullReferenceException)
13410 {
13411 // asset not found generates null ref inside the assetlandmark constructor.
13412 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
13413 tpCancel.Info.SessionID = tpReq.Info.SessionID;
13414 tpCancel.Info.AgentID = tpReq.Info.AgentID;
13415 OutPacket(tpCancel, ThrottleOutPacketType.Task);
13416 break;
13417 }
13418 }
13419 else
13420 {
13421 // Teleport home request
13422 UUIDNameRequest handlerTeleportHomeRequest = OnTeleportHomeRequest;
13423 if (handlerTeleportHomeRequest != null)
13424 {
13425 handlerTeleportHomeRequest(AgentId, this);
13426 }
13427 break;
13428 }
13429
13430 TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
13431 if (handlerTeleportLandmarkRequest != null)
13432 {
13433 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
13434 }
13435 else
13436 {
13437 //no event handler so cancel request
13438
13439
13440 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
13441 tpCancel.Info.AgentID = tpReq.Info.AgentID;
13442 tpCancel.Info.SessionID = tpReq.Info.SessionID;
13443 OutPacket(tpCancel, ThrottleOutPacketType.Task);
13444
13445 }
13446 break;
13447
13448 case PacketType.TeleportLocationRequest:
13449 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
13450 // m_log.Debug(tpLocReq.ToString());
13451
13452 #region Packet Session and User Check
13453 if (m_checkPackets)
13454 {
13455 if (tpLocReq.AgentData.SessionID != SessionId ||
13456 tpLocReq.AgentData.AgentID != AgentId)
13457 break;
13458 }
13459 #endregion
13460
13461 TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest;
13462 if (handlerTeleportLocationRequest != null)
13463 {
13464 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
13465 tpLocReq.Info.LookAt, 16);
13466 }
13467 else
13468 {
13469 //no event handler so cancel request
13470 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
13471 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
13472 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
13473 OutPacket(tpCancel, ThrottleOutPacketType.Task);
13474 }
13475 break;
13476
13477 //#endregion
13478
13479 case PacketType.UUIDNameRequest:
13480 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
13481
13482 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
13483 {
13484 UUIDNameRequest handlerNameRequest = OnNameFromUUIDRequest;
13485 if (handlerNameRequest != null)
13486 {
13487 handlerNameRequest(UUIDBlock.ID, this);
13488 }
13489 }
13490 break;
13491
13492 //#region Parcel related packets
13493
13494
13495 case PacketType.RegionHandleRequest:
13496 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
13497
13498 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
13499 if (handlerRegionHandleRequest != null)
13500 {
13501 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
13502 }
13503 break;
13504
13505 case PacketType.ParcelInfoRequest:
13506 ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack;
13507
13508 #region Packet Session and User Check
13509 if (m_checkPackets)
13510 {
13511 if (pirPack.AgentData.SessionID != SessionId ||
13512 pirPack.AgentData.AgentID != AgentId)
13513 break;
13514 }
13515 #endregion
13516
13517 ParcelInfoRequest handlerParcelInfoRequest = OnParcelInfoRequest;
13518 if (handlerParcelInfoRequest != null)
13519 {
13520 handlerParcelInfoRequest(this, pirPack.Data.ParcelID);
13521 }
13522 break;
13523
13524 case PacketType.ParcelAccessListRequest:
13525 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
13526
13527 #region Packet Session and User Check
13528 if (m_checkPackets)
13529 {
13530 if (requestPacket.AgentData.SessionID != SessionId ||
13531 requestPacket.AgentData.AgentID != AgentId)
13532 break;
13533 }
13534 #endregion
13535
13536 ParcelAccessListRequest handlerParcelAccessListRequest = OnParcelAccessListRequest;
13537
13538 if (handlerParcelAccessListRequest != null)
13539 {
13540 handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
13541 requestPacket.Data.Flags, requestPacket.Data.SequenceID,
13542 requestPacket.Data.LocalID, this);
13543 }
13544 break;
13545
13546 case PacketType.ParcelAccessListUpdate:
13547 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack;
13548
13549 #region Packet Session and User Check
13550 if (m_checkPackets)
13551 {
13552 if (updatePacket.AgentData.SessionID != SessionId ||
13553 updatePacket.AgentData.AgentID != AgentId)
13554 break;
13555 }
13556 #endregion
13557
13558 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
13559 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
13560 {
13561 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
13562 entry.AgentID = block.ID;
13563 entry.Flags = (AccessList)block.Flags;
13564 entry.Time = new DateTime();
13565 entries.Add(entry);
13566 }
13567
13568 ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest;
13569 if (handlerParcelAccessListUpdateRequest != null)
13570 {
13571 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
13572 updatePacket.AgentData.SessionID, updatePacket.Data.Flags,
13573 updatePacket.Data.LocalID, entries, this);
13574 }
13575 break;
13576
13577 case PacketType.ParcelPropertiesRequest:
13578
13579 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
13580
13581 #region Packet Session and User Check
13582 if (m_checkPackets)
13583 {
13584 if (propertiesRequest.AgentData.SessionID != SessionId ||
13585 propertiesRequest.AgentData.AgentID != AgentId)
13586 break;
13587 }
13588 #endregion
13589
13590 ParcelPropertiesRequest handlerParcelPropertiesRequest = OnParcelPropertiesRequest;
13591 if (handlerParcelPropertiesRequest != null)
13592 {
13593 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
13594 (int)Math.Round(propertiesRequest.ParcelData.South),
13595 (int)Math.Round(propertiesRequest.ParcelData.East),
13596 (int)Math.Round(propertiesRequest.ParcelData.North),
13597 propertiesRequest.ParcelData.SequenceID,
13598 propertiesRequest.ParcelData.SnapSelection, this);
13599 }
13600 break;
13601
13602 case PacketType.ParcelDivide:
13603 ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
13604
13605 #region Packet Session and User Check
13606 if (m_checkPackets)
13607 {
13608 if (landDivide.AgentData.SessionID != SessionId ||
13609 landDivide.AgentData.AgentID != AgentId)
13610 break;
13611 }
13612 #endregion
13613
13614 ParcelDivideRequest handlerParcelDivideRequest = OnParcelDivideRequest;
13615 if (handlerParcelDivideRequest != null)
13616 {
13617 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
13618 (int)Math.Round(landDivide.ParcelData.South),
13619 (int)Math.Round(landDivide.ParcelData.East),
13620 (int)Math.Round(landDivide.ParcelData.North), this);
13621 }
13622 break;
13623
13624 case PacketType.ParcelJoin:
13625 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
13626
13627 #region Packet Session and User Check
13628 if (m_checkPackets)
13629 {
13630 if (landJoin.AgentData.SessionID != SessionId ||
13631 landJoin.AgentData.AgentID != AgentId)
13632 break;
13633 }
13634 #endregion
13635
13636 ParcelJoinRequest handlerParcelJoinRequest = OnParcelJoinRequest;
13637
13638 if (handlerParcelJoinRequest != null)
13639 {
13640 handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West),
13641 (int)Math.Round(landJoin.ParcelData.South),
13642 (int)Math.Round(landJoin.ParcelData.East),
13643 (int)Math.Round(landJoin.ParcelData.North), this);
13644 }
13645 break;
13646
13647 case PacketType.ParcelPropertiesUpdate:
13648 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack;
13649
13650 #region Packet Session and User Check
13651 if (m_checkPackets)
13652 {
13653 if (parcelPropertiesPacket.AgentData.SessionID != SessionId ||
13654 parcelPropertiesPacket.AgentData.AgentID != AgentId)
13655 break;
13656 }
13657 #endregion
13658
13659 ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest;
13660
13661 if (handlerParcelPropertiesUpdateRequest != null)
13662 {
13663 LandUpdateArgs args = new LandUpdateArgs();
13664
13665 args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID;
13666 args.Category = (ParcelCategory)parcelPropertiesPacket.ParcelData.Category;
13667 args.Desc = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc);
13668 args.GroupID = parcelPropertiesPacket.ParcelData.GroupID;
13669 args.LandingType = parcelPropertiesPacket.ParcelData.LandingType;
13670 args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale;
13671 args.MediaID = parcelPropertiesPacket.ParcelData.MediaID;
13672 args.MediaURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL);
13673 args.MusicURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL);
13674 args.Name = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name);
13675 args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags;
13676 args.PassHours = parcelPropertiesPacket.ParcelData.PassHours;
13677 args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice;
13678 args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice;
13679 args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID;
13680 args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation;
13681 args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt;
13682 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
13683 }
13684 break;
13685
13686 case PacketType.ParcelSelectObjects:
13687 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
13688
13689 #region Packet Session and User Check
13690 if (m_checkPackets)
13691 {
13692 if (selectPacket.AgentData.SessionID != SessionId ||
13693 selectPacket.AgentData.AgentID != AgentId)
13694 break;
13695 }
13696 #endregion
13697
13698 List<UUID> returnIDs = new List<UUID>();
13699
13700 foreach (ParcelSelectObjectsPacket.ReturnIDsBlock rb in
13701 selectPacket.ReturnIDs)
13702 {
13703 returnIDs.Add(rb.ReturnID);
13704 }
13705
13706 ParcelSelectObjects handlerParcelSelectObjects = OnParcelSelectObjects;
13707
13708 if (handlerParcelSelectObjects != null)
13709 {
13710 handlerParcelSelectObjects(selectPacket.ParcelData.LocalID,
13711 Convert.ToInt32(selectPacket.ParcelData.ReturnType), returnIDs, this);
13712 }
13713 break;
13714
13715 case PacketType.ParcelObjectOwnersRequest:
13716 //m_log.Debug(Pack.ToString());
13717 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
13718
13719 #region Packet Session and User Check
13720 if (m_checkPackets)
13721 {
13722 if (reqPacket.AgentData.SessionID != SessionId ||
13723 reqPacket.AgentData.AgentID != AgentId)
13724 break;
13725 }
13726 #endregion
13727
13728 ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest;
13729
13730 if (handlerParcelObjectOwnerRequest != null)
13731 {
13732 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
13733 }
13734 break;
13735
13736 case PacketType.ParcelGodForceOwner:
13737 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack;
13738
13739 #region Packet Session and User Check
13740 if (m_checkPackets)
13741 {
13742 if (godForceOwnerPacket.AgentData.SessionID != SessionId ||
13743 godForceOwnerPacket.AgentData.AgentID != AgentId)
13744 break;
13745 }
13746 #endregion
13747
13748 ParcelGodForceOwner handlerParcelGodForceOwner = OnParcelGodForceOwner;
13749 if (handlerParcelGodForceOwner != null)
13750 {
13751 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this);
13752 }
13753 break;
13754
13755 case PacketType.ParcelRelease:
13756 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
13757
13758 #region Packet Session and User Check
13759 if (m_checkPackets)
13760 {
13761 if (releasePacket.AgentData.SessionID != SessionId ||
13762 releasePacket.AgentData.AgentID != AgentId)
13763 break;
13764 }
13765 #endregion
13766
13767 ParcelAbandonRequest handlerParcelAbandonRequest = OnParcelAbandonRequest;
13768 if (handlerParcelAbandonRequest != null)
13769 {
13770 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
13771 }
13772 break;
13773
13774 case PacketType.ParcelReclaim:
13775 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack;
13776
13777 #region Packet Session and User Check
13778 if (m_checkPackets)
13779 {
13780 if (reclaimPacket.AgentData.SessionID != SessionId ||
13781 reclaimPacket.AgentData.AgentID != AgentId)
13782 break;
13783 }
13784 #endregion
13785
13786 ParcelReclaim handlerParcelReclaim = OnParcelReclaim;
13787 if (handlerParcelReclaim != null)
13788 {
13789 handlerParcelReclaim(reclaimPacket.Data.LocalID, this);
13790 }
13791 break;
13792
13793 case PacketType.ParcelReturnObjects:
13794
13795
13796 ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack;
13797
13798 #region Packet Session and User Check
13799 if (m_checkPackets)
13800 {
13801 if (parcelReturnObjects.AgentData.SessionID != SessionId ||
13802 parcelReturnObjects.AgentData.AgentID != AgentId)
13803 break;
13804 }
13805 #endregion
13806
13807 UUID[] puserselectedOwnerIDs = new UUID[parcelReturnObjects.OwnerIDs.Length];
13808 for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++)
13809 puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID;
13810
13811 UUID[] puserselectedTaskIDs = new UUID[parcelReturnObjects.TaskIDs.Length];
13812
13813 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++)
13814 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID;
13815
13816 ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest;
13817 if (handlerParcelReturnObjectsRequest != null)
13818 {
13819 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this);
13820
13821 }
13822 break;
13823
13824 case PacketType.ParcelSetOtherCleanTime:
13825 ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack;
13826
13827 #region Packet Session and User Check
13828 if (m_checkPackets)
13829 {
13830 if (parcelSetOtherCleanTimePacket.AgentData.SessionID != SessionId ||
13831 parcelSetOtherCleanTimePacket.AgentData.AgentID != AgentId)
13832 break;
13833 }
13834 #endregion
13835
13836 ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
13837 if (handlerParcelSetOtherCleanTime != null)
13838 {
13839 handlerParcelSetOtherCleanTime(this,
13840 parcelSetOtherCleanTimePacket.ParcelData.LocalID,
13841 parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime);
13842 }
13843 break;
13844
13845 case PacketType.LandStatRequest:
13846 LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack;
13847
13848 #region Packet Session and User Check
13849 if (m_checkPackets)
13850 {
13851 if (lsrp.AgentData.SessionID != SessionId ||
13852 lsrp.AgentData.AgentID != AgentId)
13853 break;
13854 }
13855 #endregion
13856
13857 GodLandStatRequest handlerLandStatRequest = OnLandStatRequest;
13858 if (handlerLandStatRequest != null)
13859 {
13860 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this);
13861 }
13862 break;
13863
13864 case PacketType.ParcelDwellRequest:
13865 ParcelDwellRequestPacket dwellrq =
13866 (ParcelDwellRequestPacket)Pack;
13867
13868 #region Packet Session and User Check
13869 if (m_checkPackets)
13870 {
13871 if (dwellrq.AgentData.SessionID != SessionId ||
13872 dwellrq.AgentData.AgentID != AgentId)
13873 break;
13874 }
13875 #endregion
13876
13877 ParcelDwellRequest handlerParcelDwellRequest = OnParcelDwellRequest;
13878 if (handlerParcelDwellRequest != null)
13879 {
13880 handlerParcelDwellRequest(dwellrq.Data.LocalID, this);
13881 }
13882 break;
13883
13884 //#endregion
13885
13886 //#region Estate Packets
13887
13888 case PacketType.EstateOwnerMessage:
13889 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
13890 //m_log.Debug(messagePacket.ToString());
13891
13892 #region Packet Session and User Check
13893 if (m_checkPackets)
13894 {
13895 if (messagePacket.AgentData.SessionID != SessionId ||
13896 messagePacket.AgentData.AgentID != AgentId)
13897 break;
13898 }
13899 #endregion
13900
13901 switch (Utils.BytesToString(messagePacket.MethodData.Method))
13902 {
13903 case "getinfo":
13904 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13905 {
13906 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
13907 }
13908 break;
13909 case "setregioninfo":
13910 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13911 {
13912 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
13913 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
13914 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)),
13915 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo),
13916 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
13917 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
13918 }
13919 break;
13920 // case "texturebase":
13921 // if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13922 // {
13923 // foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
13924 // {
13925 // string s = Utils.BytesToString(block.Parameter);
13926 // string[] splitField = s.Split(' ');
13927 // if (splitField.Length == 2)
13928 // {
13929 // UUID tempUUID = new UUID(splitField[1]);
13930 // OnSetEstateTerrainBaseTexture(this, Convert.ToInt16(splitField[0]), tempUUID);
13931 // }
13932 // }
13933 // }
13934 // break;
13935 case "texturedetail":
13936 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13937 {
13938 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
13939 {
13940 string s = Utils.BytesToString(block.Parameter);
13941 string[] splitField = s.Split(' ');
13942 if (splitField.Length == 2)
13943 {
13944 Int16 corner = Convert.ToInt16(splitField[0]);
13945 UUID textureUUID = new UUID(splitField[1]);
13946
13947 OnSetEstateTerrainDetailTexture(this, corner, textureUUID);
13948 }
13949 }
13950 }
13951
13952 break;
13953 case "textureheights":
13954 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13955 {
13956 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
13957 {
13958 string s = Utils.BytesToString(block.Parameter);
13959 string[] splitField = s.Split(' ');
13960 if (splitField.Length == 3)
13961 {
13962 Int16 corner = Convert.ToInt16(splitField[0]);
13963 float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo);
13964 float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo);
13965
13966 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
13967 }
13968 }
13969 }
13970 break;
13971 case "texturecommit":
13972 OnCommitEstateTerrainTextureRequest(this);
13973 break;
13974 case "setregionterrain":
13975 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
13976 {
13977 if (messagePacket.ParamList.Length != 9)
13978 {
13979 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
13980 }
13981 else
13982 {
13983 try
13984 {
13985 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
13986 if (!tmp.Contains(".")) tmp += ".00";
13987 float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
13988 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
13989 if (!tmp.Contains(".")) tmp += ".00";
13990 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
13991 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
13992 if (!tmp.Contains(".")) tmp += ".00";
13993 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo);
13994 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
13995 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
13996 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo);
13997 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
13998 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
13999 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo);
14000
14001 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
14002
14003 }
14004 catch (Exception ex)
14005 {
14006 m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket + "\n" + ex);
14007 }
14008 }
14009 }
14010
14011 break;
14012 case "restart":
14013 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14014 {
14015 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
14016 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
14017 {
14018 float timeSeconds;
14019 Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out timeSeconds);
14020 timeSeconds = (int)timeSeconds;
14021 OnEstateRestartSimRequest(this, (int)timeSeconds);
14022
14023 }
14024 }
14025 break;
14026 case "estatechangecovenantid":
14027 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14028 {
14029 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
14030 {
14031 UUID newCovenantID = new UUID(Utils.BytesToString(block.Parameter));
14032 OnEstateChangeCovenantRequest(this, newCovenantID);
14033 }
14034 }
14035 break;
14036 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
14037 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14038 {
14039 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
14040 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
14041
14042 }
14043 break;
14044 case "simulatormessage":
14045 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14046 {
14047 UUID invoice = messagePacket.MethodData.Invoice;
14048 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
14049 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
14050 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
14051 UUID sessionID = messagePacket.AgentData.SessionID;
14052 OnSimulatorBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
14053 }
14054 break;
14055 case "instantmessage":
14056 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14057 {
14058 if (messagePacket.ParamList.Length < 5)
14059 break;
14060 UUID invoice = messagePacket.MethodData.Invoice;
14061 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
14062 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
14063 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
14064 UUID sessionID = messagePacket.AgentData.SessionID;
14065 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
14066 }
14067 break;
14068 case "setregiondebug":
14069 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14070 {
14071 UUID invoice = messagePacket.MethodData.Invoice;
14072 UUID SenderID = messagePacket.AgentData.AgentID;
14073 bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
14074 bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
14075 bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
14076
14077 OnEstateDebugRegionRequest(this, invoice, SenderID, scripted, collisionEvents, physics);
14078 }
14079 break;
14080 case "teleporthomeuser":
14081 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14082 {
14083 UUID invoice = messagePacket.MethodData.Invoice;
14084 UUID SenderID = messagePacket.AgentData.AgentID;
14085 UUID Prey;
14086
14087 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[1].Parameter), out Prey);
14088
14089 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
14090 }
14091 break;
14092 case "teleporthomeallusers":
14093 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14094 {
14095 UUID invoice = messagePacket.MethodData.Invoice;
14096 UUID SenderID = messagePacket.AgentData.AgentID;
14097 OnEstateTeleportAllUsersHomeRequest(this, invoice, SenderID);
14098 }
14099 break;
14100 case "colliders":
14101 handlerLandStatRequest = OnLandStatRequest;
14102 if (handlerLandStatRequest != null)
14103 {
14104 handlerLandStatRequest(0, 1, 0, "", this);
14105 }
14106 break;
14107 case "scripts":
14108 handlerLandStatRequest = OnLandStatRequest;
14109 if (handlerLandStatRequest != null)
14110 {
14111 handlerLandStatRequest(0, 0, 0, "", this);
14112 }
14113 break;
14114 case "terrain":
14115 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14116 {
14117 if (messagePacket.ParamList.Length > 0)
14118 {
14119 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake")
14120 {
14121 BakeTerrain handlerBakeTerrain = OnBakeTerrain;
14122 if (handlerBakeTerrain != null)
14123 {
14124 handlerBakeTerrain(this);
14125 }
14126 }
14127 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "download filename")
14128 {
14129 if (messagePacket.ParamList.Length > 1)
14130 {
14131 RequestTerrain handlerRequestTerrain = OnRequestTerrain;
14132 if (handlerRequestTerrain != null)
14133 {
14134 handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
14135 }
14136 }
14137 }
14138 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "upload filename")
14139 {
14140 if (messagePacket.ParamList.Length > 1)
14141 {
14142 RequestTerrain handlerUploadTerrain = OnUploadTerrain;
14143 if (handlerUploadTerrain != null)
14144 {
14145 handlerUploadTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
14146 }
14147 }
14148 }
14149
14150 }
14151
14152
14153 }
14154 break;
14155
14156 case "estatechangeinfo":
14157 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
14158 {
14159 UUID invoice = messagePacket.MethodData.Invoice;
14160 UUID SenderID = messagePacket.AgentData.AgentID;
14161 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
14162 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
14163
14164 EstateChangeInfo handlerEstateChangeInfo = OnEstateChangeInfo;
14165 if (handlerEstateChangeInfo != null)
14166 {
14167 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2);
14168 }
14169 }
14170 break;
14171
14172 default:
14173 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
14174 break;
14175 }
14176
14177 //int parcelID, uint reportType, uint requestflags, string filter
14178
14179 //lsrp.RequestData.ParcelLocalID;
14180 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
14181 //lsrp.RequestData.RequestFlags;
14182 //lsrp.RequestData.Filter;
14183
14184 break;
14185
14186 case PacketType.RequestRegionInfo:
14187 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
14188
14189 #region Packet Session and User Check
14190 if (m_checkPackets)
14191 {
14192 if (mPacket.SessionID != SessionId ||
14193 mPacket.AgentID != AgentId)
14194 break;
14195 }
14196 #endregion
14197
14198 RegionInfoRequest handlerRegionInfoRequest = OnRegionInfoRequest;
14199 if (handlerRegionInfoRequest != null)
14200 {
14201 handlerRegionInfoRequest(this);
14202 }
14203 break;
14204
14205 case PacketType.EstateCovenantRequest:
14206
14207 //EstateCovenantRequestPacket.AgentDataBlock epack =
14208 // ((EstateCovenantRequestPacket)Pack).AgentData;
14209
14210 EstateCovenantRequest handlerEstateCovenantRequest = OnEstateCovenantRequest;
14211 if (handlerEstateCovenantRequest != null)
14212 {
14213 handlerEstateCovenantRequest(this);
14214 }
14215 break;
14216
14217 //#endregion
14218
14219 //#region GodPackets
14220
14221 case PacketType.RequestGodlikePowers:
14222 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
14223 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
14224 UUID token = rblock.Token;
14225
14226 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
14227
14228 RequestGodlikePowers handlerReqGodlikePowers = OnRequestGodlikePowers;
14229
14230 if (handlerReqGodlikePowers != null)
14231 {
14232 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this);
14233 }
14234
14235 break;
14236
14237 case PacketType.GodKickUser:
14238 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
14239
14240 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
14241 {
14242 GodKickUser handlerGodKickUser = OnGodKickUser;
14243 if (handlerGodKickUser != null)
14244 {
14245 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
14246 gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo);
14247 }
14248 }
14249 else
14250 {
14251 SendAgentAlertMessage("Kick request denied", false);
14252 }
14253 //KickUserPacket kupack = new KickUserPacket();
14254 //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
14255
14256 //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID;
14257 //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID;
14258
14259 //kupack.TargetBlock.TargetIP = (uint)0;
14260 //kupack.TargetBlock.TargetPort = (ushort)0;
14261 //kupack.UserInfo.Reason = gkupack.UserInfo.Reason;
14262
14263 //OutPacket(kupack, ThrottleOutPacketType.Task);
14264 break;
14265
14266 //#endregion
14267
14268 //#region Economy/Transaction Packets
14269
14270 case PacketType.MoneyBalanceRequest:
14271 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack;
14272
14273 #region Packet Session and User Check
14274 if (m_checkPackets)
14275 {
14276 if (moneybalancerequestpacket.AgentData.SessionID != SessionId ||
14277 moneybalancerequestpacket.AgentData.AgentID != AgentId)
14278 break;
14279 }
14280 #endregion
14281
14282 MoneyBalanceRequest handlerMoneyBalanceRequest = OnMoneyBalanceRequest;
14283
14284 if (handlerMoneyBalanceRequest != null)
14285 {
14286 handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID);
14287 }
14288
14289 break;
14290
14291 case PacketType.EconomyDataRequest:
14292
14293
14294 EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest;
14295 if (handlerEconomoyDataRequest != null)
14296 {
14297 handlerEconomoyDataRequest(AgentId);
14298 }
14299 break;
14300
14301 case PacketType.RequestPayPrice:
14302 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
14303
14304 RequestPayPrice handlerRequestPayPrice = OnRequestPayPrice;
14305 if (handlerRequestPayPrice != null)
14306 {
14307 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID);
14308 }
14309 break;
14310
14311 case PacketType.ObjectSaleInfo:
14312 ObjectSaleInfoPacket objectSaleInfoPacket = (ObjectSaleInfoPacket)Pack;
14313
14314 #region Packet Session and User Check
14315 if (m_checkPackets)
14316 {
14317 if (objectSaleInfoPacket.AgentData.SessionID != SessionId ||
14318 objectSaleInfoPacket.AgentData.AgentID != AgentId)
14319 break;
14320 }
14321 #endregion
14322
14323 ObjectSaleInfo handlerObjectSaleInfo = OnObjectSaleInfo;
14324 if (handlerObjectSaleInfo != null)
14325 {
14326 foreach (ObjectSaleInfoPacket.ObjectDataBlock d
14327 in objectSaleInfoPacket.ObjectData)
14328 {
14329 handlerObjectSaleInfo(this,
14330 objectSaleInfoPacket.AgentData.AgentID,
14331 objectSaleInfoPacket.AgentData.SessionID,
14332 d.LocalID,
14333 d.SaleType,
14334 d.SalePrice);
14335 }
14336 }
14337 break;
14338
14339 case PacketType.ObjectBuy:
14340 ObjectBuyPacket objectBuyPacket = (ObjectBuyPacket)Pack;
14341
14342 #region Packet Session and User Check
14343 if (m_checkPackets)
14344 {
14345 if (objectBuyPacket.AgentData.SessionID != SessionId ||
14346 objectBuyPacket.AgentData.AgentID != AgentId)
14347 break;
14348 }
14349 #endregion
14350
14351 ObjectBuy handlerObjectBuy = OnObjectBuy;
14352
14353 if (handlerObjectBuy != null)
14354 {
14355 foreach (ObjectBuyPacket.ObjectDataBlock d
14356 in objectBuyPacket.ObjectData)
14357 {
14358 handlerObjectBuy(this,
14359 objectBuyPacket.AgentData.AgentID,
14360 objectBuyPacket.AgentData.SessionID,
14361 objectBuyPacket.AgentData.GroupID,
14362 objectBuyPacket.AgentData.CategoryID,
14363 d.ObjectLocalID,
14364 d.SaleType,
14365 d.SalePrice);
14366 }
14367 }
14368 break;
14369
14370 //#endregion
14371
14372 //#region Script Packets
14373
14374 case PacketType.GetScriptRunning:
14375 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack;
14376
14377 GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
14378 if (handlerGetScriptRunning != null)
14379 {
14380 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID);
14381 }
14382 break;
14383
14384 case PacketType.SetScriptRunning:
14385 SetScriptRunningPacket setScriptRunning = (SetScriptRunningPacket)Pack;
14386
14387 #region Packet Session and User Check
14388 if (m_checkPackets)
14389 {
14390 if (setScriptRunning.AgentData.SessionID != SessionId ||
14391 setScriptRunning.AgentData.AgentID != AgentId)
14392 break;
14393 }
14394 #endregion
14395
14396 SetScriptRunning handlerSetScriptRunning = OnSetScriptRunning;
14397 if (handlerSetScriptRunning != null)
14398 {
14399 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running);
14400 }
14401 break;
14402
14403 case PacketType.ScriptReset:
14404 ScriptResetPacket scriptResetPacket = (ScriptResetPacket)Pack;
14405
14406 #region Packet Session and User Check
14407 if (m_checkPackets)
14408 {
14409 if (scriptResetPacket.AgentData.SessionID != SessionId ||
14410 scriptResetPacket.AgentData.AgentID != AgentId)
14411 break;
14412 }
14413 #endregion
14414
14415 ScriptReset handlerScriptReset = OnScriptReset;
14416 if (handlerScriptReset != null)
14417 {
14418 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID);
14419 }
14420 break;
14421
14422 //#endregion
14423
14424 //#region Gesture Managment
14425
14426 case PacketType.ActivateGestures:
14427 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack;
14428
14429 #region Packet Session and User Check
14430 if (m_checkPackets)
14431 {
14432 if (activateGesturePacket.AgentData.SessionID != SessionId ||
14433 activateGesturePacket.AgentData.AgentID != AgentId)
14434 break;
14435 }
14436 #endregion
14437
14438 ActivateGesture handlerActivateGesture = OnActivateGesture;
14439 if (handlerActivateGesture != null)
14440 {
14441 handlerActivateGesture(this,
14442 activateGesturePacket.Data[0].AssetID,
14443 activateGesturePacket.Data[0].ItemID);
14444 }
14445 else m_log.Error("Null pointer for activateGesture");
14446
14447 break;
14448
14449 case PacketType.DeactivateGestures:
14450 DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack;
14451
14452 #region Packet Session and User Check
14453 if (m_checkPackets)
14454 {
14455 if (deactivateGesturePacket.AgentData.SessionID != SessionId ||
14456 deactivateGesturePacket.AgentData.AgentID != AgentId)
14457 break;
14458 }
14459 #endregion
14460
14461 DeactivateGesture handlerDeactivateGesture = OnDeactivateGesture;
14462 if (handlerDeactivateGesture != null)
14463 {
14464 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID);
14465 }
14466 break;
14467 case PacketType.ObjectOwner:
14468 ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack;
14469
14470 #region Packet Session and User Check
14471 if (m_checkPackets)
14472 {
14473 if (objectOwnerPacket.AgentData.SessionID != SessionId ||
14474 objectOwnerPacket.AgentData.AgentID != AgentId)
14475 break;
14476 }
14477 #endregion
14478
14479 List<uint> localIDs = new List<uint>();
14480
14481 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData)
14482 localIDs.Add(d.ObjectLocalID);
14483
14484 ObjectOwner handlerObjectOwner = OnObjectOwner;
14485 if (handlerObjectOwner != null)
14486 {
14487 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs);
14488 }
14489 break;
14490
14491 //#endregion
14492
14493 case PacketType.AgentFOV:
14494 AgentFOVPacket fovPacket = (AgentFOVPacket)Pack;
14495
14496 if (fovPacket.FOVBlock.GenCounter > m_agentFOVCounter)
14497 {
14498 m_agentFOVCounter = fovPacket.FOVBlock.GenCounter;
14499 AgentFOV handlerAgentFOV = OnAgentFOV;
14500 if (handlerAgentFOV != null)
14501 {
14502 handlerAgentFOV(this, fovPacket.FOVBlock.VerticalAngle);
14503 }
14504 }
14505 break;
14506
14507 //#region unimplemented handlers
14508
14509 case PacketType.ViewerStats:
14510 // TODO: handle this packet
14511 //m_log.Warn("[CLIENT]: unhandled ViewerStats packet");
14512 break;
14513
14514 case PacketType.MapItemRequest:
14515 MapItemRequestPacket mirpk = (MapItemRequestPacket)Pack;
14516
14517 #region Packet Session and User Check
14518 if (m_checkPackets)
14519 {
14520 if (mirpk.AgentData.SessionID != SessionId ||
14521 mirpk.AgentData.AgentID != AgentId)
14522 break;
14523 }
14524 #endregion
14525
14526 //m_log.Debug(mirpk.ToString());
14527 MapItemRequest handlerMapItemRequest = OnMapItemRequest;
14528 if (handlerMapItemRequest != null)
14529 {
14530 handlerMapItemRequest(this, mirpk.AgentData.Flags, mirpk.AgentData.EstateID,
14531 mirpk.AgentData.Godlike, mirpk.RequestData.ItemType,
14532 mirpk.RequestData.RegionHandle);
14533
14534 }
14535 break;
14536
14537 case PacketType.TransferAbort:
14538 // TODO: handle this packet
14539 //m_log.Warn("[CLIENT]: unhandled TransferAbort packet");
14540 break;
14541
14542 case PacketType.MuteListRequest:
14543 MuteListRequestPacket muteListRequest =
14544 (MuteListRequestPacket)Pack;
14545
14546 #region Packet Session and User Check
14547 if (m_checkPackets)
14548 {
14549 if (muteListRequest.AgentData.SessionID != SessionId ||
14550 muteListRequest.AgentData.AgentID != AgentId)
14551 break;
14552 }
14553 #endregion
14554
14555 MuteListRequest handlerMuteListRequest = OnMuteListRequest;
14556 if (handlerMuteListRequest != null)
14557 {
14558 handlerMuteListRequest(this, muteListRequest.MuteData.MuteCRC);
14559 }
14560 else
14561 {
14562 SendUseCachedMuteList();
14563 }
14564 break;
14565
14566 case PacketType.UseCircuitCode:
14567 // Don't display this one, we handle it at a lower level
14568 break;
14569
14570 case PacketType.AgentHeightWidth:
14571 // TODO: handle this packet
14572 //m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet");
14573 break;
14574
14575 case PacketType.InventoryDescendents:
14576 // TODO: handle this packet
14577 //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
14578
14579 break;
14580
14581 case PacketType.DirPlacesQuery:
14582 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
14583 //m_log.Debug(dirPlacesQueryPacket.ToString());
14584
14585 #region Packet Session and User Check
14586 if (m_checkPackets)
14587 {
14588 if (dirPlacesQueryPacket.AgentData.SessionID != SessionId ||
14589 dirPlacesQueryPacket.AgentData.AgentID != AgentId)
14590 break;
14591 }
14592 #endregion
14593
14594 DirPlacesQuery handlerDirPlacesQuery = OnDirPlacesQuery;
14595 if (handlerDirPlacesQuery != null)
14596 {
14597 handlerDirPlacesQuery(this,
14598 dirPlacesQueryPacket.QueryData.QueryID,
14599 Utils.BytesToString(
14600 dirPlacesQueryPacket.QueryData.QueryText),
14601 (int)dirPlacesQueryPacket.QueryData.QueryFlags,
14602 (int)dirPlacesQueryPacket.QueryData.Category,
14603 Utils.BytesToString(
14604 dirPlacesQueryPacket.QueryData.SimName),
14605 dirPlacesQueryPacket.QueryData.QueryStart);
14606 }
14607 break;
14608
14609 case PacketType.DirFindQuery:
14610 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack;
14611
14612 #region Packet Session and User Check
14613 if (m_checkPackets)
14614 {
14615 if (dirFindQueryPacket.AgentData.SessionID != SessionId ||
14616 dirFindQueryPacket.AgentData.AgentID != AgentId)
14617 break;
14618 }
14619 #endregion
14620
14621 DirFindQuery handlerDirFindQuery = OnDirFindQuery;
14622 if (handlerDirFindQuery != null)
14623 {
14624 handlerDirFindQuery(this,
14625 dirFindQueryPacket.QueryData.QueryID,
14626 Utils.BytesToString(
14627 dirFindQueryPacket.QueryData.QueryText),
14628 dirFindQueryPacket.QueryData.QueryFlags,
14629 dirFindQueryPacket.QueryData.QueryStart);
14630 }
14631 break;
14632
14633 case PacketType.DirLandQuery:
14634 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack;
14635
14636 #region Packet Session and User Check
14637 if (m_checkPackets)
14638 {
14639 if (dirLandQueryPacket.AgentData.SessionID != SessionId ||
14640 dirLandQueryPacket.AgentData.AgentID != AgentId)
14641 break;
14642 }
14643 #endregion
14644
14645 DirLandQuery handlerDirLandQuery = OnDirLandQuery;
14646 if (handlerDirLandQuery != null)
14647 {
14648 handlerDirLandQuery(this,
14649 dirLandQueryPacket.QueryData.QueryID,
14650 dirLandQueryPacket.QueryData.QueryFlags,
14651 dirLandQueryPacket.QueryData.SearchType,
14652 dirLandQueryPacket.QueryData.Price,
14653 dirLandQueryPacket.QueryData.Area,
14654 dirLandQueryPacket.QueryData.QueryStart);
14655 }
14656 break;
14657
14658 case PacketType.DirPopularQuery:
14659 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack;
14660
14661 #region Packet Session and User Check
14662 if (m_checkPackets)
14663 {
14664 if (dirPopularQueryPacket.AgentData.SessionID != SessionId ||
14665 dirPopularQueryPacket.AgentData.AgentID != AgentId)
14666 break;
14667 }
14668 #endregion
14669
14670 DirPopularQuery handlerDirPopularQuery = OnDirPopularQuery;
14671 if (handlerDirPopularQuery != null)
14672 {
14673 handlerDirPopularQuery(this,
14674 dirPopularQueryPacket.QueryData.QueryID,
14675 dirPopularQueryPacket.QueryData.QueryFlags);
14676 }
14677 break;
14678
14679 case PacketType.DirClassifiedQuery:
14680 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack;
14681
14682 #region Packet Session and User Check
14683 if (m_checkPackets)
14684 {
14685 if (dirClassifiedQueryPacket.AgentData.SessionID != SessionId ||
14686 dirClassifiedQueryPacket.AgentData.AgentID != AgentId)
14687 break;
14688 }
14689 #endregion
14690
14691 DirClassifiedQuery handlerDirClassifiedQuery = OnDirClassifiedQuery;
14692 if (handlerDirClassifiedQuery != null)
14693 {
14694 handlerDirClassifiedQuery(this,
14695 dirClassifiedQueryPacket.QueryData.QueryID,
14696 Utils.BytesToString(
14697 dirClassifiedQueryPacket.QueryData.QueryText),
14698 dirClassifiedQueryPacket.QueryData.QueryFlags,
14699 dirClassifiedQueryPacket.QueryData.Category,
14700 dirClassifiedQueryPacket.QueryData.QueryStart);
14701 }
14702 break;
14703
14704 case PacketType.EventInfoRequest:
14705 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack;
14706
14707 #region Packet Session and User Check
14708 if (m_checkPackets)
14709 {
14710 if (eventInfoRequestPacket.AgentData.SessionID != SessionId ||
14711 eventInfoRequestPacket.AgentData.AgentID != AgentId)
14712 break;
14713 }
14714 #endregion
14715
14716 if (OnEventInfoRequest != null)
14717 {
14718 OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID);
14719 }
14720 break;
14721
14722 //#region Calling Card
14723
14724 case PacketType.OfferCallingCard:
14725 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack;
14726
14727 #region Packet Session and User Check
14728 if (m_checkPackets)
14729 {
14730 if (offerCallingCardPacket.AgentData.SessionID != SessionId ||
14731 offerCallingCardPacket.AgentData.AgentID != AgentId)
14732 break;
14733 }
14734 #endregion
14735
14736 if (OnOfferCallingCard != null)
14737 {
14738 OnOfferCallingCard(this,
14739 offerCallingCardPacket.AgentBlock.DestID,
14740 offerCallingCardPacket.AgentBlock.TransactionID);
14741 }
14742 break;
14743
14744 case PacketType.AcceptCallingCard:
14745 AcceptCallingCardPacket acceptCallingCardPacket = (AcceptCallingCardPacket)Pack;
14746
14747 #region Packet Session and User Check
14748 if (m_checkPackets)
14749 {
14750 if (acceptCallingCardPacket.AgentData.SessionID != SessionId ||
14751 acceptCallingCardPacket.AgentData.AgentID != AgentId)
14752 break;
14753 }
14754 #endregion
14755
14756 // according to http://wiki.secondlife.com/wiki/AcceptCallingCard FolderData should
14757 // contain exactly one entry
14758 if (OnAcceptCallingCard != null && acceptCallingCardPacket.FolderData.Length > 0)
14759 {
14760 OnAcceptCallingCard(this,
14761 acceptCallingCardPacket.TransactionBlock.TransactionID,
14762 acceptCallingCardPacket.FolderData[0].FolderID);
14763 }
14764 break;
14765
14766 case PacketType.DeclineCallingCard:
14767 DeclineCallingCardPacket declineCallingCardPacket = (DeclineCallingCardPacket)Pack;
14768
14769 #region Packet Session and User Check
14770 if (m_checkPackets)
14771 {
14772 if (declineCallingCardPacket.AgentData.SessionID != SessionId ||
14773 declineCallingCardPacket.AgentData.AgentID != AgentId)
14774 break;
14775 }
14776 #endregion
14777
14778 if (OnDeclineCallingCard != null)
14779 {
14780 OnDeclineCallingCard(this,
14781 declineCallingCardPacket.TransactionBlock.TransactionID);
14782 }
14783 break;
14784 //#endregion
14785
14786 //#region Groups
14787 case PacketType.ActivateGroup:
14788 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack;
14789
14790 #region Packet Session and User Check
14791 if (m_checkPackets)
14792 {
14793 if (activateGroupPacket.AgentData.SessionID != SessionId ||
14794 activateGroupPacket.AgentData.AgentID != AgentId)
14795 break;
14796 }
14797 #endregion
14798
14799 if (m_GroupsModule != null)
14800 {
14801 m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID);
14802 m_GroupsModule.SendAgentGroupDataUpdate(this);
14803 }
14804 break;
14805
14806
14807 case PacketType.GroupTitlesRequest:
14808 GroupTitlesRequestPacket groupTitlesRequest =
14809 (GroupTitlesRequestPacket)Pack;
14810
14811 #region Packet Session and User Check
14812 if (m_checkPackets)
14813 {
14814 if (groupTitlesRequest.AgentData.SessionID != SessionId ||
14815 groupTitlesRequest.AgentData.AgentID != AgentId)
14816 break;
14817 }
14818 #endregion
14819
14820 if (m_GroupsModule != null)
14821 {
14822 GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply);
14823
14824 groupTitlesReply.AgentData =
14825 new GroupTitlesReplyPacket.AgentDataBlock();
14826
14827 groupTitlesReply.AgentData.AgentID = AgentId;
14828 groupTitlesReply.AgentData.GroupID =
14829 groupTitlesRequest.AgentData.GroupID;
14830
14831 groupTitlesReply.AgentData.RequestID =
14832 groupTitlesRequest.AgentData.RequestID;
14833
14834 List<GroupTitlesData> titles =
14835 m_GroupsModule.GroupTitlesRequest(this,
14836 groupTitlesRequest.AgentData.GroupID);
14837
14838 groupTitlesReply.GroupData =
14839 new GroupTitlesReplyPacket.GroupDataBlock[titles.Count];
14840
14841 int i = 0;
14842 foreach (GroupTitlesData d in titles)
14843 {
14844 groupTitlesReply.GroupData[i] =
14845 new GroupTitlesReplyPacket.GroupDataBlock();
14846
14847 groupTitlesReply.GroupData[i].Title =
14848 Util.StringToBytes256(d.Name);
14849 groupTitlesReply.GroupData[i].RoleID =
14850 d.UUID;
14851 groupTitlesReply.GroupData[i].Selected =
14852 d.Selected;
14853 i++;
14854 }
14855
14856 OutPacket(groupTitlesReply, ThrottleOutPacketType.Task);
14857 }
14858 break;
14859
14860 case PacketType.GroupProfileRequest:
14861 GroupProfileRequestPacket groupProfileRequest =
14862 (GroupProfileRequestPacket)Pack;
14863
14864 #region Packet Session and User Check
14865 if (m_checkPackets)
14866 {
14867 if (groupProfileRequest.AgentData.SessionID != SessionId ||
14868 groupProfileRequest.AgentData.AgentID != AgentId)
14869 break;
14870 }
14871 #endregion
14872
14873 if (m_GroupsModule != null)
14874 {
14875 GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply);
14876
14877 groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock();
14878 groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock();
14879 groupProfileReply.AgentData.AgentID = AgentId;
14880
14881 GroupProfileData d = m_GroupsModule.GroupProfileRequest(this,
14882 groupProfileRequest.GroupData.GroupID);
14883
14884 groupProfileReply.GroupData.GroupID = d.GroupID;
14885 groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name);
14886 groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter);
14887 groupProfileReply.GroupData.ShowInList = d.ShowInList;
14888 groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle);
14889 groupProfileReply.GroupData.PowersMask = d.PowersMask;
14890 groupProfileReply.GroupData.InsigniaID = d.InsigniaID;
14891 groupProfileReply.GroupData.FounderID = d.FounderID;
14892 groupProfileReply.GroupData.MembershipFee = d.MembershipFee;
14893 groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment;
14894 groupProfileReply.GroupData.Money = d.Money;
14895 groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount;
14896 groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount;
14897 groupProfileReply.GroupData.AllowPublish = d.AllowPublish;
14898 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
14899 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
14900
14901 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
14902 }
14903 break;
14904
14905 case PacketType.GroupMembersRequest:
14906 GroupMembersRequestPacket groupMembersRequestPacket =
14907 (GroupMembersRequestPacket)Pack;
14908
14909 #region Packet Session and User Check
14910 if (m_checkPackets)
14911 {
14912 if (groupMembersRequestPacket.AgentData.SessionID != SessionId ||
14913 groupMembersRequestPacket.AgentData.AgentID != AgentId)
14914 break;
14915 }
14916 #endregion
14917
14918 if (m_GroupsModule != null)
14919 {
14920 List<GroupMembersData> members =
14921 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
14922
14923 int memberCount = members.Count;
14924
14925 while (true)
14926 {
14927 int blockCount = members.Count;
14928 if (blockCount > 40)
14929 blockCount = 40;
14930
14931 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply);
14932
14933 groupMembersReply.AgentData =
14934 new GroupMembersReplyPacket.AgentDataBlock();
14935 groupMembersReply.GroupData =
14936 new GroupMembersReplyPacket.GroupDataBlock();
14937 groupMembersReply.MemberData =
14938 new GroupMembersReplyPacket.MemberDataBlock[
14939 blockCount];
14940
14941 groupMembersReply.AgentData.AgentID = AgentId;
14942 groupMembersReply.GroupData.GroupID =
14943 groupMembersRequestPacket.GroupData.GroupID;
14944 groupMembersReply.GroupData.RequestID =
14945 groupMembersRequestPacket.GroupData.RequestID;
14946 groupMembersReply.GroupData.MemberCount = memberCount;
14947
14948 for (int i = 0; i < blockCount; i++)
14949 {
14950 GroupMembersData m = members[0];
14951 members.RemoveAt(0);
14952
14953 groupMembersReply.MemberData[i] =
14954 new GroupMembersReplyPacket.MemberDataBlock();
14955 groupMembersReply.MemberData[i].AgentID =
14956 m.AgentID;
14957 groupMembersReply.MemberData[i].Contribution =
14958 m.Contribution;
14959 groupMembersReply.MemberData[i].OnlineStatus =
14960 Util.StringToBytes256(m.OnlineStatus);
14961 groupMembersReply.MemberData[i].AgentPowers =
14962 m.AgentPowers;
14963 groupMembersReply.MemberData[i].Title =
14964 Util.StringToBytes256(m.Title);
14965 groupMembersReply.MemberData[i].IsOwner =
14966 m.IsOwner;
14967 }
14968 OutPacket(groupMembersReply, ThrottleOutPacketType.Task);
14969 if (members.Count == 0)
14970 break;
14971 }
14972 }
14973 break;
14974
14975 case PacketType.GroupRoleDataRequest:
14976 GroupRoleDataRequestPacket groupRolesRequest =
14977 (GroupRoleDataRequestPacket)Pack;
14978
14979 #region Packet Session and User Check
14980 if (m_checkPackets)
14981 {
14982 if (groupRolesRequest.AgentData.SessionID != SessionId ||
14983 groupRolesRequest.AgentData.AgentID != AgentId)
14984 break;
14985 }
14986 #endregion
14987
14988 if (m_GroupsModule != null)
14989 {
14990 GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply);
14991
14992 groupRolesReply.AgentData =
14993 new GroupRoleDataReplyPacket.AgentDataBlock();
14994
14995 groupRolesReply.AgentData.AgentID = AgentId;
14996
14997 groupRolesReply.GroupData =
14998 new GroupRoleDataReplyPacket.GroupDataBlock();
14999
15000 groupRolesReply.GroupData.GroupID =
15001 groupRolesRequest.GroupData.GroupID;
15002
15003 groupRolesReply.GroupData.RequestID =
15004 groupRolesRequest.GroupData.RequestID;
15005
15006 List<GroupRolesData> titles =
15007 m_GroupsModule.GroupRoleDataRequest(this,
15008 groupRolesRequest.GroupData.GroupID);
15009
15010 groupRolesReply.GroupData.RoleCount =
15011 titles.Count;
15012
15013 groupRolesReply.RoleData =
15014 new GroupRoleDataReplyPacket.RoleDataBlock[titles.Count];
15015
15016 int i = 0;
15017 foreach (GroupRolesData d in titles)
15018 {
15019 groupRolesReply.RoleData[i] =
15020 new GroupRoleDataReplyPacket.RoleDataBlock();
15021
15022 groupRolesReply.RoleData[i].RoleID =
15023 d.RoleID;
15024 groupRolesReply.RoleData[i].Name =
15025 Util.StringToBytes256(d.Name);
15026 groupRolesReply.RoleData[i].Title =
15027 Util.StringToBytes256(d.Title);
15028 groupRolesReply.RoleData[i].Description =
15029 Util.StringToBytes1024(d.Description);
15030 groupRolesReply.RoleData[i].Powers =
15031 d.Powers;
15032 groupRolesReply.RoleData[i].Members =
15033 (uint)d.Members;
15034
15035 i++;
15036 }
15037
15038 OutPacket(groupRolesReply, ThrottleOutPacketType.Task);
15039 }
15040 break;
15041
15042 case PacketType.GroupRoleMembersRequest:
15043 GroupRoleMembersRequestPacket groupRoleMembersRequest =
15044 (GroupRoleMembersRequestPacket)Pack;
15045
15046 #region Packet Session and User Check
15047 if (m_checkPackets)
15048 {
15049 if (groupRoleMembersRequest.AgentData.SessionID != SessionId ||
15050 groupRoleMembersRequest.AgentData.AgentID != AgentId)
15051 break;
15052 }
15053 #endregion
15054
15055 if (m_GroupsModule != null)
15056 {
15057 List<GroupRoleMembersData> mappings =
15058 m_GroupsModule.GroupRoleMembersRequest(this,
15059 groupRoleMembersRequest.GroupData.GroupID);
15060
15061 int mappingsCount = mappings.Count;
15062
15063 while (mappings.Count > 0)
15064 {
15065 int pairs = mappings.Count;
15066 if (pairs > 32)
15067 pairs = 32;
15068
15069 GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply);
15070 groupRoleMembersReply.AgentData =
15071 new GroupRoleMembersReplyPacket.AgentDataBlock();
15072 groupRoleMembersReply.AgentData.AgentID =
15073 AgentId;
15074 groupRoleMembersReply.AgentData.GroupID =
15075 groupRoleMembersRequest.GroupData.GroupID;
15076 groupRoleMembersReply.AgentData.RequestID =
15077 groupRoleMembersRequest.GroupData.RequestID;
15078
15079 groupRoleMembersReply.AgentData.TotalPairs =
15080 (uint)mappingsCount;
15081
15082 groupRoleMembersReply.MemberData =
15083 new GroupRoleMembersReplyPacket.MemberDataBlock[pairs];
15084
15085 for (int i = 0; i < pairs; i++)
15086 {
15087 GroupRoleMembersData d = mappings[0];
15088 mappings.RemoveAt(0);
15089
15090 groupRoleMembersReply.MemberData[i] =
15091 new GroupRoleMembersReplyPacket.MemberDataBlock();
15092
15093 groupRoleMembersReply.MemberData[i].RoleID =
15094 d.RoleID;
15095 groupRoleMembersReply.MemberData[i].MemberID =
15096 d.MemberID;
15097 }
15098
15099 OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task);
15100 }
15101 }
15102 break;
15103
15104 case PacketType.CreateGroupRequest:
15105 CreateGroupRequestPacket createGroupRequest =
15106 (CreateGroupRequestPacket)Pack;
15107
15108 #region Packet Session and User Check
15109 if (m_checkPackets)
15110 {
15111 if (createGroupRequest.AgentData.SessionID != SessionId ||
15112 createGroupRequest.AgentData.AgentID != AgentId)
15113 break;
15114 }
15115 #endregion
15116
15117 if (m_GroupsModule != null)
15118 {
15119 m_GroupsModule.CreateGroup(this,
15120 Utils.BytesToString(createGroupRequest.GroupData.Name),
15121 Utils.BytesToString(createGroupRequest.GroupData.Charter),
15122 createGroupRequest.GroupData.ShowInList,
15123 createGroupRequest.GroupData.InsigniaID,
15124 createGroupRequest.GroupData.MembershipFee,
15125 createGroupRequest.GroupData.OpenEnrollment,
15126 createGroupRequest.GroupData.AllowPublish,
15127 createGroupRequest.GroupData.MaturePublish);
15128 }
15129 break;
15130
15131 case PacketType.UpdateGroupInfo:
15132 UpdateGroupInfoPacket updateGroupInfo =
15133 (UpdateGroupInfoPacket)Pack;
15134
15135 #region Packet Session and User Check
15136 if (m_checkPackets)
15137 {
15138 if (updateGroupInfo.AgentData.SessionID != SessionId ||
15139 updateGroupInfo.AgentData.AgentID != AgentId)
15140 break;
15141 }
15142 #endregion
15143
15144 if (m_GroupsModule != null)
15145 {
15146 m_GroupsModule.UpdateGroupInfo(this,
15147 updateGroupInfo.GroupData.GroupID,
15148 Utils.BytesToString(updateGroupInfo.GroupData.Charter),
15149 updateGroupInfo.GroupData.ShowInList,
15150 updateGroupInfo.GroupData.InsigniaID,
15151 updateGroupInfo.GroupData.MembershipFee,
15152 updateGroupInfo.GroupData.OpenEnrollment,
15153 updateGroupInfo.GroupData.AllowPublish,
15154 updateGroupInfo.GroupData.MaturePublish);
15155 }
15156
15157 break;
15158
15159 case PacketType.SetGroupAcceptNotices:
15160 SetGroupAcceptNoticesPacket setGroupAcceptNotices =
15161 (SetGroupAcceptNoticesPacket)Pack;
15162
15163 #region Packet Session and User Check
15164 if (m_checkPackets)
15165 {
15166 if (setGroupAcceptNotices.AgentData.SessionID != SessionId ||
15167 setGroupAcceptNotices.AgentData.AgentID != AgentId)
15168 break;
15169 }
15170 #endregion
15171
15172 if (m_GroupsModule != null)
15173 {
15174 m_GroupsModule.SetGroupAcceptNotices(this,
15175 setGroupAcceptNotices.Data.GroupID,
15176 setGroupAcceptNotices.Data.AcceptNotices,
15177 setGroupAcceptNotices.NewData.ListInProfile);
15178 }
15179
15180 break;
15181
15182 case PacketType.GroupTitleUpdate:
15183 GroupTitleUpdatePacket groupTitleUpdate =
15184 (GroupTitleUpdatePacket)Pack;
15185
15186 #region Packet Session and User Check
15187 if (m_checkPackets)
15188 {
15189 if (groupTitleUpdate.AgentData.SessionID != SessionId ||
15190 groupTitleUpdate.AgentData.AgentID != AgentId)
15191 break;
15192 }
15193 #endregion
15194
15195 if (m_GroupsModule != null)
15196 {
15197 m_GroupsModule.GroupTitleUpdate(this,
15198 groupTitleUpdate.AgentData.GroupID,
15199 groupTitleUpdate.AgentData.TitleRoleID);
15200 }
15201
15202 break;
15203
15204
15205 case PacketType.ParcelDeedToGroup:
15206 ParcelDeedToGroupPacket parcelDeedToGroup = (ParcelDeedToGroupPacket)Pack;
15207 if (m_GroupsModule != null)
15208 {
15209 ParcelDeedToGroup handlerParcelDeedToGroup = OnParcelDeedToGroup;
15210 if (handlerParcelDeedToGroup != null)
15211 {
15212 handlerParcelDeedToGroup(parcelDeedToGroup.Data.LocalID, parcelDeedToGroup.Data.GroupID, this);
15213
15214 }
15215 }
15216
15217 break;
15218
15219
15220 case PacketType.GroupNoticesListRequest:
15221 GroupNoticesListRequestPacket groupNoticesListRequest =
15222 (GroupNoticesListRequestPacket)Pack;
15223
15224 #region Packet Session and User Check
15225 if (m_checkPackets)
15226 {
15227 if (groupNoticesListRequest.AgentData.SessionID != SessionId ||
15228 groupNoticesListRequest.AgentData.AgentID != AgentId)
15229 break;
15230 }
15231 #endregion
15232
15233 if (m_GroupsModule != null)
15234 {
15235 GroupNoticeData[] gn =
15236 m_GroupsModule.GroupNoticesListRequest(this,
15237 groupNoticesListRequest.Data.GroupID);
15238
15239 GroupNoticesListReplyPacket groupNoticesListReply = (GroupNoticesListReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupNoticesListReply);
15240 groupNoticesListReply.AgentData =
15241 new GroupNoticesListReplyPacket.AgentDataBlock();
15242 groupNoticesListReply.AgentData.AgentID = AgentId;
15243 groupNoticesListReply.AgentData.GroupID = groupNoticesListRequest.Data.GroupID;
15244
15245 groupNoticesListReply.Data = new GroupNoticesListReplyPacket.DataBlock[gn.Length];
15246
15247 int i = 0;
15248 foreach (GroupNoticeData g in gn)
15249 {
15250 groupNoticesListReply.Data[i] = new GroupNoticesListReplyPacket.DataBlock();
15251 groupNoticesListReply.Data[i].NoticeID =
15252 g.NoticeID;
15253 groupNoticesListReply.Data[i].Timestamp =
15254 g.Timestamp;
15255 groupNoticesListReply.Data[i].FromName =
15256 Util.StringToBytes256(g.FromName);
15257 groupNoticesListReply.Data[i].Subject =
15258 Util.StringToBytes256(g.Subject);
15259 groupNoticesListReply.Data[i].HasAttachment =
15260 g.HasAttachment;
15261 groupNoticesListReply.Data[i].AssetType =
15262 g.AssetType;
15263 i++;
15264 }
15265
15266 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task);
15267 }
15268
15269 break;
15270
15271 case PacketType.GroupNoticeRequest:
15272 GroupNoticeRequestPacket groupNoticeRequest =
15273 (GroupNoticeRequestPacket)Pack;
15274
15275 #region Packet Session and User Check
15276 if (m_checkPackets)
15277 {
15278 if (groupNoticeRequest.AgentData.SessionID != SessionId ||
15279 groupNoticeRequest.AgentData.AgentID != AgentId)
15280 break;
15281 }
15282 #endregion
15283
15284 if (m_GroupsModule != null)
15285 {
15286 m_GroupsModule.GroupNoticeRequest(this,
15287 groupNoticeRequest.Data.GroupNoticeID);
15288 }
15289 break;
15290
15291 case PacketType.GroupRoleUpdate:
15292 GroupRoleUpdatePacket groupRoleUpdate =
15293 (GroupRoleUpdatePacket)Pack;
15294
15295 #region Packet Session and User Check
15296 if (m_checkPackets)
15297 {
15298 if (groupRoleUpdate.AgentData.SessionID != SessionId ||
15299 groupRoleUpdate.AgentData.AgentID != AgentId)
15300 break;
15301 }
15302 #endregion
15303
15304 if (m_GroupsModule != null)
15305 {
15306 foreach (GroupRoleUpdatePacket.RoleDataBlock d in
15307 groupRoleUpdate.RoleData)
15308 {
15309 m_GroupsModule.GroupRoleUpdate(this,
15310 groupRoleUpdate.AgentData.GroupID,
15311 d.RoleID,
15312 Utils.BytesToString(d.Name),
15313 Utils.BytesToString(d.Description),
15314 Utils.BytesToString(d.Title),
15315 d.Powers,
15316 d.UpdateType);
15317 }
15318 m_GroupsModule.NotifyChange(groupRoleUpdate.AgentData.GroupID);
15319 }
15320 break;
15321
15322 case PacketType.GroupRoleChanges:
15323 GroupRoleChangesPacket groupRoleChanges =
15324 (GroupRoleChangesPacket)Pack;
15325
15326 #region Packet Session and User Check
15327 if (m_checkPackets)
15328 {
15329 if (groupRoleChanges.AgentData.SessionID != SessionId ||
15330 groupRoleChanges.AgentData.AgentID != AgentId)
15331 break;
15332 }
15333 #endregion
15334
15335 if (m_GroupsModule != null)
15336 {
15337 foreach (GroupRoleChangesPacket.RoleChangeBlock d in
15338 groupRoleChanges.RoleChange)
15339 {
15340 m_GroupsModule.GroupRoleChanges(this,
15341 groupRoleChanges.AgentData.GroupID,
15342 d.RoleID,
15343 d.MemberID,
15344 d.Change);
15345 }
15346 m_GroupsModule.NotifyChange(groupRoleChanges.AgentData.GroupID);
15347 }
15348 break;
15349
15350 case PacketType.JoinGroupRequest:
15351 JoinGroupRequestPacket joinGroupRequest =
15352 (JoinGroupRequestPacket)Pack;
15353
15354 #region Packet Session and User Check
15355 if (m_checkPackets)
15356 {
15357 if (joinGroupRequest.AgentData.SessionID != SessionId ||
15358 joinGroupRequest.AgentData.AgentID != AgentId)
15359 break;
15360 }
15361 #endregion
15362
15363 if (m_GroupsModule != null)
15364 {
15365 m_GroupsModule.JoinGroupRequest(this,
15366 joinGroupRequest.GroupData.GroupID);
15367 }
15368 break;
15369
15370 case PacketType.LeaveGroupRequest:
15371 LeaveGroupRequestPacket leaveGroupRequest =
15372 (LeaveGroupRequestPacket)Pack;
15373
15374 #region Packet Session and User Check
15375 if (m_checkPackets)
15376 {
15377 if (leaveGroupRequest.AgentData.SessionID != SessionId ||
15378 leaveGroupRequest.AgentData.AgentID != AgentId)
15379 break;
15380 }
15381 #endregion
15382
15383 if (m_GroupsModule != null)
15384 {
15385 m_GroupsModule.LeaveGroupRequest(this,
15386 leaveGroupRequest.GroupData.GroupID);
15387 }
15388 break;
15389
15390 case PacketType.EjectGroupMemberRequest:
15391 EjectGroupMemberRequestPacket ejectGroupMemberRequest =
15392 (EjectGroupMemberRequestPacket)Pack;
15393
15394 #region Packet Session and User Check
15395 if (m_checkPackets)
15396 {
15397 if (ejectGroupMemberRequest.AgentData.SessionID != SessionId ||
15398 ejectGroupMemberRequest.AgentData.AgentID != AgentId)
15399 break;
15400 }
15401 #endregion
15402
15403 if (m_GroupsModule != null)
15404 {
15405 foreach (EjectGroupMemberRequestPacket.EjectDataBlock e
15406 in ejectGroupMemberRequest.EjectData)
15407 {
15408 m_GroupsModule.EjectGroupMemberRequest(this,
15409 ejectGroupMemberRequest.GroupData.GroupID,
15410 e.EjecteeID);
15411 }
15412 }
15413 break;
15414
15415 case PacketType.InviteGroupRequest:
15416 InviteGroupRequestPacket inviteGroupRequest =
15417 (InviteGroupRequestPacket)Pack;
15418
15419 #region Packet Session and User Check
15420 if (m_checkPackets)
15421 {
15422 if (inviteGroupRequest.AgentData.SessionID != SessionId ||
15423 inviteGroupRequest.AgentData.AgentID != AgentId)
15424 break;
15425 }
15426 #endregion
15427
15428 if (m_GroupsModule != null)
15429 {
15430 foreach (InviteGroupRequestPacket.InviteDataBlock b in
15431 inviteGroupRequest.InviteData)
15432 {
15433 m_GroupsModule.InviteGroupRequest(this,
15434 inviteGroupRequest.GroupData.GroupID,
15435 b.InviteeID,
15436 b.RoleID);
15437 }
15438 }
15439 break;
15440
15441 //#endregion
15442
15443 case PacketType.StartLure:
15444 StartLurePacket startLureRequest = (StartLurePacket)Pack;
15445
15446 #region Packet Session and User Check
15447 if (m_checkPackets)
15448 {
15449 if (startLureRequest.AgentData.SessionID != SessionId ||
15450 startLureRequest.AgentData.AgentID != AgentId)
15451 break;
15452 }
15453 #endregion
15454
15455 StartLure handlerStartLure = OnStartLure;
15456 if (handlerStartLure != null)
15457 handlerStartLure(startLureRequest.Info.LureType,
15458 Utils.BytesToString(
15459 startLureRequest.Info.Message),
15460 startLureRequest.TargetData[0].TargetID,
15461 this);
15462 break;
15463
15464 case PacketType.TeleportLureRequest:
15465 TeleportLureRequestPacket teleportLureRequest =
15466 (TeleportLureRequestPacket)Pack;
15467
15468 #region Packet Session and User Check
15469 if (m_checkPackets)
15470 {
15471 if (teleportLureRequest.Info.SessionID != SessionId ||
15472 teleportLureRequest.Info.AgentID != AgentId)
15473 break;
15474 }
15475 #endregion
15476
15477 TeleportLureRequest handlerTeleportLureRequest = OnTeleportLureRequest;
15478 if (handlerTeleportLureRequest != null)
15479 handlerTeleportLureRequest(
15480 teleportLureRequest.Info.LureID,
15481 teleportLureRequest.Info.TeleportFlags,
15482 this);
15483 break;
15484
15485 case PacketType.ClassifiedInfoRequest:
15486 ClassifiedInfoRequestPacket classifiedInfoRequest =
15487 (ClassifiedInfoRequestPacket)Pack;
15488
15489 #region Packet Session and User Check
15490 if (m_checkPackets)
15491 {
15492 if (classifiedInfoRequest.AgentData.SessionID != SessionId ||
15493 classifiedInfoRequest.AgentData.AgentID != AgentId)
15494 break;
15495 }
15496 #endregion
15497
15498 ClassifiedInfoRequest handlerClassifiedInfoRequest = OnClassifiedInfoRequest;
15499 if (handlerClassifiedInfoRequest != null)
15500 handlerClassifiedInfoRequest(
15501 classifiedInfoRequest.Data.ClassifiedID,
15502 this);
15503 break;
15504
15505 case PacketType.ClassifiedInfoUpdate:
15506 ClassifiedInfoUpdatePacket classifiedInfoUpdate =
15507 (ClassifiedInfoUpdatePacket)Pack;
15508
15509 #region Packet Session and User Check
15510 if (m_checkPackets)
15511 {
15512 if (classifiedInfoUpdate.AgentData.SessionID != SessionId ||
15513 classifiedInfoUpdate.AgentData.AgentID != AgentId)
15514 break;
15515 }
15516 #endregion
15517
15518 ClassifiedInfoUpdate handlerClassifiedInfoUpdate = OnClassifiedInfoUpdate;
15519 if (handlerClassifiedInfoUpdate != null)
15520 handlerClassifiedInfoUpdate(
15521 classifiedInfoUpdate.Data.ClassifiedID,
15522 classifiedInfoUpdate.Data.Category,
15523 Utils.BytesToString(
15524 classifiedInfoUpdate.Data.Name),
15525 Utils.BytesToString(
15526 classifiedInfoUpdate.Data.Desc),
15527 classifiedInfoUpdate.Data.ParcelID,
15528 classifiedInfoUpdate.Data.ParentEstate,
15529 classifiedInfoUpdate.Data.SnapshotID,
15530 new Vector3(
15531 classifiedInfoUpdate.Data.PosGlobal),
15532 classifiedInfoUpdate.Data.ClassifiedFlags,
15533 classifiedInfoUpdate.Data.PriceForListing,
15534 this);
15535 break;
15536
15537 case PacketType.ClassifiedDelete:
15538 ClassifiedDeletePacket classifiedDelete =
15539 (ClassifiedDeletePacket)Pack;
15540
15541 #region Packet Session and User Check
15542 if (m_checkPackets)
15543 {
15544 if (classifiedDelete.AgentData.SessionID != SessionId ||
15545 classifiedDelete.AgentData.AgentID != AgentId)
15546 break;
15547 }
15548 #endregion
15549
15550 ClassifiedDelete handlerClassifiedDelete = OnClassifiedDelete;
15551 if (handlerClassifiedDelete != null)
15552 handlerClassifiedDelete(
15553 classifiedDelete.Data.ClassifiedID,
15554 this);
15555 break;
15556
15557 case PacketType.ClassifiedGodDelete:
15558 ClassifiedGodDeletePacket classifiedGodDelete =
15559 (ClassifiedGodDeletePacket)Pack;
15560
15561 #region Packet Session and User Check
15562 if (m_checkPackets)
15563 {
15564 if (classifiedGodDelete.AgentData.SessionID != SessionId ||
15565 classifiedGodDelete.AgentData.AgentID != AgentId)
15566 break;
15567 }
15568 #endregion
15569
15570 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
15571 if (handlerClassifiedGodDelete != null)
15572 handlerClassifiedGodDelete(
15573 classifiedGodDelete.Data.ClassifiedID,
15574 this);
15575 break;
15576
15577 case PacketType.EventGodDelete:
15578 EventGodDeletePacket eventGodDelete =
15579 (EventGodDeletePacket)Pack;
15580
15581 #region Packet Session and User Check
15582 if (m_checkPackets)
15583 {
15584 if (eventGodDelete.AgentData.SessionID != SessionId ||
15585 eventGodDelete.AgentData.AgentID != AgentId)
15586 break;
15587 }
15588 #endregion
15589
15590 EventGodDelete handlerEventGodDelete = OnEventGodDelete;
15591 if (handlerEventGodDelete != null)
15592 handlerEventGodDelete(
15593 eventGodDelete.EventData.EventID,
15594 eventGodDelete.QueryData.QueryID,
15595 Utils.BytesToString(
15596 eventGodDelete.QueryData.QueryText),
15597 eventGodDelete.QueryData.QueryFlags,
15598 eventGodDelete.QueryData.QueryStart,
15599 this);
15600 break;
15601
15602 case PacketType.EventNotificationAddRequest:
15603 EventNotificationAddRequestPacket eventNotificationAdd =
15604 (EventNotificationAddRequestPacket)Pack;
15605
15606 #region Packet Session and User Check
15607 if (m_checkPackets)
15608 {
15609 if (eventNotificationAdd.AgentData.SessionID != SessionId ||
15610 eventNotificationAdd.AgentData.AgentID != AgentId)
15611 break;
15612 }
15613 #endregion
15614
15615 EventNotificationAddRequest handlerEventNotificationAddRequest = OnEventNotificationAddRequest;
15616 if (handlerEventNotificationAddRequest != null)
15617 handlerEventNotificationAddRequest(
15618 eventNotificationAdd.EventData.EventID, this);
15619 break;
15620
15621 case PacketType.EventNotificationRemoveRequest:
15622 EventNotificationRemoveRequestPacket eventNotificationRemove =
15623 (EventNotificationRemoveRequestPacket)Pack;
15624
15625 #region Packet Session and User Check
15626 if (m_checkPackets)
15627 {
15628 if (eventNotificationRemove.AgentData.SessionID != SessionId ||
15629 eventNotificationRemove.AgentData.AgentID != AgentId)
15630 break;
15631 }
15632 #endregion
15633
15634 EventNotificationRemoveRequest handlerEventNotificationRemoveRequest = OnEventNotificationRemoveRequest;
15635 if (handlerEventNotificationRemoveRequest != null)
15636 handlerEventNotificationRemoveRequest(
15637 eventNotificationRemove.EventData.EventID, this);
15638 break;
15639
15640 case PacketType.RetrieveInstantMessages:
15641 RetrieveInstantMessagesPacket rimpInstantMessagePack = (RetrieveInstantMessagesPacket)Pack;
15642
15643 #region Packet Session and User Check
15644 if (m_checkPackets)
15645 {
15646 if (rimpInstantMessagePack.AgentData.SessionID != SessionId ||
15647 rimpInstantMessagePack.AgentData.AgentID != AgentId)
15648 break;
15649 }
15650 #endregion
15651
15652 RetrieveInstantMessages handlerRetrieveInstantMessages = OnRetrieveInstantMessages;
15653 if (handlerRetrieveInstantMessages != null)
15654 handlerRetrieveInstantMessages(this);
15655 break;
15656
15657 case PacketType.PickDelete:
15658 PickDeletePacket pickDelete =
15659 (PickDeletePacket)Pack;
15660
15661 #region Packet Session and User Check
15662 if (m_checkPackets)
15663 {
15664 if (pickDelete.AgentData.SessionID != SessionId ||
15665 pickDelete.AgentData.AgentID != AgentId)
15666 break;
15667 }
15668 #endregion
15669
15670 PickDelete handlerPickDelete = OnPickDelete;
15671 if (handlerPickDelete != null)
15672 handlerPickDelete(this, pickDelete.Data.PickID);
15673 break;
15674
15675 case PacketType.PickGodDelete:
15676 PickGodDeletePacket pickGodDelete =
15677 (PickGodDeletePacket)Pack;
15678
15679 #region Packet Session and User Check
15680 if (m_checkPackets)
15681 {
15682 if (pickGodDelete.AgentData.SessionID != SessionId ||
15683 pickGodDelete.AgentData.AgentID != AgentId)
15684 break;
15685 }
15686 #endregion
15687
15688 PickGodDelete handlerPickGodDelete = OnPickGodDelete;
15689 if (handlerPickGodDelete != null)
15690 handlerPickGodDelete(this,
15691 pickGodDelete.AgentData.AgentID,
15692 pickGodDelete.Data.PickID,
15693 pickGodDelete.Data.QueryID);
15694 break;
15695
15696 case PacketType.PickInfoUpdate:
15697 PickInfoUpdatePacket pickInfoUpdate =
15698 (PickInfoUpdatePacket)Pack;
15699
15700 #region Packet Session and User Check
15701 if (m_checkPackets)
15702 {
15703 if (pickInfoUpdate.AgentData.SessionID != SessionId ||
15704 pickInfoUpdate.AgentData.AgentID != AgentId)
15705 break;
15706 }
15707 #endregion
15708
15709 PickInfoUpdate handlerPickInfoUpdate = OnPickInfoUpdate;
15710 if (handlerPickInfoUpdate != null)
15711 handlerPickInfoUpdate(this,
15712 pickInfoUpdate.Data.PickID,
15713 pickInfoUpdate.Data.CreatorID,
15714 pickInfoUpdate.Data.TopPick,
15715 Utils.BytesToString(pickInfoUpdate.Data.Name),
15716 Utils.BytesToString(pickInfoUpdate.Data.Desc),
15717 pickInfoUpdate.Data.SnapshotID,
15718 pickInfoUpdate.Data.SortOrder,
15719 pickInfoUpdate.Data.Enabled);
15720 break;
15721
15722 case PacketType.AvatarNotesUpdate:
15723 AvatarNotesUpdatePacket avatarNotesUpdate =
15724 (AvatarNotesUpdatePacket)Pack;
15725
15726 #region Packet Session and User Check
15727 if (m_checkPackets)
15728 {
15729 if (avatarNotesUpdate.AgentData.SessionID != SessionId ||
15730 avatarNotesUpdate.AgentData.AgentID != AgentId)
15731 break;
15732 }
15733 #endregion
15734
15735 AvatarNotesUpdate handlerAvatarNotesUpdate = OnAvatarNotesUpdate;
15736 if (handlerAvatarNotesUpdate != null)
15737 handlerAvatarNotesUpdate(this,
15738 avatarNotesUpdate.Data.TargetID,
15739 Utils.BytesToString(avatarNotesUpdate.Data.Notes));
15740 break;
15741
15742 case PacketType.AvatarInterestsUpdate:
15743 AvatarInterestsUpdatePacket avatarInterestUpdate =
15744 (AvatarInterestsUpdatePacket)Pack;
15745
15746 #region Packet Session and User Check
15747 if (m_checkPackets)
15748 {
15749 if (avatarInterestUpdate.AgentData.SessionID != SessionId ||
15750 avatarInterestUpdate.AgentData.AgentID != AgentId)
15751 break;
15752 }
15753 #endregion
15754 11016
15755 AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate; 11017 if (!ProcessPacketMethod(Pack))
15756 if (handlerAvatarInterestUpdate != null) 11018 m_log.Warn("[CLIENT]: unhandled packet " + Pack);
15757 handlerAvatarInterestUpdate(this,
15758 avatarInterestUpdate.PropertiesData.WantToMask,
15759 Utils.BytesToString(avatarInterestUpdate.PropertiesData.WantToText),
15760 avatarInterestUpdate.PropertiesData.SkillsMask,
15761 Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText),
15762 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
15763 break;
15764
15765 case PacketType.GrantUserRights:
15766 GrantUserRightsPacket GrantUserRights =
15767 (GrantUserRightsPacket)Pack;
15768 #region Packet Session and User Check
15769 if (m_checkPackets)
15770 {
15771 if (GrantUserRights.AgentData.SessionID != SessionId ||
15772 GrantUserRights.AgentData.AgentID != AgentId)
15773 break;
15774 }
15775 #endregion
15776 GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights;
15777 if (GrantUserRightsHandler != null)
15778 GrantUserRightsHandler(this,
15779 GrantUserRights.AgentData.AgentID,
15780 GrantUserRights.Rights[0].AgentRelated,
15781 GrantUserRights.Rights[0].RelatedRights);
15782 break;
15783
15784 case PacketType.PlacesQuery:
15785 PlacesQueryPacket placesQueryPacket =
15786 (PlacesQueryPacket)Pack;
15787
15788 PlacesQuery handlerPlacesQuery = OnPlacesQuery;
15789
15790 if (handlerPlacesQuery != null)
15791 handlerPlacesQuery(placesQueryPacket.AgentData.QueryID,
15792 placesQueryPacket.TransactionData.TransactionID,
15793 Utils.BytesToString(
15794 placesQueryPacket.QueryData.QueryText),
15795 placesQueryPacket.QueryData.QueryFlags,
15796 (byte)placesQueryPacket.QueryData.Category,
15797 Utils.BytesToString(
15798 placesQueryPacket.QueryData.SimName),
15799 this);
15800 break;
15801 */
15802 #endregion
15803 default:
15804 m_log.Warn("[CLIENT]: unhandled packet " + Pack);
15805 break;
15806 }
15807 11019
15808 PacketPool.Instance.ReturnPacket(Pack); 11020 PacketPool.Instance.ReturnPacket(Pack);
15809
15810 } 11021 }
15811 11022
15812 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) 11023 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 1903eb9..b1b7b27 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -330,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Asset
330 //m_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);
331 331
332 if (name != Name) 332 if (name != Name)
333 return; 333 return;
334 334
335 long maxSize = DefaultMaxSize; 335 long maxSize = DefaultMaxSize;
336 int maxCount = DefaultMaxCount; 336 int maxCount = DefaultMaxCount;
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 9216e0b..967c0a1 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -69,7 +69,7 @@ namespace Flotsam.RegionModules.AssetCache
69 69
70 private readonly List<char> m_InvalidChars = new List<char>(); 70 private readonly List<char> m_InvalidChars = new List<char>();
71 71
72 private int m_LogLevel = 1; 72 private int m_LogLevel = 0;
73 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests 73 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests
74 74
75 private static ulong m_Requests; 75 private static ulong m_Requests;
@@ -156,7 +156,7 @@ namespace Flotsam.RegionModules.AssetCache
156 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); 156 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
157#endif 157#endif
158 158
159 m_LogLevel = assetConfig.GetInt("LogLevel", 1); 159 m_LogLevel = assetConfig.GetInt("LogLevel", 0);
160 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000); 160 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000);
161 161
162 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration)); 162 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 61b6d65..1a6cd6c 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)
156 { 163 {
157 avatar.Invulnerable = true;
158 } 164 }
159 } 165 }
160 } 166 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ecd60bd..a898992 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -131,7 +131,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
131 { 131 {
132 if (CheckPresence(userInfo.UserProfile.ID)) 132 if (CheckPresence(userInfo.UserProfile.ID))
133 { 133 {
134 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); 134 try
135 {
136 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
137 }
138 catch (EntryPointNotFoundException e)
139 {
140 m_log.ErrorFormat(
141 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
142 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
143 m_log.Error(e);
144
145 return false;
146 }
147
135 return true; 148 return true;
136 } 149 }
137 else 150 else
@@ -156,7 +169,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
156 { 169 {
157 if (CheckPresence(userInfo.UserProfile.ID)) 170 if (CheckPresence(userInfo.UserProfile.ID))
158 { 171 {
159 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); 172 try
173 {
174 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
175 }
176 catch (EntryPointNotFoundException e)
177 {
178 m_log.ErrorFormat(
179 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
180 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
181 m_log.Error(e);
182
183 return false;
184 }
185
160 return true; 186 return true;
161 } 187 }
162 else 188 else
@@ -181,8 +207,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
181 { 207 {
182 if (CheckPresence(userInfo.UserProfile.ID)) 208 if (CheckPresence(userInfo.UserProfile.ID))
183 { 209 {
184 InventoryArchiveReadRequest request = 210 InventoryArchiveReadRequest request;
185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); 211
212 try
213 {
214 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
215 }
216 catch (EntryPointNotFoundException e)
217 {
218 m_log.ErrorFormat(
219 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
220 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
221 m_log.Error(e);
222
223 return false;
224 }
225
186 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 226 UpdateClientWithLoadedNodes(userInfo, request.Execute());
187 227
188 return true; 228 return true;
@@ -209,8 +249,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
209 { 249 {
210 if (CheckPresence(userInfo.UserProfile.ID)) 250 if (CheckPresence(userInfo.UserProfile.ID))
211 { 251 {
212 InventoryArchiveReadRequest request = 252 InventoryArchiveReadRequest request;
213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); 253
254 try
255 {
256 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
257 }
258 catch (EntryPointNotFoundException e)
259 {
260 m_log.ErrorFormat(
261 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
262 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
263 m_log.Error(e);
264
265 return false;
266 }
267
214 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 268 UpdateClientWithLoadedNodes(userInfo, request.Execute());
215 269
216 return true; 270 return true;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 2f21e6d..50348da 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
224 m_Cache.Cache(a); 224 m_Cache.Cache(a);
225 225
226// if (null == a) 226// if (null == a)
227// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); 227// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
228 228
229 Util.FireAndForget(delegate { handler(assetID, s, a); }); 229 Util.FireAndForget(delegate { handler(assetID, s, a); });
230 }); 230 });
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 3883dc6..191e859 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
317 item = m_InventoryService.GetItem(item); 317 item = m_InventoryService.GetItem(item);
318 318
319 if (null == item) 319 if (null == item)
320 m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}"); 320 m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID);
321 321
322 return item; 322 return item;
323 } 323 }
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 73f7ae3..e4fe352 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.World
109 { 109 {
110 foreach (Scene s in m_SceneList) 110 foreach (Scene s in m_SceneList)
111 { 111 {
112 if(!ProcessCommand(s, cmd)) 112 if (!ProcessCommand(s, cmd))
113 break; 113 break;
114 } 114 }
115 } 115 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c7c9778..e6d4549 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -73,7 +73,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
73 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) 73 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId)
74 { 74 {
75 m_scene = scene; 75 m_scene = scene;
76 m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); 76
77 try
78 {
79 m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
80 }
81 catch (EntryPointNotFoundException e)
82 {
83 m_log.ErrorFormat(
84 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
85 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
86 m_log.Error(e);
87 }
88
77 m_errorMessage = String.Empty; 89 m_errorMessage = String.Empty;
78 m_merge = merge; 90 m_merge = merge;
79 m_requestId = requestId; 91 m_requestId = requestId;
@@ -422,6 +434,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
422 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 434 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
423 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 435 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
424 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 436 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
437
438 currentRegionSettings.Save();
425 439
426 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 440 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
427 441
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 71bfe57..b61b341 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -65,7 +65,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
65 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) 65 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId)
66 { 66 {
67 m_scene = scene; 67 m_scene = scene;
68 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress); 68
69 try
70 {
71 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress);
72 }
73 catch (EntryPointNotFoundException e)
74 {
75 m_log.ErrorFormat(
76 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
77 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
78 m_log.Error(e);
79 }
80
69 m_requestId = requestId; 81 m_requestId = requestId;
70 } 82 }
71 83
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index c3e57f0..e77a23b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
100 Vector3 offsetPosition = new Vector3(5, 10, 15); 100 Vector3 offsetPosition = new Vector3(5, 10, 15);
101 101
102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
103 } 103 }
104 104
105 protected SceneObjectPart CreateSceneObjectPart2() 105 protected SceneObjectPart CreateSceneObjectPart2()
@@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
112 Vector3 offsetPosition = new Vector3(20, 25, 30); 112 Vector3 offsetPosition = new Vector3(20, 25, 30);
113 113
114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
115 } 115 }
116 116
117 /// <summary> 117 /// <summary>
118 /// Test saving a V0.2 OpenSim Region Archive. 118 /// Test saving a V0.2 OpenSim Region Archive.
@@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
231 foreach (string name in names) 231 foreach (string name in names)
232 { 232 {
233 if (name.EndsWith(".Resources.test-sound.wav")) 233 if (name.EndsWith(".Resources.test-sound.wav"))
234 soundDataResourceName = name; 234 soundDataResourceName = name;
235 } 235 }
236 Assert.That(soundDataResourceName, Is.Not.Null); 236 Assert.That(soundDataResourceName, Is.Not.Null);
237 237
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName }; 259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
260 part1.Inventory.AddInventoryItem(item1, true); 260 part1.Inventory.AddInventoryItem(item1, true);
261 } 261 }
262 } 262 }
263 263
264 m_scene.AddNewSceneObject(object1, false); 264 m_scene.AddNewSceneObject(object1, false);
265 265
@@ -306,15 +306,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
306 /// Test loading the region settings of a V0.2 OpenSim Region Archive. 306 /// Test loading the region settings of a V0.2 OpenSim Region Archive.
307 /// </summary> 307 /// </summary>
308 [Test] 308 [Test]
309 public void TestLoadOarV0_2RegionSettings() 309 public void TestLoadOarV0_2RegionSettings()
310 { 310 {
311 TestHelper.InMethod(); 311 TestHelper.InMethod();
312 //log4net.Config.XmlConfigurator.Configure(); 312 //log4net.Config.XmlConfigurator.Configure();
313 313
314 MemoryStream archiveWriteStream = new MemoryStream(); 314 MemoryStream archiveWriteStream = new MemoryStream();
315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
316 316
317 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 317 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
318 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 318 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
319 319
320 RegionSettings rs = new RegionSettings(); 320 RegionSettings rs = new RegionSettings();
@@ -329,11 +329,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
329 rs.DisablePhysics = true; 329 rs.DisablePhysics = true;
330 rs.DisableScripts = true; 330 rs.DisableScripts = true;
331 rs.Elevation1NW = 15.9; 331 rs.Elevation1NW = 15.9;
332 rs.Elevation1NE = 45.3; 332 rs.Elevation1NE = 45.3;
333 rs.Elevation1SE = 49; 333 rs.Elevation1SE = 49;
334 rs.Elevation1SW = 1.9; 334 rs.Elevation1SW = 1.9;
335 rs.Elevation2NW = 4.5; 335 rs.Elevation2NW = 4.5;
336 rs.Elevation2NE = 19.2; 336 rs.Elevation2NE = 19.2;
337 rs.Elevation2SE = 9.2; 337 rs.Elevation2SE = 9.2;
338 rs.Elevation2SW = 2.1; 338 rs.Elevation2SW = 2.1;
339 rs.FixedSun = true; 339 rs.FixedSun = true;
@@ -411,7 +411,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); 411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30); 412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
413 413
414 SceneObjectPart part2 = CreateSceneObjectPart2(); 414 SceneObjectPart part2 = CreateSceneObjectPart2();
415 415
416 // Create an oar file that we can use for the merge 416 // Create an oar file that we can use for the merge
417 { 417 {
@@ -420,9 +420,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
420 TerrainModule terrainModule = new TerrainModule(); 420 TerrainModule terrainModule = new TerrainModule();
421 421
422 Scene scene = SceneSetupHelpers.SetupScene(); 422 Scene scene = SceneSetupHelpers.SetupScene();
423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
424 424
425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); 425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
426 426
427 // Write out this scene 427 // Write out this scene
428 scene.EventManager.OnOarFileSaved += SaveCompleted; 428 scene.EventManager.OnOarFileSaved += SaveCompleted;
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 172d012..d2b0161 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/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
index c289cdb..8954513 100644
--- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
65 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need 65 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
66 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture 66 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
67 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID 67 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
68 /// </returns> 68 /// </returns>
69 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, 69 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
70 int updateTimer, bool SetBlending, byte AlphaValue); 70 int updateTimer, bool SetBlending, byte AlphaValue);
71 71
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index fa9bf19..f58904f 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Framework.Interfaces
150 /// <returns> 150 /// <returns>
151 /// A list of inventory items with that name. 151 /// A list of inventory items with that name.
152 /// If no inventory item has that name then an empty list is returned. 152 /// If no inventory item has that name then an empty list is returned.
153 /// </returns> 153 /// </returns>
154 IList<TaskInventoryItem> GetInventoryItems(string name); 154 IList<TaskInventoryItem> GetInventoryItems(string name);
155 155
156 /// <summary> 156 /// <summary>
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/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index 948b9dc..8da99a0 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces
62 /// <param name="name">name to filter on</param> 62 /// <param name="name">name to filter on</param>
63 /// <param name="id">key to filter on (user given, could be totally faked)</param> 63 /// <param name="id">key to filter on (user given, could be totally faked)</param>
64 /// <param name="msg">msg to filter on</param> 64 /// <param name="msg">msg to filter on</param>
65 /// <returns>number of the scripts handle</returns> 65 /// <returns>number of the scripts handle</returns>
66 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); 66 int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
67 67
68 /// <summary> 68 /// <summary>
@@ -77,19 +77,19 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// <param name="channel">channel to sent on</param> 77 /// <param name="channel">channel to sent on</param>
78 /// <param name="name">name of sender (object or avatar)</param> 78 /// <param name="name">name of sender (object or avatar)</param>
79 /// <param name="id">key of sender (object or avatar)</param> 79 /// <param name="id">key of sender (object or avatar)</param>
80 /// <param name="msg">msg to sent</param> 80 /// <param name="msg">msg to sent</param>
81 void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); 81 void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg);
82 82
83 /// <summary> 83 /// <summary>
84 /// Are there any listen events ready to be dispatched? 84 /// Are there any listen events ready to be dispatched?
85 /// </summary> 85 /// </summary>
86 /// <returns>boolean indication</returns> 86 /// <returns>boolean indication</returns>
87 bool HasMessages(); 87 bool HasMessages();
88 88
89 /// <summary> 89 /// <summary>
90 /// Pop the first availlable listen event from the queue 90 /// Pop the first availlable listen event from the queue
91 /// </summary> 91 /// </summary>
92 /// <returns>ListenerInfo with filter filled in</returns> 92 /// <returns>ListenerInfo with filter filled in</returns>
93 IWorldCommListenerInfo GetNextMessage(); 93 IWorldCommListenerInfo GetNextMessage();
94 94
95 void ListenControl(UUID itemID, int handle, int active); 95 void ListenControl(UUID itemID, int handle, int active);
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index e98f0e7..be0e985 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -419,15 +419,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
419 { 419 {
420 if (m_scenePresence.IsChildAgent) 420 if (m_scenePresence.IsChildAgent)
421 return; 421 return;
422
423 UUID[] animIDs;
424 int[] sequenceNums;
425 UUID[] objectIDs;
426 422
427 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); 423 m_scenePresence.Scene.ForEachScenePresence(
428 424 delegate(ScenePresence SP)
429 m_scenePresence.ControllingClient.SendAnimations( 425 {
430 animIDs, sequenceNums, m_scenePresence.ControllingClient.AgentId, objectIDs); 426 SP.Animator.SendAnimPack();
427 });
431 } 428 }
432 429
433 /// <summary> 430 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 22909bc..7fb1cd8 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
213 /// Triggered when an object or attachment enters a scene 213 /// Triggered when an object or attachment enters a scene
214 /// </summary> 214 /// </summary>
215 public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; 215 public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
216 public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); 216 public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
217 217
218 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); 218 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
219 219
@@ -417,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes
417 } 417 }
418 } 418 }
419 } 419 }
420 } 420 }
421 421
422 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 422 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
423 { 423 {
@@ -437,7 +437,7 @@ namespace OpenSim.Region.Framework.Scenes
437 e.Message, e.StackTrace); 437 e.Message, e.StackTrace);
438 } 438 }
439 } 439 }
440 } 440 }
441 } 441 }
442 442
443 public void TriggerOnScriptChangedEvent(uint localID, uint change) 443 public void TriggerOnScriptChangedEvent(uint localID, uint change)
@@ -458,7 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
458 e.Message, e.StackTrace); 458 e.Message, e.StackTrace);
459 } 459 }
460 } 460 }
461 } 461 }
462 } 462 }
463 463
464 public void TriggerOnClientMovement(ScenePresence avatar) 464 public void TriggerOnClientMovement(ScenePresence avatar)
@@ -479,7 +479,7 @@ namespace OpenSim.Region.Framework.Scenes
479 e.Message, e.StackTrace); 479 e.Message, e.StackTrace);
480 } 480 }
481 } 481 }
482 } 482 }
483 } 483 }
484 484
485 public void TriggerPermissionError(UUID user, string reason) 485 public void TriggerPermissionError(UUID user, string reason)
@@ -500,7 +500,7 @@ namespace OpenSim.Region.Framework.Scenes
500 e.Message, e.StackTrace); 500 e.Message, e.StackTrace);
501 } 501 }
502 } 502 }
503 } 503 }
504 } 504 }
505 505
506 public void TriggerOnPluginConsole(string[] args) 506 public void TriggerOnPluginConsole(string[] args)
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
521 e.Message, e.StackTrace); 521 e.Message, e.StackTrace);
522 } 522 }
523 } 523 }
524 } 524 }
525 } 525 }
526 526
527 public void TriggerOnFrame() 527 public void TriggerOnFrame()
@@ -542,11 +542,11 @@ namespace OpenSim.Region.Framework.Scenes
542 e.Message, e.StackTrace); 542 e.Message, e.StackTrace);
543 } 543 }
544 } 544 }
545 } 545 }
546 } 546 }
547 547
548 public void TriggerOnNewClient(IClientAPI client) 548 public void TriggerOnNewClient(IClientAPI client)
549 { 549 {
550 OnNewClientDelegate handlerNewClient = OnNewClient; 550 OnNewClientDelegate handlerNewClient = OnNewClient;
551 if (handlerNewClient != null) 551 if (handlerNewClient != null)
552 { 552 {
@@ -563,10 +563,10 @@ namespace OpenSim.Region.Framework.Scenes
563 e.Message, e.StackTrace); 563 e.Message, e.StackTrace);
564 } 564 }
565 } 565 }
566 } 566 }
567 567
568 if (client is IClientCore) 568 if (client is IClientCore)
569 { 569 {
570 OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect; 570 OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
571 if (handlerClientConnect != null) 571 if (handlerClientConnect != null)
572 { 572 {
@@ -583,7 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
583 e.Message, e.StackTrace); 583 e.Message, e.StackTrace);
584 } 584 }
585 } 585 }
586 } 586 }
587 } 587 }
588 } 588 }
589 589
@@ -605,11 +605,11 @@ namespace OpenSim.Region.Framework.Scenes
605 e.Message, e.StackTrace); 605 e.Message, e.StackTrace);
606 } 606 }
607 } 607 }
608 } 608 }
609 } 609 }
610 610
611 public void TriggerOnRemovePresence(UUID agentId) 611 public void TriggerOnRemovePresence(UUID agentId)
612 { 612 {
613 OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence; 613 OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
614 if (handlerRemovePresence != null) 614 if (handlerRemovePresence != null)
615 { 615 {
@@ -626,11 +626,11 @@ namespace OpenSim.Region.Framework.Scenes
626 e.Message, e.StackTrace); 626 e.Message, e.StackTrace);
627 } 627 }
628 } 628 }
629 } 629 }
630 } 630 }
631 631
632 public void TriggerOnBackup(IRegionDataStore dstore) 632 public void TriggerOnBackup(IRegionDataStore dstore)
633 { 633 {
634 OnBackupDelegate handlerOnAttach = OnBackup; 634 OnBackupDelegate handlerOnAttach = OnBackup;
635 if (handlerOnAttach != null) 635 if (handlerOnAttach != null)
636 { 636 {
@@ -647,7 +647,7 @@ namespace OpenSim.Region.Framework.Scenes
647 e.Message, e.StackTrace); 647 e.Message, e.StackTrace);
648 } 648 }
649 } 649 }
650 } 650 }
651 } 651 }
652 652
653 public void TriggerParcelPrimCountUpdate() 653 public void TriggerParcelPrimCountUpdate()
@@ -668,7 +668,7 @@ namespace OpenSim.Region.Framework.Scenes
668 e.Message, e.StackTrace); 668 e.Message, e.StackTrace);
669 } 669 }
670 } 670 }
671 } 671 }
672 } 672 }
673 673
674 public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) 674 public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
@@ -689,7 +689,7 @@ namespace OpenSim.Region.Framework.Scenes
689 e.Message, e.StackTrace); 689 e.Message, e.StackTrace);
690 } 690 }
691 } 691 }
692 } 692 }
693 } 693 }
694 694
695 public void TriggerTerrainTick() 695 public void TriggerTerrainTick()
@@ -710,7 +710,7 @@ namespace OpenSim.Region.Framework.Scenes
710 e.Message, e.StackTrace); 710 e.Message, e.StackTrace);
711 } 711 }
712 } 712 }
713 } 713 }
714 } 714 }
715 715
716 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) 716 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
@@ -731,7 +731,7 @@ namespace OpenSim.Region.Framework.Scenes
731 e.Message, e.StackTrace); 731 e.Message, e.StackTrace);
732 } 732 }
733 } 733 }
734 } 734 }
735 } 735 }
736 736
737 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 737 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
@@ -752,11 +752,11 @@ namespace OpenSim.Region.Framework.Scenes
752 e.Message, e.StackTrace); 752 e.Message, e.StackTrace);
753 } 753 }
754 } 754 }
755 } 755 }
756 } 756 }
757 757
758 public void TriggerShutdown() 758 public void TriggerShutdown()
759 { 759 {
760 OnShutdownDelegate handlerShutdown = OnShutdown; 760 OnShutdownDelegate handlerShutdown = OnShutdown;
761 if (handlerShutdown != null) 761 if (handlerShutdown != null)
762 { 762 {
@@ -773,11 +773,11 @@ namespace OpenSim.Region.Framework.Scenes
773 e.Message, e.StackTrace); 773 e.Message, e.StackTrace);
774 } 774 }
775 } 775 }
776 } 776 }
777 } 777 }
778 778
779 public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 779 public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
780 { 780 {
781 ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; 781 ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
782 if (handlerObjectGrab != null) 782 if (handlerObjectGrab != null)
783 { 783 {
@@ -794,11 +794,11 @@ namespace OpenSim.Region.Framework.Scenes
794 e.Message, e.StackTrace); 794 e.Message, e.StackTrace);
795 } 795 }
796 } 796 }
797 } 797 }
798 } 798 }
799 799
800 public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 800 public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
801 { 801 {
802 ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; 802 ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
803 if (handlerObjectGrabbing != null) 803 if (handlerObjectGrabbing != null)
804 { 804 {
@@ -815,11 +815,11 @@ namespace OpenSim.Region.Framework.Scenes
815 e.Message, e.StackTrace); 815 e.Message, e.StackTrace);
816 } 816 }
817 } 817 }
818 } 818 }
819 } 819 }
820 820
821 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 821 public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
822 { 822 {
823 ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; 823 ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
824 if (handlerObjectDeGrab != null) 824 if (handlerObjectDeGrab != null)
825 { 825 {
@@ -836,11 +836,11 @@ namespace OpenSim.Region.Framework.Scenes
836 e.Message, e.StackTrace); 836 e.Message, e.StackTrace);
837 } 837 }
838 } 838 }
839 } 839 }
840 } 840 }
841 841
842 public void TriggerScriptReset(uint localID, UUID itemID) 842 public void TriggerScriptReset(uint localID, UUID itemID)
843 { 843 {
844 ScriptResetDelegate handlerScriptReset = OnScriptReset; 844 ScriptResetDelegate handlerScriptReset = OnScriptReset;
845 if (handlerScriptReset != null) 845 if (handlerScriptReset != null)
846 { 846 {
@@ -857,11 +857,11 @@ namespace OpenSim.Region.Framework.Scenes
857 e.Message, e.StackTrace); 857 e.Message, e.StackTrace);
858 } 858 }
859 } 859 }
860 } 860 }
861 } 861 }
862 862
863 public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 863 public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
864 { 864 {
865 NewRezScript handlerRezScript = OnRezScript; 865 NewRezScript handlerRezScript = OnRezScript;
866 if (handlerRezScript != null) 866 if (handlerRezScript != null)
867 { 867 {
@@ -878,7 +878,7 @@ namespace OpenSim.Region.Framework.Scenes
878 e.Message, e.StackTrace); 878 e.Message, e.StackTrace);
879 } 879 }
880 } 880 }
881 } 881 }
882 } 882 }
883 883
884 public void TriggerStartScript(uint localID, UUID itemID) 884 public void TriggerStartScript(uint localID, UUID itemID)
@@ -899,7 +899,7 @@ namespace OpenSim.Region.Framework.Scenes
899 e.Message, e.StackTrace); 899 e.Message, e.StackTrace);
900 } 900 }
901 } 901 }
902 } 902 }
903 } 903 }
904 904
905 public void TriggerStopScript(uint localID, UUID itemID) 905 public void TriggerStopScript(uint localID, UUID itemID)
@@ -920,11 +920,11 @@ namespace OpenSim.Region.Framework.Scenes
920 e.Message, e.StackTrace); 920 e.Message, e.StackTrace);
921 } 921 }
922 } 922 }
923 } 923 }
924 } 924 }
925 925
926 public void TriggerRemoveScript(uint localID, UUID itemID) 926 public void TriggerRemoveScript(uint localID, UUID itemID)
927 { 927 {
928 RemoveScript handlerRemoveScript = OnRemoveScript; 928 RemoveScript handlerRemoveScript = OnRemoveScript;
929 if (handlerRemoveScript != null) 929 if (handlerRemoveScript != null)
930 { 930 {
@@ -941,7 +941,7 @@ namespace OpenSim.Region.Framework.Scenes
941 e.Message, e.StackTrace); 941 e.Message, e.StackTrace);
942 } 942 }
943 } 943 }
944 } 944 }
945 } 945 }
946 946
947 public bool TriggerGroupMove(UUID groupID, Vector3 delta) 947 public bool TriggerGroupMove(UUID groupID, Vector3 delta)
@@ -1040,7 +1040,7 @@ namespace OpenSim.Region.Framework.Scenes
1040 e.Message, e.StackTrace); 1040 e.Message, e.StackTrace);
1041 } 1041 }
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 public void TriggerLandObjectAdded(ILandObject newParcel) 1046 public void TriggerLandObjectAdded(ILandObject newParcel)
@@ -1061,7 +1061,7 @@ namespace OpenSim.Region.Framework.Scenes
1061 e.Message, e.StackTrace); 1061 e.Message, e.StackTrace);
1062 } 1062 }
1063 } 1063 }
1064 } 1064 }
1065 } 1065 }
1066 1066
1067 public void TriggerLandObjectRemoved(UUID globalID) 1067 public void TriggerLandObjectRemoved(UUID globalID)
@@ -1082,7 +1082,7 @@ namespace OpenSim.Region.Framework.Scenes
1082 e.Message, e.StackTrace); 1082 e.Message, e.StackTrace);
1083 } 1083 }
1084 } 1084 }
1085 } 1085 }
1086 } 1086 }
1087 1087
1088 public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) 1088 public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
@@ -1108,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes
1108 e.Message, e.StackTrace); 1108 e.Message, e.StackTrace);
1109 } 1109 }
1110 } 1110 }
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 public void TriggerIncomingInstantMessage(GridInstantMessage message) 1114 public void TriggerIncomingInstantMessage(GridInstantMessage message)
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
1129 e.Message, e.StackTrace); 1129 e.Message, e.StackTrace);
1130 } 1130 }
1131 } 1131 }
1132 } 1132 }
1133 } 1133 }
1134 1134
1135 public void TriggerUnhandledInstantMessage(GridInstantMessage message) 1135 public void TriggerUnhandledInstantMessage(GridInstantMessage message)
@@ -1150,7 +1150,7 @@ namespace OpenSim.Region.Framework.Scenes
1150 e.Message, e.StackTrace); 1150 e.Message, e.StackTrace);
1151 } 1151 }
1152 } 1152 }
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 public void TriggerClientClosed(UUID ClientID, Scene scene) 1156 public void TriggerClientClosed(UUID ClientID, Scene scene)
@@ -1171,7 +1171,7 @@ namespace OpenSim.Region.Framework.Scenes
1171 e.Message, e.StackTrace); 1171 e.Message, e.StackTrace);
1172 } 1172 }
1173 } 1173 }
1174 } 1174 }
1175 } 1175 }
1176 1176
1177 public void TriggerOnMakeChildAgent(ScenePresence presence) 1177 public void TriggerOnMakeChildAgent(ScenePresence presence)
@@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes
1192 e.Message, e.StackTrace); 1192 e.Message, e.StackTrace);
1193 } 1193 }
1194 } 1194 }
1195 } 1195 }
1196 } 1196 }
1197 1197
1198 public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user) 1198 public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user)
@@ -1231,7 +1231,7 @@ namespace OpenSim.Region.Framework.Scenes
1231 e.Message, e.StackTrace); 1231 e.Message, e.StackTrace);
1232 } 1232 }
1233 } 1233 }
1234 } 1234 }
1235 } 1235 }
1236 1236
1237 public void TriggerOnIncomingSceneObject(SceneObjectGroup so) 1237 public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
@@ -1251,12 +1251,12 @@ namespace OpenSim.Region.Framework.Scenes
1251 "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}", 1251 "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
1252 e.Message, e.StackTrace); 1252 e.Message, e.StackTrace);
1253 } 1253 }
1254 } 1254 }
1255 } 1255 }
1256 } 1256 }
1257 1257
1258 public void TriggerOnRegisterCaps(UUID agentID, Caps caps) 1258 public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
1259 { 1259 {
1260 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; 1260 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
1261 if (handlerRegisterCaps != null) 1261 if (handlerRegisterCaps != null)
1262 { 1262 {
@@ -1273,7 +1273,7 @@ namespace OpenSim.Region.Framework.Scenes
1273 e.Message, e.StackTrace); 1273 e.Message, e.StackTrace);
1274 } 1274 }
1275 } 1275 }
1276 } 1276 }
1277 } 1277 }
1278 1278
1279 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) 1279 public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
@@ -1294,7 +1294,7 @@ namespace OpenSim.Region.Framework.Scenes
1294 e.Message, e.StackTrace); 1294 e.Message, e.StackTrace);
1295 } 1295 }
1296 } 1296 }
1297 } 1297 }
1298 } 1298 }
1299 1299
1300 public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) 1300 public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
@@ -1315,7 +1315,7 @@ namespace OpenSim.Region.Framework.Scenes
1315 e.Message, e.StackTrace); 1315 e.Message, e.StackTrace);
1316 } 1316 }
1317 } 1317 }
1318 } 1318 }
1319 } 1319 }
1320 1320
1321 public void TriggerLandBuy(Object sender, LandBuyArgs args) 1321 public void TriggerLandBuy(Object sender, LandBuyArgs args)
@@ -1336,7 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes
1336 e.Message, e.StackTrace); 1336 e.Message, e.StackTrace);
1337 } 1337 }
1338 } 1338 }
1339 } 1339 }
1340 } 1340 }
1341 1341
1342 public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) 1342 public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
@@ -1357,11 +1357,11 @@ namespace OpenSim.Region.Framework.Scenes
1357 e.Message, e.StackTrace); 1357 e.Message, e.StackTrace);
1358 } 1358 }
1359 } 1359 }
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) 1363 public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
1364 { 1364 {
1365 ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent; 1365 ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
1366 if (handlerScriptAtTargetEvent != null) 1366 if (handlerScriptAtTargetEvent != null)
1367 { 1367 {
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
1378 e.Message, e.StackTrace); 1378 e.Message, e.StackTrace);
1379 } 1379 }
1380 } 1380 }
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 public void TriggerNotAtTargetEvent(uint localID) 1384 public void TriggerNotAtTargetEvent(uint localID)
@@ -1399,11 +1399,11 @@ namespace OpenSim.Region.Framework.Scenes
1399 e.Message, e.StackTrace); 1399 e.Message, e.StackTrace);
1400 } 1400 }
1401 } 1401 }
1402 } 1402 }
1403 } 1403 }
1404 1404
1405 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) 1405 public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
1406 { 1406 {
1407 ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; 1407 ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
1408 if (handlerScriptAtRotTargetEvent != null) 1408 if (handlerScriptAtRotTargetEvent != null)
1409 { 1409 {
@@ -1420,7 +1420,7 @@ namespace OpenSim.Region.Framework.Scenes
1420 e.Message, e.StackTrace); 1420 e.Message, e.StackTrace);
1421 } 1421 }
1422 } 1422 }
1423 } 1423 }
1424 } 1424 }
1425 1425
1426 public void TriggerNotAtRotTargetEvent(uint localID) 1426 public void TriggerNotAtRotTargetEvent(uint localID)
@@ -1441,7 +1441,7 @@ namespace OpenSim.Region.Framework.Scenes
1441 e.Message, e.StackTrace); 1441 e.Message, e.StackTrace);
1442 } 1442 }
1443 } 1443 }
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 public void TriggerRequestChangeWaterHeight(float height) 1447 public void TriggerRequestChangeWaterHeight(float height)
@@ -1462,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes
1462 e.Message, e.StackTrace); 1462 e.Message, e.StackTrace);
1463 } 1463 }
1464 } 1464 }
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) 1468 public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
@@ -1483,7 +1483,7 @@ namespace OpenSim.Region.Framework.Scenes
1483 e.Message, e.StackTrace); 1483 e.Message, e.StackTrace);
1484 } 1484 }
1485 } 1485 }
1486 } 1486 }
1487 } 1487 }
1488 1488
1489 public void TriggerSignificantClientMovement(IClientAPI client) 1489 public void TriggerSignificantClientMovement(IClientAPI client)
@@ -1504,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes
1504 e.Message, e.StackTrace); 1504 e.Message, e.StackTrace);
1505 } 1505 }
1506 } 1506 }
1507 } 1507 }
1508 } 1508 }
1509 1509
1510 public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) 1510 public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
@@ -1525,7 +1525,7 @@ namespace OpenSim.Region.Framework.Scenes
1525 e.Message, e.StackTrace); 1525 e.Message, e.StackTrace);
1526 } 1526 }
1527 } 1527 }
1528 } 1528 }
1529 } 1529 }
1530 1530
1531 public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) 1531 public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
@@ -1546,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes
1546 e.Message, e.StackTrace); 1546 e.Message, e.StackTrace);
1547 } 1547 }
1548 } 1548 }
1549 } 1549 }
1550 } 1550 }
1551 1551
1552 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1552 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
@@ -1567,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
1567 e.Message, e.StackTrace); 1567 e.Message, e.StackTrace);
1568 } 1568 }
1569 } 1569 }
1570 } 1570 }
1571 } 1571 }
1572 1572
1573 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) 1573 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
@@ -1588,7 +1588,7 @@ namespace OpenSim.Region.Framework.Scenes
1588 e.Message, e.StackTrace); 1588 e.Message, e.StackTrace);
1589 } 1589 }
1590 } 1590 }
1591 } 1591 }
1592 } 1592 }
1593 1593
1594 public void TriggerNoticeNoLandDataFromStorage() 1594 public void TriggerNoticeNoLandDataFromStorage()
@@ -1609,7 +1609,7 @@ namespace OpenSim.Region.Framework.Scenes
1609 e.Message, e.StackTrace); 1609 e.Message, e.StackTrace);
1610 } 1610 }
1611 } 1611 }
1612 } 1612 }
1613 } 1613 }
1614 1614
1615 public void TriggerIncomingLandDataFromStorage(List<LandData> landData) 1615 public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
@@ -1630,7 +1630,7 @@ namespace OpenSim.Region.Framework.Scenes
1630 e.Message, e.StackTrace); 1630 e.Message, e.StackTrace);
1631 } 1631 }
1632 } 1632 }
1633 } 1633 }
1634 } 1634 }
1635 1635
1636 public void TriggerSetAllowForcefulBan(bool allow) 1636 public void TriggerSetAllowForcefulBan(bool allow)
@@ -1651,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes
1651 e.Message, e.StackTrace); 1651 e.Message, e.StackTrace);
1652 } 1652 }
1653 } 1653 }
1654 } 1654 }
1655 } 1655 }
1656 1656
1657 public void TriggerRequestParcelPrimCountUpdate() 1657 public void TriggerRequestParcelPrimCountUpdate()
@@ -1672,7 +1672,7 @@ namespace OpenSim.Region.Framework.Scenes
1672 e.Message, e.StackTrace); 1672 e.Message, e.StackTrace);
1673 } 1673 }
1674 } 1674 }
1675 } 1675 }
1676 } 1676 }
1677 1677
1678 public void TriggerParcelPrimCountTainted() 1678 public void TriggerParcelPrimCountTainted()
@@ -1693,7 +1693,7 @@ namespace OpenSim.Region.Framework.Scenes
1693 e.Message, e.StackTrace); 1693 e.Message, e.StackTrace);
1694 } 1694 }
1695 } 1695 }
1696 } 1696 }
1697 } 1697 }
1698 1698
1699 // this lets us keep track of nasty script events like timer, etc. 1699 // this lets us keep track of nasty script events like timer, etc.
@@ -1732,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes
1732 e.Message, e.StackTrace); 1732 e.Message, e.StackTrace);
1733 } 1733 }
1734 } 1734 }
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 public float GetCurrentTimeAsSunLindenHour() 1738 public float GetCurrentTimeAsSunLindenHour()
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Framework.Scenes
1759 } 1759 }
1760 1760
1761 public void TriggerOarFileLoaded(Guid requestId, string message) 1761 public void TriggerOarFileLoaded(Guid requestId, string message)
1762 { 1762 {
1763 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; 1763 OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
1764 if (handlerOarFileLoaded != null) 1764 if (handlerOarFileLoaded != null)
1765 { 1765 {
@@ -1776,7 +1776,7 @@ namespace OpenSim.Region.Framework.Scenes
1776 e.Message, e.StackTrace); 1776 e.Message, e.StackTrace);
1777 } 1777 }
1778 } 1778 }
1779 } 1779 }
1780 } 1780 }
1781 1781
1782 public void TriggerOarFileSaved(Guid requestId, string message) 1782 public void TriggerOarFileSaved(Guid requestId, string message)
@@ -1797,7 +1797,7 @@ namespace OpenSim.Region.Framework.Scenes
1797 e.Message, e.StackTrace); 1797 e.Message, e.StackTrace);
1798 } 1798 }
1799 } 1799 }
1800 } 1800 }
1801 } 1801 }
1802 1802
1803 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) 1803 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
@@ -1818,7 +1818,7 @@ namespace OpenSim.Region.Framework.Scenes
1818 e.Message, e.StackTrace); 1818 e.Message, e.StackTrace);
1819 } 1819 }
1820 } 1820 }
1821 } 1821 }
1822 } 1822 }
1823 1823
1824 public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) 1824 public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
@@ -1839,7 +1839,7 @@ namespace OpenSim.Region.Framework.Scenes
1839 e.Message, e.StackTrace); 1839 e.Message, e.StackTrace);
1840 } 1840 }
1841 } 1841 }
1842 } 1842 }
1843 } 1843 }
1844 1844
1845 public void TriggerScriptColliding(uint localId, ColliderArgs colliders) 1845 public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
@@ -1860,7 +1860,7 @@ namespace OpenSim.Region.Framework.Scenes
1860 e.Message, e.StackTrace); 1860 e.Message, e.StackTrace);
1861 } 1861 }
1862 } 1862 }
1863 } 1863 }
1864 } 1864 }
1865 1865
1866 public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) 1866 public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1881,7 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes
1881 e.Message, e.StackTrace); 1881 e.Message, e.StackTrace);
1882 } 1882 }
1883 } 1883 }
1884 } 1884 }
1885 } 1885 }
1886 1886
1887 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) 1887 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
@@ -1902,7 +1902,7 @@ namespace OpenSim.Region.Framework.Scenes
1902 e.Message, e.StackTrace); 1902 e.Message, e.StackTrace);
1903 } 1903 }
1904 } 1904 }
1905 } 1905 }
1906 } 1906 }
1907 1907
1908 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) 1908 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
@@ -1923,7 +1923,7 @@ namespace OpenSim.Region.Framework.Scenes
1923 e.Message, e.StackTrace); 1923 e.Message, e.StackTrace);
1924 } 1924 }
1925 } 1925 }
1926 } 1926 }
1927 } 1927 }
1928 1928
1929 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) 1929 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
@@ -1944,11 +1944,11 @@ namespace OpenSim.Region.Framework.Scenes
1944 e.Message, e.StackTrace); 1944 e.Message, e.StackTrace);
1945 } 1945 }
1946 } 1946 }
1947 } 1947 }
1948 } 1948 }
1949 1949
1950 public void TriggerSetRootAgentScene(UUID agentID, Scene scene) 1950 public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
1951 { 1951 {
1952 OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene; 1952 OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
1953 if (handlerSetRootAgentScene != null) 1953 if (handlerSetRootAgentScene != null)
1954 { 1954 {
@@ -1965,7 +1965,7 @@ namespace OpenSim.Region.Framework.Scenes
1965 e.Message, e.StackTrace); 1965 e.Message, e.StackTrace);
1966 } 1966 }
1967 } 1967 }
1968 } 1968 }
1969 } 1969 }
1970 1970
1971 public void TriggerOnRegionUp(GridRegion otherRegion) 1971 public void TriggerOnRegionUp(GridRegion otherRegion)
@@ -1986,7 +1986,7 @@ namespace OpenSim.Region.Framework.Scenes
1986 e.Message, e.StackTrace); 1986 e.Message, e.StackTrace);
1987 } 1987 }
1988 } 1988 }
1989 } 1989 }
1990 } 1990 }
1991 } 1991 }
1992} 1992}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4d357fd..ab0d397 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2003,6 +2003,23 @@ namespace OpenSim.Region.Framework.Scenes
2003 return; 2003 return;
2004 } 2004 }
2005 2005
2006 if (grp.RootPart.RETURN_AT_EDGE)
2007 {
2008 // We remove the object here
2009 try
2010 {
2011 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
2012 objects.Add(grp);
2013 SceneObjectGroup[] objectsArray = objects.ToArray();
2014 returnObjects(objectsArray, UUID.Zero);
2015 }
2016 catch (Exception)
2017 {
2018 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
2019 }
2020 return;
2021 }
2022
2006 int thisx = (int)RegionInfo.RegionLocX; 2023 int thisx = (int)RegionInfo.RegionLocX;
2007 int thisy = (int)RegionInfo.RegionLocY; 2024 int thisy = (int)RegionInfo.RegionLocY;
2008 Vector3 EastCross = new Vector3(0.1f,0,0); 2025 Vector3 EastCross = new Vector3(0.1f,0,0);
@@ -2071,19 +2088,25 @@ namespace OpenSim.Region.Framework.Scenes
2071 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); 2088 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2072 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) 2089 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2073 2090
2074 if (crossedBordery.BorderLine.Z > 0) 2091 try
2075 { 2092 {
2076 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2093 if (crossedBordery.BorderLine.Z > 0)
2077 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); 2094 {
2078 } 2095 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2079 else 2096 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2080 pos.Y = ((pos.Y + Constants.RegionSize)); 2097 }
2098 else
2099 pos.Y = ((pos.Y + Constants.RegionSize));
2081 2100
2082 newRegionHandle 2101 newRegionHandle
2083 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), 2102 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2084 (uint)((thisy + changeY) * Constants.RegionSize)); 2103 (uint)((thisy + changeY) * Constants.RegionSize));
2085 // x - 1 2104 // x - 1
2086 // y + 1 2105 // y + 1
2106 }
2107 catch (Exception ex)
2108 {
2109 }
2087 } 2110 }
2088 else 2111 else
2089 { 2112 {
@@ -2545,7 +2568,7 @@ namespace OpenSim.Region.Framework.Scenes
2545 AttachObject( 2568 AttachObject(
2546 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); 2569 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2547 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2570 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2548 grp.SendGroupFullUpdate(); 2571 grp.SendGroupFullUpdate();
2549 } 2572 }
2550 else 2573 else
2551 { 2574 {
@@ -2711,6 +2734,7 @@ namespace OpenSim.Region.Framework.Scenes
2711 client.OnGrabUpdate += ProcessObjectGrabUpdate; 2734 client.OnGrabUpdate += ProcessObjectGrabUpdate;
2712 client.OnDeGrabObject += ProcessObjectDeGrab; 2735 client.OnDeGrabObject += ProcessObjectDeGrab;
2713 client.OnUndo += m_sceneGraph.HandleUndo; 2736 client.OnUndo += m_sceneGraph.HandleUndo;
2737 client.OnRedo += m_sceneGraph.HandleRedo;
2714 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2738 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2715 client.OnObjectDrop += m_sceneGraph.DropObject; 2739 client.OnObjectDrop += m_sceneGraph.DropObject;
2716 client.OnObjectSaleInfo += ObjectSaleInfo; 2740 client.OnObjectSaleInfo += ObjectSaleInfo;
@@ -2865,6 +2889,7 @@ namespace OpenSim.Region.Framework.Scenes
2865 client.OnGrabObject -= ProcessObjectGrab; 2889 client.OnGrabObject -= ProcessObjectGrab;
2866 client.OnDeGrabObject -= ProcessObjectDeGrab; 2890 client.OnDeGrabObject -= ProcessObjectDeGrab;
2867 client.OnUndo -= m_sceneGraph.HandleUndo; 2891 client.OnUndo -= m_sceneGraph.HandleUndo;
2892 client.OnRedo -= m_sceneGraph.HandleRedo;
2868 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2893 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2869 client.OnObjectDrop -= m_sceneGraph.DropObject; 2894 client.OnObjectDrop -= m_sceneGraph.DropObject;
2870 client.OnObjectSaleInfo -= ObjectSaleInfo; 2895 client.OnObjectSaleInfo -= ObjectSaleInfo;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 1547f9a..5e798c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
262 /// Returns a new unallocated local ID 262 /// Returns a new unallocated local ID
263 /// </summary> 263 /// </summary>
264 /// <returns>A brand new local ID</returns> 264 /// <returns>A brand new local ID</returns>
265 protected internal uint AllocateLocalId() 265 public uint AllocateLocalId()
266 { 266 {
267 uint myID; 267 uint myID;
268 268
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 2c66719..e28d29f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -476,6 +476,15 @@ namespace OpenSim.Region.Framework.Scenes
476 part.Undo(); 476 part.Undo();
477 } 477 }
478 } 478 }
479 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
480 {
481 if (primId != UUID.Zero)
482 {
483 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
484 if (part != null)
485 part.Redo();
486 }
487 }
479 488
480 protected internal void HandleObjectGroupUpdate( 489 protected internal void HandleObjectGroupUpdate(
481 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) 490 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
@@ -669,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes
669 // it get cleaned up 678 // it get cleaned up
670 // 679 //
671 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 680 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
672 group.HasGroupChanged = false; 681 group.HasGroupChanged = false;
673 } 682 }
674 else 683 else
675 { 684 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4676a30..f35a7c5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -369,14 +369,23 @@ namespace OpenSim.Region.Framework.Scenes
369 } 369 }
370 370
371 lockPartsForRead(true); 371 lockPartsForRead(true);
372
373 if (RootPart.GetStatusSandbox())
372 { 374 {
373 foreach (SceneObjectPart part in m_parts.Values) 375 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
374 { 376 {
375 377 RootPart.ScriptSetPhysicsStatus(false);
376 part.GroupPosition = val; 378 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
377 379 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
380 return;
378 } 381 }
379 } 382 }
383
384 foreach (SceneObjectPart part in m_parts.Values)
385 {
386 part.GroupPosition = val;
387 }
388
380 lockPartsForRead(false); 389 lockPartsForRead(false);
381 390
382 //if (m_rootPart.PhysActor != null) 391 //if (m_rootPart.PhysActor != null)
@@ -470,6 +479,34 @@ namespace OpenSim.Region.Framework.Scenes
470 } 479 }
471 } 480 }
472 481
482 private SceneObjectPart m_PlaySoundMasterPrim = null;
483 public SceneObjectPart PlaySoundMasterPrim
484 {
485 get { return m_PlaySoundMasterPrim; }
486 set { m_PlaySoundMasterPrim = value; }
487 }
488
489 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
490 public List<SceneObjectPart> PlaySoundSlavePrims
491 {
492 get { return m_LoopSoundSlavePrims; }
493 set { m_LoopSoundSlavePrims = value; }
494 }
495
496 private SceneObjectPart m_LoopSoundMasterPrim = null;
497 public SceneObjectPart LoopSoundMasterPrim
498 {
499 get { return m_LoopSoundMasterPrim; }
500 set { m_LoopSoundMasterPrim = value; }
501 }
502
503 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
504 public List<SceneObjectPart> LoopSoundSlavePrims
505 {
506 get { return m_LoopSoundSlavePrims; }
507 set { m_LoopSoundSlavePrims = value; }
508 }
509
473 // The UUID for the Region this Object is in. 510 // The UUID for the Region this Object is in.
474 public UUID RegionUUID 511 public UUID RegionUUID
475 { 512 {
@@ -584,7 +621,7 @@ namespace OpenSim.Region.Framework.Scenes
584 621
585 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) 622 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
586 m_rootPart.ParentID = 0; 623 m_rootPart.ParentID = 0;
587 if (m_rootPart.LocalId==0) 624 if (m_rootPart.LocalId == 0)
588 m_rootPart.LocalId = m_scene.AllocateLocalId(); 625 m_rootPart.LocalId = m_scene.AllocateLocalId();
589 626
590 // No need to lock here since the object isn't yet in a scene 627 // No need to lock here since the object isn't yet in a scene
@@ -1586,6 +1623,9 @@ namespace OpenSim.Region.Framework.Scenes
1586 /// <param name="part"></param> 1623 /// <param name="part"></param>
1587 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) 1624 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1588 { 1625 {
1626// m_log.DebugFormat(
1627// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1628
1589 if (m_rootPart.UUID == part.UUID) 1629 if (m_rootPart.UUID == part.UUID)
1590 { 1630 {
1591 if (IsAttachment) 1631 if (IsAttachment)
@@ -2084,7 +2124,9 @@ namespace OpenSim.Region.Framework.Scenes
2084 2124
2085 foreach (SceneObjectPart part in m_parts.Values) 2125 foreach (SceneObjectPart part in m_parts.Values)
2086 { 2126 {
2087 2127 if (!IsSelected)
2128 part.UpdateLookAt();
2129
2088 part.SendScheduledUpdates(); 2130 part.SendScheduledUpdates();
2089 2131
2090 } 2132 }
@@ -2434,7 +2476,6 @@ namespace OpenSim.Region.Framework.Scenes
2434 2476
2435 AttachToBackup(); 2477 AttachToBackup();
2436 2478
2437
2438 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the 2479 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
2439 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and 2480 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
2440 // unmoved prims! 2481 // unmoved prims!
@@ -2449,9 +2490,10 @@ namespace OpenSim.Region.Framework.Scenes
2449 /// an independent SceneObjectGroup. 2490 /// an independent SceneObjectGroup.
2450 /// </summary> 2491 /// </summary>
2451 /// <param name="partID"></param> 2492 /// <param name="partID"></param>
2452 public void DelinkFromGroup(uint partID) 2493 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2494 public SceneObjectGroup DelinkFromGroup(uint partID)
2453 { 2495 {
2454 DelinkFromGroup(partID, true); 2496 return DelinkFromGroup(partID, true);
2455 } 2497 }
2456 2498
2457 /// <summary> 2499 /// <summary>
@@ -2460,28 +2502,39 @@ namespace OpenSim.Region.Framework.Scenes
2460 /// </summary> 2502 /// </summary>
2461 /// <param name="partID"></param> 2503 /// <param name="partID"></param>
2462 /// <param name="sendEvents"></param> 2504 /// <param name="sendEvents"></param>
2463 public void DelinkFromGroup(uint partID, bool sendEvents) 2505 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2506 public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
2464 { 2507 {
2465 SceneObjectPart linkPart = GetChildPart(partID); 2508 SceneObjectPart linkPart = GetChildPart(partID);
2466 2509
2467 if (linkPart != null) 2510 if (linkPart != null)
2468 { 2511 {
2469 DelinkFromGroup(linkPart, sendEvents); 2512 return DelinkFromGroup(linkPart, sendEvents);
2470 } 2513 }
2471 else 2514 else
2472 { 2515 {
2473 m_log.InfoFormat("[SCENE OBJECT GROUP]: " + 2516 m_log.WarnFormat("[SCENE OBJECT GROUP]: " +
2474 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}", 2517 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
2475 partID, LocalId, UUID); 2518 partID, LocalId, UUID);
2519
2520 return null;
2476 } 2521 }
2477 } 2522 }
2478 2523
2479 public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents) 2524 /// <summary>
2525 /// Delink the given prim from this group. The delinked prim is established as
2526 /// an independent SceneObjectGroup.
2527 /// </summary>
2528 /// <param name="partID"></param>
2529 /// <param name="sendEvents"></param>
2530 /// <returns>The object group of the newly delinked prim.</returns>
2531 public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
2480 { 2532 {
2481 linkPart.ClearUndoState();
2482// m_log.DebugFormat( 2533// m_log.DebugFormat(
2483// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 2534// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
2484// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 2535// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
2536
2537 linkPart.ClearUndoState();
2485 2538
2486 Quaternion worldRot = linkPart.GetWorldRotation(); 2539 Quaternion worldRot = linkPart.GetWorldRotation();
2487 2540
@@ -2536,6 +2589,8 @@ namespace OpenSim.Region.Framework.Scenes
2536 2589
2537 //HasGroupChanged = true; 2590 //HasGroupChanged = true;
2538 //ScheduleGroupForFullUpdate(); 2591 //ScheduleGroupForFullUpdate();
2592
2593 return objectGroup;
2539 } 2594 }
2540 2595
2541 /// <summary> 2596 /// <summary>
@@ -2574,7 +2629,6 @@ namespace OpenSim.Region.Framework.Scenes
2574 2629
2575 part.LinkNum = linkNum; 2630 part.LinkNum = linkNum;
2576 2631
2577
2578 part.OffsetPosition = part.GroupPosition - AbsolutePosition; 2632 part.OffsetPosition = part.GroupPosition - AbsolutePosition;
2579 2633
2580 Quaternion rootRotation = m_rootPart.RotationOffset; 2634 Quaternion rootRotation = m_rootPart.RotationOffset;
@@ -2604,11 +2658,14 @@ namespace OpenSim.Region.Framework.Scenes
2604 { 2658 {
2605 if (m_rootPart.PhysActor.IsPhysical) 2659 if (m_rootPart.PhysActor.IsPhysical)
2606 { 2660 {
2607 Vector3 llmoveforce = pos - AbsolutePosition; 2661 if (!m_rootPart.BlockGrab)
2608 Vector3 grabforce = llmoveforce; 2662 {
2609 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2663 Vector3 llmoveforce = pos - AbsolutePosition;
2610 m_rootPart.PhysActor.AddForce(grabforce,true); 2664 Vector3 grabforce = llmoveforce;
2611 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2665 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2666 m_rootPart.PhysActor.AddForce(grabforce, true);
2667 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2668 }
2612 } 2669 }
2613 else 2670 else
2614 { 2671 {
@@ -2966,6 +3023,7 @@ namespace OpenSim.Region.Framework.Scenes
2966 SceneObjectPart part = GetChildPart(localID); 3023 SceneObjectPart part = GetChildPart(localID);
2967 if (part != null) 3024 if (part != null)
2968 { 3025 {
3026 part.IgnoreUndoUpdate = true;
2969 if (scale.X > m_scene.m_maxNonphys) 3027 if (scale.X > m_scene.m_maxNonphys)
2970 scale.X = m_scene.m_maxNonphys; 3028 scale.X = m_scene.m_maxNonphys;
2971 if (scale.Y > m_scene.m_maxNonphys) 3029 if (scale.Y > m_scene.m_maxNonphys)
@@ -2992,6 +3050,7 @@ namespace OpenSim.Region.Framework.Scenes
2992 { 3050 {
2993 if (obPart.UUID != m_rootPart.UUID) 3051 if (obPart.UUID != m_rootPart.UUID)
2994 { 3052 {
3053 obPart.IgnoreUndoUpdate = true;
2995 Vector3 oldSize = new Vector3(obPart.Scale); 3054 Vector3 oldSize = new Vector3(obPart.Scale);
2996 3055
2997 float f = 1.0f; 3056 float f = 1.0f;
@@ -3050,6 +3109,8 @@ namespace OpenSim.Region.Framework.Scenes
3050 y *= a; 3109 y *= a;
3051 z *= a; 3110 z *= a;
3052 } 3111 }
3112 obPart.IgnoreUndoUpdate = false;
3113 obPart.StoreUndoState();
3053 } 3114 }
3054 } 3115 }
3055 } 3116 }
@@ -3066,6 +3127,7 @@ namespace OpenSim.Region.Framework.Scenes
3066 { 3127 {
3067 foreach (SceneObjectPart obPart in m_parts.Values) 3128 foreach (SceneObjectPart obPart in m_parts.Values)
3068 { 3129 {
3130 obPart.IgnoreUndoUpdate = true;
3069 if (obPart.UUID != m_rootPart.UUID) 3131 if (obPart.UUID != m_rootPart.UUID)
3070 { 3132 {
3071 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 3133 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -3079,6 +3141,8 @@ namespace OpenSim.Region.Framework.Scenes
3079 obPart.Resize(newSize); 3141 obPart.Resize(newSize);
3080 obPart.UpdateOffSet(currentpos); 3142 obPart.UpdateOffSet(currentpos);
3081 } 3143 }
3144 obPart.IgnoreUndoUpdate = false;
3145 obPart.StoreUndoState();
3082 } 3146 }
3083 } 3147 }
3084 lockPartsForRead(false); 3148 lockPartsForRead(false);
@@ -3089,6 +3153,8 @@ namespace OpenSim.Region.Framework.Scenes
3089 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 3153 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
3090 } 3154 }
3091 3155
3156 part.IgnoreUndoUpdate = false;
3157 part.StoreUndoState();
3092 HasGroupChanged = true; 3158 HasGroupChanged = true;
3093 ScheduleGroupForTerseUpdate(); 3159 ScheduleGroupForTerseUpdate();
3094 } 3160 }
@@ -3104,13 +3170,26 @@ namespace OpenSim.Region.Framework.Scenes
3104 /// <param name="pos"></param> 3170 /// <param name="pos"></param>
3105 public void UpdateGroupPosition(Vector3 pos) 3171 public void UpdateGroupPosition(Vector3 pos)
3106 { 3172 {
3173 foreach (SceneObjectPart part in Children.Values)
3174 {
3175 part.StoreUndoState();
3176 }
3107 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3177 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3108 { 3178 {
3109 if (IsAttachment) 3179 if (IsAttachment)
3110 { 3180 {
3111 m_rootPart.AttachedPos = pos; 3181 m_rootPart.AttachedPos = pos;
3112 } 3182 }
3113 3183 if (RootPart.GetStatusSandbox())
3184 {
3185 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
3186 {
3187 RootPart.ScriptSetPhysicsStatus(false);
3188 pos = AbsolutePosition;
3189 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
3190 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
3191 }
3192 }
3114 AbsolutePosition = pos; 3193 AbsolutePosition = pos;
3115 3194
3116 HasGroupChanged = true; 3195 HasGroupChanged = true;
@@ -3129,7 +3208,10 @@ namespace OpenSim.Region.Framework.Scenes
3129 public void UpdateSinglePosition(Vector3 pos, uint localID) 3208 public void UpdateSinglePosition(Vector3 pos, uint localID)
3130 { 3209 {
3131 SceneObjectPart part = GetChildPart(localID); 3210 SceneObjectPart part = GetChildPart(localID);
3132 3211 foreach (SceneObjectPart parts in Children.Values)
3212 {
3213 parts.StoreUndoState();
3214 }
3133 if (part != null) 3215 if (part != null)
3134 { 3216 {
3135 if (part.UUID == m_rootPart.UUID) 3217 if (part.UUID == m_rootPart.UUID)
@@ -3151,6 +3233,10 @@ namespace OpenSim.Region.Framework.Scenes
3151 /// <param name="pos"></param> 3233 /// <param name="pos"></param>
3152 private void UpdateRootPosition(Vector3 pos) 3234 private void UpdateRootPosition(Vector3 pos)
3153 { 3235 {
3236 foreach (SceneObjectPart part in Children.Values)
3237 {
3238 part.StoreUndoState();
3239 }
3154 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3240 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3155 Vector3 oldPos = 3241 Vector3 oldPos =
3156 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3242 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3195,6 +3281,10 @@ namespace OpenSim.Region.Framework.Scenes
3195 /// <param name="rot"></param> 3281 /// <param name="rot"></param>
3196 public void UpdateGroupRotationR(Quaternion rot) 3282 public void UpdateGroupRotationR(Quaternion rot)
3197 { 3283 {
3284 foreach (SceneObjectPart parts in Children.Values)
3285 {
3286 parts.StoreUndoState();
3287 }
3198 m_rootPart.UpdateRotation(rot); 3288 m_rootPart.UpdateRotation(rot);
3199 3289
3200 PhysicsActor actor = m_rootPart.PhysActor; 3290 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3215,6 +3305,10 @@ namespace OpenSim.Region.Framework.Scenes
3215 /// <param name="rot"></param> 3305 /// <param name="rot"></param>
3216 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 3306 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
3217 { 3307 {
3308 foreach (SceneObjectPart parts in Children.Values)
3309 {
3310 parts.StoreUndoState();
3311 }
3218 m_rootPart.UpdateRotation(rot); 3312 m_rootPart.UpdateRotation(rot);
3219 3313
3220 PhysicsActor actor = m_rootPart.PhysActor; 3314 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3238,6 +3332,10 @@ namespace OpenSim.Region.Framework.Scenes
3238 public void UpdateSingleRotation(Quaternion rot, uint localID) 3332 public void UpdateSingleRotation(Quaternion rot, uint localID)
3239 { 3333 {
3240 SceneObjectPart part = GetChildPart(localID); 3334 SceneObjectPart part = GetChildPart(localID);
3335 foreach (SceneObjectPart parts in Children.Values)
3336 {
3337 parts.StoreUndoState();
3338 }
3241 if (part != null) 3339 if (part != null)
3242 { 3340 {
3243 if (part.UUID == m_rootPart.UUID) 3341 if (part.UUID == m_rootPart.UUID)
@@ -3268,8 +3366,11 @@ namespace OpenSim.Region.Framework.Scenes
3268 } 3366 }
3269 else 3367 else
3270 { 3368 {
3369 part.IgnoreUndoUpdate = true;
3271 part.UpdateRotation(rot); 3370 part.UpdateRotation(rot);
3272 part.OffsetPosition = pos; 3371 part.OffsetPosition = pos;
3372 part.IgnoreUndoUpdate = false;
3373 part.StoreUndoState();
3273 } 3374 }
3274 } 3375 }
3275 } 3376 }
@@ -3283,6 +3384,7 @@ namespace OpenSim.Region.Framework.Scenes
3283 Quaternion axRot = rot; 3384 Quaternion axRot = rot;
3284 Quaternion oldParentRot = m_rootPart.RotationOffset; 3385 Quaternion oldParentRot = m_rootPart.RotationOffset;
3285 3386
3387 m_rootPart.StoreUndoState();
3286 m_rootPart.UpdateRotation(rot); 3388 m_rootPart.UpdateRotation(rot);
3287 if (m_rootPart.PhysActor != null) 3389 if (m_rootPart.PhysActor != null)
3288 { 3390 {
@@ -3291,23 +3393,33 @@ namespace OpenSim.Region.Framework.Scenes
3291 } 3393 }
3292 3394
3293 lockPartsForRead(true); 3395 lockPartsForRead(true);
3396
3397 foreach (SceneObjectPart prim in m_parts.Values)
3294 { 3398 {
3295 foreach (SceneObjectPart prim in m_parts.Values) 3399 if (prim.UUID != m_rootPart.UUID)
3296 { 3400 {
3297 if (prim.UUID != m_rootPart.UUID) 3401 prim.IgnoreUndoUpdate = true;
3298 { 3402 Vector3 axPos = prim.OffsetPosition;
3299 Vector3 axPos = prim.OffsetPosition; 3403 axPos *= oldParentRot;
3300 axPos *= oldParentRot; 3404 axPos *= Quaternion.Inverse(axRot);
3301 axPos *= Quaternion.Inverse(axRot); 3405 prim.OffsetPosition = axPos;
3302 prim.OffsetPosition = axPos; 3406 Quaternion primsRot = prim.RotationOffset;
3303 Quaternion primsRot = prim.RotationOffset; 3407 Quaternion newRot = primsRot * oldParentRot;
3304 Quaternion newRot = primsRot * oldParentRot; 3408 newRot *= Quaternion.Inverse(axRot);
3305 newRot *= Quaternion.Inverse(axRot); 3409 prim.RotationOffset = newRot;
3306 prim.RotationOffset = newRot; 3410 prim.ScheduleTerseUpdate();
3307 prim.ScheduleTerseUpdate(); 3411 }
3308 } 3412 }
3413
3414 foreach (SceneObjectPart childpart in Children.Values)
3415 {
3416 if (childpart != m_rootPart)
3417 {
3418 childpart.IgnoreUndoUpdate = false;
3419 childpart.StoreUndoState();
3309 } 3420 }
3310 } 3421 }
3422
3311 lockPartsForRead(false); 3423 lockPartsForRead(false);
3312 3424
3313 m_rootPart.ScheduleTerseUpdate(); 3425 m_rootPart.ScheduleTerseUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0d19589..e7f9f31 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 int[] PayPrice = {-2,-2,-2,-2,-2}; 150 public 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;
@@ -254,6 +278,7 @@ namespace OpenSim.Region.Framework.Scenes
254 private string m_text = String.Empty; 278 private string m_text = String.Empty;
255 private string m_touchName = String.Empty; 279 private string m_touchName = String.Empty;
256 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 280 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
281 private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5);
257 private UUID _creatorID; 282 private UUID _creatorID;
258 283
259 private bool m_passTouches; 284 private bool m_passTouches;
@@ -506,6 +531,27 @@ namespace OpenSim.Region.Framework.Scenes
506 } 531 }
507 } 532 }
508 533
534 [XmlIgnore]
535 public Quaternion APIDTarget
536 {
537 get { return m_APIDTarget; }
538 set { m_APIDTarget = value; }
539 }
540
541 [XmlIgnore]
542 public float APIDDamp
543 {
544 get { return m_APIDDamp; }
545 set { m_APIDDamp = value; }
546 }
547
548 [XmlIgnore]
549 public float APIDStrength
550 {
551 get { return m_APIDStrength; }
552 set { m_APIDStrength = value; }
553 }
554
509 public ulong RegionHandle 555 public ulong RegionHandle
510 { 556 {
511 get { return m_regionHandle; } 557 get { return m_regionHandle; }
@@ -517,6 +563,33 @@ namespace OpenSim.Region.Framework.Scenes
517 get { return m_scriptAccessPin; } 563 get { return m_scriptAccessPin; }
518 set { m_scriptAccessPin = (int)value; } 564 set { m_scriptAccessPin = (int)value; }
519 } 565 }
566 private SceneObjectPart m_PlaySoundMasterPrim = null;
567 public SceneObjectPart PlaySoundMasterPrim
568 {
569 get { return m_PlaySoundMasterPrim; }
570 set { m_PlaySoundMasterPrim = value; }
571 }
572
573 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
574 public List<SceneObjectPart> PlaySoundSlavePrims
575 {
576 get { return m_LoopSoundSlavePrims; }
577 set { m_LoopSoundSlavePrims = value; }
578 }
579
580 private SceneObjectPart m_LoopSoundMasterPrim = null;
581 public SceneObjectPart LoopSoundMasterPrim
582 {
583 get { return m_LoopSoundMasterPrim; }
584 set { m_LoopSoundMasterPrim = value; }
585 }
586
587 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
588 public List<SceneObjectPart> LoopSoundSlavePrims
589 {
590 get { return m_LoopSoundSlavePrims; }
591 set { m_LoopSoundSlavePrims = value; }
592 }
520 593
521 public Byte[] TextureAnimation 594 public Byte[] TextureAnimation
522 { 595 {
@@ -576,8 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
576 } 649 }
577 set 650 set
578 { 651 {
579 StoreUndoState();
580
581 m_groupPosition = value; 652 m_groupPosition = value;
582 PhysicsActor actor = PhysActor; 653 PhysicsActor actor = PhysActor;
583 if (actor != null) 654 if (actor != null)
@@ -1403,6 +1474,10 @@ namespace OpenSim.Region.Framework.Scenes
1403 { 1474 {
1404 m_undo.Clear(); 1475 m_undo.Clear();
1405 } 1476 }
1477 lock (m_redo)
1478 {
1479 m_redo.Clear();
1480 }
1406 StoreUndoState(); 1481 StoreUndoState();
1407 } 1482 }
1408 1483
@@ -1713,6 +1788,66 @@ namespace OpenSim.Region.Framework.Scenes
1713 return m_parentGroup.RootPart.DIE_AT_EDGE; 1788 return m_parentGroup.RootPart.DIE_AT_EDGE;
1714 } 1789 }
1715 1790
1791 public bool GetReturnAtEdge()
1792 {
1793 if (m_parentGroup == null)
1794 return false;
1795 if (m_parentGroup.IsDeleted)
1796 return false;
1797
1798 return m_parentGroup.RootPart.RETURN_AT_EDGE;
1799 }
1800
1801 public void SetReturnAtEdge(bool p)
1802 {
1803 if (m_parentGroup == null)
1804 return;
1805 if (m_parentGroup.IsDeleted)
1806 return;
1807
1808 m_parentGroup.RootPart.RETURN_AT_EDGE = p;
1809 }
1810
1811 public bool GetBlockGrab()
1812 {
1813 if (m_parentGroup == null)
1814 return false;
1815 if (m_parentGroup.IsDeleted)
1816 return false;
1817
1818 return m_parentGroup.RootPart.BlockGrab;
1819 }
1820
1821 public void SetBlockGrab(bool p)
1822 {
1823 if (m_parentGroup == null)
1824 return;
1825 if (m_parentGroup.IsDeleted)
1826 return;
1827
1828 m_parentGroup.RootPart.BlockGrab = p;
1829 }
1830
1831 public void SetStatusSandbox(bool p)
1832 {
1833 if (m_parentGroup == null)
1834 return;
1835 if (m_parentGroup.IsDeleted)
1836 return;
1837 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
1838 m_parentGroup.RootPart.StatusSandbox = p;
1839 }
1840
1841 public bool GetStatusSandbox()
1842 {
1843 if (m_parentGroup == null)
1844 return false;
1845 if (m_parentGroup.IsDeleted)
1846 return false;
1847
1848 return m_parentGroup.RootPart.StatusSandbox;
1849 }
1850
1716 public int GetAxisRotation(int axis) 1851 public int GetAxisRotation(int axis)
1717 { 1852 {
1718 //Cannot use ScriptBaseClass constants as no referance to it currently. 1853 //Cannot use ScriptBaseClass constants as no referance to it currently.
@@ -1924,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
1924 // play the sound. 2059 // play the sound.
1925 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2060 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
1926 { 2061 {
1927 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); 2062 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
1928 } 2063 }
1929 2064
1930 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) 2065 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
@@ -2499,9 +2634,8 @@ namespace OpenSim.Region.Framework.Scenes
2499 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2634 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
2500 foreach (ScenePresence p in avatarts) 2635 foreach (ScenePresence p in avatarts)
2501 { 2636 {
2502 // TODO: some filtering by distance of avatar 2637 if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100))
2503 2638 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2504 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2505 } 2639 }
2506 } 2640 }
2507 2641
@@ -2562,7 +2696,38 @@ namespace OpenSim.Region.Framework.Scenes
2562 2696
2563 public void RotLookAt(Quaternion target, float strength, float damping) 2697 public void RotLookAt(Quaternion target, float strength, float damping)
2564 { 2698 {
2565 m_parentGroup.rotLookAt(target, strength, damping); 2699 rotLookAt(target, strength, damping);
2700 }
2701
2702 public void rotLookAt(Quaternion target, float strength, float damping)
2703 {
2704 if (IsAttachment)
2705 {
2706 /*
2707 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2708 if (avatar != null)
2709 {
2710 Rotate the Av?
2711 } */
2712 }
2713 else
2714 {
2715 APIDDamp = damping;
2716 APIDStrength = strength;
2717 APIDTarget = target;
2718 }
2719 }
2720
2721 public void startLookAt(Quaternion rot, float damp, float strength)
2722 {
2723 APIDDamp = damp;
2724 APIDStrength = strength;
2725 APIDTarget = rot;
2726 }
2727
2728 public void stopLookAt()
2729 {
2730 APIDTarget = Quaternion.Identity;
2566 } 2731 }
2567 2732
2568 /// <summary> 2733 /// <summary>
@@ -2824,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes
2824 /// <param name="volume"></param> 2989 /// <param name="volume"></param>
2825 /// <param name="triggered"></param> 2990 /// <param name="triggered"></param>
2826 /// <param name="flags"></param> 2991 /// <param name="flags"></param>
2827 public void SendSound(string sound, double volume, bool triggered, byte flags) 2992 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2828 { 2993 {
2829 if (volume > 1) 2994 if (volume > 1)
2830 volume = 1; 2995 volume = 1;
@@ -2859,10 +3024,51 @@ namespace OpenSim.Region.Framework.Scenes
2859 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); 3024 ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>();
2860 if (soundModule != null) 3025 if (soundModule != null)
2861 { 3026 {
2862 if (triggered) 3027 if (useMaster)
2863 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); 3028 {
3029 if (isMaster)
3030 {
3031 if (triggered)
3032 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3033 else
3034 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3035 ParentGroup.PlaySoundMasterPrim = this;
3036 ownerID = this._ownerID;
3037 objectID = this.UUID;
3038 parentID = this.GetRootPartUUID();
3039 position = this.AbsolutePosition; // region local
3040 regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle;
3041 if (triggered)
3042 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3043 else
3044 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3045 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
3046 {
3047 ownerID = prim._ownerID;
3048 objectID = prim.UUID;
3049 parentID = prim.GetRootPartUUID();
3050 position = prim.AbsolutePosition; // region local
3051 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
3052 if (triggered)
3053 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3054 else
3055 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3056 }
3057 ParentGroup.PlaySoundSlavePrims.Clear();
3058 ParentGroup.PlaySoundMasterPrim = null;
3059 }
3060 else
3061 {
3062 ParentGroup.PlaySoundSlavePrims.Add(this);
3063 }
3064 }
2864 else 3065 else
2865 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); 3066 {
3067 if (triggered)
3068 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
3069 else
3070 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
3071 }
2866 } 3072 }
2867 } 3073 }
2868 3074
@@ -3181,6 +3387,14 @@ namespace OpenSim.Region.Framework.Scenes
3181 hasProfileCut = hasDimple; // is it the same thing? 3387 hasProfileCut = hasDimple; // is it the same thing?
3182 } 3388 }
3183 3389
3390 public void SetVehicleFlags(int param, bool remove)
3391 {
3392 if (PhysActor != null)
3393 {
3394 PhysActor.VehicleFlags(param, remove);
3395 }
3396 }
3397
3184 public void SetGroup(UUID groupID, IClientAPI client) 3398 public void SetGroup(UUID groupID, IClientAPI client)
3185 { 3399 {
3186 _groupID = groupID; 3400 _groupID = groupID;
@@ -3285,27 +3499,30 @@ namespace OpenSim.Region.Framework.Scenes
3285 { 3499 {
3286 if (!Undoing) 3500 if (!Undoing)
3287 { 3501 {
3288 if (m_parentGroup != null) 3502 if (!IgnoreUndoUpdate)
3289 { 3503 {
3290 lock (m_undo) 3504 if (m_parentGroup != null)
3291 { 3505 {
3292 if (m_undo.Count > 0) 3506 lock (m_undo)
3293 { 3507 {
3294 UndoState last = m_undo.Peek(); 3508 if (m_undo.Count > 0)
3295 if (last != null)
3296 { 3509 {
3297 if (last.Compare(this)) 3510 UndoState last = m_undo.Peek();
3298 return; 3511 if (last != null)
3512 {
3513 if (last.Compare(this))
3514 return;
3515 }
3299 } 3516 }
3300 }
3301 3517
3302 if (m_parentGroup.GetSceneMaxUndo() > 0) 3518 if (m_parentGroup.GetSceneMaxUndo() > 0)
3303 { 3519 {
3304 UndoState nUndo = new UndoState(this); 3520 UndoState nUndo = new UndoState(this);
3305 3521
3306 m_undo.Push(nUndo); 3522 m_undo.Push(nUndo);
3307 } 3523 }
3308 3524
3525 }
3309 } 3526 }
3310 } 3527 }
3311 } 3528 }
@@ -3776,14 +3993,39 @@ namespace OpenSim.Region.Framework.Scenes
3776 lock (m_undo) 3993 lock (m_undo)
3777 { 3994 {
3778 if (m_undo.Count > 0) 3995 if (m_undo.Count > 0)
3996 {
3997 UndoState nUndo = null;
3998 if (m_parentGroup.GetSceneMaxUndo() > 0)
3779 { 3999 {
3780 UndoState goback = m_undo.Pop(); 4000 nUndo = new UndoState(this);
3781 if (goback != null) 4001 }
3782 goback.PlaybackState(this); 4002 UndoState goback = m_undo.Pop();
4003 if (goback != null)
4004 {
4005 goback.PlaybackState(this);
4006 if (nUndo != null)
4007 m_redo.Push(nUndo);
4008 }
3783 } 4009 }
3784 } 4010 }
3785 } 4011 }
3786 4012
4013 public void Redo()
4014 {
4015 lock (m_redo)
4016 {
4017 if (m_parentGroup.GetSceneMaxUndo() > 0)
4018 {
4019 UndoState nUndo = new UndoState(this);
4020
4021 m_undo.Push(nUndo);
4022 }
4023 UndoState gofwd = m_redo.Pop();
4024 if (gofwd != null)
4025 gofwd.PlayfwdState(this);
4026 }
4027 }
4028
3787 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 4029 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
3788 { 4030 {
3789 m_shape.ReadInUpdateExtraParam(type, inUse, data); 4031 m_shape.ReadInUpdateExtraParam(type, inUse, data);
@@ -3827,6 +4069,18 @@ namespace OpenSim.Region.Framework.Scenes
3827 (pos.Z != OffsetPosition.Z)) 4069 (pos.Z != OffsetPosition.Z))
3828 { 4070 {
3829 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 4071 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4072
4073 if (ParentGroup.RootPart.GetStatusSandbox())
4074 {
4075 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
4076 {
4077 ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
4078 newPos = OffsetPosition;
4079 ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
4080 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
4081 }
4082 }
4083
3830 OffsetPosition = newPos; 4084 OffsetPosition = newPos;
3831 ScheduleTerseUpdate(); 4085 ScheduleTerseUpdate();
3832 } 4086 }
@@ -4119,7 +4373,6 @@ namespace OpenSim.Region.Framework.Scenes
4119 (rot.Z != RotationOffset.Z) || 4373 (rot.Z != RotationOffset.Z) ||
4120 (rot.W != RotationOffset.W)) 4374 (rot.W != RotationOffset.W))
4121 { 4375 {
4122 //StoreUndoState();
4123 RotationOffset = rot; 4376 RotationOffset = rot;
4124 ParentGroup.HasGroupChanged = true; 4377 ParentGroup.HasGroupChanged = true;
4125 ScheduleTerseUpdate(); 4378 ScheduleTerseUpdate();
@@ -4303,7 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes
4303 else 4556 else
4304 { 4557 {
4305// m_log.DebugFormat( 4558// m_log.DebugFormat(
4306// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); 4559// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId);
4307 ScheduleFullUpdate(); 4560 ScheduleFullUpdate();
4308 } 4561 }
4309 } 4562 }
@@ -4421,5 +4674,41 @@ namespace OpenSim.Region.Framework.Scenes
4421 4674
4422 Inventory.ApplyNextOwnerPermissions(); 4675 Inventory.ApplyNextOwnerPermissions();
4423 } 4676 }
4677 public void UpdateLookAt()
4678 {
4679 try
4680 {
4681 if (APIDTarget != Quaternion.Identity)
4682 {
4683 if (Single.IsNaN(APIDTarget.W) == true)
4684 {
4685 APIDTarget = Quaternion.Identity;
4686 return;
4687 }
4688 Quaternion rot = RotationOffset;
4689 Quaternion dir = (rot - APIDTarget);
4690 float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f));
4691 if (dir.Z > speed)
4692 {
4693 rot.Z -= speed;
4694 }
4695 if (dir.Z < -speed)
4696 {
4697 rot.Z += speed;
4698 }
4699 rot.Normalize();
4700 UpdateRotation(rot);
4701 }
4702 }
4703 catch (Exception ex)
4704 {
4705 m_log.Error("[Physics] " + ex);
4706 }
4707 }
4708
4709 public Color4 GetTextColor()
4710 {
4711 return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A));
4712 }
4424 } 4713 }
4425} 4714}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3317dd3..5d00917 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -318,8 +318,6 @@ namespace OpenSim.Region.Framework.Scenes
318 } 318 }
319 } 319 }
320 320
321 static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
322
323 private void RestoreSavedScriptState(UUID oldID, UUID newID) 321 private void RestoreSavedScriptState(UUID oldID, UUID newID)
324 { 322 {
325 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 323 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
@@ -585,7 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
585 m_items.TryGetValue(itemId, out item); 583 m_items.TryGetValue(itemId, out item);
586 m_items.LockItemsForRead(false); 584 m_items.LockItemsForRead(false);
587 return item; 585 return item;
588 } 586 }
589 587
590 /// <summary> 588 /// <summary>
591 /// Get inventory items by name. 589 /// Get inventory items by name.
@@ -594,7 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
594 /// <returns> 592 /// <returns>
595 /// A list of inventory items with that name. 593 /// A list of inventory items with that name.
596 /// If no inventory item has that name then an empty list is returned. 594 /// If no inventory item has that name then an empty list is returned.
597 /// </returns> 595 /// </returns>
598 public IList<TaskInventoryItem> GetInventoryItems(string name) 596 public IList<TaskInventoryItem> GetInventoryItems(string name)
599 { 597 {
600 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); 598 IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6a2ab02..123d6f3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -167,6 +167,8 @@ namespace OpenSim.Region.Framework.Scenes
167 167
168 private Quaternion m_bodyRot= Quaternion.Identity; 168 private Quaternion m_bodyRot= Quaternion.Identity;
169 169
170 private Quaternion m_bodyRotPrevious = Quaternion.Identity;
171
170 private const int LAND_VELOCITYMAG_MAX = 12; 172 private const int LAND_VELOCITYMAG_MAX = 12;
171 173
172 public bool IsRestrictedToRegion; 174 public bool IsRestrictedToRegion;
@@ -233,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes
233 // Agent's Draw distance. 235 // Agent's Draw distance.
234 protected float m_DrawDistance; 236 protected float m_DrawDistance;
235 237
236 protected AvatarAppearance m_appearance; 238 protected AvatarAppearance m_appearance;
237 239
238 // neighbouring regions we have enabled a child agent in 240 // neighbouring regions we have enabled a child agent in
239 // holds the seed cap for the child agent in that region 241 // holds the seed cap for the child agent in that region
@@ -518,6 +520,12 @@ namespace OpenSim.Region.Framework.Scenes
518 set { m_bodyRot = value; } 520 set { m_bodyRot = value; }
519 } 521 }
520 522
523 public Quaternion PreviousRotation
524 {
525 get { return m_bodyRotPrevious; }
526 set { m_bodyRotPrevious = value; }
527 }
528
521 /// <summary> 529 /// <summary>
522 /// If this is true, agent doesn't have a representation in this scene. 530 /// If this is true, agent doesn't have a representation in this scene.
523 /// this is an agent 'looking into' this scene from a nearby scene(region) 531 /// this is an agent 'looking into' this scene from a nearby scene(region)
@@ -650,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
650 #region Constructor(s) 658 #region Constructor(s)
651 659
652 public ScenePresence() 660 public ScenePresence()
653 { 661 {
654 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 662 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
655 CreateSceneViewer(); 663 CreateSceneViewer();
656 m_animator = new ScenePresenceAnimator(this); 664 m_animator = new ScenePresenceAnimator(this);
@@ -868,6 +876,31 @@ namespace OpenSim.Region.Framework.Scenes
868 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) 876 if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
869 { 877 {
870 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); 878 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
879
880 if (pos.X < 0)
881 {
882 emergencyPos.X = (int)Constants.RegionSize + pos.X;
883 if (!(pos.Y < 0))
884 emergencyPos.Y = pos.Y;
885 if (!(pos.Z < 0))
886 emergencyPos.X = pos.X;
887 }
888 if (pos.Y < 0)
889 {
890 emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
891 if (!(pos.X < 0))
892 emergencyPos.X = pos.X;
893 if (!(pos.Z < 0))
894 emergencyPos.Z = pos.Z;
895 }
896 if (pos.Z < 0)
897 {
898 if (!(pos.X < 0))
899 emergencyPos.X = pos.X;
900 if (!(pos.Y < 0))
901 emergencyPos.Y = pos.Y;
902 //Leave as 128
903 }
871 904
872 m_log.WarnFormat( 905 m_log.WarnFormat(
873 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 906 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
@@ -2900,36 +2933,75 @@ namespace OpenSim.Region.Framework.Scenes
2900 { 2933 {
2901 // Checks if where it's headed exists a region 2934 // Checks if where it's headed exists a region
2902 2935
2936 bool needsTransit = false;
2903 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2937 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2904 { 2938 {
2905 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2939 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2940 {
2941 needsTransit = true;
2906 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2942 neighbor = HaveNeighbor(Cardinals.SW, ref fix);
2943 }
2907 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2944 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2945 {
2946 needsTransit = true;
2908 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2947 neighbor = HaveNeighbor(Cardinals.NW, ref fix);
2948 }
2909 else 2949 else
2950 {
2951 needsTransit = true;
2910 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2952 neighbor = HaveNeighbor(Cardinals.W, ref fix);
2953 }
2911 } 2954 }
2912 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2955 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2913 { 2956 {
2914 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2957 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2958 {
2959 needsTransit = true;
2915 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2960 neighbor = HaveNeighbor(Cardinals.SE, ref fix);
2961 }
2916 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2962 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2963 {
2964 needsTransit = true;
2917 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2965 neighbor = HaveNeighbor(Cardinals.NE, ref fix);
2966 }
2918 else 2967 else
2968 {
2969 needsTransit = true;
2919 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2970 neighbor = HaveNeighbor(Cardinals.E, ref fix);
2971 }
2920 } 2972 }
2921 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2973 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2974 {
2975 needsTransit = true;
2922 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2976 neighbor = HaveNeighbor(Cardinals.S, ref fix);
2977 }
2923 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2978 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2979 {
2980 needsTransit = true;
2924 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2981 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2982 }
2983
2925 2984
2926
2927 // Makes sure avatar does not end up outside region 2985 // Makes sure avatar does not end up outside region
2928 if (neighbor < 0) 2986 if (neighbor <= 0)
2929 AbsolutePosition = new Vector3( 2987 {
2930 AbsolutePosition.X + 3*fix[0], 2988 if (!needsTransit)
2931 AbsolutePosition.Y + 3*fix[1], 2989 {
2932 AbsolutePosition.Z); 2990 if (m_requestedSitTargetUUID == UUID.Zero)
2991 {
2992 Vector3 pos = AbsolutePosition;
2993 if (AbsolutePosition.X < 0)
2994 pos.X += Velocity.X;
2995 else if (AbsolutePosition.X > Constants.RegionSize)
2996 pos.X -= Velocity.X;
2997 if (AbsolutePosition.Y < 0)
2998 pos.Y += Velocity.Y;
2999 else if (AbsolutePosition.Y > Constants.RegionSize)
3000 pos.Y -= Velocity.Y;
3001 AbsolutePosition = pos;
3002 }
3003 }
3004 }
2933 else if (neighbor > 0) 3005 else if (neighbor > 0)
2934 CrossToNewRegion(); 3006 CrossToNewRegion();
2935 } 3007 }
@@ -3400,7 +3472,7 @@ namespace OpenSim.Region.Framework.Scenes
3400 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3472 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3401 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3473 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3402 m_physicsActor.SubscribeEvents(500); 3474 m_physicsActor.SubscribeEvents(500);
3403 m_physicsActor.LocalID = LocalId; 3475 m_physicsActor.LocalID = LocalId;
3404 } 3476 }
3405 3477
3406 private void OutOfBoundsCall(Vector3 pos) 3478 private void OutOfBoundsCall(Vector3 pos)
@@ -3503,7 +3575,7 @@ namespace OpenSim.Region.Framework.Scenes
3503 } 3575 }
3504 if (m_health <= 0) 3576 if (m_health <= 0)
3505 m_scene.EventManager.TriggerAvatarKill(killerObj, this); 3577 m_scene.EventManager.TriggerAvatarKill(killerObj, this);
3506 } 3578 }
3507 } 3579 }
3508 3580
3509 public void setHealthWithUpdate(float health) 3581 public void setHealthWithUpdate(float health)
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 cc38a30..85e3fb3 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -774,6 +774,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
774 public event UUIDNameRequest OnTeleportHomeRequest; 774 public event UUIDNameRequest OnTeleportHomeRequest;
775 public event ScriptAnswer OnScriptAnswer; 775 public event ScriptAnswer OnScriptAnswer;
776 public event AgentSit OnUndo; 776 public event AgentSit OnUndo;
777 public event AgentSit OnRedo;
778 public event LandUndo OnLandUndo;
777 public event ForceReleaseControls OnForceReleaseControls; 779 public event ForceReleaseControls OnForceReleaseControls;
778 public event GodLandStatRequest OnLandStatRequest; 780 public event GodLandStatRequest OnLandStatRequest;
779 public event DetailedEstateDataRequest OnDetailedEstateDataRequest; 781 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index b04b076..35819a6 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -50,7 +50,6 @@ using OpenSim.Region.Framework.Scenes;
50using Caps = OpenSim.Framework.Capabilities.Caps; 50using Caps = OpenSim.Framework.Capabilities.Caps;
51using System.Text.RegularExpressions; 51using System.Text.RegularExpressions;
52 52
53
54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 53namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
55{ 54{
56 public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule 55 public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
@@ -76,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
76 // SLVoice client will do a GET on this prefix 75 // SLVoice client will do a GET on this prefix
77 private static string m_freeSwitchAPIPrefix; 76 private static string m_freeSwitchAPIPrefix;
78 77
79 // We need to return some information to SLVoice 78 // We need to return some information to SLVoice
80 // figured those out via curl 79 // figured those out via curl
81 // http://vd1.vivox.com/api2/viv_get_prelogin.php 80 // http://vd1.vivox.com/api2/viv_get_prelogin.php
82 // 81 //
@@ -102,9 +101,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
102 101
103 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); 102 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
104 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); 103 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
105 104
106 private Scene m_scene; 105 private Scene m_scene;
107 106
108 107
109 private IConfig m_config; 108 private IConfig m_config;
110 109
@@ -136,9 +135,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
136 m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty); 135 m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty);
137 m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty); 136 m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty);
138 m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty); 137 m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty);
139 138
140 // XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server) 139 // XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server)
141 140
142 string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty); 141 string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty);
143 int servicePort = m_config.GetInt("freeswitch_service_port", 80); 142 int servicePort = m_config.GetInt("freeswitch_service_port", 80);
144 IPAddress serviceIPAddress = IPAddress.Parse(serviceIP); 143 IPAddress serviceIPAddress = IPAddress.Parse(serviceIP);
@@ -156,7 +155,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
156 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120); 155 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120);
157 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty); 156 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty);
158 m_freeSwitchContext = m_config.GetString("freeswitch_context", "default"); 157 m_freeSwitchContext = m_config.GetString("freeswitch_context", "default");
159 158
160 if (String.IsNullOrEmpty(m_freeSwitchServerUser) || 159 if (String.IsNullOrEmpty(m_freeSwitchServerUser) ||
161 String.IsNullOrEmpty(m_freeSwitchServerPass) || 160 String.IsNullOrEmpty(m_freeSwitchServerPass) ||
162 String.IsNullOrEmpty(m_freeSwitchRealm) || 161 String.IsNullOrEmpty(m_freeSwitchRealm) ||
@@ -182,9 +181,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
182 { 181 {
183 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), 182 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
184 FreeSwitchSLVoiceGetPreloginHTTPHandler); 183 FreeSwitchSLVoiceGetPreloginHTTPHandler);
185 184
186 // RestStreamHandler h = new 185 // RestStreamHandler h = new
187 // RestStreamHandler("GET", 186 // RestStreamHandler("GET",
188 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); 187 // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
189 // MainServer.Instance.AddStreamHandler(h); 188 // MainServer.Instance.AddStreamHandler(h);
190 189
@@ -202,13 +201,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
202 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix), 201 MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
203 FreeSwitchSLVoiceBuddyHTTPHandler); 202 FreeSwitchSLVoiceBuddyHTTPHandler);
204 } 203 }
205
206
207
208 204
209
210 m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm); 205 m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
211 206
212 m_FreeSwitchDirectory = new FreeSwitchDirectory(); 207 m_FreeSwitchDirectory = new FreeSwitchDirectory();
213 m_FreeSwitchDialplan = new FreeSwitchDialplan(); 208 m_FreeSwitchDialplan = new FreeSwitchDialplan();
214 209
@@ -225,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
225 } 220 }
226 } 221 }
227 222
228 if (m_pluginEnabled) 223 if (m_pluginEnabled)
229 { 224 {
230 // we need to capture scene in an anonymous method 225 // we need to capture scene in an anonymous method
231 // here as we need it later in the callbacks 226 // here as we need it later in the callbacks
@@ -233,8 +228,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
233 { 228 {
234 OnRegisterCaps(scene, agentID, caps); 229 OnRegisterCaps(scene, agentID, caps);
235 }; 230 };
236
237
238 231
239 try 232 try
240 { 233 {
@@ -254,16 +247,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
254 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); 247 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
255 } 248 }
256 } 249 }
257
258 } 250 }
259 } 251 }
260 252
261 public void PostInitialise() 253 public void PostInitialise()
262 { 254 {
263 if (m_pluginEnabled) 255 if (m_pluginEnabled)
264 { 256 {
265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); 257 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
266 258
267 // register the voice interface for this module, so the script engine can call us 259 // register the voice interface for this module, so the script engine can call us
268 m_scene.RegisterModuleInterface<IVoiceModule>(this); 260 m_scene.RegisterModuleInterface<IVoiceModule>(this);
269 } 261 }
@@ -282,15 +274,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
282 { 274 {
283 get { return true; } 275 get { return true; }
284 } 276 }
285 277
286 // <summary> 278 // <summary>
287 // implementation of IVoiceModule, called by osSetParcelSIPAddress script function 279 // implementation of IVoiceModule, called by osSetParcelSIPAddress script function
288 // </summary> 280 // </summary>
289 public void setLandSIPAddress(string SIPAddress,UUID GlobalID) 281 public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
290 { 282 {
291 m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}", 283 m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
292 GlobalID, SIPAddress); 284 GlobalID, SIPAddress);
293 285
294 lock (m_ParcelAddress) 286 lock (m_ParcelAddress)
295 { 287 {
296 if (m_ParcelAddress.ContainsKey(GlobalID.ToString())) 288 if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
@@ -303,18 +295,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
303 } 295 }
304 } 296 }
305 } 297 }
306 298
307 // <summary> 299 // <summary>
308 // OnRegisterCaps is invoked via the scene.EventManager 300 // OnRegisterCaps is invoked via the scene.EventManager
309 // everytime OpenSim hands out capabilities to a client 301 // everytime OpenSim hands out capabilities to a client
310 // (login, region crossing). We contribute two capabilities to 302 // (login, region crossing). We contribute two capabilities to
311 // the set of capabilities handed back to the client: 303 // the set of capabilities handed back to the client:
312 // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest. 304 // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
313 // 305 //
314 // ProvisionVoiceAccountRequest allows the client to obtain 306 // ProvisionVoiceAccountRequest allows the client to obtain
315 // the voice account credentials for the avatar it is 307 // the voice account credentials for the avatar it is
316 // controlling (e.g., user name, password, etc). 308 // controlling (e.g., user name, password, etc).
317 // 309 //
318 // ParcelVoiceInfoRequest is invoked whenever the client 310 // ParcelVoiceInfoRequest is invoked whenever the client
319 // changes from one region or parcel to another. 311 // changes from one region or parcel to another.
320 // 312 //
@@ -371,7 +363,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
371 { 363 {
372 System.Threading.Thread.Sleep(2000); 364 System.Threading.Thread.Sleep(2000);
373 avatar = scene.GetScenePresence(agentID); 365 avatar = scene.GetScenePresence(agentID);
374 366
375 if (avatar == null) 367 if (avatar == null)
376 return "<llsd>undef</llsd>"; 368 return "<llsd>undef</llsd>";
377 } 369 }
@@ -407,8 +399,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
407 // new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api"); 399 // new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, "http://etsvc02.hursley.ibm.com/api");
408 LLSDVoiceAccountResponse voiceAccountResponse = 400 LLSDVoiceAccountResponse voiceAccountResponse =
409 new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm, 401 new LLSDVoiceAccountResponse(agentname, password, m_freeSwitchRealm,
410 String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress, 402 String.Format("http://{0}:{1}{2}/", m_openSimWellKnownHTTPAddress,
411 m_freeSwitchServicePort, m_freeSwitchAPIPrefix)); 403 m_freeSwitchServicePort, m_freeSwitchAPIPrefix));
412 404
413 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse); 405 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
414 406
@@ -442,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
442 string avatarName = avatar.Name; 434 string avatarName = avatar.Name;
443 435
444 // - check whether we have a region channel in our cache 436 // - check whether we have a region channel in our cache
445 // - if not: 437 // - if not:
446 // create it and cache it 438 // create it and cache it
447 // - send it to the client 439 // - send it to the client
448 // - send channel_uri: as "sip:regionID@m_sipDomain" 440 // - send channel_uri: as "sip:regionID@m_sipDomain"
@@ -451,12 +443,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
451 LLSDParcelVoiceInfoResponse parcelVoiceInfo; 443 LLSDParcelVoiceInfoResponse parcelVoiceInfo;
452 string channelUri; 444 string channelUri;
453 445
454 if (null == scene.LandChannel) 446 if (null == scene.LandChannel)
455 throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available", 447 throw new Exception(String.Format("region \"{0}\": avatar \"{1}\": land data not yet available",
456 scene.RegionInfo.RegionName, avatarName)); 448 scene.RegionInfo.RegionName, avatarName));
457 449
458
459
460 // get channel_uri: check first whether estate 450 // get channel_uri: check first whether estate
461 // settings allow voice, then whether parcel allows 451 // settings allow voice, then whether parcel allows
462 // voice, if all do retrieve or obtain the parcel 452 // voice, if all do retrieve or obtain the parcel
@@ -493,22 +483,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
493 parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds); 483 parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
494 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo); 484 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
495 485
496 m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}", 486 m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
497 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r); 487 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
498 return r; 488 return r;
499 } 489 }
500 catch (Exception e) 490 catch (Exception e)
501 { 491 {
502 m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later", 492 m_log.ErrorFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2}, retry later",
503 scene.RegionInfo.RegionName, avatarName, e.Message); 493 scene.RegionInfo.RegionName, avatarName, e.Message);
504 m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed", 494 m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": avatar \"{1}\": {2} failed",
505 scene.RegionInfo.RegionName, avatarName, e.ToString()); 495 scene.RegionInfo.RegionName, avatarName, e.ToString());
506 496
507 return "<llsd>undef</llsd>"; 497 return "<llsd>undef</llsd>";
508 } 498 }
509 } 499 }
510 500
511
512 /// <summary> 501 /// <summary>
513 /// Callback for a client request for ChatSessionRequest 502 /// Callback for a client request for ChatSessionRequest
514 /// </summary> 503 /// </summary>
@@ -550,7 +539,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
550 string fwdresponsestr = ""; 539 string fwdresponsestr = "";
551 int fwdresponsecode = 200; 540 int fwdresponsecode = 200;
552 string fwdresponsecontenttype = "text/xml"; 541 string fwdresponsecontenttype = "text/xml";
553
554 542
555 HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress); 543 HttpWebRequest forwardreq = (HttpWebRequest)WebRequest.Create(forwardaddress);
556 forwardreq.Method = method; 544 forwardreq.Method = method;
@@ -577,7 +565,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
577 response["content_type"] = fwdresponsecontenttype; 565 response["content_type"] = fwdresponsecontenttype;
578 response["str_response_string"] = fwdresponsestr; 566 response["str_response_string"] = fwdresponsestr;
579 response["int_response_code"] = fwdresponsecode; 567 response["int_response_code"] = fwdresponsecode;
580 568
581 return response; 569 return response;
582 } 570 }
583 571
@@ -585,11 +573,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
585 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) 573 public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
586 { 574 {
587 m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called"); 575 m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
588 576
589 Hashtable response = new Hashtable(); 577 Hashtable response = new Hashtable();
590 response["content_type"] = "text/xml"; 578 response["content_type"] = "text/xml";
591 response["keepalive"] = false; 579 response["keepalive"] = false;
592 580
593 response["str_response_string"] = String.Format( 581 response["str_response_string"] = String.Format(
594 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + 582 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
595 "<VCConfiguration>\r\n"+ 583 "<VCConfiguration>\r\n"+
@@ -607,9 +595,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
607 "</VCConfiguration>", 595 "</VCConfiguration>",
608 m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN, 596 m_freeSwitchRealm, m_freeSwitchSIPProxy, m_freeSwitchAttemptUseSTUN,
609 m_freeSwitchEchoServer, m_freeSwitchEchoPort, 597 m_freeSwitchEchoServer, m_freeSwitchEchoPort,
610 m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout, 598 m_freeSwitchDefaultWellKnownIP, m_freeSwitchDefaultTimeout,
611 m_freeSwitchUrlResetPassword, ""); 599 m_freeSwitchUrlResetPassword, "");
612 600
613 response["int_response_code"] = 200; 601 response["int_response_code"] = 200;
614 602
615 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]); 603 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler return {0}",response["str_response_string"]);
@@ -624,7 +612,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
624 response["content-type"] = "text/xml"; 612 response["content-type"] = "text/xml";
625 613
626 Hashtable requestBody = parseRequestBody((string)request["body"]); 614 Hashtable requestBody = parseRequestBody((string)request["body"]);
627 615
628 if (!requestBody.ContainsKey("auth_token")) 616 if (!requestBody.ContainsKey("auth_token"))
629 return response; 617 return response;
630 618
@@ -632,7 +620,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
632 //string[] auth_tokenvals = auth_token.Split(':'); 620 //string[] auth_tokenvals = auth_token.Split(':');
633 //string username = auth_tokenvals[0]; 621 //string username = auth_tokenvals[0];
634 int strcount = 0; 622 int strcount = 0;
635 623
636 string[] ids = new string[strcount]; 624 string[] ids = new string[strcount];
637 625
638 int iter = -1; 626 int iter = -1;
@@ -648,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
648 } 636 }
649 StringBuilder resp = new StringBuilder(); 637 StringBuilder resp = new StringBuilder();
650 resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">"); 638 resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
651 639
652 resp.Append(string.Format(@"<level0> 640 resp.Append(string.Format(@"<level0>
653 <status>OK</status> 641 <status>OK</status>
654 <cookie_name>lib_session</cookie_name> 642 <cookie_name>lib_session</cookie_name>
@@ -678,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
678 <b2g_group_id></b2g_group_id> 666 <b2g_group_id></b2g_group_id>
679 </level3>", ids[i],i,m_freeSwitchRealm,dt)); 667 </level3>", ids[i],i,m_freeSwitchRealm,dt));
680 } 668 }
681 669
682 resp.Append("</buddies><groups></groups></body></level0></response>"); 670 resp.Append("</buddies><groups></groups></body></level0></response>");
683 671
684 response["str_response_string"] = resp.ToString(); 672 response["str_response_string"] = resp.ToString();
@@ -694,7 +682,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
694 string requestbody = (string)request["body"]; 682 string requestbody = (string)request["body"];
695 string uri = (string)request["uri"]; 683 string uri = (string)request["uri"];
696 string contenttype = (string)request["content-type"]; 684 string contenttype = (string)request["content-type"];
697 685
698 Hashtable requestBody = parseRequestBody((string)request["body"]); 686 Hashtable requestBody = parseRequestBody((string)request["body"]);
699 687
700 //string pwd = (string) requestBody["pwd"]; 688 //string pwd = (string) requestBody["pwd"];
@@ -712,7 +700,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
712 pos++; 700 pos++;
713 if (s == userid) 701 if (s == userid)
714 break; 702 break;
715
716 } 703 }
717 } 704 }
718 } 705 }
@@ -735,7 +722,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
735 </body> 722 </body>
736 </level0> 723 </level0>
737 </response>", userid, pos, avatarName); 724 </response>", userid, pos, avatarName);
738 725
739 response["int_response_code"] = 200; 726 response["int_response_code"] = 200;
740 return response; 727 return response;
741 /* 728 /*
@@ -752,13 +739,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
752 public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request) 739 public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
753 { 740 {
754 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]); 741 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler called with {0}", (string)request["body"]);
755 742
756 Hashtable response = new Hashtable(); 743 Hashtable response = new Hashtable();
757 response["str_response_string"] = string.Empty; 744 response["str_response_string"] = string.Empty;
758 // all the params come as NVPs in the request body 745 // all the params come as NVPs in the request body
759 Hashtable requestBody = parseRequestBody((string) request["body"]); 746 Hashtable requestBody = parseRequestBody((string) request["body"]);
760 747
761 // is this a dialplan or directory request 748 // is this a dialplan or directory request
762 string section = (string) requestBody["section"]; 749 string section = (string) requestBody["section"];
763 750
764 if (section == "directory") 751 if (section == "directory")
@@ -767,40 +754,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
767 response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody); 754 response = m_FreeSwitchDialplan.HandleDialplanRequest(m_freeSwitchContext, m_freeSwitchRealm, requestBody);
768 else 755 else
769 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); 756 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
770 757
771 // XXX: re-generate dialplan: 758 // XXX: re-generate dialplan:
772 // - conf == region UUID 759 // - conf == region UUID
773 // - conf number = region port 760 // - conf number = region port
774 // -> TODO Initialise(): keep track of regions via events 761 // -> TODO Initialise(): keep track of regions via events
775 // re-generate accounts for all avatars 762 // re-generate accounts for all avatars
776 // -> TODO Initialise(): keep track of avatars via events 763 // -> TODO Initialise(): keep track of avatars via events
777 Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); 764 Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
778 765
779 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",normalizeEndLines.Replace(((string)response["str_response_string"]), "")); 766 m_log.DebugFormat("[FreeSwitchVoice] FreeSwitchConfigHTTPHandler return {0}",normalizeEndLines.Replace(((string)response["str_response_string"]), ""));
780 return response; 767 return response;
781 } 768 }
782 769
783 public Hashtable parseRequestBody(string body) 770 public Hashtable parseRequestBody(string body)
784 { 771 {
785 Hashtable bodyParams = new Hashtable(); 772 Hashtable bodyParams = new Hashtable();
786 // split string 773 // split string
787 string [] nvps = body.Split(new Char [] {'&'}); 774 string [] nvps = body.Split(new Char [] {'&'});
788 775
789 foreach (string s in nvps) { 776 foreach (string s in nvps)
790 777 {
791 if (s.Trim() != "") 778 if (s.Trim() != "")
792 { 779 {
793 string [] nvp = s.Split(new Char [] {'='}); 780 string [] nvp = s.Split(new Char [] {'='});
794 bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1])); 781 bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1]));
795 } 782 }
796 } 783 }
797 784
798 return bodyParams; 785 return bodyParams;
799 } 786 }
800 787
801 private string ChannelUri(Scene scene, LandData land) 788 private string ChannelUri(Scene scene, LandData land)
802 { 789 {
803
804 string channelUri = null; 790 string channelUri = null;
805 791
806 string landUUID; 792 string landUUID;
@@ -808,12 +794,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
808 794
809 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same 795 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
810 // as the directory ID. Otherwise, it reflects the parcel's ID. 796 // as the directory ID. Otherwise, it reflects the parcel's ID.
811 797
812 lock (m_ParcelAddress) 798 lock (m_ParcelAddress)
813 { 799 {
814 if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) 800 if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
815 { 801 {
816 m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", 802 m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
817 land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); 803 land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
818 return m_ParcelAddress[land.GlobalID.ToString()]; 804 return m_ParcelAddress[land.GlobalID.ToString()];
819 } 805 }
@@ -823,22 +809,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
823 { 809 {
824 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name); 810 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name);
825 landUUID = land.GlobalID.ToString(); 811 landUUID = land.GlobalID.ToString();
826 m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}", 812 m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
827 landName, land.LocalID, landUUID); 813 landName, land.LocalID, landUUID);
828 } 814 }
829 else 815 else
830 { 816 {
831 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName); 817 landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionName);
832 landUUID = scene.RegionInfo.RegionID.ToString(); 818 landUUID = scene.RegionInfo.RegionID.ToString();
833 m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}", 819 m_log.DebugFormat("[FreeSwitchVoice]: Region:Parcel \"{0}\": parcel id {1}: using channel name {2}",
834 landName, land.LocalID, landUUID); 820 landName, land.LocalID, landUUID);
835 } 821 }
836 System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 822 System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
837 823
838 // slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables 824 // slvoice handles the sip address differently if it begins with confctl, hiding it from the user in the friends list. however it also disables
839 // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. 825 // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator.
840 channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); 826 channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
841 827
842 lock (m_ParcelAddress) 828 lock (m_ParcelAddress)
843 { 829 {
844 if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) 830 if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
@@ -849,14 +835,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
849 835
850 return channelUri; 836 return channelUri;
851 } 837 }
852 838
853 private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) 839 private static bool CustomCertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
854 { 840 {
855
856 return true; 841 return true;
857
858 } 842 }
859 } 843 }
844
860 public class MonoCert : ICertificatePolicy 845 public class MonoCert : ICertificatePolicy
861 { 846 {
862 #region ICertificatePolicy Members 847 #region ICertificatePolicy Members
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
index 03c1e95..3d49732 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
@@ -34,6 +34,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 34{
35 public interface IAvatar : IEntity 35 public interface IAvatar : IEntity
36 { 36 {
37
38 bool IsChildAgent { get; }
39
37 //// <value> 40 //// <value>
38 /// Array of worn attachments, empty but not null, if no attachments are worn 41 /// Array of worn attachments, empty but not null, if no attachments are worn
39 /// </value> 42 /// </value>
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/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
index 4427426..0786bd9 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
@@ -70,6 +70,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
70 set { GetSP().TeleportWithMomentum(value); } 70 set { GetSP().TeleportWithMomentum(value); }
71 } 71 }
72 72
73 public bool IsChildAgent
74 {
75 get { return GetSP().IsChildAgent; }
76 }
77
73 #region IAvatar implementation 78 #region IAvatar implementation
74 public IAvatarAttachment[] Attachments 79 public IAvatarAttachment[] Attachments
75 { 80 {
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/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
index 3490a8b..ccdea14 100644
--- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
@@ -121,19 +121,19 @@ namespace OpenSim.Region.Modules.SvnSerialiser
121 { 121 {
122 serialiser.LoadPrimsFromXml2( 122 serialiser.LoadPrimsFromXml2(
123 scene, 123 scene,
124 m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID 124 m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
125 + Slash.DirectorySeparatorChar + "objects.xml"); 125 + Slash.DirectorySeparatorChar + "objects.xml");
126 126
127 scene.RequestModuleInterface<ITerrainModule>().LoadFromFile( 127 scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(
128 m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID 128 m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID
129 + Slash.DirectorySeparatorChar + "heightmap.r32"); 129 + Slash.DirectorySeparatorChar + "heightmap.r32");
130 130
131 m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); 131 m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ").");
132 } 132 }
133 else 133 else
134 { 134 {
135 m_log.ErrorFormat( 135 m_log.ErrorFormat(
136 "[SVNBACKUP]: Region load of {0} failed - no serialisation module available", 136 "[SVNBACKUP]: Region load of {0} failed - no serialisation module available",
137 scene.RegionInfo.RegionName); 137 scene.RegionInfo.RegionName);
138 } 138 }
139 } 139 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 3135cdc..cf2076f 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/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 25b9099..25bf297 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -195,6 +195,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
195 195
196 } 196 }
197 197
198 public override void VehicleFlags(int param, bool remove)
199 {
200
201 }
202
198 public override void SetVolumeDetect(int param) 203 public override void SetVolumeDetect(int param)
199 { 204 {
200 205
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
index 120d040..7d5c078 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs
@@ -372,6 +372,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
372 372
373 } 373 }
374 374
375 public override void VehicleFlags(int param, bool remove)
376 {
377
378 }
379
375 public override void SetVolumeDetect(int param) 380 public override void SetVolumeDetect(int param)
376 { 381 {
377 382
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
index f430def..1f3e031 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
@@ -407,6 +407,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
407 407
408 } 408 }
409 409
410 public override void VehicleFlags(int param, bool remove)
411 {
412
413 }
414
410 public override void SetVolumeDetect(int param) 415 public override void SetVolumeDetect(int param)
411 { 416 {
412 //TODO: GhostObject 417 //TODO: GhostObject
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 9113ebe..273841b 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
@@ -992,9 +1004,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
992 1004
993 public override void VehicleFlagsRemove(int flags) 1005 public override void VehicleFlagsRemove(int flags)
994 { 1006 {
995
996 } 1007 }
997 1008
1009 public override void VehicleFlags(int param, bool remove)
1010 {
1011
1012 }
1013
998 public override void SetVolumeDetect(int param) 1014 public override void SetVolumeDetect(int param)
999 { 1015 {
1000 1016
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
index 2eb519f..6dadbe5 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
@@ -734,6 +734,10 @@ namespace OpenSim.Region.Physics.OdePlugin
734 734
735 } 735 }
736 736
737 public override void VehicleFlags(int flags, bool remove)
738 {
739 }
740
737 public override void VehicleFlagsSet(int flags) 741 public override void VehicleFlagsSet(int flags)
738 { 742 {
739 743
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index fb6cb55..e3ac315 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -2442,6 +2442,14 @@ Console.WriteLine(" JointCreateFixed");
2442 m_vehicle.ProcessRotationVehicleParam((Vehicle) param, rotation); 2442 m_vehicle.ProcessRotationVehicleParam((Vehicle) param, rotation);
2443 } 2443 }
2444 2444
2445 public override void VehicleFlags(int flags, bool remove)
2446 {
2447 if (!remove)
2448 VehicleFlagsSet(flags);
2449 else
2450 VehicleFlagsRemove(flags);
2451 }
2452
2445 public override void VehicleFlagsSet(int flags) 2453 public override void VehicleFlagsSet(int flags)
2446 { 2454 {
2447 m_vehicle.ProcessFlagsVehicleSet(flags); 2455 m_vehicle.ProcessFlagsVehicleSet(flags);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index f43de48..8060ba0 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -210,6 +210,7 @@ namespace OpenSim.Region.Physics.Manager
210 public abstract void VehicleRotationParam(int param, Quaternion rotation); 210 public abstract void VehicleRotationParam(int param, Quaternion rotation);
211 public abstract void VehicleFlagsSet(int flags); 211 public abstract void VehicleFlagsSet(int flags);
212 public abstract void VehicleFlagsRemove(int flags); 212 public abstract void VehicleFlagsRemove(int flags);
213 public abstract void VehicleFlags(int param, bool remove);
213 214
214 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 215 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
215 216
@@ -364,6 +365,11 @@ namespace OpenSim.Region.Physics.Manager
364 365
365 } 366 }
366 367
368 public override void VehicleFlags(int param, bool remove)
369 {
370
371 }
372
367 public override void SetVolumeDetect(int param) 373 public override void SetVolumeDetect(int param)
368 { 374 {
369 375
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 b713142..6b8d1e2 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -744,6 +744,11 @@ namespace OpenSim.Region.Physics.OdePlugin
744 744
745 } 745 }
746 746
747 public override void VehicleFlags(int param, bool remove)
748 {
749
750 }
751
747 public override void SetVolumeDetect(int param) 752 public override void SetVolumeDetect(int param)
748 { 753 {
749 754
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 008070b..9beeabb 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -72,37 +72,40 @@ namespace OpenSim.Region.Physics.OdePlugin
72 72
73 73
74 // Vehicle properties 74 // Vehicle properties
75 private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind 75 private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
76 // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier 76 // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
77 private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings: 77 private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings:
78 // HOVER_TERRAIN_ONLY 78 // HOVER_TERRAIN_ONLY
79 // HOVER_GLOBAL_HEIGHT 79 // HOVER_GLOBAL_HEIGHT
80 // NO_DEFLECTION_UP 80 // NO_DEFLECTION_UP
81 // HOVER_WATER_ONLY 81 // HOVER_WATER_ONLY
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
89 private Vector3 m_dir = Vector3.Zero; // velocity applied to body 91 private Vector3 m_dir = Vector3.Zero; // velocity applied to body
90 private Vector3 m_linearFrictionTimescale = Vector3.Zero; 92 private Vector3 m_linearFrictionTimescale = Vector3.Zero;
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
97 //Angular properties 100 //Angular properties
98 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor 101 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
99 private int m_angularMotorApply = 0; // application frame counter 102 private int m_angularMotorApply = 0; // application frame counter
100 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity 103 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity
101 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 104 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate
102 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 105 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate
103 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate 106 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
104 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body 107 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
105 // private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body 108 // private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
106 109
107 //Deflection properties 110 //Deflection properties
108 // private float m_angularDeflectionEfficiency = 0; 111 // private float m_angularDeflectionEfficiency = 0;
@@ -120,14 +123,14 @@ namespace OpenSim.Region.Physics.OdePlugin
120// private float m_VhoverEfficiency = 0f; 123// private float m_VhoverEfficiency = 0f;
121 private float m_VhoverTimescale = 0f; 124 private float m_VhoverTimescale = 0f;
122 private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height 125 private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
123 private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle. 126 private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
124 // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) 127 // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity)
125 // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. 128 // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity.
126 // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. 129 // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity.
127 130
128 //Attractor properties 131 //Attractor properties
129 private float m_verticalAttractionEfficiency = 1.0f; // damped 132 private float m_verticalAttractionEfficiency = 1.0f; // damped
130 private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor. 133 private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
131 134
132 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 135 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
133 { 136 {
@@ -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 f354328..39cfa49 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2357,12 +2357,17 @@ Console.WriteLine(" JointCreateFixed");
2357 2357
2358 public override void VehicleFlagsSet(int flags) 2358 public override void VehicleFlagsSet(int flags)
2359 { 2359 {
2360 2360 VehicleFlags(flags, false);
2361 } 2361 }
2362 2362
2363 public override void VehicleFlagsRemove(int flags) 2363 public override void VehicleFlagsRemove(int flags)
2364 { 2364 {
2365 VehicleFlags(flags, true);
2366 }
2365 2367
2368 public override void VehicleFlags(int param, bool remove)
2369 {
2370 m_vehicle.ProcessVehicleFlags(param, remove);
2366 } 2371 }
2367 2372
2368 public override void SetVolumeDetect(int param) 2373 public override void SetVolumeDetect(int param)
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 491e200..e722666 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -192,6 +192,8 @@ namespace OpenSim.Region.Physics.POSPlugin
192 192
193 } 193 }
194 194
195 public override void VehicleFlags(int param, bool remove) { }
196
195 public override void SetVolumeDetect(int param) 197 public override void SetVolumeDetect(int param)
196 { 198 {
197 199
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index f8d49f9..c129340 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -149,6 +149,8 @@ namespace OpenSim.Region.Physics.POSPlugin
149 149
150 } 150 }
151 151
152 public override void VehicleFlags(int param, bool remove) { }
153
152 public override void SetVolumeDetect(int param) 154 public override void SetVolumeDetect(int param)
153 { 155 {
154 156
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs
new file mode 100644
index 0000000..fc3adac
--- /dev/null
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs
@@ -0,0 +1,361 @@
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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXCharacter : PhysicsActor
42 {
43 private Vector3 _position;
44 private Vector3 _velocity;
45 private Vector3 m_rotationalVelocity = Vector3.Zero;
46 private Vector3 _acceleration;
47 private NxCharacter _character;
48 private bool flying;
49 private bool iscolliding = false;
50 private float gravityAccel;
51
52 public PhysXCharacter(NxCharacter character)
53 {
54 _character = character;
55 }
56
57 public override int PhysicsActorType
58 {
59 get { return (int) ActorTypes.Agent; }
60 set { return; }
61 }
62
63 public override bool SetAlwaysRun
64 {
65 get { return false; }
66 set { return; }
67 }
68
69 public override uint LocalID
70 {
71 set { return; }
72 }
73
74 public override bool Grabbed
75 {
76 set { return; }
77 }
78
79 public override bool Selected
80 {
81 set { return; }
82 }
83
84 public override float Buoyancy
85 {
86 get { return 0f; }
87 set { return; }
88 }
89
90 public override bool FloatOnWater
91 {
92 set { return; }
93 }
94
95 public override bool IsPhysical
96 {
97 get { return false; }
98 set { return; }
99 }
100
101 public override bool ThrottleUpdates
102 {
103 get { return false; }
104 set { return; }
105 }
106
107 public override bool Flying
108 {
109 get { return flying; }
110 set { flying = value; }
111 }
112
113 public override bool IsColliding
114 {
115 get { return iscolliding; }
116 set { iscolliding = value; }
117 }
118
119 public override bool CollidingGround
120 {
121 get { return false; }
122 set { return; }
123 }
124
125 public override bool CollidingObj
126 {
127 get { return false; }
128 set { return; }
129 }
130
131 public override Vector3 RotationalVelocity
132 {
133 get { return m_rotationalVelocity; }
134 set { m_rotationalVelocity = value; }
135 }
136
137 public override bool Stopped
138 {
139 get { return false; }
140 }
141
142 public override Vector3 Position
143 {
144 get { return _position; }
145 set
146 {
147 _position = value;
148 Vec3 ps = new Vec3();
149 ps.X = value.X;
150 ps.Y = value.Y;
151 ps.Z = value.Z;
152 _character.Position = ps;
153 }
154 }
155
156 public override Vector3 Size
157 {
158 get { return Vector3.Zero; }
159 set { }
160 }
161
162 public override float Mass
163 {
164 get { return 0f; }
165 }
166
167 public override Vector3 Force
168 {
169 get { return Vector3.Zero; }
170 set { return; }
171 }
172
173 public override int VehicleType
174 {
175 get { return 0; }
176 set { return; }
177 }
178
179 public override void VehicleFloatParam(int param, float value)
180 {
181 }
182
183 public override void VehicleVectorParam(int param, Vector3 value)
184 {
185 }
186
187 public override void VehicleRotationParam(int param, Quaternion rotation)
188 {
189 }
190
191 public override void VehicleFlagsSet(int param)
192 {
193 }
194
195 public override void VehicleFlagsRemove(int param)
196 {
197 }
198
199 public override void VehicleFlags(int param, bool remove)
200 {
201 }
202
203 public override void SetVolumeDetect(int param)
204 {
205 }
206
207 public override Vector3 CenterOfMass
208 {
209 get { return Vector3.Zero; }
210 }
211
212 public override Vector3 GeometricCenter
213 {
214 get { return Vector3.Zero; }
215 }
216
217 public override Vector3 Velocity
218 {
219 get { return _velocity; }
220 set { _velocity = value; }
221 }
222
223 public override float CollisionScore
224 {
225 get { return 0f; }
226 set { }
227 }
228
229 public override bool Kinematic
230 {
231 get { return false; }
232 set { }
233 }
234
235 public override Quaternion Orientation
236 {
237 get { return Quaternion.Identity; }
238 set { }
239 }
240
241 public override Vector3 Acceleration
242 {
243 get { return _acceleration; }
244 }
245
246 public void SetAcceleration(Vector3 accel)
247 {
248 _acceleration = accel;
249 }
250
251 public override void AddForce(Vector3 force, bool pushforce)
252 {
253 }
254
255 public override Vector3 Torque
256 {
257 get { return Vector3.Zero; }
258 set { return; }
259 }
260
261 public override void AddAngularForce(Vector3 force, bool pushforce)
262 {
263 }
264
265 public override void link(PhysicsActor obj)
266 {
267 }
268
269 public override void delink()
270 {
271 }
272
273 public override void LockAngularMotion(Vector3 axis)
274 {
275 }
276
277 public override void SetMomentum(Vector3 momentum)
278 {
279 }
280
281 public void Move(float timeStep)
282 {
283 Vec3 vec = new Vec3();
284 vec.X = _velocity.X*timeStep;
285 vec.Y = _velocity.Y*timeStep;
286 if (flying)
287 {
288 vec.Z = (_velocity.Z)*timeStep;
289 }
290 else
291 {
292 gravityAccel += -9.8f;
293 vec.Z = (gravityAccel + _velocity.Z)*timeStep;
294 }
295 int res = _character.Move(vec);
296 if (res == 1)
297 {
298 gravityAccel = 0;
299 }
300 }
301
302 public override PrimitiveBaseShape Shape
303 {
304 set { return; }
305 }
306
307 public void UpdatePosition()
308 {
309 Vec3 vec = _character.Position;
310 _position.X = vec.X;
311 _position.Y = vec.Y;
312 _position.Z = vec.Z;
313 }
314
315 public override void CrossingFailure()
316 {
317 }
318
319 public override Vector3 PIDTarget { set { return; } }
320 public override bool PIDActive { set { return; } }
321 public override float PIDTau { set { return; } }
322
323 public override float PIDHoverHeight { set { return; } }
324 public override bool PIDHoverActive { set { return; } }
325 public override PIDHoverType PIDHoverType { set { return; } }
326 public override float PIDHoverTau { set { return; } }
327
328 public override Quaternion APIDTarget
329 {
330 set { return; }
331 }
332
333 public override bool APIDActive
334 {
335 set { return; }
336 }
337
338 public override float APIDStrength
339 {
340 set { return; }
341 }
342
343 public override float APIDDamping
344 {
345 set { return; }
346 }
347
348 public override void SubscribeEvents(int ms)
349 {
350
351 }
352 public override void UnSubscribeEvents()
353 {
354
355 }
356 public override bool SubscribedEvents()
357 {
358 return false;
359 }
360 }
361}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
deleted file mode 100644
index e54065c..0000000
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ /dev/null
@@ -1,861 +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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 /// <summary>
42 /// Will be the PhysX plugin but for now will be a very basic physics engine
43 /// </summary>
44 public class PhysXPlugin : IPhysicsPlugin
45 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private PhysXScene _mScene;
48
49 public PhysXPlugin()
50 {
51 }
52
53 public bool Init()
54 {
55 return true;
56 }
57
58 public PhysicsScene GetScene(string sceneIdentifier)
59 {
60 if (_mScene == null)
61 {
62 _mScene = new PhysXScene(sceneIdentifier);
63 }
64 return (_mScene);
65 }
66
67 public string GetName()
68 {
69 return ("RealPhysX");
70 }
71
72 public void Dispose()
73 {
74 }
75 }
76
77 public class PhysXScene : PhysicsScene
78 {
79 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
80 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
81 private List<PhysXPrim> _prims = new List<PhysXPrim>();
82 private float[] _heightMap = null;
83 private NxPhysicsSDK mySdk;
84 private NxScene scene;
85
86 // protected internal string sceneIdentifier;
87 public PhysXScene(string _sceneIdentifier)
88 {
89 //sceneIdentifier = _sceneIdentifier;
90
91 mySdk = NxPhysicsSDK.CreateSDK();
92 m_log.Info("Sdk created - now creating scene");
93 scene = mySdk.CreateScene();
94 }
95
96 public override void Initialise(IMesher meshmerizer, IConfigSource config)
97 {
98 // Does nothing right now
99 }
100 public override void Dispose()
101 {
102
103 }
104
105 public override void SetWaterLevel(float baseheight)
106 {
107
108 }
109
110 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
111 {
112 Vec3 pos = new Vec3();
113 pos.X = position.X;
114 pos.Y = position.Y;
115 pos.Z = position.Z;
116 PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
117 act.Flying = isFlying;
118 act.Position = position;
119 _characters.Add(act);
120 return act;
121 }
122
123 public override void RemovePrim(PhysicsActor prim)
124 {
125 }
126
127 public override void RemoveAvatar(PhysicsActor actor)
128 {
129 }
130
131 private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
132 {
133 Vec3 pos = new Vec3();
134 pos.X = position.X;
135 pos.Y = position.Y;
136 pos.Z = position.Z;
137 Vec3 siz = new Vec3();
138 siz.X = size.X;
139 siz.Y = size.Y;
140 siz.Z = size.Z;
141 PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
142 _prims.Add(act);
143 return act;
144 }
145
146 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
147 Vector3 size, Quaternion rotation) //To be removed
148 {
149 return AddPrimShape(primName, pbs, position, size, rotation, false);
150 }
151
152 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
153 Vector3 size, Quaternion rotation, bool isPhysical)
154 {
155 return AddPrim(position, size, rotation);
156 }
157
158 public override void AddPhysicsActorTaint(PhysicsActor prim)
159 {
160 }
161
162 public override float Simulate(float timeStep)
163 {
164 float fps = 0f;
165 try
166 {
167 foreach (PhysXCharacter actor in _characters)
168 {
169 actor.Move(timeStep);
170 }
171 scene.Simulate(timeStep);
172 scene.FetchResults();
173 scene.UpdateControllers();
174
175 foreach (PhysXCharacter actor in _characters)
176 {
177 actor.UpdatePosition();
178 }
179 }
180 catch (Exception e)
181 {
182 m_log.Error(e.Message);
183 }
184 return fps;
185 }
186
187 public override void GetResults()
188 {
189 }
190
191 public override bool IsThreaded
192 {
193 get { return (false); // for now we won't be multithreaded
194 }
195 }
196
197 public override void SetTerrain(float[] heightMap)
198 {
199 if (_heightMap != null)
200 {
201 m_log.Debug("PhysX - deleting old terrain");
202 scene.DeleteTerrain();
203 }
204 _heightMap = heightMap;
205 scene.AddTerrain(heightMap);
206 }
207
208 public override void DeleteTerrain()
209 {
210 scene.DeleteTerrain();
211 }
212
213 public override Dictionary<uint, float> GetTopColliders()
214 {
215 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
216 return returncolliders;
217 }
218
219 }
220
221 public class PhysXCharacter : PhysicsActor
222 {
223 private Vector3 _position;
224 private Vector3 _velocity;
225 private Vector3 m_rotationalVelocity = Vector3.Zero;
226 private Vector3 _acceleration;
227 private NxCharacter _character;
228 private bool flying;
229 private bool iscolliding = false;
230 private float gravityAccel;
231
232 public PhysXCharacter(NxCharacter character)
233 {
234 _character = character;
235 }
236
237 public override int PhysicsActorType
238 {
239 get { return (int) ActorTypes.Agent; }
240 set { return; }
241 }
242
243 public override bool SetAlwaysRun
244 {
245 get { return false; }
246 set { return; }
247 }
248
249 public override uint LocalID
250 {
251 set { return; }
252 }
253
254 public override bool Grabbed
255 {
256 set { return; }
257 }
258
259 public override bool Selected
260 {
261 set { return; }
262 }
263
264 public override float Buoyancy
265 {
266 get { return 0f; }
267 set { return; }
268 }
269
270 public override bool FloatOnWater
271 {
272 set { return; }
273 }
274
275 public override bool IsPhysical
276 {
277 get { return false; }
278 set { return; }
279 }
280
281 public override bool ThrottleUpdates
282 {
283 get { return false; }
284 set { return; }
285 }
286
287 public override bool Flying
288 {
289 get { return flying; }
290 set { flying = value; }
291 }
292
293 public override bool IsColliding
294 {
295 get { return iscolliding; }
296 set { iscolliding = value; }
297 }
298
299 public override bool CollidingGround
300 {
301 get { return false; }
302 set { return; }
303 }
304
305 public override bool CollidingObj
306 {
307 get { return false; }
308 set { return; }
309 }
310
311 public override Vector3 RotationalVelocity
312 {
313 get { return m_rotationalVelocity; }
314 set { m_rotationalVelocity = value; }
315 }
316
317 public override bool Stopped
318 {
319 get { return false; }
320 }
321
322 public override Vector3 Position
323 {
324 get { return _position; }
325 set
326 {
327 _position = value;
328 Vec3 ps = new Vec3();
329 ps.X = value.X;
330 ps.Y = value.Y;
331 ps.Z = value.Z;
332 _character.Position = ps;
333 }
334 }
335
336 public override Vector3 Size
337 {
338 get { return Vector3.Zero; }
339 set { }
340 }
341
342 public override float Mass
343 {
344 get { return 0f; }
345 }
346
347 public override Vector3 Force
348 {
349 get { return Vector3.Zero; }
350 set { return; }
351 }
352
353 public override int VehicleType
354 {
355 get { return 0; }
356 set { return; }
357 }
358
359 public override void VehicleFloatParam(int param, float value)
360 {
361
362 }
363
364 public override void VehicleVectorParam(int param, Vector3 value)
365 {
366
367 }
368
369 public override void VehicleRotationParam(int param, Quaternion rotation)
370 {
371
372 }
373
374 public override void VehicleFlagsSet(int flags)
375 {
376
377 }
378
379 public override void VehicleFlagsRemove(int flags)
380 {
381
382 }
383
384 public override void SetVolumeDetect(int param)
385 {
386
387 }
388
389
390 public override Vector3 CenterOfMass
391 {
392 get { return Vector3.Zero; }
393 }
394
395 public override Vector3 GeometricCenter
396 {
397 get { return Vector3.Zero; }
398 }
399
400 public override Vector3 Velocity
401 {
402 get { return _velocity; }
403 set { _velocity = value; }
404 }
405
406 public override float CollisionScore
407 {
408 get { return 0f; }
409 set { }
410 }
411
412 public override bool Kinematic
413 {
414 get { return false; }
415 set { }
416 }
417
418 public override Quaternion Orientation
419 {
420 get { return Quaternion.Identity; }
421 set { }
422 }
423
424 public override Vector3 Acceleration
425 {
426 get { return _acceleration; }
427 }
428
429 public void SetAcceleration(Vector3 accel)
430 {
431 _acceleration = accel;
432 }
433
434 public override void AddForce(Vector3 force, bool pushforce)
435 {
436 }
437 public override Vector3 Torque
438 {
439 get { return Vector3.Zero; }
440 set { return; }
441 }
442 public override void AddAngularForce(Vector3 force, bool pushforce)
443 {
444 }
445
446 public override void link(PhysicsActor obj)
447 {
448
449 }
450
451 public override void delink()
452 {
453
454 }
455
456 public override void LockAngularMotion(Vector3 axis)
457 {
458
459 }
460
461 public override void SetMomentum(Vector3 momentum)
462 {
463 }
464
465 public void Move(float timeStep)
466 {
467 Vec3 vec = new Vec3();
468 vec.X = _velocity.X*timeStep;
469 vec.Y = _velocity.Y*timeStep;
470 if (flying)
471 {
472 vec.Z = (_velocity.Z)*timeStep;
473 }
474 else
475 {
476 gravityAccel += -9.8f;
477 vec.Z = (gravityAccel + _velocity.Z)*timeStep;
478 }
479 int res = _character.Move(vec);
480 if (res == 1)
481 {
482 gravityAccel = 0;
483 }
484 }
485
486 public override PrimitiveBaseShape Shape
487 {
488 set { return; }
489 }
490
491 public void UpdatePosition()
492 {
493 Vec3 vec = _character.Position;
494 _position.X = vec.X;
495 _position.Y = vec.Y;
496 _position.Z = vec.Z;
497 }
498 public override void CrossingFailure()
499 {
500
501 }
502
503 public override Vector3 PIDTarget { set { return; } }
504 public override bool PIDActive { set { return; } }
505 public override float PIDTau { set { return; } }
506
507 public override float PIDHoverHeight { set { return; } }
508 public override bool PIDHoverActive { set { return; } }
509 public override PIDHoverType PIDHoverType { set { return; } }
510 public override float PIDHoverTau { set { return; } }
511
512 public override Quaternion APIDTarget
513 {
514 set { return; }
515 }
516
517 public override bool APIDActive
518 {
519 set { return; }
520 }
521
522 public override float APIDStrength
523 {
524 set { return; }
525 }
526
527 public override float APIDDamping
528 {
529 set { return; }
530 }
531
532
533
534 public override void SubscribeEvents(int ms)
535 {
536
537 }
538 public override void UnSubscribeEvents()
539 {
540
541 }
542 public override bool SubscribedEvents()
543 {
544 return false;
545 }
546 }
547
548
549 public class PhysXPrim : PhysicsActor
550 {
551 private Vector3 _velocity;
552 private Vector3 _acceleration;
553 private Vector3 m_rotationalVelocity;
554 private NxActor _prim;
555
556 public PhysXPrim(NxActor prim)
557 {
558 _velocity = Vector3.Zero;
559 _acceleration = Vector3.Zero;
560 _prim = prim;
561 }
562
563 public override int PhysicsActorType
564 {
565 get { return (int) ActorTypes.Prim; }
566 set { return; }
567 }
568
569 public override bool IsPhysical
570 {
571 get { return false; }
572 set { return; }
573 }
574
575 public override bool SetAlwaysRun
576 {
577 get { return false; }
578 set { return; }
579 }
580
581 public override uint LocalID
582 {
583 set { return; }
584 }
585
586 public override bool Grabbed
587 {
588 set { return; }
589 }
590
591 public override bool Selected
592 {
593 set { return; }
594 }
595
596 public override float Buoyancy
597 {
598 get { return 0f; }
599 set { return; }
600 }
601
602 public override bool FloatOnWater
603 {
604 set { return; }
605 }
606
607 public override bool ThrottleUpdates
608 {
609 get { return false; }
610 set { return; }
611 }
612
613 public override Vector3 RotationalVelocity
614 {
615 get { return m_rotationalVelocity; }
616 set { m_rotationalVelocity = value; }
617 }
618
619 public override bool Flying
620 {
621 get { return false; //no flying prims for you
622 }
623 set { }
624 }
625
626 public override bool IsColliding
627 {
628 get { return false; }
629 set { }
630 }
631
632 public override bool CollidingGround
633 {
634 get { return false; }
635 set { return; }
636 }
637
638 public override bool CollidingObj
639 {
640 get { return false; }
641 set { return; }
642 }
643
644 public override bool Stopped
645 {
646 get { return false; }
647 }
648
649 public override Vector3 Position
650 {
651 get
652 {
653 Vector3 pos = Vector3.Zero;
654 Vec3 vec = _prim.Position;
655 pos.X = vec.X;
656 pos.Y = vec.Y;
657 pos.Z = vec.Z;
658 return pos;
659 }
660 set
661 {
662 Vector3 vec = value;
663 Vec3 pos = new Vec3();
664 pos.X = vec.X;
665 pos.Y = vec.Y;
666 pos.Z = vec.Z;
667 _prim.Position = pos;
668 }
669 }
670
671 public override PrimitiveBaseShape Shape
672 {
673 set { return; }
674 }
675
676 public override Vector3 Velocity
677 {
678 get { return _velocity; }
679 set { _velocity = value; }
680 }
681
682 public override Vector3 Torque
683 {
684 get { return Vector3.Zero; }
685 set { return; }
686 }
687
688 public override float CollisionScore
689 {
690 get { return 0f; }
691 set { }
692 }
693
694 public override bool Kinematic
695 {
696 get { return _prim.Kinematic; }
697 set { _prim.Kinematic = value; }
698 }
699
700 public override Quaternion Orientation
701 {
702 get
703 {
704 Quaternion res;
705 PhysXWrapper.Quaternion quat = _prim.GetOrientation();
706 res.W = quat.W;
707 res.X = quat.X;
708 res.Y = quat.Y;
709 res.Z = quat.Z;
710 return res;
711 }
712 set { }
713 }
714
715 public override Vector3 Acceleration
716 {
717 get { return _acceleration; }
718 }
719
720 public void SetAcceleration(Vector3 accel)
721 {
722 _acceleration = accel;
723 }
724
725 public override void AddForce(Vector3 force, bool pushforce)
726 {
727 }
728
729 public override void AddAngularForce(Vector3 force, bool pushforce)
730 {
731 }
732
733 public override void SetMomentum(Vector3 momentum)
734 {
735 }
736
737 public override Vector3 Size
738 {
739 get { return Vector3.Zero; }
740 set { }
741 }
742
743 public override void link(PhysicsActor obj)
744 {
745 }
746
747 public override void delink()
748 {
749 }
750
751 public override void LockAngularMotion(Vector3 axis)
752 {
753
754 }
755
756 public override float Mass
757 {
758 get { return 0f; }
759 }
760
761 public override Vector3 Force
762 {
763 get { return Vector3.Zero; }
764 set { return; }
765 }
766
767 public override int VehicleType
768 {
769 get { return 0; }
770 set { return; }
771 }
772
773 public override void VehicleFloatParam(int param, float value)
774 {
775
776 }
777
778 public override void VehicleVectorParam(int param, Vector3 value)
779 {
780
781 }
782
783 public override void VehicleRotationParam(int param, Quaternion rotation)
784 {
785
786 }
787
788 public override void VehicleFlagsSet(int flags)
789 {
790
791 }
792
793 public override void VehicleFlagsRemove(int flags)
794 {
795
796 }
797
798 public override void SetVolumeDetect(int param)
799 {
800
801 }
802
803 public override Vector3 CenterOfMass
804 {
805 get { return Vector3.Zero; }
806 }
807
808 public override Vector3 GeometricCenter
809 {
810 get { return Vector3.Zero; }
811 }
812
813 public override void CrossingFailure()
814 {
815 }
816
817 public override Vector3 PIDTarget { set { return; } }
818 public override bool PIDActive { set { return; } }
819 public override float PIDTau { set { return; } }
820
821 public override float PIDHoverHeight { set { return; } }
822 public override bool PIDHoverActive { set { return; } }
823 public override PIDHoverType PIDHoverType { set { return; } }
824 public override float PIDHoverTau { set { return; } }
825
826 public override Quaternion APIDTarget
827 {
828 set { return; }
829 }
830
831 public override bool APIDActive
832 {
833 set { return; }
834 }
835
836 public override float APIDStrength
837 {
838 set { return; }
839 }
840
841 public override float APIDDamping
842 {
843 set { return; }
844 }
845
846
847
848 public override void SubscribeEvents(int ms)
849 {
850
851 }
852 public override void UnSubscribeEvents()
853 {
854
855 }
856 public override bool SubscribedEvents()
857 {
858 return false;
859 }
860 }
861}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs
new file mode 100644
index 0000000..d1b5b7e
--- /dev/null
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs
@@ -0,0 +1,349 @@
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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXPrim : PhysicsActor
42 {
43 private Vector3 _velocity;
44 private Vector3 _acceleration;
45 private Vector3 m_rotationalVelocity;
46 private NxActor _prim;
47
48 public PhysXPrim(NxActor prim)
49 {
50 _velocity = Vector3.Zero;
51 _acceleration = Vector3.Zero;
52 _prim = prim;
53 }
54
55 public override int PhysicsActorType
56 {
57 get { return (int) ActorTypes.Prim; }
58 set { return; }
59 }
60
61 public override bool IsPhysical
62 {
63 get { return false; }
64 set { return; }
65 }
66
67 public override bool SetAlwaysRun
68 {
69 get { return false; }
70 set { return; }
71 }
72
73 public override uint LocalID
74 {
75 set { return; }
76 }
77
78 public override bool Grabbed
79 {
80 set { return; }
81 }
82
83 public override bool Selected
84 {
85 set { return; }
86 }
87
88 public override float Buoyancy
89 {
90 get { return 0f; }
91 set { return; }
92 }
93
94 public override bool FloatOnWater
95 {
96 set { return; }
97 }
98
99 public override bool ThrottleUpdates
100 {
101 get { return false; }
102 set { return; }
103 }
104
105 public override Vector3 RotationalVelocity
106 {
107 get { return m_rotationalVelocity; }
108 set { m_rotationalVelocity = value; }
109 }
110
111 public override bool Flying
112 {
113 get { return false; //no flying prims for you
114 }
115 set { }
116 }
117
118 public override bool IsColliding
119 {
120 get { return false; }
121 set { }
122 }
123
124 public override bool CollidingGround
125 {
126 get { return false; }
127 set { return; }
128 }
129
130 public override bool CollidingObj
131 {
132 get { return false; }
133 set { return; }
134 }
135
136 public override bool Stopped
137 {
138 get { return false; }
139 }
140
141 public override Vector3 Position
142 {
143 get
144 {
145 Vector3 pos = Vector3.Zero;
146 Vec3 vec = _prim.Position;
147 pos.X = vec.X;
148 pos.Y = vec.Y;
149 pos.Z = vec.Z;
150 return pos;
151 }
152 set
153 {
154 Vector3 vec = value;
155 Vec3 pos = new Vec3();
156 pos.X = vec.X;
157 pos.Y = vec.Y;
158 pos.Z = vec.Z;
159 _prim.Position = pos;
160 }
161 }
162
163 public override PrimitiveBaseShape Shape
164 {
165 set { return; }
166 }
167
168 public override Vector3 Velocity
169 {
170 get { return _velocity; }
171 set { _velocity = value; }
172 }
173
174 public override Vector3 Torque
175 {
176 get { return Vector3.Zero; }
177 set { return; }
178 }
179
180 public override float CollisionScore
181 {
182 get { return 0f; }
183 set { }
184 }
185
186 public override bool Kinematic
187 {
188 get { return _prim.Kinematic; }
189 set { _prim.Kinematic = value; }
190 }
191
192 public override Quaternion Orientation
193 {
194 get
195 {
196 Quaternion res;
197 PhysXWrapper.Quaternion quat = _prim.GetOrientation();
198 res.W = quat.W;
199 res.X = quat.X;
200 res.Y = quat.Y;
201 res.Z = quat.Z;
202 return res;
203 }
204 set { }
205 }
206
207 public override Vector3 Acceleration
208 {
209 get { return _acceleration; }
210 }
211
212 public void SetAcceleration(Vector3 accel)
213 {
214 _acceleration = accel;
215 }
216
217 public override void AddForce(Vector3 force, bool pushforce)
218 {
219 }
220
221 public override void AddAngularForce(Vector3 force, bool pushforce)
222 {
223 }
224
225 public override void SetMomentum(Vector3 momentum)
226 {
227 }
228
229 public override Vector3 Size
230 {
231 get { return Vector3.Zero; }
232 set { }
233 }
234
235 public override void link(PhysicsActor obj)
236 {
237 }
238
239 public override void delink()
240 {
241 }
242
243 public override void LockAngularMotion(Vector3 axis)
244 {
245
246 }
247
248 public override float Mass
249 {
250 get { return 0f; }
251 }
252
253 public override Vector3 Force
254 {
255 get { return Vector3.Zero; }
256 set { return; }
257 }
258
259 public override int VehicleType
260 {
261 get { return 0; }
262 set { return; }
263 }
264
265 public override void VehicleFloatParam(int param, float value)
266 {
267
268 }
269
270 public override void VehicleVectorParam(int param, Vector3 value)
271 {
272
273 }
274
275 public override void VehicleRotationParam(int param, Quaternion rotation)
276 {
277
278 }
279
280 public override void VehicleFlags(int param, bool remove) { }
281
282 public override void VehicleFlagsSet(int param) { }
283
284 public override void VehicleFlagsRemove(int param) { }
285
286 public override void SetVolumeDetect(int param)
287 {
288
289 }
290
291 public override Vector3 CenterOfMass
292 {
293 get { return Vector3.Zero; }
294 }
295
296 public override Vector3 GeometricCenter
297 {
298 get { return Vector3.Zero; }
299 }
300
301 public override void CrossingFailure()
302 {
303 }
304
305 public override Vector3 PIDTarget { set { return; } }
306 public override bool PIDActive { set { return; } }
307 public override float PIDTau { set { return; } }
308
309 public override float PIDHoverHeight { set { return; } }
310 public override bool PIDHoverActive { set { return; } }
311 public override PIDHoverType PIDHoverType { set { return; } }
312 public override float PIDHoverTau { set { return; } }
313
314 public override Quaternion APIDTarget
315 {
316 set { return; }
317 }
318
319 public override bool APIDActive
320 {
321 set { return; }
322 }
323
324 public override float APIDStrength
325 {
326 set { return; }
327 }
328
329 public override float APIDDamping
330 {
331 set { return; }
332 }
333
334
335
336 public override void SubscribeEvents(int ms)
337 {
338
339 }
340 public override void UnSubscribeEvents()
341 {
342
343 }
344 public override bool SubscribedEvents()
345 {
346 return false;
347 }
348 }
349}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs
new file mode 100644
index 0000000..4de4b01
--- /dev/null
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs
@@ -0,0 +1,183 @@
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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using PhysXWrapper;
34using Quaternion=OpenMetaverse.Quaternion;
35using System.Reflection;
36using log4net;
37using OpenMetaverse;
38
39namespace OpenSim.Region.Physics.PhysXPlugin
40{
41 public class PhysXScene : PhysicsScene
42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
45 private List<PhysXPrim> _prims = new List<PhysXPrim>();
46 private float[] _heightMap = null;
47 private NxPhysicsSDK mySdk;
48 private NxScene scene;
49
50 // protected internal string sceneIdentifier;
51 public PhysXScene(string _sceneIdentifier)
52 {
53 //sceneIdentifier = _sceneIdentifier;
54
55 mySdk = NxPhysicsSDK.CreateSDK();
56 m_log.Info("Sdk created - now creating scene");
57 scene = mySdk.CreateScene();
58 }
59
60 public override void Initialise(IMesher meshmerizer, IConfigSource config)
61 {
62 // Does nothing right now
63 }
64 public override void Dispose()
65 {
66
67 }
68
69 public override void SetWaterLevel(float baseheight)
70 {
71
72 }
73
74 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
75 {
76 Vec3 pos = new Vec3();
77 pos.X = position.X;
78 pos.Y = position.Y;
79 pos.Z = position.Z;
80 PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
81 act.Flying = isFlying;
82 act.Position = position;
83 _characters.Add(act);
84 return act;
85 }
86
87 public override void RemovePrim(PhysicsActor prim)
88 {
89 }
90
91 public override void RemoveAvatar(PhysicsActor actor)
92 {
93 }
94
95 private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
96 {
97 Vec3 pos = new Vec3();
98 pos.X = position.X;
99 pos.Y = position.Y;
100 pos.Z = position.Z;
101 Vec3 siz = new Vec3();
102 siz.X = size.X;
103 siz.Y = size.Y;
104 siz.Z = size.Z;
105 PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
106 _prims.Add(act);
107 return act;
108 }
109
110 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
111 Vector3 size, Quaternion rotation) //To be removed
112 {
113 return AddPrimShape(primName, pbs, position, size, rotation, false);
114 }
115
116 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
117 Vector3 size, Quaternion rotation, bool isPhysical)
118 {
119 return AddPrim(position, size, rotation);
120 }
121
122 public override void AddPhysicsActorTaint(PhysicsActor prim)
123 {
124 }
125
126 public override float Simulate(float timeStep)
127 {
128 float fps = 0f;
129 try
130 {
131 foreach (PhysXCharacter actor in _characters)
132 {
133 actor.Move(timeStep);
134 }
135 scene.Simulate(timeStep);
136 scene.FetchResults();
137 scene.UpdateControllers();
138
139 foreach (PhysXCharacter actor in _characters)
140 {
141 actor.UpdatePosition();
142 }
143 }
144 catch (Exception e)
145 {
146 m_log.Error(e.Message);
147 }
148 return fps;
149 }
150
151 public override void GetResults()
152 {
153 }
154
155 public override bool IsThreaded
156 {
157 // for now we won't be multithreaded
158 get { return (false); }
159 }
160
161 public override void SetTerrain(float[] heightMap)
162 {
163 if (_heightMap != null)
164 {
165 m_log.Debug("PhysX - deleting old terrain");
166 scene.DeleteTerrain();
167 }
168 _heightMap = heightMap;
169 scene.AddTerrain(heightMap);
170 }
171
172 public override void DeleteTerrain()
173 {
174 scene.DeleteTerrain();
175 }
176
177 public override Dictionary<uint, float> GetTopColliders()
178 {
179 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
180 return returncolliders;
181 }
182 }
183}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7a6739b..3154f9e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1252,7 +1252,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1252 1252
1253 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) 1253 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
1254 { 1254 {
1255 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); 1255 if (value != 0)
1256 m_host.SetBlockGrab(true);
1257 else
1258 m_host.SetBlockGrab(false);
1256 } 1259 }
1257 1260
1258 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) 1261 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
@@ -1265,12 +1268,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1265 1268
1266 if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) 1269 if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE)
1267 { 1270 {
1268 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); 1271 if (value != 0)
1272 m_host.SetReturnAtEdge(true);
1273 else
1274 m_host.SetReturnAtEdge(false);
1269 } 1275 }
1270 1276
1271 if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) 1277 if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX)
1272 { 1278 {
1273 NotImplemented("llSetStatus - STATUS_SANDBOX"); 1279 if (value != 0)
1280 m_host.SetStatusSandbox(true);
1281 else
1282 m_host.SetStatusSandbox(false);
1274 } 1283 }
1275 1284
1276 if (statusrotationaxis != 0) 1285 if (statusrotationaxis != 0)
@@ -1307,8 +1316,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1307 return 0; 1316 return 0;
1308 1317
1309 case ScriptBaseClass.STATUS_BLOCK_GRAB: 1318 case ScriptBaseClass.STATUS_BLOCK_GRAB:
1310 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); 1319 if (m_host.GetBlockGrab())
1311 return 0; 1320 return 1;
1321 else
1322 return 0;
1312 1323
1313 case ScriptBaseClass.STATUS_DIE_AT_EDGE: 1324 case ScriptBaseClass.STATUS_DIE_AT_EDGE:
1314 if (m_host.GetDieAtEdge()) 1325 if (m_host.GetDieAtEdge())
@@ -1317,24 +1328,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1317 return 0; 1328 return 0;
1318 1329
1319 case ScriptBaseClass.STATUS_RETURN_AT_EDGE: 1330 case ScriptBaseClass.STATUS_RETURN_AT_EDGE:
1320 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 1331 if (m_host.GetReturnAtEdge())
1321 return 0; 1332 return 1;
1333 else
1334 return 0;
1322 1335
1323 case ScriptBaseClass.STATUS_ROTATE_X: 1336 case ScriptBaseClass.STATUS_ROTATE_X:
1324 NotImplemented("llGetStatus - STATUS_ROTATE_X"); 1337 if (m_host.GetAxisRotation(2) == 2)
1325 return 0; 1338 return 1;
1339 else
1340 return 0;
1326 1341
1327 case ScriptBaseClass.STATUS_ROTATE_Y: 1342 case ScriptBaseClass.STATUS_ROTATE_Y:
1328 NotImplemented("llGetStatus - STATUS_ROTATE_Y"); 1343 if (m_host.GetAxisRotation(4) == 4)
1329 return 0; 1344 return 1;
1345 else
1346 return 0;
1330 1347
1331 case ScriptBaseClass.STATUS_ROTATE_Z: 1348 case ScriptBaseClass.STATUS_ROTATE_Z:
1332 NotImplemented("llGetStatus - STATUS_ROTATE_Z"); 1349 if (m_host.GetAxisRotation(8) == 8)
1333 return 0; 1350 return 1;
1351 else
1352 return 0;
1334 1353
1335 case ScriptBaseClass.STATUS_SANDBOX: 1354 case ScriptBaseClass.STATUS_SANDBOX:
1336 NotImplemented("llGetStatus - STATUS_SANDBOX"); 1355 if (m_host.GetStatusSandbox())
1337 return 0; 1356 return 1;
1357 else
1358 return 0;
1338 } 1359 }
1339 return 0; 1360 return 0;
1340 } 1361 }
@@ -2346,7 +2367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2346 m_host.AddScriptLPS(1); 2367 m_host.AddScriptLPS(1);
2347 2368
2348 // send the sound, once, to all clients in range 2369 // send the sound, once, to all clients in range
2349 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); 2370 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false);
2350 } 2371 }
2351 2372
2352 // Xantor 20080528 we should do this differently. 2373 // Xantor 20080528 we should do this differently.
@@ -2376,42 +2397,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2376 public void llLoopSoundMaster(string sound, double volume) 2397 public void llLoopSoundMaster(string sound, double volume)
2377 { 2398 {
2378 m_host.AddScriptLPS(1); 2399 m_host.AddScriptLPS(1);
2379 NotImplemented("llLoopSoundMaster"); 2400 m_host.ParentGroup.LoopSoundMasterPrim = m_host;
2401 lock (m_host.ParentGroup.LoopSoundSlavePrims)
2402 {
2403 foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims)
2404 {
2405 if (prim.Sound != UUID.Zero)
2406 llStopSound();
2407
2408 prim.Sound = KeyOrName(sound);
2409 prim.SoundGain = volume;
2410 prim.SoundFlags = 1; // looping
2411 prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
2412
2413 prim.ScheduleFullUpdate();
2414 prim.SendFullUpdateToAllClients();
2415 }
2416 }
2417 if (m_host.Sound != UUID.Zero)
2418 llStopSound();
2419
2420 m_host.Sound = KeyOrName(sound);
2421 m_host.SoundGain = volume;
2422 m_host.SoundFlags = 1; // looping
2423 m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
2424
2425 m_host.ScheduleFullUpdate();
2426 m_host.SendFullUpdateToAllClients();
2380 } 2427 }
2381 2428
2382 public void llLoopSoundSlave(string sound, double volume) 2429 public void llLoopSoundSlave(string sound, double volume)
2383 { 2430 {
2384 m_host.AddScriptLPS(1); 2431 m_host.AddScriptLPS(1);
2385 NotImplemented("llLoopSoundSlave"); 2432 lock (m_host.ParentGroup.LoopSoundSlavePrims)
2433 {
2434 m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host);
2435 }
2386 } 2436 }
2387 2437
2388 public void llPlaySoundSlave(string sound, double volume) 2438 public void llPlaySoundSlave(string sound, double volume)
2389 { 2439 {
2390 m_host.AddScriptLPS(1); 2440 m_host.AddScriptLPS(1);
2391 NotImplemented("llPlaySoundSlave"); 2441
2442 // send the sound, once, to all clients in range
2443 m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false);
2392 } 2444 }
2393 2445
2394 public void llTriggerSound(string sound, double volume) 2446 public void llTriggerSound(string sound, double volume)
2395 { 2447 {
2396 m_host.AddScriptLPS(1); 2448 m_host.AddScriptLPS(1);
2397 // send the sound, once, to all clients in range 2449 // send the sound, once, to all clients in range
2398 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0); 2450 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false);
2399 } 2451 }
2400 2452
2401 // Xantor 20080528: Clear prim data of sound instead 2453 // Xantor 20080528: Clear prim data of sound instead
2402 public void llStopSound() 2454 public void llStopSound()
2403 { 2455 {
2404 m_host.AddScriptLPS(1); 2456 m_host.AddScriptLPS(1);
2405 2457 if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host))
2406 m_host.Sound = UUID.Zero; 2458 {
2407 m_host.SoundGain = 0; 2459 if (m_host.ParentGroup.LoopSoundMasterPrim == m_host)
2408 m_host.SoundFlags = 0; 2460 {
2409 m_host.SoundRadius = 0; 2461 foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims)
2410 2462 {
2411 m_host.ScheduleFullUpdate(); 2463 part.Sound = UUID.Zero;
2412 m_host.SendFullUpdateToAllClients(); 2464 part.SoundGain = 0;
2413 2465 part.SoundFlags = 0;
2414 // m_host.SendSound(UUID.Zero.ToString(), 1.0, false, 2); 2466 part.SoundRadius = 0;
2467 part.ScheduleFullUpdate();
2468 part.SendFullUpdateToAllClients();
2469 }
2470 m_host.ParentGroup.LoopSoundMasterPrim = null;
2471 m_host.ParentGroup.LoopSoundSlavePrims.Clear();
2472 }
2473 else
2474 {
2475 m_host.Sound = UUID.Zero;
2476 m_host.SoundGain = 0;
2477 m_host.SoundFlags = 0;
2478 m_host.SoundRadius = 0;
2479 m_host.ScheduleFullUpdate();
2480 m_host.SendFullUpdateToAllClients();
2481 }
2482 }
2483 else
2484 {
2485 m_host.Sound = UUID.Zero;
2486 m_host.SoundGain = 0;
2487 m_host.SoundFlags = 0;
2488 m_host.SoundRadius = 0;
2489 m_host.ScheduleFullUpdate();
2490 m_host.SendFullUpdateToAllClients();
2491 }
2415 } 2492 }
2416 2493
2417 public void llPreloadSound(string sound) 2494 public void llPreloadSound(string sound)
@@ -2803,8 +2880,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2803 2880
2804 public void llLookAt(LSL_Vector target, double strength, double damping) 2881 public void llLookAt(LSL_Vector target, double strength, double damping)
2805 { 2882 {
2806 // partial implementation, rotates objects correctly but does not apply strength or damping attributes
2807
2808 m_host.AddScriptLPS(1); 2883 m_host.AddScriptLPS(1);
2809 // Determine where we are looking from 2884 // Determine where we are looking from
2810 LSL_Vector from = llGetPos(); 2885 LSL_Vector from = llGetPos();
@@ -2824,9 +2899,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2824 // the angles of rotation in radians into rotation value 2899 // the angles of rotation in radians into rotation value
2825 2900
2826 LSL_Types.Quaternion rot = llEuler2Rot(angle); 2901 LSL_Types.Quaternion rot = llEuler2Rot(angle);
2827 2902 Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
2903 m_host.startLookAt(rotation, (float)damping, (float)strength);
2828 // Orient the object to the angle calculated 2904 // Orient the object to the angle calculated
2829 llSetRot(rot); 2905 //llSetRot(rot);
2830 } 2906 }
2831 2907
2832 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 2908 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
@@ -3329,13 +3405,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3329 public void llPointAt(LSL_Vector pos) 3405 public void llPointAt(LSL_Vector pos)
3330 { 3406 {
3331 m_host.AddScriptLPS(1); 3407 m_host.AddScriptLPS(1);
3332 NotImplemented("llPointAt"); 3408 ScenePresence Owner = World.GetScenePresence(m_host.UUID);
3409 LSL_Rotation rot = llEuler2Rot(pos);
3410 Owner.PreviousRotation = Owner.Rotation;
3411 Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s));
3333 } 3412 }
3334 3413
3335 public void llStopPointAt() 3414 public void llStopPointAt()
3336 { 3415 {
3337 m_host.AddScriptLPS(1); 3416 m_host.AddScriptLPS(1);
3338 NotImplemented("llStopPointAt"); 3417 ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID);
3418 Owner.Rotation = Owner.PreviousRotation;
3339 } 3419 }
3340 3420
3341 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) 3421 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
@@ -4138,8 +4218,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4138 public void llCollisionSound(string impact_sound, double impact_volume) 4218 public void llCollisionSound(string impact_sound, double impact_volume)
4139 { 4219 {
4140 m_host.AddScriptLPS(1); 4220 m_host.AddScriptLPS(1);
4141 //NotImplemented("llCollisionSound");
4142
4143 // TODO: Parameter check logic required. 4221 // TODO: Parameter check logic required.
4144 UUID soundId = UUID.Zero; 4222 UUID soundId = UUID.Zero;
4145 if (!UUID.TryParse(impact_sound, out soundId)) 4223 if (!UUID.TryParse(impact_sound, out soundId))
@@ -4727,8 +4805,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4727 public LSL_Vector llGetCenterOfMass() 4805 public LSL_Vector llGetCenterOfMass()
4728 { 4806 {
4729 m_host.AddScriptLPS(1); 4807 m_host.AddScriptLPS(1);
4730 NotImplemented("llGetCenterOfMass"); 4808 Vector3 center = m_host.GetGeometricCenter();
4731 return new LSL_Vector(); 4809 return new LSL_Vector(center.X,center.Y,center.Z);
4732 } 4810 }
4733 4811
4734 public LSL_List llListSort(LSL_List src, int stride, int ascending) 4812 public LSL_List llListSort(LSL_List src, int stride, int ascending)
@@ -5461,8 +5539,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5461 flags |= ScriptBaseClass.AGENT_SITTING; 5539 flags |= ScriptBaseClass.AGENT_SITTING;
5462 } 5540 }
5463 5541
5464 //NotImplemented("llGetAgentInfo");
5465
5466 return flags; 5542 return flags;
5467 } 5543 }
5468 5544
@@ -5522,12 +5598,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5522 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) 5598 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
5523 { 5599 {
5524 m_host.AddScriptLPS(1); 5600 m_host.AddScriptLPS(1);
5601
5602 SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate);
5603 }
5604
5605 public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate)
5606 {
5607 m_host.AddScriptLPS(1);
5608
5609 List<SceneObjectPart> parts = GetLinkParts(linknumber);
5610
5611 foreach (var part in parts)
5612 {
5613 SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
5614 }
5615 }
5616
5617 private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
5618 {
5619
5525 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); 5620 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
5526 pTexAnim.Flags = (Primitive.TextureAnimMode)mode; 5621 pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
5527 5622
5528 //ALL_SIDES 5623 //ALL_SIDES
5529 if (face == ScriptBaseClass.ALL_SIDES) 5624 if (face == ScriptBaseClass.ALL_SIDES)
5530 face = 255; 5625 face = 255;
5531 5626
5532 pTexAnim.Face = (uint)face; 5627 pTexAnim.Face = (uint)face;
5533 pTexAnim.Length = (float)length; 5628 pTexAnim.Length = (float)length;
@@ -5536,16 +5631,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5536 pTexAnim.SizeY = (uint)sizey; 5631 pTexAnim.SizeY = (uint)sizey;
5537 pTexAnim.Start = (float)start; 5632 pTexAnim.Start = (float)start;
5538 5633
5539 m_host.AddTextureAnimation(pTexAnim); 5634 part.AddTextureAnimation(pTexAnim);
5540 m_host.SendFullUpdateToAllClients(); 5635 part.SendFullUpdateToAllClients();
5541 m_host.ParentGroup.HasGroupChanged = true; 5636 part.ParentGroup.HasGroupChanged = true;
5542 } 5637 }
5543 5638
5544 public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, 5639 public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
5545 LSL_Vector bottom_south_west) 5640 LSL_Vector bottom_south_west)
5546 { 5641 {
5547 m_host.AddScriptLPS(1); 5642 m_host.AddScriptLPS(1);
5548 NotImplemented("llTriggerSoundLimited"); 5643 float radius1 = (float)llVecDist(llGetPos(), top_north_east);
5644 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
5645 float radius = Math.Abs(radius1 - radius2);
5646 m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false);
5549 } 5647 }
5550 5648
5551 public void llEjectFromLand(string pest) 5649 public void llEjectFromLand(string pest)
@@ -5932,13 +6030,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5932 return ps; 6030 return ps;
5933 } 6031 }
5934 6032
6033 public void llLinkParticleSystem(int linknumber, LSL_List rules)
6034 {
6035 m_host.AddScriptLPS(1);
6036
6037 List<SceneObjectPart> parts = GetLinkParts(linknumber);
6038
6039 foreach (var part in parts)
6040 {
6041 SetParticleSystem(part, rules);
6042 }
6043 }
6044
5935 public void llParticleSystem(LSL_List rules) 6045 public void llParticleSystem(LSL_List rules)
5936 { 6046 {
5937 m_host.AddScriptLPS(1); 6047 m_host.AddScriptLPS(1);
6048 SetParticleSystem(m_host, rules);
6049 }
6050
6051 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
6052
6053
5938 if (rules.Length == 0) 6054 if (rules.Length == 0)
5939 { 6055 {
5940 m_host.RemoveParticleSystem(); 6056 part.RemoveParticleSystem();
5941 m_host.ParentGroup.HasGroupChanged = true; 6057 part.ParentGroup.HasGroupChanged = true;
5942 } 6058 }
5943 else 6059 else
5944 { 6060 {
@@ -6049,7 +6165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6049 } 6165 }
6050 else 6166 else
6051 { 6167 {
6052 prules.Target = m_host.UUID; 6168 prules.Target = part.UUID;
6053 } 6169 }
6054 break; 6170 break;
6055 6171
@@ -6075,16 +6191,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6075 } 6191 }
6076 prules.CRC = 1; 6192 prules.CRC = 1;
6077 6193
6078 m_host.AddNewParticleSystem(prules); 6194 part.AddNewParticleSystem(prules);
6079 m_host.ParentGroup.HasGroupChanged = true; 6195 part.ParentGroup.HasGroupChanged = true;
6080 } 6196 }
6081 m_host.SendFullUpdateToAllClients(); 6197 part.SendFullUpdateToAllClients();
6082 } 6198 }
6083 6199
6084 public void llGroundRepel(double height, int water, double tau) 6200 public void llGroundRepel(double height, int water, double tau)
6085 { 6201 {
6086 m_host.AddScriptLPS(1); 6202 m_host.AddScriptLPS(1);
6087 NotImplemented("llGroundRepel"); 6203 if (m_host.PhysActor != null)
6204 {
6205 float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
6206 float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0));
6207 PIDHoverType hoverType = PIDHoverType.Ground;
6208 if (water != 0)
6209 {
6210 hoverType = PIDHoverType.GroundAndWater;
6211 if (ground < waterLevel)
6212 height += waterLevel;
6213 else
6214 height += ground;
6215 }
6216 else
6217 {
6218 height += ground;
6219 }
6220
6221 m_host.SetHoverHeight((float)height, hoverType, (float)tau);
6222 }
6088 } 6223 }
6089 6224
6090 protected UUID GetTaskInventoryItem(string name) 6225 protected UUID GetTaskInventoryItem(string name)
@@ -6219,7 +6354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6219 { 6354 {
6220 if (!m_host.ParentGroup.IsDeleted) 6355 if (!m_host.ParentGroup.IsDeleted)
6221 { 6356 {
6222 m_host.ParentGroup.RootPart.SetVehicleFlags(flags); 6357 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6223 } 6358 }
6224 } 6359 }
6225 } 6360 }
@@ -6231,7 +6366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6231 { 6366 {
6232 if (!m_host.ParentGroup.IsDeleted) 6367 if (!m_host.ParentGroup.IsDeleted)
6233 { 6368 {
6234 m_host.ParentGroup.RootPart.RemoveVehicleFlags(flags); 6369 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6235 } 6370 }
6236 } 6371 }
6237 } 6372 }
@@ -6868,6 +7003,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6868 SetPrimParams(part, rules); 7003 SetPrimParams(part, rules);
6869 } 7004 }
6870 7005
7006 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
7007 {
7008 llSetLinkPrimitiveParams(linknumber, rules);
7009 }
7010
6871 protected void SetPrimParams(SceneObjectPart part, LSL_List rules) 7011 protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
6872 { 7012 {
6873 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7013 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -7227,6 +7367,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7227 int style = rules.GetLSLIntegerItem(idx++); 7367 int style = rules.GetLSLIntegerItem(idx++);
7228 SetTexGen(part, face, style); 7368 SetTexGen(part, face, style);
7229 break; 7369 break;
7370 case (int)ScriptBaseClass.PRIM_TEXT:
7371 if (remain < 3)
7372 return;
7373 string primText = rules.GetLSLStringItem(idx++);
7374 LSL_Vector primTextColor = rules.GetVector3Item(idx++);
7375 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
7376 Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
7377 Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
7378 Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
7379 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7380
7381 break;
7230 } 7382 }
7231 } 7383 }
7232 } 7384 }
@@ -7271,7 +7423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7271 public void llRemoteDataSetRegion() 7423 public void llRemoteDataSetRegion()
7272 { 7424 {
7273 m_host.AddScriptLPS(1); 7425 m_host.AddScriptLPS(1);
7274 NotImplemented("llRemoteDataSetRegion"); 7426 Deprecated("llRemoteDataSetRegion");
7275 } 7427 }
7276 7428
7277 public LSL_Float llLog10(double val) 7429 public LSL_Float llLog10(double val)
@@ -7470,6 +7622,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7470 return GetLinkPrimitiveParams(m_host, rules); 7622 return GetLinkPrimitiveParams(m_host, rules);
7471 } 7623 }
7472 7624
7625 public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
7626 {
7627 m_host.AddScriptLPS(1);
7628
7629 List<SceneObjectPart> parts = GetLinkParts(linknumber);
7630
7631 LSL_List res = new LSL_List();
7632
7633 foreach (var part in parts)
7634 {
7635 LSL_List partRes = GetLinkPrimitiveParams(part, rules);
7636 res += partRes;
7637 }
7638
7639 return res;
7640 }
7641
7473 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) 7642 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
7474 { 7643 {
7475 LSL_List res = new LSL_List(); 7644 LSL_List res = new LSL_List();
@@ -7853,6 +8022,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7853 res.Add(new LSL_Float(primglow)); 8022 res.Add(new LSL_Float(primglow));
7854 } 8023 }
7855 break; 8024 break;
8025 case (int)ScriptBaseClass.PRIM_TEXT:
8026 Color4 textColor = part.GetTextColor();
8027 res.Add(part.Text);
8028 res.Add(new LSL_Vector(textColor.R,
8029 textColor.G,
8030 textColor.B));
8031 res.Add(new LSL_Float(textColor.A));
8032 break;
7856 } 8033 }
7857 } 8034 }
7858 return res; 8035 return res;
@@ -8409,7 +8586,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8409 public void llSetInventoryPermMask(string item, int mask, int value) 8586 public void llSetInventoryPermMask(string item, int mask, int value)
8410 { 8587 {
8411 m_host.AddScriptLPS(1); 8588 m_host.AddScriptLPS(1);
8412 NotImplemented("llSetInventoryPermMask"); 8589 if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
8590 {
8591 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
8592 {
8593 lock (m_host.TaskInventory)
8594 {
8595 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8596 {
8597 if (inv.Value.Name == item)
8598 {
8599 switch (mask)
8600 {
8601 case 0:
8602 inv.Value.BasePermissions = (uint)value;
8603 break;
8604 case 1:
8605 inv.Value.CurrentPermissions = (uint)value;
8606 break;
8607 case 2:
8608 inv.Value.GroupPermissions = (uint)value;
8609 break;
8610 case 3:
8611 inv.Value.EveryonePermissions = (uint)value;
8612 break;
8613 case 4:
8614 inv.Value.NextPermissions = (uint)value;
8615 break;
8616 }
8617 }
8618 }
8619 }
8620 }
8621 }
8413 } 8622 }
8414 8623
8415 public LSL_String llGetInventoryCreator(string item) 8624 public LSL_String llGetInventoryCreator(string item)
@@ -8843,6 +9052,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8843 // we send to all 9052 // we send to all
8844 landData.MediaID = new UUID(texture); 9053 landData.MediaID = new UUID(texture);
8845 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; 9054 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0;
9055 landData.MediaSize[0] = width;
9056 landData.MediaSize[1] = height;
9057 landData.MediaType = mediaType;
8846 9058
8847 // do that one last, it will cause a ParcelPropertiesUpdate 9059 // do that one last, it will cause a ParcelPropertiesUpdate
8848 landObject.SetMediaUrl(url); 9060 landObject.SetMediaUrl(url);
@@ -8902,11 +9114,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8902 m_host.AddScriptLPS(1); 9114 m_host.AddScriptLPS(1);
8903 LSL_List list = new LSL_List(); 9115 LSL_List list = new LSL_List();
8904 //TO DO: make the implementation for the missing commands 9116 //TO DO: make the implementation for the missing commands
8905 //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture.
8906 //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url.
8907 //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)
8908 //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)
8909 //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later)
8910 //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) 9117 //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)
8911 for (int i = 0; i < aList.Data.Length; i++) 9118 for (int i = 0; i < aList.Data.Length; i++)
8912 { 9119 {
@@ -8924,6 +9131,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8924 case ParcelMediaCommandEnum.Texture: 9131 case ParcelMediaCommandEnum.Texture:
8925 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); 9132 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString()));
8926 break; 9133 break;
9134 case ParcelMediaCommandEnum.Type:
9135 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType));
9136 break;
9137 case ParcelMediaCommandEnum.Size:
9138 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0]));
9139 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1]));
9140 break;
8927 default: 9141 default:
8928 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 9142 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
8929 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); 9143 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index a74e8da..7ab04a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
135 LSL_Key llGetLinkKey(int linknum); 135 LSL_Key llGetLinkKey(int linknum);
136 LSL_String llGetLinkName(int linknum); 136 LSL_String llGetLinkName(int linknum);
137 LSL_Integer llGetLinkNumber(); 137 LSL_Integer llGetLinkNumber();
138 LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
138 LSL_Integer llGetListEntryType(LSL_List src, int index); 139 LSL_Integer llGetListEntryType(LSL_List src, int index);
139 LSL_Integer llGetListLength(LSL_List src); 140 LSL_Integer llGetListLength(LSL_List src);
140 LSL_Vector llGetLocalPos(); 141 LSL_Vector llGetLocalPos();
@@ -206,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
206 void llInstantMessage(string user, string message); 207 void llInstantMessage(string user, string message);
207 LSL_String llIntegerToBase64(int number); 208 LSL_String llIntegerToBase64(int number);
208 LSL_String llKey2Name(string id); 209 LSL_String llKey2Name(string id);
210 void llLinkParticleSystem(int linknum, LSL_List rules);
209 LSL_String llList2CSV(LSL_List src); 211 LSL_String llList2CSV(LSL_List src);
210 LSL_Float llList2Float(LSL_List src, int index); 212 LSL_Float llList2Float(LSL_List src, int index);
211 LSL_Integer llList2Integer(LSL_List src, int index); 213 LSL_Integer llList2Integer(LSL_List src, int index);
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
322 void llSetLinkColor(int linknumber, LSL_Vector color, int face); 324 void llSetLinkColor(int linknumber, LSL_Vector color, int face);
323 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); 325 void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
324 void llSetLinkTexture(int linknumber, string texture, int face); 326 void llSetLinkTexture(int linknumber, string texture, int face);
327 void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
325 void llSetLocalRot(LSL_Rotation rot); 328 void llSetLocalRot(LSL_Rotation rot);
326 void llSetObjectDesc(string desc); 329 void llSetObjectDesc(string desc);
327 void llSetObjectName(string name); 330 void llSetObjectName(string name);
@@ -330,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
330 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 333 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
331 void llSetPos(LSL_Vector pos); 334 void llSetPos(LSL_Vector pos);
332 void llSetPrimitiveParams(LSL_List rules); 335 void llSetPrimitiveParams(LSL_List rules);
336 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
333 void llSetPrimURL(string url); 337 void llSetPrimURL(string url);
334 void llSetRemoteScriptAccessPin(int pin); 338 void llSetRemoteScriptAccessPin(int pin);
335 void llSetRot(LSL_Rotation rot); 339 void llSetRot(LSL_Rotation rot);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 13b855f..ee35fa4 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;
@@ -305,6 +313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
305 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake 313 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
306 public const int PRIM_POINT_LIGHT = 23; // Huh? 314 public const int PRIM_POINT_LIGHT = 23; // Huh?
307 public const int PRIM_GLOW = 25; 315 public const int PRIM_GLOW = 25;
316 public const int PRIM_TEXT = 26;
308 public const int PRIM_TEXGEN_DEFAULT = 0; 317 public const int PRIM_TEXGEN_DEFAULT = 0;
309 public const int PRIM_TEXGEN_PLANAR = 1; 318 public const int PRIM_TEXGEN_PLANAR = 1;
310 319
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index a28e97b..3339995 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -674,6 +674,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
674 return m_LSL_Functions.llGetPrimitiveParams(rules); 674 return m_LSL_Functions.llGetPrimitiveParams(rules);
675 } 675 }
676 676
677 public LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules)
678 {
679 return m_LSL_Functions.llGetLinkPrimitiveParams(linknum, rules);
680 }
681
677 public LSL_Integer llGetRegionAgentCount() 682 public LSL_Integer llGetRegionAgentCount()
678 { 683 {
679 return m_LSL_Functions.llGetRegionAgentCount(); 684 return m_LSL_Functions.llGetRegionAgentCount();
@@ -889,6 +894,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
889 return m_LSL_Functions.llKey2Name(id); 894 return m_LSL_Functions.llKey2Name(id);
890 } 895 }
891 896
897 public void llLinkParticleSystem(int linknum, LSL_List rules)
898 {
899 m_LSL_Functions.llLinkParticleSystem(linknum, rules);
900 }
901
892 public LSL_String llList2CSV(LSL_List src) 902 public LSL_String llList2CSV(LSL_List src)
893 { 903 {
894 return m_LSL_Functions.llList2CSV(src); 904 return m_LSL_Functions.llList2CSV(src);
@@ -1468,6 +1478,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1468 m_LSL_Functions.llSetLinkTexture(linknumber, texture, face); 1478 m_LSL_Functions.llSetLinkTexture(linknumber, texture, face);
1469 } 1479 }
1470 1480
1481 public void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate)
1482 {
1483 m_LSL_Functions.llSetLinkTextureAnim(linknum, mode, face, sizex, sizey, start, length, rate);
1484 }
1485
1471 public void llSetLocalRot(LSL_Rotation rot) 1486 public void llSetLocalRot(LSL_Rotation rot)
1472 { 1487 {
1473 m_LSL_Functions.llSetLocalRot(rot); 1488 m_LSL_Functions.llSetLocalRot(rot);
@@ -1508,6 +1523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1508 m_LSL_Functions.llSetPrimitiveParams(rules); 1523 m_LSL_Functions.llSetPrimitiveParams(rules);
1509 } 1524 }
1510 1525
1526 public void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules)
1527 {
1528 m_LSL_Functions.llSetLinkPrimitiveParamsFast(linknum, rules);
1529 }
1530
1511 public void llSetPrimURL(string url) 1531 public void llSetPrimURL(string url)
1512 { 1532 {
1513 m_LSL_Functions.llSetPrimURL(url); 1533 m_LSL_Functions.llSetPrimURL(url);