aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-07-14 14:48:36 +0000
committerMW2007-07-14 14:48:36 +0000
commit5a909a2054b17c74e23d608a401c0779a3072869 (patch)
tree53344ac01d4222edba7bc38abe7d78a43bcd7573 /OpenSim
parent* encapsulated some public fields (diff)
downloadopensim-SC-5a909a2054b17c74e23d608a401c0779a3072869.zip
opensim-SC-5a909a2054b17c74e23d608a401c0779a3072869.tar.gz
opensim-SC-5a909a2054b17c74e23d608a401c0779a3072869.tar.bz2
opensim-SC-5a909a2054b17c74e23d608a401c0779a3072869.tar.xz
Set up parcel manager and the master avatar in SimpleApp.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs46
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs31
-rw-r--r--OpenSim/Region/Examples/SimpleApp/PulseScript.cs68
3 files changed, 67 insertions, 78 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index f46e403..d7a0ab2 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -8,13 +8,12 @@ using OpenSim.Framework.Types;
8using OpenSim.Region.Caches; 8using OpenSim.Region.Caches;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Terrain; 10using OpenSim.Region.Terrain;
11using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; 11using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
12 12
13namespace SimpleApp 13namespace SimpleApp
14{ 14{
15 public class MyWorld : Scene 15 public class MyWorld : Scene
16 { 16 {
17 private bool firstlogin = true;
18 private List<ScenePresence> m_avatars; 17 private List<ScenePresence> m_avatars;
19 18
20 public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) 19 public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
@@ -58,53 +57,46 @@ namespace SimpleApp
58 #region IWorld Members 57 #region IWorld Members
59 58
60 override public void AddNewClient(IClientAPI client, bool child) 59 override public void AddNewClient(IClientAPI client, bool child)
61
62 { 60 {
63 NewLoggin();
64
65 LLVector3 pos = new LLVector3(128, 128, 128); 61 LLVector3 pos = new LLVector3(128, 128, 128);
66 62
67 client.OnRegionHandShakeReply += SendLayerData; 63 client.OnRegionHandShakeReply += SendLayerData;
68 client.OnChatFromViewer += 64 client.OnChatFromViewer +=
69 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 65 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
70 { 66 {
71 // Echo it (so you know what you typed) 67 // Echo it (so you know what you typed)
72 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); 68 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
73 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); 69 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero);
74 }; 70 };
75 71
76 client.OnAddPrim += AddNewPrim; 72 client.OnAddPrim += AddNewPrim;
77 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; 73 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
78 client.OnRequestMapBlocks += this.RequestMapBlocks; 74 client.OnRequestMapBlocks += this.RequestMapBlocks;
79 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 75 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
80 client.OnGrapUpdate += this.MoveObject; 76 client.OnGrapUpdate += this.MoveObject;
81 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 77 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
82 78
83 client.OnCompleteMovementToRegion += delegate() 79 client.OnCompleteMovementToRegion += delegate()
84 { 80 {
85 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); 81 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero);
86 }; 82 };
87 83
88 client.SendRegionHandshake(m_regInfo); 84 client.SendRegionHandshake(m_regInfo);
89 85
90 ScenePresence avatar =CreateAndAddScenePresence(client); 86 ScenePresence avatar = CreateAndAddScenePresence(client);
91 avatar.Pos = new LLVector3(128, 128, 26); 87 avatar.Pos = new LLVector3(128, 128, 26);
92 } 88 }
93 89
94 public void NewLoggin() 90 public void CustomStartup()
95 { 91 {
96 if (firstlogin) 92 this.StartTimer();
97 {
98 this.StartTimer();
99 93
100 ScriptManager.AddPreCompiledScript(new PulseScript()); 94 ScriptManager.AddPreCompiledScript(new PulseScript());
101 95
102 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); 96 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
103 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 97 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
104 LLVector3 pos1 = new LLVector3(129, 129, 27); 98 LLVector3 pos1 = new LLVector3(129, 129, 27);
105 AddNewPrim(LLUUID.Random(), pos1, shape); 99 AddNewPrim(LLUUID.Random(), pos1, shape);
106 firstlogin = false;
107 }
108 } 100 }
109 101
110 public override void Update() 102 public override void Update()
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 42036eb..f30f444 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -13,6 +13,7 @@ using OpenSim.Region.Capabilities;
13using OpenSim.Region.ClientStack; 13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local; 14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.GridInterfaces.Local; 15using OpenSim.Region.GridInterfaces.Local;
16using OpenSim.Framework.Data;
16 17
17namespace SimpleApp 18namespace SimpleApp
18{ 19{
@@ -48,7 +49,7 @@ namespace SimpleApp
48 49
49 UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager ); 50 UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager );
50 PacketServer packetServer = new PacketServer(udpServer); 51 PacketServer packetServer = new PacketServer(udpServer);
51 udpServer.ServerListener(); 52
52 53
53 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 54 ClientView.TerrainManager = new TerrainManager(new SecondLife());
54 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); 55 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
@@ -62,25 +63,22 @@ namespace SimpleApp
62 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; 63 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
63 64
64 world.LoadWorldMap(); 65 world.LoadWorldMap();
65 world.ParcelManager.NoParcelDataFromStorage();
66 66
67 udpServer.LocalWorld = world; 67 udpServer.LocalWorld = world;
68
69 httpServer.Start();
70
71 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
72 m_log.ReadLine();
73 68
69 httpServer.Start();
70 udpServer.ServerListener();
74 71
75 /* 72 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test");
76 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); 73 if (masterAvatar != null)
77 74 {
78 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 75 world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
79 76 world.ParcelManager.NoParcelDataFromStorage();
80 LLVector3 pos = new LLVector3(129,130,25); 77 }
81 78
82 world.AddNewPrim( LLUUID.Random(), pos, shape ); 79 world.CustomStartup();
83 */ 80 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
81 m_log.ReadLine();
84 82
85 } 83 }
86 84
@@ -136,8 +134,7 @@ namespace SimpleApp
136 { 134 {
137 Program app = new Program(); 135 Program app = new Program();
138 136
139 app.Run(); 137 app.Run();
140
141 } 138 }
142 } 139 }
143} 140}
diff --git a/OpenSim/Region/Examples/SimpleApp/PulseScript.cs b/OpenSim/Region/Examples/SimpleApp/PulseScript.cs
index 01a9bda..b65765c 100644
--- a/OpenSim/Region/Examples/SimpleApp/PulseScript.cs
+++ b/OpenSim/Region/Examples/SimpleApp/PulseScript.cs
@@ -5,48 +5,48 @@ using OpenSim.Region.Scripting;
5using OpenSim.Region.Environment.Scenes; 5using OpenSim.Region.Environment.Scenes;
6namespace SimpleApp 6namespace SimpleApp
7{ 7{
8 public class PulseScript :IScript 8 public class PulseScript : IScript
9 { 9 {
10 ScriptInfo script; 10 ScriptInfo script;
11 11
12 private libsecondlife.LLVector3 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f); 12 private libsecondlife.LLVector3 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
13 public string getName() 13 public string getName()
14 { 14 {
15 return "pulseScript 0.1"; 15 return "pulseScript 0.1";
16 } 16 }
17 17
18 public void Initialise(ScriptInfo scriptInfo) 18 public void Initialise(ScriptInfo scriptInfo)
19 { 19 {
20 script = scriptInfo; 20 script = scriptInfo;
21 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 21 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
22 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 22 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
23 } 23 }
24 24
25 void events_OnNewPresence(ScenePresence presence) 25 void events_OnNewPresence(ScenePresence presence)
26 { 26 {
27 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); 27 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
28 } 28 }
29 29
30 void events_OnFrame() 30 void events_OnFrame()
31 {
32 foreach (EntityBase ent in this.script.world.Entities.Values)
31 { 33 {
32 foreach(EntityBase ent in this.script.world.Entities.Values) 34 if (ent is SceneObject)
33 { 35 {
34 if (ent is SceneObject) 36 SceneObject prim = (SceneObject)ent;
35 { 37 if ((prim.rootPrimitive.Scale.X > 1) && (prim.rootPrimitive.Scale.Y > 1) && (prim.rootPrimitive.Scale.Z > 1))
36 SceneObject prim = (SceneObject)ent; 38 {
37 if ((prim.rootPrimitive.Scale.X > 1) && (prim.rootPrimitive.Scale.Y > 1) && (prim.rootPrimitive.Scale.Z > 1)) 39 this.pulse = new libsecondlife.LLVector3(-0.1f, -0.1f, -0.1f);
38 { 40 }
39 this.pulse = new libsecondlife.LLVector3(-0.1f, -0.1f, -0.1f); 41 else if ((prim.rootPrimitive.Scale.X < 0.2f) && (prim.rootPrimitive.Scale.Y < 0.2f) && (prim.rootPrimitive.Scale.Z < 0.2f))
40 } 42 {
41 else if ((prim.rootPrimitive.Scale.X < 0.2f) && (prim.rootPrimitive.Scale.Y < 0.2f) && (prim.rootPrimitive.Scale.Z < 0.2f)) 43 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
42 { 44 }
43 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
44 }
45 45
46 prim.rootPrimitive.ResizeGoup( prim.rootPrimitive.Scale + pulse); 46 prim.rootPrimitive.ResizeGoup(prim.rootPrimitive.Scale + pulse);
47 } 47 }
48 }
49 } 48 }
50 49 }
50
51 } 51 }
52} 52}