aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2010-08-18 00:59:20 +0100
committerMelanie2010-08-18 00:59:20 +0100
commite74809ff4c7fd67ceb5336e5d8e7811591f6cce3 (patch)
tree3e878fb80be75106631d76a12b8da9e65e98f7b9 /OpenSim/Region/Framework
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parent* Changed a few OSD.FromBinary() calls to the more accurate OSD.FromULong() t... (diff)
downloadopensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.zip
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.gz
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.bz2
opensim-SC-e74809ff4c7fd67ceb5336e5d8e7811591f6cce3.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IBuySellModule.cs47
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICloudModule.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs386
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
9 files changed, 81 insertions, 395 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs
new file mode 100644
index 0000000..0132bae
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IBuySellModule.cs
@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IBuySellModule
34 {
35 /// <summary>
36 /// Try to buy an object
37 /// </summary>
38 /// <param name="remoteClient"></param>
39 /// <param name="categoryID"></param>
40 /// <param name="localID"></param>
41 /// <param name="saleType"></param>
42 /// <returns>
43 /// True on a successful purchase, false on failure
44 /// </returns>
45 bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType);
46 }
47} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
index f8a5bad..7296ac3 100644
--- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
@@ -25,7 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28
29namespace OpenSim.Region.Framework.Interfaces 28namespace OpenSim.Region.Framework.Interfaces
30{ 29{
31 public interface ICloudModule : IRegionModule 30 public interface ICloudModule : IRegionModule
@@ -35,4 +34,4 @@ namespace OpenSim.Region.Framework.Interfaces
35 /// </summary> 34 /// </summary>
36 float CloudCover(int x, int y, int z); 35 float CloudCover(int x, int y, int z);
37 } 36 }
38} 37} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs
index 2390ff4..1e92fde 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryTransferModule.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces
35 /// </summary> 35 /// </summary>
36 public interface IInventoryTransferModule 36 public interface IInventoryTransferModule
37 { 37 {
38 void SetRootAgentScene(UUID agentID, Scene scene);
39 bool NeedSceneCacheClear(UUID agentID, Scene scene); 38 bool NeedSceneCacheClear(UUID agentID, Scene scene);
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index ac6afed..d6e31f4 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -29,6 +29,9 @@ namespace OpenSim.Region.Framework.Interfaces
29{ 29{
30 public interface IWorldMapModule 30 public interface IWorldMapModule
31 { 31 {
32 void RegenerateMaptile(byte[] data); 32 /// <summary>
33 /// Generate a map tile for the scene. a terrain texture for this scene
34 /// </summary>
35 void GenerateMaptile();
33 } 36 }
34} 37}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 17159b4..18ea865 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -687,7 +687,7 @@ namespace OpenSim.Region.Framework.Scenes
687 /// <summary> 687 /// <summary>
688 /// Create a new asset data structure. 688 /// Create a new asset data structure.
689 /// </summary> 689 /// </summary>
690 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID) 690 public AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
691 { 691 {
692 AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString()); 692 AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString());
693 asset.Description = description; 693 asset.Description = description;
@@ -869,7 +869,7 @@ namespace OpenSim.Region.Framework.Scenes
869 ScenePresence presence; 869 ScenePresence presence;
870 if (TryGetScenePresence(remoteClient.AgentId, out presence)) 870 if (TryGetScenePresence(remoteClient.AgentId, out presence))
871 { 871 {
872 byte[] data = null; 872// byte[] data = null;
873 873
874 AssetBase asset = new AssetBase(); 874 AssetBase asset = new AssetBase();
875 asset.FullID = olditemID; 875 asset.FullID = olditemID;
@@ -877,8 +877,10 @@ namespace OpenSim.Region.Framework.Scenes
877 asset.Name = name; 877 asset.Name = name;
878 asset.Description = description; 878 asset.Description = description;
879 879
880 CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); 880 CreateNewInventoryItem(
881 881 remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType,
882 (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
883 (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
882 } 884 }
883 else 885 else
884 { 886 {
@@ -911,7 +913,6 @@ namespace OpenSim.Region.Framework.Scenes
911 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); 913 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
912 } 914 }
913 915
914
915 /// <summary> 916 /// <summary>
916 /// Send the details of a prim's inventory to the client. 917 /// Send the details of a prim's inventory to the client.
917 /// </summary> 918 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7c89e65..73472a9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -496,73 +496,6 @@ namespace OpenSim.Region.Framework.Scenes
496 496
497 #endregion 497 #endregion
498 498
499 #region BinaryStats
500
501 public class StatLogger
502 {
503 public DateTime StartTime;
504 public string Path;
505 public System.IO.BinaryWriter Log;
506 }
507 static StatLogger m_statLog = null;
508 static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
509 static string m_statsDir = String.Empty;
510 static Object m_statLockObject = new Object();
511 private void LogSimStats(SimStats stats)
512 {
513 SimStatsPacket pack = new SimStatsPacket();
514 pack.Region = new SimStatsPacket.RegionBlock();
515 pack.Region.RegionX = stats.RegionX;
516 pack.Region.RegionY = stats.RegionY;
517 pack.Region.RegionFlags = stats.RegionFlags;
518 pack.Region.ObjectCapacity = stats.ObjectCapacity;
519 //pack.Region = //stats.RegionBlock;
520 pack.Stat = stats.StatsBlock;
521 pack.Header.Reliable = false;
522
523 // note that we are inside the reporter lock when called
524 DateTime now = DateTime.Now;
525
526 // hide some time information into the packet
527 pack.Header.Sequence = (uint)now.Ticks;
528
529 lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
530 {
531 try
532 {
533 if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
534 {
535 // First log file or time has expired, start writing to a new log file
536 if (m_statLog != null && m_statLog.Log != null)
537 {
538 m_statLog.Log.Close();
539 }
540 m_statLog = new StatLogger();
541 m_statLog.StartTime = now;
542 m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
543 + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
544 m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
545 }
546
547 // Write the serialized data to disk
548 if (m_statLog != null && m_statLog.Log != null)
549 m_statLog.Log.Write(pack.ToBytes());
550 }
551 catch (Exception ex)
552 {
553 m_log.Error("statistics gathering failed: " + ex.Message, ex);
554 if (m_statLog != null && m_statLog.Log != null)
555 {
556 m_statLog.Log.Close();
557 }
558 m_statLog = null;
559 }
560 }
561 return;
562 }
563
564 #endregion
565
566 #region Constructors 499 #region Constructors
567 500
568 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 501 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
@@ -628,45 +561,6 @@ namespace OpenSim.Region.Framework.Scenes
628 if (m_storageManager.EstateDataStore != null) 561 if (m_storageManager.EstateDataStore != null)
629 { 562 {
630 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 563 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
631 if (m_regInfo.EstateSettings.EstateID == 0) // No record at all
632 {
633 MainConsole.Instance.Output("Your region is not part of an estate.");
634 while (true)
635 {
636 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
637 if (response == "no")
638 {
639 // Create a new estate
640 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
641
642 m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName);
643 m_regInfo.EstateSettings.Save();
644 break;
645 }
646 else
647 {
648 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
649 if (response == "None")
650 continue;
651
652 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
653 if (estateIDs.Count < 1)
654 {
655 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
656 continue;
657 }
658
659 int estateID = estateIDs[0];
660
661 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
662
663 if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID))
664 break;
665
666 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
667 }
668 }
669 }
670 } 564 }
671 565
672 #endregion Region Settings 566 #endregion Region Settings
@@ -771,38 +665,6 @@ namespace OpenSim.Region.Framework.Scenes
771 665
772 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 666 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
773 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); 667 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
774
775 #region BinaryStats
776
777 try
778 {
779 IConfig statConfig = m_config.Configs["Statistics.Binary"];
780 if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
781 {
782 if (statConfig.Contains("collect_region_stats"))
783 {
784 if (statConfig.GetBoolean("collect_region_stats"))
785 {
786 // if enabled, add us to the event. If not enabled, I won't get called
787 StatsReporter.OnSendStatsResult += LogSimStats;
788 }
789 }
790 if (statConfig.Contains("region_stats_period_seconds"))
791 {
792 m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
793 }
794 if (statConfig.Contains("stats_dir"))
795 {
796 m_statsDir = statConfig.GetString("stats_dir");
797 }
798 }
799 }
800 catch
801 {
802 // if it doesn't work, we don't collect anything
803 }
804
805 #endregion BinaryStats
806 } 668 }
807 catch 669 catch
808 { 670 {
@@ -1844,33 +1706,6 @@ namespace OpenSim.Region.Framework.Scenes
1844 1706
1845 } 1707 }
1846 1708
1847 /// <summary>
1848 /// Create a terrain texture for this scene
1849 /// </summary>
1850 public void CreateTerrainTexture()
1851 {
1852 //create a texture asset of the terrain
1853 IMapImageGenerator terrain = RequestModuleInterface<IMapImageGenerator>();
1854
1855 // Cannot create a map for a nonexistant heightmap yet.
1856 if (Heightmap == null)
1857 return;
1858
1859 if (terrain == null)
1860 return;
1861
1862 byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png");
1863 if (data != null)
1864 {
1865 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
1866
1867 if (mapModule != null)
1868 mapModule.RegenerateMaptile(data);
1869 else
1870 m_log.DebugFormat("[SCENE]: MapModule is null, can't save maptile");
1871 }
1872 }
1873
1874 #endregion 1709 #endregion
1875 1710
1876 #region Load Land 1711 #region Load Land
@@ -1929,7 +1764,7 @@ namespace OpenSim.Region.Framework.Scenes
1929 1764
1930 AddRestoredSceneObject(group, true, true); 1765 AddRestoredSceneObject(group, true, true);
1931 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1766 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1932 rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; 1767 rootPart.Flags &= ~PrimFlags.Scripted;
1933 rootPart.TrimPermissions(); 1768 rootPart.TrimPermissions();
1934 group.CheckSculptAndLoad(); 1769 group.CheckSculptAndLoad();
1935 //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 1770 //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
@@ -2248,7 +2083,7 @@ namespace OpenSim.Region.Framework.Scenes
2248 2083
2249 foreach (SceneObjectPart part in group.Children.Values) 2084 foreach (SceneObjectPart part in group.Children.Values)
2250 { 2085 {
2251 if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0)) 2086 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
2252 { 2087 {
2253 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? 2088 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
2254 } 2089 }
@@ -2761,7 +2596,7 @@ namespace OpenSim.Region.Framework.Scenes
2761 if (!VerifyClient(aCircuit, ep, out vialogin)) 2596 if (!VerifyClient(aCircuit, ep, out vialogin))
2762 { 2597 {
2763 // uh-oh, this is fishy 2598 // uh-oh, this is fishy
2764 m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", 2599 m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2765 client.AgentId, client.SessionId, ep.ToString()); 2600 client.AgentId, client.SessionId, ep.ToString());
2766 try 2601 try
2767 { 2602 {
@@ -2769,13 +2604,13 @@ namespace OpenSim.Region.Framework.Scenes
2769 } 2604 }
2770 catch (Exception e) 2605 catch (Exception e)
2771 { 2606 {
2772 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); 2607 m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2773 } 2608 }
2774 return; 2609 return;
2775 } 2610 }
2776 } 2611 }
2777 2612
2778 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2613 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2779 2614
2780 ScenePresence sp = CreateAndAddScenePresence(client); 2615 ScenePresence sp = CreateAndAddScenePresence(client);
2781 if (aCircuit != null) 2616 if (aCircuit != null)
@@ -2804,7 +2639,7 @@ namespace OpenSim.Region.Framework.Scenes
2804 // Do the verification here 2639 // Do the verification here
2805 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) 2640 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2806 { 2641 {
2807 m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2642 m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2808 vialogin = true; 2643 vialogin = true;
2809 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2644 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2810 if (userVerification != null && ep != null) 2645 if (userVerification != null && ep != null)
@@ -2814,11 +2649,11 @@ namespace OpenSim.Region.Framework.Scenes
2814 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString())) 2649 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
2815 { 2650 {
2816 // uh-oh, this is fishy 2651 // uh-oh, this is fishy
2817 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2652 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2818 return false; 2653 return false;
2819 } 2654 }
2820 else 2655 else
2821 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2656 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2822 } 2657 }
2823 } 2658 }
2824 2659
@@ -2849,7 +2684,7 @@ namespace OpenSim.Region.Framework.Scenes
2849 } 2684 }
2850 catch (Exception e) 2685 catch (Exception e)
2851 { 2686 {
2852 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); 2687 m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
2853 } 2688 }
2854 } 2689 }
2855 else 2690 else
@@ -2879,7 +2714,6 @@ namespace OpenSim.Region.Framework.Scenes
2879 public virtual void SubscribeToClientTerrainEvents(IClientAPI client) 2714 public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
2880 { 2715 {
2881 client.OnRegionHandShakeReply += SendLayerData; 2716 client.OnRegionHandShakeReply += SendLayerData;
2882 client.OnUnackedTerrain += TerrainUnAcked;
2883 } 2717 }
2884 2718
2885 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 2719 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
@@ -2919,8 +2753,7 @@ namespace OpenSim.Region.Framework.Scenes
2919 client.OnUndo += m_sceneGraph.HandleUndo; 2753 client.OnUndo += m_sceneGraph.HandleUndo;
2920 client.OnRedo += m_sceneGraph.HandleRedo; 2754 client.OnRedo += m_sceneGraph.HandleRedo;
2921 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2755 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2922 client.OnObjectDrop += m_sceneGraph.DropObject; 2756 client.OnObjectDrop += m_sceneGraph.DropObject;
2923 client.OnObjectSaleInfo += ObjectSaleInfo;
2924 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2757 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2925 client.OnObjectOwner += ObjectOwner; 2758 client.OnObjectOwner += ObjectOwner;
2926 } 2759 }
@@ -3011,7 +2844,6 @@ namespace OpenSim.Region.Framework.Scenes
3011 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) 2844 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
3012 { 2845 {
3013 client.OnRegionHandShakeReply -= SendLayerData; 2846 client.OnRegionHandShakeReply -= SendLayerData;
3014 client.OnUnackedTerrain -= TerrainUnAcked;
3015 } 2847 }
3016 2848
3017 public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) 2849 public virtual void UnSubscribeToClientPrimEvents(IClientAPI client)
@@ -3050,7 +2882,6 @@ namespace OpenSim.Region.Framework.Scenes
3050 client.OnRedo -= m_sceneGraph.HandleRedo; 2882 client.OnRedo -= m_sceneGraph.HandleRedo;
3051 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2883 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
3052 client.OnObjectDrop -= m_sceneGraph.DropObject; 2884 client.OnObjectDrop -= m_sceneGraph.DropObject;
3053 client.OnObjectSaleInfo -= ObjectSaleInfo;
3054 client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; 2885 client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable;
3055 client.OnObjectOwner -= ObjectOwner; 2886 client.OnObjectOwner -= ObjectOwner;
3056 } 2887 }
@@ -4625,23 +4456,6 @@ namespace OpenSim.Region.Framework.Scenes
4625 client.SendRegionHandle(regionID, handle); 4456 client.SendRegionHandle(regionID, handle);
4626 } 4457 }
4627 4458
4628 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
4629 {
4630 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
4631 client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised());
4632 }
4633
4634 public void SetRootAgentScene(UUID agentID)
4635 {
4636 IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
4637 if (inv == null)
4638 return;
4639
4640 inv.SetRootAgentScene(agentID, this);
4641
4642 EventManager.TriggerSetRootAgentScene(agentID, this);
4643 }
4644
4645 public bool NeedSceneCacheClear(UUID agentID) 4459 public bool NeedSceneCacheClear(UUID agentID)
4646 { 4460 {
4647 IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); 4461 IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
@@ -4651,184 +4465,6 @@ namespace OpenSim.Region.Framework.Scenes
4651 return inv.NeedSceneCacheClear(agentID, this); 4465 return inv.NeedSceneCacheClear(agentID, this);
4652 } 4466 }
4653 4467
4654 public void ObjectSaleInfo(IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
4655 {
4656 SceneObjectPart part = GetSceneObjectPart(localID);
4657 if (part == null || part.ParentGroup == null)
4658 return;
4659
4660 if (part.ParentGroup.IsDeleted)
4661 return;
4662
4663 part = part.ParentGroup.RootPart;
4664
4665 part.ObjectSaleType = saleType;
4666 part.SalePrice = salePrice;
4667
4668 part.ParentGroup.HasGroupChanged = true;
4669
4670 part.GetProperties(client);
4671 }
4672
4673 public bool PerformObjectBuy(IClientAPI remoteClient, UUID categoryID,
4674 uint localID, byte saleType)
4675 {
4676 SceneObjectPart part = GetSceneObjectPart(localID);
4677
4678 if (part == null)
4679 return false;
4680
4681 if (part.ParentGroup == null)
4682 return false;
4683
4684 SceneObjectGroup group = part.ParentGroup;
4685
4686 switch (saleType)
4687 {
4688 case 1: // Sell as original (in-place sale)
4689 uint effectivePerms=group.GetEffectivePermissions();
4690
4691 if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
4692 {
4693 m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
4694 return false;
4695 }
4696
4697 group.SetOwnerId(remoteClient.AgentId);
4698 group.SetRootPartOwner(part, remoteClient.AgentId,
4699 remoteClient.ActiveGroupId);
4700
4701 List<SceneObjectPart> partList =
4702 new List<SceneObjectPart>(group.Children.Values);
4703
4704 if (Permissions.PropagatePermissions())
4705 {
4706 foreach (SceneObjectPart child in partList)
4707 {
4708 child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
4709 child.TriggerScriptChangedEvent(Changed.OWNER);
4710 child.ApplyNextOwnerPermissions();
4711 }
4712 }
4713
4714 part.ObjectSaleType = 0;
4715 part.SalePrice = 10;
4716
4717 group.HasGroupChanged = true;
4718 part.GetProperties(remoteClient);
4719 part.TriggerScriptChangedEvent(Changed.OWNER);
4720 group.ResumeScripts();
4721 part.ScheduleFullUpdate();
4722
4723 break;
4724
4725 case 2: // Sell a copy
4726
4727
4728 Vector3 inventoryStoredPosition = new Vector3
4729 (((group.AbsolutePosition.X > (int)Constants.RegionSize)
4730 ? 250
4731 : group.AbsolutePosition.X)
4732 ,
4733 (group.AbsolutePosition.X > (int)Constants.RegionSize)
4734 ? 250
4735 : group.AbsolutePosition.X,
4736 group.AbsolutePosition.Z);
4737
4738 Vector3 originalPosition = group.AbsolutePosition;
4739
4740 group.AbsolutePosition = inventoryStoredPosition;
4741
4742 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
4743 group.AbsolutePosition = originalPosition;
4744
4745 uint perms=group.GetEffectivePermissions();
4746
4747 if ((perms & (uint)PermissionMask.Transfer) == 0)
4748 {
4749 m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
4750 return false;
4751 }
4752
4753 AssetBase asset = CreateAsset(
4754 group.GetPartName(localID),
4755 group.GetPartDescription(localID),
4756 (sbyte)AssetType.Object,
4757 Utils.StringToBytes(sceneObjectXml),
4758 group.OwnerID);
4759 AssetService.Store(asset);
4760
4761 InventoryItemBase item = new InventoryItemBase();
4762 item.CreatorId = part.CreatorID.ToString();
4763
4764 item.ID = UUID.Random();
4765 item.Owner = remoteClient.AgentId;
4766 item.AssetID = asset.FullID;
4767 item.Description = asset.Description;
4768 item.Name = asset.Name;
4769 item.AssetType = asset.Type;
4770 item.InvType = (int)InventoryType.Object;
4771 item.Folder = categoryID;
4772
4773 uint nextPerms=(perms & 7) << 13;
4774 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
4775 perms &= ~(uint)PermissionMask.Copy;
4776 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
4777 perms &= ~(uint)PermissionMask.Transfer;
4778 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
4779 perms &= ~(uint)PermissionMask.Modify;
4780
4781 item.BasePermissions = perms & part.NextOwnerMask;
4782 item.CurrentPermissions = perms & part.NextOwnerMask;
4783 item.NextPermissions = part.NextOwnerMask;
4784 item.EveryOnePermissions = part.EveryoneMask &
4785 part.NextOwnerMask;
4786 item.GroupPermissions = part.GroupMask &
4787 part.NextOwnerMask;
4788 item.CurrentPermissions |= 16; // Slam!
4789 item.CreationDate = Util.UnixTimeSinceEpoch();
4790
4791 if (InventoryService.AddItem(item))
4792 remoteClient.SendInventoryItemCreateUpdate(item, 0);
4793 else
4794 {
4795 m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
4796 return false;
4797 }
4798 break;
4799
4800 case 3: // Sell contents
4801 List<UUID> invList = part.Inventory.GetInventoryList();
4802
4803 bool okToSell = true;
4804
4805 foreach (UUID invID in invList)
4806 {
4807 TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID);
4808 if ((item1.CurrentPermissions &
4809 (uint)PermissionMask.Transfer) == 0)
4810 {
4811 okToSell = false;
4812 break;
4813 }
4814 }
4815
4816 if (!okToSell)
4817 {
4818 m_dialogModule.SendAlertToUser(
4819 remoteClient, "This item's inventory doesn't appear to be for sale");
4820 return false;
4821 }
4822
4823 if (invList.Count > 0)
4824 MoveTaskInventoryItems(remoteClient.AgentId, part.Name,
4825 part, invList);
4826 break;
4827 }
4828
4829 return true;
4830 }
4831
4832 public void CleanTempObjects() 4468 public void CleanTempObjects()
4833 { 4469 {
4834 List<EntityBase> objs = GetEntities(); 4470 List<EntityBase> objs = GetEntities();
@@ -4969,7 +4605,7 @@ namespace OpenSim.Region.Framework.Scenes
4969 } 4605 }
4970 4606
4971 // turn the proxy non-physical, which also stops its client-side interpolation 4607 // turn the proxy non-physical, which also stops its client-side interpolation
4972 bool wasUsingPhysics = ((jointProxyObject.ObjectFlags & (uint)PrimFlags.Physics) != 0); 4608 bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0);
4973 if (wasUsingPhysics) 4609 if (wasUsingPhysics)
4974 { 4610 {
4975 jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock 4611 jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 20a2abc..9b66fad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1588,9 +1588,9 @@ namespace OpenSim.Region.Framework.Scenes
1588 1588
1589 public void aggregateScriptEvents() 1589 public void aggregateScriptEvents()
1590 { 1590 {
1591 uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags(); 1591 PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags();
1592 1592
1593 scriptEvents aggregateScriptEvents=0; 1593 scriptEvents aggregateScriptEvents = 0;
1594 1594
1595 lockPartsForRead(true); 1595 lockPartsForRead(true);
1596 { 1596 {
@@ -1600,7 +1600,7 @@ namespace OpenSim.Region.Framework.Scenes
1600 if (part == null) 1600 if (part == null)
1601 continue; 1601 continue;
1602 if (part != RootPart) 1602 if (part != RootPart)
1603 part.ObjectFlags = objectflagupdate; 1603 part.Flags = objectflagupdate;
1604 aggregateScriptEvents |= part.AggregateScriptEvents; 1604 aggregateScriptEvents |= part.AggregateScriptEvents;
1605 1605
1606 } 1606 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index dd780b7..9e52b00 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1348,7 +1348,7 @@ namespace OpenSim.Region.Framework.Scenes
1348 public void AddFlag(PrimFlags flag) 1348 public void AddFlag(PrimFlags flag)
1349 { 1349 {
1350 // PrimFlags prevflag = Flags; 1350 // PrimFlags prevflag = Flags;
1351 if ((ObjectFlags & (uint) flag) == 0) 1351 if ((Flags & flag) == 0)
1352 { 1352 {
1353 //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString()); 1353 //m_log.Debug("Adding flag: " + ((PrimFlags) flag).ToString());
1354 Flags |= flag; 1354 Flags |= flag;
@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.Framework.Scenes
1638 dupe.Velocity = new Vector3(0, 0, 0); 1638 dupe.Velocity = new Vector3(0, 0, 0);
1639 dupe.Acceleration = new Vector3(0, 0, 0); 1639 dupe.Acceleration = new Vector3(0, 0, 0);
1640 dupe.AngularVelocity = new Vector3(0, 0, 0); 1640 dupe.AngularVelocity = new Vector3(0, 0, 0);
1641 dupe.ObjectFlags = ObjectFlags; 1641 dupe.Flags = Flags;
1642 1642
1643 dupe._ownershipCost = _ownershipCost; 1643 dupe._ownershipCost = _ownershipCost;
1644 dupe._objectSaleType = _objectSaleType; 1644 dupe._objectSaleType = _objectSaleType;
@@ -1675,7 +1675,7 @@ namespace OpenSim.Region.Framework.Scenes
1675 m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived); 1675 m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived);
1676 } 1676 }
1677 1677
1678 bool UsePhysics = ((dupe.ObjectFlags & (uint)PrimFlags.Physics) != 0); 1678 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0);
1679 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1679 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1680 } 1680 }
1681 1681
@@ -4299,9 +4299,9 @@ namespace OpenSim.Region.Framework.Scenes
4299 4299
4300 public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD) 4300 public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD)
4301 { 4301 {
4302 bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0); 4302 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4303 bool wasTemporary = ((ObjectFlags & (uint)PrimFlags.TemporaryOnRez) != 0); 4303 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
4304 bool wasPhantom = ((ObjectFlags & (uint)PrimFlags.Phantom) != 0); 4304 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
4305 bool wasVD = VolumeDetectActive; 4305 bool wasVD = VolumeDetectActive;
4306 4306
4307 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD)) 4307 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD))
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4064339..02e60f8 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -905,7 +905,8 @@ namespace OpenSim.Region.Framework.Scenes
905 m_grouptitle = gm.GetGroupTitle(m_uuid); 905 m_grouptitle = gm.GetGroupTitle(m_uuid);
906 906
907 m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; 907 m_rootRegionHandle = m_scene.RegionInfo.RegionHandle;
908 m_scene.SetRootAgentScene(m_uuid); 908
909 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
909 910
910 // Moved this from SendInitialData to ensure that m_appearance is initialized 911 // Moved this from SendInitialData to ensure that m_appearance is initialized
911 // before the inventory is processed in MakeRootAgent. This fixes a race condition 912 // before the inventory is processed in MakeRootAgent. This fixes a race condition