diff options
author | lbsa71 | 2007-04-03 20:08:30 +0000 |
---|---|---|
committer | lbsa71 | 2007-04-03 20:08:30 +0000 |
commit | f12ceff6925236ca184c5a7a9c010b5e4bdb1b70 (patch) | |
tree | 9c83230be4bbdc19501e854df63084399cd742ba /OpenSim.RegionServer/CAPS/AdminWebFront.cs | |
parent | * Extended Script API with GetRandomAvatar (diff) | |
download | opensim-SC-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.zip opensim-SC-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.tar.gz opensim-SC-f12ceff6925236ca184c5a7a9c010b5e4bdb1b70.tar.bz2 opensim-SC-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/AdminWebFront.cs')
-rw-r--r-- | OpenSim.RegionServer/CAPS/AdminWebFront.cs | 32 |
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; | |||
10 | using libsecondlife; | 10 | using libsecondlife; |
11 | using OpenSim.RegionServer.world.scripting; | 11 | using OpenSim.RegionServer.world.scripting; |
12 | using Avatar=libsecondlife.Avatar; | 12 | using Avatar=libsecondlife.Avatar; |
13 | using OpenSim.RegionServer.world.scripting.Scripts; | ||
13 | 14 | ||
14 | namespace OpenSim.CAPS | 15 | namespace 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 |