diff options
author | Sean Dague | 2007-09-17 12:52:03 +0000 |
---|---|---|
committer | Sean Dague | 2007-09-17 12:52:03 +0000 |
commit | b8d9737a47696952bedec33dface8f18df47341f (patch) | |
tree | 9279f45510f8a9285ac5b9c9165ab6c741009eac /OpenSim/Region/Environment | |
parent | I think this is the last bits for a consistant pristine (diff) | |
download | opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.zip opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.gz opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.bz2 opensim-SC-b8d9737a47696952bedec33dface8f18df47341f.tar.xz |
fixing me some line endings
Diffstat (limited to '')
29 files changed, 2636 insertions, 2636 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs index 8fdfa8f..727b386 100644 --- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs | |||
@@ -1,27 +1,27 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Interfaces | 7 | namespace OpenSim.Region.Environment.Interfaces |
8 | { | 8 | { |
9 | public interface IDynamicTextureManager | 9 | public interface IDynamicTextureManager |
10 | { | 10 | { |
11 | void RegisterRender(string handleType, IDynamicTextureRender render); | 11 | void RegisterRender(string handleType, IDynamicTextureRender render); |
12 | void ReturnData(LLUUID id, byte[] data); | 12 | void ReturnData(LLUUID id, byte[] data); |
13 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); | 13 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); |
14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer); | 14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer); |
15 | } | 15 | } |
16 | 16 | ||
17 | public interface IDynamicTextureRender | 17 | public interface IDynamicTextureRender |
18 | { | 18 | { |
19 | string GetName(); | 19 | string GetName(); |
20 | string GetContentType(); | 20 | string GetContentType(); |
21 | bool SupportsAsynchronous(); | 21 | bool SupportsAsynchronous(); |
22 | byte[] ConvertUrl(string url, string extraParams); | 22 | byte[] ConvertUrl(string url, string extraParams); |
23 | byte[] ConvertStream(Stream data, string extraParams); | 23 | byte[] ConvertStream(Stream data, string extraParams); |
24 | bool AsyncConvertUrl(LLUUID id, string url, string extraParams); | 24 | bool AsyncConvertUrl(LLUUID id, string url, string extraParams); |
25 | bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); | 25 | bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); |
26 | } | 26 | } |
27 | } | 27 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs index 2294631..e974e25 100644 --- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs | |||
@@ -1,12 +1,12 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace OpenSim.Region.Environment.Interfaces |
7 | { | 7 | { |
8 | public interface IHttpRequests | 8 | public interface IHttpRequests |
9 | { | 9 | { |
10 | LLUUID MakeHttpRequest(string url, string type, string body); | 10 | LLUUID MakeHttpRequest(string url, string type, string body); |
11 | } | 11 | } |
12 | } | 12 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 11989fe..47f3d92 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -1,15 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Interfaces | 5 | namespace OpenSim.Region.Environment.Interfaces |
6 | { | 6 | { |
7 | public interface IRegionModule | 7 | public interface IRegionModule |
8 | { | 8 | { |
9 | void Initialise(Scenes.Scene scene); | 9 | void Initialise(Scenes.Scene scene); |
10 | void PostInitialise(); | 10 | void PostInitialise(); |
11 | void CloseDown(); | 11 | void CloseDown(); |
12 | string GetName(); | 12 | string GetName(); |
13 | bool IsSharedModule(); | 13 | bool IsSharedModule(); |
14 | } | 14 | } |
15 | } | 15 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs index 73ef476..f0adabc 100644 --- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -1,12 +1,12 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace OpenSim.Region.Environment.Interfaces |
7 | { | 7 | { |
8 | public interface ISimChat | 8 | public interface ISimChat |
9 | { | 9 | { |
10 | void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); | 10 | void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); |
11 | } | 11 | } |
12 | } | 12 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs index a07168e..576c5b4 100644 --- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs | |||
@@ -1,46 +1,46 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Framework.Interfaces; | 4 | using OpenSim.Framework.Interfaces; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Interfaces | 6 | namespace OpenSim.Region.Environment.Interfaces |
7 | { | 7 | { |
8 | public interface ITerrain | 8 | public interface ITerrain |
9 | { | 9 | { |
10 | bool Tainted(); | 10 | bool Tainted(); |
11 | bool Tainted(int x, int y); | 11 | bool Tainted(int x, int y); |
12 | void ResetTaint(); | 12 | void ResetTaint(); |
13 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser); | 13 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser); |
14 | void CheckHeightValues(); | 14 | void CheckHeightValues(); |
15 | float[] GetHeights1D(); | 15 | float[] GetHeights1D(); |
16 | float[,] GetHeights2D(); | 16 | float[,] GetHeights2D(); |
17 | double[,] GetHeights2DD(); | 17 | double[,] GetHeights2DD(); |
18 | void GetHeights1D(float[] heights); | 18 | void GetHeights1D(float[] heights); |
19 | void SetHeights2D(float[,] heights); | 19 | void SetHeights2D(float[,] heights); |
20 | void SetHeights2D(double[,] heights); | 20 | void SetHeights2D(double[,] heights); |
21 | void SwapRevertMaps(); | 21 | void SwapRevertMaps(); |
22 | void SaveRevertMap(); | 22 | void SaveRevertMap(); |
23 | bool RunTerrainCmd(string[] args, ref string resultText, string simName); | 23 | bool RunTerrainCmd(string[] args, ref string resultText, string simName); |
24 | void SetRange(float min, float max); | 24 | void SetRange(float min, float max); |
25 | void LoadFromFileF64(string filename); | 25 | void LoadFromFileF64(string filename); |
26 | void LoadFromFileF32(string filename); | 26 | void LoadFromFileF32(string filename); |
27 | void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); | 27 | void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); |
28 | void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); | 28 | void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); |
29 | void LoadFromFileSLRAW(string filename); | 29 | void LoadFromFileSLRAW(string filename); |
30 | void WriteToFileF64(string filename); | 30 | void WriteToFileF64(string filename); |
31 | void WriteToFileF32(string filename); | 31 | void WriteToFileF32(string filename); |
32 | void WriteToFileRAW(string filename); | 32 | void WriteToFileRAW(string filename); |
33 | void WriteToFileHiRAW(string filename); | 33 | void WriteToFileHiRAW(string filename); |
34 | void SetSeed(int val); | 34 | void SetSeed(int val); |
35 | void RaiseTerrain(double rx, double ry, double size, double amount); | 35 | void RaiseTerrain(double rx, double ry, double size, double amount); |
36 | void LowerTerrain(double rx, double ry, double size, double amount); | 36 | void LowerTerrain(double rx, double ry, double size, double amount); |
37 | void FlattenTerrain(double rx, double ry, double size, double amount); | 37 | void FlattenTerrain(double rx, double ry, double size, double amount); |
38 | void NoiseTerrain(double rx, double ry, double size, double amount); | 38 | void NoiseTerrain(double rx, double ry, double size, double amount); |
39 | void RevertTerrain(double rx, double ry, double size, double amount); | 39 | void RevertTerrain(double rx, double ry, double size, double amount); |
40 | void SmoothTerrain(double rx, double ry, double size, double amount); | 40 | void SmoothTerrain(double rx, double ry, double size, double amount); |
41 | void HillsGenerator(); | 41 | void HillsGenerator(); |
42 | double GetHeight(int x, int y); | 42 | double GetHeight(int x, int y); |
43 | void ExportImage(string filename, string gradientmap); | 43 | void ExportImage(string filename, string gradientmap); |
44 | byte[] ExportJpegImage(string gradientmap); | 44 | byte[] ExportJpegImage(string gradientmap); |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs index a19ba8d..7482ec0 100644 --- a/OpenSim/Region/Environment/Interfaces/IXfer.cs +++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs | |||
@@ -1,11 +1,11 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Interfaces | 5 | namespace OpenSim.Region.Environment.Interfaces |
6 | { | 6 | { |
7 | public interface IXfer | 7 | public interface IXfer |
8 | { | 8 | { |
9 | bool AddNewFile(string fileName, byte[] data); | 9 | bool AddNewFile(string fileName, byte[] data); |
10 | } | 10 | } |
11 | } | 11 | } |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index ea416cb..5e27f50 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -1,160 +1,160 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Reflection; | 3 | using System.Reflection; |
4 | using System.Text; | 4 | using System.Text; |
5 | using OpenSim.Framework.Console; | 5 | using OpenSim.Framework.Console; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | using OpenSim.Region.Environment.Modules; | 8 | using OpenSim.Region.Environment.Modules; |
9 | 9 | ||
10 | namespace OpenSim.Region.Environment | 10 | namespace OpenSim.Region.Environment |
11 | { | 11 | { |
12 | public class ModuleLoader | 12 | public class ModuleLoader |
13 | { | 13 | { |
14 | 14 | ||
15 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 15 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); |
16 | 16 | ||
17 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | 17 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); |
18 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | 18 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); |
19 | 19 | ||
20 | public ModuleLoader() | 20 | public ModuleLoader() |
21 | { | 21 | { |
22 | 22 | ||
23 | } | 23 | } |
24 | 24 | ||
25 | /// <summary> | 25 | /// <summary> |
26 | /// Should have a module factory? | 26 | /// Should have a module factory? |
27 | /// </summary> | 27 | /// </summary> |
28 | /// <param name="scene"></param> | 28 | /// <param name="scene"></param> |
29 | public void CreateDefaultModules(Scene scene, string exceptModules) | 29 | public void CreateDefaultModules(Scene scene, string exceptModules) |
30 | { | 30 | { |
31 | IRegionModule module = new XferModule(); | 31 | IRegionModule module = new XferModule(); |
32 | InitialiseModule(module, scene); | 32 | InitialiseModule(module, scene); |
33 | 33 | ||
34 | module = new ChatModule(); | 34 | module = new ChatModule(); |
35 | InitialiseModule(module, scene); | 35 | InitialiseModule(module, scene); |
36 | 36 | ||
37 | module = new AvatarProfilesModule(); | 37 | module = new AvatarProfilesModule(); |
38 | InitialiseModule(module, scene); | 38 | InitialiseModule(module, scene); |
39 | 39 | ||
40 | this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 40 | this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
41 | 41 | ||
42 | string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 42 | string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
43 | this.LoadRegionModule(lslPath, "LSLScriptingModule", scene); | 43 | this.LoadRegionModule(lslPath, "LSLScriptingModule", scene); |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | public void LoadDefaultSharedModules(string exceptModules) | 48 | public void LoadDefaultSharedModules(string exceptModules) |
49 | { | 49 | { |
50 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); | 50 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
51 | this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); | 51 | this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); |
52 | } | 52 | } |
53 | 53 | ||
54 | public void InitialiseSharedModules(Scene scene) | 54 | public void InitialiseSharedModules(Scene scene) |
55 | { | 55 | { |
56 | foreach (IRegionModule module in this.LoadedSharedModules.Values) | 56 | foreach (IRegionModule module in this.LoadedSharedModules.Values) |
57 | { | 57 | { |
58 | module.Initialise(scene); | 58 | module.Initialise(scene); |
59 | scene.AddModule(module.GetName(), module); //should be doing this? | 59 | scene.AddModule(module.GetName(), module); //should be doing this? |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | private void InitialiseModule(IRegionModule module, Scene scene) | 63 | private void InitialiseModule(IRegionModule module, Scene scene) |
64 | { | 64 | { |
65 | module.Initialise(scene); | 65 | module.Initialise(scene); |
66 | scene.AddModule(module.GetName(), module); | 66 | scene.AddModule(module.GetName(), module); |
67 | LoadedModules.Add(module); | 67 | LoadedModules.Add(module); |
68 | } | 68 | } |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Loads/initialises a Module instance that can be used by mutliple Regions | 71 | /// Loads/initialises a Module instance that can be used by mutliple Regions |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="dllName"></param> | 73 | /// <param name="dllName"></param> |
74 | /// <param name="moduleName"></param> | 74 | /// <param name="moduleName"></param> |
75 | /// <param name="scene"></param> | 75 | /// <param name="scene"></param> |
76 | public void LoadSharedModule(string dllName, string moduleName) | 76 | public void LoadSharedModule(string dllName, string moduleName) |
77 | { | 77 | { |
78 | IRegionModule module = this.LoadModule(dllName, moduleName); | 78 | IRegionModule module = this.LoadModule(dllName, moduleName); |
79 | if (module != null) | 79 | if (module != null) |
80 | { | 80 | { |
81 | this.LoadedSharedModules.Add(module.GetName(), module); | 81 | this.LoadedSharedModules.Add(module.GetName(), module); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 85 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
86 | { | 86 | { |
87 | IRegionModule module = this.LoadModule(dllName, moduleName); | 87 | IRegionModule module = this.LoadModule(dllName, moduleName); |
88 | if (module != null) | 88 | if (module != null) |
89 | { | 89 | { |
90 | this.InitialiseModule(module, scene); | 90 | this.InitialiseModule(module, scene); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
95 | /// Loads a external Module (if not already loaded) and creates a new instance of it. | 95 | /// Loads a external Module (if not already loaded) and creates a new instance of it. |
96 | /// </summary> | 96 | /// </summary> |
97 | /// <param name="dllName"></param> | 97 | /// <param name="dllName"></param> |
98 | /// <param name="moduleName"></param> | 98 | /// <param name="moduleName"></param> |
99 | /// <param name="scene"></param> | 99 | /// <param name="scene"></param> |
100 | public IRegionModule LoadModule(string dllName, string moduleName) | 100 | public IRegionModule LoadModule(string dllName, string moduleName) |
101 | { | 101 | { |
102 | Assembly pluginAssembly = null; | 102 | Assembly pluginAssembly = null; |
103 | if (LoadedAssemblys.ContainsKey(dllName)) | 103 | if (LoadedAssemblys.ContainsKey(dllName)) |
104 | { | 104 | { |
105 | pluginAssembly = LoadedAssemblys[dllName]; | 105 | pluginAssembly = LoadedAssemblys[dllName]; |
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
109 | pluginAssembly = Assembly.LoadFrom(dllName); | 109 | pluginAssembly = Assembly.LoadFrom(dllName); |
110 | this.LoadedAssemblys.Add(dllName, pluginAssembly); | 110 | this.LoadedAssemblys.Add(dllName, pluginAssembly); |
111 | } | 111 | } |
112 | 112 | ||
113 | IRegionModule module = null; | 113 | IRegionModule module = null; |
114 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 114 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
115 | { | 115 | { |
116 | if (pluginType.IsPublic) | 116 | if (pluginType.IsPublic) |
117 | { | 117 | { |
118 | if (!pluginType.IsAbstract) | 118 | if (!pluginType.IsAbstract) |
119 | { | 119 | { |
120 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); | 120 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); |
121 | 121 | ||
122 | if (typeInterface != null) | 122 | if (typeInterface != null) |
123 | { | 123 | { |
124 | module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 124 | module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | typeInterface = null; | 127 | typeInterface = null; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } | 130 | } |
131 | pluginAssembly = null; | 131 | pluginAssembly = null; |
132 | 132 | ||
133 | if ((module != null ) || (module.GetName() == moduleName)) | 133 | if ((module != null ) || (module.GetName() == moduleName)) |
134 | { | 134 | { |
135 | return module; | 135 | return module; |
136 | } | 136 | } |
137 | 137 | ||
138 | return null; | 138 | return null; |
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | public void PostInitialise() | 142 | public void PostInitialise() |
143 | { | 143 | { |
144 | foreach (IRegionModule module in this.LoadedSharedModules.Values) | 144 | foreach (IRegionModule module in this.LoadedSharedModules.Values) |
145 | { | 145 | { |
146 | module.PostInitialise(); | 146 | module.PostInitialise(); |
147 | } | 147 | } |
148 | 148 | ||
149 | foreach (IRegionModule module in this.LoadedModules) | 149 | foreach (IRegionModule module in this.LoadedModules) |
150 | { | 150 | { |
151 | module.PostInitialise(); | 151 | module.PostInitialise(); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | public void ClearCache() | 155 | public void ClearCache() |
156 | { | 156 | { |
157 | this.LoadedAssemblys.Clear(); | 157 | this.LoadedAssemblys.Clear(); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | } | 160 | } |
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index 21a7e61..7a53f6f 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -1,50 +1,50 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace OpenSim.Region.Environment.Modules |
11 | { | 11 | { |
12 | public class AssetDownloadModule : IRegionModule | 12 | public class AssetDownloadModule : IRegionModule |
13 | { | 13 | { |
14 | private Scene m_scene; | 14 | private Scene m_scene; |
15 | 15 | ||
16 | public AssetDownloadModule() | 16 | public AssetDownloadModule() |
17 | { | 17 | { |
18 | 18 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | public void Initialise(Scene scene) | 21 | public void Initialise(Scene scene) |
22 | { | 22 | { |
23 | m_scene = scene; | 23 | m_scene = scene; |
24 | m_scene.EventManager.OnNewClient += NewClient; | 24 | m_scene.EventManager.OnNewClient += NewClient; |
25 | } | 25 | } |
26 | 26 | ||
27 | public void PostInitialise() | 27 | public void PostInitialise() |
28 | { | 28 | { |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | public void CloseDown() | 32 | public void CloseDown() |
33 | { | 33 | { |
34 | } | 34 | } |
35 | 35 | ||
36 | public string GetName() | 36 | public string GetName() |
37 | { | 37 | { |
38 | return "AssetDownloadModule"; | 38 | return "AssetDownloadModule"; |
39 | } | 39 | } |
40 | 40 | ||
41 | public bool IsSharedModule() | 41 | public bool IsSharedModule() |
42 | { | 42 | { |
43 | return false; | 43 | return false; |
44 | } | 44 | } |
45 | 45 | ||
46 | public void NewClient(IClientAPI client) | 46 | public void NewClient(IClientAPI client) |
47 | { | 47 | { |
48 | } | 48 | } |
49 | } | 49 | } |
50 | } | 50 | } |
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index 1ad061a..c349888 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -1,71 +1,71 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class AvatarProfilesModule :IRegionModule | 11 | public class AvatarProfilesModule :IRegionModule |
12 | { | 12 | { |
13 | 13 | ||
14 | private Scene m_scene; | 14 | private Scene m_scene; |
15 | 15 | ||
16 | public AvatarProfilesModule() | 16 | public AvatarProfilesModule() |
17 | { | 17 | { |
18 | 18 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | public void Initialise(Scene scene) | 21 | public void Initialise(Scene scene) |
22 | { | 22 | { |
23 | m_scene = scene; | 23 | m_scene = scene; |
24 | m_scene.EventManager.OnNewClient += NewClient; | 24 | m_scene.EventManager.OnNewClient += NewClient; |
25 | } | 25 | } |
26 | 26 | ||
27 | public void PostInitialise() | 27 | public void PostInitialise() |
28 | { | 28 | { |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | public void CloseDown() | 32 | public void CloseDown() |
33 | { | 33 | { |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string GetName() |
38 | { | 38 | { |
39 | return "AvatarProfilesModule"; | 39 | return "AvatarProfilesModule"; |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | 42 | public bool IsSharedModule() |
43 | { | 43 | { |
44 | return false; | 44 | return false; |
45 | } | 45 | } |
46 | 46 | ||
47 | public void NewClient(IClientAPI client) | 47 | public void NewClient(IClientAPI client) |
48 | { | 48 | { |
49 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 49 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
50 | } | 50 | } |
51 | 51 | ||
52 | public void RemoveClient(IClientAPI client) | 52 | public void RemoveClient(IClientAPI client) |
53 | { | 53 | { |
54 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | 54 | client.OnRequestAvatarProperties -= RequestAvatarProperty; |
55 | } | 55 | } |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
58 | /// | 58 | /// |
59 | /// </summary> | 59 | /// </summary> |
60 | /// <param name="remoteClient"></param> | 60 | /// <param name="remoteClient"></param> |
61 | /// <param name="avatarID"></param> | 61 | /// <param name="avatarID"></param> |
62 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) | 62 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) |
63 | { | 63 | { |
64 | string about = "OpenSim crash test dummy"; | 64 | string about = "OpenSim crash test dummy"; |
65 | string bornOn = "Before now"; | 65 | string bornOn = "Before now"; |
66 | string flAbout = "First life? What is one of those? OpenSim is my life!"; | 66 | string flAbout = "First life? What is one of those? OpenSim is my life!"; |
67 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 67 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
68 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); | 68 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index a46343b..8d3a553 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -1,216 +1,216 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Net; | 4 | using System.Net; |
5 | using System.Net.Sockets; | 5 | using System.Net.Sockets; |
6 | using System.Threading; | 6 | using System.Threading; |
7 | using System.IO; | 7 | using System.IO; |
8 | using libsecondlife; | 8 | using libsecondlife; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Environment.Interfaces; | 10 | using OpenSim.Region.Environment.Interfaces; |
11 | using OpenSim.Framework.Interfaces; | 11 | using OpenSim.Framework.Interfaces; |
12 | using OpenSim.Framework.Utilities; | 12 | using OpenSim.Framework.Utilities; |
13 | using OpenSim.Framework.Console; | 13 | using OpenSim.Framework.Console; |
14 | 14 | ||
15 | namespace OpenSim.Region.Environment.Modules | 15 | namespace OpenSim.Region.Environment.Modules |
16 | { | 16 | { |
17 | public class ChatModule : IRegionModule, ISimChat | 17 | public class ChatModule : IRegionModule, ISimChat |
18 | { | 18 | { |
19 | private Scene m_scene; | 19 | private Scene m_scene; |
20 | 20 | ||
21 | private string m_server = "irc2.choopa.net"; | 21 | private string m_server = "irc2.choopa.net"; |
22 | 22 | ||
23 | // private int m_port = 6668; | 23 | // private int m_port = 6668; |
24 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 24 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
25 | private string m_nick = "OSimBot"; | 25 | private string m_nick = "OSimBot"; |
26 | private string m_channel = "#opensim"; | 26 | private string m_channel = "#opensim"; |
27 | 27 | ||
28 | // private NetworkStream m_stream; | 28 | // private NetworkStream m_stream; |
29 | private TcpClient m_irc; | 29 | private TcpClient m_irc; |
30 | private StreamWriter m_ircWriter; | 30 | private StreamWriter m_ircWriter; |
31 | private StreamReader m_ircReader; | 31 | private StreamReader m_ircReader; |
32 | 32 | ||
33 | // private Thread pingSender; | 33 | // private Thread pingSender; |
34 | // private Thread listener; | 34 | // private Thread listener; |
35 | 35 | ||
36 | private bool connected = false; | 36 | private bool connected = false; |
37 | 37 | ||
38 | public ChatModule() | 38 | public ChatModule() |
39 | { | 39 | { |
40 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 40 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
41 | m_irc = null; | 41 | m_irc = null; |
42 | m_ircWriter = null; | 42 | m_ircWriter = null; |
43 | m_ircReader = null; | 43 | m_ircReader = null; |
44 | } | 44 | } |
45 | 45 | ||
46 | public void Initialise(Scene scene) | 46 | public void Initialise(Scene scene) |
47 | { | 47 | { |
48 | m_scene = scene; | 48 | m_scene = scene; |
49 | m_scene.EventManager.OnNewClient += NewClient; | 49 | m_scene.EventManager.OnNewClient += NewClient; |
50 | 50 | ||
51 | m_scene.RegisterModuleInterface<ISimChat>(this); | 51 | m_scene.RegisterModuleInterface<ISimChat>(this); |
52 | } | 52 | } |
53 | 53 | ||
54 | public void PostInitialise() | 54 | public void PostInitialise() |
55 | { | 55 | { |
56 | /* | 56 | /* |
57 | try | 57 | try |
58 | { | 58 | { |
59 | m_irc = new TcpClient(m_server, m_port); | 59 | m_irc = new TcpClient(m_server, m_port); |
60 | m_stream = m_irc.GetStream(); | 60 | m_stream = m_irc.GetStream(); |
61 | m_ircReader = new StreamReader(m_stream); | 61 | m_ircReader = new StreamReader(m_stream); |
62 | m_ircWriter = new StreamWriter(m_stream); | 62 | m_ircWriter = new StreamWriter(m_stream); |
63 | 63 | ||
64 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 64 | pingSender = new Thread(new ThreadStart(this.PingRun)); |
65 | pingSender.Start(); | 65 | pingSender.Start(); |
66 | 66 | ||
67 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 67 | listener = new Thread(new ThreadStart(this.ListenerRun)); |
68 | listener.Start(); | 68 | listener.Start(); |
69 | 69 | ||
70 | m_ircWriter.WriteLine(m_user); | 70 | m_ircWriter.WriteLine(m_user); |
71 | m_ircWriter.Flush(); | 71 | m_ircWriter.Flush(); |
72 | m_ircWriter.WriteLine("NICK " + m_nick); | 72 | m_ircWriter.WriteLine("NICK " + m_nick); |
73 | m_ircWriter.Flush(); | 73 | m_ircWriter.Flush(); |
74 | m_ircWriter.WriteLine("JOIN " + m_channel); | 74 | m_ircWriter.WriteLine("JOIN " + m_channel); |
75 | m_ircWriter.Flush(); | 75 | m_ircWriter.Flush(); |
76 | connected = true; | 76 | connected = true; |
77 | } | 77 | } |
78 | catch (Exception e) | 78 | catch (Exception e) |
79 | { | 79 | { |
80 | Console.WriteLine(e.ToString()); | 80 | Console.WriteLine(e.ToString()); |
81 | } | 81 | } |
82 | */ | 82 | */ |
83 | } | 83 | } |
84 | 84 | ||
85 | public void CloseDown() | 85 | public void CloseDown() |
86 | { | 86 | { |
87 | m_ircWriter.Close(); | 87 | m_ircWriter.Close(); |
88 | m_ircReader.Close(); | 88 | m_ircReader.Close(); |
89 | m_irc.Close(); | 89 | m_irc.Close(); |
90 | } | 90 | } |
91 | 91 | ||
92 | public string GetName() | 92 | public string GetName() |
93 | { | 93 | { |
94 | return "ChatModule"; | 94 | return "ChatModule"; |
95 | } | 95 | } |
96 | 96 | ||
97 | public bool IsSharedModule() | 97 | public bool IsSharedModule() |
98 | { | 98 | { |
99 | return false; | 99 | return false; |
100 | } | 100 | } |
101 | 101 | ||
102 | public void NewClient(IClientAPI client) | 102 | public void NewClient(IClientAPI client) |
103 | { | 103 | { |
104 | client.OnChatFromViewer += SimChat; | 104 | client.OnChatFromViewer += SimChat; |
105 | } | 105 | } |
106 | 106 | ||
107 | public void PingRun() | 107 | public void PingRun() |
108 | { | 108 | { |
109 | while (true) | 109 | while (true) |
110 | { | 110 | { |
111 | m_ircWriter.WriteLine("PING :" + m_server); | 111 | m_ircWriter.WriteLine("PING :" + m_server); |
112 | m_ircWriter.Flush(); | 112 | m_ircWriter.Flush(); |
113 | Thread.Sleep(15000); | 113 | Thread.Sleep(15000); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | public void ListenerRun() | 117 | public void ListenerRun() |
118 | { | 118 | { |
119 | string inputLine; | 119 | string inputLine; |
120 | LLVector3 pos = new LLVector3(128, 128, 20); | 120 | LLVector3 pos = new LLVector3(128, 128, 20); |
121 | while (true) | 121 | while (true) |
122 | { | 122 | { |
123 | while ((inputLine = m_ircReader.ReadLine()) != null) | 123 | while ((inputLine = m_ircReader.ReadLine()) != null) |
124 | { | 124 | { |
125 | Console.WriteLine(inputLine); | 125 | Console.WriteLine(inputLine); |
126 | if (inputLine.Contains(m_channel)) | 126 | if (inputLine.Contains(m_channel)) |
127 | { | 127 | { |
128 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); | 128 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); |
129 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 129 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
130 | { | 130 | { |
131 | presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", | 131 | presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", |
132 | LLUUID.Zero); | 132 | LLUUID.Zero); |
133 | }); | 133 | }); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 139 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
140 | { | 140 | { |
141 | ScenePresence avatar = null; | 141 | ScenePresence avatar = null; |
142 | avatar = m_scene.RequestAvatar(fromAgentID); | 142 | avatar = m_scene.RequestAvatar(fromAgentID); |
143 | if (avatar != null) | 143 | if (avatar != null) |
144 | { | 144 | { |
145 | fromPos = avatar.AbsolutePosition; | 145 | fromPos = avatar.AbsolutePosition; |
146 | fromName = avatar.Firstname + " " + avatar.Lastname; | 146 | fromName = avatar.Firstname + " " + avatar.Lastname; |
147 | avatar = null; | 147 | avatar = null; |
148 | } | 148 | } |
149 | 149 | ||
150 | if (connected) | 150 | if (connected) |
151 | { | 151 | { |
152 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + | 152 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + |
153 | Util.FieldToString(message)); | 153 | Util.FieldToString(message)); |
154 | m_ircWriter.Flush(); | 154 | m_ircWriter.Flush(); |
155 | } | 155 | } |
156 | 156 | ||
157 | if (channel == 0) | 157 | if (channel == 0) |
158 | { | 158 | { |
159 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 159 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
160 | { | 160 | { |
161 | int dis = -1000; | 161 | int dis = -1000; |
162 | 162 | ||
163 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 163 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it |
164 | avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); | 164 | avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId); |
165 | if (avatar != null) | 165 | if (avatar != null) |
166 | { | 166 | { |
167 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | 167 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); |
168 | } | 168 | } |
169 | 169 | ||
170 | switch (type) | 170 | switch (type) |
171 | { | 171 | { |
172 | case 0: // Whisper | 172 | case 0: // Whisper |
173 | if ((dis < 10) && (dis > -10)) | 173 | if ((dis < 10) && (dis > -10)) |
174 | { | 174 | { |
175 | //should change so the message is sent through the avatar rather than direct to the ClientView | 175 | //should change so the message is sent through the avatar rather than direct to the ClientView |
176 | presence.ControllingClient.SendChatMessage(message, | 176 | presence.ControllingClient.SendChatMessage(message, |
177 | type, | 177 | type, |
178 | fromPos, | 178 | fromPos, |
179 | fromName, | 179 | fromName, |
180 | fromAgentID); | 180 | fromAgentID); |
181 | } | 181 | } |
182 | break; | 182 | break; |
183 | case 1: // Say | 183 | case 1: // Say |
184 | if ((dis < 30) && (dis > -30)) | 184 | if ((dis < 30) && (dis > -30)) |
185 | { | 185 | { |
186 | //Console.WriteLine("sending chat"); | 186 | //Console.WriteLine("sending chat"); |
187 | presence.ControllingClient.SendChatMessage(message, | 187 | presence.ControllingClient.SendChatMessage(message, |
188 | type, | 188 | type, |
189 | fromPos, | 189 | fromPos, |
190 | fromName, | 190 | fromName, |
191 | fromAgentID); | 191 | fromAgentID); |
192 | } | 192 | } |
193 | break; | 193 | break; |
194 | case 2: // Shout | 194 | case 2: // Shout |
195 | if ((dis < 100) && (dis > -100)) | 195 | if ((dis < 100) && (dis > -100)) |
196 | { | 196 | { |
197 | presence.ControllingClient.SendChatMessage(message, | 197 | presence.ControllingClient.SendChatMessage(message, |
198 | type, | 198 | type, |
199 | fromPos, | 199 | fromPos, |
200 | fromName, | 200 | fromName, |
201 | fromAgentID); | 201 | fromAgentID); |
202 | } | 202 | } |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case 0xff: // Broadcast | 205 | case 0xff: // Broadcast |
206 | presence.ControllingClient.SendChatMessage(message, type, | 206 | presence.ControllingClient.SendChatMessage(message, type, |
207 | fromPos, | 207 | fromPos, |
208 | fromName, | 208 | fromName, |
209 | fromAgentID); | 209 | fromAgentID); |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | }); | 212 | }); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 8223919..bbd9810 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -1,159 +1,159 @@ | |||
1 | using System.Text; | 1 | using System.Text; |
2 | using System.Net; | 2 | using System.Net; |
3 | using System.Net.Sockets; | 3 | using System.Net.Sockets; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | using OpenSim.Region.Environment.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
9 | using OpenSim.Region.Environment.Interfaces; | 9 | using OpenSim.Region.Environment.Interfaces; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Utilities; | 11 | using OpenSim.Framework.Utilities; |
12 | using OpenSim.Framework.Console; | 12 | using OpenSim.Framework.Console; |
13 | using OpenSim.Framework.Types; | 13 | using OpenSim.Framework.Types; |
14 | 14 | ||
15 | namespace OpenSim.Region.Environment.Modules | 15 | namespace OpenSim.Region.Environment.Modules |
16 | { | 16 | { |
17 | public class DynamicTextureModule :IRegionModule, IDynamicTextureManager | 17 | public class DynamicTextureModule :IRegionModule, IDynamicTextureManager |
18 | { | 18 | { |
19 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 19 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
20 | private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); | 20 | private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); |
21 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 21 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
22 | 22 | ||
23 | public void Initialise(Scene scene) | 23 | public void Initialise(Scene scene) |
24 | { | 24 | { |
25 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) | 25 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) |
26 | { | 26 | { |
27 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); | 27 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); |
28 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | 28 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | public void PostInitialise() | 32 | public void PostInitialise() |
33 | { | 33 | { |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | public void CloseDown() | 37 | public void CloseDown() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | public string GetName() | 41 | public string GetName() |
42 | { | 42 | { |
43 | return "DynamicTextureModule"; | 43 | return "DynamicTextureModule"; |
44 | } | 44 | } |
45 | 45 | ||
46 | public bool IsSharedModule() | 46 | public bool IsSharedModule() |
47 | { | 47 | { |
48 | return true; | 48 | return true; |
49 | } | 49 | } |
50 | 50 | ||
51 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 51 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
52 | { | 52 | { |
53 | if (!RenderPlugins.ContainsKey(handleType)) | 53 | if (!RenderPlugins.ContainsKey(handleType)) |
54 | { | 54 | { |
55 | RenderPlugins.Add(handleType, render); | 55 | RenderPlugins.Add(handleType, render); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | public void ReturnData(LLUUID id, byte[] data) | 59 | public void ReturnData(LLUUID id, byte[] data) |
60 | { | 60 | { |
61 | if (Updaters.ContainsKey(id)) | 61 | if (Updaters.ContainsKey(id)) |
62 | { | 62 | { |
63 | DynamicTextureUpdater updater = Updaters[id]; | 63 | DynamicTextureUpdater updater = Updaters[id]; |
64 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 64 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
65 | { | 65 | { |
66 | Scene scene = RegisteredScenes[updater.SimUUID]; | 66 | Scene scene = RegisteredScenes[updater.SimUUID]; |
67 | updater.DataReceived(data, scene); | 67 | updater.DataReceived(data, scene); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) | 72 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) |
73 | { | 73 | { |
74 | System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 74 | System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
75 | if (this.RenderPlugins.ContainsKey(contentType)) | 75 | if (this.RenderPlugins.ContainsKey(contentType)) |
76 | { | 76 | { |
77 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 77 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
78 | updater.SimUUID = simID; | 78 | updater.SimUUID = simID; |
79 | updater.PrimID = primID; | 79 | updater.PrimID = primID; |
80 | updater.ContentType = contentType; | 80 | updater.ContentType = contentType; |
81 | updater.Url = url; | 81 | updater.Url = url; |
82 | updater.UpdateTimer = updateTimer; | 82 | updater.UpdateTimer = updateTimer; |
83 | updater.UpdaterID = LLUUID.Random(); | 83 | updater.UpdaterID = LLUUID.Random(); |
84 | updater.Params = extraParams; | 84 | updater.Params = extraParams; |
85 | 85 | ||
86 | if (!this.Updaters.ContainsKey(updater.UpdaterID)) | 86 | if (!this.Updaters.ContainsKey(updater.UpdaterID)) |
87 | { | 87 | { |
88 | Updaters.Add(updater.UpdaterID, updater); | 88 | Updaters.Add(updater.UpdaterID, updater); |
89 | } | 89 | } |
90 | 90 | ||
91 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 91 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
92 | return updater.UpdaterID; | 92 | return updater.UpdaterID; |
93 | } | 93 | } |
94 | return LLUUID.Zero; | 94 | return LLUUID.Zero; |
95 | } | 95 | } |
96 | 96 | ||
97 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) | 97 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) |
98 | { | 98 | { |
99 | if (this.RenderPlugins.ContainsKey(contentType)) | 99 | if (this.RenderPlugins.ContainsKey(contentType)) |
100 | { | 100 | { |
101 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 101 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
102 | updater.SimUUID = simID; | 102 | updater.SimUUID = simID; |
103 | updater.PrimID = primID; | 103 | updater.PrimID = primID; |
104 | updater.ContentType = contentType; | 104 | updater.ContentType = contentType; |
105 | updater.BodyData = data; | 105 | updater.BodyData = data; |
106 | updater.UpdateTimer = updateTimer; | 106 | updater.UpdateTimer = updateTimer; |
107 | updater.UpdaterID = LLUUID.Random(); | 107 | updater.UpdaterID = LLUUID.Random(); |
108 | updater.Params = extraParams; | 108 | updater.Params = extraParams; |
109 | 109 | ||
110 | if (!this.Updaters.ContainsKey(updater.UpdaterID)) | 110 | if (!this.Updaters.ContainsKey(updater.UpdaterID)) |
111 | { | 111 | { |
112 | Updaters.Add(updater.UpdaterID, updater); | 112 | Updaters.Add(updater.UpdaterID, updater); |
113 | } | 113 | } |
114 | 114 | ||
115 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 115 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
116 | return updater.UpdaterID; | 116 | return updater.UpdaterID; |
117 | } | 117 | } |
118 | return LLUUID.Zero; | 118 | return LLUUID.Zero; |
119 | } | 119 | } |
120 | 120 | ||
121 | public class DynamicTextureUpdater | 121 | public class DynamicTextureUpdater |
122 | { | 122 | { |
123 | public LLUUID SimUUID; | 123 | public LLUUID SimUUID; |
124 | public LLUUID UpdaterID; | 124 | public LLUUID UpdaterID; |
125 | public string ContentType; | 125 | public string ContentType; |
126 | public string Url; | 126 | public string Url; |
127 | public string BodyData; | 127 | public string BodyData; |
128 | public LLUUID PrimID; | 128 | public LLUUID PrimID; |
129 | public int UpdateTimer; | 129 | public int UpdateTimer; |
130 | public LLUUID LastAssetID; | 130 | public LLUUID LastAssetID; |
131 | public string Params; | 131 | public string Params; |
132 | 132 | ||
133 | public DynamicTextureUpdater() | 133 | public DynamicTextureUpdater() |
134 | { | 134 | { |
135 | LastAssetID = LLUUID.Zero; | 135 | LastAssetID = LLUUID.Zero; |
136 | UpdateTimer = 0; | 136 | UpdateTimer = 0; |
137 | BodyData = null; | 137 | BodyData = null; |
138 | } | 138 | } |
139 | 139 | ||
140 | public void DataReceived(byte[] data, Scene scene) | 140 | public void DataReceived(byte[] data, Scene scene) |
141 | { | 141 | { |
142 | //TODO delete the last asset(data), if it was a dynamic texture | 142 | //TODO delete the last asset(data), if it was a dynamic texture |
143 | 143 | ||
144 | AssetBase asset = new AssetBase(); | 144 | AssetBase asset = new AssetBase(); |
145 | asset.FullID = LLUUID.Random(); | 145 | asset.FullID = LLUUID.Random(); |
146 | asset.Data = data; | 146 | asset.Data = data; |
147 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | 147 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); |
148 | asset.Type = 0; | 148 | asset.Type = 0; |
149 | scene.commsManager.AssetCache.AddAsset(asset); | 149 | scene.commsManager.AssetCache.AddAsset(asset); |
150 | 150 | ||
151 | this.LastAssetID = asset.FullID; | 151 | this.LastAssetID = asset.FullID; |
152 | 152 | ||
153 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 153 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); |
154 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); | 154 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); |
155 | part.ScheduleFullUpdate(); | 155 | part.ScheduleFullUpdate(); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } | 158 | } |
159 | } | 159 | } |
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs index 2a90dd3..fff9539 100644 --- a/OpenSim/Region/Environment/Modules/EmailModule.cs +++ b/OpenSim/Region/Environment/Modules/EmailModule.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | class EmailModule | 7 | class EmailModule |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index d46039c..411b838 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace OpenSim.Region.Environment.Modules |
11 | { | 11 | { |
12 | public class FriendsModule : IRegionModule | 12 | public class FriendsModule : IRegionModule |
13 | { | 13 | { |
14 | private Scene m_scene; | 14 | private Scene m_scene; |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
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() |
31 | { | 31 | { |
32 | return "FriendsModule"; | 32 | return "FriendsModule"; |
33 | } | 33 | } |
34 | 34 | ||
35 | public bool IsSharedModule() | 35 | public bool IsSharedModule() |
36 | { | 36 | { |
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index 8e4b409..9ed0e96 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class GroupsModule : IRegionModule | 11 | public class GroupsModule : IRegionModule |
12 | { | 12 | { |
13 | private Scene m_scene; | 13 | private Scene m_scene; |
14 | 14 | ||
15 | public void Initialise(Scene scene) | 15 | public void Initialise(Scene scene) |
16 | { | 16 | { |
17 | m_scene = scene; | 17 | m_scene = scene; |
18 | } | 18 | } |
19 | 19 | ||
20 | public void PostInitialise() | 20 | public void PostInitialise() |
21 | { | 21 | { |
22 | 22 | ||
23 | } | 23 | } |
24 | 24 | ||
25 | public void CloseDown() | 25 | public void CloseDown() |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | public string GetName() | 29 | public string GetName() |
30 | { | 30 | { |
31 | return "GroupsModule"; | 31 | return "GroupsModule"; |
32 | } | 32 | } |
33 | 33 | ||
34 | public bool IsSharedModule() | 34 | public bool IsSharedModule() |
35 | { | 35 | { |
36 | return false; | 36 | return false; |
37 | } | 37 | } |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index acf031b..25c118a 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace OpenSim.Region.Environment.Modules |
11 | { | 11 | { |
12 | public class InstantMessageModule :IRegionModule | 12 | public class InstantMessageModule :IRegionModule |
13 | { | 13 | { |
14 | private Scene m_scene; | 14 | private Scene m_scene; |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
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() |
31 | { | 31 | { |
32 | return "InstantMessageModule"; | 32 | return "InstantMessageModule"; |
33 | } | 33 | } |
34 | 34 | ||
35 | public bool IsSharedModule() | 35 | public bool IsSharedModule() |
36 | { | 36 | { |
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 00b4d8e..bfcb7d7 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | 9 | ||
10 | namespace OpenSim.Region.Environment.Modules | 10 | namespace OpenSim.Region.Environment.Modules |
11 | { | 11 | { |
12 | public class InventoryModule :IRegionModule | 12 | public class InventoryModule :IRegionModule |
13 | { | 13 | { |
14 | private Scene m_scene; | 14 | private Scene m_scene; |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
17 | { | 17 | { |
18 | m_scene = scene; | 18 | m_scene = scene; |
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
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() |
31 | { | 31 | { |
32 | return "InventoryModule"; | 32 | return "InventoryModule"; |
33 | } | 33 | } |
34 | 34 | ||
35 | public bool IsSharedModule() | 35 | public bool IsSharedModule() |
36 | { | 36 | { |
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs index 11af718..e47cc9e 100644 --- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | class ScriptsHttpRequests | 7 | class ScriptsHttpRequests |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs index 08fc202..1c01b27 100644 --- a/OpenSim/Region/Environment/Modules/TeleportModule.cs +++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | class TeleportModule | 7 | class TeleportModule |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 7d31644..59c0839 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -1,54 +1,54 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class TextureDownloadModule :IRegionModule | 11 | public class TextureDownloadModule :IRegionModule |
12 | { | 12 | { |
13 | private Scene m_scene; | 13 | private Scene m_scene; |
14 | 14 | ||
15 | public TextureDownloadModule() | 15 | public TextureDownloadModule() |
16 | { | 16 | { |
17 | 17 | ||
18 | } | 18 | } |
19 | 19 | ||
20 | public void Initialise(Scene scene) | 20 | public void Initialise(Scene scene) |
21 | { | 21 | { |
22 | m_scene = scene; | 22 | m_scene = scene; |
23 | m_scene.EventManager.OnNewClient += NewClient; | 23 | m_scene.EventManager.OnNewClient += NewClient; |
24 | } | 24 | } |
25 | 25 | ||
26 | public void PostInitialise() | 26 | public void PostInitialise() |
27 | { | 27 | { |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | public void CloseDown() | 31 | public void CloseDown() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | public string GetName() | 35 | public string GetName() |
36 | { | 36 | { |
37 | return "TextureDownloadModule"; | 37 | return "TextureDownloadModule"; |
38 | } | 38 | } |
39 | 39 | ||
40 | public bool IsSharedModule() | 40 | public bool IsSharedModule() |
41 | { | 41 | { |
42 | return false; | 42 | return false; |
43 | } | 43 | } |
44 | 44 | ||
45 | public void NewClient(IClientAPI client) | 45 | public void NewClient(IClientAPI client) |
46 | { | 46 | { |
47 | } | 47 | } |
48 | 48 | ||
49 | public void TextureAssetCallback(LLUUID texture, byte[] data) | 49 | public void TextureAssetCallback(LLUUID texture, byte[] data) |
50 | { | 50 | { |
51 | 51 | ||
52 | } | 52 | } |
53 | } | 53 | } |
54 | } | 54 | } |
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index 44b4d7a..216d10a 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -1,180 +1,180 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
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.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
9 | using OpenSim.Region.Environment.Interfaces; | 9 | using OpenSim.Region.Environment.Interfaces; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
12 | { | 12 | { |
13 | public class XferModule : IRegionModule, IXfer | 13 | public class XferModule : IRegionModule, IXfer |
14 | { | 14 | { |
15 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 15 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
16 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 16 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
17 | 17 | ||
18 | private Scene m_scene; | 18 | private Scene m_scene; |
19 | 19 | ||
20 | public XferModule() | 20 | public XferModule() |
21 | { | 21 | { |
22 | 22 | ||
23 | } | 23 | } |
24 | 24 | ||
25 | public void Initialise(Scene scene) | 25 | public void Initialise(Scene scene) |
26 | { | 26 | { |
27 | m_scene = scene; | 27 | m_scene = scene; |
28 | m_scene.EventManager.OnNewClient += NewClient; | 28 | m_scene.EventManager.OnNewClient += NewClient; |
29 | 29 | ||
30 | m_scene.RegisterModuleInterface<IXfer>(this); | 30 | m_scene.RegisterModuleInterface<IXfer>(this); |
31 | } | 31 | } |
32 | 32 | ||
33 | public void PostInitialise() | 33 | public void PostInitialise() |
34 | { | 34 | { |
35 | 35 | ||
36 | } | 36 | } |
37 | 37 | ||
38 | public void CloseDown() | 38 | public void CloseDown() |
39 | { | 39 | { |
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | public string GetName() | 43 | public string GetName() |
44 | { | 44 | { |
45 | return "XferModule"; | 45 | return "XferModule"; |
46 | } | 46 | } |
47 | 47 | ||
48 | public bool IsSharedModule() | 48 | public bool IsSharedModule() |
49 | { | 49 | { |
50 | return false; | 50 | return false; |
51 | } | 51 | } |
52 | 52 | ||
53 | public void NewClient(IClientAPI client) | 53 | public void NewClient(IClientAPI client) |
54 | { | 54 | { |
55 | client.OnRequestXfer += RequestXfer; | 55 | client.OnRequestXfer += RequestXfer; |
56 | client.OnConfirmXfer += AckPacket; | 56 | client.OnConfirmXfer += AckPacket; |
57 | } | 57 | } |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// | 60 | /// |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <param name="remoteClient"></param> | 62 | /// <param name="remoteClient"></param> |
63 | /// <param name="xferID"></param> | 63 | /// <param name="xferID"></param> |
64 | /// <param name="fileName"></param> | 64 | /// <param name="fileName"></param> |
65 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) | 65 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) |
66 | { | 66 | { |
67 | lock (NewFiles) | 67 | lock (NewFiles) |
68 | { | 68 | { |
69 | if (NewFiles.ContainsKey(fileName)) | 69 | if (NewFiles.ContainsKey(fileName)) |
70 | { | 70 | { |
71 | if (!Transfers.ContainsKey(xferID)) | 71 | if (!Transfers.ContainsKey(xferID)) |
72 | { | 72 | { |
73 | byte[] fileData = NewFiles[fileName]; | 73 | byte[] fileData = NewFiles[fileName]; |
74 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 74 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
75 | Transfers.Add(xferID, transaction); | 75 | Transfers.Add(xferID, transaction); |
76 | NewFiles.Remove(fileName); | 76 | NewFiles.Remove(fileName); |
77 | transaction.StartSend(); | 77 | transaction.StartSend(); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) | 83 | public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) |
84 | { | 84 | { |
85 | if (this.Transfers.ContainsKey(xferID)) | 85 | if (this.Transfers.ContainsKey(xferID)) |
86 | { | 86 | { |
87 | Transfers[xferID].AckPacket(packet); | 87 | Transfers[xferID].AckPacket(packet); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | public bool AddNewFile(string fileName, byte[] data) | 91 | public bool AddNewFile(string fileName, byte[] data) |
92 | { | 92 | { |
93 | lock (NewFiles) | 93 | lock (NewFiles) |
94 | { | 94 | { |
95 | if (NewFiles.ContainsKey(fileName)) | 95 | if (NewFiles.ContainsKey(fileName)) |
96 | { | 96 | { |
97 | NewFiles[fileName] = data; | 97 | NewFiles[fileName] = data; |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | NewFiles.Add(fileName, data); | 101 | NewFiles.Add(fileName, data); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | return true; | 104 | return true; |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | public class XferDownLoad | 108 | public class XferDownLoad |
109 | { | 109 | { |
110 | public byte[] Data = new byte[0]; | 110 | public byte[] Data = new byte[0]; |
111 | public string FileName = ""; | 111 | public string FileName = ""; |
112 | public ulong XferID = 0; | 112 | public ulong XferID = 0; |
113 | public int DataPointer = 0; | 113 | public int DataPointer = 0; |
114 | public uint Packet = 0; | 114 | public uint Packet = 0; |
115 | public IClientAPI Client; | 115 | public IClientAPI Client; |
116 | public uint Serial = 1; | 116 | public uint Serial = 1; |
117 | private bool complete = false; | 117 | private bool complete = false; |
118 | 118 | ||
119 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) | 119 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) |
120 | { | 120 | { |
121 | FileName = fileName; | 121 | FileName = fileName; |
122 | Data = data; | 122 | Data = data; |
123 | XferID = xferID; | 123 | XferID = xferID; |
124 | Client = client; | 124 | Client = client; |
125 | } | 125 | } |
126 | 126 | ||
127 | public XferDownLoad() | 127 | public XferDownLoad() |
128 | { | 128 | { |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | public void StartSend() | 132 | public void StartSend() |
133 | { | 133 | { |
134 | if (Data.Length < 1000) | 134 | if (Data.Length < 1000) |
135 | { | 135 | { |
136 | // for now (testing ) we only support files under 1000 bytes | 136 | // for now (testing ) we only support files under 1000 bytes |
137 | byte[] transferData = new byte[Data.Length + 4]; | 137 | byte[] transferData = new byte[Data.Length + 4]; |
138 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); | 138 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); |
139 | Array.Copy(Data, 0, transferData, 4, Data.Length); | 139 | Array.Copy(Data, 0, transferData, 4, Data.Length); |
140 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); | 140 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); |
141 | complete = true; | 141 | complete = true; |
142 | } | 142 | } |
143 | else | 143 | else |
144 | { | 144 | { |
145 | byte[] transferData = new byte[1000 +4]; | 145 | byte[] transferData = new byte[1000 +4]; |
146 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); | 146 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); |
147 | Array.Copy(Data, 0, transferData, 4, 1000); | 147 | Array.Copy(Data, 0, transferData, 4, 1000); |
148 | Client.SendXferPacket(XferID, 0 , transferData); | 148 | Client.SendXferPacket(XferID, 0 , transferData); |
149 | Packet++; | 149 | Packet++; |
150 | DataPointer = 1000; | 150 | DataPointer = 1000; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | public void AckPacket(uint packet) | 154 | public void AckPacket(uint packet) |
155 | { | 155 | { |
156 | if (!complete) | 156 | if (!complete) |
157 | { | 157 | { |
158 | if ((Data.Length - DataPointer) > 1000) | 158 | if ((Data.Length - DataPointer) > 1000) |
159 | { | 159 | { |
160 | byte[] transferData = new byte[1000]; | 160 | byte[] transferData = new byte[1000]; |
161 | Array.Copy(Data, DataPointer, transferData, 0, 1000); | 161 | Array.Copy(Data, DataPointer, transferData, 0, 1000); |
162 | Client.SendXferPacket(XferID, Packet, transferData); | 162 | Client.SendXferPacket(XferID, Packet, transferData); |
163 | Packet++; | 163 | Packet++; |
164 | DataPointer += 1000; | 164 | DataPointer += 1000; |
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | byte[] transferData = new byte[Data.Length - DataPointer]; | 168 | byte[] transferData = new byte[Data.Length - DataPointer]; |
169 | Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); | 169 | Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); |
170 | uint endPacket = Packet |= (uint)0x80000000; | 170 | uint endPacket = Packet |= (uint)0x80000000; |
171 | Client.SendXferPacket(XferID, endPacket, transferData); | 171 | Client.SendXferPacket(XferID, endPacket, transferData); |
172 | Packet++; | 172 | Packet++; |
173 | DataPointer += (Data.Length - DataPointer); | 173 | DataPointer += (Data.Length - DataPointer); |
174 | complete = true; | 174 | complete = true; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | } | 178 | } |
179 | } | 179 | } |
180 | } | 180 | } |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 110a130..cb455f4 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -1,305 +1,305 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Framework.Types; | 3 | using OpenSim.Framework.Types; |
4 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
5 | using OpenSim.Framework.Servers; | 5 | using OpenSim.Framework.Servers; |
6 | using OpenSim.Region.Capabilities; | 6 | using OpenSim.Region.Capabilities; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | using OpenSim.Region.Environment.LandManagement; | 8 | using OpenSim.Region.Environment.LandManagement; |
9 | 9 | ||
10 | using libsecondlife; | 10 | using libsecondlife; |
11 | 11 | ||
12 | namespace OpenSim.Region.Environment | 12 | namespace OpenSim.Region.Environment |
13 | { | 13 | { |
14 | public class PermissionManager | 14 | public class PermissionManager |
15 | { | 15 | { |
16 | protected Scene m_scene; | 16 | protected Scene m_scene; |
17 | 17 | ||
18 | // Bypasses the permissions engine (always returns OK) | 18 | // Bypasses the permissions engine (always returns OK) |
19 | // disable in any production environment | 19 | // disable in any production environment |
20 | // TODO: Change this to false when permissions are a desired default | 20 | // TODO: Change this to false when permissions are a desired default |
21 | // TODO: Move to configuration option. | 21 | // TODO: Move to configuration option. |
22 | private bool m_bypassPermissions = true; | 22 | private bool m_bypassPermissions = true; |
23 | public bool BypassPermissions | 23 | public bool BypassPermissions |
24 | { | 24 | { |
25 | get { return m_bypassPermissions; } | 25 | get { return m_bypassPermissions; } |
26 | set { m_bypassPermissions = value; } | 26 | set { m_bypassPermissions = value; } |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | public PermissionManager(Scene scene) | 30 | public PermissionManager(Scene scene) |
31 | { | 31 | { |
32 | m_scene = scene; | 32 | m_scene = scene; |
33 | } | 33 | } |
34 | 34 | ||
35 | protected virtual void SendPermissionError(LLUUID user, string reason) | 35 | protected virtual void SendPermissionError(LLUUID user, string reason) |
36 | { | 36 | { |
37 | m_scene.EventManager.TriggerPermissionError(user, reason); | 37 | m_scene.EventManager.TriggerPermissionError(user, reason); |
38 | } | 38 | } |
39 | 39 | ||
40 | protected virtual bool IsAdministrator(LLUUID user) | 40 | protected virtual bool IsAdministrator(LLUUID user) |
41 | { | 41 | { |
42 | if (m_bypassPermissions) | 42 | if (m_bypassPermissions) |
43 | { | 43 | { |
44 | return true; | 44 | return true; |
45 | } | 45 | } |
46 | 46 | ||
47 | return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; | 47 | return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; |
48 | } | 48 | } |
49 | 49 | ||
50 | protected virtual bool IsEstateManager(LLUUID user) | 50 | protected virtual bool IsEstateManager(LLUUID user) |
51 | { | 51 | { |
52 | if (m_bypassPermissions) | 52 | if (m_bypassPermissions) |
53 | { | 53 | { |
54 | return true; | 54 | return true; |
55 | } | 55 | } |
56 | 56 | ||
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | 59 | ||
60 | protected virtual bool IsGridUser(LLUUID user) | 60 | protected virtual bool IsGridUser(LLUUID user) |
61 | { | 61 | { |
62 | return true; | 62 | return true; |
63 | } | 63 | } |
64 | 64 | ||
65 | protected virtual bool IsGuest(LLUUID user) | 65 | protected virtual bool IsGuest(LLUUID user) |
66 | { | 66 | { |
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | 69 | ||
70 | public virtual bool CanRezObject(LLUUID user, LLVector3 position) | 70 | public virtual bool CanRezObject(LLUUID user, LLVector3 position) |
71 | { | 71 | { |
72 | bool permission = false; | 72 | bool permission = false; |
73 | 73 | ||
74 | string reason = "Insufficient permission"; | 74 | string reason = "Insufficient permission"; |
75 | 75 | ||
76 | if (IsAdministrator(user)) | 76 | if (IsAdministrator(user)) |
77 | { | 77 | { |
78 | permission = true; | 78 | permission = true; |
79 | } | 79 | } |
80 | else | 80 | else |
81 | { | 81 | { |
82 | reason = "Not an administrator"; | 82 | reason = "Not an administrator"; |
83 | } | 83 | } |
84 | 84 | ||
85 | if (GenericParcelPermission(user, position)) | 85 | if (GenericParcelPermission(user, position)) |
86 | { | 86 | { |
87 | permission = true; | 87 | permission = true; |
88 | } | 88 | } |
89 | else | 89 | else |
90 | { | 90 | { |
91 | reason = "Not the parcel owner"; | 91 | reason = "Not the parcel owner"; |
92 | } | 92 | } |
93 | 93 | ||
94 | if (!permission) | 94 | if (!permission) |
95 | SendPermissionError(user, reason); | 95 | SendPermissionError(user, reason); |
96 | 96 | ||
97 | return permission; | 97 | return permission; |
98 | } | 98 | } |
99 | 99 | ||
100 | #region Object Permissions | 100 | #region Object Permissions |
101 | 101 | ||
102 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) | 102 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) |
103 | { | 103 | { |
104 | // Default: deny | 104 | // Default: deny |
105 | bool permission = false; | 105 | bool permission = false; |
106 | 106 | ||
107 | if( !m_scene.Entities.ContainsKey( objId )) | 107 | if( !m_scene.Entities.ContainsKey( objId )) |
108 | { | 108 | { |
109 | return false; | 109 | return false; |
110 | } | 110 | } |
111 | 111 | ||
112 | // If it's not an object, we cant edit it. | 112 | // If it's not an object, we cant edit it. |
113 | if (!(m_scene.Entities[objId] is SceneObjectGroup)) | 113 | if (!(m_scene.Entities[objId] is SceneObjectGroup)) |
114 | { | 114 | { |
115 | return false; | 115 | return false; |
116 | } | 116 | } |
117 | 117 | ||
118 | SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; | 118 | SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; |
119 | LLUUID taskOwner = null; | 119 | LLUUID taskOwner = null; |
120 | 120 | ||
121 | // Object owners should be able to edit their own content | 121 | // Object owners should be able to edit their own content |
122 | if (user == taskOwner) | 122 | if (user == taskOwner) |
123 | permission = true; | 123 | permission = true; |
124 | 124 | ||
125 | // Users should be able to edit what is over their land. | 125 | // Users should be able to edit what is over their land. |
126 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) | 126 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) |
127 | permission = true; | 127 | permission = true; |
128 | 128 | ||
129 | // Estate users should be able to edit anything in the sim | 129 | // Estate users should be able to edit anything in the sim |
130 | if (IsEstateManager(user)) | 130 | if (IsEstateManager(user)) |
131 | permission = true; | 131 | permission = true; |
132 | 132 | ||
133 | // Admin objects should not be editable by the above | 133 | // Admin objects should not be editable by the above |
134 | if (IsAdministrator(taskOwner)) | 134 | if (IsAdministrator(taskOwner)) |
135 | permission = false; | 135 | permission = false; |
136 | 136 | ||
137 | // Admin should be able to edit anything in the sim (including admin objects) | 137 | // Admin should be able to edit anything in the sim (including admin objects) |
138 | if (IsAdministrator(user)) | 138 | if (IsAdministrator(user)) |
139 | permission = true; | 139 | permission = true; |
140 | 140 | ||
141 | return permission; | 141 | return permission; |
142 | } | 142 | } |
143 | 143 | ||
144 | /// <summary> | 144 | /// <summary> |
145 | /// Permissions check - can user delete an object? | 145 | /// Permissions check - can user delete an object? |
146 | /// </summary> | 146 | /// </summary> |
147 | /// <param name="user">User attempting the delete</param> | 147 | /// <param name="user">User attempting the delete</param> |
148 | /// <param name="obj">Target object</param> | 148 | /// <param name="obj">Target object</param> |
149 | /// <returns>Has permission?</returns> | 149 | /// <returns>Has permission?</returns> |
150 | public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) | 150 | public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) |
151 | { | 151 | { |
152 | return GenericObjectPermission(user, obj); | 152 | return GenericObjectPermission(user, obj); |
153 | } | 153 | } |
154 | 154 | ||
155 | public virtual bool CanEditObject(LLUUID user, LLUUID obj) | 155 | public virtual bool CanEditObject(LLUUID user, LLUUID obj) |
156 | { | 156 | { |
157 | return GenericObjectPermission(user, obj); | 157 | return GenericObjectPermission(user, obj); |
158 | } | 158 | } |
159 | 159 | ||
160 | public virtual bool CanReturnObject(LLUUID user, LLUUID obj) | 160 | public virtual bool CanReturnObject(LLUUID user, LLUUID obj) |
161 | { | 161 | { |
162 | return GenericObjectPermission(user, obj); | 162 | return GenericObjectPermission(user, obj); |
163 | } | 163 | } |
164 | 164 | ||
165 | #endregion | 165 | #endregion |
166 | 166 | ||
167 | #region Communication Permissions | 167 | #region Communication Permissions |
168 | 168 | ||
169 | public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) | 169 | public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) |
170 | { | 170 | { |
171 | bool permission = false; | 171 | bool permission = false; |
172 | string reason = "Only registered users may communicate with another account."; | 172 | string reason = "Only registered users may communicate with another account."; |
173 | 173 | ||
174 | if (IsGridUser(user)) | 174 | if (IsGridUser(user)) |
175 | permission = true; | 175 | permission = true; |
176 | 176 | ||
177 | if (!IsGridUser(user)) | 177 | if (!IsGridUser(user)) |
178 | { | 178 | { |
179 | permission = false; | 179 | permission = false; |
180 | reason = "The person that you are messaging is not a registered user."; | 180 | reason = "The person that you are messaging is not a registered user."; |
181 | } | 181 | } |
182 | if (IsAdministrator(user)) | 182 | if (IsAdministrator(user)) |
183 | permission = true; | 183 | permission = true; |
184 | 184 | ||
185 | if (IsEstateManager(user)) | 185 | if (IsEstateManager(user)) |
186 | permission = true; | 186 | permission = true; |
187 | 187 | ||
188 | if (!permission) | 188 | if (!permission) |
189 | SendPermissionError(user, reason); | 189 | SendPermissionError(user, reason); |
190 | 190 | ||
191 | return permission; | 191 | return permission; |
192 | } | 192 | } |
193 | 193 | ||
194 | public virtual bool CanInstantMessage(LLUUID user, LLUUID target) | 194 | public virtual bool CanInstantMessage(LLUUID user, LLUUID target) |
195 | { | 195 | { |
196 | return GenericCommunicationPermission(user, target); | 196 | return GenericCommunicationPermission(user, target); |
197 | } | 197 | } |
198 | 198 | ||
199 | public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) | 199 | public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) |
200 | { | 200 | { |
201 | return GenericCommunicationPermission(user, target); | 201 | return GenericCommunicationPermission(user, target); |
202 | } | 202 | } |
203 | 203 | ||
204 | #endregion | 204 | #endregion |
205 | 205 | ||
206 | public virtual bool CanEditScript(LLUUID user, LLUUID script) | 206 | public virtual bool CanEditScript(LLUUID user, LLUUID script) |
207 | { | 207 | { |
208 | return IsAdministrator(user); | 208 | return IsAdministrator(user); |
209 | } | 209 | } |
210 | 210 | ||
211 | public virtual bool CanRunScript(LLUUID user, LLUUID script) | 211 | public virtual bool CanRunScript(LLUUID user, LLUUID script) |
212 | { | 212 | { |
213 | return IsAdministrator(user); | 213 | return IsAdministrator(user); |
214 | } | 214 | } |
215 | 215 | ||
216 | public virtual bool CanTerraform(LLUUID user, LLVector3 position) | 216 | public virtual bool CanTerraform(LLUUID user, LLVector3 position) |
217 | { | 217 | { |
218 | bool permission = false; | 218 | bool permission = false; |
219 | 219 | ||
220 | // Estate override | 220 | // Estate override |
221 | if (GenericEstatePermission(user)) | 221 | if (GenericEstatePermission(user)) |
222 | permission = true; | 222 | permission = true; |
223 | 223 | ||
224 | // Land owner can terraform too | 224 | // Land owner can terraform too |
225 | if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y))) | 225 | if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y))) |
226 | permission = true; | 226 | permission = true; |
227 | 227 | ||
228 | if (!permission) | 228 | if (!permission) |
229 | SendPermissionError(user, "Not authorized to terraform at this location."); | 229 | SendPermissionError(user, "Not authorized to terraform at this location."); |
230 | 230 | ||
231 | return permission; | 231 | return permission; |
232 | } | 232 | } |
233 | 233 | ||
234 | #region Estate Permissions | 234 | #region Estate Permissions |
235 | 235 | ||
236 | protected virtual bool GenericEstatePermission(LLUUID user) | 236 | protected virtual bool GenericEstatePermission(LLUUID user) |
237 | { | 237 | { |
238 | // Default: deny | 238 | // Default: deny |
239 | bool permission = false; | 239 | bool permission = false; |
240 | 240 | ||
241 | // Estate admins should be able to use estate tools | 241 | // Estate admins should be able to use estate tools |
242 | if (IsEstateManager(user)) | 242 | if (IsEstateManager(user)) |
243 | permission = true; | 243 | permission = true; |
244 | 244 | ||
245 | // Administrators always have permission | 245 | // Administrators always have permission |
246 | if (IsAdministrator(user)) | 246 | if (IsAdministrator(user)) |
247 | permission = true; | 247 | permission = true; |
248 | 248 | ||
249 | return permission; | 249 | return permission; |
250 | } | 250 | } |
251 | 251 | ||
252 | public virtual bool CanEditEstateTerrain(LLUUID user) | 252 | public virtual bool CanEditEstateTerrain(LLUUID user) |
253 | { | 253 | { |
254 | return GenericEstatePermission(user); | 254 | return GenericEstatePermission(user); |
255 | } | 255 | } |
256 | 256 | ||
257 | #endregion | 257 | #endregion |
258 | 258 | ||
259 | #region Parcel Permissions | 259 | #region Parcel Permissions |
260 | 260 | ||
261 | protected virtual bool GenericParcelPermission(LLUUID user, Land parcel) | 261 | protected virtual bool GenericParcelPermission(LLUUID user, Land parcel) |
262 | { | 262 | { |
263 | bool permission = false; | 263 | bool permission = false; |
264 | 264 | ||
265 | if (parcel.landData.ownerID == user) | 265 | if (parcel.landData.ownerID == user) |
266 | permission = true; | 266 | permission = true; |
267 | 267 | ||
268 | if (parcel.landData.isGroupOwned) | 268 | if (parcel.landData.isGroupOwned) |
269 | { | 269 | { |
270 | // TODO: Need to do some extra checks here. Requires group code. | 270 | // TODO: Need to do some extra checks here. Requires group code. |
271 | } | 271 | } |
272 | 272 | ||
273 | if(IsEstateManager(user)) | 273 | if(IsEstateManager(user)) |
274 | permission = true; | 274 | permission = true; |
275 | 275 | ||
276 | if (IsAdministrator(user)) | 276 | if (IsAdministrator(user)) |
277 | permission = true; | 277 | permission = true; |
278 | 278 | ||
279 | return permission; | 279 | return permission; |
280 | } | 280 | } |
281 | 281 | ||
282 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) | 282 | protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) |
283 | { | 283 | { |
284 | return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); | 284 | return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); |
285 | } | 285 | } |
286 | 286 | ||
287 | public virtual bool CanEditParcel(LLUUID user, Land parcel) | 287 | public virtual bool CanEditParcel(LLUUID user, Land parcel) |
288 | { | 288 | { |
289 | return GenericParcelPermission(user, parcel); | 289 | return GenericParcelPermission(user, parcel); |
290 | } | 290 | } |
291 | 291 | ||
292 | public virtual bool CanSellParcel(LLUUID user, Land parcel) | 292 | public virtual bool CanSellParcel(LLUUID user, Land parcel) |
293 | { | 293 | { |
294 | return GenericParcelPermission(user, parcel); | 294 | return GenericParcelPermission(user, parcel); |
295 | } | 295 | } |
296 | 296 | ||
297 | public virtual bool CanAbandonParcel(LLUUID user, Land parcel) | 297 | public virtual bool CanAbandonParcel(LLUUID user, Land parcel) |
298 | { | 298 | { |
299 | return GenericParcelPermission(user, parcel); | 299 | return GenericParcelPermission(user, parcel); |
300 | } | 300 | } |
301 | 301 | ||
302 | #endregion | 302 | #endregion |
303 | 303 | ||
304 | } | 304 | } |
305 | } | 305 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 70b34cf..a259dd0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1,427 +1,427 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using libsecondlife.Packets; | 5 | using libsecondlife.Packets; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Communications.Caches; | 8 | using OpenSim.Framework.Communications.Caches; |
9 | using OpenSim.Framework.Data; | 9 | using OpenSim.Framework.Data; |
10 | using OpenSim.Framework.Utilities; | 10 | using OpenSim.Framework.Utilities; |
11 | using OpenSim.Region.Physics.Manager; | 11 | using OpenSim.Region.Physics.Manager; |
12 | 12 | ||
13 | namespace OpenSim.Region.Environment.Scenes | 13 | namespace OpenSim.Region.Environment.Scenes |
14 | { | 14 | { |
15 | public partial class Scene | 15 | public partial class Scene |
16 | { | 16 | { |
17 | //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 | 17 | //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 |
18 | // or at least some of they can be moved somewhere else | 18 | // or at least some of they can be moved somewhere else |
19 | 19 | ||
20 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) | 20 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) |
21 | { | 21 | { |
22 | if (this.Avatars.ContainsKey(userID)) | 22 | if (this.Avatars.ContainsKey(userID)) |
23 | { | 23 | { |
24 | this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); | 24 | this.AddInventoryItem(this.Avatars[userID].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.UserProfiles.GetUserDetails(remoteClient.AgentId); | 30 | CachedUserInfo userInfo = commsManager.UserProfiles.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 userID, LLUUID itemID, byte[] data) | 38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) |
39 | { | 39 | { |
40 | if (this.Avatars.ContainsKey(userID)) | 40 | if (this.Avatars.ContainsKey(userID)) |
41 | { | 41 | { |
42 | return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); | 42 | return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); |
43 | } | 43 | } |
44 | return LLUUID.Zero; | 44 | return LLUUID.Zero; |
45 | } | 45 | } |
46 | 46 | ||
47 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 47 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
48 | { | 48 | { |
49 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 49 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
50 | if (userInfo != null) | 50 | if (userInfo != null) |
51 | { | 51 | { |
52 | if (userInfo.RootFolder != null) | 52 | if (userInfo.RootFolder != null) |
53 | { | 53 | { |
54 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 54 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
55 | if (item != null) | 55 | if (item != null) |
56 | { | 56 | { |
57 | AssetBase asset; | 57 | AssetBase asset; |
58 | asset = new AssetBase(); | 58 | asset = new AssetBase(); |
59 | asset.FullID = LLUUID.Random(); | 59 | asset.FullID = LLUUID.Random(); |
60 | asset.Type = (sbyte)item.assetType; | 60 | asset.Type = (sbyte)item.assetType; |
61 | asset.InvType = (sbyte)item.invType; | 61 | asset.InvType = (sbyte)item.invType; |
62 | asset.Name = item.inventoryName; | 62 | asset.Name = item.inventoryName; |
63 | asset.Data = data; | 63 | asset.Data = data; |
64 | commsManager.AssetCache.AddAsset(asset); | 64 | commsManager.AssetCache.AddAsset(asset); |
65 | 65 | ||
66 | item.assetID = asset.FullID; | 66 | item.assetID = asset.FullID; |
67 | userInfo.UpdateItem(remoteClient.AgentId, item); | 67 | userInfo.UpdateItem(remoteClient.AgentId, item); |
68 | 68 | ||
69 | // remoteClient.SendInventoryItemUpdate(item); | 69 | // remoteClient.SendInventoryItemUpdate(item); |
70 | if (item.invType == 7) | 70 | if (item.invType == 7) |
71 | { | 71 | { |
72 | //do we want to know about updated note cards? | 72 | //do we want to know about updated note cards? |
73 | } | 73 | } |
74 | else if (item.invType == 10) | 74 | else if (item.invType == 10) |
75 | { | 75 | { |
76 | // do we want to know about updated scripts | 76 | // do we want to know about updated scripts |
77 | } | 77 | } |
78 | 78 | ||
79 | return (asset.FullID); | 79 | return (asset.FullID); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | } | 82 | } |
83 | return LLUUID.Zero; | 83 | return LLUUID.Zero; |
84 | } | 84 | } |
85 | 85 | ||
86 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) | 86 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) |
87 | { | 87 | { |
88 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 88 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
89 | if (userInfo != null) | 89 | if (userInfo != null) |
90 | { | 90 | { |
91 | if (userInfo.RootFolder != null) | 91 | if (userInfo.RootFolder != null) |
92 | { | 92 | { |
93 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 93 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
94 | if (item != null) | 94 | if (item != null) |
95 | { | 95 | { |
96 | AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | 96 | AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); |
97 | if (transactions != null) | 97 | if (transactions != null) |
98 | { | 98 | { |
99 | AssetBase asset = null; | 99 | AssetBase asset = null; |
100 | bool addToCache = false; | 100 | bool addToCache = false; |
101 | 101 | ||
102 | asset = commsManager.AssetCache.GetAsset(assetID); | 102 | asset = commsManager.AssetCache.GetAsset(assetID); |
103 | if (asset == null) | 103 | if (asset == null) |
104 | { | 104 | { |
105 | asset = transactions.GetTransactionAsset(transactionID); | 105 | asset = transactions.GetTransactionAsset(transactionID); |
106 | addToCache = true; | 106 | addToCache = true; |
107 | } | 107 | } |
108 | 108 | ||
109 | if (asset != null) | 109 | if (asset != null) |
110 | { | 110 | { |
111 | if (asset.FullID == assetID) | 111 | if (asset.FullID == assetID) |
112 | { | 112 | { |
113 | asset.Name = item.inventoryName; | 113 | asset.Name = item.inventoryName; |
114 | asset.Description = item.inventoryDescription; | 114 | asset.Description = item.inventoryDescription; |
115 | asset.InvType = (sbyte)item.invType; | 115 | asset.InvType = (sbyte)item.invType; |
116 | asset.Type = (sbyte)item.assetType; | 116 | asset.Type = (sbyte)item.assetType; |
117 | item.assetID = asset.FullID; | 117 | item.assetID = asset.FullID; |
118 | 118 | ||
119 | if (addToCache) | 119 | if (addToCache) |
120 | { | 120 | { |
121 | commsManager.AssetCache.AddAsset(asset); | 121 | commsManager.AssetCache.AddAsset(asset); |
122 | } | 122 | } |
123 | 123 | ||
124 | userInfo.UpdateItem(remoteClient.AgentId, item); | 124 | userInfo.UpdateItem(remoteClient.AgentId, item); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | /// <summary> | 133 | /// <summary> |
134 | /// temporary method to test out creating new inventory items | 134 | /// temporary method to test out creating new inventory items |
135 | /// </summary> | 135 | /// </summary> |
136 | /// <param name="remoteClient"></param> | 136 | /// <param name="remoteClient"></param> |
137 | /// <param name="transActionID"></param> | 137 | /// <param name="transActionID"></param> |
138 | /// <param name="folderID"></param> | 138 | /// <param name="folderID"></param> |
139 | /// <param name="callbackID"></param> | 139 | /// <param name="callbackID"></param> |
140 | /// <param name="description"></param> | 140 | /// <param name="description"></param> |
141 | /// <param name="name"></param> | 141 | /// <param name="name"></param> |
142 | /// <param name="invType"></param> | 142 | /// <param name="invType"></param> |
143 | /// <param name="type"></param> | 143 | /// <param name="type"></param> |
144 | /// <param name="wearableType"></param> | 144 | /// <param name="wearableType"></param> |
145 | /// <param name="nextOwnerMask"></param> | 145 | /// <param name="nextOwnerMask"></param> |
146 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | 146 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) |
147 | { | 147 | { |
148 | if (transActionID == LLUUID.Zero) | 148 | if (transActionID == LLUUID.Zero) |
149 | { | 149 | { |
150 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 150 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
151 | if (userInfo != null) | 151 | if (userInfo != null) |
152 | { | 152 | { |
153 | AssetBase asset = new AssetBase(); | 153 | AssetBase asset = new AssetBase(); |
154 | asset.Name = name; | 154 | asset.Name = name; |
155 | asset.Description = description; | 155 | asset.Description = description; |
156 | asset.InvType = invType; | 156 | asset.InvType = invType; |
157 | asset.Type = type; | 157 | asset.Type = type; |
158 | asset.FullID = LLUUID.Random(); | 158 | asset.FullID = LLUUID.Random(); |
159 | asset.Data = new byte[1]; | 159 | asset.Data = new byte[1]; |
160 | this.commsManager.AssetCache.AddAsset(asset); | 160 | this.commsManager.AssetCache.AddAsset(asset); |
161 | 161 | ||
162 | InventoryItemBase item = new InventoryItemBase(); | 162 | InventoryItemBase item = new InventoryItemBase(); |
163 | item.avatarID = remoteClient.AgentId; | 163 | item.avatarID = remoteClient.AgentId; |
164 | item.creatorsID = remoteClient.AgentId; | 164 | item.creatorsID = remoteClient.AgentId; |
165 | item.inventoryID = LLUUID.Random(); | 165 | item.inventoryID = LLUUID.Random(); |
166 | item.assetID = asset.FullID; | 166 | item.assetID = asset.FullID; |
167 | item.inventoryDescription = description; | 167 | item.inventoryDescription = description; |
168 | item.inventoryName = name; | 168 | item.inventoryName = name; |
169 | item.assetType = invType; | 169 | item.assetType = invType; |
170 | item.invType = invType; | 170 | item.invType = invType; |
171 | item.parentFolderID = folderID; | 171 | item.parentFolderID = folderID; |
172 | item.inventoryCurrentPermissions = 2147483647; | 172 | item.inventoryCurrentPermissions = 2147483647; |
173 | item.inventoryNextPermissions = nextOwnerMask; | 173 | item.inventoryNextPermissions = nextOwnerMask; |
174 | 174 | ||
175 | userInfo.AddItem(remoteClient.AgentId, item); | 175 | userInfo.AddItem(remoteClient.AgentId, item); |
176 | remoteClient.SendInventoryItemUpdate(item); | 176 | remoteClient.SendInventoryItemUpdate(item); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | else | 179 | else |
180 | { | 180 | { |
181 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); | 181 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); |
182 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | 182 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | /// <summary> | 186 | /// <summary> |
187 | /// | 187 | /// |
188 | /// </summary> | 188 | /// </summary> |
189 | /// <param name="remoteClient"></param> | 189 | /// <param name="remoteClient"></param> |
190 | /// <param name="primLocalID"></param> | 190 | /// <param name="primLocalID"></param> |
191 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 191 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
192 | { | 192 | { |
193 | bool hasPrim = false; | 193 | bool hasPrim = false; |
194 | foreach (EntityBase ent in Entities.Values) | 194 | foreach (EntityBase ent in Entities.Values) |
195 | { | 195 | { |
196 | if (ent is SceneObjectGroup) | 196 | if (ent is SceneObjectGroup) |
197 | { | 197 | { |
198 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); | 198 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); |
199 | if (hasPrim != false) | 199 | if (hasPrim != false) |
200 | { | 200 | { |
201 | bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); | 201 | bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); |
202 | if (fileChange) | 202 | if (fileChange) |
203 | { | 203 | { |
204 | if (this.XferManager != null) | 204 | if (this.XferManager != null) |
205 | { | 205 | { |
206 | ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); | 206 | ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | 215 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) |
216 | { | 216 | { |
217 | bool hasPrim = false; | 217 | bool hasPrim = false; |
218 | foreach (EntityBase ent in Entities.Values) | 218 | foreach (EntityBase ent in Entities.Values) |
219 | { | 219 | { |
220 | if (ent is SceneObjectGroup) | 220 | if (ent is SceneObjectGroup) |
221 | { | 221 | { |
222 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | 222 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
223 | if (hasPrim != false) | 223 | if (hasPrim != false) |
224 | { | 224 | { |
225 | int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); | 225 | int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); |
226 | ((SceneObjectGroup)ent).GetProperites(remoteClient); | 226 | ((SceneObjectGroup)ent).GetProperites(remoteClient); |
227 | if (type == 10) | 227 | if (type == 10) |
228 | { | 228 | { |
229 | this.EventManager.TriggerRemoveScript(localID, itemID); | 229 | this.EventManager.TriggerRemoveScript(localID, itemID); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 236 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
237 | { | 237 | { |
238 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 238 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
239 | LLUUID copyID = LLUUID.Random(); | 239 | LLUUID copyID = LLUUID.Random(); |
240 | if (userInfo != null) | 240 | if (userInfo != null) |
241 | { | 241 | { |
242 | if (userInfo.RootFolder != null) | 242 | if (userInfo.RootFolder != null) |
243 | { | 243 | { |
244 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 244 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
245 | if (item != null) | 245 | if (item != null) |
246 | { | 246 | { |
247 | bool isTexture = false; | 247 | bool isTexture = false; |
248 | bool rezzed = false; | 248 | bool rezzed = false; |
249 | if (item.invType == 0) | 249 | if (item.invType == 0) |
250 | { | 250 | { |
251 | isTexture = true; | 251 | isTexture = true; |
252 | } | 252 | } |
253 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 253 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
254 | if (rezAsset != null) | 254 | if (rezAsset != null) |
255 | { | 255 | { |
256 | string script = Util.FieldToString(rezAsset.Data); | 256 | string script = Util.FieldToString(rezAsset.Data); |
257 | //Console.WriteLine("rez script "+script); | 257 | //Console.WriteLine("rez script "+script); |
258 | this.EventManager.TriggerRezScript(localID, copyID, script); | 258 | this.EventManager.TriggerRezScript(localID, copyID, script); |
259 | rezzed = true; | 259 | rezzed = true; |
260 | } | 260 | } |
261 | else | 261 | else |
262 | { | 262 | { |
263 | //lets try once more incase the asset cache is being slow getting the asset from server | 263 | //lets try once more incase the asset cache is being slow getting the asset from server |
264 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 264 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
265 | if (rezAsset != null) | 265 | if (rezAsset != null) |
266 | { | 266 | { |
267 | string script = Util.FieldToString(rezAsset.Data); | 267 | string script = Util.FieldToString(rezAsset.Data); |
268 | // Console.WriteLine("rez script " + script); | 268 | // Console.WriteLine("rez script " + script); |
269 | this.EventManager.TriggerRezScript(localID, copyID, script); | 269 | this.EventManager.TriggerRezScript(localID, copyID, script); |
270 | rezzed = true; | 270 | rezzed = true; |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | if (rezzed) | 274 | if (rezzed) |
275 | { | 275 | { |
276 | bool hasPrim = false; | 276 | bool hasPrim = false; |
277 | foreach (EntityBase ent in Entities.Values) | 277 | foreach (EntityBase ent in Entities.Values) |
278 | { | 278 | { |
279 | if (ent is SceneObjectGroup) | 279 | if (ent is SceneObjectGroup) |
280 | { | 280 | { |
281 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); | 281 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); |
282 | if (hasPrim != false) | 282 | if (hasPrim != false) |
283 | { | 283 | { |
284 | 284 | ||
285 | bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); | 285 | bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); |
286 | ((SceneObjectGroup)ent).GetProperites(remoteClient); | 286 | ((SceneObjectGroup)ent).GetProperites(remoteClient); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | } | 291 | } |
292 | } | 292 | } |
293 | } | 293 | } |
294 | } | 294 | } |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// | 297 | /// |
298 | /// </summary> | 298 | /// </summary> |
299 | /// <param name="packet"></param> | 299 | /// <param name="packet"></param> |
300 | /// <param name="simClient"></param> | 300 | /// <param name="simClient"></param> |
301 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | 301 | public void DeRezObject(Packet packet, IClientAPI remoteClient) |
302 | { | 302 | { |
303 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | 303 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; |
304 | 304 | ||
305 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 305 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
306 | { | 306 | { |
307 | //currently following code not used (or don't know of any case of destination being zero | 307 | //currently following code not used (or don't know of any case of destination being zero |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 311 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
312 | { | 312 | { |
313 | EntityBase selectedEnt = null; | 313 | EntityBase selectedEnt = null; |
314 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | 314 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); |
315 | foreach (EntityBase ent in this.Entities.Values) | 315 | foreach (EntityBase ent in this.Entities.Values) |
316 | { | 316 | { |
317 | if (ent.LocalId == Data.ObjectLocalID) | 317 | if (ent.LocalId == Data.ObjectLocalID) |
318 | { | 318 | { |
319 | selectedEnt = ent; | 319 | selectedEnt = ent; |
320 | break; | 320 | break; |
321 | } | 321 | } |
322 | } | 322 | } |
323 | if (selectedEnt != null) | 323 | if (selectedEnt != null) |
324 | { | 324 | { |
325 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) | 325 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) |
326 | { | 326 | { |
327 | string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); | 327 | string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); |
328 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 328 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
329 | if (userInfo != null) | 329 | if (userInfo != null) |
330 | { | 330 | { |
331 | AssetBase asset = new AssetBase(); | 331 | AssetBase asset = new AssetBase(); |
332 | asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); | 332 | asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); |
333 | asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); | 333 | asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); |
334 | asset.InvType = 6; | 334 | asset.InvType = 6; |
335 | asset.Type = 6; | 335 | asset.Type = 6; |
336 | asset.FullID = LLUUID.Random(); | 336 | asset.FullID = LLUUID.Random(); |
337 | asset.Data = Helpers.StringToField(sceneObjectXml); | 337 | asset.Data = Helpers.StringToField(sceneObjectXml); |
338 | commsManager.AssetCache.AddAsset(asset); | 338 | commsManager.AssetCache.AddAsset(asset); |
339 | 339 | ||
340 | 340 | ||
341 | InventoryItemBase item = new InventoryItemBase(); | 341 | InventoryItemBase item = new InventoryItemBase(); |
342 | item.avatarID = remoteClient.AgentId; | 342 | item.avatarID = remoteClient.AgentId; |
343 | item.creatorsID = remoteClient.AgentId; | 343 | item.creatorsID = remoteClient.AgentId; |
344 | item.inventoryID = LLUUID.Random(); | 344 | item.inventoryID = LLUUID.Random(); |
345 | item.assetID = asset.FullID; | 345 | item.assetID = asset.FullID; |
346 | item.inventoryDescription = asset.Description; | 346 | item.inventoryDescription = asset.Description; |
347 | item.inventoryName = asset.Name; | 347 | item.inventoryName = asset.Name; |
348 | item.assetType = asset.Type; | 348 | item.assetType = asset.Type; |
349 | item.invType = asset.InvType; | 349 | item.invType = asset.InvType; |
350 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | 350 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; |
351 | item.inventoryCurrentPermissions = 2147483647; | 351 | item.inventoryCurrentPermissions = 2147483647; |
352 | item.inventoryNextPermissions = 2147483647; | 352 | item.inventoryNextPermissions = 2147483647; |
353 | 353 | ||
354 | userInfo.AddItem(remoteClient.AgentId, item); | 354 | userInfo.AddItem(remoteClient.AgentId, item); |
355 | remoteClient.SendInventoryItemUpdate(item); | 355 | remoteClient.SendInventoryItemUpdate(item); |
356 | } | 356 | } |
357 | 357 | ||
358 | SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); | 358 | SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); |
359 | if (rootPart.PhysActor != null) | 359 | if (rootPart.PhysActor != null) |
360 | { | 360 | { |
361 | this.phyScene.RemovePrim(rootPart.PhysActor); | 361 | this.phyScene.RemovePrim(rootPart.PhysActor); |
362 | rootPart.PhysActor = null; | 362 | rootPart.PhysActor = null; |
363 | } | 363 | } |
364 | 364 | ||
365 | storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); | 365 | storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); |
366 | ((SceneObjectGroup)selectedEnt).DeleteGroup(); | 366 | ((SceneObjectGroup)selectedEnt).DeleteGroup(); |
367 | 367 | ||
368 | lock (Entities) | 368 | lock (Entities) |
369 | { | 369 | { |
370 | Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); | 370 | Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); |
371 | } | 371 | } |
372 | ((SceneObjectGroup)selectedEnt).DeleteParts(); | 372 | ((SceneObjectGroup)selectedEnt).DeleteParts(); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | } | 375 | } |
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 379 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) |
380 | { | 380 | { |
381 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | 381 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); |
382 | if (userInfo != null) | 382 | if (userInfo != null) |
383 | { | 383 | { |
384 | if (userInfo.RootFolder != null) | 384 | if (userInfo.RootFolder != null) |
385 | { | 385 | { |
386 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 386 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
387 | if (item != null) | 387 | if (item != null) |
388 | { | 388 | { |
389 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 389 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
390 | if (rezAsset != null) | 390 | if (rezAsset != null) |
391 | { | 391 | { |
392 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 392 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
393 | userInfo.DeleteItem(remoteClient.AgentId, item); | 393 | userInfo.DeleteItem(remoteClient.AgentId, item); |
394 | remoteClient.SendRemoveInventoryItem(itemID); | 394 | remoteClient.SendRemoveInventoryItem(itemID); |
395 | } | 395 | } |
396 | else | 396 | else |
397 | { | 397 | { |
398 | //lets try once more incase the asset cache is being slow getting the asset from server | 398 | //lets try once more incase the asset cache is being slow getting the asset from server |
399 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 399 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
400 | if (rezAsset != null) | 400 | if (rezAsset != null) |
401 | { | 401 | { |
402 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 402 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
403 | userInfo.DeleteItem(remoteClient.AgentId, item); | 403 | userInfo.DeleteItem(remoteClient.AgentId, item); |
404 | remoteClient.SendRemoveInventoryItem(itemID); | 404 | remoteClient.SendRemoveInventoryItem(itemID); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | } | 407 | } |
408 | } | 408 | } |
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | private void AddRezObject(string xmlData, LLVector3 pos) | 412 | private void AddRezObject(string xmlData, LLVector3 pos) |
413 | { | 413 | { |
414 | SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); | 414 | SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); |
415 | this.AddEntity(group); | 415 | this.AddEntity(group); |
416 | group.AbsolutePosition = pos; | 416 | group.AbsolutePosition = pos; |
417 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 417 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
418 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 418 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) |
419 | rootPart.PhysActor = phyScene.AddPrim( | 419 | rootPart.PhysActor = phyScene.AddPrim( |
420 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), | 420 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), |
421 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | 421 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), |
422 | new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | 422 | new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, |
423 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); | 423 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | } | 427 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index dfac406..4a99a80 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -1,237 +1,237 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using System; | 2 | using System; |
3 | using OpenSim.Framework.Console; | 3 | using OpenSim.Framework.Console; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes | 6 | namespace OpenSim.Region.Environment.Scenes |
7 | { | 7 | { |
8 | public class SceneManager | 8 | public class SceneManager |
9 | { | 9 | { |
10 | private readonly List<Scene> m_localScenes; | 10 | private readonly List<Scene> m_localScenes; |
11 | private Scene m_currentScene = null; | 11 | private Scene m_currentScene = null; |
12 | public Scene CurrentScene | 12 | public Scene CurrentScene |
13 | { | 13 | { |
14 | get | 14 | get |
15 | { | 15 | { |
16 | return m_currentScene; | 16 | return m_currentScene; |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | private Scene CurrentOrFirstScene | 20 | private Scene CurrentOrFirstScene |
21 | { | 21 | { |
22 | get | 22 | get |
23 | { | 23 | { |
24 | if (m_currentScene == null) | 24 | if (m_currentScene == null) |
25 | { | 25 | { |
26 | return m_localScenes[0]; | 26 | return m_localScenes[0]; |
27 | } | 27 | } |
28 | else | 28 | else |
29 | { | 29 | { |
30 | return m_currentScene; | 30 | return m_currentScene; |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | public SceneManager() | 35 | public SceneManager() |
36 | { | 36 | { |
37 | m_localScenes = new List<Scene>(); | 37 | m_localScenes = new List<Scene>(); |
38 | } | 38 | } |
39 | 39 | ||
40 | public void Close() | 40 | public void Close() |
41 | { | 41 | { |
42 | for (int i = 0; i < m_localScenes.Count; i++) | 42 | for (int i = 0; i < m_localScenes.Count; i++) |
43 | { | 43 | { |
44 | m_localScenes[i].Close(); | 44 | m_localScenes[i].Close(); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | public void Add(Scene scene) | 48 | public void Add(Scene scene) |
49 | { | 49 | { |
50 | m_localScenes.Add(scene); | 50 | m_localScenes.Add(scene); |
51 | } | 51 | } |
52 | 52 | ||
53 | public void SavePrimsToXml(string filename) | 53 | public void SavePrimsToXml(string filename) |
54 | { | 54 | { |
55 | CurrentOrFirstScene.SavePrimsToXml(filename); | 55 | CurrentOrFirstScene.SavePrimsToXml(filename); |
56 | } | 56 | } |
57 | 57 | ||
58 | public void LoadPrimsFromXml(string filename) | 58 | public void LoadPrimsFromXml(string filename) |
59 | { | 59 | { |
60 | CurrentOrFirstScene.LoadPrimsFromXml(filename); | 60 | CurrentOrFirstScene.LoadPrimsFromXml(filename); |
61 | } | 61 | } |
62 | 62 | ||
63 | public bool RunTerrainCmd(string[] cmdparams, ref string result) | 63 | public bool RunTerrainCmd(string[] cmdparams, ref string result) |
64 | { | 64 | { |
65 | if (m_currentScene == null) | 65 | if (m_currentScene == null) |
66 | { | 66 | { |
67 | bool success = true; | 67 | bool success = true; |
68 | foreach (Scene scene in m_localScenes) | 68 | foreach (Scene scene in m_localScenes) |
69 | { | 69 | { |
70 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) | 70 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) |
71 | { | 71 | { |
72 | success = false; | 72 | success = false; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | return success; | 76 | return success; |
77 | } | 77 | } |
78 | else | 78 | else |
79 | { | 79 | { |
80 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); | 80 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public void SendCommandToScripts(string[] cmdparams) | 84 | public void SendCommandToScripts(string[] cmdparams) |
85 | { | 85 | { |
86 | ForEach(delegate(Scene scene) | 86 | ForEach(delegate(Scene scene) |
87 | { | 87 | { |
88 | scene.SendCommandToScripts(cmdparams); | 88 | scene.SendCommandToScripts(cmdparams); |
89 | }); | 89 | }); |
90 | } | 90 | } |
91 | 91 | ||
92 | public void BypassPermissions(bool bypassPermissions) | 92 | public void BypassPermissions(bool bypassPermissions) |
93 | { | 93 | { |
94 | ForEach(delegate(Scene scene) | 94 | ForEach(delegate(Scene scene) |
95 | { | 95 | { |
96 | scene.PermissionsMngr.BypassPermissions = bypassPermissions; | 96 | scene.PermissionsMngr.BypassPermissions = bypassPermissions; |
97 | }); | 97 | }); |
98 | } | 98 | } |
99 | 99 | ||
100 | private void ForEach(Action<Scene> func) | 100 | private void ForEach(Action<Scene> func) |
101 | { | 101 | { |
102 | if (m_currentScene == null) | 102 | if (m_currentScene == null) |
103 | { | 103 | { |
104 | m_localScenes.ForEach(func); | 104 | m_localScenes.ForEach(func); |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { | 107 | { |
108 | func(m_currentScene); | 108 | func(m_currentScene); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | public void Backup() | 112 | public void Backup() |
113 | { | 113 | { |
114 | ForEach(delegate(Scene scene) | 114 | ForEach(delegate(Scene scene) |
115 | { | 115 | { |
116 | scene.Backup(); | 116 | scene.Backup(); |
117 | }); | 117 | }); |
118 | } | 118 | } |
119 | 119 | ||
120 | public void HandleAlertCommand(string[] cmdparams) | 120 | public void HandleAlertCommand(string[] cmdparams) |
121 | { | 121 | { |
122 | ForEach(delegate(Scene scene) | 122 | ForEach(delegate(Scene scene) |
123 | { | 123 | { |
124 | scene.HandleAlertCommand(cmdparams); | 124 | scene.HandleAlertCommand(cmdparams); |
125 | }); | 125 | }); |
126 | } | 126 | } |
127 | 127 | ||
128 | public bool TrySetCurrentRegion(string regionName) | 128 | public bool TrySetCurrentRegion(string regionName) |
129 | { | 129 | { |
130 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) | 130 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) |
131 | { | 131 | { |
132 | m_currentScene = null; | 132 | m_currentScene = null; |
133 | return true; | 133 | return true; |
134 | } | 134 | } |
135 | else | 135 | else |
136 | { | 136 | { |
137 | Console.WriteLine("Searching for Region: '" + regionName + "'"); | 137 | Console.WriteLine("Searching for Region: '" + regionName + "'"); |
138 | Scene foundScene = null; | 138 | Scene foundScene = null; |
139 | 139 | ||
140 | foreach (Scene scene in m_localScenes) | 140 | foreach (Scene scene in m_localScenes) |
141 | { | 141 | { |
142 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) | 142 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) |
143 | { | 143 | { |
144 | m_currentScene = scene; | 144 | m_currentScene = scene; |
145 | return true; | 145 | return true; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | return false; | 149 | return false; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | public void DebugPacket(LogBase log, int newDebug) | 153 | public void DebugPacket(LogBase log, int newDebug) |
154 | { | 154 | { |
155 | ForEach(delegate(Scene scene) | 155 | ForEach(delegate(Scene scene) |
156 | { | 156 | { |
157 | foreach (EntityBase entity in scene.Entities.Values) | 157 | foreach (EntityBase entity in scene.Entities.Values) |
158 | { | 158 | { |
159 | if (entity is ScenePresence) | 159 | if (entity is ScenePresence) |
160 | { | 160 | { |
161 | ScenePresence scenePrescence = entity as ScenePresence; | 161 | ScenePresence scenePrescence = entity as ScenePresence; |
162 | if (!scenePrescence.childAgent) | 162 | if (!scenePrescence.childAgent) |
163 | { | 163 | { |
164 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", | 164 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", |
165 | scenePrescence.Firstname, scenePrescence.Lastname, | 165 | scenePrescence.Firstname, scenePrescence.Lastname, |
166 | newDebug)); | 166 | newDebug)); |
167 | 167 | ||
168 | scenePrescence.ControllingClient.SetDebug(newDebug); | 168 | scenePrescence.ControllingClient.SetDebug(newDebug); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | }); | 172 | }); |
173 | } | 173 | } |
174 | 174 | ||
175 | public List<ScenePresence> GetAvatars() | 175 | public List<ScenePresence> GetAvatars() |
176 | { | 176 | { |
177 | List<ScenePresence> avatars = new List<ScenePresence>(); | 177 | List<ScenePresence> avatars = new List<ScenePresence>(); |
178 | 178 | ||
179 | ForEach(delegate(Scene scene) | 179 | ForEach(delegate(Scene scene) |
180 | { | 180 | { |
181 | foreach (EntityBase entity in scene.Entities.Values) | 181 | foreach (EntityBase entity in scene.Entities.Values) |
182 | { | 182 | { |
183 | if (entity is ScenePresence) | 183 | if (entity is ScenePresence) |
184 | { | 184 | { |
185 | ScenePresence scenePrescence = entity as ScenePresence; | 185 | ScenePresence scenePrescence = entity as ScenePresence; |
186 | if (!scenePrescence.childAgent) | 186 | if (!scenePrescence.childAgent) |
187 | { | 187 | { |
188 | avatars.Add(scenePrescence); | 188 | avatars.Add(scenePrescence); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
192 | }); | 192 | }); |
193 | 193 | ||
194 | return avatars; | 194 | return avatars; |
195 | } | 195 | } |
196 | 196 | ||
197 | public RegionInfo GetRegionInfo(ulong regionHandle) | 197 | public RegionInfo GetRegionInfo(ulong regionHandle) |
198 | { | 198 | { |
199 | foreach (Scene scene in m_localScenes) | 199 | foreach (Scene scene in m_localScenes) |
200 | { | 200 | { |
201 | if (scene.RegionInfo.RegionHandle == regionHandle) | 201 | if (scene.RegionInfo.RegionHandle == regionHandle) |
202 | { | 202 | { |
203 | return scene.RegionInfo; | 203 | return scene.RegionInfo; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | return null; | 207 | return null; |
208 | } | 208 | } |
209 | 209 | ||
210 | public void SetTimePhase(int timePhase) | 210 | public void SetTimePhase(int timePhase) |
211 | { | 211 | { |
212 | ForEach(delegate(Scene scene) | 212 | ForEach(delegate(Scene scene) |
213 | { | 213 | { |
214 | scene.SetTimePhase( | 214 | scene.SetTimePhase( |
215 | timePhase) | 215 | timePhase) |
216 | ; | 216 | ; |
217 | }); | 217 | }); |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | public void ForceClientUpdate() | 221 | public void ForceClientUpdate() |
222 | { | 222 | { |
223 | ForEach(delegate(Scene scene) | 223 | ForEach(delegate(Scene scene) |
224 | { | 224 | { |
225 | scene.ForceClientUpdate(); | 225 | scene.ForceClientUpdate(); |
226 | }); | 226 | }); |
227 | } | 227 | } |
228 | 228 | ||
229 | public void HandleEditCommand(string[] cmdparams) | 229 | public void HandleEditCommand(string[] cmdparams) |
230 | { | 230 | { |
231 | ForEach(delegate(Scene scene) | 231 | ForEach(delegate(Scene scene) |
232 | { | 232 | { |
233 | scene.HandleEditCommand(cmdparams); | 233 | scene.HandleEditCommand(cmdparams); |
234 | }); | 234 | }); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index 2f248ce..7cf9cb7 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -1,20 +1,20 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | 6 | namespace OpenSim.Region.Environment.Scenes.Scripting |
7 | { | 7 | { |
8 | public interface IScriptHost | 8 | public interface IScriptHost |
9 | { | 9 | { |
10 | string Name { get; set;} | 10 | string Name { get; set;} |
11 | string SitName{ get; set;} | 11 | string SitName{ get; set;} |
12 | string TouchName { get; set;} | 12 | string TouchName { get; set;} |
13 | string Description { get; set; } | 13 | string Description { get; set; } |
14 | LLUUID UUID { get; } | 14 | LLUUID UUID { get; } |
15 | LLUUID ObjectOwner { get;} | 15 | LLUUID ObjectOwner { get;} |
16 | LLUUID ObjectCreator { get; } | 16 | LLUUID ObjectCreator { get; } |
17 | LLVector3 AbsolutePosition { get; } | 17 | LLVector3 AbsolutePosition { get; } |
18 | void SetText(string text, Axiom.Math.Vector3 color, double alpha); | 18 | void SetText(string text, Axiom.Math.Vector3 color, double alpha); |
19 | } | 19 | } |
20 | } | 20 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 5e3dcae..875e4cb 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -1,56 +1,56 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | 6 | namespace OpenSim.Region.Environment.Scenes.Scripting |
7 | { | 7 | { |
8 | public class NullScriptHost : IScriptHost | 8 | public class NullScriptHost : IScriptHost |
9 | { | 9 | { |
10 | 10 | ||
11 | LLVector3 m_pos = new LLVector3( 128, 128, 30 ); | 11 | LLVector3 m_pos = new LLVector3( 128, 128, 30 ); |
12 | public string Name | 12 | public string Name |
13 | { | 13 | { |
14 | get { return "Object"; } | 14 | get { return "Object"; } |
15 | set { } | 15 | set { } |
16 | } | 16 | } |
17 | 17 | ||
18 | public string SitName | 18 | public string SitName |
19 | { | 19 | { |
20 | get { return ""; } | 20 | get { return ""; } |
21 | set { } | 21 | set { } |
22 | } | 22 | } |
23 | 23 | ||
24 | public string TouchName | 24 | public string TouchName |
25 | { | 25 | { |
26 | get { return ""; } | 26 | get { return ""; } |
27 | set { } | 27 | set { } |
28 | } | 28 | } |
29 | 29 | ||
30 | public string Description | 30 | public string Description |
31 | { | 31 | { |
32 | get { return ""; } | 32 | get { return ""; } |
33 | set { } | 33 | set { } |
34 | } | 34 | } |
35 | 35 | ||
36 | public LLUUID UUID | 36 | public LLUUID UUID |
37 | { | 37 | { |
38 | get { return LLUUID.Zero; } | 38 | get { return LLUUID.Zero; } |
39 | } | 39 | } |
40 | 40 | ||
41 | public LLUUID ObjectOwner | 41 | public LLUUID ObjectOwner |
42 | { get { return LLUUID.Zero; } } | 42 | { get { return LLUUID.Zero; } } |
43 | 43 | ||
44 | public LLUUID ObjectCreator { get { return LLUUID.Zero; } } | 44 | public LLUUID ObjectCreator { get { return LLUUID.Zero; } } |
45 | 45 | ||
46 | public LLVector3 AbsolutePosition | 46 | public LLVector3 AbsolutePosition |
47 | { | 47 | { |
48 | get { return m_pos; } | 48 | get { return m_pos; } |
49 | } | 49 | } |
50 | 50 | ||
51 | public void SetText(string text, Axiom.Math.Vector3 color, double alpha) | 51 | public void SetText(string text, Axiom.Math.Vector3 color, double alpha) |
52 | { | 52 | { |
53 | Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); | 53 | Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } | 56 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs index d3d58fe..5e8ff87 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs | |||
@@ -1,43 +1,43 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Region.Environment.Scenes.Scripting; | 32 | using OpenSim.Region.Environment.Scenes.Scripting; |
33 | 33 | ||
34 | //TODO: WHERE TO PLACE THIS? | 34 | //TODO: WHERE TO PLACE THIS? |
35 | namespace OpenSim.Region.Environment.Scenes.Scripting | 35 | namespace OpenSim.Region.Environment.Scenes.Scripting |
36 | { | 36 | { |
37 | public interface ScriptEngineInterface | 37 | public interface ScriptEngineInterface |
38 | { | 38 | { |
39 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); | 39 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); |
40 | void Shutdown(); | 40 | void Shutdown(); |
41 | // void StartScript(string ScriptID, IScriptHost ObjectID); | 41 | // void StartScript(string ScriptID, IScriptHost ObjectID); |
42 | } | 42 | } |
43 | } | 43 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs index 3500545..83bd0ab 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs | |||
@@ -1,124 +1,124 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | 34 | ||
35 | namespace OpenSim.Region.Environment.Scenes.Scripting | 35 | namespace OpenSim.Region.Environment.Scenes.Scripting |
36 | { | 36 | { |
37 | public class ScriptEngineLoader | 37 | public class ScriptEngineLoader |
38 | { | 38 | { |
39 | private OpenSim.Framework.Console.LogBase m_log; | 39 | private OpenSim.Framework.Console.LogBase m_log; |
40 | public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) | 40 | public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) |
41 | { | 41 | { |
42 | m_log = logger; | 42 | m_log = logger; |
43 | } | 43 | } |
44 | 44 | ||
45 | public ScriptEngineInterface LoadScriptEngine(string EngineName) | 45 | public ScriptEngineInterface LoadScriptEngine(string EngineName) |
46 | { | 46 | { |
47 | ScriptEngineInterface ret = null; | 47 | ScriptEngineInterface ret = null; |
48 | try | 48 | try |
49 | { | 49 | { |
50 | ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), | 50 | ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), |
51 | "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); | 51 | "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); |
52 | } | 52 | } |
53 | catch (Exception e) | 53 | catch (Exception e) |
54 | { | 54 | { |
55 | m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); | 55 | m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); |
56 | } | 56 | } |
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// Does actual loading and initialization of script Assembly | 61 | /// Does actual loading and initialization of script Assembly |
62 | /// </summary> | 62 | /// </summary> |
63 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | 63 | /// <param name="FreeAppDomain">AppDomain to load script into</param> |
64 | /// <param name="FileName">FileName of script assembly (.dll)</param> | 64 | /// <param name="FileName">FileName of script assembly (.dll)</param> |
65 | /// <returns></returns> | 65 | /// <returns></returns> |
66 | private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) | 66 | private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) |
67 | { | 67 | { |
68 | //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); | 68 | //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); |
69 | // Load .Net Assembly (.dll) | 69 | // Load .Net Assembly (.dll) |
70 | // Initialize and return it | 70 | // Initialize and return it |
71 | 71 | ||
72 | // TODO: Add error handling | 72 | // TODO: Add error handling |
73 | 73 | ||
74 | Assembly a; | 74 | Assembly a; |
75 | //try | 75 | //try |
76 | //{ | 76 | //{ |
77 | 77 | ||
78 | 78 | ||
79 | // Load to default appdomain (temporary) | 79 | // Load to default appdomain (temporary) |
80 | a = Assembly.LoadFrom(FileName); | 80 | a = Assembly.LoadFrom(FileName); |
81 | // Load to specified appdomain | 81 | // Load to specified appdomain |
82 | // TODO: Insert security | 82 | // TODO: Insert security |
83 | //a = FreeAppDomain.Load(FileName); | 83 | //a = FreeAppDomain.Load(FileName); |
84 | //} | 84 | //} |
85 | //catch (Exception e) | 85 | //catch (Exception e) |
86 | //{ | 86 | //{ |
87 | // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); | 87 | // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); |
88 | //} | 88 | //} |
89 | 89 | ||
90 | 90 | ||
91 | //Console.WriteLine("Loading: " + FileName); | 91 | //Console.WriteLine("Loading: " + FileName); |
92 | //foreach (Type _t in a.GetTypes()) | 92 | //foreach (Type _t in a.GetTypes()) |
93 | //{ | 93 | //{ |
94 | // Console.WriteLine("Type: " + _t.ToString()); | 94 | // Console.WriteLine("Type: " + _t.ToString()); |
95 | //} | 95 | //} |
96 | 96 | ||
97 | Type t; | 97 | Type t; |
98 | //try | 98 | //try |
99 | //{ | 99 | //{ |
100 | t = a.GetType(NameSpace, true); | 100 | t = a.GetType(NameSpace, true); |
101 | //} | 101 | //} |
102 | //catch (Exception e) | 102 | //catch (Exception e) |
103 | //{ | 103 | //{ |
104 | // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); | 104 | // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); |
105 | //} | 105 | //} |
106 | 106 | ||
107 | ScriptEngineInterface ret; | 107 | ScriptEngineInterface ret; |
108 | //try | 108 | //try |
109 | //{ | 109 | //{ |
110 | ret = (ScriptEngineInterface)Activator.CreateInstance(t); | 110 | ret = (ScriptEngineInterface)Activator.CreateInstance(t); |
111 | //} | 111 | //} |
112 | //catch (Exception e) | 112 | //catch (Exception e) |
113 | //{ | 113 | //{ |
114 | // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); | 114 | // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); |
115 | //} | 115 | //} |
116 | 116 | ||
117 | return ret; | 117 | return ret; |
118 | 118 | ||
119 | 119 | ||
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | } | 123 | } |
124 | } | 124 | } |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index c7b0524..3b4dd9a 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -1,167 +1,167 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Types | 6 | namespace OpenSim.Region.Environment.Types |
7 | { | 7 | { |
8 | public class BasicQuadTreeNode | 8 | public class BasicQuadTreeNode |
9 | { | 9 | { |
10 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); | 10 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); |
11 | private BasicQuadTreeNode[] m_childNodes = null; | 11 | private BasicQuadTreeNode[] m_childNodes = null; |
12 | private BasicQuadTreeNode m_parent = null; | 12 | private BasicQuadTreeNode m_parent = null; |
13 | 13 | ||
14 | private short m_leftX; | 14 | private short m_leftX; |
15 | private short m_leftY; | 15 | private short m_leftY; |
16 | private short m_width; | 16 | private short m_width; |
17 | private short m_height; | 17 | private short m_height; |
18 | 18 | ||
19 | public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) | 19 | public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) |
20 | { | 20 | { |
21 | m_parent = parent; | 21 | m_parent = parent; |
22 | m_leftX = leftX; | 22 | m_leftX = leftX; |
23 | m_leftY = leftY; | 23 | m_leftY = leftY; |
24 | m_width = width; | 24 | m_width = width; |
25 | m_height = height; | 25 | m_height = height; |
26 | } | 26 | } |
27 | 27 | ||
28 | public void AddObject(SceneObjectGroup obj) | 28 | public void AddObject(SceneObjectGroup obj) |
29 | { | 29 | { |
30 | if (m_childNodes == null) | 30 | if (m_childNodes == null) |
31 | { | 31 | { |
32 | if (!m_objects.Contains(obj)) | 32 | if (!m_objects.Contains(obj)) |
33 | { | 33 | { |
34 | m_objects.Add(obj); | 34 | m_objects.Add(obj); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | else | 37 | else |
38 | { | 38 | { |
39 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) | 39 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) |
40 | { | 40 | { |
41 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 41 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
42 | { | 42 | { |
43 | m_childNodes[0].AddObject(obj); | 43 | m_childNodes[0].AddObject(obj); |
44 | } | 44 | } |
45 | else | 45 | else |
46 | { | 46 | { |
47 | m_childNodes[2].AddObject(obj); | 47 | m_childNodes[2].AddObject(obj); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | else | 50 | else |
51 | { | 51 | { |
52 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | 52 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
53 | { | 53 | { |
54 | m_childNodes[1].AddObject(obj); | 54 | m_childNodes[1].AddObject(obj); |
55 | } | 55 | } |
56 | else | 56 | else |
57 | { | 57 | { |
58 | m_childNodes[3].AddObject(obj); | 58 | m_childNodes[3].AddObject(obj); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | public void Subdivide() | 64 | public void Subdivide() |
65 | { | 65 | { |
66 | if (m_childNodes == null) | 66 | if (m_childNodes == null) |
67 | { | 67 | { |
68 | m_childNodes = new BasicQuadTreeNode[4]; | 68 | m_childNodes = new BasicQuadTreeNode[4]; |
69 | m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); | 69 | m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); |
70 | m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); | 70 | m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); |
71 | m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); | 71 | m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); |
72 | m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); | 72 | m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); |
73 | } | 73 | } |
74 | else | 74 | else |
75 | { | 75 | { |
76 | for (int i = 0; i < m_childNodes.Length; i++) | 76 | for (int i = 0; i < m_childNodes.Length; i++) |
77 | { | 77 | { |
78 | m_childNodes[i].Subdivide(); | 78 | m_childNodes[i].Subdivide(); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public List<SceneObjectGroup> GetObjectsFrom(int x, int y) | 83 | public List<SceneObjectGroup> GetObjectsFrom(int x, int y) |
84 | { | 84 | { |
85 | if (m_childNodes == null) | 85 | if (m_childNodes == null) |
86 | { | 86 | { |
87 | return m_objects; | 87 | return m_objects; |
88 | } | 88 | } |
89 | else | 89 | else |
90 | { | 90 | { |
91 | if (x < (m_leftX + (m_width / 2))) | 91 | if (x < (m_leftX + (m_width / 2))) |
92 | { | 92 | { |
93 | if (y < (m_leftY + (m_height / 2))) | 93 | if (y < (m_leftY + (m_height / 2))) |
94 | { | 94 | { |
95 | return m_childNodes[0].GetObjectsFrom(x, y); | 95 | return m_childNodes[0].GetObjectsFrom(x, y); |
96 | } | 96 | } |
97 | else | 97 | else |
98 | { | 98 | { |
99 | return m_childNodes[2].GetObjectsFrom(x, y); | 99 | return m_childNodes[2].GetObjectsFrom(x, y); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | else | 102 | else |
103 | { | 103 | { |
104 | if (y < (m_leftY + (m_height / 2))) | 104 | if (y < (m_leftY + (m_height / 2))) |
105 | { | 105 | { |
106 | return m_childNodes[1].GetObjectsFrom(x, y); | 106 | return m_childNodes[1].GetObjectsFrom(x, y); |
107 | } | 107 | } |
108 | else | 108 | else |
109 | { | 109 | { |
110 | return m_childNodes[3].GetObjectsFrom(x, y); | 110 | return m_childNodes[3].GetObjectsFrom(x, y); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | public void Update() | 116 | public void Update() |
117 | { | 117 | { |
118 | if (m_childNodes != null) | 118 | if (m_childNodes != null) |
119 | { | 119 | { |
120 | for (int i = 0; i < 4; i++) | 120 | for (int i = 0; i < 4; i++) |
121 | { | 121 | { |
122 | m_childNodes[i].Update(); | 122 | m_childNodes[i].Update(); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | else | 125 | else |
126 | { | 126 | { |
127 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 127 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); |
128 | foreach (SceneObjectGroup group in m_objects) | 128 | foreach (SceneObjectGroup group in m_objects) |
129 | { | 129 | { |
130 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 130 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
131 | { | 131 | { |
132 | //still in bounds | 132 | //still in bounds |
133 | } | 133 | } |
134 | else | 134 | else |
135 | { | 135 | { |
136 | outBounds.Add(group); | 136 | outBounds.Add(group); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | foreach (SceneObjectGroup removee in outBounds) | 140 | foreach (SceneObjectGroup removee in outBounds) |
141 | { | 141 | { |
142 | m_objects.Remove(removee); | 142 | m_objects.Remove(removee); |
143 | if (m_parent != null) | 143 | if (m_parent != null) |
144 | { | 144 | { |
145 | m_parent.PassUp(removee); | 145 | m_parent.PassUp(removee); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | outBounds.Clear(); | 148 | outBounds.Clear(); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | public void PassUp(SceneObjectGroup group) | 152 | public void PassUp(SceneObjectGroup group) |
153 | { | 153 | { |
154 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 154 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
155 | { | 155 | { |
156 | this.AddObject(group); | 156 | this.AddObject(group); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | if (m_parent != null) | 160 | if (m_parent != null) |
161 | { | 161 | { |
162 | m_parent.PassUp(group); | 162 | m_parent.PassUp(group); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index dab4258..3b7c182 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -1,54 +1,54 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Types | 7 | namespace OpenSim.Region.Environment.Types |
8 | { | 8 | { |
9 | public class UpdateQueue | 9 | public class UpdateQueue |
10 | { | 10 | { |
11 | private Queue<SceneObjectPart> m_queue; | 11 | private Queue<SceneObjectPart> m_queue; |
12 | 12 | ||
13 | private List<LLUUID> m_ids; | 13 | private List<LLUUID> m_ids; |
14 | 14 | ||
15 | public int Count | 15 | public int Count |
16 | { | 16 | { |
17 | get { return m_queue.Count; } | 17 | get { return m_queue.Count; } |
18 | } | 18 | } |
19 | 19 | ||
20 | public UpdateQueue() | 20 | public UpdateQueue() |
21 | { | 21 | { |
22 | m_queue = new Queue<SceneObjectPart>(); | 22 | m_queue = new Queue<SceneObjectPart>(); |
23 | m_ids = new List<LLUUID>(); | 23 | m_ids = new List<LLUUID>(); |
24 | } | 24 | } |
25 | 25 | ||
26 | public void Enqueue(SceneObjectPart part) | 26 | public void Enqueue(SceneObjectPart part) |
27 | { | 27 | { |
28 | lock (m_ids) | 28 | lock (m_ids) |
29 | { | 29 | { |
30 | if (!m_ids.Contains(part.UUID)) | 30 | if (!m_ids.Contains(part.UUID)) |
31 | { | 31 | { |
32 | m_ids.Add(part.UUID); | 32 | m_ids.Add(part.UUID); |
33 | m_queue.Enqueue(part); | 33 | m_queue.Enqueue(part); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public SceneObjectPart Dequeue() | 38 | public SceneObjectPart Dequeue() |
39 | { | 39 | { |
40 | SceneObjectPart part = null; | 40 | SceneObjectPart part = null; |
41 | if (m_queue.Count > 0) | 41 | if (m_queue.Count > 0) |
42 | { | 42 | { |
43 | part = m_queue.Dequeue(); | 43 | part = m_queue.Dequeue(); |
44 | lock (m_ids) | 44 | lock (m_ids) |
45 | { | 45 | { |
46 | m_ids.Remove(part.UUID); | 46 | m_ids.Remove(part.UUID); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | return part; | 50 | return part; |
51 | } | 51 | } |
52 | 52 | ||
53 | } | 53 | } |
54 | } | 54 | } |