diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule')
44 files changed, 0 insertions, 4531 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs deleted file mode 100644 index 3f1bd54..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | class ExtensionHandler : IExtension | ||
36 | { | ||
37 | private readonly Dictionary<Type, object> m_instances; | ||
38 | |||
39 | public ExtensionHandler(Dictionary<Type, object> instances) | ||
40 | { | ||
41 | m_instances = instances; | ||
42 | } | ||
43 | |||
44 | public T Get<T>() | ||
45 | { | ||
46 | return (T) m_instances[typeof (T)]; | ||
47 | } | ||
48 | |||
49 | public bool TryGet<T>(out T extension) | ||
50 | { | ||
51 | if (!m_instances.ContainsKey(typeof(T))) | ||
52 | { | ||
53 | extension = default(T); | ||
54 | return false; | ||
55 | } | ||
56 | |||
57 | extension = Get<T>(); | ||
58 | return true; | ||
59 | } | ||
60 | |||
61 | public bool Has<T>() | ||
62 | { | ||
63 | return m_instances.ContainsKey(typeof (T)); | ||
64 | } | ||
65 | } | ||
66 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs deleted file mode 100644 index a0dc38b..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Drawing; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.Imaging; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
35 | { | ||
36 | class Graphics : System.MarshalByRefObject, IGraphics | ||
37 | { | ||
38 | private readonly Scene m_scene; | ||
39 | |||
40 | public Graphics(Scene m_scene) | ||
41 | { | ||
42 | this.m_scene = m_scene; | ||
43 | } | ||
44 | |||
45 | public UUID SaveBitmap(Bitmap data) | ||
46 | { | ||
47 | return SaveBitmap(data, false, true); | ||
48 | } | ||
49 | |||
50 | public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) | ||
51 | { | ||
52 | AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID.ToString()); | ||
53 | asset.Data = OpenJPEG.EncodeFromImage(data, lossless); | ||
54 | asset.Description = "MRM Image"; | ||
55 | asset.Local = false; | ||
56 | asset.Temporary = temporary; | ||
57 | m_scene.AssetService.Store(asset); | ||
58 | |||
59 | return asset.FullID; | ||
60 | } | ||
61 | |||
62 | public Bitmap LoadBitmap(UUID assetID) | ||
63 | { | ||
64 | AssetBase bmp = m_scene.AssetService.Get(assetID.ToString()); | ||
65 | ManagedImage outimg; | ||
66 | Image img; | ||
67 | OpenJPEG.DecodeToImage(bmp.Data, out outimg, out img); | ||
68 | |||
69 | return new Bitmap(img); | ||
70 | } | ||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs deleted file mode 100644 index 47c3085..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Region.Framework.Scenes; | ||
29 | |||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
31 | { | ||
32 | public class Heightmap : System.MarshalByRefObject, IHeightmap | ||
33 | { | ||
34 | private readonly Scene m_scene; | ||
35 | |||
36 | public Heightmap(Scene scene) | ||
37 | { | ||
38 | m_scene = scene; | ||
39 | } | ||
40 | |||
41 | public double this[int x, int y] | ||
42 | { | ||
43 | get { return Get(x, y); } | ||
44 | set { Set(x, y, value); } | ||
45 | } | ||
46 | |||
47 | public int Length | ||
48 | { | ||
49 | get { return m_scene.Heightmap.Height; } | ||
50 | } | ||
51 | |||
52 | public int Width | ||
53 | { | ||
54 | get { return m_scene.Heightmap.Width; } | ||
55 | } | ||
56 | |||
57 | protected double Get(int x, int y) | ||
58 | { | ||
59 | return m_scene.Heightmap[x, y]; | ||
60 | } | ||
61 | |||
62 | protected void Set(int x, int y, double val) | ||
63 | { | ||
64 | m_scene.Heightmap[x, y] = val; | ||
65 | } | ||
66 | } | ||
67 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs deleted file mode 100644 index cbde283..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Host.cs +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using log4net; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | class Host : System.MarshalByRefObject, IHost | ||
36 | { | ||
37 | private readonly IObject m_obj; | ||
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | private readonly IGraphics m_graphics; | ||
40 | private readonly IExtension m_extend; | ||
41 | private readonly IMicrothreader m_threader; | ||
42 | //private Scene m_scene; | ||
43 | |||
44 | public Host(IObject m_obj, Scene m_scene, IExtension m_extend, IMicrothreader m_threader) | ||
45 | { | ||
46 | this.m_obj = m_obj; | ||
47 | this.m_threader = m_threader; | ||
48 | this.m_extend = m_extend; | ||
49 | //this.m_scene = m_scene; | ||
50 | |||
51 | m_graphics = new Graphics(m_scene); | ||
52 | } | ||
53 | |||
54 | public IObject Object | ||
55 | { | ||
56 | get { return m_obj; } | ||
57 | } | ||
58 | |||
59 | public ILog Console | ||
60 | { | ||
61 | get { return m_log; } | ||
62 | } | ||
63 | |||
64 | public IGraphics Graphics | ||
65 | { | ||
66 | get { return m_graphics; } | ||
67 | } | ||
68 | |||
69 | public IExtension Extensions | ||
70 | { | ||
71 | get { return m_extend; } | ||
72 | } | ||
73 | |||
74 | public IMicrothreader Microthreads | ||
75 | { | ||
76 | get { return m_threader; } | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IMRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IMRMModule.cs deleted file mode 100644 index e957a62..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IMRMModule.cs +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
31 | { | ||
32 | public interface IMRMModule | ||
33 | { | ||
34 | void RegisterExtension<T>(T instance); | ||
35 | void InitializeMRM(MRMBase mmb, uint localID, UUID itemID); | ||
36 | void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs deleted file mode 100644 index 533d176..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
29 | { | ||
30 | public interface ISecurityCredential | ||
31 | { | ||
32 | ISocialEntity owner { get; } | ||
33 | bool CanEditObject(IObject target); | ||
34 | bool CanEditTerrain(int x, int y); | ||
35 | } | ||
36 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs deleted file mode 100644 index 3d49732..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | public interface IAvatar : IEntity | ||
36 | { | ||
37 | |||
38 | bool IsChildAgent { get; } | ||
39 | |||
40 | //// <value> | ||
41 | /// Array of worn attachments, empty but not null, if no attachments are worn | ||
42 | /// </value> | ||
43 | |||
44 | IAvatarAttachment[] Attachments { get; } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Request to open an url clientside | ||
48 | /// </summary> | ||
49 | void LoadUrl(IObject sender, string message, string url); | ||
50 | } | ||
51 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs deleted file mode 100644 index 2368a23..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
29 | { | ||
30 | public interface IAvatarAttachment | ||
31 | { | ||
32 | //// <value> | ||
33 | /// Describes where on the avatar the attachment is located | ||
34 | /// </value> | ||
35 | int Location { get ; } | ||
36 | |||
37 | //// <value> | ||
38 | /// Accessor to the rez'ed asset, representing the attachment | ||
39 | /// </value> | ||
40 | IObject Asset { get; } | ||
41 | } | ||
42 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IEntity.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IEntity.cs deleted file mode 100644 index 6ea23df..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IEntity.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | public interface IEntity | ||
36 | { | ||
37 | string Name { get; set; } | ||
38 | UUID GlobalID { get; } | ||
39 | Vector3 WorldPosition { get; set; } | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IExtension.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IExtension.cs deleted file mode 100644 index f5beebd..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IExtension.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces | ||
33 | { | ||
34 | public interface IExtension | ||
35 | { | ||
36 | T Get<T>(); | ||
37 | bool TryGet<T>(out T extension); | ||
38 | bool Has<T>(); | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IGraphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IGraphics.cs deleted file mode 100644 index 012cd37..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IGraphics.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Drawing; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
32 | { | ||
33 | public interface IGraphics | ||
34 | { | ||
35 | UUID SaveBitmap(Bitmap data); | ||
36 | UUID SaveBitmap(Bitmap data, bool lossless, bool temporary); | ||
37 | Bitmap LoadBitmap(UUID assetID); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHeightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHeightmap.cs deleted file mode 100644 index 93cbc5b..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHeightmap.cs +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
33 | { | ||
34 | public interface IHeightmap | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Returns [or sets] the heightmap value at specified coordinates. | ||
38 | /// </summary> | ||
39 | /// <param name="x">X Coordinate</param> | ||
40 | /// <param name="y">Y Coordinate</param> | ||
41 | /// <returns>A value in meters representing height. Can be negative. Value correlates with Z parameter in world coordinates</returns> | ||
42 | /// <example> | ||
43 | /// double heightVal = World.Heightmap[128,128]; | ||
44 | /// World.Heightmap[128,128] *= 5.0; | ||
45 | /// World.Heightmap[128,128] = 25; | ||
46 | /// </example> | ||
47 | double this[int x, int y] | ||
48 | { | ||
49 | get; | ||
50 | set; | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// The maximum length of the region (Y axis), exclusive. (eg Height = 256, max Y = 255). Minimum is always 0 inclusive. | ||
55 | /// </summary> | ||
56 | /// <example> | ||
57 | /// Host.Console.Info("The terrain length of this region is " + World.Heightmap.Length); | ||
58 | /// </example> | ||
59 | int Length { get; } | ||
60 | |||
61 | /// <summary> | ||
62 | /// The maximum width of the region (X axis), exclusive. (eg Width = 256, max X = 255). Minimum is always 0 inclusive. | ||
63 | /// </summary> | ||
64 | /// <example> | ||
65 | /// Host.Console.Info("The terrain width of this region is " + World.Heightmap.Width); | ||
66 | /// </example> | ||
67 | int Width { get; } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHost.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHost.cs deleted file mode 100644 index cf63fd6..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IHost.cs +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using log4net; | ||
32 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; | ||
33 | |||
34 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
35 | { | ||
36 | public interface IHost | ||
37 | { | ||
38 | IObject Object { get; } | ||
39 | ILog Console { get; } | ||
40 | IGraphics Graphics { get; } | ||
41 | IExtension Extensions { get; } | ||
42 | IMicrothreader Microthreads { get; } | ||
43 | } | ||
44 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs deleted file mode 100644 index d61f52a..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenMetaverse.Assets; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// This implements the methods needed to operate on individual inventory items. | ||
36 | /// </summary> | ||
37 | public interface IInventoryItem | ||
38 | { | ||
39 | int Type { get; } | ||
40 | UUID AssetID { get; } | ||
41 | T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new(); | ||
42 | } | ||
43 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs deleted file mode 100644 index 2723476..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces | ||
34 | { | ||
35 | public interface IMicrothreader | ||
36 | { | ||
37 | void Run(IEnumerable microthread); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs deleted file mode 100644 index dc2edd9..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ /dev/null | |||
@@ -1,245 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Drawing; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | [Serializable] | ||
36 | public class TouchEventArgs : EventArgs | ||
37 | { | ||
38 | public IAvatar Avatar; | ||
39 | |||
40 | public Vector3 TouchBiNormal; | ||
41 | public Vector3 TouchNormal; | ||
42 | public Vector3 TouchPosition; | ||
43 | |||
44 | public Vector2 TouchUV; | ||
45 | public Vector2 TouchST; | ||
46 | |||
47 | public int TouchMaterialIndex; | ||
48 | } | ||
49 | |||
50 | public delegate void OnTouchDelegate(IObject sender, TouchEventArgs e); | ||
51 | |||
52 | public interface IObject : IEntity | ||
53 | { | ||
54 | #region Events | ||
55 | |||
56 | event OnTouchDelegate OnTouch; | ||
57 | |||
58 | #endregion | ||
59 | |||
60 | /// <summary> | ||
61 | /// Returns whether or not this object is still in the world. | ||
62 | /// Eg, if you store an IObject reference, however the object | ||
63 | /// is deleted before you use it, it will throw a NullReference | ||
64 | /// exception. 'Exists' allows you to check the object is still | ||
65 | /// in play before utilizing it. | ||
66 | /// </summary> | ||
67 | /// <example> | ||
68 | /// IObject deleteMe = World.Objects[0]; | ||
69 | /// | ||
70 | /// if (deleteMe.Exists) { | ||
71 | /// deleteMe.Say("Hello, I still exist!"); | ||
72 | /// } | ||
73 | /// | ||
74 | /// World.Objects.Remove(deleteMe); | ||
75 | /// | ||
76 | /// if (!deleteMe.Exists) { | ||
77 | /// Host.Console.Info("I was deleted"); | ||
78 | /// } | ||
79 | /// </example> | ||
80 | /// <remarks> | ||
81 | /// Objects should be near-guarunteed to exist for any event which | ||
82 | /// passes them as an argument. Storing an object for a longer period | ||
83 | /// of time however will limit their reliability. | ||
84 | /// | ||
85 | /// It is a good practice to use Try/Catch blocks handling for | ||
86 | /// NullReferenceException, when accessing remote objects. | ||
87 | /// </remarks> | ||
88 | bool Exists { get; } | ||
89 | |||
90 | /// <summary> | ||
91 | /// The local region-unique ID for this object. | ||
92 | /// </summary> | ||
93 | uint LocalID { get; } | ||
94 | |||
95 | /// <summary> | ||
96 | /// The description assigned to this object. | ||
97 | /// </summary> | ||
98 | String Description { get; set; } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Returns the UUID of the Owner of the Object. | ||
102 | /// </summary> | ||
103 | UUID OwnerId { get; } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Returns the UUID of the Creator of the Object. | ||
107 | /// </summary> | ||
108 | UUID CreatorId { get; } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Returns the root object of a linkset. If this object is the root, it will return itself. | ||
112 | /// </summary> | ||
113 | IObject Root { get; } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Returns a collection of objects which are linked to the current object. Does not include the root object. | ||
117 | /// </summary> | ||
118 | IObject[] Children { get; } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Returns a list of materials attached to this object. Each may contain unique texture | ||
122 | /// and other visual information. For primitive based objects, this correlates with | ||
123 | /// Object Faces. For mesh based objects, this correlates with Materials. | ||
124 | /// </summary> | ||
125 | IObjectMaterial[] Materials { get; } | ||
126 | |||
127 | /// <summary> | ||
128 | /// The bounding box of the object. Primitive and Mesh objects alike are scaled to fit within these bounds. | ||
129 | /// </summary> | ||
130 | Vector3 Scale { get; set; } | ||
131 | |||
132 | /// <summary> | ||
133 | /// The rotation of the object relative to the Scene | ||
134 | /// </summary> | ||
135 | Quaternion WorldRotation { get; set; } | ||
136 | |||
137 | /// <summary> | ||
138 | /// The rotation of the object relative to a parent object | ||
139 | /// If root, works the same as WorldRotation | ||
140 | /// </summary> | ||
141 | Quaternion OffsetRotation { get; set; } | ||
142 | |||
143 | /// <summary> | ||
144 | /// The position of the object relative to a parent object | ||
145 | /// If root, works the same as WorldPosition | ||
146 | /// </summary> | ||
147 | Vector3 OffsetPosition { get; set; } | ||
148 | |||
149 | Vector3 SitTarget { get; set; } | ||
150 | String SitTargetText { get; set; } | ||
151 | |||
152 | String TouchText { get; set; } | ||
153 | |||
154 | /// <summary> | ||
155 | /// Text to be associated with this object, in the | ||
156 | /// Second Life(r) viewer, this is shown above the | ||
157 | /// object. | ||
158 | /// </summary> | ||
159 | String Text { get; set; } | ||
160 | |||
161 | bool IsRotationLockedX { get; set; } // SetStatus(!ROTATE_X) | ||
162 | bool IsRotationLockedY { get; set; } // SetStatus(!ROTATE_Y) | ||
163 | bool IsRotationLockedZ { get; set; } // SetStatus(!ROTATE_Z) | ||
164 | bool IsSandboxed { get; set; } // SetStatus(SANDBOX) | ||
165 | bool IsImmotile { get; set; } // SetStatus(BLOCK_GRAB) | ||
166 | bool IsAlwaysReturned { get; set; } // SetStatus(!DIE_AT_EDGE) | ||
167 | bool IsTemporary { get; set; } // TEMP_ON_REZ | ||
168 | |||
169 | bool IsFlexible { get; set; } | ||
170 | |||
171 | IObjectShape Shape { get; } | ||
172 | |||
173 | // TODO: | ||
174 | // PrimHole | ||
175 | // Repeats, Offsets, Cut/Dimple/ProfileCut | ||
176 | // Hollow, Twist, HoleSize, | ||
177 | // Taper[A+B], Shear[A+B], Revolutions, | ||
178 | // RadiusOffset, Skew | ||
179 | |||
180 | PhysicsMaterial PhysicsMaterial { get; set; } | ||
181 | |||
182 | IObjectPhysics Physics { get; } | ||
183 | |||
184 | IObjectSound Sound { get; } | ||
185 | |||
186 | /// <summary> | ||
187 | /// Causes the object to speak to its surroundings, | ||
188 | /// equivilent to LSL/OSSL llSay | ||
189 | /// </summary> | ||
190 | /// <param name="msg">The message to send to the user</param> | ||
191 | void Say(string msg); | ||
192 | |||
193 | /// <summary> | ||
194 | /// Causes the object to speak to on a specific channel, | ||
195 | /// equivilent to LSL/OSSL llSay | ||
196 | /// </summary> | ||
197 | /// <param name="msg">The message to send to the user</param> | ||
198 | /// <param name="channel">The channel on which to send the message</param> | ||
199 | void Say(string msg,int channel); | ||
200 | |||
201 | /// <summary> | ||
202 | /// Opens a Dialog Panel in the Users Viewer, | ||
203 | /// equivilent to LSL/OSSL llDialog | ||
204 | /// </summary> | ||
205 | /// <param name="avatar">The UUID of the Avatar to which the Dialog should be send</param> | ||
206 | /// <param name="message">The Message to display at the top of the Dialog</param> | ||
207 | /// <param name="buttons">The Strings that act as label/value of the Bottons in the Dialog</param> | ||
208 | /// <param name="chat_channel">The channel on which to send the response</param> | ||
209 | void Dialog(UUID avatar, string message, string[] buttons, int chat_channel); | ||
210 | |||
211 | //// <value> | ||
212 | /// Grants access to the objects inventory | ||
213 | /// </value> | ||
214 | IObjectInventory Inventory { get; } | ||
215 | } | ||
216 | |||
217 | public enum PhysicsMaterial | ||
218 | { | ||
219 | Default, | ||
220 | Glass, | ||
221 | Metal, | ||
222 | Plastic, | ||
223 | Wood, | ||
224 | Rubber, | ||
225 | Stone, | ||
226 | Flesh | ||
227 | } | ||
228 | |||
229 | public enum TextureMapping | ||
230 | { | ||
231 | Default, | ||
232 | Planar | ||
233 | } | ||
234 | |||
235 | public interface IObjectMaterial | ||
236 | { | ||
237 | Color Color { get; set; } | ||
238 | UUID Texture { get; set; } | ||
239 | TextureMapping Mapping { get; set; } // SetPrimParms(PRIM_TEXGEN) | ||
240 | bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) | ||
241 | double Bloom { get; set; } // SetPrimParms(GLOW) | ||
242 | bool Shiny { get; set; } // SetPrimParms(SHINY) | ||
243 | bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECATE IN FAVOUR OF UUID?] | ||
244 | } | ||
245 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObjectAccessor.cs deleted file mode 100644 index a6c8c36..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObjectAccessor.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
32 | { | ||
33 | public interface IObjectAccessor : ICollection<IObject> | ||
34 | { | ||
35 | IObject this[int index] { get; } | ||
36 | IObject this[uint index] { get; } | ||
37 | IObject this[UUID index] { get; } | ||
38 | IObject Create(Vector3 position); | ||
39 | IObject Create(Vector3 position, Quaternion rotation); | ||
40 | } | ||
41 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IParcel.cs deleted file mode 100644 index 759b26d..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IParcel.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | public interface IParcel | ||
36 | { | ||
37 | string Name { get; set; } | ||
38 | string Description { get; set; } | ||
39 | ISocialEntity Owner { get; set; } | ||
40 | bool[,] Bitmap { get; } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IPersistence.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IPersistence.cs deleted file mode 100644 index 17bb6e7..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IPersistence.cs +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
33 | { | ||
34 | interface IPersistence | ||
35 | { | ||
36 | T Get<T>(Guid storageID); | ||
37 | T Get<T>(); | ||
38 | |||
39 | /// <summary> | ||
40 | /// Stores 'data' into the persistence system | ||
41 | /// associated with this object, however saved | ||
42 | /// under the ID 'storageID'. This data may | ||
43 | /// be accessed by other scripts however. | ||
44 | /// </summary> | ||
45 | /// <param name="storageID"></param> | ||
46 | /// <param name="data"></param> | ||
47 | void Put<T>(Guid storageID, T data); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Stores 'data' into the persistence system | ||
51 | /// using the default ID for this script. | ||
52 | /// </summary> | ||
53 | /// <param name="data"></param> | ||
54 | void Put<T>(T data); | ||
55 | } | ||
56 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs deleted file mode 100644 index 13e7934..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
31 | { | ||
32 | interface IScheduler | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Schedule an event callback to occur | ||
36 | /// when 'time' is elapsed. | ||
37 | /// </summary> | ||
38 | /// <param name="time">The period to wait before executing</param> | ||
39 | void RunIn(TimeSpan time); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Schedule an event callback to fire | ||
43 | /// every "time". Equivilent to a repeating | ||
44 | /// timer. | ||
45 | /// </summary> | ||
46 | /// <param name="time">The period to wait between executions</param> | ||
47 | void RunAndRepeat(TimeSpan time); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Fire this scheduler only when the region has | ||
51 | /// a user in it. | ||
52 | /// </summary> | ||
53 | bool IfOccupied { get; set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Fire this only when simulator performance | ||
57 | /// is reasonable. (eg sysload <= 1.0) | ||
58 | /// </summary> | ||
59 | bool IfHealthy { get; set; } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Fire this event only when the region is visible | ||
63 | /// to a child agent, or there is a full agent | ||
64 | /// in this region. | ||
65 | /// </summary> | ||
66 | bool IfVisible { get; set; } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Determines whether this runs in the master scheduler thread, or a new thread | ||
70 | /// is spawned to handle your request. Running in scheduler may mean that your | ||
71 | /// code does not execute perfectly on time, however will result in better | ||
72 | /// region performance. | ||
73 | /// </summary> | ||
74 | /// <remarks> | ||
75 | /// Default: true | ||
76 | /// </remarks> | ||
77 | bool Schedule { get; set; } | ||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/ISocialEntity.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/ISocialEntity.cs deleted file mode 100644 index 400367f..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/ISocialEntity.cs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | public interface ISocialEntity | ||
36 | { | ||
37 | UUID GlobalID { get; } | ||
38 | string Name { get; } | ||
39 | bool IsUser { get; } | ||
40 | } | ||
41 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs deleted file mode 100644 index 3b3b3d0..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IWorld.cs +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX; | ||
30 | |||
31 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
32 | { | ||
33 | public class NewUserEventArgs : EventArgs | ||
34 | { | ||
35 | public IAvatar Avatar; | ||
36 | } | ||
37 | |||
38 | public delegate void OnNewUserDelegate(IWorld sender, NewUserEventArgs e); | ||
39 | |||
40 | public class ChatEventArgs : EventArgs | ||
41 | { | ||
42 | public string Text; | ||
43 | public IEntity Sender; | ||
44 | public int Channel; | ||
45 | } | ||
46 | |||
47 | public delegate void OnChatDelegate(IWorld sender, ChatEventArgs e); | ||
48 | |||
49 | public interface IWorld | ||
50 | { | ||
51 | IObjectAccessor Objects { get; } | ||
52 | IAvatar[] Avatars { get; } | ||
53 | IParcel[] Parcels { get; } | ||
54 | IHeightmap Terrain { get; } | ||
55 | IWorldAudio Audio { get; } | ||
56 | |||
57 | |||
58 | event OnChatDelegate OnChat; | ||
59 | event OnNewUserDelegate OnNewUser; | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs deleted file mode 100644 index bec8f38..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Text; | ||
30 | |||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | //using OpenSim.Services.AssetService; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.Assets; | ||
36 | |||
37 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
38 | { | ||
39 | public class InventoryItem : IInventoryItem | ||
40 | { | ||
41 | TaskInventoryItem m_privateItem; | ||
42 | Scene m_rootScene; | ||
43 | |||
44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) | ||
45 | { | ||
46 | m_rootScene = rootScene; | ||
47 | m_privateItem = internalItem; | ||
48 | } | ||
49 | |||
50 | // Marked internal, to prevent scripts from accessing the internal type | ||
51 | internal TaskInventoryItem ToTaskInventoryItem() | ||
52 | { | ||
53 | return m_privateItem; | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// This will attempt to convert from an IInventoryItem to an InventoryItem object | ||
58 | /// </summary> | ||
59 | /// <description> | ||
60 | /// In order for this to work the object which implements IInventoryItem must inherit from InventoryItem, otherwise | ||
61 | /// an exception is thrown. | ||
62 | /// </description> | ||
63 | /// <param name="i"> | ||
64 | /// The interface to upcast <see cref="IInventoryItem"/> | ||
65 | /// </param> | ||
66 | /// <returns> | ||
67 | /// The object backing the interface implementation <see cref="InventoryItem"/> | ||
68 | /// </returns> | ||
69 | internal static InventoryItem FromInterface(IInventoryItem i) | ||
70 | { | ||
71 | if (typeof(InventoryItem).IsAssignableFrom(i.GetType())) | ||
72 | { | ||
73 | return (InventoryItem)i; | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | throw new ApplicationException("[MRM] There is no legal conversion from IInventoryItem to InventoryItem"); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public int Type { get { return m_privateItem.Type; } } | ||
82 | public UUID AssetID { get { return m_privateItem.AssetID; } } | ||
83 | |||
84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. | ||
85 | public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() | ||
86 | { | ||
87 | AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); | ||
88 | T result = new T(); | ||
89 | |||
90 | if ((sbyte)result.AssetType != a.Type) | ||
91 | throw new ApplicationException("[MRM] The supplied asset class does not match the found asset"); | ||
92 | |||
93 | result.AssetData = a.Data; | ||
94 | result.Decode(); | ||
95 | return result; | ||
96 | } | ||
97 | } | ||
98 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs deleted file mode 100644 index c898da6..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Framework; | ||
29 | using OpenSim.Region.Framework.Interfaces; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
33 | { | ||
34 | class LOParcel : System.MarshalByRefObject, IParcel | ||
35 | { | ||
36 | private readonly Scene m_scene; | ||
37 | private readonly int m_parcelID; | ||
38 | |||
39 | public LOParcel(Scene m_scene, int m_parcelID) | ||
40 | { | ||
41 | this.m_scene = m_scene; | ||
42 | this.m_parcelID = m_parcelID; | ||
43 | } | ||
44 | |||
45 | private ILandObject GetLO() | ||
46 | { | ||
47 | return m_scene.LandChannel.GetLandObject(m_parcelID); | ||
48 | } | ||
49 | |||
50 | public string Name | ||
51 | { | ||
52 | get { return GetLO().LandData.Name; } | ||
53 | set { GetLO().LandData.Name = value; } | ||
54 | } | ||
55 | |||
56 | public string Description | ||
57 | { | ||
58 | get { return GetLO().LandData.Description; } | ||
59 | set { GetLO().LandData.Description = value; } | ||
60 | } | ||
61 | |||
62 | public ISocialEntity Owner | ||
63 | { | ||
64 | get { throw new System.NotImplementedException(); } | ||
65 | set { throw new System.NotImplementedException(); } | ||
66 | } | ||
67 | |||
68 | public bool[,] Bitmap | ||
69 | { | ||
70 | get { return GetLO().LandBitmap; } | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs deleted file mode 100644 index 6a23f5d..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMBase.cs +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
31 | { | ||
32 | public abstract class MRMBase : System.MarshalByRefObject | ||
33 | { | ||
34 | private IWorld m_world; | ||
35 | private IHost m_host; | ||
36 | private UUID m_id; | ||
37 | |||
38 | public void InitMiniModule(IWorld world, IHost host, UUID uniqueID) | ||
39 | { | ||
40 | m_world = world; | ||
41 | m_host = host; | ||
42 | m_id = uniqueID; | ||
43 | } | ||
44 | |||
45 | protected IWorld World | ||
46 | { | ||
47 | get { return m_world; } | ||
48 | } | ||
49 | |||
50 | protected IHost Host | ||
51 | { | ||
52 | get { return m_host; } | ||
53 | } | ||
54 | |||
55 | public UUID ID | ||
56 | { | ||
57 | get { return m_id; } | ||
58 | } | ||
59 | |||
60 | public abstract void Start(); | ||
61 | public abstract void Stop(); | ||
62 | } | ||
63 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs deleted file mode 100644 index 4bafe2f..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ /dev/null | |||
@@ -1,521 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.CodeDom.Compiler; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Diagnostics; | ||
33 | using System.IO; | ||
34 | using System.Reflection; | ||
35 | using System.Security; | ||
36 | using System.Security.Permissions; | ||
37 | using System.Security.Policy; | ||
38 | using System.Text; | ||
39 | using log4net; | ||
40 | using Microsoft.CSharp; | ||
41 | using Nini.Config; | ||
42 | using OpenMetaverse; | ||
43 | using OpenSim.Framework; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using Mono.Addins; | ||
47 | |||
48 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
49 | { | ||
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")] | ||
51 | public class MRMModule : INonSharedRegionModule, IMRMModule | ||
52 | { | ||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | private Scene m_scene; | ||
55 | private bool m_Enabled; | ||
56 | private bool m_Hidden; | ||
57 | |||
58 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); | ||
59 | |||
60 | private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>(); | ||
61 | |||
62 | private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); | ||
63 | |||
64 | private readonly MicroScheduler m_microthreads = new MicroScheduler(); | ||
65 | |||
66 | |||
67 | private IConfig m_config; | ||
68 | |||
69 | public void RegisterExtension<T>(T instance) | ||
70 | { | ||
71 | m_extensions[typeof (T)] = instance; | ||
72 | } | ||
73 | |||
74 | #region INonSharedRegionModule | ||
75 | |||
76 | public void Initialise(IConfigSource source) | ||
77 | { | ||
78 | if (source.Configs["MRM"] != null) | ||
79 | { | ||
80 | m_config = source.Configs["MRM"]; | ||
81 | |||
82 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | ||
83 | { | ||
84 | m_log.Info("[MRM]: Enabling MRM Module"); | ||
85 | m_Enabled = true; | ||
86 | m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void AddRegion(Scene scene) | ||
92 | { | ||
93 | if (!m_Enabled) | ||
94 | return; | ||
95 | |||
96 | m_scene = scene; | ||
97 | |||
98 | // when hidden, we don't listen for client initiated script events | ||
99 | // only making the MRM engine available for region modules | ||
100 | if (!m_Hidden) | ||
101 | { | ||
102 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | ||
103 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | ||
104 | } | ||
105 | |||
106 | scene.EventManager.OnFrame += EventManager_OnFrame; | ||
107 | |||
108 | scene.RegisterModuleInterface<IMRMModule>(this); | ||
109 | } | ||
110 | |||
111 | public void RegionLoaded(Scene scene) | ||
112 | { | ||
113 | } | ||
114 | |||
115 | public void RemoveRegion(Scene scene) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | public void Close() | ||
120 | { | ||
121 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) | ||
122 | { | ||
123 | pair.Value.Stop(); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | public string Name | ||
128 | { | ||
129 | get { return "MiniRegionModule"; } | ||
130 | } | ||
131 | |||
132 | public Type ReplaceableInterface | ||
133 | { | ||
134 | get { return null; } | ||
135 | } | ||
136 | |||
137 | #endregion | ||
138 | |||
139 | void EventManager_OnStopScript(uint localID, UUID itemID) | ||
140 | { | ||
141 | if (m_scripts.ContainsKey(itemID)) | ||
142 | { | ||
143 | m_scripts[itemID].Stop(); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | void EventManager_OnFrame() | ||
148 | { | ||
149 | m_microthreads.Tick(1000); | ||
150 | } | ||
151 | |||
152 | static string ConvertMRMKeywords(string script) | ||
153 | { | ||
154 | script = script.Replace("microthreaded void", "IEnumerable"); | ||
155 | script = script.Replace("relax;", "yield return null;"); | ||
156 | |||
157 | return script; | ||
158 | } | ||
159 | |||
160 | /// <summary> | ||
161 | /// Create an AppDomain that contains policy restricting code to execute | ||
162 | /// with only the permissions granted by a named permission set | ||
163 | /// </summary> | ||
164 | /// <param name="permissionSetName">name of the permission set to restrict to</param> | ||
165 | /// <param name="appDomainName">'friendly' name of the appdomain to be created</param> | ||
166 | /// <exception cref="ArgumentNullException"> | ||
167 | /// if <paramref name="permissionSetName"/> is null | ||
168 | /// </exception> | ||
169 | /// <exception cref="ArgumentOutOfRangeException"> | ||
170 | /// if <paramref name="permissionSetName"/> is empty | ||
171 | /// </exception> | ||
172 | /// <returns>AppDomain with a restricted security policy</returns> | ||
173 | /// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx | ||
174 | /// Valid permissionSetName values are: | ||
175 | /// * FullTrust | ||
176 | /// * SkipVerification | ||
177 | /// * Execution | ||
178 | /// * Nothing | ||
179 | /// * LocalIntranet | ||
180 | /// * Internet | ||
181 | /// * Everything | ||
182 | /// </remarks> | ||
183 | #pragma warning disable 0618 | ||
184 | public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName) | ||
185 | { | ||
186 | if (permissionSetName == null) | ||
187 | throw new ArgumentNullException("permissionSetName"); | ||
188 | if (permissionSetName.Length == 0) | ||
189 | throw new ArgumentOutOfRangeException("permissionSetName", permissionSetName, | ||
190 | "Cannot have an empty permission set name"); | ||
191 | |||
192 | // Default to all code getting nothing | ||
193 | PolicyStatement emptyPolicy = new PolicyStatement(new PermissionSet(PermissionState.None)); | ||
194 | UnionCodeGroup policyRoot = new UnionCodeGroup(new AllMembershipCondition(), emptyPolicy); | ||
195 | |||
196 | bool foundName = false; | ||
197 | PermissionSet setIntersection = new PermissionSet(PermissionState.Unrestricted); | ||
198 | |||
199 | // iterate over each policy level | ||
200 | IEnumerator levelEnumerator = SecurityManager.PolicyHierarchy(); | ||
201 | while (levelEnumerator.MoveNext()) | ||
202 | { | ||
203 | PolicyLevel level = levelEnumerator.Current as PolicyLevel; | ||
204 | |||
205 | // if this level has defined a named permission set with the | ||
206 | // given name, then intersect it with what we've retrieved | ||
207 | // from all the previous levels | ||
208 | if (level != null) | ||
209 | { | ||
210 | PermissionSet levelSet = level.GetNamedPermissionSet(permissionSetName); | ||
211 | if (levelSet != null) | ||
212 | { | ||
213 | foundName = true; | ||
214 | if (setIntersection != null) | ||
215 | setIntersection = setIntersection.Intersect(levelSet); | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | // Intersect() can return null for an empty set, so convert that | ||
221 | // to an empty set object. Also return an empty set if we didn't find | ||
222 | // the named permission set we were looking for | ||
223 | if (setIntersection == null || !foundName) | ||
224 | setIntersection = new PermissionSet(PermissionState.None); | ||
225 | else | ||
226 | setIntersection = new NamedPermissionSet(permissionSetName, setIntersection); | ||
227 | |||
228 | // if no named permission sets were found, return an empty set, | ||
229 | // otherwise return the set that was found | ||
230 | PolicyStatement permissions = new PolicyStatement(setIntersection); | ||
231 | policyRoot.AddChild(new UnionCodeGroup(new AllMembershipCondition(), permissions)); | ||
232 | |||
233 | // create an AppDomain policy level for the policy tree | ||
234 | PolicyLevel appDomainLevel = PolicyLevel.CreateAppDomainLevel(); | ||
235 | appDomainLevel.RootCodeGroup = policyRoot; | ||
236 | |||
237 | // create an AppDomain where this policy will be in effect | ||
238 | string domainName = appDomainName; | ||
239 | AppDomain restrictedDomain = AppDomain.CreateDomain(domainName); | ||
240 | restrictedDomain.SetAppDomainPolicy(appDomainLevel); | ||
241 | |||
242 | return restrictedDomain; | ||
243 | } | ||
244 | #pragma warning restore 0618 | ||
245 | |||
246 | |||
247 | void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | ||
248 | { | ||
249 | if (script.StartsWith("//MRM:C#")) | ||
250 | { | ||
251 | if (m_config.GetBoolean("OwnerOnly", true)) | ||
252 | if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.EstateSettings.EstateOwner | ||
253 | || m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.EstateSettings.EstateOwner) | ||
254 | return; | ||
255 | |||
256 | script = ConvertMRMKeywords(script); | ||
257 | |||
258 | try | ||
259 | { | ||
260 | AppDomain target; | ||
261 | if (m_config.GetBoolean("Sandboxed", true)) | ||
262 | { | ||
263 | m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + | ||
264 | m_config.GetString("SandboxLevel", "Internet") + "-level security."); | ||
265 | |||
266 | string domainName = UUID.Random().ToString(); | ||
267 | target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"), | ||
268 | domainName); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain"); | ||
273 | m_log.Warn( | ||
274 | "[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments."); | ||
275 | target = AppDomain.CurrentDomain; | ||
276 | } | ||
277 | |||
278 | m_log.Info("[MRM] Unwrapping into target AppDomain"); | ||
279 | MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( | ||
280 | CompileFromDotNetText(script, itemID.ToString()), | ||
281 | "OpenSim.MiniModule"); | ||
282 | |||
283 | m_log.Info("[MRM] Initialising MRM Globals"); | ||
284 | InitializeMRM(mmb, localID, itemID); | ||
285 | |||
286 | m_scripts[itemID] = mmb; | ||
287 | |||
288 | m_log.Info("[MRM] Starting MRM"); | ||
289 | mmb.Start(); | ||
290 | } | ||
291 | catch (UnauthorizedAccessException e) | ||
292 | { | ||
293 | m_log.Error("[MRM] UAE " + e.Message); | ||
294 | m_log.Error("[MRM] " + e.StackTrace); | ||
295 | |||
296 | if (e.InnerException != null) | ||
297 | m_log.Error("[MRM] " + e.InnerException); | ||
298 | |||
299 | m_scene.ForEachClient(delegate(IClientAPI user) | ||
300 | { | ||
301 | user.SendAlertMessage( | ||
302 | "MRM UnAuthorizedAccess: " + e); | ||
303 | }); | ||
304 | } | ||
305 | catch (Exception e) | ||
306 | { | ||
307 | m_log.Info("[MRM] Error: " + e); | ||
308 | m_scene.ForEachClient(delegate(IClientAPI user) | ||
309 | { | ||
310 | user.SendAlertMessage( | ||
311 | "Compile error while building MRM script, check OpenSim console for more information."); | ||
312 | }); | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host) | ||
318 | { | ||
319 | // UUID should be changed to object owner. | ||
320 | UUID owner = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
321 | SEUser securityUser = new SEUser(owner, "Name Unassigned"); | ||
322 | SecurityCredential creds = new SecurityCredential(securityUser, m_scene); | ||
323 | |||
324 | world = new World(m_scene, creds); | ||
325 | host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions), | ||
326 | m_microthreads); | ||
327 | } | ||
328 | |||
329 | public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) | ||
330 | { | ||
331 | m_log.Info("[MRM] Created MRM Instance"); | ||
332 | |||
333 | IWorld world; | ||
334 | IHost host; | ||
335 | |||
336 | GetGlobalEnvironment(localID, out world, out host); | ||
337 | |||
338 | mmb.InitMiniModule(world, host, itemID); | ||
339 | } | ||
340 | |||
341 | /// <summary> | ||
342 | /// Stolen from ScriptEngine Common | ||
343 | /// </summary> | ||
344 | /// <param name="Script"></param> | ||
345 | /// <param name="uuid">Unique ID for this module</param> | ||
346 | /// <returns></returns> | ||
347 | internal string CompileFromDotNetText(string Script, string uuid) | ||
348 | { | ||
349 | m_log.Info("MRM 1"); | ||
350 | const string ext = ".cs"; | ||
351 | const string FilePrefix = "MiniModule"; | ||
352 | |||
353 | // Output assembly name | ||
354 | string OutFile = Path.Combine("MiniModules", Path.Combine( | ||
355 | m_scene.RegionInfo.RegionID.ToString(), | ||
356 | FilePrefix + "_compiled_" + uuid + "_" + | ||
357 | Util.RandomClass.Next(9000) + ".dll")); | ||
358 | |||
359 | // Create Directories for Assemblies | ||
360 | if (!Directory.Exists("MiniModules")) | ||
361 | Directory.CreateDirectory("MiniModules"); | ||
362 | string tmp = Path.Combine("MiniModules", m_scene.RegionInfo.RegionID.ToString()); | ||
363 | if (!Directory.Exists(tmp)) | ||
364 | Directory.CreateDirectory(tmp); | ||
365 | |||
366 | m_log.Info("MRM 2"); | ||
367 | |||
368 | try | ||
369 | { | ||
370 | File.Delete(OutFile); | ||
371 | } | ||
372 | catch (UnauthorizedAccessException e) | ||
373 | { | ||
374 | throw new Exception("Unable to delete old existing " + | ||
375 | "script-file before writing new. Compile aborted: " + | ||
376 | e); | ||
377 | } | ||
378 | catch (IOException e) | ||
379 | { | ||
380 | throw new Exception("Unable to delete old existing " + | ||
381 | "script-file before writing new. Compile aborted: " + | ||
382 | e); | ||
383 | } | ||
384 | |||
385 | m_log.Info("MRM 3"); | ||
386 | |||
387 | // DEBUG - write source to disk | ||
388 | string srcFileName = FilePrefix + "_source_" + | ||
389 | Path.GetFileNameWithoutExtension(OutFile) + ext; | ||
390 | try | ||
391 | { | ||
392 | File.WriteAllText(Path.Combine(Path.Combine( | ||
393 | "MiniModules", | ||
394 | m_scene.RegionInfo.RegionID.ToString()), | ||
395 | srcFileName), Script); | ||
396 | } | ||
397 | catch (Exception ex) //NOTLEGIT - Should be just FileIOException | ||
398 | { | ||
399 | m_log.Error("[Compiler]: Exception while " + | ||
400 | "trying to write script source to file \"" + | ||
401 | srcFileName + "\": " + ex); | ||
402 | } | ||
403 | |||
404 | m_log.Info("MRM 4"); | ||
405 | |||
406 | // Do actual compile | ||
407 | CompilerParameters parameters = new CompilerParameters(); | ||
408 | |||
409 | parameters.IncludeDebugInformation = true; | ||
410 | |||
411 | string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | ||
412 | |||
413 | List<string> libraries = new List<string>(); | ||
414 | string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); | ||
415 | foreach (string s in lines) | ||
416 | { | ||
417 | if (s.StartsWith("//@DEPENDS:")) | ||
418 | { | ||
419 | libraries.Add(s.Replace("//@DEPENDS:", "")); | ||
420 | } | ||
421 | } | ||
422 | |||
423 | libraries.Add("OpenSim.Region.OptionalModules.dll"); | ||
424 | libraries.Add("OpenMetaverseTypes.dll"); | ||
425 | libraries.Add("log4net.dll"); | ||
426 | |||
427 | foreach (string library in libraries) | ||
428 | { | ||
429 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, library)); | ||
430 | } | ||
431 | |||
432 | parameters.GenerateExecutable = false; | ||
433 | parameters.OutputAssembly = OutFile; | ||
434 | parameters.IncludeDebugInformation = true; | ||
435 | parameters.TreatWarningsAsErrors = false; | ||
436 | |||
437 | m_log.Info("MRM 5"); | ||
438 | |||
439 | CompilerResults results = CScodeProvider.CompileAssemblyFromSource( | ||
440 | parameters, Script); | ||
441 | |||
442 | m_log.Info("MRM 6"); | ||
443 | |||
444 | int display = 5; | ||
445 | if (results.Errors.Count > 0) | ||
446 | { | ||
447 | string errtext = String.Empty; | ||
448 | foreach (CompilerError CompErr in results.Errors) | ||
449 | { | ||
450 | // Show 5 errors max | ||
451 | // | ||
452 | if (display <= 0) | ||
453 | break; | ||
454 | display--; | ||
455 | |||
456 | string severity = "Error"; | ||
457 | if (CompErr.IsWarning) | ||
458 | { | ||
459 | severity = "Warning"; | ||
460 | } | ||
461 | |||
462 | string text = CompErr.ErrorText; | ||
463 | |||
464 | // The Second Life viewer's script editor begins | ||
465 | // countingn lines and columns at 0, so we subtract 1. | ||
466 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", | ||
467 | CompErr.Line - 1, CompErr.Column - 1, | ||
468 | CompErr.ErrorNumber, text, severity); | ||
469 | } | ||
470 | |||
471 | if (!File.Exists(OutFile)) | ||
472 | { | ||
473 | throw new Exception(errtext); | ||
474 | } | ||
475 | } | ||
476 | |||
477 | m_log.Info("MRM 7"); | ||
478 | |||
479 | if (!File.Exists(OutFile)) | ||
480 | { | ||
481 | string errtext = String.Empty; | ||
482 | errtext += "No compile error. But not able to locate compiled file."; | ||
483 | throw new Exception(errtext); | ||
484 | } | ||
485 | |||
486 | FileInfo fi = new FileInfo(OutFile); | ||
487 | |||
488 | Byte[] data = new Byte[fi.Length]; | ||
489 | |||
490 | try | ||
491 | { | ||
492 | FileStream fs = File.Open(OutFile, FileMode.Open, FileAccess.Read); | ||
493 | fs.Read(data, 0, data.Length); | ||
494 | fs.Close(); | ||
495 | } | ||
496 | catch (IOException) | ||
497 | { | ||
498 | string errtext = String.Empty; | ||
499 | errtext += "No compile error. But not able to open file."; | ||
500 | throw new Exception(errtext); | ||
501 | } | ||
502 | |||
503 | m_log.Info("MRM 8"); | ||
504 | |||
505 | // Convert to base64 | ||
506 | // | ||
507 | string filetext = Convert.ToBase64String(data); | ||
508 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); | ||
509 | |||
510 | m_log.Info("MRM 9"); | ||
511 | |||
512 | FileStream sfs = File.Create(OutFile + ".cil.b64"); | ||
513 | sfs.Write(buf, 0, buf.Length); | ||
514 | sfs.Close(); | ||
515 | |||
516 | m_log.Info("MRM 10"); | ||
517 | |||
518 | return OutFile; | ||
519 | } | ||
520 | } | ||
521 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs deleted file mode 100644 index 5861486..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using log4net; | ||
34 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
37 | { | ||
38 | public class MicroScheduler : System.MarshalByRefObject, IMicrothreader | ||
39 | { | ||
40 | private readonly List<IEnumerator> m_threads = new List<IEnumerator>(); | ||
41 | |||
42 | public void Run(IEnumerable microthread) | ||
43 | { | ||
44 | lock (m_threads) | ||
45 | m_threads.Add(microthread.GetEnumerator()); | ||
46 | } | ||
47 | |||
48 | public void Tick(int count) | ||
49 | { | ||
50 | lock (m_threads) | ||
51 | { | ||
52 | if (m_threads.Count == 0) | ||
53 | return; | ||
54 | |||
55 | int i = 0; | ||
56 | while (m_threads.Count > 0 && i < count) | ||
57 | { | ||
58 | i++; | ||
59 | |||
60 | bool running = m_threads[i%m_threads.Count].MoveNext(); | ||
61 | |||
62 | |||
63 | if (!running) | ||
64 | m_threads.Remove(m_threads[i%m_threads.Count]); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectInventory.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectInventory.cs deleted file mode 100644 index bb85d06..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectInventory.cs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// This implements the methods neccesary to operate on the inventory of an object | ||
37 | /// </summary> | ||
38 | public interface IObjectInventory : IDictionary<UUID, IInventoryItem> | ||
39 | { | ||
40 | IInventoryItem this[string name] { get; } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs deleted file mode 100644 index 45bf25e..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// This implements an interface similar to that provided by physics engines to OpenSim internally. | ||
37 | /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current | ||
38 | /// physics scene representation of this object. | ||
39 | /// </summary> | ||
40 | public interface IObjectPhysics | ||
41 | { | ||
42 | bool Enabled { get; set; } | ||
43 | |||
44 | bool Phantom { get; set; } | ||
45 | bool PhantomCollisions { get; set; } | ||
46 | |||
47 | double Density { get; set; } | ||
48 | double Mass { get; set; } | ||
49 | double Buoyancy { get; set; } | ||
50 | |||
51 | Vector3 GeometricCenter { get; } | ||
52 | Vector3 CenterOfMass { get; } | ||
53 | |||
54 | Vector3 RotationalVelocity { get; set; } | ||
55 | Vector3 Velocity { get; set; } | ||
56 | Vector3 Torque { get; set; } | ||
57 | Vector3 Acceleration { get; } | ||
58 | Vector3 Force { get; set; } | ||
59 | |||
60 | bool FloatOnWater { set; } | ||
61 | |||
62 | void AddForce(Vector3 force, bool pushforce); | ||
63 | void AddAngularForce(Vector3 force, bool pushforce); | ||
64 | void SetMomentum(Vector3 momentum); | ||
65 | } | ||
66 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs deleted file mode 100644 index 27cf279..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
34 | { | ||
35 | public enum SculptType | ||
36 | { | ||
37 | Default = 1, | ||
38 | Sphere = 1, | ||
39 | Torus = 2, | ||
40 | Plane = 3, | ||
41 | Cylinder = 4 | ||
42 | } | ||
43 | |||
44 | public enum HoleShape | ||
45 | { | ||
46 | Default = 0x00, | ||
47 | Circle = 0x10, | ||
48 | Square = 0x20, | ||
49 | Triangle = 0x30 | ||
50 | } | ||
51 | |||
52 | public enum PrimType | ||
53 | { | ||
54 | NotPrimitive = 255, | ||
55 | Box = 0, | ||
56 | Cylinder = 1, | ||
57 | Prism = 2, | ||
58 | Sphere = 3, | ||
59 | Torus = 4, | ||
60 | Tube = 5, | ||
61 | Ring = 6, | ||
62 | Sculpt = 7 | ||
63 | } | ||
64 | |||
65 | public interface IObjectShape | ||
66 | { | ||
67 | UUID SculptMap { get; set; } | ||
68 | SculptType SculptType { get; set; } | ||
69 | |||
70 | HoleShape HoleType { get; set; } | ||
71 | Double HoleSize { get; set; } | ||
72 | PrimType PrimType { get; set; } | ||
73 | |||
74 | } | ||
75 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs deleted file mode 100644 index d623c51..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
34 | { | ||
35 | public interface IObjectSound | ||
36 | { | ||
37 | void Play(UUID soundAsset, double volume); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs deleted file mode 100644 index 140264b..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using IEnumerable=System.Collections.IEnumerable; | ||
35 | |||
36 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
37 | { | ||
38 | |||
39 | internal class IObjEnum : System.MarshalByRefObject, IEnumerator<IObject> | ||
40 | { | ||
41 | private readonly Scene m_scene; | ||
42 | private readonly IEnumerator<EntityBase> m_sogEnum; | ||
43 | private readonly ISecurityCredential m_security; | ||
44 | private readonly List<EntityBase> m_entities; | ||
45 | |||
46 | public IObjEnum(Scene scene, ISecurityCredential security) | ||
47 | { | ||
48 | m_scene = scene; | ||
49 | m_security = security; | ||
50 | m_entities = new List<EntityBase>(m_scene.Entities.GetEntities()); | ||
51 | m_sogEnum = m_entities.GetEnumerator(); | ||
52 | } | ||
53 | |||
54 | public void Dispose() | ||
55 | { | ||
56 | m_sogEnum.Dispose(); | ||
57 | } | ||
58 | |||
59 | public bool MoveNext() | ||
60 | { | ||
61 | return m_sogEnum.MoveNext(); | ||
62 | } | ||
63 | |||
64 | public void Reset() | ||
65 | { | ||
66 | m_sogEnum.Reset(); | ||
67 | } | ||
68 | |||
69 | public IObject Current | ||
70 | { | ||
71 | get | ||
72 | { | ||
73 | return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | object IEnumerator.Current | ||
78 | { | ||
79 | get { return Current; } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor | ||
84 | { | ||
85 | private readonly Scene m_scene; | ||
86 | private readonly ISecurityCredential m_security; | ||
87 | |||
88 | public ObjectAccessor(Scene scene, ISecurityCredential security) | ||
89 | { | ||
90 | m_scene = scene; | ||
91 | m_security = security; | ||
92 | } | ||
93 | |||
94 | public IObject this[int index] | ||
95 | { | ||
96 | get | ||
97 | { | ||
98 | return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public IObject this[uint index] | ||
103 | { | ||
104 | get | ||
105 | { | ||
106 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public IObject this[UUID index] | ||
111 | { | ||
112 | get | ||
113 | { | ||
114 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | public IObject Create(Vector3 position) | ||
119 | { | ||
120 | return Create(position, Quaternion.Identity); | ||
121 | } | ||
122 | |||
123 | public IObject Create(Vector3 position, Quaternion rotation) | ||
124 | { | ||
125 | |||
126 | SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID, | ||
127 | UUID.Zero, | ||
128 | position, | ||
129 | rotation, | ||
130 | PrimitiveBaseShape.CreateBox()); | ||
131 | |||
132 | IObject ret = new SOPObject(m_scene, sog.LocalId, m_security); | ||
133 | |||
134 | return ret; | ||
135 | } | ||
136 | |||
137 | public IEnumerator<IObject> GetEnumerator() | ||
138 | { | ||
139 | return new IObjEnum(m_scene, m_security); | ||
140 | } | ||
141 | |||
142 | IEnumerator IEnumerable.GetEnumerator() | ||
143 | { | ||
144 | return GetEnumerator(); | ||
145 | } | ||
146 | |||
147 | public void Add(IObject item) | ||
148 | { | ||
149 | throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible."); | ||
150 | } | ||
151 | |||
152 | public void Clear() | ||
153 | { | ||
154 | throw new NotSupportedException("Collection is read-only. TODO FIX."); | ||
155 | } | ||
156 | |||
157 | public bool Contains(IObject item) | ||
158 | { | ||
159 | return m_scene.Entities.ContainsKey(item.LocalID); | ||
160 | } | ||
161 | |||
162 | public void CopyTo(IObject[] array, int arrayIndex) | ||
163 | { | ||
164 | for (int i = arrayIndex; i < Count + arrayIndex; i++) | ||
165 | { | ||
166 | array[i] = this[i - arrayIndex]; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | public bool Remove(IObject item) | ||
171 | { | ||
172 | throw new NotSupportedException("Collection is read-only. TODO FIX."); | ||
173 | } | ||
174 | |||
175 | public int Count | ||
176 | { | ||
177 | get { return m_scene.Entities.Count; } | ||
178 | } | ||
179 | |||
180 | public bool IsReadOnly | ||
181 | { | ||
182 | get { return true; } | ||
183 | } | ||
184 | } | ||
185 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs deleted file mode 100644 index e2bdf5e..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | class SEUser : System.MarshalByRefObject, ISocialEntity | ||
36 | { | ||
37 | private readonly UUID m_uuid; | ||
38 | private readonly string m_name; | ||
39 | |||
40 | public SEUser(UUID uuid, string name) | ||
41 | { | ||
42 | m_uuid = uuid; | ||
43 | m_name = name; | ||
44 | } | ||
45 | |||
46 | public UUID GlobalID | ||
47 | { | ||
48 | get { return m_uuid; } | ||
49 | } | ||
50 | |||
51 | public string Name | ||
52 | { | ||
53 | get { return m_name; } | ||
54 | } | ||
55 | |||
56 | public bool IsUser | ||
57 | { | ||
58 | get { return true; } | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs deleted file mode 100644 index 1ff9cb5..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ /dev/null | |||
@@ -1,833 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Security; | ||
31 | using OpenMetaverse; | ||
32 | using OpenMetaverse.Packets; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; | ||
37 | using OpenSim.Region.PhysicsModules.SharedBase; | ||
38 | using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; | ||
39 | using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; | ||
40 | |||
41 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
42 | { | ||
43 | class SOPObject : MarshalByRefObject, IObject, IObjectPhysics, IObjectShape, IObjectSound | ||
44 | { | ||
45 | private readonly Scene m_rootScene; | ||
46 | private readonly uint m_localID; | ||
47 | private readonly ISecurityCredential m_security; | ||
48 | |||
49 | [Obsolete("Replace with 'credential' constructor [security]")] | ||
50 | public SOPObject(Scene rootScene, uint localID) | ||
51 | { | ||
52 | m_rootScene = rootScene; | ||
53 | m_localID = localID; | ||
54 | } | ||
55 | |||
56 | public SOPObject(Scene rootScene, uint localID, ISecurityCredential credential) | ||
57 | { | ||
58 | m_rootScene = rootScene; | ||
59 | m_localID = localID; | ||
60 | m_security = credential; | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// This needs to run very, very quickly. | ||
65 | /// It is utilized in nearly every property and method. | ||
66 | /// </summary> | ||
67 | /// <returns></returns> | ||
68 | private SceneObjectPart GetSOP() | ||
69 | { | ||
70 | return m_rootScene.GetSceneObjectPart(m_localID); | ||
71 | } | ||
72 | |||
73 | private bool CanEdit() | ||
74 | { | ||
75 | if (!m_security.CanEditObject(this)) | ||
76 | { | ||
77 | throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]"); | ||
78 | } | ||
79 | return true; | ||
80 | } | ||
81 | |||
82 | #region OnTouch | ||
83 | |||
84 | private event OnTouchDelegate _OnTouch; | ||
85 | private bool _OnTouchActive = false; | ||
86 | |||
87 | public event OnTouchDelegate OnTouch | ||
88 | { | ||
89 | add | ||
90 | { | ||
91 | if (CanEdit()) | ||
92 | { | ||
93 | if (!_OnTouchActive) | ||
94 | { | ||
95 | GetSOP().Flags |= PrimFlags.Touch; | ||
96 | _OnTouchActive = true; | ||
97 | m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; | ||
98 | } | ||
99 | |||
100 | _OnTouch += value; | ||
101 | } | ||
102 | } | ||
103 | remove | ||
104 | { | ||
105 | _OnTouch -= value; | ||
106 | |||
107 | if (_OnTouch == null) | ||
108 | { | ||
109 | GetSOP().Flags &= ~PrimFlags.Touch; | ||
110 | _OnTouchActive = false; | ||
111 | m_rootScene.EventManager.OnObjectGrab -= EventManager_OnObjectGrab; | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | void EventManager_OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | ||
117 | { | ||
118 | if (_OnTouchActive && m_localID == localID) | ||
119 | { | ||
120 | TouchEventArgs e = new TouchEventArgs(); | ||
121 | e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security); | ||
122 | e.TouchBiNormal = surfaceArgs.Binormal; | ||
123 | e.TouchMaterialIndex = surfaceArgs.FaceIndex; | ||
124 | e.TouchNormal = surfaceArgs.Normal; | ||
125 | e.TouchPosition = surfaceArgs.Position; | ||
126 | e.TouchST = new Vector2(surfaceArgs.STCoord.X, surfaceArgs.STCoord.Y); | ||
127 | e.TouchUV = new Vector2(surfaceArgs.UVCoord.X, surfaceArgs.UVCoord.Y); | ||
128 | |||
129 | IObject sender = this; | ||
130 | |||
131 | if (_OnTouch != null) | ||
132 | _OnTouch(sender, e); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | #endregion | ||
137 | |||
138 | public bool Exists | ||
139 | { | ||
140 | get { return GetSOP() != null; } | ||
141 | } | ||
142 | |||
143 | public uint LocalID | ||
144 | { | ||
145 | get { return m_localID; } | ||
146 | } | ||
147 | |||
148 | public UUID GlobalID | ||
149 | { | ||
150 | get { return GetSOP().UUID; } | ||
151 | } | ||
152 | |||
153 | public string Name | ||
154 | { | ||
155 | get { return GetSOP().Name; } | ||
156 | set | ||
157 | { | ||
158 | if (CanEdit()) | ||
159 | GetSOP().Name = value; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | public string Description | ||
164 | { | ||
165 | get { return GetSOP().Description; } | ||
166 | set | ||
167 | { | ||
168 | if (CanEdit()) | ||
169 | GetSOP().Description = value; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | public UUID OwnerId | ||
174 | { | ||
175 | get { return GetSOP().OwnerID;} | ||
176 | } | ||
177 | |||
178 | public UUID CreatorId | ||
179 | { | ||
180 | get { return GetSOP().CreatorID;} | ||
181 | } | ||
182 | |||
183 | public IObject[] Children | ||
184 | { | ||
185 | get | ||
186 | { | ||
187 | SceneObjectPart my = GetSOP(); | ||
188 | IObject[] rets = null; | ||
189 | |||
190 | int total = my.ParentGroup.PrimCount; | ||
191 | |||
192 | rets = new IObject[total]; | ||
193 | |||
194 | int i = 0; | ||
195 | |||
196 | foreach (SceneObjectPart part in my.ParentGroup.Parts) | ||
197 | { | ||
198 | rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security); | ||
199 | } | ||
200 | |||
201 | return rets; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | public IObject Root | ||
206 | { | ||
207 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); } | ||
208 | } | ||
209 | |||
210 | public IObjectMaterial[] Materials | ||
211 | { | ||
212 | get | ||
213 | { | ||
214 | SceneObjectPart sop = GetSOP(); | ||
215 | IObjectMaterial[] rets = new IObjectMaterial[getNumberOfSides(sop)]; | ||
216 | |||
217 | for (int i = 0; i < rets.Length; i++) | ||
218 | { | ||
219 | rets[i] = new SOPObjectMaterial(i, sop); | ||
220 | } | ||
221 | |||
222 | return rets; | ||
223 | } | ||
224 | } | ||
225 | |||
226 | public Vector3 Scale | ||
227 | { | ||
228 | get { return GetSOP().Scale; } | ||
229 | set | ||
230 | { | ||
231 | if (CanEdit()) | ||
232 | GetSOP().Scale = value; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | public Quaternion WorldRotation | ||
237 | { | ||
238 | get { throw new System.NotImplementedException(); } | ||
239 | set { throw new System.NotImplementedException(); } | ||
240 | } | ||
241 | |||
242 | public Quaternion OffsetRotation | ||
243 | { | ||
244 | get { throw new System.NotImplementedException(); } | ||
245 | set { throw new System.NotImplementedException(); } | ||
246 | } | ||
247 | |||
248 | public Vector3 WorldPosition | ||
249 | { | ||
250 | get { return GetSOP().AbsolutePosition; } | ||
251 | set | ||
252 | { | ||
253 | if (CanEdit()) | ||
254 | { | ||
255 | SceneObjectPart pos = GetSOP(); | ||
256 | pos.UpdateOffSet(value - pos.AbsolutePosition); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | public Vector3 OffsetPosition | ||
262 | { | ||
263 | get { return GetSOP().OffsetPosition; } | ||
264 | set | ||
265 | { | ||
266 | if (CanEdit()) | ||
267 | { | ||
268 | GetSOP().OffsetPosition = value; | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | |||
273 | public Vector3 SitTarget | ||
274 | { | ||
275 | get { return GetSOP().SitTargetPosition; } | ||
276 | set | ||
277 | { | ||
278 | if (CanEdit()) | ||
279 | { | ||
280 | GetSOP().SitTargetPosition = value; | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | |||
285 | public string SitTargetText | ||
286 | { | ||
287 | get { return GetSOP().SitName; } | ||
288 | set | ||
289 | { | ||
290 | if (CanEdit()) | ||
291 | { | ||
292 | GetSOP().SitName = value; | ||
293 | } | ||
294 | } | ||
295 | } | ||
296 | |||
297 | public string TouchText | ||
298 | { | ||
299 | get { return GetSOP().TouchName; } | ||
300 | set | ||
301 | { | ||
302 | if (CanEdit()) | ||
303 | { | ||
304 | GetSOP().TouchName = value; | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | |||
309 | public string Text | ||
310 | { | ||
311 | get { return GetSOP().Text; } | ||
312 | set | ||
313 | { | ||
314 | if (CanEdit()) | ||
315 | { | ||
316 | GetSOP().SetText(value,new Vector3(1.0f,1.0f,1.0f),1.0f); | ||
317 | } | ||
318 | } | ||
319 | } | ||
320 | |||
321 | public bool IsRotationLockedX | ||
322 | { | ||
323 | get { throw new System.NotImplementedException(); } | ||
324 | set { throw new System.NotImplementedException(); } | ||
325 | } | ||
326 | |||
327 | public bool IsRotationLockedY | ||
328 | { | ||
329 | get { throw new System.NotImplementedException(); } | ||
330 | set { throw new System.NotImplementedException(); } | ||
331 | } | ||
332 | |||
333 | public bool IsRotationLockedZ | ||
334 | { | ||
335 | get { throw new System.NotImplementedException(); } | ||
336 | set { throw new System.NotImplementedException(); } | ||
337 | } | ||
338 | |||
339 | public bool IsSandboxed | ||
340 | { | ||
341 | get { throw new System.NotImplementedException(); } | ||
342 | set { throw new System.NotImplementedException(); } | ||
343 | } | ||
344 | |||
345 | public bool IsImmotile | ||
346 | { | ||
347 | get { throw new System.NotImplementedException(); } | ||
348 | set { throw new System.NotImplementedException(); } | ||
349 | } | ||
350 | |||
351 | public bool IsAlwaysReturned | ||
352 | { | ||
353 | get { throw new System.NotImplementedException(); } | ||
354 | set { throw new System.NotImplementedException(); } | ||
355 | } | ||
356 | |||
357 | public bool IsTemporary | ||
358 | { | ||
359 | get { throw new System.NotImplementedException(); } | ||
360 | set { throw new System.NotImplementedException(); } | ||
361 | } | ||
362 | |||
363 | public bool IsFlexible | ||
364 | { | ||
365 | get { throw new System.NotImplementedException(); } | ||
366 | set { throw new System.NotImplementedException(); } | ||
367 | } | ||
368 | |||
369 | public PhysicsMaterial PhysicsMaterial | ||
370 | { | ||
371 | get { throw new System.NotImplementedException(); } | ||
372 | set { throw new System.NotImplementedException(); } | ||
373 | } | ||
374 | |||
375 | public IObjectPhysics Physics | ||
376 | { | ||
377 | get { return this; } | ||
378 | } | ||
379 | |||
380 | public IObjectShape Shape | ||
381 | { | ||
382 | get { return this; } | ||
383 | } | ||
384 | |||
385 | public IObjectInventory Inventory | ||
386 | { | ||
387 | get { return new SOPObjectInventory(m_rootScene, GetSOP().TaskInventory); } | ||
388 | } | ||
389 | |||
390 | #region Public Functions | ||
391 | |||
392 | public void Say(string msg) | ||
393 | { | ||
394 | if (!CanEdit()) | ||
395 | return; | ||
396 | |||
397 | SceneObjectPart sop = GetSOP(); | ||
398 | m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); | ||
399 | } | ||
400 | |||
401 | public void Say(string msg,int channel) | ||
402 | { | ||
403 | if (!CanEdit()) | ||
404 | return; | ||
405 | |||
406 | SceneObjectPart sop = GetSOP(); | ||
407 | m_rootScene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,channel, sop.AbsolutePosition, sop.Name, sop.UUID, false); | ||
408 | } | ||
409 | |||
410 | public void Dialog(UUID avatar, string message, string[] buttons, int chat_channel) | ||
411 | { | ||
412 | if (!CanEdit()) | ||
413 | return; | ||
414 | |||
415 | IDialogModule dm = m_rootScene.RequestModuleInterface<IDialogModule>(); | ||
416 | |||
417 | if (dm == null) | ||
418 | return; | ||
419 | |||
420 | if (buttons.Length < 1) | ||
421 | { | ||
422 | Say("ERROR: No less than 1 button can be shown",2147483647); | ||
423 | return; | ||
424 | } | ||
425 | if (buttons.Length > 12) | ||
426 | { | ||
427 | Say("ERROR: No more than 12 buttons can be shown",2147483647); | ||
428 | return; | ||
429 | } | ||
430 | |||
431 | foreach (string button in buttons) | ||
432 | { | ||
433 | if (button == String.Empty) | ||
434 | { | ||
435 | Say("ERROR: button label cannot be blank",2147483647); | ||
436 | return; | ||
437 | } | ||
438 | if (button.Length > 24) | ||
439 | { | ||
440 | Say("ERROR: button label cannot be longer than 24 characters",2147483647); | ||
441 | return; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | dm.SendDialogToUser( | ||
446 | avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID, | ||
447 | message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); | ||
448 | |||
449 | } | ||
450 | |||
451 | #endregion | ||
452 | |||
453 | |||
454 | #region Supporting Functions | ||
455 | |||
456 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces | ||
457 | private static void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | ||
458 | out bool hasDimple, out bool hasProfileCut) | ||
459 | { | ||
460 | if (primType == (int)PrimType.Box | ||
461 | || | ||
462 | primType == (int)PrimType.Cylinder | ||
463 | || | ||
464 | primType == (int)PrimType.Prism) | ||
465 | |||
466 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | ||
467 | else | ||
468 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | ||
469 | |||
470 | hasHollow = shape.ProfileHollow > 0; | ||
471 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | ||
472 | hasProfileCut = hasDimple; // is it the same thing? | ||
473 | |||
474 | } | ||
475 | |||
476 | private static int getScriptPrimType(PrimitiveBaseShape primShape) | ||
477 | { | ||
478 | if (primShape.SculptEntry) | ||
479 | return (int) PrimType.Sculpt; | ||
480 | if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square) | ||
481 | { | ||
482 | if (primShape.PathCurve == (byte) Extrusion.Straight) | ||
483 | return (int) PrimType.Box; | ||
484 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | ||
485 | return (int) PrimType.Tube; | ||
486 | } | ||
487 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Circle) | ||
488 | { | ||
489 | if (primShape.PathCurve == (byte) Extrusion.Straight) | ||
490 | return (int) PrimType.Cylinder; | ||
491 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | ||
492 | return (int) PrimType.Torus; | ||
493 | } | ||
494 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.HalfCircle) | ||
495 | { | ||
496 | if (primShape.PathCurve == (byte) Extrusion.Curve1 || primShape.PathCurve == (byte) Extrusion.Curve2) | ||
497 | return (int) PrimType.Sphere; | ||
498 | } | ||
499 | else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.EquilateralTriangle) | ||
500 | { | ||
501 | if (primShape.PathCurve == (byte) Extrusion.Straight) | ||
502 | return (int) PrimType.Prism; | ||
503 | if (primShape.PathCurve == (byte) Extrusion.Curve1) | ||
504 | return (int) PrimType.Ring; | ||
505 | } | ||
506 | return (int) PrimType.NotPrimitive; | ||
507 | } | ||
508 | |||
509 | private static int getNumberOfSides(SceneObjectPart part) | ||
510 | { | ||
511 | int ret; | ||
512 | bool hasCut; | ||
513 | bool hasHollow; | ||
514 | bool hasDimple; | ||
515 | bool hasProfileCut; | ||
516 | |||
517 | int primType = getScriptPrimType(part.Shape); | ||
518 | hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | ||
519 | |||
520 | switch (primType) | ||
521 | { | ||
522 | default: | ||
523 | case (int) PrimType.Box: | ||
524 | ret = 6; | ||
525 | if (hasCut) ret += 2; | ||
526 | if (hasHollow) ret += 1; | ||
527 | break; | ||
528 | case (int) PrimType.Cylinder: | ||
529 | ret = 3; | ||
530 | if (hasCut) ret += 2; | ||
531 | if (hasHollow) ret += 1; | ||
532 | break; | ||
533 | case (int) PrimType.Prism: | ||
534 | ret = 5; | ||
535 | if (hasCut) ret += 2; | ||
536 | if (hasHollow) ret += 1; | ||
537 | break; | ||
538 | case (int) PrimType.Sphere: | ||
539 | ret = 1; | ||
540 | if (hasCut) ret += 2; | ||
541 | if (hasDimple) ret += 2; | ||
542 | if (hasHollow) | ||
543 | ret += 1; // GOTCHA: LSL shows 2 additional sides here. | ||
544 | // This has been fixed, but may cause porting issues. | ||
545 | break; | ||
546 | case (int) PrimType.Torus: | ||
547 | ret = 1; | ||
548 | if (hasCut) ret += 2; | ||
549 | if (hasProfileCut) ret += 2; | ||
550 | if (hasHollow) ret += 1; | ||
551 | break; | ||
552 | case (int) PrimType.Tube: | ||
553 | ret = 4; | ||
554 | if (hasCut) ret += 2; | ||
555 | if (hasProfileCut) ret += 2; | ||
556 | if (hasHollow) ret += 1; | ||
557 | break; | ||
558 | case (int) PrimType.Ring: | ||
559 | ret = 3; | ||
560 | if (hasCut) ret += 2; | ||
561 | if (hasProfileCut) ret += 2; | ||
562 | if (hasHollow) ret += 1; | ||
563 | break; | ||
564 | case (int) PrimType.Sculpt: | ||
565 | ret = 1; | ||
566 | break; | ||
567 | } | ||
568 | return ret; | ||
569 | } | ||
570 | |||
571 | |||
572 | #endregion | ||
573 | |||
574 | #region IObjectPhysics | ||
575 | |||
576 | public bool Enabled | ||
577 | { | ||
578 | get { throw new System.NotImplementedException(); } | ||
579 | set { throw new System.NotImplementedException(); } | ||
580 | } | ||
581 | |||
582 | public bool Phantom | ||
583 | { | ||
584 | get { throw new System.NotImplementedException(); } | ||
585 | set { throw new System.NotImplementedException(); } | ||
586 | } | ||
587 | |||
588 | public bool PhantomCollisions | ||
589 | { | ||
590 | get { throw new System.NotImplementedException(); } | ||
591 | set { throw new System.NotImplementedException(); } | ||
592 | } | ||
593 | |||
594 | public double Density | ||
595 | { | ||
596 | get { return (GetSOP().PhysActor.Mass/Scale.X*Scale.Y/Scale.Z); } | ||
597 | set { throw new NotImplementedException(); } | ||
598 | } | ||
599 | |||
600 | public double Mass | ||
601 | { | ||
602 | get { return GetSOP().PhysActor.Mass; } | ||
603 | set { throw new NotImplementedException(); } | ||
604 | } | ||
605 | |||
606 | public double Buoyancy | ||
607 | { | ||
608 | get { return GetSOP().PhysActor.Buoyancy; } | ||
609 | set { GetSOP().PhysActor.Buoyancy = (float)value; } | ||
610 | } | ||
611 | |||
612 | public Vector3 GeometricCenter | ||
613 | { | ||
614 | get | ||
615 | { | ||
616 | Vector3 tmp = GetSOP().PhysActor.GeometricCenter; | ||
617 | return tmp; | ||
618 | } | ||
619 | } | ||
620 | |||
621 | public Vector3 CenterOfMass | ||
622 | { | ||
623 | get | ||
624 | { | ||
625 | Vector3 tmp = GetSOP().PhysActor.CenterOfMass; | ||
626 | return tmp; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | public Vector3 RotationalVelocity | ||
631 | { | ||
632 | get | ||
633 | { | ||
634 | Vector3 tmp = GetSOP().PhysActor.RotationalVelocity; | ||
635 | return tmp; | ||
636 | } | ||
637 | set | ||
638 | { | ||
639 | if (!CanEdit()) | ||
640 | return; | ||
641 | |||
642 | GetSOP().PhysActor.RotationalVelocity = value; | ||
643 | } | ||
644 | } | ||
645 | |||
646 | public Vector3 Velocity | ||
647 | { | ||
648 | get | ||
649 | { | ||
650 | Vector3 tmp = GetSOP().PhysActor.Velocity; | ||
651 | return tmp; | ||
652 | } | ||
653 | set | ||
654 | { | ||
655 | if (!CanEdit()) | ||
656 | return; | ||
657 | |||
658 | GetSOP().PhysActor.Velocity = value; | ||
659 | } | ||
660 | } | ||
661 | |||
662 | public Vector3 Torque | ||
663 | { | ||
664 | get | ||
665 | { | ||
666 | Vector3 tmp = GetSOP().PhysActor.Torque; | ||
667 | return tmp; | ||
668 | } | ||
669 | set | ||
670 | { | ||
671 | if (!CanEdit()) | ||
672 | return; | ||
673 | |||
674 | GetSOP().PhysActor.Torque = value; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | public Vector3 Acceleration | ||
679 | { | ||
680 | get | ||
681 | { | ||
682 | Vector3 tmp = GetSOP().PhysActor.Acceleration; | ||
683 | return tmp; | ||
684 | } | ||
685 | } | ||
686 | |||
687 | public Vector3 Force | ||
688 | { | ||
689 | get | ||
690 | { | ||
691 | Vector3 tmp = GetSOP().PhysActor.Force; | ||
692 | return tmp; | ||
693 | } | ||
694 | set | ||
695 | { | ||
696 | if (!CanEdit()) | ||
697 | return; | ||
698 | |||
699 | GetSOP().PhysActor.Force = value; | ||
700 | } | ||
701 | } | ||
702 | |||
703 | public bool FloatOnWater | ||
704 | { | ||
705 | set | ||
706 | { | ||
707 | if (!CanEdit()) | ||
708 | return; | ||
709 | GetSOP().PhysActor.FloatOnWater = value; | ||
710 | } | ||
711 | } | ||
712 | |||
713 | public void AddForce(Vector3 force, bool pushforce) | ||
714 | { | ||
715 | if (!CanEdit()) | ||
716 | return; | ||
717 | |||
718 | GetSOP().PhysActor.AddForce(force, pushforce); | ||
719 | } | ||
720 | |||
721 | public void AddAngularForce(Vector3 force, bool pushforce) | ||
722 | { | ||
723 | if (!CanEdit()) | ||
724 | return; | ||
725 | |||
726 | GetSOP().PhysActor.AddAngularForce(force, pushforce); | ||
727 | } | ||
728 | |||
729 | public void SetMomentum(Vector3 momentum) | ||
730 | { | ||
731 | if (!CanEdit()) | ||
732 | return; | ||
733 | |||
734 | GetSOP().PhysActor.SetMomentum(momentum); | ||
735 | } | ||
736 | |||
737 | #endregion | ||
738 | |||
739 | #region Implementation of IObjectShape | ||
740 | |||
741 | private UUID m_sculptMap = UUID.Zero; | ||
742 | |||
743 | public UUID SculptMap | ||
744 | { | ||
745 | get { return m_sculptMap; } | ||
746 | set | ||
747 | { | ||
748 | if (!CanEdit()) | ||
749 | return; | ||
750 | |||
751 | m_sculptMap = value; | ||
752 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | ||
753 | } | ||
754 | } | ||
755 | |||
756 | private SculptType m_sculptType = Object.SculptType.Default; | ||
757 | |||
758 | public SculptType SculptType | ||
759 | { | ||
760 | get { return m_sculptType; } | ||
761 | set | ||
762 | { | ||
763 | if (!CanEdit()) | ||
764 | return; | ||
765 | |||
766 | m_sculptType = value; | ||
767 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | ||
768 | } | ||
769 | } | ||
770 | |||
771 | public HoleShape HoleType | ||
772 | { | ||
773 | get { throw new System.NotImplementedException(); } | ||
774 | set { throw new System.NotImplementedException(); } | ||
775 | } | ||
776 | |||
777 | public double HoleSize | ||
778 | { | ||
779 | get { throw new System.NotImplementedException(); } | ||
780 | set { throw new System.NotImplementedException(); } | ||
781 | } | ||
782 | |||
783 | public PrimType PrimType | ||
784 | { | ||
785 | get { return (PrimType)getScriptPrimType(GetSOP().Shape); } | ||
786 | set { throw new System.NotImplementedException(); } | ||
787 | } | ||
788 | |||
789 | private void SetPrimitiveSculpted(UUID map, byte type) | ||
790 | { | ||
791 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | ||
792 | |||
793 | SceneObjectPart part = GetSOP(); | ||
794 | |||
795 | UUID sculptId = map; | ||
796 | |||
797 | shapeBlock.ObjectLocalID = part.LocalId; | ||
798 | shapeBlock.PathScaleX = 100; | ||
799 | shapeBlock.PathScaleY = 150; | ||
800 | |||
801 | // retain pathcurve | ||
802 | shapeBlock.PathCurve = part.Shape.PathCurve; | ||
803 | |||
804 | part.Shape.SetSculptProperties((byte)type, sculptId); | ||
805 | part.Shape.SculptEntry = true; | ||
806 | part.UpdateShape(shapeBlock); | ||
807 | } | ||
808 | |||
809 | |||
810 | #endregion | ||
811 | |||
812 | |||
813 | #region Implementation of IObjectSound | ||
814 | |||
815 | public IObjectSound Sound | ||
816 | { | ||
817 | get { return this; } | ||
818 | } | ||
819 | |||
820 | public void Play(UUID asset, double volume) | ||
821 | { | ||
822 | if (!CanEdit()) | ||
823 | return; | ||
824 | ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>(); | ||
825 | if (module != null) | ||
826 | { | ||
827 | module.SendSound(GetSOP().UUID, asset, volume, true, 0, false, false); | ||
828 | } | ||
829 | } | ||
830 | |||
831 | #endregion | ||
832 | } | ||
833 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectInventory.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectInventory.cs deleted file mode 100644 index 8c3158c..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectInventory.cs +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
37 | { | ||
38 | public class SOPObjectInventory : IObjectInventory | ||
39 | { | ||
40 | TaskInventoryDictionary m_privateInventory; /// OpenSim's task inventory | ||
41 | Dictionary<UUID, IInventoryItem> m_publicInventory; /// MRM's inventory | ||
42 | Scene m_rootScene; | ||
43 | |||
44 | public SOPObjectInventory(Scene rootScene, TaskInventoryDictionary taskInventory) | ||
45 | { | ||
46 | m_rootScene = rootScene; | ||
47 | m_privateInventory = taskInventory; | ||
48 | m_publicInventory = new Dictionary<UUID, IInventoryItem>(); | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// Fully populate the public dictionary with the contents of the private dictionary | ||
53 | /// </summary> | ||
54 | /// <description> | ||
55 | /// This will only convert those items which hasn't already been converted. ensuring that | ||
56 | /// no items are converted twice, and that any references already in use are maintained. | ||
57 | /// </description> | ||
58 | private void SynchronizeDictionaries() | ||
59 | { | ||
60 | foreach (TaskInventoryItem privateItem in m_privateInventory.Values) | ||
61 | if (!m_publicInventory.ContainsKey(privateItem.ItemID)) | ||
62 | m_publicInventory.Add(privateItem.ItemID, new InventoryItem(m_rootScene, privateItem)); | ||
63 | } | ||
64 | |||
65 | #region IDictionary<UUID, IInventoryItem> implementation | ||
66 | public void Add (UUID key, IInventoryItem value) | ||
67 | { | ||
68 | m_publicInventory.Add(key, value); | ||
69 | m_privateInventory.Add(key, InventoryItem.FromInterface(value).ToTaskInventoryItem()); | ||
70 | } | ||
71 | |||
72 | public bool ContainsKey (UUID key) | ||
73 | { | ||
74 | return m_privateInventory.ContainsKey(key); | ||
75 | } | ||
76 | |||
77 | public bool Remove (UUID key) | ||
78 | { | ||
79 | m_publicInventory.Remove(key); | ||
80 | return m_privateInventory.Remove(key); | ||
81 | } | ||
82 | |||
83 | public bool TryGetValue (UUID key, out IInventoryItem value) | ||
84 | { | ||
85 | value = null; | ||
86 | |||
87 | bool result = false; | ||
88 | if (!m_publicInventory.TryGetValue(key, out value)) | ||
89 | { | ||
90 | // wasn't found in the public inventory | ||
91 | TaskInventoryItem privateItem; | ||
92 | |||
93 | result = m_privateInventory.TryGetValue(key, out privateItem); | ||
94 | if (result) | ||
95 | { | ||
96 | value = new InventoryItem(m_rootScene, privateItem); | ||
97 | m_publicInventory.Add(key, value); // add item, so we don't convert again | ||
98 | } | ||
99 | } else | ||
100 | return true; | ||
101 | |||
102 | return result; | ||
103 | } | ||
104 | |||
105 | public ICollection<UUID> Keys { | ||
106 | get { | ||
107 | return m_privateInventory.Keys; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | public ICollection<IInventoryItem> Values { | ||
112 | get { | ||
113 | SynchronizeDictionaries(); | ||
114 | return m_publicInventory.Values; | ||
115 | } | ||
116 | } | ||
117 | #endregion | ||
118 | |||
119 | #region IEnumerable<KeyValuePair<UUID, IInventoryItem>> implementation | ||
120 | public IEnumerator<KeyValuePair<UUID, IInventoryItem>> GetEnumerator () | ||
121 | { | ||
122 | SynchronizeDictionaries(); | ||
123 | return m_publicInventory.GetEnumerator(); | ||
124 | } | ||
125 | |||
126 | #endregion | ||
127 | |||
128 | #region IEnumerable implementation | ||
129 | IEnumerator IEnumerable.GetEnumerator () | ||
130 | { | ||
131 | SynchronizeDictionaries(); | ||
132 | return m_publicInventory.GetEnumerator(); | ||
133 | } | ||
134 | |||
135 | #endregion | ||
136 | |||
137 | #region ICollection<KeyValuePair<UUID, IInventoryItem>> implementation | ||
138 | public void Add (KeyValuePair<UUID, IInventoryItem> item) | ||
139 | { | ||
140 | Add(item.Key, item.Value); | ||
141 | } | ||
142 | |||
143 | public void Clear () | ||
144 | { | ||
145 | m_publicInventory.Clear(); | ||
146 | m_privateInventory.Clear(); | ||
147 | } | ||
148 | |||
149 | public bool Contains (KeyValuePair<UUID, IInventoryItem> item) | ||
150 | { | ||
151 | return m_privateInventory.ContainsKey(item.Key); | ||
152 | } | ||
153 | |||
154 | public void CopyTo (KeyValuePair<UUID, IInventoryItem>[] array, int arrayIndex) | ||
155 | { | ||
156 | throw new NotImplementedException(); | ||
157 | } | ||
158 | |||
159 | public bool Remove (KeyValuePair<UUID, IInventoryItem> item) | ||
160 | { | ||
161 | return Remove(item.Key); | ||
162 | } | ||
163 | |||
164 | public int Count { | ||
165 | get { | ||
166 | return m_privateInventory.Count; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | public bool IsReadOnly { | ||
171 | get { | ||
172 | return false; | ||
173 | } | ||
174 | } | ||
175 | #endregion | ||
176 | |||
177 | #region Explicit implementations | ||
178 | IInventoryItem System.Collections.Generic.IDictionary<UUID, IInventoryItem>.this[UUID key] | ||
179 | { | ||
180 | get { | ||
181 | IInventoryItem result; | ||
182 | if (TryGetValue(key, out result)) | ||
183 | return result; | ||
184 | else | ||
185 | throw new KeyNotFoundException("[MRM] The requrested item ID could not be found"); | ||
186 | } | ||
187 | set { | ||
188 | m_publicInventory[key] = value; | ||
189 | m_privateInventory[key] = InventoryItem.FromInterface(value).ToTaskInventoryItem(); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<UUID, IInventoryItem>>.CopyTo(System.Collections.Generic.KeyValuePair<UUID,IInventoryItem>[] array, int offset) | ||
194 | { | ||
195 | throw new NotImplementedException(); | ||
196 | } | ||
197 | #endregion | ||
198 | |||
199 | public IInventoryItem this[string name] | ||
200 | { | ||
201 | get { | ||
202 | foreach (TaskInventoryItem i in m_privateInventory.Values) | ||
203 | if (i.Name == name) | ||
204 | { | ||
205 | if (!m_publicInventory.ContainsKey(i.ItemID)) | ||
206 | m_publicInventory.Add(i.ItemID, new InventoryItem(m_rootScene, i)); | ||
207 | |||
208 | return m_publicInventory[i.ItemID]; | ||
209 | } | ||
210 | throw new KeyNotFoundException(); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | } | ||
215 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs deleted file mode 100644 index 62e4485..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Drawing; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
33 | { | ||
34 | class SOPObjectMaterial : System.MarshalByRefObject, IObjectMaterial | ||
35 | { | ||
36 | private readonly int m_face; | ||
37 | private readonly SceneObjectPart m_parent; | ||
38 | |||
39 | public SOPObjectMaterial(int m_face, SceneObjectPart m_parent) | ||
40 | { | ||
41 | this.m_face = m_face; | ||
42 | this.m_parent = m_parent; | ||
43 | } | ||
44 | |||
45 | public Color Color | ||
46 | { | ||
47 | get | ||
48 | { | ||
49 | Color4 res = GetTexface().RGBA; | ||
50 | return Color.FromArgb((int) (res.A*255), (int) (res.R*255), (int) (res.G*255), (int) (res.B*255)); | ||
51 | } | ||
52 | set | ||
53 | { | ||
54 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
55 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
56 | texface.RGBA = new Color4(value.R,value.G,value.B,value.A); | ||
57 | tex.FaceTextures[m_face] = texface; | ||
58 | m_parent.UpdateTextureEntry(tex); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | public UUID Texture | ||
63 | { | ||
64 | get | ||
65 | { | ||
66 | Primitive.TextureEntryFace texface = GetTexface(); | ||
67 | return texface.TextureID; | ||
68 | } | ||
69 | set | ||
70 | { | ||
71 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
72 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
73 | texface.TextureID = value; | ||
74 | tex.FaceTextures[m_face] = texface; | ||
75 | m_parent.UpdateTextureEntry(tex); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | private Primitive.TextureEntryFace GetTexface() | ||
80 | { | ||
81 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
82 | return tex.GetFace((uint)m_face); | ||
83 | } | ||
84 | |||
85 | public TextureMapping Mapping | ||
86 | { | ||
87 | get { throw new System.NotImplementedException(); } | ||
88 | set { throw new System.NotImplementedException(); } | ||
89 | } | ||
90 | |||
91 | public bool Bright | ||
92 | { | ||
93 | get { return GetTexface().Fullbright; } | ||
94 | set | ||
95 | { | ||
96 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
97 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
98 | texface.Fullbright = value; | ||
99 | tex.FaceTextures[m_face] = texface; | ||
100 | m_parent.UpdateTextureEntry(tex); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public double Bloom | ||
105 | { | ||
106 | get { return GetTexface().Glow; } | ||
107 | set | ||
108 | { | ||
109 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
110 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
111 | texface.Glow = (float) value; | ||
112 | tex.FaceTextures[m_face] = texface; | ||
113 | m_parent.UpdateTextureEntry(tex); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | public bool Shiny | ||
118 | { | ||
119 | get { return GetTexface().Shiny != Shininess.None; } | ||
120 | set | ||
121 | { | ||
122 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
123 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
124 | texface.Shiny = value ? Shininess.High : Shininess.None; | ||
125 | tex.FaceTextures[m_face] = texface; | ||
126 | m_parent.UpdateTextureEntry(tex); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public bool BumpMap | ||
131 | { | ||
132 | get { return GetTexface().Bump == Bumpiness.None; } | ||
133 | set { throw new System.NotImplementedException(); } | ||
134 | } | ||
135 | } | ||
136 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs deleted file mode 100644 index a380f66..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Security; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
37 | { | ||
38 | class SPAvatar : System.MarshalByRefObject, IAvatar | ||
39 | { | ||
40 | private readonly Scene m_rootScene; | ||
41 | private readonly UUID m_ID; | ||
42 | private readonly ISecurityCredential m_security; | ||
43 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | public SPAvatar(Scene scene, UUID ID, ISecurityCredential security) | ||
46 | { | ||
47 | m_rootScene = scene; | ||
48 | m_security = security; | ||
49 | m_ID = ID; | ||
50 | } | ||
51 | |||
52 | private ScenePresence GetSP() | ||
53 | { | ||
54 | return m_rootScene.GetScenePresence(m_ID); | ||
55 | } | ||
56 | |||
57 | public string Name | ||
58 | { | ||
59 | get { return GetSP().Name; } | ||
60 | set { throw new SecurityException("Avatar Names are a read-only property."); } | ||
61 | } | ||
62 | |||
63 | public UUID GlobalID | ||
64 | { | ||
65 | get { return m_ID; } | ||
66 | } | ||
67 | |||
68 | public Vector3 WorldPosition | ||
69 | { | ||
70 | get { return GetSP().AbsolutePosition; } | ||
71 | set { GetSP().Teleport(value); } | ||
72 | } | ||
73 | |||
74 | public bool IsChildAgent | ||
75 | { | ||
76 | get { return GetSP().IsChildAgent; } | ||
77 | } | ||
78 | |||
79 | #region IAvatar implementation | ||
80 | public IAvatarAttachment[] Attachments | ||
81 | { | ||
82 | get { | ||
83 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); | ||
84 | |||
85 | List<AvatarAttachment> internalAttachments = GetSP().Appearance.GetAttachments(); | ||
86 | foreach (AvatarAttachment attach in internalAttachments) | ||
87 | { | ||
88 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, attach.AttachPoint, | ||
89 | new UUID(attach.ItemID), | ||
90 | new UUID(attach.AssetID), m_security)); | ||
91 | } | ||
92 | |||
93 | return attachments.ToArray(); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | public void LoadUrl(IObject sender, string message, string url) | ||
98 | { | ||
99 | IDialogModule dm = m_rootScene.RequestModuleInterface<IDialogModule>(); | ||
100 | if (dm != null) | ||
101 | dm.SendUrlToUser(GetSP().UUID, sender.Name, sender.GlobalID, GetSP().UUID, false, message, url); | ||
102 | } | ||
103 | #endregion | ||
104 | } | ||
105 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs deleted file mode 100644 index bcf6053..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
34 | { | ||
35 | public class SPAvatarAttachment : IAvatarAttachment | ||
36 | { | ||
37 | private readonly Scene m_rootScene; | ||
38 | //private readonly IAvatar m_parent; | ||
39 | private readonly int m_location; | ||
40 | //private readonly UUID m_itemId; | ||
41 | private readonly UUID m_assetId; | ||
42 | |||
43 | private readonly ISecurityCredential m_security; | ||
44 | |||
45 | public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId, ISecurityCredential security) | ||
46 | { | ||
47 | m_rootScene = rootScene; | ||
48 | m_security = security; | ||
49 | //m_parent = self; | ||
50 | m_location = location; | ||
51 | //m_itemId = itemId; | ||
52 | m_assetId = assetId; | ||
53 | } | ||
54 | |||
55 | public int Location { get { return m_location; } } | ||
56 | |||
57 | public IObject Asset | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId, m_security); | ||
62 | } | ||
63 | } | ||
64 | } | ||
65 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs deleted file mode 100644 index bc7f6cb..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
35 | { | ||
36 | class SecurityCredential : ISecurityCredential | ||
37 | { | ||
38 | private readonly ISocialEntity m_owner; | ||
39 | private readonly Scene m_scene; | ||
40 | |||
41 | public SecurityCredential(ISocialEntity m_owner, Scene m_scene) | ||
42 | { | ||
43 | this.m_owner = m_owner; | ||
44 | this.m_scene = m_scene; | ||
45 | } | ||
46 | |||
47 | public ISocialEntity owner | ||
48 | { | ||
49 | get { return m_owner; } | ||
50 | } | ||
51 | |||
52 | public bool CanEditObject(IObject target) | ||
53 | { | ||
54 | return m_scene.Permissions.CanEditObject(target.GlobalID, m_owner.GlobalID); | ||
55 | } | ||
56 | |||
57 | public bool CanEditTerrain(int x, int y) | ||
58 | { | ||
59 | return m_scene.Permissions.CanTerraformLand(m_owner.GlobalID, new Vector3(x, y, 0)); | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs deleted file mode 100644 index 778bf7d..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | ||
29 | |||
30 | namespace OpenSim | ||
31 | { | ||
32 | class DrunkenTextAppreciationModule : MRMBase | ||
33 | { | ||
34 | public override void Start() | ||
35 | { | ||
36 | World.OnChat += World_OnChat; | ||
37 | } | ||
38 | |||
39 | void World_OnChat(IWorld sender, ChatEventArgs e) | ||
40 | { | ||
41 | if (e.Sender is IAvatar) | ||
42 | { | ||
43 | if (!e.Text.Contains("hic!")) | ||
44 | { | ||
45 | e.Text = e.Text.Replace("s", "sh"); | ||
46 | e.Text = e.Text.Replace("S", "Sh"); | ||
47 | e.Text += " ...hic!"; | ||
48 | |||
49 | Host.Object.Say(e.Text); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | if (e.Sender is IObject) | ||
54 | { | ||
55 | // Ignore | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public override void Stop() | ||
60 | { | ||
61 | |||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt deleted file mode 100644 index d2c204a..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | //MRM:C# | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | ||
5 | |||
6 | namespace OpenSim | ||
7 | { | ||
8 | class MiniModule : MRMBase | ||
9 | { | ||
10 | public microthreaded void MicroThreadFunction(string testparam) | ||
11 | { | ||
12 | Host.Object.Say("Hello " + testparam); | ||
13 | |||
14 | relax; // the 'relax' keyword gives up processing time. | ||
15 | // and should be inserted before, after or in | ||
16 | // any computationally "heavy" zones. | ||
17 | |||
18 | int c = 500; | ||
19 | while(c-- < 0) { | ||
20 | Host.Object.Say("C=" + c); | ||
21 | relax; // Putting 'relax' in microthreaded loops | ||
22 | // is an easy way to lower the CPU tax | ||
23 | // on your script. | ||
24 | } | ||
25 | |||
26 | } | ||
27 | |||
28 | public override void Start() | ||
29 | { | ||
30 | Host.Microthreads.Run( | ||
31 | MicroThreadFunction("World!") | ||
32 | ); | ||
33 | } | ||
34 | |||
35 | public override void Stop() | ||
36 | { | ||
37 | |||
38 | } | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs deleted file mode 100644 index 724c2a9..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/TestModule.cs +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | ||
31 | |||
32 | namespace OpenSim | ||
33 | { | ||
34 | class MiniModule : MRMBase | ||
35 | { | ||
36 | // private microthreaded Function(params...) | ||
37 | private IEnumerable TestMicrothread(string param) | ||
38 | { | ||
39 | Host.Console.Info("Microthreaded " + param); | ||
40 | // relax; | ||
41 | yield return null; | ||
42 | Host.Console.Info("Microthreaded 2" + param); | ||
43 | yield return null; | ||
44 | int c = 100; | ||
45 | while (c-- < 0) | ||
46 | { | ||
47 | Host.Console.Info("Microthreaded Looped " + c + " " + param); | ||
48 | yield return null; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public void Microthread(IEnumerable thread) | ||
53 | { | ||
54 | |||
55 | } | ||
56 | |||
57 | public void RunMicrothread() | ||
58 | { | ||
59 | List<IEnumerator> threads = new List<IEnumerator>(); | ||
60 | threads.Add(TestMicrothread("A").GetEnumerator()); | ||
61 | threads.Add(TestMicrothread("B").GetEnumerator()); | ||
62 | threads.Add(TestMicrothread("C").GetEnumerator()); | ||
63 | |||
64 | Microthread(TestMicrothread("Ohai")); | ||
65 | |||
66 | int i = 0; | ||
67 | while (threads.Count > 0) | ||
68 | { | ||
69 | i++; | ||
70 | bool running = threads[i%threads.Count].MoveNext(); | ||
71 | |||
72 | if (!running) | ||
73 | threads.Remove(threads[i%threads.Count]); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | public override void Start() | ||
78 | { | ||
79 | // Say Hello | ||
80 | Host.Object.Say("Hello, Avatar!"); | ||
81 | |||
82 | // Register ourselves to listen | ||
83 | // for touch events. | ||
84 | Host.Object.OnTouch += OnTouched; | ||
85 | } | ||
86 | |||
87 | // This is our touch event handler | ||
88 | void OnTouched(IObject sender, TouchEventArgs e) | ||
89 | { | ||
90 | Host.Object.Say("Touched."); | ||
91 | } | ||
92 | |||
93 | public override void Stop() | ||
94 | { | ||
95 | |||
96 | } | ||
97 | } | ||
98 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs deleted file mode 100644 index eff70ef..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ /dev/null | |||
@@ -1,250 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Interfaces; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX; | ||
34 | |||
35 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
36 | { | ||
37 | public class World : System.MarshalByRefObject, IWorld, IWorldAudio | ||
38 | { | ||
39 | private readonly Scene m_internalScene; | ||
40 | private readonly ISecurityCredential m_security; | ||
41 | private readonly Heightmap m_heights; | ||
42 | |||
43 | private readonly ObjectAccessor m_objs; | ||
44 | |||
45 | public World(Scene internalScene, ISecurityCredential securityCredential) | ||
46 | { | ||
47 | m_security = securityCredential; | ||
48 | m_internalScene = internalScene; | ||
49 | m_heights = new Heightmap(m_internalScene); | ||
50 | m_objs = new ObjectAccessor(m_internalScene, securityCredential); | ||
51 | } | ||
52 | |||
53 | #region Events | ||
54 | |||
55 | #region OnNewUser | ||
56 | |||
57 | private event OnNewUserDelegate _OnNewUser; | ||
58 | private bool _OnNewUserActive; | ||
59 | |||
60 | public event OnNewUserDelegate OnNewUser | ||
61 | { | ||
62 | add | ||
63 | { | ||
64 | if (!_OnNewUserActive) | ||
65 | { | ||
66 | _OnNewUserActive = true; | ||
67 | m_internalScene.EventManager.OnNewPresence += EventManager_OnNewPresence; | ||
68 | } | ||
69 | |||
70 | _OnNewUser += value; | ||
71 | } | ||
72 | remove | ||
73 | { | ||
74 | _OnNewUser -= value; | ||
75 | |||
76 | if (_OnNewUser == null) | ||
77 | { | ||
78 | _OnNewUserActive = false; | ||
79 | m_internalScene.EventManager.OnNewPresence -= EventManager_OnNewPresence; | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | |||
84 | void EventManager_OnNewPresence(ScenePresence presence) | ||
85 | { | ||
86 | if (_OnNewUser != null) | ||
87 | { | ||
88 | NewUserEventArgs e = new NewUserEventArgs(); | ||
89 | e.Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security); | ||
90 | _OnNewUser(this, e); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | #endregion | ||
95 | |||
96 | #region OnChat | ||
97 | private event OnChatDelegate _OnChat; | ||
98 | private bool _OnChatActive; | ||
99 | |||
100 | public IWorldAudio Audio | ||
101 | { | ||
102 | get { return this; } | ||
103 | } | ||
104 | |||
105 | public event OnChatDelegate OnChat | ||
106 | { | ||
107 | add | ||
108 | { | ||
109 | if (!_OnChatActive) | ||
110 | { | ||
111 | _OnChatActive = true; | ||
112 | m_internalScene.EventManager.OnChatFromClient += EventManager_OnChatFromClient; | ||
113 | m_internalScene.EventManager.OnChatFromWorld += EventManager_OnChatFromWorld; | ||
114 | } | ||
115 | |||
116 | _OnChat += value; | ||
117 | } | ||
118 | remove | ||
119 | { | ||
120 | _OnChat -= value; | ||
121 | |||
122 | if (_OnChat == null) | ||
123 | { | ||
124 | _OnChatActive = false; | ||
125 | m_internalScene.EventManager.OnChatFromClient -= EventManager_OnChatFromClient; | ||
126 | m_internalScene.EventManager.OnChatFromWorld -= EventManager_OnChatFromWorld; | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | |||
131 | void EventManager_OnChatFromWorld(object sender, OSChatMessage chat) | ||
132 | { | ||
133 | if (_OnChat != null) | ||
134 | { | ||
135 | HandleChatPacket(chat); | ||
136 | return; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | private void HandleChatPacket(OSChatMessage chat) | ||
141 | { | ||
142 | if (string.IsNullOrEmpty(chat.Message)) | ||
143 | return; | ||
144 | |||
145 | // Object? | ||
146 | if (chat.Sender == null && chat.SenderObject != null) | ||
147 | { | ||
148 | ChatEventArgs e = new ChatEventArgs(); | ||
149 | e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId, m_security); | ||
150 | e.Text = chat.Message; | ||
151 | e.Channel = chat.Channel; | ||
152 | |||
153 | _OnChat(this, e); | ||
154 | return; | ||
155 | } | ||
156 | // Avatar? | ||
157 | if (chat.Sender != null && chat.SenderObject == null) | ||
158 | { | ||
159 | ChatEventArgs e = new ChatEventArgs(); | ||
160 | e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID, m_security); | ||
161 | e.Text = chat.Message; | ||
162 | e.Channel = chat.Channel; | ||
163 | |||
164 | _OnChat(this, e); | ||
165 | return; | ||
166 | } | ||
167 | // Skip if other | ||
168 | } | ||
169 | |||
170 | void EventManager_OnChatFromClient(object sender, OSChatMessage chat) | ||
171 | { | ||
172 | if (_OnChat != null) | ||
173 | { | ||
174 | HandleChatPacket(chat); | ||
175 | return; | ||
176 | } | ||
177 | } | ||
178 | #endregion | ||
179 | |||
180 | #endregion | ||
181 | |||
182 | public IObjectAccessor Objects | ||
183 | { | ||
184 | get { return m_objs; } | ||
185 | } | ||
186 | |||
187 | public IParcel[] Parcels | ||
188 | { | ||
189 | get | ||
190 | { | ||
191 | List<ILandObject> m_los = m_internalScene.LandChannel.AllParcels(); | ||
192 | List<IParcel> m_parcels = new List<IParcel>(m_los.Count); | ||
193 | |||
194 | foreach (ILandObject landObject in m_los) | ||
195 | { | ||
196 | m_parcels.Add(new LOParcel(m_internalScene, landObject.LandData.LocalID)); | ||
197 | } | ||
198 | |||
199 | return m_parcels.ToArray(); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | |||
204 | public IAvatar[] Avatars | ||
205 | { | ||
206 | get | ||
207 | { | ||
208 | EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); | ||
209 | IAvatar[] rets = new IAvatar[ents.Length]; | ||
210 | |||
211 | for (int i = 0; i < ents.Length; i++) | ||
212 | { | ||
213 | EntityBase ent = ents[i]; | ||
214 | rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); | ||
215 | } | ||
216 | |||
217 | return rets; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public IHeightmap Terrain | ||
222 | { | ||
223 | get { return m_heights; } | ||
224 | } | ||
225 | |||
226 | #region Implementation of IWorldAudio | ||
227 | |||
228 | public void PlaySound(UUID audio, Vector3 position, double volume) | ||
229 | { | ||
230 | ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>(); | ||
231 | if (soundModule != null) | ||
232 | { | ||
233 | soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position, | ||
234 | m_internalScene.RegionInfo.RegionHandle); | ||
235 | } | ||
236 | } | ||
237 | |||
238 | public void PlaySound(UUID audio, Vector3 position) | ||
239 | { | ||
240 | ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>(); | ||
241 | if (soundModule != null) | ||
242 | { | ||
243 | soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position, | ||
244 | m_internalScene.RegionInfo.RegionHandle); | ||
245 | } | ||
246 | } | ||
247 | |||
248 | #endregion | ||
249 | } | ||
250 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs deleted file mode 100644 index 712a676..0000000 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/WorldX/IWorldAudio.cs +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX | ||
34 | { | ||
35 | public interface IWorldAudio | ||
36 | { | ||
37 | void PlaySound(UUID audio, Vector3 position, double volume); | ||
38 | void PlaySound(UUID audio, Vector3 position); | ||
39 | } | ||
40 | } | ||