diff options
author | Melanie | 2012-01-24 01:48:38 +0100 |
---|---|---|
committer | Melanie | 2012-01-24 02:36:35 +0000 |
commit | a4977bbe190fb6c1eb5c45247b9222c719118fd4 (patch) | |
tree | c6e028bc3b06c607ff5372a1808b5922a74801b0 /OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | |
parent | Reverse the spawn point distance vector (diff) | |
download | opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.zip opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.gz opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.bz2 opensim-SC_OLD-a4977bbe190fb6c1eb5c45247b9222c719118fd4.tar.xz |
Simplify and streamline telehub editing code. Verify rotations and fix
spwan point positioning on rotated telehubs.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 69 |
1 files changed, 22 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index 3eb7efa..8bc831f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | |||
@@ -26,15 +26,19 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using log4net; | ||
33 | 35 | ||
34 | namespace OpenSim.Region.CoreModules.World.Estate | 36 | namespace OpenSim.Region.CoreModules.World.Estate |
35 | { | 37 | { |
36 | public class TelehubManager | 38 | public class TelehubManager |
37 | { | 39 | { |
40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
41 | |||
38 | Scene m_Scene; | 42 | Scene m_Scene; |
39 | 43 | ||
40 | public TelehubManager(Scene scene) | 44 | public TelehubManager(Scene scene) |
@@ -43,78 +47,49 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
43 | } | 47 | } |
44 | 48 | ||
45 | // Connect the Telehub | 49 | // Connect the Telehub |
46 | public bool Connect(SceneObjectGroup grp) | 50 | public void Connect(SceneObjectGroup grp) |
47 | { | 51 | { |
48 | try | 52 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
49 | { | ||
50 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | ||
51 | |||
52 | m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; | ||
53 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
54 | } | ||
55 | catch (Exception ex) | ||
56 | { | ||
57 | return false; | ||
58 | } | ||
59 | 53 | ||
60 | return true; | 54 | m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID; |
55 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
61 | } | 56 | } |
62 | 57 | ||
63 | // Disconnect the Telehub: | 58 | // Disconnect the Telehub: |
64 | public bool Disconnect() | 59 | public void Disconnect() |
65 | { | 60 | { |
66 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) | 61 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) |
67 | return false; | 62 | return; |
68 | 63 | ||
69 | try | 64 | m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; |
70 | { | 65 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
71 | m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; | 66 | m_Scene.RegionInfo.RegionSettings.Save(); |
72 | m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | ||
73 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
74 | } | ||
75 | catch (Exception ex) | ||
76 | { | ||
77 | return false; | ||
78 | } | ||
79 | |||
80 | return true; | ||
81 | } | 67 | } |
82 | 68 | ||
83 | // Add a SpawnPoint to the Telehub | 69 | // Add a SpawnPoint to the Telehub |
84 | public bool AddSpawnPoint(Vector3 point) | 70 | public void AddSpawnPoint(Vector3 point) |
85 | { | 71 | { |
86 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) | 72 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) |
87 | return false; | 73 | return; |
88 | 74 | ||
89 | SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); | 75 | SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject); |
90 | if (grp == null) | 76 | if (grp == null) |
91 | return false; | 77 | return; |
92 | 78 | ||
93 | try | 79 | SpawnPoint sp = new SpawnPoint(); |
94 | { | 80 | sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); |
95 | SpawnPoint sp = new SpawnPoint(); | 81 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); |
96 | sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point); | 82 | m_Scene.RegionInfo.RegionSettings.Save(); |
97 | m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp); | ||
98 | m_Scene.RegionInfo.RegionSettings.Save(); | ||
99 | } | ||
100 | catch (Exception ex) | ||
101 | { | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | return true; | ||
106 | } | 83 | } |
107 | 84 | ||
108 | // Remove a SpawnPoint from the Telehub | 85 | // Remove a SpawnPoint from the Telehub |
109 | public bool RemoveSpawnPoint(int spawnpoint) | 86 | public void RemoveSpawnPoint(int spawnpoint) |
110 | { | 87 | { |
111 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) | 88 | if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero) |
112 | return false; | 89 | return; |
113 | 90 | ||
114 | m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); | 91 | m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint); |
115 | m_Scene.RegionInfo.RegionSettings.Save(); | 92 | m_Scene.RegionInfo.RegionSettings.Save(); |
116 | |||
117 | return true; | ||
118 | } | 93 | } |
119 | } | 94 | } |
120 | } | 95 | } |