diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs | 245 |
1 files changed, 245 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs new file mode 100644 index 0000000..e189489 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs | |||
@@ -0,0 +1,245 @@ | |||
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 | } | ||