aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/CAPS
diff options
context:
space:
mode:
authorlbsa712007-04-03 20:08:30 +0000
committerlbsa712007-04-03 20:08:30 +0000
commitf12ceff6925236ca184c5a7a9c010b5e4bdb1b70 (patch)
tree9c83230be4bbdc19501e854df63084399cd742ba /OpenSim.RegionServer/CAPS
parent* Extended Script API with GetRandomAvatar (diff)
downloadopensim-SC_OLD-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.zip
opensim-SC_OLD-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.tar.gz
opensim-SC_OLD-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.tar.bz2
opensim-SC_OLD-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.tar.xz
* The world can not contain ScriptFactories that creates unique instances of scripts for entities.
* Created Scripts folder to house trusted Scripts * The test script now lives in Scripts/FollowRandomAvatar.cs
Diffstat (limited to 'OpenSim.RegionServer/CAPS')
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs32
1 files changed, 2 insertions, 30 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 0d03a57..d4519e8 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -10,6 +10,7 @@ using OpenSim.Framework.Inventory;
10using libsecondlife; 10using libsecondlife;
11using OpenSim.RegionServer.world.scripting; 11using OpenSim.RegionServer.world.scripting;
12using Avatar=libsecondlife.Avatar; 12using Avatar=libsecondlife.Avatar;
13using OpenSim.RegionServer.world.scripting.Scripts;
13 14
14namespace OpenSim.CAPS 15namespace OpenSim.CAPS
15{ 16{
@@ -139,35 +140,6 @@ namespace OpenSim.CAPS
139 return responseString; 140 return responseString;
140 } 141 }
141 142
142
143 private class TestScript : Script
144 {
145 public TestScript()
146 : base(LLUUID.Random())
147 {
148 OnFrame += MyOnFrame;
149 }
150
151 private void MyOnFrame(IScriptContext context)
152 {
153 LLVector3 pos = context.Entity.Pos;
154
155 IScriptReadonlyEntity avatar;
156
157 if( context.TryGetRandomAvatar( out avatar ) )
158 {
159 LLVector3 avatarPos = avatar.Pos;
160
161 float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X))/2;
162 float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y))/2;
163
164 LLVector3 newPos = new LLVector3( x, y, pos.Z );
165
166 context.Entity.Pos = newPos;
167 }
168 }
169 }
170
171 private string AddTestScript(string request, string path) 143 private string AddTestScript(string request, string path)
172 { 144 {
173 int index = path.LastIndexOf('/'); 145 int index = path.LastIndexOf('/');
@@ -179,7 +151,7 @@ namespace OpenSim.CAPS
179 if( LLUUID.TryParse( lluidStr, out id ) ) 151 if( LLUUID.TryParse( lluidStr, out id ) )
180 { 152 {
181 // This is just here for concept purposes... Remove! 153 // This is just here for concept purposes... Remove!
182 m_world.AddScript( m_world.Entities[id], new TestScript()); 154 m_world.AddScript( m_world.Entities[id], new FollowRandomAvatar());
183 return String.Format("Added new script to object [{0}]", id); 155 return String.Format("Added new script to object [{0}]", id);
184 } 156 }
185 else 157 else