aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/PulseScript.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/PulseScript.cs52
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Scripting;
5using OpenSim.Region.Environment.Scenes;
6namespace 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}