aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs184
-rw-r--r--OpenSim/OpenSim.Region/Scenes/SceneEvents.cs79
-rw-r--r--OpenSim/OpenSim.Region/Scenes/scripting/Engines/JSharpScriptEngine.cs104
-rw-r--r--OpenSim/Region/Environment/Scenes/Entity.cs (renamed from OpenSim/OpenSim.Region/Scenes/Entity.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs (renamed from OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs (renamed from OpenSim/OpenSim.Region/Scenes/Primitive.cs)6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs (renamed from OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs)6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs (renamed from OpenSim/OpenSim.Region/Scenes/Scene.cs)25
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs (renamed from OpenSim/OpenSim.Region/Scenes/SceneBase.cs)6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs (renamed from OpenSim/OpenSim.Region/Scenes/SceneObject.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs (renamed from OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs)4
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs (renamed from OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs (renamed from OpenSim/OpenSim.Region/Scenes/ScenePresence.cs)82
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs (renamed from OpenSim/OpenSim.Region/Scenes/scripting/Engines/CSharpScriptEngine.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs (renamed from OpenSim/OpenSim.Region/Scenes/scripting/Engines/JScriptEngine.cs)2
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Script.cs (renamed from OpenSim/OpenSim.Region/Scenes/scripting/Script.cs)8
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs (renamed from OpenSim/OpenSim.Region/Scenes/scripting/ScriptInfo.cs)4
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs (renamed from OpenSim/OpenSim.Region/Scenes/scripting/ScriptManager.cs)9
18 files changed, 93 insertions, 436 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs b/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs
deleted file mode 100644
index 7b53388..0000000
--- a/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs
+++ /dev/null
@@ -1,184 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.IO;
32using System.Reflection;
33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
36using libsecondlife;
37
38namespace OpenSim.Region.Scenes
39{
40 public partial class Scene
41 {
42 private Dictionary<string, IScriptEngine> scriptEngines = new Dictionary<string, IScriptEngine>();
43
44 /// <summary>
45 ///
46 /// </summary>
47 private void LoadScriptEngines()
48 {
49 this.LoadScriptPlugins();
50 }
51
52 /// <summary>
53 ///
54 /// </summary>
55 public void LoadScriptPlugins()
56 {
57 string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines");
58 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
59
60
61 for (int i = 0; i < pluginFiles.Length; i++)
62 {
63 this.AddPlugin(pluginFiles[i]);
64 }
65 }
66
67 /// <summary>
68 ///
69 /// </summary>
70 /// <param name="FileName"></param>
71 private void AddPlugin(string FileName)
72 {
73 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
74
75 foreach (Type pluginType in pluginAssembly.GetTypes())
76 {
77 if (pluginType.IsPublic)
78 {
79 if (!pluginType.IsAbstract)
80 {
81 Type typeInterface = pluginType.GetInterface("IScriptEngine", true);
82
83 if (typeInterface != null)
84 {
85 IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
86 plug.Init(this);
87 this.scriptEngines.Add(plug.GetName(), plug);
88
89 }
90
91 typeInterface = null;
92 }
93 }
94 }
95
96 pluginAssembly = null;
97 }
98
99 /// <summary>
100 ///
101 /// </summary>
102 /// <param name="scriptType"></param>
103 /// <param name="scriptName"></param>
104 /// <param name="script"></param>
105 /// <param name="ent"></param>
106 public void LoadScript(string scriptType, string scriptName, string script, Entity ent)
107 {
108 if(this.scriptEngines.ContainsKey(scriptType))
109 {
110 this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.LocalId);
111 }
112 }
113
114 #region IScriptAPI Methods
115
116 /// <summary>
117 ///
118 /// </summary>
119 /// <param name="localID"></param>
120 /// <returns></returns>
121 public LLVector3 GetEntityPosition(uint localID)
122 {
123 LLVector3 res = new LLVector3();
124 // Console.WriteLine("script- getting entity " + localID + " position");
125 foreach (Entity entity in this.Entities.Values)
126 {
127 if (entity.LocalId == localID)
128 {
129 res.X = entity.Pos.X;
130 res.Y = entity.Pos.Y;
131 res.Z = entity.Pos.Z;
132 }
133 }
134 return res;
135 }
136
137 /// <summary>
138 ///
139 /// </summary>
140 /// <param name="localID"></param>
141 /// <param name="x"></param>
142 /// <param name="y"></param>
143 /// <param name="z"></param>
144 public void SetEntityPosition(uint localID, float x , float y, float z)
145 {
146 foreach (Entity entity in this.Entities.Values)
147 {
148 if (entity.LocalId == localID && entity is Primitive)
149 {
150 LLVector3 pos = entity.Pos;
151 pos.X = x;
152 pos.Y = y;
153 Primitive prim = entity as Primitive;
154 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
155 //prim.UpdatePosition(pos);
156 // Console.WriteLine("script- setting entity " + localID + " positon");
157 }
158 }
159
160 }
161
162 /// <summary>
163 ///
164 /// </summary>
165 /// <returns></returns>
166 public uint GetRandomAvatarID()
167 {
168 //Console.WriteLine("script- getting random avatar id");
169 uint res = 0;
170 foreach (Entity entity in this.Entities.Values)
171 {
172 if (entity is ScenePresence)
173 {
174 res = entity.LocalId;
175 }
176 }
177 return res;
178 }
179
180 #endregion
181
182
183 }
184}
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs b/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs
deleted file mode 100644
index 4b39e51..0000000
--- a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Region.Scenes
33{
34 /// <summary>
35 /// A class for triggering remote scene events.
36 /// </summary>
37 public class EventManager
38 {
39 public delegate void OnFrameDelegate();
40 public event OnFrameDelegate OnFrame;
41
42 public delegate void OnNewPresenceDelegate(ScenePresence presence);
43 public event OnNewPresenceDelegate OnNewPresence;
44
45 public delegate void OnNewPrimitiveDelegate(Primitive prim);
46 public event OnNewPrimitiveDelegate OnNewPrimitive;
47
48 public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid);
49 public event OnRemovePresenceDelegate OnRemovePresence;
50
51 public void TriggerOnFrame()
52 {
53 if (OnFrame != null)
54 {
55 OnFrame();
56 }
57 }
58
59 public void TriggerOnNewPrimitive(Primitive prim)
60 {
61 if (OnNewPrimitive != null)
62 OnNewPrimitive(prim);
63 }
64
65 public void TriggerOnNewPresence(ScenePresence presence)
66 {
67 if (OnNewPresence != null)
68 OnNewPresence(presence);
69 }
70
71 public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid)
72 {
73 if (OnRemovePresence != null)
74 {
75 OnRemovePresence(uuid);
76 }
77 }
78 }
79}
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/JSharpScriptEngine.cs b/OpenSim/OpenSim.Region/Scenes/scripting/Engines/JSharpScriptEngine.cs
deleted file mode 100644
index b33b55d..0000000
--- a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/JSharpScriptEngine.cs
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32// Compilation stuff
33using System.CodeDom;
34using System.CodeDom.Compiler;
35using Microsoft.VJSharp;
36
37namespace OpenSim.Scripting
38{
39 public class JSharpScriptEngine : IScriptCompiler
40 {
41 public string FileExt()
42 {
43 return ".jsl";
44 }
45
46 private Dictionary<string, IScript> LoadDotNetScript(ICodeCompiler compiler, string filename)
47 {
48 CompilerParameters compilerParams = new CompilerParameters();
49 CompilerResults compilerResults;
50 compilerParams.GenerateExecutable = false;
51 compilerParams.GenerateInMemory = true;
52 compilerParams.IncludeDebugInformation = false;
53 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
54 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
55 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
56 compilerParams.ReferencedAssemblies.Add("System.dll");
57
58 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
59
60 if (compilerResults.Errors.Count > 0)
61 {
62 OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors");
63 foreach (CompilerError error in compilerResults.Errors)
64 {
65 OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
66 }
67 }
68 else
69 {
70 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
71
72 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
73 {
74 Type testInterface = pluginType.GetInterface("IScript", true);
75
76 if (testInterface != null)
77 {
78 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
79
80 string scriptName = "J#/" + script.getName();
81 Console.WriteLine("Script: " + scriptName + " loaded.");
82
83 if (!scripts.ContainsKey(scriptName))
84 {
85 scripts.Add(scriptName, script);
86 }
87 else
88 {
89 scripts[scriptName] = script;
90 }
91 }
92 }
93 return scripts;
94 }
95 return null;
96 }
97
98 public Dictionary<string, IScript> compile(string filename)
99 {
100 VJSharpCodeProvider jsharpProvider = new VJSharpCodeProvider();
101 return LoadDotNetScript(jsharpProvider.CreateCompiler(), filename);
102 }
103 }
104}
diff --git a/OpenSim/OpenSim.Region/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index 77f8854..db5070d 100644
--- a/OpenSim/OpenSim.Region/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -32,7 +32,7 @@ using Axiom.MathLib;
32using OpenSim.Physics.Manager; 32using OpenSim.Physics.Manager;
33using libsecondlife; 33using libsecondlife;
34 34
35namespace OpenSim.Region.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public abstract class Entity 37 public abstract class Entity
38 { 38 {
diff --git a/OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 65077e6..36023d0 100644
--- a/OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -7,7 +7,7 @@ using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types; 8using OpenSim.Framework.Types;
9 9
10namespace OpenSim.Region.Scenes 10namespace OpenSim.Region.Environment.Scenes
11{ 11{
12 public interface IScenePresenceBody 12 public interface IScenePresenceBody
13 { 13 {
diff --git a/OpenSim/OpenSim.Region/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index e04c711..0f649b2 100644
--- a/OpenSim/OpenSim.Region/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -36,7 +36,7 @@ using OpenSim.Physics.Manager;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Inventory; 37using OpenSim.Framework.Inventory;
38 38
39namespace OpenSim.Region.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public class Primitive : Entity 41 public class Primitive : Entity
42 { 42 {
@@ -174,9 +174,9 @@ namespace OpenSim.Region.Scenes
174 dataArrays.Add(primData.ToBytes()); 174 dataArrays.Add(primData.ToBytes());
175 foreach (Entity child in children) 175 foreach (Entity child in children)
176 { 176 {
177 if (child is OpenSim.Region.Scenes.Primitive) 177 if (child is OpenSim.Region.Environment.Scenes.Primitive)
178 { 178 {
179 dataArrays.Add(((OpenSim.Region.Scenes.Primitive)child).GetByteArray()); 179 dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray());
180 } 180 }
181 } 181 }
182 byte[] primstart = Helpers.StringToField("<Prim>"); 182 byte[] primstart = Helpers.StringToField("<Prim>");
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index d1a2717..1d55c4d 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -36,7 +36,7 @@ using OpenSim.Framework.Types;
36using OpenSim.Framework.Inventory; 36using OpenSim.Framework.Inventory;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38 38
39namespace OpenSim.Region.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public partial class Scene 41 public partial class Scene
42 { 42 {
@@ -218,7 +218,7 @@ namespace OpenSim.Region.Scenes
218 { 218 {
219 if (ent.LocalId == primLocalID) 219 if (ent.LocalId == primLocalID)
220 { 220 {
221 ((OpenSim.Region.Scenes.Primitive)ent).GetProperites(remoteClient); 221 ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient);
222 break; 222 break;
223 } 223 }
224 } 224 }
@@ -266,7 +266,7 @@ namespace OpenSim.Region.Scenes
266 { 266 {
267 if (ent.LocalId == localID) 267 if (ent.LocalId == localID)
268 { 268 {
269 ((OpenSim.Region.Scenes.Primitive)ent).UpdatePosition(pos); 269 ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos);
270 break; 270 break;
271 } 271 }
272 } 272 }
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f7d90fa..8c912d0 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -39,18 +39,20 @@ using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.Framework.Inventory; 40using OpenSim.Framework.Inventory;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Terrain; 42using OpenSim.Region.Terrain;
43using OpenGrid.Framework.Communications; 43using OpenSim.Framework.Communications;
44using OpenSim.Caches; 44using OpenSim.Region.Caches;
45using OpenSim.Region; 45using OpenSim.Region.Environment;
46using OpenSim.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Scripting; 47using OpenSim.Region.Enviorment.Scripting;
48 48using OpenSim.Region.Capabilities;
49namespace OpenSim.Region.Scenes 49using Caps = OpenSim.Region.Capabilities.Caps;
50
51namespace OpenSim.Region.Environment.Scenes
50{ 52{
51 public delegate bool FilterAvatarList(ScenePresence avatar); 53 public delegate bool FilterAvatarList(ScenePresence avatar);
52 54
53 public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI 55 public partial class Scene : SceneBase, ILocalStorageReceiver
54 { 56 {
55 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); 57 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
56 protected Dictionary<libsecondlife.LLUUID, ScenePresence> Avatars; 58 protected Dictionary<libsecondlife.LLUUID, ScenePresence> Avatars;
@@ -66,7 +68,7 @@ namespace OpenSim.Region.Scenes
66 protected RegionCommsListener regionCommsHost; 68 protected RegionCommsListener regionCommsHost;
67 protected CommunicationsManager commsManager; 69 protected CommunicationsManager commsManager;
68 70
69 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 71 protected Dictionary<LLUUID,Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
70 protected BaseHttpServer httpListener; 72 protected BaseHttpServer httpListener;
71 73
72 public ParcelManager parcelManager; 74 public ParcelManager parcelManager;
@@ -503,6 +505,7 @@ namespace OpenSim.Region.Scenes
503 remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; 505 remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation;
504 //remoteClient.OnObjectSelect += this.SelectPrim; 506 //remoteClient.OnObjectSelect += this.SelectPrim;
505 remoteClient.OnGrapUpdate += this.MoveObject; 507 remoteClient.OnGrapUpdate += this.MoveObject;
508 remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
506 509
507 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 510 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
508 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); 511 remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
@@ -510,7 +513,7 @@ namespace OpenSim.Region.Scenes
510 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); 513 remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest);
511 remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); 514 remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage);
512 */ 515 */
513 516
514 ScenePresence newAvatar = null; 517 ScenePresence newAvatar = null;
515 try 518 try
516 { 519 {
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 5275fcf..50d3b82 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -37,10 +37,10 @@ using OpenSim.Physics.Manager;
37using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Types; 38using OpenSim.Framework.Types;
39using OpenSim.Framework.Inventory; 39using OpenSim.Framework.Inventory;
40using OpenSim.Terrain; 40using OpenSim.Region.Terrain;
41using OpenSim.Caches; 41using OpenSim.Region.Caches;
42 42
43namespace OpenSim.Region.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public abstract class SceneBase : IWorld 45 public abstract class SceneBase : IWorld
46 { 46 {
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 5df87bf..88fb160 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -35,7 +35,7 @@ using OpenSim.Physics.Manager;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Inventory; 36using OpenSim.Framework.Inventory;
37 37
38namespace OpenSim.Region.Scenes 38namespace OpenSim.Region.Environment.Scenes
39{ 39{
40 public class SceneObject : Entity 40 public class SceneObject : Entity
41 { 41 {
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index f0a8721..2caabc2 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -31,7 +31,7 @@ using System.Text;
31using libsecondlife; 31using libsecondlife;
32using System.Xml; 32using System.Xml;
33 33
34namespace OpenSim.Region.Scenes 34namespace OpenSim.Region.Environment.Scenes
35{ 35{
36 partial class ScenePresence 36 partial class ScenePresence
37 { 37 {
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Scenes
66 66
67 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); 67 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
68 68
69 foreach (KeyValuePair<string, LLUUID> kp in OpenSim.Region.Scenes.ScenePresence.Animations.AnimsLLUUID) 69 foreach (KeyValuePair<string, LLUUID> kp in OpenSim.Region.Environment.Scenes.ScenePresence.Animations.AnimsLLUUID)
70 { 70 {
71 AnimsNames.Add(kp.Value, kp.Key); 71 AnimsNames.Add(kp.Value, kp.Key);
72 } 72 }
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
index d21b11f..2c81d2a 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
@@ -34,7 +34,7 @@ using OpenSim.Physics.Manager;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Region.Scenes 37namespace OpenSim.Region.Environment.Scenes
38{ 38{
39 partial class ScenePresence 39 partial class ScenePresence
40 { 40 {
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 45d3fed..b90004e 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Types; 37using OpenSim.Framework.Types;
38using Axiom.MathLib; 38using Axiom.MathLib;
39 39
40namespace OpenSim.Region.Scenes 40namespace OpenSim.Region.Environment.Scenes
41{ 41{
42 public partial class ScenePresence : Entity 42 public partial class ScenePresence : Entity
43 { 43 {
@@ -66,6 +66,17 @@ namespace OpenSim.Region.Scenes
66 66
67 protected RegionInfo m_regionInfo; 67 protected RegionInfo m_regionInfo;
68 68
69 private Vector3[] Dir_Vectors = new Vector3[6];
70 private enum Dir_ControlFlags
71 {
72 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
73 DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG,
74 DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS,
75 DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG,
76 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
77 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
78 }
79
69 #region Properties 80 #region Properties
70 /// <summary> 81 /// <summary>
71 /// 82 ///
@@ -125,6 +136,13 @@ namespace OpenSim.Region.Scenes
125 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 136 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
126 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 137 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
127 138
139 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
140 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
141 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
142 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT
143 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
144 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
145
128 } 146 }
129 #endregion 147 #endregion
130 148
@@ -216,40 +234,46 @@ namespace OpenSim.Region.Scenes
216 /// </summary> 234 /// </summary>
217 /// <param name="pack"></param> 235 /// <param name="pack"></param>
218 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 236 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
219 { 237 {
220 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) 238 int i = 0;
239 bool update_movementflag = false;
240 bool update_rotation = false;
241 bool DCFlagKeyPressed = false;
242 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
243 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
244
245 this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
246
247 if (q != this.bodyRot)
221 { 248 {
222 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 249 this.bodyRot = q;
223 if (((movementflag & 1) == 0) || (q != this.bodyRot)) 250 update_rotation = true;
224 {
225 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
226 this.AddNewMovement(v3, q);
227 movementflag = 1;
228 this.bodyRot = q;
229 }
230 } 251 }
231 else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) 252 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
232 { 253 {
233 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 254 if ((flags & (uint)DCF) != 0)
234 if (((movementflag & 2) == 0) || (q != this.bodyRot)) 255 {
235 { 256 DCFlagKeyPressed = true;
236 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); 257 agent_control_v3 += Dir_Vectors[i];
237 this.AddNewMovement(v3, q); 258 if ((movementflag & (uint)DCF) == 0)
238 movementflag = 2; 259 {
239 this.bodyRot = q; 260 movementflag += (byte)(uint)DCF;
261 update_movementflag = true;
262 }
240 } 263 }
241 } 264 else
242 else
243 {
244 if ((movementflag) != 0)
245 { 265 {
246 NewForce newVelocity = new NewForce(); 266 if ((movementflag & (uint)DCF) != 0)
247 newVelocity.X = 0; 267 {
248 newVelocity.Y = 0; 268 movementflag -= (byte)(uint)DCF;
249 newVelocity.Z = 0; 269 update_movementflag = true;
250 this.forcesList.Add(newVelocity); 270 }
251 movementflag = 0;
252 } 271 }
272 i++;
273 }
274 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
275 {
276 this.AddNewMovement(agent_control_v3, q);
253 } 277 }
254 278
255 } 279 }
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs
index 870303f..a232b65 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/CSharpScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpScriptEngine.cs
@@ -34,7 +34,7 @@ using System.CodeDom;
34using System.CodeDom.Compiler; 34using System.CodeDom.Compiler;
35using Microsoft.CSharp; 35using Microsoft.CSharp;
36 36
37namespace OpenSim.Scripting 37namespace OpenSim.Region.Enviorment.Scripting
38{ 38{
39 public class CSharpScriptEngine : IScriptCompiler 39 public class CSharpScriptEngine : IScriptCompiler
40 { 40 {
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs
index ffae1d7..2d44223 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/Engines/JScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine.cs
@@ -34,7 +34,7 @@ using System.CodeDom;
34using System.CodeDom.Compiler; 34using System.CodeDom.Compiler;
35using Microsoft.JScript; 35using Microsoft.JScript;
36 36
37namespace OpenSim.Scripting 37namespace OpenSim.Region.Enviorment.Scripting
38{ 38{
39 public class JScriptEngine : IScriptCompiler 39 public class JScriptEngine : IScriptCompiler
40 { 40 {
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
index 56bd1db..1e64675 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
@@ -31,10 +31,10 @@ using System.Text;
31 31
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region; 34using OpenSim.Region.Environment;
35using OpenSim.Region.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36
37namespace OpenSim.Scripting 37namespace OpenSim.Region.Enviorment.Scripting
38{ 38{
39 public interface IScript 39 public interface IScript
40 { 40 {
@@ -54,7 +54,7 @@ namespace OpenSim.Scripting
54 public void Initialise(ScriptInfo scriptInfo) 54 public void Initialise(ScriptInfo scriptInfo)
55 { 55 {
56 script = scriptInfo; 56 script = scriptInfo;
57 script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame); 57 script.events.OnFrame += new OpenSim.Region.Environment.Scenes.EventManager.OnFrameDelegate(events_OnFrame);
58 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 58 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
59 } 59 }
60 60
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
index cf627dd..522a572 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/ScriptInfo.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
@@ -29,10 +29,10 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32using OpenSim.Region.Scenes; 32using OpenSim.Region.Environment.Scenes;
33using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
34 34
35namespace OpenSim.Scripting 35namespace OpenSim.Region.Enviorment.Scripting
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Class which provides access to the world 38 /// Class which provides access to the world
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
index abffffa..eb1c1d9 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/ScriptManager.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
@@ -29,12 +29,12 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Scripting 32namespace OpenSim.Region.Enviorment.Scripting
33{ 33{
34 public class ScriptManager 34 public class ScriptManager
35 { 35 {
36 List<IScript> scripts = new List<IScript>(); 36 List<IScript> scripts = new List<IScript>();
37 OpenSim.Region.Scenes.Scene scene; 37 OpenSim.Region.Environment.Scenes.Scene scene;
38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
39 39
40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
@@ -49,7 +49,7 @@ namespace OpenSim.Scripting
49 OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); 49 OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
50 } 50 }
51 51
52 public ScriptManager(OpenSim.Region.Scenes.Scene world) 52 public ScriptManager(OpenSim.Region.Environment.Scenes.Scene world)
53 { 53 {
54 scene = world; 54 scene = world;
55 55
@@ -59,9 +59,6 @@ namespace OpenSim.Scripting
59 59
60 JScriptEngine jscriptCompiler = new JScriptEngine(); 60 JScriptEngine jscriptCompiler = new JScriptEngine();
61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); 61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
62
63 JSharpScriptEngine jsharpCompiler = new JSharpScriptEngine();
64 compilers.Add(jsharpCompiler.FileExt(), jsharpCompiler);
65 } 62 }
66 63
67 public void Compile(string filename) 64 public void Compile(string filename)