diff options
author | lbsa71 | 2007-07-14 15:33:25 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-14 15:33:25 +0000 |
commit | 811d2b69c9c5d07dbb196cd2ee6353916d0b51c5 (patch) | |
tree | ad6cb65aee221bdab5a0cd7deddb49950ba98241 | |
parent | *Added support for prim counting on parcels (diff) | |
download | opensim-SC_OLD-811d2b69c9c5d07dbb196cd2ee6353916d0b51c5.zip opensim-SC_OLD-811d2b69c9c5d07dbb196cd2ee6353916d0b51c5.tar.gz opensim-SC_OLD-811d2b69c9c5d07dbb196cd2ee6353916d0b51c5.tar.bz2 opensim-SC_OLD-811d2b69c9c5d07dbb196cd2ee6353916d0b51c5.tar.xz |
* Worked some more on SimpleApp
* Removed SceneObject references to RegionHandle, ParcelManager, EventManager as they are public on Scene
* Moved PulseScript behaviour into MySceneObject
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObject.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 61 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/PulseScript.cs | 52 |
6 files changed, 108 insertions, 158 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 81bab9a..13a8c89 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -41,8 +41,8 @@ using OpenSim.Physics.Manager; | |||
41 | using OpenSim.Region.Caches; | 41 | using OpenSim.Region.Caches; |
42 | using OpenSim.Region.Scripting; | 42 | using OpenSim.Region.Scripting; |
43 | using OpenSim.Region.Terrain; | 43 | using OpenSim.Region.Terrain; |
44 | using Caps=OpenSim.Region.Capabilities.Caps; | 44 | using Caps = OpenSim.Region.Capabilities.Caps; |
45 | using Timer=System.Timers.Timer; | 45 | using Timer = System.Timers.Timer; |
46 | 46 | ||
47 | namespace OpenSim.Region.Environment.Scenes | 47 | namespace OpenSim.Region.Environment.Scenes |
48 | { | 48 | { |
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
223 | //Perform parcel update of prim count | 223 | //Perform parcel update of prim count |
224 | performParcelPrimCountUpdate(); | 224 | performParcelPrimCountUpdate(); |
225 | this.parcelPrimCheckCount = 0; | 225 | this.parcelPrimCheckCount = 0; |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | } | 229 | } |
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | { | 267 | { |
268 | this.SendLayerData(client); | 268 | this.SendLayerData(client); |
269 | }); | 269 | }); |
270 | 270 | ||
271 | foreach (LLUUID UUID in Entities.Keys) | 271 | foreach (LLUUID UUID in Entities.Keys) |
272 | { | 272 | { |
273 | Entities[UUID].LandRenegerated(); | 273 | Entities[UUID].LandRenegerated(); |
@@ -454,18 +454,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
454 | /// <param name="ownerID"></param> | 454 | /// <param name="ownerID"></param> |
455 | public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) | 455 | public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) |
456 | { | 456 | { |
457 | try | 457 | SceneObject sceneOb = new SceneObject(this, ownerID, this.PrimIDAllocate(), pos, shape); |
458 | { | 458 | AddNewEntity(sceneOb); |
459 | SceneObject sceneOb = new SceneObject(m_regionHandle, this, this.m_eventManager,this.m_parcelManager, ownerID, this.PrimIDAllocate(), pos, shape); | 459 | } |
460 | this.Entities.Add(sceneOb.rootUUID, sceneOb); | ||
461 | 460 | ||
462 | // Trigger event for listeners | 461 | public void AddNewEntity(SceneObject sceneObject) |
463 | // eventManager.TriggerOnNewPrimitive(prim); | 462 | { |
464 | } | 463 | this.Entities.Add(sceneObject.rootUUID, sceneObject); |
465 | catch (Exception e) | ||
466 | { | ||
467 | MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | ||
468 | } | ||
469 | } | 464 | } |
470 | 465 | ||
471 | #endregion | 466 | #endregion |
@@ -484,7 +479,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
484 | this.m_estateManager.sendRegionHandshake(client); | 479 | this.m_estateManager.sendRegionHandshake(client); |
485 | CreateAndAddScenePresence(client); | 480 | CreateAndAddScenePresence(client); |
486 | this.m_parcelManager.sendParcelOverlay(client); | 481 | this.m_parcelManager.sendParcelOverlay(client); |
487 | 482 | ||
488 | } | 483 | } |
489 | 484 | ||
490 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 485 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
@@ -512,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
512 | client.OnObjectName += this.PrimName; | 507 | client.OnObjectName += this.PrimName; |
513 | client.OnLinkObjects += this.LinkObjects; | 508 | client.OnLinkObjects += this.LinkObjects; |
514 | client.OnObjectDuplicate += this.DuplicateObject; | 509 | client.OnObjectDuplicate += this.DuplicateObject; |
515 | 510 | ||
516 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_parcelManager.handleParcelPropertiesRequest); | 511 | client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_parcelManager.handleParcelPropertiesRequest); |
517 | client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); | 512 | client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); |
518 | client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); | 513 | client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); |
@@ -571,26 +566,30 @@ namespace OpenSim.Region.Environment.Scenes | |||
571 | { | 566 | { |
572 | m_eventManager.TriggerOnRemovePresence(agentID); | 567 | m_eventManager.TriggerOnRemovePresence(agentID); |
573 | 568 | ||
574 | ScenePresence avatar = this.RequestAvatar(agentID); | 569 | ScenePresence avatar = this.RequestAvatar(agentID); |
575 | 570 | ||
576 | m_clientManager.ForEachClient( | 571 | m_clientManager.ForEachClient( |
577 | delegate(IClientAPI client) | 572 | delegate(IClientAPI client) |
573 | { | ||
574 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | ||
575 | }); | ||
576 | |||
577 | lock (Avatars) | ||
578 | { | ||
579 | if (Avatars.ContainsKey(agentID)) | ||
578 | { | 580 | { |
579 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | ||
580 | }); | ||
581 | |||
582 | lock (Avatars) { | ||
583 | if (Avatars.ContainsKey(agentID)) { | ||
584 | Avatars.Remove(agentID); | 581 | Avatars.Remove(agentID); |
585 | } | 582 | } |
586 | } | 583 | } |
587 | lock (Entities) { | 584 | lock (Entities) |
588 | if (Entities.ContainsKey(agentID)) { | 585 | { |
586 | if (Entities.ContainsKey(agentID)) | ||
587 | { | ||
589 | Entities.Remove(agentID); | 588 | Entities.Remove(agentID); |
590 | } | 589 | } |
591 | } | 590 | } |
592 | // TODO: Add the removal from physics ? | 591 | // TODO: Add the removal from physics ? |
593 | 592 | ||
594 | 593 | ||
595 | 594 | ||
596 | return; | 595 | return; |
@@ -685,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
685 | /// </summary> | 684 | /// </summary> |
686 | public void RegisterRegionWithComms() | 685 | public void RegisterRegionWithComms() |
687 | { | 686 | { |
688 | 687 | ||
689 | this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); | 688 | this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); |
690 | if (this.regionCommsHost != null) | 689 | if (this.regionCommsHost != null) |
691 | { | 690 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index f4c4083..7c49ddb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs | |||
@@ -79,12 +79,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
79 | /// <summary> | 79 | /// <summary> |
80 | /// | 80 | /// |
81 | /// </summary> | 81 | /// </summary> |
82 | public SceneObject(ulong regionHandle, Scene world, EventManager eventManager, ParcelManager parcelManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | 82 | public SceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) |
83 | { | 83 | { |
84 | m_regionHandle = regionHandle; | 84 | m_regionHandle = world.RegionInfo.RegionHandle; |
85 | m_world = world; | 85 | m_world = world; |
86 | m_eventManager = eventManager; | 86 | m_eventManager = world.EventManager; |
87 | m_parcelManager = parcelManager; | 87 | m_parcelManager = world.ParcelManager; |
88 | 88 | ||
89 | this.Pos = pos; | 89 | this.Pos = pos; |
90 | this.CreateRootFromShape(ownerID, localID, shape, pos); | 90 | this.CreateRootFromShape(ownerID, localID, shape, pos); |
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs new file mode 100644 index 0000000..8508dac --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | |||
@@ -0,0 +1,40 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Types; | ||
7 | using System.Timers; | ||
8 | |||
9 | namespace SimpleApp | ||
10 | { | ||
11 | public class MySceneObject : SceneObject | ||
12 | { | ||
13 | LLVector3 delta = new LLVector3(0.1f, 0.1f, 0.1f); | ||
14 | |||
15 | public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | ||
16 | : base(world, ownerID, localID, pos, shape ) | ||
17 | { | ||
18 | Timer timer = new Timer(); | ||
19 | timer.Enabled = true; | ||
20 | timer.Interval = 100; | ||
21 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
22 | } | ||
23 | |||
24 | public void Heartbeat(object sender, EventArgs e) | ||
25 | { | ||
26 | if (rootPrimitive.Scale.X > 1) | ||
27 | { | ||
28 | delta = new LLVector3(-0.1f, -0.1f, -0.1f); | ||
29 | } | ||
30 | |||
31 | if (rootPrimitive.Scale.X < 0.2f) | ||
32 | { | ||
33 | delta = new LLVector3(0.1f, 0.1f, 0.1f); | ||
34 | } | ||
35 | |||
36 | rootPrimitive.ResizeGoup(rootPrimitive.Scale + delta); | ||
37 | update(); | ||
38 | } | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index d7a0ab2..d0e3fed 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -8,7 +8,7 @@ using OpenSim.Framework.Types; | |||
8 | using OpenSim.Region.Caches; | 8 | using OpenSim.Region.Caches; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Terrain; | 10 | using OpenSim.Region.Terrain; |
11 | using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; | 11 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; |
12 | 12 | ||
13 | namespace SimpleApp | 13 | namespace SimpleApp |
14 | { | 14 | { |
@@ -22,22 +22,6 @@ namespace SimpleApp | |||
22 | m_avatars = new List<Avatar>(); | 22 | m_avatars = new List<Avatar>(); |
23 | } | 23 | } |
24 | 24 | ||
25 | /* | ||
26 | public override void SendLayerData(IClientAPI remoteClient) | ||
27 | { | ||
28 | float[] map = new float[65536]; | ||
29 | |||
30 | for (int i = 0; i < 65536; i++) | ||
31 | { | ||
32 | int x = i % 256; | ||
33 | int y = i / 256; | ||
34 | |||
35 | map[i] = 0f; | ||
36 | } | ||
37 | |||
38 | remoteClient.SendLayerData(map); | ||
39 | }*/ | ||
40 | |||
41 | public override void LoadWorldMap() | 25 | public override void LoadWorldMap() |
42 | { | 26 | { |
43 | float[] map = new float[65536]; | 27 | float[] map = new float[65536]; |
@@ -59,55 +43,34 @@ namespace SimpleApp | |||
59 | override public void AddNewClient(IClientAPI client, bool child) | 43 | override public void AddNewClient(IClientAPI client, bool child) |
60 | { | 44 | { |
61 | LLVector3 pos = new LLVector3(128, 128, 128); | 45 | LLVector3 pos = new LLVector3(128, 128, 128); |
62 | 46 | ||
63 | client.OnRegionHandShakeReply += SendLayerData; | 47 | client.OnRegionHandShakeReply += SendLayerData; |
64 | client.OnChatFromViewer += | 48 | client.OnChatFromViewer += |
65 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 49 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
66 | { | 50 | { |
67 | // Echo it (so you know what you typed) | 51 | // Echo it (so you know what you typed) |
68 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | 52 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); |
69 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero); | 53 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); |
70 | }; | 54 | }; |
71 | 55 | ||
72 | client.OnAddPrim += AddNewPrim; | 56 | client.OnAddPrim += AddNewPrim; |
73 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; | 57 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; |
74 | client.OnRequestMapBlocks += this.RequestMapBlocks; | 58 | client.OnRequestMapBlocks += this.RequestMapBlocks; |
75 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; | 59 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; |
76 | client.OnGrapUpdate += this.MoveObject; | 60 | client.OnGrapUpdate += this.MoveObject; |
77 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; | 61 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; |
78 | 62 | ||
79 | client.OnCompleteMovementToRegion += delegate() | 63 | client.OnCompleteMovementToRegion += delegate() |
80 | { | 64 | { |
81 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); | 65 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); |
82 | }; | 66 | }; |
83 | 67 | ||
84 | client.SendRegionHandshake(m_regInfo); | 68 | client.SendRegionHandshake(m_regInfo); |
85 | 69 | ||
86 | ScenePresence avatar = CreateAndAddScenePresence(client); | 70 | ScenePresence avatar = CreateAndAddScenePresence(client); |
87 | avatar.Pos = new LLVector3(128, 128, 26); | 71 | avatar.Pos = new LLVector3(128, 128, 26); |
88 | } | ||
89 | |||
90 | public void CustomStartup() | ||
91 | { | ||
92 | this.StartTimer(); | ||
93 | |||
94 | ScriptManager.AddPreCompiledScript(new PulseScript()); | ||
95 | |||
96 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); | ||
97 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | ||
98 | LLVector3 pos1 = new LLVector3(129, 129, 27); | ||
99 | AddNewPrim(LLUUID.Random(), pos1, shape); | ||
100 | } | 72 | } |
101 | 73 | ||
102 | public override void Update() | ||
103 | { | ||
104 | foreach (LLUUID UUID in Entities.Keys) | ||
105 | { | ||
106 | Entities[UUID].update(); | ||
107 | } | ||
108 | EventManager.TriggerOnFrame(); | ||
109 | } | ||
110 | |||
111 | #endregion | 74 | #endregion |
112 | } | 75 | } |
113 | } | 76 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index f30f444..42a7add 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -13,7 +13,8 @@ using OpenSim.Region.Capabilities; | |||
13 | using OpenSim.Region.ClientStack; | 13 | using OpenSim.Region.ClientStack; |
14 | using OpenSim.Region.Communications.Local; | 14 | using OpenSim.Region.Communications.Local; |
15 | using OpenSim.Region.GridInterfaces.Local; | 15 | using OpenSim.Region.GridInterfaces.Local; |
16 | using OpenSim.Framework.Data; | 16 | using System.Timers; |
17 | using OpenSim.Region.Environment.Scenes; | ||
17 | 18 | ||
18 | namespace SimpleApp | 19 | namespace SimpleApp |
19 | { | 20 | { |
@@ -23,16 +24,17 @@ namespace SimpleApp | |||
23 | AuthenticateSessionsBase m_circuitManager; | 24 | AuthenticateSessionsBase m_circuitManager; |
24 | uint m_localId; | 25 | uint m_localId; |
25 | public MyWorld world; | 26 | public MyWorld world; |
27 | private SceneObject m_sceneObject; | ||
26 | 28 | ||
27 | private void Run() | 29 | private void Run() |
28 | { | 30 | { |
29 | m_log = new LogBase(null, "SimpleApp", this, false); | 31 | m_log = new LogBase(null, "SimpleApp", this, false); |
30 | MainLog.Instance = m_log; | 32 | MainLog.Instance = m_log; |
31 | 33 | ||
32 | // CheckSumServer checksumServer = new CheckSumServer(12036); | 34 | // CheckSumServer checksumServer = new CheckSumServer(12036); |
33 | // checksumServer.ServerListener(); | 35 | // checksumServer.ServerListener(); |
34 | 36 | ||
35 | IPEndPoint internalEndPoint = new IPEndPoint( IPAddress.Parse( "127.0.0.1" ), 9000 ); | 37 | IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000); |
36 | 38 | ||
37 | m_circuitManager = new AuthenticateSessionsBase(); | 39 | m_circuitManager = new AuthenticateSessionsBase(); |
38 | 40 | ||
@@ -46,42 +48,40 @@ namespace SimpleApp | |||
46 | 48 | ||
47 | PhysicsManager physManager = new PhysicsManager(); | 49 | PhysicsManager physManager = new PhysicsManager(); |
48 | physManager.LoadPlugins(); | 50 | physManager.LoadPlugins(); |
49 | 51 | ||
50 | UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager ); | 52 | UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager); |
51 | PacketServer packetServer = new PacketServer(udpServer); | 53 | PacketServer packetServer = new PacketServer(udpServer); |
52 | 54 | ||
53 | |||
54 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 55 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
55 | BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); | 56 | BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); |
56 | 57 | ||
57 | NetworkServersInfo serverInfo = new NetworkServersInfo(); | 58 | NetworkServersInfo serverInfo = new NetworkServersInfo(); |
58 | CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); | 59 | CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); |
59 | 60 | ||
60 | RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); | 61 | RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "127.0.0.1"); |
61 | 62 | ||
62 | world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); | 63 | world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); |
63 | world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; | 64 | world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; |
64 | 65 | ||
65 | world.LoadWorldMap(); | 66 | world.LoadWorldMap(); |
66 | 67 | world.ParcelManager.NoParcelDataFromStorage(); | |
68 | |||
67 | udpServer.LocalWorld = world; | 69 | udpServer.LocalWorld = world; |
68 | 70 | ||
69 | httpServer.Start(); | 71 | httpServer.Start(); |
70 | udpServer.ServerListener(); | 72 | udpServer.ServerListener(); |
71 | 73 | ||
72 | UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test"); | 74 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); |
73 | if (masterAvatar != null) | 75 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
74 | { | 76 | LLVector3 pos = new LLVector3(129, 129, 27); |
75 | world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; | ||
76 | world.ParcelManager.NoParcelDataFromStorage(); | ||
77 | } | ||
78 | 77 | ||
79 | world.CustomStartup(); | 78 | m_sceneObject = new MySceneObject(world, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); |
80 | m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); | 79 | world.AddNewEntity(m_sceneObject); |
80 | |||
81 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | ||
81 | m_log.ReadLine(); | 82 | m_log.ReadLine(); |
82 | |||
83 | } | 83 | } |
84 | 84 | ||
85 | private bool AddNewSessionHandler(ulong regionHandle, Login loginData) | 85 | private bool AddNewSessionHandler(ulong regionHandle, Login loginData) |
86 | { | 86 | { |
87 | m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); | 87 | m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); |
@@ -101,15 +101,15 @@ namespace SimpleApp | |||
101 | 101 | ||
102 | return true; | 102 | return true; |
103 | } | 103 | } |
104 | 104 | ||
105 | #region IAssetReceiver Members | 105 | #region IAssetReceiver Members |
106 | 106 | ||
107 | public void AssetReceived( AssetBase asset, bool IsTexture) | 107 | public void AssetReceived(AssetBase asset, bool IsTexture) |
108 | { | 108 | { |
109 | throw new Exception("The method or operation is not implemented."); | 109 | throw new Exception("The method or operation is not implemented."); |
110 | } | 110 | } |
111 | 111 | ||
112 | public void AssetNotFound( AssetBase asset) | 112 | public void AssetNotFound(AssetBase asset) |
113 | { | 113 | { |
114 | throw new Exception("The method or operation is not implemented."); | 114 | throw new Exception("The method or operation is not implemented."); |
115 | } | 115 | } |
@@ -134,7 +134,7 @@ namespace SimpleApp | |||
134 | { | 134 | { |
135 | Program app = new Program(); | 135 | Program app = new Program(); |
136 | 136 | ||
137 | app.Run(); | 137 | app.Run(); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/PulseScript.cs b/OpenSim/Region/Examples/SimpleApp/PulseScript.cs deleted file mode 100644 index b65765c..0000000 --- a/OpenSim/Region/Examples/SimpleApp/PulseScript.cs +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
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 | } | ||