diff options
Diffstat (limited to 'OpenSim/Region/Environment')
23 files changed, 1332 insertions, 1332 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs index 05cecf8..e91240a 100644 --- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs | |||
@@ -1,17 +1,17 @@ | |||
1 | using System.IO; | 1 | using System.IO; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Interfaces | 4 | namespace OpenSim.Region.Environment.Interfaces |
5 | { | 5 | { |
6 | public interface IDynamicTextureManager | 6 | public interface IDynamicTextureManager |
7 | { | 7 | { |
8 | void RegisterRender(string handleType, IDynamicTextureRender render); | 8 | void RegisterRender(string handleType, IDynamicTextureRender render); |
9 | void ReturnData(LLUUID id, byte[] data); | 9 | void ReturnData(LLUUID id, byte[] data); |
10 | 10 | ||
11 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, | 11 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, |
12 | int updateTimer); | 12 | int updateTimer); |
13 | 13 | ||
14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, | 14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, |
15 | int updateTimer); | 15 | int updateTimer); |
16 | } | 16 | } |
17 | 17 | ||
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs index cb00b48..49b96d0 100644 --- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface IHttpRequests | 5 | public interface IHttpRequests |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 981b73f..2c7c742 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using OpenSim.Region.Environment.Scenes; | 1 | using OpenSim.Region.Environment.Scenes; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface IRegionModule | 5 | public interface IRegionModule |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs index 5aa78ab..36ff1ad 100644 --- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface ISimChat | 5 | public interface ISimChat |
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs index f9ff71a..3d0169a 100644 --- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs | |||
@@ -1,16 +1,16 @@ | |||
1 | using OpenSim.Framework.Interfaces; | 1 | using OpenSim.Framework.Interfaces; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface ITerrain | 5 | public interface ITerrain |
6 | { | 6 | { |
7 | bool Tainted(); | 7 | bool Tainted(); |
8 | bool Tainted(int x, int y); | 8 | bool Tainted(int x, int y); |
9 | void ResetTaint(); | 9 | void ResetTaint(); |
10 | 10 | ||
11 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, | 11 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, |
12 | IClientAPI remoteUser); | 12 | IClientAPI remoteUser); |
13 | 13 | ||
14 | void CheckHeightValues(); | 14 | void CheckHeightValues(); |
15 | float[] GetHeights1D(); | 15 | float[] GetHeights1D(); |
16 | float[,] GetHeights2D(); | 16 | float[,] GetHeights2D(); |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 2b18949..ce2a843 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -1,156 +1,156 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Reflection; | 4 | using System.Reflection; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Region.Environment.Interfaces; |
6 | using OpenSim.Region.Environment.Modules; | 6 | using OpenSim.Region.Environment.Modules; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment | 9 | namespace OpenSim.Region.Environment |
10 | { | 10 | { |
11 | public class ModuleLoader | 11 | public class ModuleLoader |
12 | { | 12 | { |
13 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 13 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); |
14 | 14 | ||
15 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | 15 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); |
16 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | 16 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); |
17 | 17 | ||
18 | public ModuleLoader() | 18 | public ModuleLoader() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
23 | /// Should have a module factory? | 23 | /// Should have a module factory? |
24 | /// </summary> | 24 | /// </summary> |
25 | /// <param name="scene"></param> | 25 | /// <param name="scene"></param> |
26 | public void CreateDefaultModules(Scene scene, string exceptModules) | 26 | public void CreateDefaultModules(Scene scene, string exceptModules) |
27 | { | 27 | { |
28 | IRegionModule module = new XferModule(); | 28 | IRegionModule module = new XferModule(); |
29 | InitialiseModule(module, scene); | 29 | InitialiseModule(module, scene); |
30 | 30 | ||
31 | module = new ChatModule(); | 31 | module = new ChatModule(); |
32 | InitialiseModule(module, scene); | 32 | InitialiseModule(module, scene); |
33 | 33 | ||
34 | module = new AvatarProfilesModule(); | 34 | module = new AvatarProfilesModule(); |
35 | InitialiseModule(module, scene); | 35 | InitialiseModule(module, scene); |
36 | 36 | ||
37 | LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 37 | LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
38 | 38 | ||
39 | string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 39 | string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
40 | LoadRegionModule(lslPath, "LSLScriptingModule", scene); | 40 | LoadRegionModule(lslPath, "LSLScriptingModule", scene); |
41 | } | 41 | } |
42 | 42 | ||
43 | 43 | ||
44 | public void LoadDefaultSharedModules(string exceptModules) | 44 | public void LoadDefaultSharedModules(string exceptModules) |
45 | { | 45 | { |
46 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); | 46 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
47 | LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); | 47 | LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void InitialiseSharedModules(Scene scene) | 50 | public void InitialiseSharedModules(Scene scene) |
51 | { | 51 | { |
52 | foreach (IRegionModule module in LoadedSharedModules.Values) | 52 | foreach (IRegionModule module in LoadedSharedModules.Values) |
53 | { | 53 | { |
54 | module.Initialise(scene); | 54 | module.Initialise(scene); |
55 | scene.AddModule(module.GetName(), module); //should be doing this? | 55 | scene.AddModule(module.GetName(), module); //should be doing this? |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | private void InitialiseModule(IRegionModule module, Scene scene) | 59 | private void InitialiseModule(IRegionModule module, Scene scene) |
60 | { | 60 | { |
61 | module.Initialise(scene); | 61 | module.Initialise(scene); |
62 | scene.AddModule(module.GetName(), module); | 62 | scene.AddModule(module.GetName(), module); |
63 | LoadedModules.Add(module); | 63 | LoadedModules.Add(module); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Loads/initialises a Module instance that can be used by mutliple Regions | 67 | /// Loads/initialises a Module instance that can be used by mutliple Regions |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="dllName"></param> | 69 | /// <param name="dllName"></param> |
70 | /// <param name="moduleName"></param> | 70 | /// <param name="moduleName"></param> |
71 | /// <param name="scene"></param> | 71 | /// <param name="scene"></param> |
72 | public void LoadSharedModule(string dllName, string moduleName) | 72 | public void LoadSharedModule(string dllName, string moduleName) |
73 | { | 73 | { |
74 | IRegionModule module = LoadModule(dllName, moduleName); | 74 | IRegionModule module = LoadModule(dllName, moduleName); |
75 | if (module != null) | 75 | if (module != null) |
76 | { | 76 | { |
77 | LoadedSharedModules.Add(module.GetName(), module); | 77 | LoadedSharedModules.Add(module.GetName(), module); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 81 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
82 | { | 82 | { |
83 | IRegionModule module = LoadModule(dllName, moduleName); | 83 | IRegionModule module = LoadModule(dllName, moduleName); |
84 | if (module != null) | 84 | if (module != null) |
85 | { | 85 | { |
86 | InitialiseModule(module, scene); | 86 | InitialiseModule(module, scene); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Loads a external Module (if not already loaded) and creates a new instance of it. | 91 | /// Loads a external Module (if not already loaded) and creates a new instance of it. |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <param name="dllName"></param> | 93 | /// <param name="dllName"></param> |
94 | /// <param name="moduleName"></param> | 94 | /// <param name="moduleName"></param> |
95 | /// <param name="scene"></param> | 95 | /// <param name="scene"></param> |
96 | public IRegionModule LoadModule(string dllName, string moduleName) | 96 | public IRegionModule LoadModule(string dllName, string moduleName) |
97 | { | 97 | { |
98 | Assembly pluginAssembly = null; | 98 | Assembly pluginAssembly = null; |
99 | if (LoadedAssemblys.ContainsKey(dllName)) | 99 | if (LoadedAssemblys.ContainsKey(dllName)) |
100 | { | 100 | { |
101 | pluginAssembly = LoadedAssemblys[dllName]; | 101 | pluginAssembly = LoadedAssemblys[dllName]; |
102 | } | 102 | } |
103 | else | 103 | else |
104 | { | 104 | { |
105 | pluginAssembly = Assembly.LoadFrom(dllName); | 105 | pluginAssembly = Assembly.LoadFrom(dllName); |
106 | LoadedAssemblys.Add(dllName, pluginAssembly); | 106 | LoadedAssemblys.Add(dllName, pluginAssembly); |
107 | } | 107 | } |
108 | 108 | ||
109 | IRegionModule module = null; | 109 | IRegionModule module = null; |
110 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 110 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
111 | { | 111 | { |
112 | if (pluginType.IsPublic) | 112 | if (pluginType.IsPublic) |
113 | { | 113 | { |
114 | if (!pluginType.IsAbstract) | 114 | if (!pluginType.IsAbstract) |
115 | { | 115 | { |
116 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); | 116 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); |
117 | 117 | ||
118 | if (typeInterface != null) | 118 | if (typeInterface != null) |
119 | { | 119 | { |
120 | module = | 120 | module = |
121 | (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 121 | (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | typeInterface = null; | 124 | typeInterface = null; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | } | 127 | } |
128 | pluginAssembly = null; | 128 | pluginAssembly = null; |
129 | 129 | ||
130 | if ((module != null) || (module.GetName() == moduleName)) | 130 | if ((module != null) || (module.GetName() == moduleName)) |
131 | { | 131 | { |
132 | return module; | 132 | return module; |
133 | } | 133 | } |
134 | 134 | ||
135 | return null; | 135 | return null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public void PostInitialise() | 138 | public void PostInitialise() |
139 | { | 139 | { |
140 | foreach (IRegionModule module in LoadedSharedModules.Values) | 140 | foreach (IRegionModule module in LoadedSharedModules.Values) |
141 | { | 141 | { |
142 | module.PostInitialise(); | 142 | module.PostInitialise(); |
143 | } | 143 | } |
144 | 144 | ||
145 | foreach (IRegionModule module in LoadedModules) | 145 | foreach (IRegionModule module in LoadedModules) |
146 | { | 146 | { |
147 | module.PostInitialise(); | 147 | module.PostInitialise(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | public void ClearCache() | 151 | public void ClearCache() |
152 | { | 152 | { |
153 | LoadedAssemblys.Clear(); | 153 | LoadedAssemblys.Clear(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } \ No newline at end of file | 156 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index 511b5f6..7d789f9 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using OpenSim.Framework.Interfaces; | 1 | using OpenSim.Framework.Interfaces; |
2 | using OpenSim.Region.Environment.Interfaces; | 2 | using OpenSim.Region.Environment.Interfaces; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | public class AssetDownloadModule : IRegionModule | 7 | public class AssetDownloadModule : IRegionModule |
@@ -9,7 +9,7 @@ namespace OpenSim.Region.Environment.Modules | |||
9 | private Scene m_scene; | 9 | private Scene m_scene; |
10 | 10 | ||
11 | public AssetDownloadModule() | 11 | public AssetDownloadModule() |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | public void Initialise(Scene scene) | 15 | public void Initialise(Scene scene) |
@@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Modules | |||
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
23 | } | 23 | } |
24 | 24 | ||
25 | public void CloseDown() | 25 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index ea5f787..aaa9261 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -1,16 +1,16 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class AvatarProfilesModule : IRegionModule | 8 | public class AvatarProfilesModule : IRegionModule |
9 | { | 9 | { |
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public AvatarProfilesModule() | 12 | public AvatarProfilesModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
@@ -20,11 +20,11 @@ namespace OpenSim.Region.Environment.Modules | |||
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void CloseDown() |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | public string GetName() | 30 | public string GetName() |
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules | |||
58 | string bornOn = "Before now"; | 58 | string bornOn = "Before now"; |
59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; | 59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; |
60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", | 61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", |
62 | partner); | 62 | partner); |
63 | } | 63 | } |
64 | } | 64 | } |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 1c7b806..2eac7d6 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -1,214 +1,214 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Net.Sockets; | 3 | using System.Net.Sockets; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
12 | { | 12 | { |
13 | public class ChatModule : IRegionModule, ISimChat | 13 | public class ChatModule : IRegionModule, ISimChat |
14 | { | 14 | { |
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | private string m_server = "irc2.choopa.net"; | 17 | private string m_server = "irc2.choopa.net"; |
18 | 18 | ||
19 | // private int m_port = 6668; | 19 | // private int m_port = 6668; |
20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
21 | private string m_nick = "OSimBot"; | 21 | private string m_nick = "OSimBot"; |
22 | private string m_channel = "#opensim"; | 22 | private string m_channel = "#opensim"; |
23 | 23 | ||
24 | // private NetworkStream m_stream; | 24 | // private NetworkStream m_stream; |
25 | private TcpClient m_irc; | 25 | private TcpClient m_irc; |
26 | private StreamWriter m_ircWriter; | 26 | private StreamWriter m_ircWriter; |
27 | private StreamReader m_ircReader; | 27 | private StreamReader m_ircReader; |
28 | 28 | ||
29 | // private Thread pingSender; | 29 | // private Thread pingSender; |
30 | // private Thread listener; | 30 | // private Thread listener; |
31 | 31 | ||
32 | private bool connected = false; | 32 | private bool connected = false; |
33 | 33 | ||
34 | public ChatModule() | 34 | public ChatModule() |
35 | { | 35 | { |
36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
37 | m_irc = null; | 37 | m_irc = null; |
38 | m_ircWriter = null; | 38 | m_ircWriter = null; |
39 | m_ircReader = null; | 39 | m_ircReader = null; |
40 | } | 40 | } |
41 | 41 | ||
42 | public void Initialise(Scene scene) | 42 | public void Initialise(Scene scene) |
43 | { | 43 | { |
44 | m_scene = scene; | 44 | m_scene = scene; |
45 | m_scene.EventManager.OnNewClient += NewClient; | 45 | m_scene.EventManager.OnNewClient += NewClient; |
46 | 46 | ||
47 | m_scene.RegisterModuleInterface<ISimChat>(this); | 47 | m_scene.RegisterModuleInterface<ISimChat>(this); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void PostInitialise() | 50 | public void PostInitialise() |
51 | { | 51 | { |
52 | /* | 52 | /* |
53 | try | 53 | try |
54 | { | 54 | { |
55 | m_irc = new TcpClient(m_server, m_port); | 55 | m_irc = new TcpClient(m_server, m_port); |
56 | m_stream = m_irc.GetStream(); | 56 | m_stream = m_irc.GetStream(); |
57 | m_ircReader = new StreamReader(m_stream); | 57 | m_ircReader = new StreamReader(m_stream); |
58 | m_ircWriter = new StreamWriter(m_stream); | 58 | m_ircWriter = new StreamWriter(m_stream); |
59 | 59 | ||
60 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 60 | pingSender = new Thread(new ThreadStart(this.PingRun)); |
61 | pingSender.Start(); | 61 | pingSender.Start(); |
62 | 62 | ||
63 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 63 | listener = new Thread(new ThreadStart(this.ListenerRun)); |
64 | listener.Start(); | 64 | listener.Start(); |
65 | 65 | ||
66 | m_ircWriter.WriteLine(m_user); | 66 | m_ircWriter.WriteLine(m_user); |
67 | m_ircWriter.Flush(); | 67 | m_ircWriter.Flush(); |
68 | m_ircWriter.WriteLine("NICK " + m_nick); | 68 | m_ircWriter.WriteLine("NICK " + m_nick); |
69 | m_ircWriter.Flush(); | 69 | m_ircWriter.Flush(); |
70 | m_ircWriter.WriteLine("JOIN " + m_channel); | 70 | m_ircWriter.WriteLine("JOIN " + m_channel); |
71 | m_ircWriter.Flush(); | 71 | m_ircWriter.Flush(); |
72 | connected = true; | 72 | connected = true; |
73 | } | 73 | } |
74 | catch (Exception e) | 74 | catch (Exception e) |
75 | { | 75 | { |
76 | Console.WriteLine(e.ToString()); | 76 | Console.WriteLine(e.ToString()); |
77 | } | 77 | } |
78 | */ | 78 | */ |
79 | } | 79 | } |
80 | 80 | ||
81 | public void CloseDown() | 81 | public void CloseDown() |
82 | { | 82 | { |
83 | m_ircWriter.Close(); | 83 | m_ircWriter.Close(); |
84 | m_ircReader.Close(); | 84 | m_ircReader.Close(); |
85 | m_irc.Close(); | 85 | m_irc.Close(); |
86 | } | 86 | } |
87 | 87 | ||
88 | public string GetName() | 88 | public string GetName() |
89 | { | 89 | { |
90 | return "ChatModule"; | 90 | return "ChatModule"; |
91 | } | 91 | } |
92 | 92 | ||
93 | public bool IsSharedModule() | 93 | public bool IsSharedModule() |
94 | { | 94 | { |
95 | return false; | 95 | return false; |
96 | } | 96 | } |
97 | 97 | ||
98 | public void NewClient(IClientAPI client) | 98 | public void NewClient(IClientAPI client) |
99 | { | 99 | { |
100 | client.OnChatFromViewer += SimChat; | 100 | client.OnChatFromViewer += SimChat; |
101 | } | 101 | } |
102 | 102 | ||
103 | public void PingRun() | 103 | public void PingRun() |
104 | { | 104 | { |
105 | while (true) | 105 | while (true) |
106 | { | 106 | { |
107 | m_ircWriter.WriteLine("PING :" + m_server); | 107 | m_ircWriter.WriteLine("PING :" + m_server); |
108 | m_ircWriter.Flush(); | 108 | m_ircWriter.Flush(); |
109 | Thread.Sleep(15000); | 109 | Thread.Sleep(15000); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public void ListenerRun() | 113 | public void ListenerRun() |
114 | { | 114 | { |
115 | string inputLine; | 115 | string inputLine; |
116 | LLVector3 pos = new LLVector3(128, 128, 20); | 116 | LLVector3 pos = new LLVector3(128, 128, 20); |
117 | while (true) | 117 | while (true) |
118 | { | 118 | { |
119 | while ((inputLine = m_ircReader.ReadLine()) != null) | 119 | while ((inputLine = m_ircReader.ReadLine()) != null) |
120 | { | 120 | { |
121 | Console.WriteLine(inputLine); | 121 | Console.WriteLine(inputLine); |
122 | if (inputLine.Contains(m_channel)) | 122 | if (inputLine.Contains(m_channel)) |
123 | { | 123 | { |
124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); | 124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); |
125 | m_scene.Broadcast(delegate(IClientAPI client) | 125 | m_scene.Broadcast(delegate(IClientAPI client) |
126 | { | 126 | { |
127 | client.SendChatMessage( | 127 | client.SendChatMessage( |
128 | Helpers.StringToField(mess), 255, pos, "IRC:", | 128 | Helpers.StringToField(mess), 255, pos, "IRC:", |
129 | LLUUID.Zero); | 129 | LLUUID.Zero); |
130 | }); | 130 | }); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, | 136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, |
137 | LLUUID fromAgentID) | 137 | LLUUID fromAgentID) |
138 | { | 138 | { |
139 | ScenePresence avatar = null; | 139 | ScenePresence avatar = null; |
140 | avatar = m_scene.GetScenePresence(fromAgentID); | 140 | avatar = m_scene.GetScenePresence(fromAgentID); |
141 | if (avatar != null) | 141 | if (avatar != null) |
142 | { | 142 | { |
143 | fromPos = avatar.AbsolutePosition; | 143 | fromPos = avatar.AbsolutePosition; |
144 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
145 | avatar = null; | 145 | avatar = null; |
146 | } | 146 | } |
147 | 147 | ||
148 | if (connected) | 148 | if (connected) |
149 | { | 149 | { |
150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + | 150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + |
151 | Util.FieldToString(message)); | 151 | Util.FieldToString(message)); |
152 | m_ircWriter.Flush(); | 152 | m_ircWriter.Flush(); |
153 | } | 153 | } |
154 | 154 | ||
155 | if (channel == 0) | 155 | if (channel == 0) |
156 | { | 156 | { |
157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
158 | { | 158 | { |
159 | int dis = -1000; | 159 | int dis = -1000; |
160 | 160 | ||
161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it |
162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); | 162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); |
163 | if (avatar != null) | 163 | if (avatar != null) |
164 | { | 164 | { |
165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | 165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); |
166 | } | 166 | } |
167 | 167 | ||
168 | switch (type) | 168 | switch (type) |
169 | { | 169 | { |
170 | case 0: // Whisper | 170 | case 0: // Whisper |
171 | if ((dis < 10) && (dis > -10)) | 171 | if ((dis < 10) && (dis > -10)) |
172 | { | 172 | { |
173 | //should change so the message is sent through the avatar rather than direct to the ClientView | 173 | //should change so the message is sent through the avatar rather than direct to the ClientView |
174 | presence.ControllingClient.SendChatMessage(message, | 174 | presence.ControllingClient.SendChatMessage(message, |
175 | type, | 175 | type, |
176 | fromPos, | 176 | fromPos, |
177 | fromName, | 177 | fromName, |
178 | fromAgentID); | 178 | fromAgentID); |
179 | } | 179 | } |
180 | break; | 180 | break; |
181 | case 1: // Say | 181 | case 1: // Say |
182 | if ((dis < 30) && (dis > -30)) | 182 | if ((dis < 30) && (dis > -30)) |
183 | { | 183 | { |
184 | //Console.WriteLine("sending chat"); | 184 | //Console.WriteLine("sending chat"); |
185 | presence.ControllingClient.SendChatMessage(message, | 185 | presence.ControllingClient.SendChatMessage(message, |
186 | type, | 186 | type, |
187 | fromPos, | 187 | fromPos, |
188 | fromName, | 188 | fromName, |
189 | fromAgentID); | 189 | fromAgentID); |
190 | } | 190 | } |
191 | break; | 191 | break; |
192 | case 2: // Shout | 192 | case 2: // Shout |
193 | if ((dis < 100) && (dis > -100)) | 193 | if ((dis < 100) && (dis > -100)) |
194 | { | 194 | { |
195 | presence.ControllingClient.SendChatMessage(message, | 195 | presence.ControllingClient.SendChatMessage(message, |
196 | type, | 196 | type, |
197 | fromPos, | 197 | fromPos, |
198 | fromName, | 198 | fromName, |
199 | fromAgentID); | 199 | fromAgentID); |
200 | } | 200 | } |
201 | break; | 201 | break; |
202 | 202 | ||
203 | case 0xff: // Broadcast | 203 | case 0xff: // Broadcast |
204 | presence.ControllingClient.SendChatMessage(message, type, | 204 | presence.ControllingClient.SendChatMessage(message, type, |
205 | fromPos, | 205 | fromPos, |
206 | fromName, | 206 | fromName, |
207 | fromAgentID); | 207 | fromAgentID); |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | }); | 210 | }); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } \ No newline at end of file | 214 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 0fd03d3..5f8824c 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -1,157 +1,157 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using OpenSim.Framework.Utilities; | 5 | using OpenSim.Framework.Utilities; |
6 | using OpenSim.Region.Environment.Interfaces; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager |
12 | { | 12 | { |
13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
14 | 14 | ||
15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = | 15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = |
16 | new Dictionary<string, IDynamicTextureRender>(); | 16 | new Dictionary<string, IDynamicTextureRender>(); |
17 | 17 | ||
18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
19 | 19 | ||
20 | public void Initialise(Scene scene) | 20 | public void Initialise(Scene scene) |
21 | { | 21 | { |
22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) | 22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) |
23 | { | 23 | { |
24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); | 24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); |
25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | 25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void CloseDown() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string GetName() |
38 | { | 38 | { |
39 | return "DynamicTextureModule"; | 39 | return "DynamicTextureModule"; |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | 42 | public bool IsSharedModule() |
43 | { | 43 | { |
44 | return true; | 44 | return true; |
45 | } | 45 | } |
46 | 46 | ||
47 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 47 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
48 | { | 48 | { |
49 | if (!RenderPlugins.ContainsKey(handleType)) | 49 | if (!RenderPlugins.ContainsKey(handleType)) |
50 | { | 50 | { |
51 | RenderPlugins.Add(handleType, render); | 51 | RenderPlugins.Add(handleType, render); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | public void ReturnData(LLUUID id, byte[] data) | 55 | public void ReturnData(LLUUID id, byte[] data) |
56 | { | 56 | { |
57 | if (Updaters.ContainsKey(id)) | 57 | if (Updaters.ContainsKey(id)) |
58 | { | 58 | { |
59 | DynamicTextureUpdater updater = Updaters[id]; | 59 | DynamicTextureUpdater updater = Updaters[id]; |
60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
61 | { | 61 | { |
62 | Scene scene = RegisteredScenes[updater.SimUUID]; | 62 | Scene scene = RegisteredScenes[updater.SimUUID]; |
63 | updater.DataReceived(data, scene); | 63 | updater.DataReceived(data, scene); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
69 | string extraParams, int updateTimer) | 69 | string extraParams, int updateTimer) |
70 | { | 70 | { |
71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
72 | if (RenderPlugins.ContainsKey(contentType)) | 72 | if (RenderPlugins.ContainsKey(contentType)) |
73 | { | 73 | { |
74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
75 | updater.SimUUID = simID; | 75 | updater.SimUUID = simID; |
76 | updater.PrimID = primID; | 76 | updater.PrimID = primID; |
77 | updater.ContentType = contentType; | 77 | updater.ContentType = contentType; |
78 | updater.Url = url; | 78 | updater.Url = url; |
79 | updater.UpdateTimer = updateTimer; | 79 | updater.UpdateTimer = updateTimer; |
80 | updater.UpdaterID = LLUUID.Random(); | 80 | updater.UpdaterID = LLUUID.Random(); |
81 | updater.Params = extraParams; | 81 | updater.Params = extraParams; |
82 | 82 | ||
83 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 83 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
84 | { | 84 | { |
85 | Updaters.Add(updater.UpdaterID, updater); | 85 | Updaters.Add(updater.UpdaterID, updater); |
86 | } | 86 | } |
87 | 87 | ||
88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
89 | return updater.UpdaterID; | 89 | return updater.UpdaterID; |
90 | } | 90 | } |
91 | return LLUUID.Zero; | 91 | return LLUUID.Zero; |
92 | } | 92 | } |
93 | 93 | ||
94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
95 | string extraParams, int updateTimer) | 95 | string extraParams, int updateTimer) |
96 | { | 96 | { |
97 | if (RenderPlugins.ContainsKey(contentType)) | 97 | if (RenderPlugins.ContainsKey(contentType)) |
98 | { | 98 | { |
99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
100 | updater.SimUUID = simID; | 100 | updater.SimUUID = simID; |
101 | updater.PrimID = primID; | 101 | updater.PrimID = primID; |
102 | updater.ContentType = contentType; | 102 | updater.ContentType = contentType; |
103 | updater.BodyData = data; | 103 | updater.BodyData = data; |
104 | updater.UpdateTimer = updateTimer; | 104 | updater.UpdateTimer = updateTimer; |
105 | updater.UpdaterID = LLUUID.Random(); | 105 | updater.UpdaterID = LLUUID.Random(); |
106 | updater.Params = extraParams; | 106 | updater.Params = extraParams; |
107 | 107 | ||
108 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 108 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
109 | { | 109 | { |
110 | Updaters.Add(updater.UpdaterID, updater); | 110 | Updaters.Add(updater.UpdaterID, updater); |
111 | } | 111 | } |
112 | 112 | ||
113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
114 | return updater.UpdaterID; | 114 | return updater.UpdaterID; |
115 | } | 115 | } |
116 | return LLUUID.Zero; | 116 | return LLUUID.Zero; |
117 | } | 117 | } |
118 | 118 | ||
119 | public class DynamicTextureUpdater | 119 | public class DynamicTextureUpdater |
120 | { | 120 | { |
121 | public LLUUID SimUUID; | 121 | public LLUUID SimUUID; |
122 | public LLUUID UpdaterID; | 122 | public LLUUID UpdaterID; |
123 | public string ContentType; | 123 | public string ContentType; |
124 | public string Url; | 124 | public string Url; |
125 | public string BodyData; | 125 | public string BodyData; |
126 | public LLUUID PrimID; | 126 | public LLUUID PrimID; |
127 | public int UpdateTimer; | 127 | public int UpdateTimer; |
128 | public LLUUID LastAssetID; | 128 | public LLUUID LastAssetID; |
129 | public string Params; | 129 | public string Params; |
130 | 130 | ||
131 | public DynamicTextureUpdater() | 131 | public DynamicTextureUpdater() |
132 | { | 132 | { |
133 | LastAssetID = LLUUID.Zero; | 133 | LastAssetID = LLUUID.Zero; |
134 | UpdateTimer = 0; | 134 | UpdateTimer = 0; |
135 | BodyData = null; | 135 | BodyData = null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public void DataReceived(byte[] data, Scene scene) | 138 | public void DataReceived(byte[] data, Scene scene) |
139 | { | 139 | { |
140 | //TODO delete the last asset(data), if it was a dynamic texture | 140 | //TODO delete the last asset(data), if it was a dynamic texture |
141 | 141 | ||
142 | AssetBase asset = new AssetBase(); | 142 | AssetBase asset = new AssetBase(); |
143 | asset.FullID = LLUUID.Random(); | 143 | asset.FullID = LLUUID.Random(); |
144 | asset.Data = data; | 144 | asset.Data = data; |
145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | 145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); |
146 | asset.Type = 0; | 146 | asset.Type = 0; |
147 | scene.commsManager.AssetCache.AddAsset(asset); | 147 | scene.commsManager.AssetCache.AddAsset(asset); |
148 | 148 | ||
149 | LastAssetID = asset.FullID; | 149 | LastAssetID = asset.FullID; |
150 | 150 | ||
151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); |
152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); | 152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); |
153 | part.ScheduleFullUpdate(); | 153 | part.ScheduleFullUpdate(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } \ No newline at end of file | 157 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index c2a7291..767b4b0 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class FriendsModule : IRegionModule | 6 | public class FriendsModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index dcef2c5..fa5804e 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class GroupsModule : IRegionModule | 6 | public class GroupsModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 14f2b65..44cb3d5 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InstantMessageModule : IRegionModule | 6 | public class InstantMessageModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 40bd37e..527731d 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InventoryModule : IRegionModule | 6 | public class InventoryModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index f107d77..38c7d9b 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -1,8 +1,8 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class TextureDownloadModule : IRegionModule | 8 | public class TextureDownloadModule : IRegionModule |
@@ -10,7 +10,7 @@ namespace OpenSim.Region.Environment.Modules | |||
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public TextureDownloadModule() | 12 | public TextureDownloadModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
@@ -20,7 +20,7 @@ namespace OpenSim.Region.Environment.Modules | |||
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void CloseDown() |
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | } | 42 | } |
43 | 43 | ||
44 | public void TextureAssetCallback(LLUUID texture, byte[] data) | 44 | public void TextureAssetCallback(LLUUID texture, byte[] data) |
45 | { | 45 | { |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } \ No newline at end of file | 48 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index 7f8c5c1..9f93c1e 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Interfaces; | 4 | using OpenSim.Framework.Interfaces; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Region.Environment.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | 7 | ||
8 | namespace OpenSim.Region.Environment.Modules | 8 | namespace OpenSim.Region.Environment.Modules |
9 | { | 9 | { |
10 | public class XferModule : IRegionModule, IXfer | 10 | public class XferModule : IRegionModule, IXfer |
@@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Modules | |||
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | public XferModule() | 17 | public XferModule() |
18 | { | 18 | { |
19 | } | 19 | } |
20 | 20 | ||
21 | public void Initialise(Scene scene) | 21 | public void Initialise(Scene scene) |
@@ -27,11 +27,11 @@ namespace OpenSim.Region.Environment.Modules | |||
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void CloseDown() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string GetName() |
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | } | 119 | } |
120 | 120 | ||
121 | public XferDownLoad() | 121 | public XferDownLoad() |
122 | { | 122 | { |
123 | } | 123 | } |
124 | 124 | ||
125 | public void StartSend() | 125 | public void StartSend() |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 0a33380..4c02a6c 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Region.Environment.LandManagement; | 2 | using OpenSim.Region.Environment.LandManagement; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment | 5 | namespace OpenSim.Region.Environment |
6 | { | 6 | { |
7 | public class PermissionManager | 7 | public class PermissionManager |
@@ -12,8 +12,8 @@ namespace OpenSim.Region.Environment | |||
12 | // disable in any production environment | 12 | // disable in any production environment |
13 | // TODO: Change this to false when permissions are a desired default | 13 | // TODO: Change this to false when permissions are a desired default |
14 | // TODO: Move to configuration option. | 14 | // TODO: Move to configuration option. |
15 | private bool m_bypassPermissions = true; | 15 | private bool m_bypassPermissions = true; |
16 | 16 | ||
17 | public bool BypassPermissions | 17 | public bool BypassPermissions |
18 | { | 18 | { |
19 | get { return m_bypassPermissions; } | 19 | get { return m_bypassPermissions; } |
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment | |||
117 | permission = true; | 117 | permission = true; |
118 | 118 | ||
119 | // Users should be able to edit what is over their land. | 119 | // Users should be able to edit what is over their land. |
120 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == | 120 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == |
121 | user) | 121 | user) |
122 | permission = true; | 122 | permission = true; |
123 | 123 | ||
@@ -294,6 +294,6 @@ namespace OpenSim.Region.Environment | |||
294 | return GenericParcelPermission(user, parcel); | 294 | return GenericParcelPermission(user, parcel); |
295 | } | 295 | } |
296 | 296 | ||
297 | #endregion | 297 | #endregion |
298 | } | 298 | } |
299 | } \ No newline at end of file | 299 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b7f5bad..24f1a86 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1,445 +1,445 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using libsecondlife.Packets; | 3 | using libsecondlife.Packets; |
4 | using OpenSim.Framework.Communications.Cache; | 4 | using OpenSim.Framework.Communications.Cache; |
5 | using OpenSim.Framework.Communications.Caches; | 5 | using OpenSim.Framework.Communications.Caches; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
9 | using OpenSim.Region.Physics.Manager; | 9 | using OpenSim.Region.Physics.Manager; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Scenes | 11 | namespace OpenSim.Region.Environment.Scenes |
12 | { | 12 | { |
13 | public partial class Scene | 13 | public partial class Scene |
14 | { | 14 | { |
15 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete | 15 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete |
16 | // or at least some of they can be moved somewhere else | 16 | // or at least some of they can be moved somewhere else |
17 | 17 | ||
18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) |
19 | { | 19 | { |
20 | ScenePresence avatar; | 20 | ScenePresence avatar; |
21 | 21 | ||
22 | if ( TryGetAvatar( avatarId, out avatar )) | 22 | if ( TryGetAvatar( avatarId, out avatar )) |
23 | { | 23 | { |
24 | AddInventoryItem(avatar.ControllingClient, item); | 24 | AddInventoryItem(avatar.ControllingClient, item); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
29 | { | 29 | { |
30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
31 | if (userInfo != null) | 31 | if (userInfo != null) |
32 | { | 32 | { |
33 | userInfo.AddItem(remoteClient.AgentId, item); | 33 | userInfo.AddItem(remoteClient.AgentId, item); |
34 | remoteClient.SendInventoryItemUpdate(item); | 34 | remoteClient.SendInventoryItemUpdate(item); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) | 38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) |
39 | { | 39 | { |
40 | ScenePresence avatar; | 40 | ScenePresence avatar; |
41 | 41 | ||
42 | if (TryGetAvatar(avatarId, out avatar)) | 42 | if (TryGetAvatar(avatarId, out avatar)) |
43 | { | 43 | { |
44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); |
45 | } | 45 | } |
46 | 46 | ||
47 | return LLUUID.Zero; | 47 | return LLUUID.Zero; |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
51 | { | 51 | { |
52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
53 | if (userInfo != null) | 53 | if (userInfo != null) |
54 | { | 54 | { |
55 | if (userInfo.RootFolder != null) | 55 | if (userInfo.RootFolder != null) |
56 | { | 56 | { |
57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
58 | if (item != null) | 58 | if (item != null) |
59 | { | 59 | { |
60 | AssetBase asset; | 60 | AssetBase asset; |
61 | asset = new AssetBase(); | 61 | asset = new AssetBase(); |
62 | asset.FullID = LLUUID.Random(); | 62 | asset.FullID = LLUUID.Random(); |
63 | asset.Type = (sbyte) item.assetType; | 63 | asset.Type = (sbyte) item.assetType; |
64 | asset.InvType = (sbyte) item.invType; | 64 | asset.InvType = (sbyte) item.invType; |
65 | asset.Name = item.inventoryName; | 65 | asset.Name = item.inventoryName; |
66 | asset.Data = data; | 66 | asset.Data = data; |
67 | commsManager.AssetCache.AddAsset(asset); | 67 | commsManager.AssetCache.AddAsset(asset); |
68 | 68 | ||
69 | item.assetID = asset.FullID; | 69 | item.assetID = asset.FullID; |
70 | userInfo.UpdateItem(remoteClient.AgentId, item); | 70 | userInfo.UpdateItem(remoteClient.AgentId, item); |
71 | 71 | ||
72 | // remoteClient.SendInventoryItemUpdate(item); | 72 | // remoteClient.SendInventoryItemUpdate(item); |
73 | if (item.invType == 7) | 73 | if (item.invType == 7) |
74 | { | 74 | { |
75 | //do we want to know about updated note cards? | 75 | //do we want to know about updated note cards? |
76 | } | 76 | } |
77 | else if (item.invType == 10) | 77 | else if (item.invType == 10) |
78 | { | 78 | { |
79 | // do we want to know about updated scripts | 79 | // do we want to know about updated scripts |
80 | } | 80 | } |
81 | 81 | ||
82 | return (asset.FullID); | 82 | return (asset.FullID); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | return LLUUID.Zero; | 86 | return LLUUID.Zero; |
87 | } | 87 | } |
88 | 88 | ||
89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, | 89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, |
90 | LLUUID itemID) | 90 | LLUUID itemID) |
91 | { | 91 | { |
92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
93 | if (userInfo != null) | 93 | if (userInfo != null) |
94 | { | 94 | { |
95 | if (userInfo.RootFolder != null) | 95 | if (userInfo.RootFolder != null) |
96 | { | 96 | { |
97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
98 | if (item != null) | 98 | if (item != null) |
99 | { | 99 | { |
100 | AgentAssetTransactions transactions = | 100 | AgentAssetTransactions transactions = |
101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | 101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); |
102 | if (transactions != null) | 102 | if (transactions != null) |
103 | { | 103 | { |
104 | AssetBase asset = null; | 104 | AssetBase asset = null; |
105 | bool addToCache = false; | 105 | bool addToCache = false; |
106 | 106 | ||
107 | asset = commsManager.AssetCache.GetAsset(assetID); | 107 | asset = commsManager.AssetCache.GetAsset(assetID); |
108 | if (asset == null) | 108 | if (asset == null) |
109 | { | 109 | { |
110 | asset = transactions.GetTransactionAsset(transactionID); | 110 | asset = transactions.GetTransactionAsset(transactionID); |
111 | addToCache = true; | 111 | addToCache = true; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (asset != null) | 114 | if (asset != null) |
115 | { | 115 | { |
116 | if (asset.FullID == assetID) | 116 | if (asset.FullID == assetID) |
117 | { | 117 | { |
118 | asset.Name = item.inventoryName; | 118 | asset.Name = item.inventoryName; |
119 | asset.Description = item.inventoryDescription; | 119 | asset.Description = item.inventoryDescription; |
120 | asset.InvType = (sbyte) item.invType; | 120 | asset.InvType = (sbyte) item.invType; |
121 | asset.Type = (sbyte) item.assetType; | 121 | asset.Type = (sbyte) item.assetType; |
122 | item.assetID = asset.FullID; | 122 | item.assetID = asset.FullID; |
123 | 123 | ||
124 | if (addToCache) | 124 | if (addToCache) |
125 | { | 125 | { |
126 | commsManager.AssetCache.AddAsset(asset); | 126 | commsManager.AssetCache.AddAsset(asset); |
127 | } | 127 | } |
128 | 128 | ||
129 | userInfo.UpdateItem(remoteClient.AgentId, item); | 129 | userInfo.UpdateItem(remoteClient.AgentId, item); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// temporary method to test out creating new inventory items | 139 | /// temporary method to test out creating new inventory items |
140 | /// </summary> | 140 | /// </summary> |
141 | /// <param name="remoteClient"></param> | 141 | /// <param name="remoteClient"></param> |
142 | /// <param name="transActionID"></param> | 142 | /// <param name="transActionID"></param> |
143 | /// <param name="folderID"></param> | 143 | /// <param name="folderID"></param> |
144 | /// <param name="callbackID"></param> | 144 | /// <param name="callbackID"></param> |
145 | /// <param name="description"></param> | 145 | /// <param name="description"></param> |
146 | /// <param name="name"></param> | 146 | /// <param name="name"></param> |
147 | /// <param name="invType"></param> | 147 | /// <param name="invType"></param> |
148 | /// <param name="type"></param> | 148 | /// <param name="type"></param> |
149 | /// <param name="wearableType"></param> | 149 | /// <param name="wearableType"></param> |
150 | /// <param name="nextOwnerMask"></param> | 150 | /// <param name="nextOwnerMask"></param> |
151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, | 151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, |
152 | uint callbackID, string description, string name, sbyte invType, sbyte type, | 152 | uint callbackID, string description, string name, sbyte invType, sbyte type, |
153 | byte wearableType, uint nextOwnerMask) | 153 | byte wearableType, uint nextOwnerMask) |
154 | { | 154 | { |
155 | if (transActionID == LLUUID.Zero) | 155 | if (transActionID == LLUUID.Zero) |
156 | { | 156 | { |
157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
158 | if (userInfo != null) | 158 | if (userInfo != null) |
159 | { | 159 | { |
160 | AssetBase asset = new AssetBase(); | 160 | AssetBase asset = new AssetBase(); |
161 | asset.Name = name; | 161 | asset.Name = name; |
162 | asset.Description = description; | 162 | asset.Description = description; |
163 | asset.InvType = invType; | 163 | asset.InvType = invType; |
164 | asset.Type = type; | 164 | asset.Type = type; |
165 | asset.FullID = LLUUID.Random(); | 165 | asset.FullID = LLUUID.Random(); |
166 | asset.Data = new byte[1]; | 166 | asset.Data = new byte[1]; |
167 | commsManager.AssetCache.AddAsset(asset); | 167 | commsManager.AssetCache.AddAsset(asset); |
168 | 168 | ||
169 | InventoryItemBase item = new InventoryItemBase(); | 169 | InventoryItemBase item = new InventoryItemBase(); |
170 | item.avatarID = remoteClient.AgentId; | 170 | item.avatarID = remoteClient.AgentId; |
171 | item.creatorsID = remoteClient.AgentId; | 171 | item.creatorsID = remoteClient.AgentId; |
172 | item.inventoryID = LLUUID.Random(); | 172 | item.inventoryID = LLUUID.Random(); |
173 | item.assetID = asset.FullID; | 173 | item.assetID = asset.FullID; |
174 | item.inventoryDescription = description; | 174 | item.inventoryDescription = description; |
175 | item.inventoryName = name; | 175 | item.inventoryName = name; |
176 | item.assetType = invType; | 176 | item.assetType = invType; |
177 | item.invType = invType; | 177 | item.invType = invType; |
178 | item.parentFolderID = folderID; | 178 | item.parentFolderID = folderID; |
179 | item.inventoryCurrentPermissions = 2147483647; | 179 | item.inventoryCurrentPermissions = 2147483647; |
180 | item.inventoryNextPermissions = nextOwnerMask; | 180 | item.inventoryNextPermissions = nextOwnerMask; |
181 | 181 | ||
182 | userInfo.AddItem(remoteClient.AgentId, item); | 182 | userInfo.AddItem(remoteClient.AgentId, item); |
183 | remoteClient.SendInventoryItemUpdate(item); | 183 | remoteClient.SendInventoryItemUpdate(item); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, | 188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, |
189 | callbackID, description, name, invType, | 189 | callbackID, description, name, invType, |
190 | type, wearableType, nextOwnerMask); | 190 | type, wearableType, nextOwnerMask); |
191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | 191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | /// <summary> | 195 | /// <summary> |
196 | /// | 196 | /// |
197 | /// </summary> | 197 | /// </summary> |
198 | /// <param name="remoteClient"></param> | 198 | /// <param name="remoteClient"></param> |
199 | /// <param name="primLocalID"></param> | 199 | /// <param name="primLocalID"></param> |
200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
201 | { | 201 | { |
202 | bool hasPrim = false; | 202 | bool hasPrim = false; |
203 | foreach (EntityBase ent in Entities.Values) | 203 | foreach (EntityBase ent in Entities.Values) |
204 | { | 204 | { |
205 | if (ent is SceneObjectGroup) | 205 | if (ent is SceneObjectGroup) |
206 | { | 206 | { |
207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); | 207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); |
208 | if (hasPrim != false) | 208 | if (hasPrim != false) |
209 | { | 209 | { |
210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); | 210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); |
211 | if (fileChange) | 211 | if (fileChange) |
212 | { | 212 | { |
213 | if (XferManager != null) | 213 | if (XferManager != null) |
214 | { | 214 | { |
215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); | 215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | 224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) |
225 | { | 225 | { |
226 | bool hasPrim = false; | 226 | bool hasPrim = false; |
227 | foreach (EntityBase ent in Entities.Values) | 227 | foreach (EntityBase ent in Entities.Values) |
228 | { | 228 | { |
229 | if (ent is SceneObjectGroup) | 229 | if (ent is SceneObjectGroup) |
230 | { | 230 | { |
231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
232 | if (hasPrim != false) | 232 | if (hasPrim != false) |
233 | { | 233 | { |
234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); | 234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); |
235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
236 | if (type == 10) | 236 | if (type == 10) |
237 | { | 237 | { |
238 | EventManager.TriggerRemoveScript(localID, itemID); | 238 | EventManager.TriggerRemoveScript(localID, itemID); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
246 | { | 246 | { |
247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
248 | LLUUID copyID = LLUUID.Random(); | 248 | LLUUID copyID = LLUUID.Random(); |
249 | if (userInfo != null) | 249 | if (userInfo != null) |
250 | { | 250 | { |
251 | if (userInfo.RootFolder != null) | 251 | if (userInfo.RootFolder != null) |
252 | { | 252 | { |
253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
254 | if (item != null) | 254 | if (item != null) |
255 | { | 255 | { |
256 | bool isTexture = false; | 256 | bool isTexture = false; |
257 | bool rezzed = false; | 257 | bool rezzed = false; |
258 | if (item.invType == 0) | 258 | if (item.invType == 0) |
259 | { | 259 | { |
260 | isTexture = true; | 260 | isTexture = true; |
261 | } | 261 | } |
262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
263 | if (rezAsset != null) | 263 | if (rezAsset != null) |
264 | { | 264 | { |
265 | string script = Util.FieldToString(rezAsset.Data); | 265 | string script = Util.FieldToString(rezAsset.Data); |
266 | //Console.WriteLine("rez script "+script); | 266 | //Console.WriteLine("rez script "+script); |
267 | EventManager.TriggerRezScript(localID, copyID, script); | 267 | EventManager.TriggerRezScript(localID, copyID, script); |
268 | rezzed = true; | 268 | rezzed = true; |
269 | } | 269 | } |
270 | else | 270 | else |
271 | { | 271 | { |
272 | //lets try once more incase the asset cache is being slow getting the asset from server | 272 | //lets try once more incase the asset cache is being slow getting the asset from server |
273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
274 | if (rezAsset != null) | 274 | if (rezAsset != null) |
275 | { | 275 | { |
276 | string script = Util.FieldToString(rezAsset.Data); | 276 | string script = Util.FieldToString(rezAsset.Data); |
277 | // Console.WriteLine("rez script " + script); | 277 | // Console.WriteLine("rez script " + script); |
278 | EventManager.TriggerRezScript(localID, copyID, script); | 278 | EventManager.TriggerRezScript(localID, copyID, script); |
279 | rezzed = true; | 279 | rezzed = true; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | if (rezzed) | 283 | if (rezzed) |
284 | { | 284 | { |
285 | bool hasPrim = false; | 285 | bool hasPrim = false; |
286 | foreach (EntityBase ent in Entities.Values) | 286 | foreach (EntityBase ent in Entities.Values) |
287 | { | 287 | { |
288 | if (ent is SceneObjectGroup) | 288 | if (ent is SceneObjectGroup) |
289 | { | 289 | { |
290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
291 | if (hasPrim != false) | 291 | if (hasPrim != false) |
292 | { | 292 | { |
293 | bool added = | 293 | bool added = |
294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, | 294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, |
295 | copyID); | 295 | copyID); |
296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | /// <summary> | 306 | /// <summary> |
307 | /// | 307 | /// |
308 | /// </summary> | 308 | /// </summary> |
309 | /// <param name="packet"></param> | 309 | /// <param name="packet"></param> |
310 | /// <param name="simClient"></param> | 310 | /// <param name="simClient"></param> |
311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | 311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) |
312 | { | 312 | { |
313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; | 313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; |
314 | 314 | ||
315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
316 | { | 316 | { |
317 | //currently following code not used (or don't know of any case of destination being zero | 317 | //currently following code not used (or don't know of any case of destination being zero |
318 | } | 318 | } |
319 | else | 319 | else |
320 | { | 320 | { |
321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
322 | { | 322 | { |
323 | EntityBase selectedEnt = null; | 323 | EntityBase selectedEnt = null; |
324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | 324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); |
325 | foreach (EntityBase ent in Entities.Values) | 325 | foreach (EntityBase ent in Entities.Values) |
326 | { | 326 | { |
327 | if (ent.LocalId == Data.ObjectLocalID) | 327 | if (ent.LocalId == Data.ObjectLocalID) |
328 | { | 328 | { |
329 | selectedEnt = ent; | 329 | selectedEnt = ent; |
330 | break; | 330 | break; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | if (selectedEnt != null) | 333 | if (selectedEnt != null) |
334 | { | 334 | { |
335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) | 335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) |
336 | { | 336 | { |
337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); | 337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); |
338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
339 | if (userInfo != null) | 339 | if (userInfo != null) |
340 | { | 340 | { |
341 | AssetBase asset = new AssetBase(); | 341 | AssetBase asset = new AssetBase(); |
342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); | 342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); |
343 | asset.Description = | 343 | asset.Description = |
344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); | 344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); |
345 | asset.InvType = 6; | 345 | asset.InvType = 6; |
346 | asset.Type = 6; | 346 | asset.Type = 6; |
347 | asset.FullID = LLUUID.Random(); | 347 | asset.FullID = LLUUID.Random(); |
348 | asset.Data = Helpers.StringToField(sceneObjectXml); | 348 | asset.Data = Helpers.StringToField(sceneObjectXml); |
349 | commsManager.AssetCache.AddAsset(asset); | 349 | commsManager.AssetCache.AddAsset(asset); |
350 | 350 | ||
351 | 351 | ||
352 | InventoryItemBase item = new InventoryItemBase(); | 352 | InventoryItemBase item = new InventoryItemBase(); |
353 | item.avatarID = remoteClient.AgentId; | 353 | item.avatarID = remoteClient.AgentId; |
354 | item.creatorsID = remoteClient.AgentId; | 354 | item.creatorsID = remoteClient.AgentId; |
355 | item.inventoryID = LLUUID.Random(); | 355 | item.inventoryID = LLUUID.Random(); |
356 | item.assetID = asset.FullID; | 356 | item.assetID = asset.FullID; |
357 | item.inventoryDescription = asset.Description; | 357 | item.inventoryDescription = asset.Description; |
358 | item.inventoryName = asset.Name; | 358 | item.inventoryName = asset.Name; |
359 | item.assetType = asset.Type; | 359 | item.assetType = asset.Type; |
360 | item.invType = asset.InvType; | 360 | item.invType = asset.InvType; |
361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | 361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; |
362 | item.inventoryCurrentPermissions = 2147483647; | 362 | item.inventoryCurrentPermissions = 2147483647; |
363 | item.inventoryNextPermissions = 2147483647; | 363 | item.inventoryNextPermissions = 2147483647; |
364 | 364 | ||
365 | userInfo.AddItem(remoteClient.AgentId, item); | 365 | userInfo.AddItem(remoteClient.AgentId, item); |
366 | remoteClient.SendInventoryItemUpdate(item); | 366 | remoteClient.SendInventoryItemUpdate(item); |
367 | } | 367 | } |
368 | 368 | ||
369 | SceneObjectPart rootPart = | 369 | SceneObjectPart rootPart = |
370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); | 370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); |
371 | if (rootPart.PhysActor != null) | 371 | if (rootPart.PhysActor != null) |
372 | { | 372 | { |
373 | phyScene.RemovePrim(rootPart.PhysActor); | 373 | phyScene.RemovePrim(rootPart.PhysActor); |
374 | rootPart.PhysActor = null; | 374 | rootPart.PhysActor = null; |
375 | } | 375 | } |
376 | 376 | ||
377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, | 377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, |
378 | m_regInfo.SimUUID); | 378 | m_regInfo.SimUUID); |
379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); | 379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); |
380 | 380 | ||
381 | lock (Entities) | 381 | lock (Entities) |
382 | { | 382 | { |
383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); | 383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); |
384 | } | 384 | } |
385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); | 385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) |
393 | { | 393 | { |
394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
395 | if (userInfo != null) | 395 | if (userInfo != null) |
396 | { | 396 | { |
397 | if (userInfo.RootFolder != null) | 397 | if (userInfo.RootFolder != null) |
398 | { | 398 | { |
399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
400 | if (item != null) | 400 | if (item != null) |
401 | { | 401 | { |
402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
403 | if (rezAsset != null) | 403 | if (rezAsset != null) |
404 | { | 404 | { |
405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
406 | userInfo.DeleteItem(remoteClient.AgentId, item); | 406 | userInfo.DeleteItem(remoteClient.AgentId, item); |
407 | remoteClient.SendRemoveInventoryItem(itemID); | 407 | remoteClient.SendRemoveInventoryItem(itemID); |
408 | } | 408 | } |
409 | else | 409 | else |
410 | { | 410 | { |
411 | //lets try once more incase the asset cache is being slow getting the asset from server | 411 | //lets try once more incase the asset cache is being slow getting the asset from server |
412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
413 | if (rezAsset != null) | 413 | if (rezAsset != null) |
414 | { | 414 | { |
415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
416 | userInfo.DeleteItem(remoteClient.AgentId, item); | 416 | userInfo.DeleteItem(remoteClient.AgentId, item); |
417 | remoteClient.SendRemoveInventoryItem(itemID); | 417 | remoteClient.SendRemoveInventoryItem(itemID); |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | private void AddRezObject(string xmlData, LLVector3 pos) | 425 | private void AddRezObject(string xmlData, LLVector3 pos) |
426 | { | 426 | { |
427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
428 | AddEntity(group); | 428 | AddEntity(group); |
429 | group.AbsolutePosition = pos; | 429 | group.AbsolutePosition = pos; |
430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
432 | { | 432 | { |
433 | PrimitiveBaseShape pbs = rootPart.Shape; | 433 | PrimitiveBaseShape pbs = rootPart.Shape; |
434 | rootPart.PhysActor = phyScene.AddPrimShape( | 434 | rootPart.PhysActor = phyScene.AddPrimShape( |
435 | rootPart.Name, | 435 | rootPart.Name, |
436 | pbs, | 436 | pbs, |
437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | 437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, |
438 | rootPart.AbsolutePosition.Z), | 438 | rootPart.AbsolutePosition.Z), |
439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | 439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), |
440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | 440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, |
441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); | 441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 0049282..89f60d1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -1,251 +1,251 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using OpenSim.Framework.Console; | 3 | using OpenSim.Framework.Console; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Scenes | 7 | namespace OpenSim.Region.Environment.Scenes |
8 | { | 8 | { |
9 | public class SceneManager | 9 | public class SceneManager |
10 | { | 10 | { |
11 | private readonly List<Scene> m_localScenes; | 11 | private readonly List<Scene> m_localScenes; |
12 | private Scene m_currentScene = null; | 12 | private Scene m_currentScene = null; |
13 | 13 | ||
14 | public Scene CurrentScene | 14 | public Scene CurrentScene |
15 | { | 15 | { |
16 | get { return m_currentScene; } | 16 | get { return m_currentScene; } |
17 | } | 17 | } |
18 | 18 | ||
19 | public Scene CurrentOrFirstScene | 19 | public Scene CurrentOrFirstScene |
20 | { | 20 | { |
21 | get | 21 | get |
22 | { | 22 | { |
23 | if (m_currentScene == null) | 23 | if (m_currentScene == null) |
24 | { | 24 | { |
25 | return m_localScenes[0]; | 25 | return m_localScenes[0]; |
26 | } | 26 | } |
27 | else | 27 | else |
28 | { | 28 | { |
29 | return m_currentScene; | 29 | return m_currentScene; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | public SceneManager() | 34 | public SceneManager() |
35 | { | 35 | { |
36 | m_localScenes = new List<Scene>(); | 36 | m_localScenes = new List<Scene>(); |
37 | } | 37 | } |
38 | 38 | ||
39 | public void Close() | 39 | public void Close() |
40 | { | 40 | { |
41 | for (int i = 0; i < m_localScenes.Count; i++) | 41 | for (int i = 0; i < m_localScenes.Count; i++) |
42 | { | 42 | { |
43 | m_localScenes[i].Close(); | 43 | m_localScenes[i].Close(); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void Add(Scene scene) | 47 | public void Add(Scene scene) |
48 | { | 48 | { |
49 | m_localScenes.Add(scene); | 49 | m_localScenes.Add(scene); |
50 | } | 50 | } |
51 | 51 | ||
52 | public void SaveCurrentSceneToXml(string filename) | 52 | public void SaveCurrentSceneToXml(string filename) |
53 | { | 53 | { |
54 | CurrentOrFirstScene.SavePrimsToXml(filename); | 54 | CurrentOrFirstScene.SavePrimsToXml(filename); |
55 | } | 55 | } |
56 | 56 | ||
57 | public void LoadCurrentSceneFromXml(string filename) | 57 | public void LoadCurrentSceneFromXml(string filename) |
58 | { | 58 | { |
59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); | 59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); |
60 | } | 60 | } |
61 | 61 | ||
62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) | 62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) |
63 | { | 63 | { |
64 | if (m_currentScene == null) | 64 | if (m_currentScene == null) |
65 | { | 65 | { |
66 | bool success = true; | 66 | bool success = true; |
67 | foreach (Scene scene in m_localScenes) | 67 | foreach (Scene scene in m_localScenes) |
68 | { | 68 | { |
69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) | 69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) |
70 | { | 70 | { |
71 | success = false; | 71 | success = false; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | return success; | 75 | return success; |
76 | } | 76 | } |
77 | else | 77 | else |
78 | { | 78 | { |
79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); | 79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) | 83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) |
84 | { | 84 | { |
85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
86 | } | 86 | } |
87 | 87 | ||
88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
89 | { | 89 | { |
90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); | 90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); |
91 | } | 91 | } |
92 | 92 | ||
93 | private void ForEachCurrentScene(Action<Scene> func) | 93 | private void ForEachCurrentScene(Action<Scene> func) |
94 | { | 94 | { |
95 | if (m_currentScene == null) | 95 | if (m_currentScene == null) |
96 | { | 96 | { |
97 | m_localScenes.ForEach(func); | 97 | m_localScenes.ForEach(func); |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | func(m_currentScene); | 101 | func(m_currentScene); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | public void BackupCurrentScene() | 105 | public void BackupCurrentScene() |
106 | { | 106 | { |
107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); | 107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); |
108 | } | 108 | } |
109 | 109 | ||
110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) | 110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) |
111 | { | 111 | { |
112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); | 112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); |
113 | } | 113 | } |
114 | 114 | ||
115 | public bool TrySetCurrentScene(string regionName) | 115 | public bool TrySetCurrentScene(string regionName) |
116 | { | 116 | { |
117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) | 117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) |
118 | { | 118 | { |
119 | m_currentScene = null; | 119 | m_currentScene = null; |
120 | return true; | 120 | return true; |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); | 124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); |
125 | 125 | ||
126 | foreach (Scene scene in m_localScenes) | 126 | foreach (Scene scene in m_localScenes) |
127 | { | 127 | { |
128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) | 128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) |
129 | { | 129 | { |
130 | m_currentScene = scene; | 130 | m_currentScene = scene; |
131 | return true; | 131 | return true; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | return false; | 135 | return false; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) | 139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) |
140 | { | 140 | { |
141 | ForEachCurrentScene(delegate(Scene scene) | 141 | ForEachCurrentScene(delegate(Scene scene) |
142 | { | 142 | { |
143 | foreach (EntityBase entity in scene.Entities.Values) | 143 | foreach (EntityBase entity in scene.Entities.Values) |
144 | { | 144 | { |
145 | if (entity is ScenePresence) | 145 | if (entity is ScenePresence) |
146 | { | 146 | { |
147 | ScenePresence scenePrescence = entity as ScenePresence; | 147 | ScenePresence scenePrescence = entity as ScenePresence; |
148 | if (!scenePrescence.IsChildAgent) | 148 | if (!scenePrescence.IsChildAgent) |
149 | { | 149 | { |
150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", | 150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", |
151 | scenePrescence.Firstname, scenePrescence.Lastname, | 151 | scenePrescence.Firstname, scenePrescence.Lastname, |
152 | newDebug)); | 152 | newDebug)); |
153 | 153 | ||
154 | scenePrescence.ControllingClient.SetDebug(newDebug); | 154 | scenePrescence.ControllingClient.SetDebug(newDebug); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | }); | 158 | }); |
159 | } | 159 | } |
160 | 160 | ||
161 | public List<ScenePresence> GetCurrentSceneAvatars() | 161 | public List<ScenePresence> GetCurrentSceneAvatars() |
162 | { | 162 | { |
163 | List<ScenePresence> avatars = new List<ScenePresence>(); | 163 | List<ScenePresence> avatars = new List<ScenePresence>(); |
164 | 164 | ||
165 | ForEachCurrentScene(delegate(Scene scene) | 165 | ForEachCurrentScene(delegate(Scene scene) |
166 | { | 166 | { |
167 | foreach (EntityBase entity in scene.Entities.Values) | 167 | foreach (EntityBase entity in scene.Entities.Values) |
168 | { | 168 | { |
169 | if (entity is ScenePresence) | 169 | if (entity is ScenePresence) |
170 | { | 170 | { |
171 | ScenePresence scenePrescence = entity as ScenePresence; | 171 | ScenePresence scenePrescence = entity as ScenePresence; |
172 | if (!scenePrescence.IsChildAgent) | 172 | if (!scenePrescence.IsChildAgent) |
173 | { | 173 | { |
174 | avatars.Add(scenePrescence); | 174 | avatars.Add(scenePrescence); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | }); | 178 | }); |
179 | 179 | ||
180 | return avatars; | 180 | return avatars; |
181 | } | 181 | } |
182 | 182 | ||
183 | public RegionInfo GetRegionInfo(ulong regionHandle) | 183 | public RegionInfo GetRegionInfo(ulong regionHandle) |
184 | { | 184 | { |
185 | foreach (Scene scene in m_localScenes) | 185 | foreach (Scene scene in m_localScenes) |
186 | { | 186 | { |
187 | if (scene.RegionInfo.RegionHandle == regionHandle) | 187 | if (scene.RegionInfo.RegionHandle == regionHandle) |
188 | { | 188 | { |
189 | return scene.RegionInfo; | 189 | return scene.RegionInfo; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | return null; | 193 | return null; |
194 | } | 194 | } |
195 | 195 | ||
196 | public void SetCurrentSceneTimePhase(int timePhase) | 196 | public void SetCurrentSceneTimePhase(int timePhase) |
197 | { | 197 | { |
198 | ForEachCurrentScene(delegate(Scene scene) | 198 | ForEachCurrentScene(delegate(Scene scene) |
199 | { | 199 | { |
200 | scene.SetTimePhase( | 200 | scene.SetTimePhase( |
201 | timePhase) | 201 | timePhase) |
202 | ; | 202 | ; |
203 | }); | 203 | }); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | public void ForceCurrentSceneClientUpdate() | 207 | public void ForceCurrentSceneClientUpdate() |
208 | { | 208 | { |
209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
210 | } | 210 | } |
211 | 211 | ||
212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
213 | { | 213 | { |
214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
215 | } | 215 | } |
216 | 216 | ||
217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) | 217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) |
218 | { | 218 | { |
219 | foreach (Scene scene in m_localScenes) | 219 | foreach (Scene scene in m_localScenes) |
220 | { | 220 | { |
221 | if( scene.TryGetAvatar( avatarId, out avatar )) | 221 | if( scene.TryGetAvatar( avatarId, out avatar )) |
222 | { | 222 | { |
223 | return true; | 223 | return true; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | avatar = null; | 227 | avatar = null; |
228 | return false; | 228 | return false; |
229 | } | 229 | } |
230 | 230 | ||
231 | public void CloseScene(Scene scene) | 231 | public void CloseScene(Scene scene) |
232 | { | 232 | { |
233 | m_localScenes.Remove(scene); | 233 | m_localScenes.Remove(scene); |
234 | scene.Close(); | 234 | scene.Close(); |
235 | } | 235 | } |
236 | 236 | ||
237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
238 | { | 238 | { |
239 | foreach (Scene scene in m_localScenes) | 239 | foreach (Scene scene in m_localScenes) |
240 | { | 240 | { |
241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) | 241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) |
242 | { | 242 | { |
243 | return true; | 243 | return true; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | avatar = null; | 247 | avatar = null; |
248 | return false; | 248 | return false; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } \ No newline at end of file | 251 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index dbd43be..baaeb86 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Scenes.Scripting | 4 | namespace OpenSim.Region.Environment.Scenes.Scripting |
5 | { | 5 | { |
6 | public interface IScriptHost | 6 | public interface IScriptHost |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 6876cfb..2337aba 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -1,13 +1,13 @@ | |||
1 | using System; | 1 | using System; |
2 | using Axiom.Math; | 2 | using Axiom.Math; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Scenes.Scripting | 5 | namespace OpenSim.Region.Environment.Scenes.Scripting |
6 | { | 6 | { |
7 | public class NullScriptHost : IScriptHost | 7 | public class NullScriptHost : IScriptHost |
8 | { | 8 | { |
9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); | 9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); |
10 | 10 | ||
11 | public string Name | 11 | public string Name |
12 | { | 12 | { |
13 | get { return "Object"; } | 13 | get { return "Object"; } |
@@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
38 | } | 38 | } |
39 | 39 | ||
40 | public LLUUID ObjectOwner | 40 | public LLUUID ObjectOwner |
41 | { | 41 | { |
42 | get { return LLUUID.Zero; } | 42 | get { return LLUUID.Zero; } |
43 | } | 43 | } |
44 | 44 | ||
45 | public LLUUID ObjectCreator | 45 | public LLUUID ObjectCreator |
46 | { | 46 | { |
47 | get { return LLUUID.Zero; } | 47 | get { return LLUUID.Zero; } |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLVector3 AbsolutePosition | 50 | public LLVector3 AbsolutePosition |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 0b815ba..2b8d92e 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Types | 4 | namespace OpenSim.Region.Environment.Types |
5 | { | 5 | { |
6 | public class BasicQuadTreeNode | 6 | public class BasicQuadTreeNode |
@@ -64,16 +64,16 @@ namespace OpenSim.Region.Environment.Types | |||
64 | if (m_childNodes == null) | 64 | if (m_childNodes == null) |
65 | { | 65 | { |
66 | m_childNodes = new BasicQuadTreeNode[4]; | 66 | m_childNodes = new BasicQuadTreeNode[4]; |
67 | m_childNodes[0] = | 67 | m_childNodes[0] = |
68 | new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); | 68 | new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); |
69 | m_childNodes[1] = | 69 | m_childNodes[1] = |
70 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), | 70 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), |
71 | (short) (m_height/2)); | 71 | (short) (m_height/2)); |
72 | m_childNodes[2] = | 72 | m_childNodes[2] = |
73 | new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), | 73 | new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), |
74 | (short) (m_height/2)); | 74 | (short) (m_height/2)); |
75 | m_childNodes[3] = | 75 | m_childNodes[3] = |
76 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), | 76 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), |
77 | (short) (m_width/2), (short) (m_height/2)); | 77 | (short) (m_width/2), (short) (m_height/2)); |
78 | } | 78 | } |
79 | else | 79 | else |
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Types | |||
132 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 132 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); |
133 | foreach (SceneObjectGroup group in m_objects) | 133 | foreach (SceneObjectGroup group in m_objects) |
134 | { | 134 | { |
135 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 135 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
136 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 136 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
137 | { | 137 | { |
138 | //still in bounds | 138 | //still in bounds |
@@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Types | |||
157 | 157 | ||
158 | public void PassUp(SceneObjectGroup group) | 158 | public void PassUp(SceneObjectGroup group) |
159 | { | 159 | { |
160 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 160 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
161 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 161 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
162 | { | 162 | { |
163 | AddObject(group); | 163 | AddObject(group); |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 6e26aaf..c1fb161 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Types | 5 | namespace OpenSim.Region.Environment.Types |
6 | { | 6 | { |
7 | public class UpdateQueue | 7 | public class UpdateQueue |
@@ -46,6 +46,6 @@ namespace OpenSim.Region.Environment.Types | |||
46 | } | 46 | } |
47 | 47 | ||
48 | return part; | 48 | return part; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } \ No newline at end of file | 51 | } \ No newline at end of file |