From c76c80a28aabeb1cb0556ea2ebd89f6241bb7026 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:44:26 -0600 Subject: [PATCH 01/26] Adds IClientAPI voids for GroupProposals. Signed-off-by: Melanie --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 10 +++++++++- .../Client/Sirikata/ClientStack/SirikataClientView.cs | 10 +++++++++- OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | 10 +++++++++- OpenSim/Framework/IClientAPI.cs | 7 ++++++- OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 10 +++++++++- .../InternetRelayClientView/Server/IRCClientView.cs | 10 +++++++++- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 10 +++++++++- OpenSim/Tests/Common/Mock/TestClient.cs | 8 ++++++++ 8 files changed, 68 insertions(+), 7 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index f84b2968b7..6bf976c228 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1688,7 +1688,15 @@ namespace OpenSim.Client.MXP.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index e1eed9bad9..8e5efe493f 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -1177,7 +1177,15 @@ namespace OpenSim.Client.Sirikata.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } #endregion diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 7ca57b031c..f23acdc264 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -1194,7 +1194,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index eb5b0341d0..0efc2a4c83 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1446,7 +1446,12 @@ namespace OpenSim.Framework void SendUserInfoReply(bool imViaEmail, bool visible, string email); void SendUseCachedMuteList(); - void SendMuteListUpdate(string filename); + + void SendMuteListUpdate(string filename); + + void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals); + + void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes); void KillEndDone(); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 7699aa2f41..d5218b553e 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -1133,7 +1133,15 @@ namespace OpenSim.Region.Examples.SimpleModule } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 10b352f2a8..55bbed9285 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1657,7 +1657,15 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index daefd70220..fa47d16324 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1138,7 +1138,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC } public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) - { + { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b78433f8e7..93cab0e817 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1194,6 +1194,14 @@ namespace OpenSim.Tests.Common.Mock public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt) { + } + + public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes) + { + } + + public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) + { } } } From bc68390b14ec582093dc322c2f45c32491924406 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Jan 2010 22:51:37 +0000 Subject: [PATCH 02/26] The first 2 handlers for the XInventory system. --- .../Inventory/XInventoryInConnector.cs | 74 +++++++++++++++++++ .../Inventory/XInventoryConnector.cs | 4 +- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b48e30e342..c7d5ff1d3a 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -38,6 +38,7 @@ using OpenSim.Services.Interfaces; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; using log4net; +using OpenMetaverse; namespace OpenSim.Server.Handlers.Asset { @@ -193,6 +194,14 @@ namespace OpenSim.Server.Handlers.Asset { Dictionary result = new Dictionary(); + if (!request.ContainsKey("PRINCIPAL")) + return FailureResult(); + + if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString()))) + result["RESULT"] = "True"; + else + result["RESULT"] = "False"; + string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -203,6 +212,15 @@ namespace OpenSim.Server.Handlers.Asset { Dictionary result = new Dictionary(); + if (!request.ContainsKey("PRINCIPAL")) + return FailureResult(); + + + List folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); + + foreach (InventoryFolderBase f in folders) + result[f.ID.ToString()] = EncodeFolder(f); + string xmlString = ServerUtils.BuildXmlResponse(result); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -378,5 +396,61 @@ namespace OpenSim.Server.Handlers.Asset UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); } + + private Dictionary EncodeFolder(InventoryFolderBase f) + { + Dictionary ret = new Dictionary(); + + ret["ParentID"] = f.ParentID.ToString(); + ret["Type"] = f.Type.ToString(); + ret["Version"] = f.Version.ToString(); + ret["Name"] = f.Name; + ret["Owner"] = f.Owner.ToString(); + ret["ID"] = f.ID.ToString(); + + return ret; + } + + private InventoryFolderBase BuildFolder(Dictionary data) + { + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.ParentID = new UUID(data["ParentID"].ToString()); + folder.Type = short.Parse(data["Type"].ToString()); + folder.Version = ushort.Parse(data["Version"].ToString()); + folder.Name = data["Name"].ToString(); + folder.Owner = new UUID(data["Owner"].ToString()); + folder.ID = new UUID(data["ID"].ToString()); + + return folder; + } + + private InventoryItemBase BuildItem(Dictionary data) + { + InventoryItemBase item = new InventoryItemBase(); + + item.AssetID = new UUID(data["AssetID"].ToString()); + item.AssetType = int.Parse(data["AssetType"].ToString()); + item.Name = data["Name"].ToString(); + item.Owner = new UUID(data["Owner"].ToString()); + item.ID = new UUID(data["ID"].ToString()); + item.InvType = int.Parse(data["InvType"].ToString()); + item.Folder = new UUID(data["Folder"].ToString()); + item.CreatorId = data["CreatorId"].ToString(); + item.Description = data["Description"].ToString(); + item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); + item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); + item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); + item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); + item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); + item.GroupID = new UUID(data["GroupID"].ToString()); + item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); + item.SalePrice = int.Parse(data["SalePrice"].ToString()); + item.SaleType = byte.Parse(data["SaleType"].ToString()); + item.Flags = uint.Parse(data["Flags"].ToString()); + item.CreationDate = int.Parse(data["CreationDate"].ToString()); + + return item; + } } } diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 40acd6d20f..b9ccd7ea12 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -490,7 +490,7 @@ namespace OpenSim.Services.Connectors return replyData; } - InventoryFolderBase BuildFolder(Dictionary data) + private InventoryFolderBase BuildFolder(Dictionary data) { InventoryFolderBase folder = new InventoryFolderBase(); @@ -504,7 +504,7 @@ namespace OpenSim.Services.Connectors return folder; } - InventoryItemBase BuildItem(Dictionary data) + private InventoryItemBase BuildItem(Dictionary data) { InventoryItemBase item = new InventoryItemBase(); From b297913e2b4831a7dbc57c867f7ad6a46bd65f44 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 8 Jan 2010 22:58:01 -0800 Subject: [PATCH 03/26] Add some notes to OpenSim.ini.example suggesting to use MySQL with Mono installations --- bin/OpenSim.ini.example | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 0667047bfb..15623de5b8 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -126,11 +126,16 @@ ;storage_plugin = "OpenSim.Data.Null.dll" ; --- To use sqlite as region storage: + ; NOTE: SQLite and OpenSim are not functioning properly with Mono 2.4.3 or greater. + ; If you are using Mono you probably should be using MySQL storage_plugin = "OpenSim.Data.SQLite.dll" storage_connection_string="URI=file:OpenSim.db,version=3"; - ; --- To use MySQL storage, supply your own connectionstring (this is only an example): + ; --- To use MySQL storage, supply your own connection string (this is only an example): ; note that the supplied account needs create privilegies if you want it to auto-create needed tables. + ; + ; -->>> There are multiple connection strings defined in several places in this file. Check it carefully! + ; ; storage_plugin="OpenSim.Data.MySQL.dll" ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; ; If you want to use a different database/server for estate data, then From b3d6c85126fe8cf3e84ca023c41b0ed4a2664c15 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 8 Jan 2010 23:09:38 -0800 Subject: [PATCH 04/26] Add some configuration hints and references to README.txt --- README.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index d276c6ec19..339d6872c1 100644 --- a/README.txt +++ b/README.txt @@ -13,10 +13,14 @@ If it breaks, you get to keep *both* pieces. == Installation on Windows == Prereqs: - + * runprebuild.bat * Load OpenSim.sln into Visual Studio .NET and build the solution. * chdir bin + * edit OpenSim.ini and appropriate files in bin/config-include * OpenSim.exe + + Helpful resources: +* http://opensimulator.org/wiki/Build_Instructions See configuring OpenSim @@ -31,11 +35,16 @@ From the distribution type: * ./runprebuild.sh * nant * cd bin + * edit OpenSim.ini and appropriate files in bin/config-include * mono ./OpenSim.exe See configuring OpenSim == Configuring OpenSim == + Helpful resources: +* http://opensimulator.org/wiki/Configuration +* http://opensimulator.org/wiki/Configuring_Regions +* http://opensimulator.org/wiki/Mysql-config When OpenSim starts for the first time, you will be prompted with a series of questions that look something like: From 063f106cbbc2a805dc210fe16c30741ab24876cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 14:17:44 +0000 Subject: [PATCH 05/26] Add functionality to estate "Allowed Users" and "Allowed Groups". Allowed users will be honored now, while allowed groups will not. This requires additional groups module integration work --- .../Client/MXP/ClientStack/MXPClientView.cs | 2 +- .../ClientStack/SirikataClientView.cs | 2 +- .../VWoHTTP/ClientStack/VWHClientView.cs | 2 +- OpenSim/Framework/EstateSettings.cs | 28 ++ OpenSim/Framework/IClientAPI.cs | 2 +- .../ClientStack/LindenUDP/LLClientView.cs | 17 +- .../World/Estate/EstateManagementModule.cs | 268 +++++++++++------- .../Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../Server/IRCClientView.cs | 2 +- .../OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 11 files changed, 209 insertions(+), 120 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 6bf976c228..3c98229265 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1217,7 +1217,7 @@ namespace OpenSim.Client.MXP.ClientStack // Need to translate to MXP somehow } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { // Need to translate to MXP somehow } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index 8e5efe493f..30d157565f 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -760,7 +760,7 @@ namespace OpenSim.Client.Sirikata.ClientStack throw new System.NotImplementedException(); } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index f23acdc264..6a119bd372 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -767,7 +767,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack throw new System.NotImplementedException(); } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { throw new System.NotImplementedException(); } diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index deced98c97..b4b5808ad3 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -300,6 +300,34 @@ namespace OpenSim.Framework OnSave(this); } + public void AddEstateUser(UUID avatarID) + { + if (avatarID == UUID.Zero) + return; + if (!l_EstateAccess.Contains(avatarID)) + l_EstateAccess.Add(avatarID); + } + + public void RemoveEstateUser(UUID avatarID) + { + if (l_EstateAccess.Contains(avatarID)) + l_EstateAccess.Remove(avatarID); + } + + public void AddEstateGroup(UUID avatarID) + { + if (avatarID == UUID.Zero) + return; + if (!l_EstateGroups.Contains(avatarID)) + l_EstateGroups.Add(avatarID); + } + + public void RemoveEstateGroup(UUID avatarID) + { + if (l_EstateGroups.Contains(avatarID)) + l_EstateGroups.Remove(avatarID); + } + public void AddEstateManager(UUID avatarID) { if (avatarID == UUID.Zero) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0efc2a4c83..3489af122d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1271,7 +1271,7 @@ namespace OpenSim.Framework void SendHealth(float health); - void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID); + void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID); void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7d90a68d93..3d3c32432d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3912,7 +3912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) + { EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); packet.AgentData.TransactionID = UUID.Random(); @@ -3921,26 +3922,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.MethodData.Invoice = invoice; packet.MethodData.Method = Utils.StringToBytes("setaccess"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length]; - for (int i = 0; i < (6 + EstateManagers.Length); i++) + for (int i = 0; i < (6 + Data.Length); i++) { returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); } int j = 0; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(EstateManagers.Length.ToString()); j++; - for (int i = 0; i < EstateManagers.Length; i++) + returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++; + for (int i = 0; i < Data.Length; i++) { - returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; + returnblock[j].Parameter = Data[i].GetBytes(); j++; } packet.ParamList = returnblock; - packet.Header.Reliable = false; + packet.Header.Reliable = true; OutPacket(packet, ThrottleOutPacketType.Task); } diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index b1dcb1489a..deade6bd82 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -75,10 +75,21 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); - remote_client.SendEstateManagersList(invoice, + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AccessOptions, + m_scene.RegionInfo.EstateSettings.EstateAccess, + m_scene.RegionInfo.EstateSettings.EstateID); + + remote_client.SendEstateList(invoice, + (int)Constants.EstateAccessCodex.AllowedGroups, + m_scene.RegionInfo.EstateSettings.EstateGroups, + m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); @@ -233,127 +244,176 @@ namespace OpenSim.Region.CoreModules.World.Estate if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID) return; // never process owner - switch (estateAccessType) + if ((estateAccessType & 4) != 0) // User add { - case 64: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + + } + if ((estateAccessType & 8) != 0) // User remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); + m_scene.RegionInfo.EstateSettings.Save(); + + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 16) != 0) // Group add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 32) != 0) // Group remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); + m_scene.RegionInfo.EstateSettings.Save(); + + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 64) != 0) // Ban add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; + + bool alreadyInList = false; + + for (int i = 0; i < banlistcheck.Length; i++) { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - - bool alreadyInList = false; - - for (int i = 0; i < banlistcheck.Length; i++) + if (user == banlistcheck[i].BannedUserID) { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - break; - } - + alreadyInList = true; + break; } - if (!alreadyInList) - { - EstateBan item = new EstateBan(); - - item.BannedUserID = user; - item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; - item.BannedHostAddress = "0.0.0.0"; - item.BannedHostIPMask = "0.0.0.0"; - - m_scene.RegionInfo.EstateSettings.AddBan(item); - m_scene.RegionInfo.EstateSettings.Save(); - - ScenePresence s = m_scene.GetScenePresence(user); - if (s != null) - { - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(user, s.ControllingClient); - } - } - - } - else - { - remote_client.SendAlertMessage("User is already on the region ban list"); - } - //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); } - else + if (!alreadyInList) { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } - break; - case 128: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) - { - EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - bool alreadyInList = false; - EstateBan listitem = null; + EstateBan item = new EstateBan(); - for (int i = 0; i < banlistcheck.Length; i++) - { - if (user == banlistcheck[i].BannedUserID) - { - alreadyInList = true; - listitem = banlistcheck[i]; - break; - } + item.BannedUserID = user; + item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; + item.BannedHostAddress = "0.0.0.0"; + item.BannedHostIPMask = "0.0.0.0"; - } - if (alreadyInList && listitem != null) - { - m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); - m_scene.RegionInfo.EstateSettings.Save(); - } - else - { - remote_client.SendAlertMessage("User is not on the region ban list"); - } - //m_scene.RegionInfo.regionBanlist.Add(Manager(user); - remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); - } - else - { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } - break; - case 256: - - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) - { - m_scene.RegionInfo.EstateSettings.AddEstateManager(user); - m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); - } - else - { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); - } - - break; - case 512: - if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) - { - m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.AddBan(item); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + ScenePresence s = m_scene.GetScenePresence(user); + if (s != null) + { + if (!s.IsChildAgent) + { + s.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(user, s.ControllingClient); + } + } + } else { - remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + remote_client.SendAlertMessage("User is already on the region ban list"); } - break; + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 128) != 0) // Ban remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) + { + EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - default: + bool alreadyInList = false; + EstateBan listitem = null; - m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString()); - break; + for (int i = 0; i < banlistcheck.Length; i++) + { + if (user == banlistcheck[i].BannedUserID) + { + alreadyInList = true; + listitem = banlistcheck[i]; + break; + } + + } + if (alreadyInList && listitem != null) + { + m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); + m_scene.RegionInfo.EstateSettings.Save(); + } + else + { + remote_client.SendAlertMessage("User is not on the region ban list"); + } + //m_scene.RegionInfo.regionBanlist.Add(Manager(user); + remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 256) != 0) // Manager add + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.AddEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } + } + if ((estateAccessType & 512) != 0) // Manager remove + { + if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) + { + m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); + m_scene.RegionInfo.EstateSettings.Save(); + + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); + } + else + { + remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index d5218b553e..1dfa1b1b76 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -879,7 +879,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 55bbed9285..6785c08ce9 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1220,7 +1220,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fa47d16324..4a4c51557b 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -897,7 +897,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 93cab0e817..8b79502127 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -924,7 +924,7 @@ namespace OpenSim.Tests.Common.Mock { } - public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) + public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) { } From 332463ca94c24bf6706cd40d4c2fa89b1cd13199 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 15:28:52 +0000 Subject: [PATCH 06/26] Fix up the weird Lindenish "setaccess" message. Talk about strange.... --- OpenSim/Framework/Constants.cs | 8 ++++---- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 632431fb3f..5757061efc 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -36,10 +36,10 @@ namespace OpenSim.Framework public enum EstateAccessCodex : uint { - AccessOptions = 17, - AllowedGroups = 18, - EstateBans = 20, - EstateManagers = 24 + AccessOptions = 1, + AllowedGroups = 2, + EstateBans = 4, + EstateManagers = 8 } [Flags]public enum TeleportFlags : uint diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d3c32432d..515d0ea1c2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3935,7 +3935,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + + j = 2; // Agents + if ((code & 2) != 0) + j = 3; // Groups + if ((code & 8) != 0) + j = 5; // Managers + + returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); + j = 6; + for (int i = 0; i < Data.Length; i++) { returnblock[j].Parameter = Data[i].GetBytes(); j++; From 673a52fa7a0cef508396cfc2185825e72cf96507 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 15:58:18 +0000 Subject: [PATCH 07/26] Implement the groups module query to make the estate allowed groups work --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 764ac6014f..183d811f43 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3525,8 +3525,35 @@ namespace OpenSim.Region.Framework.Scenes return false; } + IGroupsModule groupsModule = + RequestModuleInterface(); + + List agentGroups = new List(); + + if (groupsModule != null) + { + GroupMembershipData[] GroupMembership = + groupsModule.GetMembershipData(agent.AgentID); + + for (int i = 0; i < GroupMembership.Length; i++) + agentGroups.Add(GroupMembership[i].GroupID); + } + + bool groupAccess = false; + UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups; + + foreach (UUID group in estateGroups) + { + if (agentGroups.Contains(group)) + { + groupAccess = true; + break; + } + } + if (!m_regInfo.EstateSettings.PublicAccess && - !m_regInfo.EstateSettings.HasAccess(agent.AgentID)) + !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && + !groupAccess) { m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); From bc558788c2b52b6ec9143b1697806624b9fb7977 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 16:32:14 +0000 Subject: [PATCH 08/26] A last fix for estate access by group. One should send the correct list. --- .../Region/CoreModules/World/Estate/EstateManagementModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index deade6bd82..695cced293 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } else { @@ -292,7 +292,7 @@ namespace OpenSim.Region.CoreModules.World.Estate m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); m_scene.RegionInfo.EstateSettings.Save(); - remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); + remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); } else { From 49c09ef24c37637c023d1ae22865d546efc4d0d0 Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 8 Jan 2010 12:37:10 -0600 Subject: [PATCH 09/26] Fixes prim to prim collision. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d1bc351b3d..cadb19f704 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1941,7 +1941,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; @@ -2077,7 +2077,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; @@ -2208,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (found) + if (!found) { DetectedObject detobj = new DetectedObject(); detobj.keyUUID = obj.UUID; From 81d5a4b6d8d8548dde98cbf827d171bb1ebf96ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:03:18 +0000 Subject: [PATCH 10/26] Remove "login disable", "login enable" and "login status" commands. --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 111 +++++++----------- .../Client/Linden/LLStandaloneLoginModule.cs | 15 --- .../Client/Linden/LLStandaloneLoginService.cs | 19 ++- .../Communications/Tests/LoginServiceTests.cs | 10 +- .../ILoginServiceToRegionsConnector.cs | 1 - OpenSim/Region/Application/OpenSim.cs | 48 -------- OpenSim/Region/Application/OpenSimBase.cs | 31 ----- .../Hypergrid/HGStandaloneLoginModule.cs | 15 --- .../Grid/HGGridConnector.cs | 2 - .../Scenes/SceneCommunicationService.cs | 7 -- 10 files changed, 49 insertions(+), 210 deletions(-) diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 9075f15f43..14ce682084 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -60,21 +60,6 @@ namespace OpenSim.Client.Linden m_port = port; } - protected bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected List m_scenes = new List(); protected Scene m_firstScene; @@ -239,67 +224,53 @@ namespace OpenSim.Client.Linden agentData.child = false; } - if (!RegionLoginsEnabled) - { - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", - agentData.firstname, agentData.lastname); + bool success = false; + string denyMess = ""; + Scene scene; + if (TryGetRegion(regionHandle, out scene)) + { + if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) + { + denyMess = "User is banned from this region"; + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user is banned", + agentData.firstname, agentData.lastname); + } + else + { + string reason; + if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) + { + success = true; + } + else + { + denyMess = String.Format("Login refused by region: {0}", reason); + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", + agentData.firstname, agentData.lastname); + } + } + + } + else + { + denyMess = "Region not found"; + } + + if (success) + { Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = "region login currently disabled"; + respdata["success"] = "TRUE"; resp.Value = respdata; } else { - bool success = false; - string denyMess = ""; - - Scene scene; - if (TryGetRegion(regionHandle, out scene)) - { - if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) - { - denyMess = "User is banned from this region"; - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user is banned", - agentData.firstname, agentData.lastname); - } - else - { - string reason; - if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) - { - success = true; - } - else - { - denyMess = String.Format("Login refused by region: {0}", reason); - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", - agentData.firstname, agentData.lastname); - } - } - - } - else - { - denyMess = "Region not found"; - } - - if (success) - { - Hashtable respdata = new Hashtable(); - respdata["success"] = "TRUE"; - resp.Value = respdata; - } - else - { - Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = denyMess; - resp.Value = respdata; - } + Hashtable respdata = new Hashtable(); + respdata["success"] = "FALSE"; + respdata["reason"] = denyMess; + resp.Value = respdata; } } catch (Exception e) diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index 8047f74c8e..e51eace0e9 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs @@ -56,21 +56,6 @@ namespace OpenSim.Client.Linden protected bool authenticate; protected string welcomeMessage; - public bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected LLStandaloneLoginService m_loginService; #region IRegionModule Members diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs index 122110d406..9ab043a59a 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs @@ -202,20 +202,15 @@ namespace OpenSim.Client.Linden agent.Appearance = new AvatarAppearance(agent.AgentID); } - if (m_regionsConnector.RegionLoginsEnabled) + string reason; + bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); + if (!success) { - string reason; - bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); - if (!success) - { - response.ErrorReason = "key"; - response.ErrorMessage = reason; - } - return success; - // return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); + response.ErrorReason = "key"; + response.ErrorMessage = reason; } - - return false; + return success; + // return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason); } public override void LogOffUser(UserProfileData theUser, string message) diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 60f0ba8ef6..a274ae7239 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -388,12 +388,6 @@ namespace OpenSim.Framework.Communications.Tests } } - #region ILoginRegionsConnector Members - public bool RegionLoginsEnabled - { - get { return true; } - } - public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message) { } @@ -454,8 +448,6 @@ namespace OpenSim.Framework.Communications.Tests return null; } - - #endregion } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs index 2aee88e557..5a155c1127 100644 --- a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs +++ b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs @@ -32,7 +32,6 @@ namespace OpenSim.Framework { public interface ILoginServiceToRegionsConnector { - bool RegionLoginsEnabled { get; } void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message); bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason); RegionInfo RequestClosestRegion(string region); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 82b2fd4e28..c9f2cfaee1 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -287,18 +287,6 @@ namespace OpenSim "create region", "Create a new region", HandleCreateRegion); - m_console.Commands.AddCommand("region", false, "login enable", - "login enable", - "Enable logins to the simulator", HandleLoginEnable); - - m_console.Commands.AddCommand("region", false, "login disable", - "login disable", - "Disable logins to the simulator", HandleLoginDisable); - - m_console.Commands.AddCommand("region", false, "login status", - "login status", - "Display status of logins", HandleLoginStatus); - m_console.Commands.AddCommand("region", false, "restart", "restart", "Restart all sims in this instance", RunCommand); @@ -558,42 +546,6 @@ namespace OpenSim } } - /// - /// Enable logins - /// - /// - /// - private void HandleLoginEnable(string module, string[] cmd) - { - ProcessLogin(true); - } - - - /// - /// Disable logins - /// - /// - /// - private void HandleLoginDisable(string module, string[] cmd) - { - ProcessLogin(false); - } - - /// - /// Log login status to the console - /// - /// - /// - private void HandleLoginStatus(string module, string[] cmd) - { - if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false) - - m_log.Info("[ Login ] Login are disabled "); - else - m_log.Info("[ Login ] Login are enabled"); - } - - /// /// Change and load configuration file data. /// diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 391856bbc2..cf2ab65b22 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -203,12 +203,6 @@ namespace OpenSim plugin.PostInitialise(); } - // Only enable logins to the regions once we have completely finished starting up (apart from scripts) - if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null)) - { - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; - } - AddPluginCommands(); } @@ -278,31 +272,6 @@ namespace OpenSim m_sceneManager.OnRestartSim += handleRestartRegion; } - /// - /// Initialises the asset cache. This supports legacy configuration values - /// to ensure consistent operation, but values outside of that namespace - /// are handled by the more generic resolution mechanism provided by - /// the ResolveAssetServer virtual method. If extended resolution fails, - /// then the normal default action is taken. - /// Creation of the AssetCache is handled by ResolveAssetCache. This - /// function accepts a reference to the instantiated AssetServer and - /// returns an IAssetCache implementation, if possible. This is a virtual - /// method. - /// - public void ProcessLogin(bool LoginEnabled) - { - if (LoginEnabled) - { - m_log.Info("[LOGIN]: Login is now enabled."); - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; - } - else - { - m_log.Info("[LOGIN]: Login is now disabled."); - SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false; - } - } - /// /// Execute the region creation process. This includes setting up scene infrastructure. /// diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 46ee3c005a..0b54746f19 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -55,21 +55,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid protected bool m_enabled = false; // Module is only enabled if running in standalone mode - public bool RegionLoginsEnabled - { - get - { - if (m_firstScene != null) - { - return m_firstScene.SceneGridService.RegionLoginsEnabled; - } - else - { - return false; - } - } - } - protected HGLoginAuthService m_loginService; #region IRegionModule Members diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 93cb60c9d2..f9cd90fc8c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -696,8 +696,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome) { comingHome = false; - if (!m_aScene.SceneGridService.RegionLoginsEnabled) - return false; CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID); if (uinfo != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index f49d072087..6164368153 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -65,13 +65,6 @@ namespace OpenSim.Region.Framework.Scenes protected List m_agentsInTransit; - public bool RegionLoginsEnabled - { - get { return m_regionLoginsEnabled; } - set { m_regionLoginsEnabled = value; } - } - private bool m_regionLoginsEnabled = false; - /// /// An agent is crossing into this region /// From b0a7bcb2c814554dff4fc6dcdcd45ccf700601e9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:17:40 +0000 Subject: [PATCH 11/26] Add "StartDisabled" to [Startup] to make all regions start up with logins disabled until enabled from the console. Add the AccessModule (WIP) --- .../Resources/CoreModulePlugin.addin.xml | 1 + .../CoreModules/World/Access/AccessModule.cs | 82 +++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++-- bin/OpenSim.ini.example | 3 + 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Access/AccessModule.cs diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index beb2307c57..ebc7f59d85 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -47,6 +47,7 @@ \ \ + \ diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs new file mode 100644 index 0000000000..108dcfb47d --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Region.CoreModules.World +{ + public class AccessModule : ISharedRegionModule + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public void Initialise(IConfigSource config) + { + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public string Name + { + get { return "AccessModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + } + } +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 183d811f43..da0b8e4b50 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes public CommunicationsManager CommsManager; protected SceneCommunicationService m_sceneGridService; - public bool loginsdisabled = true; + public bool LoginsDisabled = true; public new float TimeDilation { @@ -1275,15 +1275,19 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); } - if (loginsdisabled && m_frame > 20) + if (LoginsDisabled && m_frame > 20) { // In 99.9% of cases it is a bad idea to manually force garbage collection. However, // this is a rare case where we know we have just went through a long cycle of heap // allocations, and there is no more work to be done until someone logs in GC.Collect(); - m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - loginsdisabled = false; + IConfig startupConfig = m_config.Configs["Startup"]; + if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) + { + m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); + LoginsDisabled = false; + } } } catch (NotImplementedException) @@ -3348,7 +3352,7 @@ namespace OpenSim.Region.Framework.Scenes // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport - if (loginsdisabled) + if (LoginsDisabled) { reason = "Logins Disabled"; return false; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 15623de5b8..af6345aa18 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -268,6 +268,9 @@ ; Enable JSON simulator data by setting a URI name (case sensitive) ; Stats_URI = "jsonSimStats" + ; Make OpenSim start all regions woth logins disabled. They will need + ; to be enabled from the console if this is set + ; StartDisabled = false [SMTP] enabled=false From b9e6f4583cbfc10f566f702f70cecb5348fec023 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 03:48:10 +0000 Subject: [PATCH 12/26] Implement access module commands --- .../CoreModules/World/Access/AccessModule.cs | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 108dcfb47d..dfa8df6922 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -32,6 +32,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -45,8 +46,30 @@ namespace OpenSim.Region.CoreModules.World LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private List m_SceneList = new List(); + public void Initialise(IConfigSource config) { + MainConsole.Instance.Commands.AddCommand("access", true, + "login enable", + "login enable", + "Enable simulator logins", + String.Empty, + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("access", true, + "login disable", + "login disable", + "Disable simulator logins", + String.Empty, + HandleLoginCommand); + + MainConsole.Instance.Commands.AddCommand("access", true, + "login status", + "login status", + "Show login status", + String.Empty, + HandleLoginCommand); } public void PostInitialise() @@ -69,14 +92,67 @@ namespace OpenSim.Region.CoreModules.World public void AddRegion(Scene scene) { + if (!m_SceneList.Contains(scene)) + m_SceneList.Add(scene); } public void RemoveRegion(Scene scene) { + m_SceneList.Remove(scene); } public void RegionLoaded(Scene scene) { } + + public void HandleLoginCommand(string module, string[] cmd) + { + if ((Scene)MainConsole.Instance.ConsoleScene == null) + { + foreach (Scene s in m_SceneList) + { + if(!ProcessCommand(s, cmd)) + break; + } + } + else + { + ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd); + } + } + + bool ProcessCommand(Scene scene, string[] cmd) + { + if (cmd.Length < 2) + { + MainConsole.Instance.Output("Syntax: login enable|disable|status"); + return false; + } + + switch (cmd[1]) + { + case "enable": + if (scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName)); + scene.LoginsDisabled = false; + break; + case "disable": + if (!scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName)); + scene.LoginsDisabled = true; + break; + case "status": + if (scene.LoginsDisabled) + MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName)); + else + MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); + break; + default: + MainConsole.Instance.Output("Syntax: login enable|disable|status"); + return false; + } + + return true; + } } } From 45b19e5e2da33813de07c2be2e46c1f28cbf9b38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 04:05:19 +0000 Subject: [PATCH 13/26] Fix a small bug in login disable code --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index da0b8e4b50..bc9301b8b9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1275,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); } - if (LoginsDisabled && m_frame > 20) + if (LoginsDisabled && m_frame == 20) { // In 99.9% of cases it is a bad idea to manually force garbage collection. However, // this is a rare case where we know we have just went through a long cycle of heap From 038ec133e648ab99643f5738e4ab85e450e5aa45 Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 14:28:53 -0600 Subject: [PATCH 14/26] Adds land collision events. CRs cleaned from patch Signed-off-by: Melanie --- .../Region/Framework/Scenes/EventManager.cs | 28 ++++ .../Framework/Scenes/SceneObjectPart.cs | 138 ++++++++++++++++-- .../ScriptEngine/XEngine/EventManager.cs | 71 ++++++--- 3 files changed, 210 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 753344d1a0..4dd6f32383 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -189,6 +189,10 @@ namespace OpenSim.Region.Framework.Scenes public event ScriptColliding OnScriptColliding; public event ScriptColliding OnScriptCollidingEnd; + public event ScriptColliding OnScriptLandColliderStart; + public event ScriptColliding OnScriptLandColliding; + public event ScriptColliding OnScriptLandColliderEnd; + public delegate void OnMakeChildAgentDelegate(ScenePresence presence); public event OnMakeChildAgentDelegate OnMakeChildAgent; @@ -439,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes private ScriptColliding handlerCollidingStart = null; private ScriptColliding handlerColliding = null; private ScriptColliding handlerCollidingEnd = null; + private ScriptColliding handlerLandCollidingStart = null; + private ScriptColliding handlerLandColliding = null; + private ScriptColliding handlerLandCollidingEnd = null; private GetScriptRunning handlerGetScriptRunning = null; private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; @@ -1034,6 +1041,27 @@ namespace OpenSim.Region.Framework.Scenes handlerCollidingEnd(localId, colliders); } + public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) + { + handlerLandCollidingStart = OnScriptLandColliderStart; + if (handlerLandCollidingStart != null) + handlerLandCollidingStart(localId, colliders); + } + + public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) + { + handlerLandColliding = OnScriptLandColliding; + if (handlerLandColliding != null) + handlerLandColliding(localId, colliders); + } + + public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) + { + handlerLandCollidingEnd = OnScriptLandColliderEnd; + if (handlerLandCollidingEnd != null) + handlerLandCollidingEnd(localId, colliders); + } + public void TriggerSetRootAgentScene(UUID agentID, Scene scene) { handlerSetRootAgentScene = OnSetRootAgentScene; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cadb19f704..a427f12d98 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1853,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes // and build up list of colliders this time foreach (uint localid in collissionswith.Keys) { - if (localid != 0) + thisHitColliders.Add(localid); + if (!m_lastColliders.Contains(localid)) { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - { - startedColliders.Add(localid); - } - - //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); + startedColliders.Add(localid); } + //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); } // calculate things that ended colliding @@ -1904,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes List colliding = new List(); foreach (uint localId in startedColliders) { + if (localId == 0) + return; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; @@ -2039,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes { // always running this check because if the user deletes the object it would return a null reference. if (localId == 0) - continue; + return; if (m_parentGroup == null) return; @@ -2171,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in endedColliders) { if (localId == 0) - continue; + return; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) @@ -2293,6 +2291,120 @@ namespace OpenSim.Region.Framework.Scenes } } } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) + { + if (startedColliders.Count > 0) + { + ColliderArgs LandStartCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandStartCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage); + } + } + } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) + { + if (m_lastColliders.Count > 0) + { + ColliderArgs LandCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage); + } + } + } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) + { + if (endedColliders.Count > 0) + { + ColliderArgs LandEndCollidingMessage = new ColliderArgs(); + List colliding = new List(); + foreach (uint localId in startedColliders) + { + if (localId == 0) + { + //Hope that all is left is ground! + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = UUID.Zero; + detobj.nameStr = ""; + detobj.ownerUUID = UUID.Zero; + detobj.posVector = m_parentGroup.RootPart.AbsolutePosition; + detobj.rotQuat = Quaternion.Identity; + detobj.velVector = Vector3.Zero; + detobj.colliderType = 0; + detobj.groupUUID = UUID.Zero; + colliding.Add(detobj); + } + } + + if (colliding.Count > 0) + { + LandEndCollidingMessage.Colliders = colliding; + // always running this check because if the user deletes the object it would return a null reference. + if (m_parentGroup == null) + return; + + if (m_parentGroup.Scene == null) + return; + + m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage); + } + } + } } public void PhysicsOutOfBounds(Vector3 pos) @@ -3698,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes ((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || (CollisionSound != UUID.Zero) ) { @@ -3902,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes ((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || + ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || (CollisionSound != UUID.Zero) ) { diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 8195f33663..b2eab45837 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -63,6 +63,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; + myScriptEngine.World.EventManager.OnScriptLandColliderStart += land_collision_start; + myScriptEngine.World.EventManager.OnScriptLandColliding += land_collision; + myScriptEngine.World.EventManager.OnScriptLandColliderEnd += land_collision_end; IMoneyModule money=myScriptEngine.World.RequestModuleInterface(); if (money != null) { @@ -285,29 +288,63 @@ namespace OpenSim.Region.ScriptEngine.XEngine det.ToArray())); } - public void land_collision_start(uint localID, UUID itemID) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision_start", - new object[0], - new DetectParams[0])); + public void land_collision_start(uint localID, ColliderArgs col) + { + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision_start", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } + } - public void land_collision(uint localID, UUID itemID) + public void land_collision(uint localID, ColliderArgs col) { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision", - new object[0], - new DetectParams[0])); + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } } - public void land_collision_end(uint localID, UUID itemID) + public void land_collision_end(uint localID, ColliderArgs col) { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "land_collision_end", - new object[0], - new DetectParams[0])); - } + List det = new List(); + + foreach (DetectedObject detobj in col.Colliders) + { + DetectParams d = new DetectParams(); + d.Position = new LSL_Types.Vector3(detobj.posVector.X, + detobj.posVector.Y, + detobj.posVector.Z); + d.Populate(myScriptEngine.World); + det.Add(d); + myScriptEngine.PostObjectEvent(localID, new EventParams( + "land_collision_end", + new Object[] { new LSL_Types.Vector3(d.Position) }, + det.ToArray())); + } + } // timer: not handled here // listen: not handled here From 2bf49cc1bb2d87877476f68daec2d515f475406d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 19:58:44 +0000 Subject: [PATCH 15/26] Clean CRs from previous patch --- .../Framework/Scenes/SceneObjectPart.cs | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a427f12d98..73f79b3751 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -139,15 +139,15 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; [XmlIgnore] - public UUID FromItemID; - - [XmlIgnore] - public int STATUS_ROTATE_X; - - [XmlIgnore] - public int STATUS_ROTATE_Y; - - [XmlIgnore] + public UUID FromItemID; + + [XmlIgnore] + public int STATUS_ROTATE_X; + + [XmlIgnore] + public int STATUS_ROTATE_Y; + + [XmlIgnore] public int STATUS_ROTATE_Z; [XmlIgnore] @@ -1680,19 +1680,19 @@ namespace OpenSim.Region.Framework.Scenes return false; return m_parentGroup.RootPart.DIE_AT_EDGE; - } - - public int GetAxisRotation(int axis) - { - //Cannot use ScriptBaseClass constants as no referance to it currently. - if (axis == 2)//STATUS_ROTATE_X - return STATUS_ROTATE_X; - if (axis == 4)//STATUS_ROTATE_Y - return STATUS_ROTATE_Y; - if (axis == 8)//STATUS_ROTATE_Z - return STATUS_ROTATE_Z; - - return 0; + } + + public int GetAxisRotation(int axis) + { + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + return STATUS_ROTATE_X; + if (axis == 4)//STATUS_ROTATE_Y + return STATUS_ROTATE_Y; + if (axis == 8)//STATUS_ROTATE_Z + return STATUS_ROTATE_Z; + + return 0; } public double GetDistanceTo(Vector3 a, Vector3 b) @@ -1934,24 +1934,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = obj.UUID; - detobj.nameStr = obj.Name; - detobj.ownerUUID = obj._ownerID; - detobj.posVector = obj.AbsolutePosition; - detobj.rotQuat = obj.GetWorldRotation(); - detobj.velVector = obj.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = obj._groupID; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work + if (!found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = obj.UUID; + detobj.nameStr = obj.Name; + detobj.ownerUUID = obj._ownerID; + detobj.posVector = obj.AbsolutePosition; + detobj.rotQuat = obj.GetWorldRotation(); + detobj.velVector = obj.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = obj._groupID; + colliding.Add(detobj); + } } } else @@ -1963,7 +1963,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); @@ -1985,24 +1985,24 @@ namespace OpenSim.Region.Framework.Scenes else { } - } - else - { + } + else + { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); - //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work - if (!found) - { - DetectedObject detobj = new DetectedObject(); - detobj.keyUUID = av.UUID; - detobj.nameStr = av.ControllingClient.Name; - detobj.ownerUUID = av.UUID; - detobj.posVector = av.AbsolutePosition; - detobj.rotQuat = av.Rotation; - detobj.velVector = av.Velocity; - detobj.colliderType = 0; - detobj.groupUUID = av.ControllingClient.ActiveGroupId; - colliding.Add(detobj); - } + //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work + if (!found) + { + DetectedObject detobj = new DetectedObject(); + detobj.keyUUID = av.UUID; + detobj.nameStr = av.ControllingClient.Name; + detobj.ownerUUID = av.UUID; + detobj.posVector = av.AbsolutePosition; + detobj.rotQuat = av.Rotation; + detobj.velVector = av.Velocity; + detobj.colliderType = 0; + detobj.groupUUID = av.ControllingClient.ActiveGroupId; + colliding.Add(detobj); + } } } @@ -2099,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); @@ -2230,7 +2230,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avlist[i]; if (av.LocalId == localId) - { + { if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) { bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); @@ -2290,7 +2290,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); } } - } + } if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) { if (startedColliders.Count > 0) @@ -2870,13 +2870,13 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup != null) { m_parentGroup.SetAxisRotation(axis, rotate); - } - //Cannot use ScriptBaseClass constants as no referance to it currently. - if (axis == 2)//STATUS_ROTATE_X - STATUS_ROTATE_X = rotate; - if (axis == 4)//STATUS_ROTATE_Y - STATUS_ROTATE_Y = rotate; - if (axis == 8)//STATUS_ROTATE_Z + } + //Cannot use ScriptBaseClass constants as no referance to it currently. + if (axis == 2)//STATUS_ROTATE_X + STATUS_ROTATE_X = rotate; + if (axis == 4)//STATUS_ROTATE_Y + STATUS_ROTATE_Y = rotate; + if (axis == 8)//STATUS_ROTATE_Z STATUS_ROTATE_Z = rotate; } From a0859754c03324be9a4a2b9c9f26928e64cb5a6f Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 10 Jan 2010 20:20:00 -0600 Subject: [PATCH 16/26] Adds llRotTarget and the events at_rot_target and not_at_rot_target. Signed-off-by: Melanie --- .../Region/Framework/Scenes/EventManager.cs | 32 ++++- .../Framework/Scenes/SceneObjectGroup.cs | 130 +++++++++++++++++- .../Framework/Scenes/SceneObjectPart.cs | 17 +++ .../Shared/Api/Implementation/LSL_Api.cs | 9 +- .../Shared/Api/Runtime/Executor.cs | 7 +- .../ScriptEngine/XEngine/EventManager.cs | 22 +-- 6 files changed, 196 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4dd6f32383..76d5cb6421 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,7 +181,15 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + + public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); + + public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; + + public delegate void ScriptNotAtRotTargetEvent(uint localID); + + public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; public delegate void ScriptColliding(uint localID, ColliderArgs colliders); @@ -383,7 +391,9 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; + private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; private ClientMovement handlerClientMovement = null; //OnClientMovement; private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; @@ -849,6 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } + } + + public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) + { + handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; + if (handlerScriptAtRotTargetEvent != null) + { + handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); + } + } + + public void TriggerNotAtRotTargetEvent(uint localID) + { + handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; + if (handlerScriptNotAtRotTargetEvent != null) + { + handlerScriptNotAtRotTargetEvent(localID); + } } public void TriggerRequestChangeWaterHeight(float height) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34d8b49c83..8050bf6092 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,8 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -79,6 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -165,10 +173,14 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); + private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1261,6 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) m_targets.Clear(); m_scene.RemoveGroupTarget(this); + } + m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); + m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); + + if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) + { + lock (m_rotTargets) + m_rotTargets.Clear(); + m_scene.RemoveGroupTarget(this); } ScheduleGroupForFullUpdate(); @@ -3157,6 +3178,30 @@ namespace OpenSim.Region.Framework.Scenes } } + } + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + scriptRotTarget waypoint = new scriptRotTarget(); + waypoint.targetRot = target; + waypoint.tolerance = tolerance; + uint handle = m_scene.AllocateLocalId(); + waypoint.handle = handle; + lock (m_rotTargets) + { + m_rotTargets.Add(handle, waypoint); + } + m_scene.AddGroupTarget(this); + return (int)handle; + } + + public void unregisterRotTargetWaypoint(int handle) + { + lock (m_targets) + { + m_rotTargets.Remove((uint)handle); + if (m_targets.Count == 0) + m_scene.RemoveGroupTarget(this); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) @@ -3263,6 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + lock (m_rotTargets) + { + foreach (uint idx in m_rotTargets.Keys) + { + scriptRotTarget target = m_rotTargets[idx]; + double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; + if (angle < 0) angle = -angle; + if (angle > Math.PI) angle = (Math.PI * 2 - angle); + if (angle <= target.tolerance) + { + // trigger at_rot_target + if (m_scriptListens_atRotTarget) + { + at_Rottarget = true; + scriptRotTarget att = new scriptRotTarget(); + att.targetRot = target.targetRot; + att.tolerance = target.tolerance; + att.handle = target.handle; + atRotTargets.Add(idx, att); + } + } + } + } + + if (atRotTargets.Count > 0) + { + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + foreach (uint target in atRotTargets.Keys) + { + scriptRotTarget att = atRotTargets[target]; + m_scene.EventManager.TriggerAtRotTargetEvent( + localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); + } + } + + return; + } + + if (m_scriptListens_notAtRotTarget && !at_Rottarget) + { + //trigger not_at_target + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 73f79b3751..177de476ff 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,6 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } + } + + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + if (m_parentGroup != null) + { + return m_parentGroup.registerRotTargetWaypoint(target, tolerance); + } + return 0; + } + + public void unregisterRotTargetWaypoint(int handle) + { + if (m_parentGroup != null) + { + m_parentGroup.unregisterRotTargetWaypoint(handle); + } } public void SetCameraAtOffset(Vector3 v) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39b597e05d..856f8b6863 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2108,15 +2108,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { - m_host.AddScriptLPS(1); - NotImplemented("llRotTarget"); - return 0; + m_host.AddScriptLPS(1); + return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); } public void llRotTargetRemove(int number) { - m_host.AddScriptLPS(1); - NotImplemented("llRotTargetRemove"); + m_host.AddScriptLPS(1); + m_host.unregisterRotTargetWaypoint(number); } public void llMoveToTarget(LSL_Vector target, double tau) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index 7f67599c92..fb8685021d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs @@ -61,7 +61,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, + at_rot_target = 16777216, listen = 32768, money = 65536, moving_end = 131072, @@ -202,8 +203,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return; } - m_eventFlagsMap.Add("attach", scriptEvents.attach); - // m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target); + m_eventFlagsMap.Add("attach", scriptEvents.attach); + m_eventFlagsMap.Add("at_rot_target", scriptEvents.at_rot_target); m_eventFlagsMap.Add("at_target", scriptEvents.at_target); // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed); m_eventFlagsMap.Add("collision", scriptEvents.collision); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index b2eab45837..ce22ba5419 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -58,7 +58,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; - myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; @@ -388,16 +390,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_target",new object[0], new DetectParams[0])); - } - - public void at_rot_target(uint localID, UUID itemID) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( - "at_rot_target",new object[0], + } + + public void at_rot_target(uint localID, uint handle, Quaternion targetrot, + Quaternion atrot) + { + myScriptEngine.PostObjectEvent(localID, new EventParams( + "at_rot_target", new object[] { + new LSL_Types.LSLInteger(handle), + new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W), + new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, new DetectParams[0])); } - public void not_at_rot_target(uint localID, UUID itemID) + public void not_at_rot_target(uint localID) { myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_rot_target",new object[0], From 2320b17ca92d0c922d78ad72933fe3903f2108d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 02:04:05 +0000 Subject: [PATCH 17/26] Whitespace cleanup --- .../Region/Framework/Scenes/EventManager.cs | 56 ++-- .../Framework/Scenes/SceneObjectGroup.cs | 248 +++++++++--------- .../Framework/Scenes/SceneObjectPart.cs | 34 +-- .../Shared/Api/Implementation/LSL_Api.cs | 4 +- .../Shared/Api/Runtime/Executor.cs | 4 +- .../ScriptEngine/XEngine/EventManager.cs | 20 +- 6 files changed, 183 insertions(+), 183 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 76d5cb6421..399379ea2c 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -181,14 +181,14 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ScriptNotAtTargetEvent(uint localID); - public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; - - public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); - - public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; - - public delegate void ScriptNotAtRotTargetEvent(uint localID); - + public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; + + public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot); + + public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent; + + public delegate void ScriptNotAtRotTargetEvent(uint localID); + public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent; public delegate void ScriptColliding(uint localID, ColliderArgs colliders); @@ -391,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; - private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; + private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; + private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; private ClientMovement handlerClientMovement = null; //OnClientMovement; private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; @@ -859,24 +859,24 @@ namespace OpenSim.Region.Framework.Scenes { handlerScriptNotAtTargetEvent(localID); } - } - - public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) - { - handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; - if (handlerScriptAtRotTargetEvent != null) - { - handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); - } - } - - public void TriggerNotAtRotTargetEvent(uint localID) - { - handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; - if (handlerScriptNotAtRotTargetEvent != null) - { - handlerScriptNotAtRotTargetEvent(localID); - } + } + + public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) + { + handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; + if (handlerScriptAtRotTargetEvent != null) + { + handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); + } + } + + public void TriggerNotAtRotTargetEvent(uint localID) + { + handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; + if (handlerScriptNotAtRotTargetEvent != null) + { + handlerScriptNotAtRotTargetEvent(localID); + } } public void TriggerRequestChangeWaterHeight(float height) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8050bf6092..ec41ac76c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, at_rot_target = 16777216, listen = 32768, money = 65536, @@ -80,13 +80,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 targetPos; public float tolerance; public uint handle; - } - - struct scriptRotTarget - { - public Quaternion targetRot; - public float tolerance; - public uint handle; + } + + struct scriptRotTarget + { + public Quaternion targetRot; + public float tolerance; + public uint handle; } public delegate void PrimCountTaintedDelegate(); @@ -173,13 +173,13 @@ namespace OpenSim.Region.Framework.Scenes protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); - private Dictionary m_targets = new Dictionary(); + private Dictionary m_targets = new Dictionary(); private Dictionary m_rotTargets = new Dictionary(); private bool m_scriptListens_atTarget = false; - private bool m_scriptListens_notAtTarget = false; - - private bool m_scriptListens_atRotTarget = false; + private bool m_scriptListens_notAtTarget = false; + + private bool m_scriptListens_atRotTarget = false; private bool m_scriptListens_notAtRotTarget = false; internal Dictionary m_savedScriptState = null; @@ -1273,15 +1273,15 @@ namespace OpenSim.Region.Framework.Scenes lock (m_targets) m_targets.Clear(); m_scene.RemoveGroupTarget(this); - } - m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); - m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); - - if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) - { - lock (m_rotTargets) - m_rotTargets.Clear(); - m_scene.RemoveGroupTarget(this); + } + m_scriptListens_atRotTarget = ((aggregateScriptEvents & scriptEvents.at_rot_target) != 0); + m_scriptListens_notAtRotTarget = ((aggregateScriptEvents & scriptEvents.not_at_rot_target) != 0); + + if (!m_scriptListens_atRotTarget && !m_scriptListens_notAtRotTarget) + { + lock (m_rotTargets) + m_rotTargets.Clear(); + m_scene.RemoveGroupTarget(this); } ScheduleGroupForFullUpdate(); @@ -3178,30 +3178,30 @@ namespace OpenSim.Region.Framework.Scenes } } - } - public int registerRotTargetWaypoint(Quaternion target, float tolerance) - { - scriptRotTarget waypoint = new scriptRotTarget(); - waypoint.targetRot = target; - waypoint.tolerance = tolerance; - uint handle = m_scene.AllocateLocalId(); - waypoint.handle = handle; - lock (m_rotTargets) - { - m_rotTargets.Add(handle, waypoint); - } - m_scene.AddGroupTarget(this); - return (int)handle; - } - - public void unregisterRotTargetWaypoint(int handle) - { - lock (m_targets) - { - m_rotTargets.Remove((uint)handle); - if (m_targets.Count == 0) - m_scene.RemoveGroupTarget(this); - } + } + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + scriptRotTarget waypoint = new scriptRotTarget(); + waypoint.targetRot = target; + waypoint.tolerance = tolerance; + uint handle = m_scene.AllocateLocalId(); + waypoint.handle = handle; + lock (m_rotTargets) + { + m_rotTargets.Add(handle, waypoint); + } + m_scene.AddGroupTarget(this); + return (int)handle; + } + + public void unregisterRotTargetWaypoint(int handle) + { + lock (m_targets) + { + m_rotTargets.Remove((uint)handle); + if (m_targets.Count == 0) + m_scene.RemoveGroupTarget(this); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) @@ -3308,85 +3308,85 @@ namespace OpenSim.Region.Framework.Scenes } } } - } - if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) - { - if (m_rotTargets.Count > 0) - { - bool at_Rottarget = false; - Dictionary atRotTargets = new Dictionary(); - lock (m_rotTargets) - { - foreach (uint idx in m_rotTargets.Keys) - { - scriptRotTarget target = m_rotTargets[idx]; - double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; - if (angle < 0) angle = -angle; - if (angle > Math.PI) angle = (Math.PI * 2 - angle); - if (angle <= target.tolerance) - { - // trigger at_rot_target - if (m_scriptListens_atRotTarget) - { - at_Rottarget = true; - scriptRotTarget att = new scriptRotTarget(); - att.targetRot = target.targetRot; - att.tolerance = target.tolerance; - att.handle = target.handle; - atRotTargets.Add(idx, att); - } - } - } - } - - if (atRotTargets.Count > 0) - { - uint[] localids = new uint[0]; - lock (m_parts) - { - localids = new uint[m_parts.Count]; - int cntr = 0; - foreach (SceneObjectPart part in m_parts.Values) - { - localids[cntr] = part.LocalId; - cntr++; - } - } - - for (int ctr = 0; ctr < localids.Length; ctr++) - { - foreach (uint target in atRotTargets.Keys) - { - scriptRotTarget att = atRotTargets[target]; - m_scene.EventManager.TriggerAtRotTargetEvent( - localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); - } - } - - return; - } - - if (m_scriptListens_notAtRotTarget && !at_Rottarget) - { - //trigger not_at_target - uint[] localids = new uint[0]; - lock (m_parts) - { - localids = new uint[m_parts.Count]; - int cntr = 0; - foreach (SceneObjectPart part in m_parts.Values) - { - localids[cntr] = part.LocalId; - cntr++; - } - } - - for (int ctr = 0; ctr < localids.Length; ctr++) - { - m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); - } - } - } + } + if (m_scriptListens_atRotTarget || m_scriptListens_notAtRotTarget) + { + if (m_rotTargets.Count > 0) + { + bool at_Rottarget = false; + Dictionary atRotTargets = new Dictionary(); + lock (m_rotTargets) + { + foreach (uint idx in m_rotTargets.Keys) + { + scriptRotTarget target = m_rotTargets[idx]; + double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; + if (angle < 0) angle = -angle; + if (angle > Math.PI) angle = (Math.PI * 2 - angle); + if (angle <= target.tolerance) + { + // trigger at_rot_target + if (m_scriptListens_atRotTarget) + { + at_Rottarget = true; + scriptRotTarget att = new scriptRotTarget(); + att.targetRot = target.targetRot; + att.tolerance = target.tolerance; + att.handle = target.handle; + atRotTargets.Add(idx, att); + } + } + } + } + + if (atRotTargets.Count > 0) + { + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + foreach (uint target in atRotTargets.Keys) + { + scriptRotTarget att = atRotTargets[target]; + m_scene.EventManager.TriggerAtRotTargetEvent( + localids[ctr], att.handle, att.targetRot, m_rootPart.RotationOffset); + } + } + + return; + } + + if (m_scriptListens_notAtRotTarget && !at_Rottarget) + { + //trigger not_at_target + uint[] localids = new uint[0]; + lock (m_parts) + { + localids = new uint[m_parts.Count]; + int cntr = 0; + foreach (SceneObjectPart part in m_parts.Values) + { + localids[cntr] = part.LocalId; + cntr++; + } + } + + for (int ctr = 0; ctr < localids.Length; ctr++) + { + m_scene.EventManager.TriggerNotAtRotTargetEvent(localids[ctr]); + } + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 177de476ff..56b2f13f3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4078,23 +4078,23 @@ namespace OpenSim.Region.Framework.Scenes { m_parentGroup.unregisterTargetWaypoint(handle); } - } - - public int registerRotTargetWaypoint(Quaternion target, float tolerance) - { - if (m_parentGroup != null) - { - return m_parentGroup.registerRotTargetWaypoint(target, tolerance); - } - return 0; - } - - public void unregisterRotTargetWaypoint(int handle) - { - if (m_parentGroup != null) - { - m_parentGroup.unregisterRotTargetWaypoint(handle); - } + } + + public int registerRotTargetWaypoint(Quaternion target, float tolerance) + { + if (m_parentGroup != null) + { + return m_parentGroup.registerRotTargetWaypoint(target, tolerance); + } + return 0; + } + + public void unregisterRotTargetWaypoint(int handle) + { + if (m_parentGroup != null) + { + m_parentGroup.unregisterRotTargetWaypoint(handle); + } } public void SetCameraAtOffset(Vector3 v) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 856f8b6863..1985e72900 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2108,13 +2108,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llRotTarget(LSL_Rotation rot, double error) { - m_host.AddScriptLPS(1); + m_host.AddScriptLPS(1); return m_host.registerRotTargetWaypoint(new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), (float)error); } public void llRotTargetRemove(int number) { - m_host.AddScriptLPS(1); + m_host.AddScriptLPS(1); m_host.unregisterRotTargetWaypoint(number); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs index fb8685021d..96153156cb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase land_collision = 2048, land_collision_end = 4096, land_collision_start = 8192, - at_target = 16384, + at_target = 16384, at_rot_target = 16777216, listen = 32768, money = 65536, @@ -203,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return; } - m_eventFlagsMap.Add("attach", scriptEvents.attach); + m_eventFlagsMap.Add("attach", scriptEvents.attach); m_eventFlagsMap.Add("at_rot_target", scriptEvents.at_rot_target); m_eventFlagsMap.Add("at_target", scriptEvents.at_target); // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index ce22ba5419..16309efca4 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; - myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; - myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; - myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; + myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target; + myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target; myScriptEngine.World.EventManager.OnScriptControlEvent += control; myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptColliding += collision; @@ -390,16 +390,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine myScriptEngine.PostObjectEvent(localID, new EventParams( "not_at_target",new object[0], new DetectParams[0])); - } - - public void at_rot_target(uint localID, uint handle, Quaternion targetrot, - Quaternion atrot) - { - myScriptEngine.PostObjectEvent(localID, new EventParams( + } + + public void at_rot_target(uint localID, uint handle, Quaternion targetrot, + Quaternion atrot) + { + myScriptEngine.PostObjectEvent(localID, new EventParams( "at_rot_target", new object[] { new LSL_Types.LSLInteger(handle), new LSL_Types.Quaternion(targetrot.X,targetrot.Y,targetrot.Z,targetrot.W), - new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, + new LSL_Types.Quaternion(atrot.X,atrot.Y,atrot.Z,atrot.W) }, new DetectParams[0])); } From e966e51b89bdc0fc36482621f8954e5faffc8fbf Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 03:29:24 +0000 Subject: [PATCH 18/26] Add a console_port setting to let the rest console use a different port from the region server --- OpenSim/Framework/MainServer.cs | 4 ++-- OpenSim/Region/Application/OpenSim.cs | 13 ++++++++++++- bin/OpenSim.ini.example | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 7da4893b62..84cc05eb74 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -32,7 +32,7 @@ namespace OpenSim.Framework { public class MainServer { - private static BaseHttpServer instance; + private static BaseHttpServer instance = null; private static Dictionary m_Servers = new Dictionary(); @@ -46,7 +46,7 @@ namespace OpenSim.Framework { if (port == 0) return Instance; - if (port == Instance.Port) + if (instance != null && port == Instance.Port) return Instance; if (m_Servers.ContainsKey(port)) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c9f2cfaee1..cfa94eaae5 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -53,6 +53,7 @@ namespace OpenSim protected string m_shutdownCommandsFile; protected bool m_gui = false; protected string m_consoleType = "local"; + protected uint m_consolePort = 0; private string m_timedScript = "disabled"; private Timer m_scriptTimer; @@ -79,6 +80,7 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); + m_consolePort = (uint)startupConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { @@ -151,7 +153,16 @@ namespace OpenSim base.StartupSpecific(); if (m_console is RemoteConsole) - ((RemoteConsole)m_console).SetServer(m_httpServer); + { + if (m_consolePort == 0) + { + ((RemoteConsole)m_console).SetServer(m_httpServer); + } + else + { + ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort)); + } + } //Run Startup Commands if (String.IsNullOrEmpty(m_startupCommandsFile)) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index af6345aa18..d09dc676ba 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,6 +326,7 @@ ConsoleUser = "Test" ConsolePass = "secret" http_listener_port = 9000 + console_port = 0 default_location_x = 1000 default_location_y = 1000 From 2b478a61d09a75f0c7e575b7e43807a6c9328e73 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 03:49:05 +0000 Subject: [PATCH 19/26] Add the console port setting to ROBUST, too --- OpenSim/Server/Base/HttpServerBase.cs | 7 ++++++- bin/OpenSim.Server.ini.example | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index ed0210f190..77184a498a 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -49,6 +49,7 @@ namespace OpenSim.Server.Base protected uint m_Port = 0; protected Dictionary m_Servers = new Dictionary(); + protected uint m_consolePort = 0; public IHttpServer HttpServer { @@ -98,6 +99,7 @@ namespace OpenSim.Server.Base Thread.CurrentThread.Abort(); } + m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); m_Port = port; m_HttpServer = new BaseHttpServer(port); @@ -111,7 +113,10 @@ namespace OpenSim.Server.Base if (MainConsole.Instance is RemoteConsole) { - ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + if (m_consolePort == 0) + ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer); + else + ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort)); } } } diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index f3d222f446..12af0cd2c4 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -22,6 +22,7 @@ port = 8003 ; * Leave commented to diable logins to the console ;ConsoleUser = Test ;ConsolePass = secret +;ConsolePort = 0 ; * As an example, the below configuration precisely mimicks the legacy ; * asset server. It is read by the asset IN connector (defined above) From ff55ae0eb210e542d483d04779a9c96210f01691 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 07:59:13 +0000 Subject: [PATCH 20/26] Make console_port work. --- OpenSim/Region/Application/OpenSim.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index cfa94eaae5..e09d730b33 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -67,6 +67,7 @@ namespace OpenSim base.ReadExtraConfigSettings(); IConfig startupConfig = m_config.Source.Configs["Startup"]; + IConfig networkConfig = m_config.Source.Configs["Network"]; int stpMaxThreads = 15; @@ -80,7 +81,8 @@ namespace OpenSim else m_consoleType= startupConfig.GetString("console", String.Empty); - m_consolePort = (uint)startupConfig.GetInt("console_port", 0); + if (networkConfig != null) + m_consolePort = (uint)networkConfig.GetInt("console_port", 0); m_timedScript = startupConfig.GetString("timer_Script", "disabled"); if (m_logFileAppender != null) { From 9c668558d43f4eeac10c1753825ad643fe4b8721 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Jan 2010 15:00:16 +0000 Subject: [PATCH 21/26] minor: formatting --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d8b91598e0..2c8b0eabe3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1983,6 +1983,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (int)pws; } + public void osSetSpeed(string UUID, float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); @@ -1990,6 +1991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); avatar.SpeedModifier = SpeedModifier; } + public void osKickAvatar(string FirstName,string SurName,string alert) { CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); @@ -2010,6 +2012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseDamage(string avatar, double damage) { CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); @@ -2037,6 +2040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + public void osCauseHealing(string avatar, double healing) { CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); @@ -2061,4 +2065,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -} +} \ No newline at end of file From b776e06f0d05f2568f7c29e78c506daa3c13fb73 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Jan 2010 15:47:01 +0000 Subject: [PATCH 22/26] minor: slightly improve README for building addon-modules within the main OpenSim build --- addon-modules/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addon-modules/README b/addon-modules/README index 19f268fa52..b5bf2e007e 100644 --- a/addon-modules/README +++ b/addon-modules/README @@ -3,3 +3,7 @@ In this directory you can place addon modules for OpenSim Each module should be in it's own tree and the root of the tree should contain a file named "prebuild.xml", which will be included in the main prebuild file. + +The prebuild.xml should only contain and associated child tags. +The , , and tags should not be +included since the add-on modules prebuild.xml will be inserted directly into the main prebuild.xml From d86c0d406a3fcabae2fe2c70f76507796152eb74 Mon Sep 17 00:00:00 2001 From: "dr scofield (aka dirk husemann)" Date: Mon, 11 Jan 2010 17:15:49 +0100 Subject: [PATCH 23/26] more specific config error logging --- .../Region/OptionalModules/Avatar/Chat/ChannelState.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index 3c5e8c9e65..b3fa07febd 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -220,8 +220,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat // Fail if fundamental information is still missing - if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) - throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}", cs.idn, rs.Region)); + if (cs.Server == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: server missing", cs.idn, rs.Region)); + else if (cs.IrcChannel == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: channel missing", cs.idn, rs.Region)); + else if (cs.BaseNickname == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: nick missing", cs.idn, rs.Region)); + else if (cs.User == null) + throw new Exception(String.Format("[IRC-Channel-{0}] Invalid configuration for region {1}: user missing", cs.idn, rs.Region)); m_log.InfoFormat("[IRC-Channel-{0}] Configuration for Region {1} is valid", cs.idn, rs.Region); m_log.InfoFormat("[IRC-Channel-{0}] Server = {1}", cs.idn, cs.Server); From fcaef85029b98b13d884869b6da7e561e365fcf8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Jan 2010 17:13:03 +0000 Subject: [PATCH 24/26] Add explanation about AllowModFunctions to OpenSim.ini.example This switch allows scripts to pass messages to modules via the modSendCommand() function Modules can then send messages back to scripts via the link_message LSL event through invoking DispatchReply() on OpenSim.Region.Framework.Interfaces.IScriptModuleComms --- bin/OpenSim.ini.example | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index d09dc676ba..6a117c931f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -987,6 +987,11 @@ ; Compile debug info (line numbers) into the script assemblies CompileWithDebugInformation = true + ; Allow the user of mod* functions. This allows a script to pass messages + ; to a region module via the modSendCommand() function + ; Default is false + AllowMODFunctions = false + ; Allow the use of os* functions (some are dangerous) AllowOSFunctions = false From b88bee9d48c2f953867737520f9ed731dc84cc2a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Jan 2010 17:17:58 +0000 Subject: [PATCH 25/26] add interface/method documentatio nto IScriptModuleComms --- .../Interfaces/IScriptModuleComms.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs index 5cdf1911b2..d7fa316668 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs @@ -32,13 +32,29 @@ namespace OpenSim.Region.Framework.Interfaces { public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); + /// + /// Interface for communication between OpenSim modules and in-world scripts + /// + /// + /// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages + /// from scripts in OpenSim modules. public interface IScriptModuleComms { + /// + /// Modules can subscribe to this event to receive command invocations from in-world scripts + /// event ScriptCommand OnScriptCommand; - void DispatchReply(UUID script, int code, string text, string k); + /// + /// Send a link_message event to an in-world script + /// + /// + /// + /// + /// + void DispatchReply(UUID scriptId, int code, string text, string key); // For use ONLY by the script API - void RaiseEvent(UUID script, string id, string module, string command, string k); + void RaiseEvent(UUID script, string id, string module, string command, string key); } } From 7467a471ca2d3e6066f89d8bca4ba956e07fbb6b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 22:52:05 +0000 Subject: [PATCH 26/26] Add the option to reject duplicate region names --- OpenSim/Services/GridService/GridService.cs | 25 +++++++++++++++++++++ bin/OpenSim.Server.ini.example | 1 + 2 files changed, 26 insertions(+) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e53e5..a500593855 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_AllowDuplicateNames = false; + public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); + } } #region IGridService @@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService } } + if (!m_AllowDuplicateNames) + { + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return false; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 12af0cd2c4..d4e05af5d0 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -80,3 +80,4 @@ LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" Realm = "regions" +; AllowDuplicateNames = "True"