aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/CAPS
diff options
context:
space:
mode:
authorlbsa712007-04-03 19:12:07 +0000
committerlbsa712007-04-03 19:12:07 +0000
commit7169acc47e8bb56581bd28c3bd921ca9236ba3c3 (patch)
tree4565785736fb759f0c665aac28cd88937042bdd3 /OpenSim.RegionServer/CAPS
parentAnother temporary bug fix attempt, this time for the packet overflow problem,... (diff)
downloadopensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.zip
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.gz
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.bz2
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.xz
* Extended Script API with GetRandomAvatar
* The script will now get a IScriptEntity to it's host object with get/sets * The script gets a IScriptReadnlyEntity interface to entities other than the host object. * the test script now follows a random avatar.
Diffstat (limited to 'OpenSim.RegionServer/CAPS')
-rw-r--r--OpenSim.RegionServer/CAPS/AdminWebFront.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index 43996d0..0d03a57 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -9,6 +9,7 @@ using OpenSim.Assets;
9using OpenSim.Framework.Inventory; 9using OpenSim.Framework.Inventory;
10using libsecondlife; 10using libsecondlife;
11using OpenSim.RegionServer.world.scripting; 11using OpenSim.RegionServer.world.scripting;
12using Avatar=libsecondlife.Avatar;
12 13
13namespace OpenSim.CAPS 14namespace OpenSim.CAPS
14{ 15{
@@ -141,8 +142,6 @@ namespace OpenSim.CAPS
141 142
142 private class TestScript : Script 143 private class TestScript : Script
143 { 144 {
144 int toggle = 0;
145
146 public TestScript() 145 public TestScript()
147 : base(LLUUID.Random()) 146 : base(LLUUID.Random())
148 { 147 {
@@ -151,13 +150,21 @@ namespace OpenSim.CAPS
151 150
152 private void MyOnFrame(IScriptContext context) 151 private void MyOnFrame(IScriptContext context)
153 { 152 {
154 toggle = 2 - toggle; 153 LLVector3 pos = context.Entity.Pos;
155 154
156 LLVector3 pos = context.GetPos(); 155 IScriptReadonlyEntity avatar;
156
157 if( context.TryGetRandomAvatar( out avatar ) )
158 {
159 LLVector3 avatarPos = avatar.Pos;
157 160
158 pos.X += (toggle - 1); 161 float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X))/2;
162 float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y))/2;
159 163
160 context.MoveTo(pos); 164 LLVector3 newPos = new LLVector3( x, y, pos.Z );
165
166 context.Entity.Pos = newPos;
167 }
161 } 168 }
162 } 169 }
163 170
@@ -194,7 +201,7 @@ namespace OpenSim.CAPS
194 foreach (Entity entity in m_world.Entities.Values) 201 foreach (Entity entity in m_world.Entities.Values)
195 { 202 {
196 string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');"; 203 string testScriptLink = "javascript:loadXMLDoc('Admin/AddTestScript/" + entity.uuid.ToString() + "');";
197 responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.getName(), entity.position, testScriptLink ); 204 responseString += String.Format( "<li>[{0}] \"{1}\" @ {2} <a href=\"{3}\">add test script</a></li>", entity.uuid, entity.Name, entity.Pos, testScriptLink );
198 } 205 }
199 responseString += "</ul>"; 206 responseString += "</ul>";
200 return responseString; 207 return responseString;