diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
4 files changed, 140 insertions, 53 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs index dc2e3fa..ef1e896 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs | |||
@@ -157,7 +157,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
157 | 157 | ||
158 | bool IsFlexible { get; set; } | 158 | bool IsFlexible { get; set; } |
159 | 159 | ||
160 | PrimType PrimShape { get; set; } | 160 | IObjectShape Shape { get; } |
161 | |||
161 | // TODO: | 162 | // TODO: |
162 | // PrimHole | 163 | // PrimHole |
163 | // Repeats, Offsets, Cut/Dimple/ProfileCut | 164 | // Repeats, Offsets, Cut/Dimple/ProfileCut |
@@ -191,19 +192,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
191 | Flesh | 192 | Flesh |
192 | } | 193 | } |
193 | 194 | ||
194 | public enum PrimType | ||
195 | { | ||
196 | NotPrimitive = 255, | ||
197 | Box = 0, | ||
198 | Cylinder = 1, | ||
199 | Prism = 2, | ||
200 | Sphere = 3, | ||
201 | Torus = 4, | ||
202 | Tube = 5, | ||
203 | Ring = 6, | ||
204 | Sculpt = 7 | ||
205 | } | ||
206 | |||
207 | public enum TextureMapping | 195 | public enum TextureMapping |
208 | { | 196 | { |
209 | Default, | 197 | Default, |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs index 46b5041..f850a94 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IScheduler.cs | |||
@@ -1,31 +1,4 @@ | |||
1 | /* | 1 | using System; |
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 | 2 | ||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 3 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
31 | { | 4 | { |
@@ -50,21 +23,30 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
50 | /// Fire this scheduler only when the region has | 23 | /// Fire this scheduler only when the region has |
51 | /// a user in it. | 24 | /// a user in it. |
52 | /// </summary> | 25 | /// </summary> |
53 | bool WhenRegionOccupied { get; set; } | 26 | bool IfOccupied { get; set; } |
27 | |||
28 | /// <summary> | ||
29 | /// Fire this only when simulator performance | ||
30 | /// is reasonable. (eg sysload <= 1.0) | ||
31 | /// </summary> | ||
32 | bool IfHealthy { get; set; } | ||
54 | 33 | ||
55 | /// <summary> | 34 | /// <summary> |
56 | /// Fire this event only when the region is visible | 35 | /// Fire this event only when the region is visible |
57 | /// to a child agent, or there is a full agent | 36 | /// to a child agent, or there is a full agent |
58 | /// in this region. | 37 | /// in this region. |
59 | /// </summary> | 38 | /// </summary> |
60 | bool WhenRegionVisible { get; set; } | 39 | bool IfVisible { get; set; } |
61 | 40 | ||
62 | /// <summary> | 41 | /// <summary> |
63 | /// Determines whether this runs in the master scheduler thread, or a new thread | 42 | /// Determines whether this runs in the master scheduler thread, or a new thread |
64 | /// is spawned to handle your request. Running in scheduler may mean that your | 43 | /// is spawned to handle your request. Running in scheduler may mean that your |
65 | /// code does not execute perfectly on time, however will result in a lower | 44 | /// code does not execute perfectly on time, however will result in better |
66 | /// processor cost to running your code. | 45 | /// region performance. |
67 | /// </summary> | 46 | /// </summary> |
47 | /// <remarks> | ||
48 | /// Default: true | ||
49 | /// </remarks> | ||
68 | bool Schedule { get; set; } | 50 | bool Schedule { get; set; } |
69 | } | 51 | } |
70 | } | 52 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs new file mode 100644 index 0000000..ed24680 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectShape.cs | |||
@@ -0,0 +1,48 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenMetaverse; | ||
5 | |||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | ||
7 | { | ||
8 | public enum SculptType | ||
9 | { | ||
10 | Default = 1, | ||
11 | Sphere = 1, | ||
12 | Torus = 2, | ||
13 | Plane = 3, | ||
14 | Cylinder = 4 | ||
15 | } | ||
16 | |||
17 | public enum HoleShape | ||
18 | { | ||
19 | Default = 0x00, | ||
20 | Circle = 0x10, | ||
21 | Square = 0x20, | ||
22 | Triangle = 0x30 | ||
23 | } | ||
24 | |||
25 | public enum PrimType | ||
26 | { | ||
27 | NotPrimitive = 255, | ||
28 | Box = 0, | ||
29 | Cylinder = 1, | ||
30 | Prism = 2, | ||
31 | Sphere = 3, | ||
32 | Torus = 4, | ||
33 | Tube = 5, | ||
34 | Ring = 6, | ||
35 | Sculpt = 7 | ||
36 | } | ||
37 | |||
38 | public interface IObjectShape | ||
39 | { | ||
40 | UUID SculptMap { get; set; } | ||
41 | SculptType SculptType { get; set; } | ||
42 | |||
43 | HoleShape HoleType { get; set; } | ||
44 | Double HoleSize { get; set; } | ||
45 | PrimType PrimType { get; set; } | ||
46 | |||
47 | } | ||
48 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 22a1126..f29522f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -28,14 +28,17 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; | 34 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; |
34 | using OpenSim.Region.Physics.Manager; | 35 | using OpenSim.Region.Physics.Manager; |
36 | using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; | ||
37 | using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; | ||
35 | 38 | ||
36 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 39 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
37 | { | 40 | { |
38 | class SOPObject : MarshalByRefObject, IObject, IObjectPhysics | 41 | class SOPObject : MarshalByRefObject, IObject, IObjectPhysics, IObjectShape |
39 | { | 42 | { |
40 | private readonly Scene m_rootScene; | 43 | private readonly Scene m_rootScene; |
41 | private readonly uint m_localID; | 44 | private readonly uint m_localID; |
@@ -282,12 +285,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
282 | set { throw new System.NotImplementedException(); } | 285 | set { throw new System.NotImplementedException(); } |
283 | } | 286 | } |
284 | 287 | ||
285 | public PrimType PrimShape | ||
286 | { | ||
287 | get { return (PrimType) getScriptPrimType(GetSOP().Shape); } | ||
288 | set { throw new System.NotImplementedException(); } | ||
289 | } | ||
290 | |||
291 | public PhysicsMaterial PhysicsMaterial | 288 | public PhysicsMaterial PhysicsMaterial |
292 | { | 289 | { |
293 | get { throw new System.NotImplementedException(); } | 290 | get { throw new System.NotImplementedException(); } |
@@ -299,6 +296,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
299 | get { return this; } | 296 | get { return this; } |
300 | } | 297 | } |
301 | 298 | ||
299 | public IObjectShape Shape | ||
300 | { | ||
301 | get { return this; } | ||
302 | } | ||
303 | |||
302 | #region Public Functions | 304 | #region Public Functions |
303 | 305 | ||
304 | public void Say(string msg) | 306 | public void Say(string msg) |
@@ -569,5 +571,72 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
569 | } | 571 | } |
570 | 572 | ||
571 | #endregion | 573 | #endregion |
574 | |||
575 | #region Implementation of IObjectShape | ||
576 | |||
577 | private UUID m_sculptMap = UUID.Zero; | ||
578 | |||
579 | public UUID SculptMap | ||
580 | { | ||
581 | get { return m_sculptMap; } | ||
582 | set | ||
583 | { | ||
584 | m_sculptMap = value; | ||
585 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | ||
586 | } | ||
587 | } | ||
588 | |||
589 | private SculptType m_sculptType = Object.SculptType.Default; | ||
590 | |||
591 | public SculptType SculptType | ||
592 | { | ||
593 | get { return m_sculptType; } | ||
594 | set | ||
595 | { | ||
596 | m_sculptType = value; | ||
597 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | public HoleShape HoleType | ||
602 | { | ||
603 | get { throw new System.NotImplementedException(); } | ||
604 | set { throw new System.NotImplementedException(); } | ||
605 | } | ||
606 | |||
607 | public double HoleSize | ||
608 | { | ||
609 | get { throw new System.NotImplementedException(); } | ||
610 | set { throw new System.NotImplementedException(); } | ||
611 | } | ||
612 | |||
613 | public PrimType PrimType | ||
614 | { | ||
615 | get { return (PrimType)getScriptPrimType(GetSOP().Shape); } | ||
616 | set { throw new System.NotImplementedException(); } | ||
617 | } | ||
618 | |||
619 | private void SetPrimitiveSculpted(UUID map, byte type) | ||
620 | { | ||
621 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | ||
622 | |||
623 | SceneObjectPart part = GetSOP(); | ||
624 | |||
625 | UUID sculptId = map; | ||
626 | |||
627 | shapeBlock.ObjectLocalID = part.LocalId; | ||
628 | shapeBlock.PathScaleX = 100; | ||
629 | shapeBlock.PathScaleY = 150; | ||
630 | |||
631 | // retain pathcurve | ||
632 | shapeBlock.PathCurve = part.Shape.PathCurve; | ||
633 | |||
634 | part.Shape.SetSculptData((byte)type, sculptId); | ||
635 | part.Shape.SculptEntry = true; | ||
636 | part.UpdateShape(shapeBlock); | ||
637 | } | ||
638 | |||
639 | |||
640 | #endregion | ||
572 | } | 641 | } |
573 | } | 642 | } |