diff options
Diffstat (limited to 'OpenSim/Region/Framework')
10 files changed, 270 insertions, 316 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs index 0bb4567..cc7885a 100644 --- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | 35 | ||
36 | public interface IJsonStoreModule | 36 | public interface IJsonStoreModule |
37 | { | 37 | { |
38 | bool AttachObjectStore(UUID objectID); | ||
38 | bool CreateStore(string value, ref UUID result); | 39 | bool CreateStore(string value, ref UUID result); |
39 | bool DestroyStore(UUID storeID); | 40 | bool DestroyStore(UUID storeID); |
40 | bool TestStore(UUID storeID); | 41 | bool TestStore(UUID storeID); |
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs index 9b504c0..2a5828e 100644 --- a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.5.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f8d84e3..de3978c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -720,7 +720,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
720 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 720 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
721 | SceneCommunicationService sceneGridService, | 721 | SceneCommunicationService sceneGridService, |
722 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 722 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
723 | bool dumpAssetsToFile, | ||
724 | IConfigSource config, string simulatorVersion) | 723 | IConfigSource config, string simulatorVersion) |
725 | : this(regInfo) | 724 | : this(regInfo) |
726 | { | 725 | { |
@@ -811,8 +810,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
811 | 810 | ||
812 | RegisterDefaultSceneEvents(); | 811 | RegisterDefaultSceneEvents(); |
813 | 812 | ||
814 | DumpAssetsToFile = dumpAssetsToFile; | ||
815 | |||
816 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled | 813 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled |
817 | // better in the future. | 814 | // better in the future. |
818 | m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; | 815 | m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; |
@@ -4482,19 +4479,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4482 | 4479 | ||
4483 | #region Script Engine | 4480 | #region Script Engine |
4484 | 4481 | ||
4485 | private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); | ||
4486 | public bool DumpAssetsToFile; | ||
4487 | |||
4488 | /// <summary> | ||
4489 | /// | ||
4490 | /// </summary> | ||
4491 | /// <param name="scriptEngine"></param> | ||
4492 | public void AddScriptEngine(ScriptEngineInterface scriptEngine) | ||
4493 | { | ||
4494 | ScriptEngines.Add(scriptEngine); | ||
4495 | scriptEngine.InitializeEngine(this); | ||
4496 | } | ||
4497 | |||
4498 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4482 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) |
4499 | { | 4483 | { |
4500 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4484 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6720635..b00f388 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -37,6 +37,7 @@ using System.Xml.Serialization; | |||
37 | using log4net; | 37 | using log4net; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
41 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes.Scripting; | 43 | using OpenSim.Region.Framework.Scenes.Scripting; |
@@ -115,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
115 | 116 | ||
116 | #endregion Enumerations | 117 | #endregion Enumerations |
117 | 118 | ||
118 | public class SceneObjectPart : IScriptHost, ISceneEntity | 119 | public class SceneObjectPart : ISceneEntity |
119 | { | 120 | { |
120 | /// <value> | 121 | /// <value> |
121 | /// Denote all sides of the prim | 122 | /// Denote all sides of the prim |
@@ -124,6 +125,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
124 | 125 | ||
125 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
126 | 127 | ||
128 | /// <summary> | ||
129 | /// Dynamic attributes can be created and deleted as required. | ||
130 | /// </summary> | ||
131 | public DAMap DynAttrs { get; set; } | ||
132 | |||
127 | /// <value> | 133 | /// <value> |
128 | /// Is this a root part? | 134 | /// Is this a root part? |
129 | /// </value> | 135 | /// </value> |
@@ -296,6 +302,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | protected Vector3 m_lastAcceleration; | 302 | protected Vector3 m_lastAcceleration; |
297 | protected Vector3 m_lastAngularVelocity; | 303 | protected Vector3 m_lastAngularVelocity; |
298 | protected int m_lastTerseSent; | 304 | protected int m_lastTerseSent; |
305 | |||
306 | protected byte m_physicsShapeType = (byte)PhysShapeType.prim; | ||
307 | // TODO: Implement these | ||
308 | //protected float m_density = 1000.0f; // in kg/m^3 | ||
309 | //protected float m_gravitymod = 1.0f; | ||
310 | //protected float m_friction = 0.6f; // wood | ||
311 | //protected float m_bounce = 0.5f; // wood | ||
299 | 312 | ||
300 | /// <summary> | 313 | /// <summary> |
301 | /// Stores media texture data | 314 | /// Stores media texture data |
@@ -335,6 +348,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
335 | m_particleSystem = Utils.EmptyBytes; | 348 | m_particleSystem = Utils.EmptyBytes; |
336 | Rezzed = DateTime.UtcNow; | 349 | Rezzed = DateTime.UtcNow; |
337 | Description = String.Empty; | 350 | Description = String.Empty; |
351 | DynAttrs = new DAMap(); | ||
338 | 352 | ||
339 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 353 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
340 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 354 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
@@ -1315,6 +1329,69 @@ namespace OpenSim.Region.Framework.Scenes | |||
1315 | set { m_collisionSoundVolume = value; } | 1329 | set { m_collisionSoundVolume = value; } |
1316 | } | 1330 | } |
1317 | 1331 | ||
1332 | public byte DefaultPhysicsShapeType() | ||
1333 | { | ||
1334 | byte type; | ||
1335 | |||
1336 | if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh)) | ||
1337 | type = (byte)PhysShapeType.convex; | ||
1338 | else | ||
1339 | type = (byte)PhysShapeType.prim; | ||
1340 | |||
1341 | return type; | ||
1342 | } | ||
1343 | |||
1344 | public byte PhysicsShapeType | ||
1345 | { | ||
1346 | get { return m_physicsShapeType; } | ||
1347 | set | ||
1348 | { | ||
1349 | byte oldv = m_physicsShapeType; | ||
1350 | |||
1351 | if (value >= 0 && value <= (byte)PhysShapeType.convex) | ||
1352 | { | ||
1353 | if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) | ||
1354 | m_physicsShapeType = DefaultPhysicsShapeType(); | ||
1355 | else | ||
1356 | m_physicsShapeType = value; | ||
1357 | } | ||
1358 | else | ||
1359 | m_physicsShapeType = DefaultPhysicsShapeType(); | ||
1360 | |||
1361 | if (m_physicsShapeType != oldv && ParentGroup != null) | ||
1362 | { | ||
1363 | if (m_physicsShapeType == (byte)PhysShapeType.none) | ||
1364 | { | ||
1365 | if (PhysActor != null) | ||
1366 | { | ||
1367 | Velocity = new Vector3(0, 0, 0); | ||
1368 | Acceleration = new Vector3(0, 0, 0); | ||
1369 | if (ParentGroup.RootPart == this) | ||
1370 | AngularVelocity = new Vector3(0, 0, 0); | ||
1371 | ParentGroup.Scene.RemovePhysicalPrim(1); | ||
1372 | RemoveFromPhysics(); | ||
1373 | } | ||
1374 | } | ||
1375 | else if (PhysActor == null) | ||
1376 | { | ||
1377 | ApplyPhysics((uint)Flags, VolumeDetectActive); | ||
1378 | } | ||
1379 | else | ||
1380 | { | ||
1381 | // TODO: Update physics actor | ||
1382 | } | ||
1383 | |||
1384 | if (ParentGroup != null) | ||
1385 | ParentGroup.HasGroupChanged = true; | ||
1386 | } | ||
1387 | } | ||
1388 | } | ||
1389 | |||
1390 | public float Density { get; set; } | ||
1391 | public float GravityModifier { get; set; } | ||
1392 | public float Friction { get; set; } | ||
1393 | public float Restitution { get; set; } | ||
1394 | |||
1318 | #endregion Public Properties with only Get | 1395 | #endregion Public Properties with only Get |
1319 | 1396 | ||
1320 | private uint ApplyMask(uint val, bool set, uint mask) | 1397 | private uint ApplyMask(uint val, bool set, uint mask) |
@@ -1516,9 +1593,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1516 | if (!ParentGroup.Scene.CollidablePrims) | 1593 | if (!ParentGroup.Scene.CollidablePrims) |
1517 | return; | 1594 | return; |
1518 | 1595 | ||
1519 | // m_log.DebugFormat( | 1596 | if (PhysicsShapeType == (byte)PhysShapeType.none) |
1520 | // "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", | 1597 | return; |
1521 | // Name, LocalId, UUID, m_physicalPrim); | ||
1522 | 1598 | ||
1523 | bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; | 1599 | bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; |
1524 | bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; | 1600 | bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; |
@@ -1618,6 +1694,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1618 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 1694 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
1619 | dupe.Shape.ExtraParams = extraP; | 1695 | dupe.Shape.ExtraParams = extraP; |
1620 | 1696 | ||
1697 | dupe.DynAttrs.CopyFrom(DynAttrs); | ||
1698 | |||
1621 | if (userExposed) | 1699 | if (userExposed) |
1622 | { | 1700 | { |
1623 | /* | 1701 | /* |
@@ -3869,6 +3947,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3869 | } | 3947 | } |
3870 | } | 3948 | } |
3871 | 3949 | ||
3950 | public void UpdateExtraPhysics(ExtraPhysicsData physdata) | ||
3951 | { | ||
3952 | if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) | ||
3953 | return; | ||
3954 | |||
3955 | if (PhysicsShapeType != (byte)physdata.PhysShapeType) | ||
3956 | { | ||
3957 | PhysicsShapeType = (byte)physdata.PhysShapeType; | ||
3958 | |||
3959 | } | ||
3960 | |||
3961 | if(Density != physdata.Density) | ||
3962 | Density = physdata.Density; | ||
3963 | if(GravityModifier != physdata.GravitationModifier) | ||
3964 | GravityModifier = physdata.GravitationModifier; | ||
3965 | if(Friction != physdata.Friction) | ||
3966 | Friction = physdata.Friction; | ||
3967 | if(Restitution != physdata.Bounce) | ||
3968 | Restitution = physdata.Bounce; | ||
3969 | } | ||
3872 | /// <summary> | 3970 | /// <summary> |
3873 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. | 3971 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. |
3874 | /// </summary> | 3972 | /// </summary> |
@@ -3940,6 +4038,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3940 | 4038 | ||
3941 | if (SetPhantom | 4039 | if (SetPhantom |
3942 | || ParentGroup.IsAttachment | 4040 | || ParentGroup.IsAttachment |
4041 | || PhysicsShapeType == (byte)PhysShapeType.none | ||
3943 | || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints | 4042 | || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints |
3944 | { | 4043 | { |
3945 | AddFlag(PrimFlags.Phantom); | 4044 | AddFlag(PrimFlags.Phantom); |
@@ -4598,4 +4697,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
4598 | } | 4697 | } |
4599 | } | 4698 | } |
4600 | } | 4699 | } |
4601 | } \ No newline at end of file | 4700 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs deleted file mode 100644 index f3be028..0000000 --- a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs +++ /dev/null | |||
@@ -1,46 +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.Framework.Scenes.Scripting | ||
31 | { | ||
32 | public interface IScriptHost | ||
33 | { | ||
34 | string Name { get; set; } | ||
35 | string Description { get; set; } | ||
36 | |||
37 | UUID UUID { get; } | ||
38 | UUID OwnerID { get; } | ||
39 | UUID CreatorID { get; } | ||
40 | Vector3 AbsolutePosition { get; } | ||
41 | |||
42 | string SitName { get; set; } | ||
43 | string TouchName { get; set; } | ||
44 | void SetText(string text, Vector3 color, double alpha); | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs deleted file mode 100644 index d7198f0..0000000 --- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs +++ /dev/null | |||
@@ -1,91 +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 log4net; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes.Scripting | ||
35 | { | ||
36 | public class NullScriptHost : IScriptHost | ||
37 | { | ||
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | |||
40 | private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); | ||
41 | |||
42 | public string Name | ||
43 | { | ||
44 | get { return "Object"; } | ||
45 | set { } | ||
46 | } | ||
47 | |||
48 | public string SitName | ||
49 | { | ||
50 | get { return String.Empty; } | ||
51 | set { } | ||
52 | } | ||
53 | |||
54 | public string TouchName | ||
55 | { | ||
56 | get { return String.Empty; } | ||
57 | set { } | ||
58 | } | ||
59 | |||
60 | public string Description | ||
61 | { | ||
62 | get { return String.Empty; } | ||
63 | set { } | ||
64 | } | ||
65 | |||
66 | public UUID UUID | ||
67 | { | ||
68 | get { return UUID.Zero; } | ||
69 | } | ||
70 | |||
71 | public UUID OwnerID | ||
72 | { | ||
73 | get { return UUID.Zero; } | ||
74 | } | ||
75 | |||
76 | public UUID CreatorID | ||
77 | { | ||
78 | get { return UUID.Zero; } | ||
79 | } | ||
80 | |||
81 | public Vector3 AbsolutePosition | ||
82 | { | ||
83 | get { return m_pos; } | ||
84 | } | ||
85 | |||
86 | public void SetText(string text, Vector3 color, double alpha) | ||
87 | { | ||
88 | m_log.Warn("Tried to SetText "+text+" on NullScriptHost"); | ||
89 | } | ||
90 | } | ||
91 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.cs deleted file mode 100644 index 812a21c..0000000 --- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineInterface.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 | //TODO: WHERE TO PLACE THIS? | ||
29 | |||
30 | namespace OpenSim.Region.Framework.Scenes.Scripting | ||
31 | { | ||
32 | public interface ScriptEngineInterface | ||
33 | { | ||
34 | void InitializeEngine(Scene Sceneworld); | ||
35 | void Shutdown(); | ||
36 | // void StartScript(string ScriptID, IScriptHost ObjectID); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs deleted file mode 100644 index c58ccc5..0000000 --- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptEngineLoader.cs +++ /dev/null | |||
@@ -1,119 +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 | /* Original code: Tedd Hansen */ | ||
29 | using System; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes.Scripting | ||
35 | { | ||
36 | public class ScriptEngineLoader | ||
37 | { | ||
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | |||
40 | public ScriptEngineInterface LoadScriptEngine(string EngineName) | ||
41 | { | ||
42 | ScriptEngineInterface ret = null; | ||
43 | try | ||
44 | { | ||
45 | ret = | ||
46 | LoadAndInitAssembly( | ||
47 | Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), | ||
48 | "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); | ||
49 | } | ||
50 | catch (Exception e) | ||
51 | { | ||
52 | m_log.Error("[ScriptEngine]: " + | ||
53 | "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + | ||
54 | e.StackTrace.ToString()); | ||
55 | } | ||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Does actual loading and initialization of script Assembly | ||
61 | /// </summary> | ||
62 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | ||
63 | /// <param name="FileName">FileName of script assembly (.dll)</param> | ||
64 | /// <returns></returns> | ||
65 | private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) | ||
66 | { | ||
67 | //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); | ||
68 | // Load .Net Assembly (.dll) | ||
69 | // Initialize and return it | ||
70 | |||
71 | // TODO: Add error handling | ||
72 | |||
73 | Assembly a; | ||
74 | //try | ||
75 | //{ | ||
76 | |||
77 | |||
78 | // Load to default appdomain (temporary) | ||
79 | a = Assembly.LoadFrom(FileName); | ||
80 | // Load to specified appdomain | ||
81 | // TODO: Insert security | ||
82 | //a = FreeAppDomain.Load(FileName); | ||
83 | //} | ||
84 | //catch (Exception e) | ||
85 | //{ | ||
86 | // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); | ||
87 | //} | ||
88 | |||
89 | |||
90 | //m_log.Debug("Loading: " + FileName); | ||
91 | //foreach (Type _t in a.GetTypes()) | ||
92 | //{ | ||
93 | // m_log.Debug("Type: " + _t.ToString()); | ||
94 | //} | ||
95 | |||
96 | Type t; | ||
97 | //try | ||
98 | //{ | ||
99 | t = a.GetType(NameSpace, true); | ||
100 | //} | ||
101 | //catch (Exception e) | ||
102 | //{ | ||
103 | // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | ||
104 | //} | ||
105 | |||
106 | ScriptEngineInterface ret; | ||
107 | //try | ||
108 | //{ | ||
109 | ret = (ScriptEngineInterface) Activator.CreateInstance(t); | ||
110 | //} | ||
111 | //catch (Exception e) | ||
112 | //{ | ||
113 | // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | ||
114 | //} | ||
115 | |||
116 | return ret; | ||
117 | } | ||
118 | } | ||
119 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs new file mode 100644 index 0000000..f08ba59 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs | |||
@@ -0,0 +1,107 @@ | |||
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 OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Scenes.Scripting | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Utility functions for use by scripts manipulating the scene. | ||
37 | /// </summary> | ||
38 | public static class ScriptUtils | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Get an asset id given an item name and an item type. | ||
42 | /// </summary> | ||
43 | /// <returns>UUID.Zero if the name and type did not match any item.</returns> | ||
44 | /// <param name='part'></param> | ||
45 | /// <param name='name'></param> | ||
46 | /// <param name='type'></param> | ||
47 | public static UUID GetAssetIdFromItemName(SceneObjectPart part, string name, int type) | ||
48 | { | ||
49 | TaskInventoryItem item = part.Inventory.GetInventoryItem(name); | ||
50 | |||
51 | if (item != null && item.Type == type) | ||
52 | return item.AssetID; | ||
53 | else | ||
54 | return UUID.Zero; | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// accepts a valid UUID, -or- a name of an inventory item. | ||
59 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found | ||
60 | /// in prim inventory. | ||
61 | /// </summary> | ||
62 | /// <param name="part">Scene object part to search for inventory item</param> | ||
63 | /// <param name="key"></param> | ||
64 | /// <returns></returns> | ||
65 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier) | ||
66 | { | ||
67 | UUID key; | ||
68 | |||
69 | // if we can parse the string as a key, use it. | ||
70 | // else try to locate the name in inventory of object. found returns key, | ||
71 | // not found returns UUID.Zero | ||
72 | if (!UUID.TryParse(identifier, out key)) | ||
73 | { | ||
74 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | ||
75 | |||
76 | if (item != null) | ||
77 | key = item.AssetID; | ||
78 | else | ||
79 | key = UUID.Zero; | ||
80 | } | ||
81 | |||
82 | return key; | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Return the UUID of the asset matching the specified key or name | ||
87 | /// and asset type. | ||
88 | /// </summary> | ||
89 | /// <param name="part">Scene object part to search for inventory item</param> | ||
90 | /// <param name="identifier"></param> | ||
91 | /// <param name="type"></param> | ||
92 | /// <returns></returns> | ||
93 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type) | ||
94 | { | ||
95 | UUID key; | ||
96 | |||
97 | if (!UUID.TryParse(identifier, out key)) | ||
98 | { | ||
99 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | ||
100 | if (item != null && item.Type == (int)type) | ||
101 | key = item.AssetID; | ||
102 | } | ||
103 | |||
104 | return key; | ||
105 | } | ||
106 | } | ||
107 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 2d4c60a..39420a6 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -359,6 +359,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
359 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); | 359 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); |
360 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); | 360 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); |
361 | m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); | 361 | m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); |
362 | m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs); | ||
362 | m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); | 363 | m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); |
363 | m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); | 364 | m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); |
364 | m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); | 365 | m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); |
@@ -366,6 +367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
366 | m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); | 367 | m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); |
367 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 368 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
368 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 369 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
370 | |||
371 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | ||
372 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | ||
373 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | ||
374 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | ||
375 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | ||
376 | |||
369 | #endregion | 377 | #endregion |
370 | 378 | ||
371 | #region TaskInventoryXmlProcessors initialization | 379 | #region TaskInventoryXmlProcessors initialization |
@@ -593,6 +601,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
593 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); | 601 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); |
594 | } | 602 | } |
595 | 603 | ||
604 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader) | ||
605 | { | ||
606 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); | ||
607 | } | ||
608 | |||
609 | private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) | ||
610 | { | ||
611 | obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); | ||
612 | } | ||
613 | |||
614 | private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) | ||
615 | { | ||
616 | obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); | ||
617 | } | ||
618 | |||
619 | private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) | ||
620 | { | ||
621 | obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty); | ||
622 | } | ||
623 | |||
624 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) | ||
625 | { | ||
626 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | ||
627 | } | ||
628 | |||
596 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 629 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
597 | { | 630 | { |
598 | List<string> errorNodeNames; | 631 | List<string> errorNodeNames; |
@@ -722,6 +755,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
722 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); | 755 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); |
723 | } | 756 | } |
724 | 757 | ||
758 | private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) | ||
759 | { | ||
760 | obj.DynAttrs.ReadXml(reader); | ||
761 | } | ||
762 | |||
725 | private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) | 763 | private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) |
726 | { | 764 | { |
727 | obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); | 765 | obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); |
@@ -1235,6 +1273,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1235 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); | 1273 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); |
1236 | if (sop.MediaUrl != null) | 1274 | if (sop.MediaUrl != null) |
1237 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1275 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1276 | |||
1277 | if (sop.DynAttrs.Count > 0) | ||
1278 | { | ||
1279 | writer.WriteStartElement("DynAttrs"); | ||
1280 | sop.DynAttrs.WriteXml(writer); | ||
1281 | writer.WriteEndElement(); | ||
1282 | } | ||
1283 | |||
1238 | WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); | 1284 | WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); |
1239 | WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); | 1285 | WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); |
1240 | writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); | 1286 | writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); |
@@ -1243,6 +1289,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1243 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1289 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1244 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1290 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1245 | 1291 | ||
1292 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | ||
1293 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | ||
1294 | if (sop.Density != 1000.0f) | ||
1295 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | ||
1296 | if (sop.Friction != 0.6f) | ||
1297 | writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); | ||
1298 | if (sop.Restitution != 0.5f) | ||
1299 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | ||
1300 | if (sop.GravityModifier != 1.0f) | ||
1301 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | ||
1302 | |||
1246 | writer.WriteEndElement(); | 1303 | writer.WriteEndElement(); |
1247 | } | 1304 | } |
1248 | 1305 | ||