aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/World.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/world/World.cs34
1 files changed, 30 insertions, 4 deletions
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index c7c57d1..74325b0 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -18,7 +18,7 @@ using OpenSim.Terrain;
18 18
19namespace OpenSim.world 19namespace OpenSim.world
20{ 20{
21 public partial class World : ILocalStorageReceiver 21 public partial class World : ILocalStorageReceiver, IScriptAPI
22 { 22 {
23 public object LockPhysicsEngine = new object(); 23 public object LockPhysicsEngine = new object();
24 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 24 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
@@ -66,6 +66,7 @@ namespace OpenSim.world
66 // Scripts = new ScriptEngine(this); 66 // Scripts = new ScriptEngine(this);
67 Avatar.LoadAnims(); 67 Avatar.LoadAnims();
68 this.SetDefaultScripts(); 68 this.SetDefaultScripts();
69 this.LoadScriptEngines();
69 } 70 }
70 71
71 public void AddScript(Entity entity, Script script) 72 public void AddScript(Entity entity, Script script)
@@ -86,8 +87,28 @@ namespace OpenSim.world
86 //Console.WriteLine("searching for script to add: " + substring); 87 //Console.WriteLine("searching for script to add: " + substring);
87 88
88 ScriptFactory scriptFactory; 89 ScriptFactory scriptFactory;
89 90 Console.WriteLine("script string is " + substring);
90 if (this.m_scripts.TryGetValue(substring, out scriptFactory)) 91 if(substring.StartsWith("<ScriptEngine:"))
92 {
93 string substring1 = "";
94 string script = "";
95 Console.WriteLine("searching for script engine");
96 substring1 = substring.Remove(0, 14);
97 int dev = substring1.IndexOf(',');
98 string sEngine = substring1.Substring(0, dev);
99 substring1 = substring1.Remove(0, dev+1);
100 int end = substring1.IndexOf('>');
101 string sName = substring1.Substring(0, end);
102 Console.WriteLine(" script info : " + sEngine + " , " + sName);
103 int startscript = substring.IndexOf('>');
104 script = substring.Remove(0, startscript + 1);
105 Console.WriteLine("script data is " + script);
106 if (this.scriptEngines.ContainsKey(sEngine))
107 {
108 this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid);
109 }
110 }
111 else if (this.m_scripts.TryGetValue(substring, out scriptFactory))
91 { 112 {
92 //Console.WriteLine("added script"); 113 //Console.WriteLine("added script");
93 this.AddScript(entity, scriptFactory()); 114 this.AddScript(entity, scriptFactory());
@@ -149,7 +170,10 @@ namespace OpenSim.world
149 { 170 {
150 scriptHandler.OnFrame(); 171 scriptHandler.OnFrame();
151 } 172 }
152 173 foreach (IScriptEngine scripteng in this.scriptEngines.Values)
174 {
175 //scripteng.OnFrame();
176 }
153 //backup world data 177 //backup world data
154 this.storageCount++; 178 this.storageCount++;
155 if (storageCount > 1200) //set to how often you want to backup 179 if (storageCount > 1200) //set to how often you want to backup
@@ -255,7 +279,9 @@ namespace OpenSim.world
255 float[] map = this.localStorage.LoadWorld(); 279 float[] map = this.localStorage.LoadWorld();
256 if (map == null) 280 if (map == null)
257 { 281 {
282 Console.WriteLine("creating new terrain");
258 this.Terrain.hills(); 283 this.Terrain.hills();
284
259 //this.localStorage.SaveMap(this.Terrain.map); 285 //this.localStorage.SaveMap(this.Terrain.map);
260 } 286 }
261 else 287 else