diff options
author | Jeff Ames | 2009-03-07 02:00:18 +0000 |
---|---|---|
committer | Jeff Ames | 2009-03-07 02:00:18 +0000 |
commit | e1f68145be8b0cfc48c7fe6920ae8db1bfa049f5 (patch) | |
tree | d4d37926bd660bbad4dd9e4f84a385a1f770ec5d /OpenSim | |
parent | * Fixes mantis: #3241 (diff) | |
download | opensim-SC-e1f68145be8b0cfc48c7fe6920ae8db1bfa049f5.zip opensim-SC-e1f68145be8b0cfc48c7fe6920ae8db1bfa049f5.tar.gz opensim-SC-e1f68145be8b0cfc48c7fe6920ae8db1bfa049f5.tar.bz2 opensim-SC-e1f68145be8b0cfc48c7fe6920ae8db1bfa049f5.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim')
13 files changed, 855 insertions, 855 deletions
diff --git a/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs b/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs index 836f559..9a2b157 100644 --- a/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs +++ b/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.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.CoreModules.World.Tests | 5 | namespace OpenSim.Region.CoreModules.World.Tests |
6 | { | 6 | { |
7 | class SOGSpamTest | 7 | class SOGSpamTest |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs index c75c6e7..6fa6ebe 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs | |||
@@ -1,34 +1,34 @@ | |||
1 | using OpenSim.Region.Framework.Scenes; | 1 | using OpenSim.Region.Framework.Scenes; |
2 | 2 | ||
3 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 3 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
4 | { | 4 | { |
5 | public class Heightmap : IHeightmap | 5 | public class Heightmap : IHeightmap |
6 | { | 6 | { |
7 | private Scene m_scene; | 7 | private Scene m_scene; |
8 | 8 | ||
9 | public Heightmap(Scene scene) | 9 | public Heightmap(Scene scene) |
10 | { | 10 | { |
11 | m_scene = scene; | 11 | m_scene = scene; |
12 | } | 12 | } |
13 | 13 | ||
14 | public int Height | 14 | public int Height |
15 | { | 15 | { |
16 | get { return m_scene.Heightmap.Height; } | 16 | get { return m_scene.Heightmap.Height; } |
17 | } | 17 | } |
18 | 18 | ||
19 | public int Width | 19 | public int Width |
20 | { | 20 | { |
21 | get { return m_scene.Heightmap.Width; } | 21 | get { return m_scene.Heightmap.Width; } |
22 | } | 22 | } |
23 | 23 | ||
24 | public double Get(int x, int y) | 24 | public double Get(int x, int y) |
25 | { | 25 | { |
26 | return m_scene.Heightmap[x, y]; | 26 | return m_scene.Heightmap[x, y]; |
27 | } | 27 | } |
28 | 28 | ||
29 | public void Set(int x, int y, double val) | 29 | public void Set(int x, int y, double val) |
30 | { | 30 | { |
31 | m_scene.Heightmap[x, y] = val; | 31 | m_scene.Heightmap[x, y] = val; |
32 | } | 32 | } |
33 | } | 33 | } |
34 | } | 34 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs index dcb70b4..c8b51b6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs | |||
@@ -1,29 +1,29 @@ | |||
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 log4net; | 5 | using log4net; |
6 | 6 | ||
7 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 7 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
8 | { | 8 | { |
9 | class Host : IHost | 9 | class Host : IHost |
10 | { | 10 | { |
11 | private readonly IObject m_obj; | 11 | private readonly IObject m_obj; |
12 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 12 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
13 | 13 | ||
14 | public Host(IObject m_obj) | 14 | public Host(IObject m_obj) |
15 | { | 15 | { |
16 | this.m_obj = m_obj; | 16 | this.m_obj = m_obj; |
17 | } | 17 | } |
18 | 18 | ||
19 | public IObject Object | 19 | public IObject Object |
20 | { | 20 | { |
21 | get { return m_obj; } | 21 | get { return m_obj; } |
22 | } | 22 | } |
23 | 23 | ||
24 | public ILog Console | 24 | public ILog Console |
25 | { | 25 | { |
26 | get { return m_log; } | 26 | get { return m_log; } |
27 | } | 27 | } |
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs index ba92c64..270ed89 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs | |||
@@ -1,14 +1,14 @@ | |||
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 OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | interface IAvatar | 8 | interface IAvatar |
9 | { | 9 | { |
10 | string Name { get; } | 10 | string Name { get; } |
11 | UUID GlobalID { get; } | 11 | UUID GlobalID { get; } |
12 | Vector3 Position { get; } | 12 | Vector3 Position { get; } |
13 | } | 13 | } |
14 | } | 14 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs index b4502a4..84d602a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs | |||
@@ -1,14 +1,14 @@ | |||
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.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | public interface IHeightmap | 7 | public interface IHeightmap |
8 | { | 8 | { |
9 | int Height { get; } | 9 | int Height { get; } |
10 | int Width { get; } | 10 | int Width { get; } |
11 | double Get(int x, int y); | 11 | double Get(int x, int y); |
12 | void Set(int x, int y, double val); | 12 | void Set(int x, int y, double val); |
13 | } | 13 | } |
14 | } | 14 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHost.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHost.cs index 8f95ba7..123fa38 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHost.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHost.cs | |||
@@ -1,13 +1,13 @@ | |||
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 log4net; | 4 | using log4net; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | public interface IHost | 8 | public interface IHost |
9 | { | 9 | { |
10 | IObject Object { get; } | 10 | IObject Object { get; } |
11 | ILog Console { get; } | 11 | ILog Console { get; } |
12 | } | 12 | } |
13 | } | 13 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs index ef442d4..0c7bfc0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Drawing; | 2 | using System.Drawing; |
3 | using OpenMetaverse; | 3 | using OpenMetaverse; |
4 | 4 | ||
5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | public interface IObject | 7 | public interface IObject |
8 | { | 8 | { |
9 | bool Exists { get; } | 9 | bool Exists { get; } |
10 | uint LocalID { get; } | 10 | uint LocalID { get; } |
11 | UUID GlobalID { get; } | 11 | UUID GlobalID { get; } |
12 | 12 | ||
13 | IObject[] Children { get; } | 13 | IObject[] Children { get; } |
14 | 14 | ||
15 | /// <summary> | 15 | /// <summary> |
16 | /// Equals 'this' if we have no parent. Ergo, Root.Children.Count will always return the total number of items in the linkset. | 16 | /// Equals 'this' if we have no parent. Ergo, Root.Children.Count will always return the total number of items in the linkset. |
17 | /// </summary> | 17 | /// </summary> |
18 | IObject Root { get; } | 18 | IObject Root { get; } |
19 | 19 | ||
20 | IObjectFace[] Faces { get; } | 20 | IObjectFace[] Faces { get; } |
21 | 21 | ||
22 | Vector3 Scale { get; set; } | 22 | Vector3 Scale { get; set; } |
23 | Quaternion Rotation { get; set; } | 23 | Quaternion Rotation { get; set; } |
24 | 24 | ||
25 | Vector3 SitTarget { get; set; } | 25 | Vector3 SitTarget { get; set; } |
26 | String SitTargetText { get; set; } | 26 | String SitTargetText { get; set; } |
27 | 27 | ||
28 | String TouchText { get; set; } | 28 | String TouchText { get; set; } |
29 | 29 | ||
30 | String Text { get; set; } | 30 | String Text { get; set; } |
31 | 31 | ||
32 | bool IsPhysical { get; set; } // SetStatus(PHYSICS) | 32 | bool IsPhysical { get; set; } // SetStatus(PHYSICS) |
33 | bool IsPhantom { get; set; } // SetStatus(PHANTOM) | 33 | bool IsPhantom { get; set; } // SetStatus(PHANTOM) |
34 | bool IsRotationLockedX { get; set; } // SetStatus(!ROTATE_X) | 34 | bool IsRotationLockedX { get; set; } // SetStatus(!ROTATE_X) |
35 | bool IsRotationLockedY { get; set; } // SetStatus(!ROTATE_Y) | 35 | bool IsRotationLockedY { get; set; } // SetStatus(!ROTATE_Y) |
36 | bool IsRotationLockedZ { get; set; } // SetStatus(!ROTATE_Z) | 36 | bool IsRotationLockedZ { get; set; } // SetStatus(!ROTATE_Z) |
37 | bool IsSandboxed { get; set; } // SetStatus(SANDBOX) | 37 | bool IsSandboxed { get; set; } // SetStatus(SANDBOX) |
38 | bool IsImmotile { get; set; } // SetStatus(BLOCK_GRAB) | 38 | bool IsImmotile { get; set; } // SetStatus(BLOCK_GRAB) |
39 | bool IsAlwaysReturned { get; set; } // SetStatus(!DIE_AT_EDGE) | 39 | bool IsAlwaysReturned { get; set; } // SetStatus(!DIE_AT_EDGE) |
40 | bool IsTemporary { get; set; } // TEMP_ON_REZ | 40 | bool IsTemporary { get; set; } // TEMP_ON_REZ |
41 | 41 | ||
42 | bool IsFlexible { get; set; } | 42 | bool IsFlexible { get; set; } |
43 | 43 | ||
44 | PrimType PrimShape { get; set; } | 44 | PrimType PrimShape { get; set; } |
45 | // TODO: | 45 | // TODO: |
46 | // PrimHole | 46 | // PrimHole |
47 | // Repeats, Offsets, Cut/Dimple/ProfileCut | 47 | // Repeats, Offsets, Cut/Dimple/ProfileCut |
48 | // Hollow, Twist, HoleSize, | 48 | // Hollow, Twist, HoleSize, |
49 | // Taper[A+B], Shear[A+B], Revolutions, | 49 | // Taper[A+B], Shear[A+B], Revolutions, |
50 | // RadiusOffset, Skew | 50 | // RadiusOffset, Skew |
51 | 51 | ||
52 | Material Material { get; set; } | 52 | Material Material { get; set; } |
53 | } | 53 | } |
54 | 54 | ||
55 | public enum Material | 55 | public enum Material |
56 | { | 56 | { |
57 | Default, | 57 | Default, |
58 | Glass, | 58 | Glass, |
59 | Metal, | 59 | Metal, |
60 | Plastic, | 60 | Plastic, |
61 | Wood, | 61 | Wood, |
62 | Rubber, | 62 | Rubber, |
63 | Stone, | 63 | Stone, |
64 | Flesh | 64 | Flesh |
65 | } | 65 | } |
66 | 66 | ||
67 | public enum PrimType | 67 | public enum PrimType |
68 | { | 68 | { |
69 | NotPrimitive = 255, | 69 | NotPrimitive = 255, |
70 | Box = 0, | 70 | Box = 0, |
71 | Cylinder = 1, | 71 | Cylinder = 1, |
72 | Prism = 2, | 72 | Prism = 2, |
73 | Sphere = 3, | 73 | Sphere = 3, |
74 | Torus = 4, | 74 | Torus = 4, |
75 | Tube = 5, | 75 | Tube = 5, |
76 | Ring = 6, | 76 | Ring = 6, |
77 | Sculpt = 7 | 77 | Sculpt = 7 |
78 | } | 78 | } |
79 | 79 | ||
80 | public enum TextureMapping | 80 | public enum TextureMapping |
81 | { | 81 | { |
82 | Default, | 82 | Default, |
83 | Planar | 83 | Planar |
84 | } | 84 | } |
85 | 85 | ||
86 | public interface IObjectFace | 86 | public interface IObjectFace |
87 | { | 87 | { |
88 | Color Color { get; set; } | 88 | Color Color { get; set; } |
89 | UUID Texture { get; set; } | 89 | UUID Texture { get; set; } |
90 | TextureMapping Mapping { get; set; } // SetPrimParms(PRIM_TEXGEN) | 90 | TextureMapping Mapping { get; set; } // SetPrimParms(PRIM_TEXGEN) |
91 | bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) | 91 | bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) |
92 | double Bloom { get; set; } // SetPrimParms(GLOW) | 92 | double Bloom { get; set; } // SetPrimParms(GLOW) |
93 | bool Shiny { get; set; } // SetPrimParms(SHINY) | 93 | bool Shiny { get; set; } // SetPrimParms(SHINY) |
94 | bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECIATE IN FAVOUR OF UUID?] | 94 | bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECIATE IN FAVOUR OF UUID?] |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index 2f1388e..ea74524 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.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 | 4 | ||
5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | public interface IWorld | 7 | public interface IWorld |
8 | { | 8 | { |
9 | IObject[] Objects { get; } | 9 | IObject[] Objects { get; } |
10 | IHeightmap Terrain { get; } | 10 | IHeightmap Terrain { get; } |
11 | } | 11 | } |
12 | } | 12 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs index b2e6d2e..cbef1ca 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs | |||
@@ -1,27 +1,27 @@ | |||
1 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 1 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
2 | { | 2 | { |
3 | public abstract class MRMBase | 3 | public abstract class MRMBase |
4 | { | 4 | { |
5 | private IWorld m_world; | 5 | private IWorld m_world; |
6 | private IHost m_host; | 6 | private IHost m_host; |
7 | 7 | ||
8 | public void InitMiniModule(IWorld world, IHost host) | 8 | public void InitMiniModule(IWorld world, IHost host) |
9 | { | 9 | { |
10 | m_world = world; | 10 | m_world = world; |
11 | m_host = host; | 11 | m_host = host; |
12 | } | 12 | } |
13 | 13 | ||
14 | protected IWorld World | 14 | protected IWorld World |
15 | { | 15 | { |
16 | get { return m_world; } | 16 | get { return m_world; } |
17 | } | 17 | } |
18 | 18 | ||
19 | protected IHost Host | 19 | protected IHost Host |
20 | { | 20 | { |
21 | get { return m_host; } | 21 | get { return m_host; } |
22 | } | 22 | } |
23 | 23 | ||
24 | public abstract void Start(); | 24 | public abstract void Start(); |
25 | public abstract void Stop(); | 25 | public abstract void Stop(); |
26 | } | 26 | } |
27 | } | 27 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 86a3240..1536445 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -1,235 +1,235 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.CodeDom.Compiler; | 2 | using System.CodeDom.Compiler; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.IO; | 4 | using System.IO; |
5 | using System.Reflection; | 5 | using System.Reflection; |
6 | using System.Text; | 6 | using System.Text; |
7 | using log4net; | 7 | using log4net; |
8 | using Microsoft.CSharp; | 8 | using Microsoft.CSharp; |
9 | using Nini.Config; | 9 | using Nini.Config; |
10 | using OpenMetaverse; | 10 | using OpenMetaverse; |
11 | using OpenSim.Region.Framework.Interfaces; | 11 | using OpenSim.Region.Framework.Interfaces; |
12 | using OpenSim.Region.Framework.Scenes; | 12 | using OpenSim.Region.Framework.Scenes; |
13 | 13 | ||
14 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 14 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
15 | { | 15 | { |
16 | public class MRMModule : IRegionModule | 16 | public class MRMModule : IRegionModule |
17 | { | 17 | { |
18 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 18 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
19 | private Scene m_scene; | 19 | private Scene m_scene; |
20 | 20 | ||
21 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); | 21 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); |
22 | 22 | ||
23 | private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); | 23 | private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); |
24 | 24 | ||
25 | public void Initialise(Scene scene, IConfigSource source) | 25 | public void Initialise(Scene scene, IConfigSource source) |
26 | { | 26 | { |
27 | if (source.Configs["MRM"] != null) | 27 | if (source.Configs["MRM"] != null) |
28 | { | 28 | { |
29 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | 29 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) |
30 | { | 30 | { |
31 | m_log.Info("[MRM] Enabling MRM Module"); | 31 | m_log.Info("[MRM] Enabling MRM Module"); |
32 | m_scene = scene; | 32 | m_scene = scene; |
33 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | 33 | scene.EventManager.OnRezScript += EventManager_OnRezScript; |
34 | } | 34 | } |
35 | else | 35 | else |
36 | { | 36 | { |
37 | m_log.Info("[MRM] Disabled MRM Module (Express)"); | 37 | m_log.Info("[MRM] Disabled MRM Module (Express)"); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | else | 40 | else |
41 | { | 41 | { |
42 | m_log.Info("[MRM] Disabled MRM Module (Omission)"); | 42 | m_log.Info("[MRM] Disabled MRM Module (Omission)"); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | 46 | void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
47 | { | 47 | { |
48 | if (script.StartsWith("//MiniMod:C#")) | 48 | if (script.StartsWith("//MiniMod:C#")) |
49 | { | 49 | { |
50 | m_log.Info("[MRM] Found C# MRM"); | 50 | m_log.Info("[MRM] Found C# MRM"); |
51 | IWorld m_world = new World(m_scene); | 51 | IWorld m_world = new World(m_scene); |
52 | IHost m_host = new Host(new SOPObject(m_scene, localID)); | 52 | IHost m_host = new Host(new SOPObject(m_scene, localID)); |
53 | 53 | ||
54 | MRMBase mmb = (MRMBase) AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap( | 54 | MRMBase mmb = (MRMBase) AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap( |
55 | CompileFromDotNetText(script, itemID.ToString()), | 55 | CompileFromDotNetText(script, itemID.ToString()), |
56 | "OpenSim.MiniModule"); | 56 | "OpenSim.MiniModule"); |
57 | m_log.Info("[MRM] Created MRM Instance"); | 57 | m_log.Info("[MRM] Created MRM Instance"); |
58 | mmb.InitMiniModule(m_world, m_host); | 58 | mmb.InitMiniModule(m_world, m_host); |
59 | m_scripts[itemID] = mmb; | 59 | m_scripts[itemID] = mmb; |
60 | 60 | ||
61 | m_log.Info("[MRM] Starting MRM"); | 61 | m_log.Info("[MRM] Starting MRM"); |
62 | mmb.Start(); | 62 | mmb.Start(); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | public void PostInitialise() | 66 | public void PostInitialise() |
67 | { | 67 | { |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | public void Close() | 71 | public void Close() |
72 | { | 72 | { |
73 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) | 73 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) |
74 | { | 74 | { |
75 | pair.Value.Stop(); | 75 | pair.Value.Stop(); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | public string Name | 79 | public string Name |
80 | { | 80 | { |
81 | get { return "MiniRegionModule"; } | 81 | get { return "MiniRegionModule"; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public bool IsSharedModule | 84 | public bool IsSharedModule |
85 | { | 85 | { |
86 | get { return false; } | 86 | get { return false; } |
87 | } | 87 | } |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// Stolen from ScriptEngine Common | 90 | /// Stolen from ScriptEngine Common |
91 | /// </summary> | 91 | /// </summary> |
92 | /// <param name="Script"></param> | 92 | /// <param name="Script"></param> |
93 | /// <param name="uuid">Unique ID for this module</param> | 93 | /// <param name="uuid">Unique ID for this module</param> |
94 | /// <returns></returns> | 94 | /// <returns></returns> |
95 | internal string CompileFromDotNetText(string Script, string uuid) | 95 | internal string CompileFromDotNetText(string Script, string uuid) |
96 | { | 96 | { |
97 | const string ext = ".cs"; | 97 | const string ext = ".cs"; |
98 | const string FilePrefix = "MiniModule"; | 98 | const string FilePrefix = "MiniModule"; |
99 | 99 | ||
100 | // Output assembly name | 100 | // Output assembly name |
101 | string OutFile = Path.Combine("MiniModules", Path.Combine( | 101 | string OutFile = Path.Combine("MiniModules", Path.Combine( |
102 | m_scene.RegionInfo.RegionID.ToString(), | 102 | m_scene.RegionInfo.RegionID.ToString(), |
103 | FilePrefix + "_compiled_" + uuid + ".dll")); | 103 | FilePrefix + "_compiled_" + uuid + ".dll")); |
104 | 104 | ||
105 | // Create Directories for Assemblies | 105 | // Create Directories for Assemblies |
106 | if (!Directory.Exists("MiniModules")) | 106 | if (!Directory.Exists("MiniModules")) |
107 | Directory.CreateDirectory("MiniModules"); | 107 | Directory.CreateDirectory("MiniModules"); |
108 | string tmp = Path.Combine("MiniModules", m_scene.RegionInfo.RegionID.ToString()); | 108 | string tmp = Path.Combine("MiniModules", m_scene.RegionInfo.RegionID.ToString()); |
109 | if (!Directory.Exists(tmp)) | 109 | if (!Directory.Exists(tmp)) |
110 | Directory.CreateDirectory(tmp); | 110 | Directory.CreateDirectory(tmp); |
111 | 111 | ||
112 | try | 112 | try |
113 | { | 113 | { |
114 | File.Delete(OutFile); | 114 | File.Delete(OutFile); |
115 | } | 115 | } |
116 | catch (IOException e) | 116 | catch (IOException e) |
117 | { | 117 | { |
118 | throw new Exception("Unable to delete old existing " + | 118 | throw new Exception("Unable to delete old existing " + |
119 | "script-file before writing new. Compile aborted: " + | 119 | "script-file before writing new. Compile aborted: " + |
120 | e); | 120 | e); |
121 | } | 121 | } |
122 | 122 | ||
123 | // DEBUG - write source to disk | 123 | // DEBUG - write source to disk |
124 | string srcFileName = FilePrefix + "_source_" + | 124 | string srcFileName = FilePrefix + "_source_" + |
125 | Path.GetFileNameWithoutExtension(OutFile) + ext; | 125 | Path.GetFileNameWithoutExtension(OutFile) + ext; |
126 | try | 126 | try |
127 | { | 127 | { |
128 | File.WriteAllText(Path.Combine(Path.Combine( | 128 | File.WriteAllText(Path.Combine(Path.Combine( |
129 | "MiniModules", | 129 | "MiniModules", |
130 | m_scene.RegionInfo.RegionID.ToString()), | 130 | m_scene.RegionInfo.RegionID.ToString()), |
131 | srcFileName), Script); | 131 | srcFileName), Script); |
132 | } | 132 | } |
133 | catch (Exception ex) //NOTLEGIT - Should be just FileIOException | 133 | catch (Exception ex) //NOTLEGIT - Should be just FileIOException |
134 | { | 134 | { |
135 | m_log.Error("[Compiler]: Exception while " + | 135 | m_log.Error("[Compiler]: Exception while " + |
136 | "trying to write script source to file \"" + | 136 | "trying to write script source to file \"" + |
137 | srcFileName + "\": " + ex.ToString()); | 137 | srcFileName + "\": " + ex.ToString()); |
138 | } | 138 | } |
139 | 139 | ||
140 | // Do actual compile | 140 | // Do actual compile |
141 | CompilerParameters parameters = new CompilerParameters(); | 141 | CompilerParameters parameters = new CompilerParameters(); |
142 | 142 | ||
143 | parameters.IncludeDebugInformation = true; | 143 | parameters.IncludeDebugInformation = true; |
144 | 144 | ||
145 | string rootPath = | 145 | string rootPath = |
146 | Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | 146 | Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); |
147 | 147 | ||
148 | 148 | ||
149 | // TODO: Add Libraries | 149 | // TODO: Add Libraries |
150 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, | 150 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, |
151 | "OpenSim.Region.OptionalModules.dll")); | 151 | "OpenSim.Region.OptionalModules.dll")); |
152 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, | 152 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, |
153 | "log4net.dll")); | 153 | "log4net.dll")); |
154 | 154 | ||
155 | parameters.GenerateExecutable = false; | 155 | parameters.GenerateExecutable = false; |
156 | parameters.OutputAssembly = OutFile; | 156 | parameters.OutputAssembly = OutFile; |
157 | parameters.IncludeDebugInformation = true; | 157 | parameters.IncludeDebugInformation = true; |
158 | parameters.TreatWarningsAsErrors = false; | 158 | parameters.TreatWarningsAsErrors = false; |
159 | 159 | ||
160 | CompilerResults results = CScodeProvider.CompileAssemblyFromSource( | 160 | CompilerResults results = CScodeProvider.CompileAssemblyFromSource( |
161 | parameters, Script); | 161 | parameters, Script); |
162 | 162 | ||
163 | int display = 5; | 163 | int display = 5; |
164 | if (results.Errors.Count > 0) | 164 | if (results.Errors.Count > 0) |
165 | { | 165 | { |
166 | string errtext = String.Empty; | 166 | string errtext = String.Empty; |
167 | foreach (CompilerError CompErr in results.Errors) | 167 | foreach (CompilerError CompErr in results.Errors) |
168 | { | 168 | { |
169 | // Show 5 errors max | 169 | // Show 5 errors max |
170 | // | 170 | // |
171 | if (display <= 0) | 171 | if (display <= 0) |
172 | break; | 172 | break; |
173 | display--; | 173 | display--; |
174 | 174 | ||
175 | string severity = "Error"; | 175 | string severity = "Error"; |
176 | if (CompErr.IsWarning) | 176 | if (CompErr.IsWarning) |
177 | { | 177 | { |
178 | severity = "Warning"; | 178 | severity = "Warning"; |
179 | } | 179 | } |
180 | 180 | ||
181 | string text = CompErr.ErrorText; | 181 | string text = CompErr.ErrorText; |
182 | 182 | ||
183 | // The Second Life viewer's script editor begins | 183 | // The Second Life viewer's script editor begins |
184 | // countingn lines and columns at 0, so we subtract 1. | 184 | // countingn lines and columns at 0, so we subtract 1. |
185 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", | 185 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", |
186 | CompErr.Line - 1, CompErr.Column - 1, | 186 | CompErr.Line - 1, CompErr.Column - 1, |
187 | CompErr.ErrorNumber, text, severity); | 187 | CompErr.ErrorNumber, text, severity); |
188 | } | 188 | } |
189 | 189 | ||
190 | if (!File.Exists(OutFile)) | 190 | if (!File.Exists(OutFile)) |
191 | { | 191 | { |
192 | throw new Exception(errtext); | 192 | throw new Exception(errtext); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | if (!File.Exists(OutFile)) | 196 | if (!File.Exists(OutFile)) |
197 | { | 197 | { |
198 | string errtext = String.Empty; | 198 | string errtext = String.Empty; |
199 | errtext += "No compile error. But not able to locate compiled file."; | 199 | errtext += "No compile error. But not able to locate compiled file."; |
200 | throw new Exception(errtext); | 200 | throw new Exception(errtext); |
201 | } | 201 | } |
202 | 202 | ||
203 | FileInfo fi = new FileInfo(OutFile); | 203 | FileInfo fi = new FileInfo(OutFile); |
204 | 204 | ||
205 | Byte[] data = new Byte[fi.Length]; | 205 | Byte[] data = new Byte[fi.Length]; |
206 | 206 | ||
207 | try | 207 | try |
208 | { | 208 | { |
209 | FileStream fs = File.Open(OutFile, FileMode.Open, FileAccess.Read); | 209 | FileStream fs = File.Open(OutFile, FileMode.Open, FileAccess.Read); |
210 | fs.Read(data, 0, data.Length); | 210 | fs.Read(data, 0, data.Length); |
211 | fs.Close(); | 211 | fs.Close(); |
212 | } | 212 | } |
213 | catch (IOException) | 213 | catch (IOException) |
214 | { | 214 | { |
215 | string errtext = String.Empty; | 215 | string errtext = String.Empty; |
216 | errtext += "No compile error. But not able to open file."; | 216 | errtext += "No compile error. But not able to open file."; |
217 | throw new Exception(errtext); | 217 | throw new Exception(errtext); |
218 | } | 218 | } |
219 | 219 | ||
220 | // Convert to base64 | 220 | // Convert to base64 |
221 | // | 221 | // |
222 | string filetext = Convert.ToBase64String(data); | 222 | string filetext = Convert.ToBase64String(data); |
223 | 223 | ||
224 | ASCIIEncoding enc = new ASCIIEncoding(); | 224 | ASCIIEncoding enc = new ASCIIEncoding(); |
225 | 225 | ||
226 | Byte[] buf = enc.GetBytes(filetext); | 226 | Byte[] buf = enc.GetBytes(filetext); |
227 | 227 | ||
228 | FileStream sfs = File.Create(OutFile + ".cil.b64"); | 228 | FileStream sfs = File.Create(OutFile + ".cil.b64"); |
229 | sfs.Write(buf, 0, buf.Length); | 229 | sfs.Write(buf, 0, buf.Length); |
230 | sfs.Close(); | 230 | sfs.Close(); |
231 | 231 | ||
232 | return OutFile; | 232 | return OutFile; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | } | 235 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index d939e85..e154b79 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -1,317 +1,317 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenMetaverse; | 2 | using OpenMetaverse; |
3 | using OpenSim.Framework; | 3 | using OpenSim.Framework; |
4 | using OpenSim.Region.Framework.Scenes; | 4 | using OpenSim.Region.Framework.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | class SOPObject : IObject | 8 | class SOPObject : IObject |
9 | { | 9 | { |
10 | private readonly Scene m_rootScene; | 10 | private readonly Scene m_rootScene; |
11 | private readonly uint m_localID; | 11 | private readonly uint m_localID; |
12 | 12 | ||
13 | public SOPObject(Scene rootScene, uint localID) | 13 | public SOPObject(Scene rootScene, uint localID) |
14 | { | 14 | { |
15 | m_rootScene = rootScene; | 15 | m_rootScene = rootScene; |
16 | m_localID = localID; | 16 | m_localID = localID; |
17 | } | 17 | } |
18 | 18 | ||
19 | /// <summary> | 19 | /// <summary> |
20 | /// This needs to run very, very quickly. | 20 | /// This needs to run very, very quickly. |
21 | /// It is utilized in nearly every property and method. | 21 | /// It is utilized in nearly every property and method. |
22 | /// </summary> | 22 | /// </summary> |
23 | /// <returns></returns> | 23 | /// <returns></returns> |
24 | private SceneObjectPart GetSOP() | 24 | private SceneObjectPart GetSOP() |
25 | { | 25 | { |
26 | if (m_rootScene.Entities.ContainsKey(m_localID)) | 26 | if (m_rootScene.Entities.ContainsKey(m_localID)) |
27 | return ((SceneObjectGroup) m_rootScene.Entities[m_localID]).RootPart; | 27 | return ((SceneObjectGroup) m_rootScene.Entities[m_localID]).RootPart; |
28 | 28 | ||
29 | return null; | 29 | return null; |
30 | } | 30 | } |
31 | 31 | ||
32 | public bool Exists | 32 | public bool Exists |
33 | { | 33 | { |
34 | get { return GetSOP() != null; } | 34 | get { return GetSOP() != null; } |
35 | } | 35 | } |
36 | 36 | ||
37 | public uint LocalID | 37 | public uint LocalID |
38 | { | 38 | { |
39 | get { return m_localID; } | 39 | get { return m_localID; } |
40 | } | 40 | } |
41 | 41 | ||
42 | public UUID GlobalID | 42 | public UUID GlobalID |
43 | { | 43 | { |
44 | get { return GetSOP().UUID; } | 44 | get { return GetSOP().UUID; } |
45 | } | 45 | } |
46 | 46 | ||
47 | public IObject[] Children | 47 | public IObject[] Children |
48 | { | 48 | { |
49 | get | 49 | get |
50 | { | 50 | { |
51 | SceneObjectPart my = GetSOP(); | 51 | SceneObjectPart my = GetSOP(); |
52 | int total = my.ParentGroup.Children.Count; | 52 | int total = my.ParentGroup.Children.Count; |
53 | 53 | ||
54 | IObject[] rets = new IObject[total]; | 54 | IObject[] rets = new IObject[total]; |
55 | 55 | ||
56 | int i = 0; | 56 | int i = 0; |
57 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) | 57 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) |
58 | { | 58 | { |
59 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); | 59 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); |
60 | } | 60 | } |
61 | 61 | ||
62 | return rets; | 62 | return rets; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | public IObject Root | 66 | public IObject Root |
67 | { | 67 | { |
68 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } | 68 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } |
69 | } | 69 | } |
70 | 70 | ||
71 | public IObjectFace[] Faces | 71 | public IObjectFace[] Faces |
72 | { | 72 | { |
73 | get | 73 | get |
74 | { | 74 | { |
75 | SceneObjectPart sop = GetSOP(); | 75 | SceneObjectPart sop = GetSOP(); |
76 | IObjectFace[] rets = new IObjectFace[getNumberOfSides(sop)]; | 76 | IObjectFace[] rets = new IObjectFace[getNumberOfSides(sop)]; |
77 | 77 | ||
78 | for (int i = 0; i < rets.Length;i++ ) | 78 | for (int i = 0; i < rets.Length;i++ ) |
79 | { | 79 | { |
80 | //rets[i] = new ObjectFace | 80 | //rets[i] = new ObjectFace |
81 | } | 81 | } |
82 | 82 | ||
83 | return rets; | 83 | return rets; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | public Vector3 Scale | 87 | public Vector3 Scale |
88 | { | 88 | { |
89 | get { return GetSOP().Scale; } | 89 | get { return GetSOP().Scale; } |
90 | set { GetSOP().Scale = value; } | 90 | set { GetSOP().Scale = value; } |
91 | } | 91 | } |
92 | 92 | ||
93 | public Quaternion Rotation | 93 | public Quaternion Rotation |
94 | { | 94 | { |
95 | get { throw new System.NotImplementedException(); } | 95 | get { throw new System.NotImplementedException(); } |
96 | set { throw new System.NotImplementedException(); } | 96 | set { throw new System.NotImplementedException(); } |
97 | } | 97 | } |
98 | 98 | ||
99 | public Vector3 SitTarget | 99 | public Vector3 SitTarget |
100 | { | 100 | { |
101 | get { throw new System.NotImplementedException(); } | 101 | get { throw new System.NotImplementedException(); } |
102 | set { throw new System.NotImplementedException(); } | 102 | set { throw new System.NotImplementedException(); } |
103 | } | 103 | } |
104 | 104 | ||
105 | public string SitTargetText | 105 | public string SitTargetText |
106 | { | 106 | { |
107 | get { throw new System.NotImplementedException(); } | 107 | get { throw new System.NotImplementedException(); } |
108 | set { throw new System.NotImplementedException(); } | 108 | set { throw new System.NotImplementedException(); } |
109 | } | 109 | } |
110 | 110 | ||
111 | public string TouchText | 111 | public string TouchText |
112 | { | 112 | { |
113 | get { throw new System.NotImplementedException(); } | 113 | get { throw new System.NotImplementedException(); } |
114 | set { throw new System.NotImplementedException(); } | 114 | set { throw new System.NotImplementedException(); } |
115 | } | 115 | } |
116 | 116 | ||
117 | public string Text | 117 | public string Text |
118 | { | 118 | { |
119 | get { throw new System.NotImplementedException(); } | 119 | get { throw new System.NotImplementedException(); } |
120 | set { throw new System.NotImplementedException(); } | 120 | set { throw new System.NotImplementedException(); } |
121 | } | 121 | } |
122 | 122 | ||
123 | public bool IsPhysical | 123 | public bool IsPhysical |
124 | { | 124 | { |
125 | get { throw new System.NotImplementedException(); } | 125 | get { throw new System.NotImplementedException(); } |
126 | set { throw new System.NotImplementedException(); } | 126 | set { throw new System.NotImplementedException(); } |
127 | } | 127 | } |
128 | 128 | ||
129 | public bool IsPhantom | 129 | public bool IsPhantom |
130 | { | 130 | { |
131 | get { throw new System.NotImplementedException(); } | 131 | get { throw new System.NotImplementedException(); } |
132 | set { throw new System.NotImplementedException(); } | 132 | set { throw new System.NotImplementedException(); } |
133 | } | 133 | } |
134 | 134 | ||
135 | public bool IsRotationLockedX | 135 | public bool IsRotationLockedX |
136 | { | 136 | { |
137 | get { throw new System.NotImplementedException(); } | 137 | get { throw new System.NotImplementedException(); } |
138 | set { throw new System.NotImplementedException(); } | 138 | set { throw new System.NotImplementedException(); } |
139 | } | 139 | } |
140 | 140 | ||
141 | public bool IsRotationLockedY | 141 | public bool IsRotationLockedY |
142 | { | 142 | { |
143 | get { throw new System.NotImplementedException(); } | 143 | get { throw new System.NotImplementedException(); } |
144 | set { throw new System.NotImplementedException(); } | 144 | set { throw new System.NotImplementedException(); } |
145 | } | 145 | } |
146 | 146 | ||
147 | public bool IsRotationLockedZ | 147 | public bool IsRotationLockedZ |
148 | { | 148 | { |
149 | get { throw new System.NotImplementedException(); } | 149 | get { throw new System.NotImplementedException(); } |
150 | set { throw new System.NotImplementedException(); } | 150 | set { throw new System.NotImplementedException(); } |
151 | } | 151 | } |
152 | 152 | ||
153 | public bool IsSandboxed | 153 | public bool IsSandboxed |
154 | { | 154 | { |
155 | get { throw new System.NotImplementedException(); } | 155 | get { throw new System.NotImplementedException(); } |
156 | set { throw new System.NotImplementedException(); } | 156 | set { throw new System.NotImplementedException(); } |
157 | } | 157 | } |
158 | 158 | ||
159 | public bool IsImmotile | 159 | public bool IsImmotile |
160 | { | 160 | { |
161 | get { throw new System.NotImplementedException(); } | 161 | get { throw new System.NotImplementedException(); } |
162 | set { throw new System.NotImplementedException(); } | 162 | set { throw new System.NotImplementedException(); } |
163 | } | 163 | } |
164 | 164 | ||
165 | public bool IsAlwaysReturned | 165 | public bool IsAlwaysReturned |
166 | { | 166 | { |
167 | get { throw new System.NotImplementedException(); } | 167 | get { throw new System.NotImplementedException(); } |
168 | set { throw new System.NotImplementedException(); } | 168 | set { throw new System.NotImplementedException(); } |
169 | } | 169 | } |
170 | 170 | ||
171 | public bool IsTemporary | 171 | public bool IsTemporary |
172 | { | 172 | { |
173 | get { throw new System.NotImplementedException(); } | 173 | get { throw new System.NotImplementedException(); } |
174 | set { throw new System.NotImplementedException(); } | 174 | set { throw new System.NotImplementedException(); } |
175 | } | 175 | } |
176 | 176 | ||
177 | public bool IsFlexible | 177 | public bool IsFlexible |
178 | { | 178 | { |
179 | get { throw new System.NotImplementedException(); } | 179 | get { throw new System.NotImplementedException(); } |
180 | set { throw new System.NotImplementedException(); } | 180 | set { throw new System.NotImplementedException(); } |
181 | } | 181 | } |
182 | 182 | ||
183 | public PrimType PrimShape | 183 | public PrimType PrimShape |
184 | { | 184 | { |
185 | get { return (PrimType) getScriptPrimType(GetSOP().Shape); } | 185 | get { return (PrimType) getScriptPrimType(GetSOP().Shape); } |
186 | set { throw new System.NotImplementedException(); } | 186 | set { throw new System.NotImplementedException(); } |
187 | } | 187 | } |
188 | 188 | ||
189 | public Material Material | 189 | public Material Material |
190 | { | 190 | { |
191 | get { throw new System.NotImplementedException(); } | 191 | get { throw new System.NotImplementedException(); } |
192 | set { throw new System.NotImplementedException(); } | 192 | set { throw new System.NotImplementedException(); } |
193 | } | 193 | } |
194 | 194 | ||
195 | 195 | ||
196 | #region Supporting Functions | 196 | #region Supporting Functions |
197 | 197 | ||
198 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces | 198 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces |
199 | private static void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | 199 | private static void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, |
200 | out bool hasDimple, out bool hasProfileCut) | 200 | out bool hasDimple, out bool hasProfileCut) |
201 | { | 201 | { |
202 | if (primType == (int)PrimType.Box | 202 | if (primType == (int)PrimType.Box |
203 | || | 203 | || |
204 | primType == (int)PrimType.Cylinder | 204 | primType == (int)PrimType.Cylinder |
205 | || | 205 | || |
206 | primType == (int)PrimType.Prism) | 206 | primType == (int)PrimType.Prism) |
207 | 207 | ||
208 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | 208 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); |
209 | else | 209 | else |
210 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | 210 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); |
211 | 211 | ||
212 | hasHollow = shape.ProfileHollow > 0; | 212 | hasHollow = shape.ProfileHollow > 0; |
213 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | 213 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms |
214 | hasProfileCut = hasDimple; // is it the same thing? | 214 | hasProfileCut = hasDimple; // is it the same thing? |
215 | 215 | ||
216 | } | 216 | } |
217 | 217 | ||
218 | private static int getScriptPrimType(PrimitiveBaseShape primShape) | 218 | private static int getScriptPrimType(PrimitiveBaseShape primShape) |
219 | { | 219 | { |
220 | if (primShape.SculptEntry) | 220 | if (primShape.SculptEntry) |
221 | return (int) PrimType.Sculpt; | 221 | return (int) PrimType.Sculpt; |
222 | if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square) | 222 | if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square) |
223 | { | 223 | { |
224 | if (primShape.PathCurve == (byte) Extrusion.Straight) | 224 | if (primShape.PathCurve == (byte) Extrusion.Straight) |
225 | return (int) PrimType.Box; | 225 | return (int) PrimType.Box; |
226 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | 226 | if (primShape.PathCurve == (byte) Extrusion.Curve1) |
227 | return (int) PrimType.Tube; | 227 | return (int) PrimType.Tube; |
228 | } | 228 | } |
229 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Circle) | 229 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Circle) |
230 | { | 230 | { |
231 | if (primShape.PathCurve == (byte) Extrusion.Straight) | 231 | if (primShape.PathCurve == (byte) Extrusion.Straight) |
232 | return (int) PrimType.Cylinder; | 232 | return (int) PrimType.Cylinder; |
233 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | 233 | if (primShape.PathCurve == (byte) Extrusion.Curve1) |
234 | return (int) PrimType.Torus; | 234 | return (int) PrimType.Torus; |
235 | } | 235 | } |
236 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.HalfCircle) | 236 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.HalfCircle) |
237 | { | 237 | { |
238 | if (primShape.PathCurve == (byte) Extrusion.Curve1 || primShape.PathCurve == (byte) Extrusion.Curve2) | 238 | if (primShape.PathCurve == (byte) Extrusion.Curve1 || primShape.PathCurve == (byte) Extrusion.Curve2) |
239 | return (int) PrimType.Sphere; | 239 | return (int) PrimType.Sphere; |
240 | } | 240 | } |
241 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.EquilateralTriangle) | 241 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.EquilateralTriangle) |
242 | { | 242 | { |
243 | if (primShape.PathCurve == (byte) Extrusion.Straight) | 243 | if (primShape.PathCurve == (byte) Extrusion.Straight) |
244 | return (int) PrimType.Prism; | 244 | return (int) PrimType.Prism; |
245 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | 245 | if (primShape.PathCurve == (byte) Extrusion.Curve1) |
246 | return (int) PrimType.Ring; | 246 | return (int) PrimType.Ring; |
247 | } | 247 | } |
248 | return (int) PrimType.NotPrimitive; | 248 | return (int) PrimType.NotPrimitive; |
249 | } | 249 | } |
250 | 250 | ||
251 | private static int getNumberOfSides(SceneObjectPart part) | 251 | private static int getNumberOfSides(SceneObjectPart part) |
252 | { | 252 | { |
253 | int ret; | 253 | int ret; |
254 | bool hasCut; | 254 | bool hasCut; |
255 | bool hasHollow; | 255 | bool hasHollow; |
256 | bool hasDimple; | 256 | bool hasDimple; |
257 | bool hasProfileCut; | 257 | bool hasProfileCut; |
258 | 258 | ||
259 | int primType = getScriptPrimType(part.Shape); | 259 | int primType = getScriptPrimType(part.Shape); |
260 | hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | 260 | hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); |
261 | 261 | ||
262 | switch (primType) | 262 | switch (primType) |
263 | { | 263 | { |
264 | default: | 264 | default: |
265 | case (int) PrimType.Box: | 265 | case (int) PrimType.Box: |
266 | ret = 6; | 266 | ret = 6; |
267 | if (hasCut) ret += 2; | 267 | if (hasCut) ret += 2; |
268 | if (hasHollow) ret += 1; | 268 | if (hasHollow) ret += 1; |
269 | break; | 269 | break; |
270 | case (int) PrimType.Cylinder: | 270 | case (int) PrimType.Cylinder: |
271 | ret = 3; | 271 | ret = 3; |
272 | if (hasCut) ret += 2; | 272 | if (hasCut) ret += 2; |
273 | if (hasHollow) ret += 1; | 273 | if (hasHollow) ret += 1; |
274 | break; | 274 | break; |
275 | case (int) PrimType.Prism: | 275 | case (int) PrimType.Prism: |
276 | ret = 5; | 276 | ret = 5; |
277 | if (hasCut) ret += 2; | 277 | if (hasCut) ret += 2; |
278 | if (hasHollow) ret += 1; | 278 | if (hasHollow) ret += 1; |
279 | break; | 279 | break; |
280 | case (int) PrimType.Sphere: | 280 | case (int) PrimType.Sphere: |
281 | ret = 1; | 281 | ret = 1; |
282 | if (hasCut) ret += 2; | 282 | if (hasCut) ret += 2; |
283 | if (hasDimple) ret += 2; | 283 | if (hasDimple) ret += 2; |
284 | if (hasHollow) | 284 | if (hasHollow) |
285 | ret += 1; // GOTCHA: LSL shows 2 additional sides here. | 285 | ret += 1; // GOTCHA: LSL shows 2 additional sides here. |
286 | // This has been fixed, but may cause porting issues. | 286 | // This has been fixed, but may cause porting issues. |
287 | break; | 287 | break; |
288 | case (int) PrimType.Torus: | 288 | case (int) PrimType.Torus: |
289 | ret = 1; | 289 | ret = 1; |
290 | if (hasCut) ret += 2; | 290 | if (hasCut) ret += 2; |
291 | if (hasProfileCut) ret += 2; | 291 | if (hasProfileCut) ret += 2; |
292 | if (hasHollow) ret += 1; | 292 | if (hasHollow) ret += 1; |
293 | break; | 293 | break; |
294 | case (int) PrimType.Tube: | 294 | case (int) PrimType.Tube: |
295 | ret = 4; | 295 | ret = 4; |
296 | if (hasCut) ret += 2; | 296 | if (hasCut) ret += 2; |
297 | if (hasProfileCut) ret += 2; | 297 | if (hasProfileCut) ret += 2; |
298 | if (hasHollow) ret += 1; | 298 | if (hasHollow) ret += 1; |
299 | break; | 299 | break; |
300 | case (int) PrimType.Ring: | 300 | case (int) PrimType.Ring: |
301 | ret = 3; | 301 | ret = 3; |
302 | if (hasCut) ret += 2; | 302 | if (hasCut) ret += 2; |
303 | if (hasProfileCut) ret += 2; | 303 | if (hasProfileCut) ret += 2; |
304 | if (hasHollow) ret += 1; | 304 | if (hasHollow) ret += 1; |
305 | break; | 305 | break; |
306 | case (int) PrimType.Sculpt: | 306 | case (int) PrimType.Sculpt: |
307 | ret = 1; | 307 | ret = 1; |
308 | break; | 308 | break; |
309 | } | 309 | } |
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
313 | 313 | ||
314 | #endregion | 314 | #endregion |
315 | 315 | ||
316 | } | 316 | } |
317 | } | 317 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 6c7f854..b1a4394 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -1,39 +1,39 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Region.Framework.Scenes; | 2 | using OpenSim.Region.Framework.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
5 | { | 5 | { |
6 | public class World : IWorld | 6 | public class World : IWorld |
7 | { | 7 | { |
8 | private readonly Scene m_internalScene; | 8 | private readonly Scene m_internalScene; |
9 | private readonly Heightmap m_heights; | 9 | private readonly Heightmap m_heights; |
10 | 10 | ||
11 | public World(Scene internalScene) | 11 | public World(Scene internalScene) |
12 | { | 12 | { |
13 | m_internalScene = internalScene; | 13 | m_internalScene = internalScene; |
14 | m_heights = new Heightmap(m_internalScene); | 14 | m_heights = new Heightmap(m_internalScene); |
15 | } | 15 | } |
16 | 16 | ||
17 | public IObject[] Objects | 17 | public IObject[] Objects |
18 | { | 18 | { |
19 | get | 19 | get |
20 | { | 20 | { |
21 | List<EntityBase> ents = m_internalScene.Entities.GetAllByType<SceneObjectGroup>(); | 21 | List<EntityBase> ents = m_internalScene.Entities.GetAllByType<SceneObjectGroup>(); |
22 | IObject[] rets = new IObject[ents.Count]; | 22 | IObject[] rets = new IObject[ents.Count]; |
23 | 23 | ||
24 | for (int i = 0; i < ents.Count; i++) | 24 | for (int i = 0; i < ents.Count; i++) |
25 | { | 25 | { |
26 | EntityBase ent = ents[i]; | 26 | EntityBase ent = ents[i]; |
27 | rets[i] = new SOPObject(m_internalScene, ent.LocalId); | 27 | rets[i] = new SOPObject(m_internalScene, ent.LocalId); |
28 | } | 28 | } |
29 | 29 | ||
30 | return rets; | 30 | return rets; |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | public IHeightmap Terrain | 34 | public IHeightmap Terrain |
35 | { | 35 | { |
36 | get { return m_heights; } | 36 | get { return m_heights; } |
37 | } | 37 | } |
38 | } | 38 | } |
39 | } | 39 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/ObjectModules/IObjectModule.cs b/OpenSim/Region/OptionalModules/Scripting/ObjectModules/IObjectModule.cs index 923b053..6ced656 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ObjectModules/IObjectModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ObjectModules/IObjectModule.cs | |||
@@ -1,15 +1,15 @@ | |||
1 | using OpenSim.Region.Framework.Scenes; | 1 | using OpenSim.Region.Framework.Scenes; |
2 | 2 | ||
3 | namespace OpenSim.Region.OptionalModules.Scripting.ObjectModules | 3 | namespace OpenSim.Region.OptionalModules.Scripting.ObjectModules |
4 | { | 4 | { |
5 | interface IObjectModule | 5 | interface IObjectModule |
6 | { | 6 | { |
7 | void Add(EntityBase entity, Scene scene); | 7 | void Add(EntityBase entity, Scene scene); |
8 | void Start(); | 8 | void Start(); |
9 | void Stop(); | 9 | void Stop(); |
10 | void Tick(); | 10 | void Tick(); |
11 | 11 | ||
12 | string ClassName { get; } | 12 | string ClassName { get; } |
13 | bool IsShared { get; } | 13 | bool IsShared { get; } |
14 | } | 14 | } |
15 | } | 15 | } |