diff options
Added AddPreCompiledScript method to ScriptManager.
Done some work on lbsa71's simpleApp(hope he doesn't mind):
now have the avatar showing up and the terrain and his pulsating box (well except its not a box, as there seems to be something wrong with our PrimitiveBaseShape..DefaultBox() settings).
Also noticed a few other problems that I had to work around, so these need looking into.
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/PulseScript.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/PulseScript.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/PulseScript.cs b/OpenSim/Region/Examples/SimpleApp/PulseScript.cs new file mode 100644 index 0000000..01a9bda --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/PulseScript.cs | |||
@@ -0,0 +1,52 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Scripting; | ||
5 | using OpenSim.Region.Environment.Scenes; | ||
6 | namespace SimpleApp | ||
7 | { | ||
8 | public class PulseScript :IScript | ||
9 | { | ||
10 | ScriptInfo script; | ||
11 | |||
12 | private libsecondlife.LLVector3 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f); | ||
13 | public string getName() | ||
14 | { | ||
15 | return "pulseScript 0.1"; | ||
16 | } | ||
17 | |||
18 | public void Initialise(ScriptInfo scriptInfo) | ||
19 | { | ||
20 | script = scriptInfo; | ||
21 | script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); | ||
22 | script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | ||
23 | } | ||
24 | |||
25 | void events_OnNewPresence(ScenePresence presence) | ||
26 | { | ||
27 | script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); | ||
28 | } | ||
29 | |||
30 | void events_OnFrame() | ||
31 | { | ||
32 | foreach(EntityBase ent in this.script.world.Entities.Values) | ||
33 | { | ||
34 | if (ent is SceneObject) | ||
35 | { | ||
36 | SceneObject prim = (SceneObject)ent; | ||
37 | if ((prim.rootPrimitive.Scale.X > 1) && (prim.rootPrimitive.Scale.Y > 1) && (prim.rootPrimitive.Scale.Z > 1)) | ||
38 | { | ||
39 | this.pulse = new libsecondlife.LLVector3(-0.1f, -0.1f, -0.1f); | ||
40 | } | ||
41 | else if ((prim.rootPrimitive.Scale.X < 0.2f) && (prim.rootPrimitive.Scale.Y < 0.2f) && (prim.rootPrimitive.Scale.Z < 0.2f)) | ||
42 | { | ||
43 | pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f); | ||
44 | } | ||
45 | |||
46 | prim.rootPrimitive.ResizeGoup( prim.rootPrimitive.Scale + pulse); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | } | ||
52 | } | ||