aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-06-10 12:25:39 +0000
committerMW2007-06-10 12:25:39 +0000
commitcb624a4d4586de1b66b646a2d04c56bb988f921e (patch)
tree9285b97f88ad23fa59d056c4774377a68fb49033
parentMore World to Region transformation. (diff)
downloadopensim-SC_OLD-cb624a4d4586de1b66b646a2d04c56bb988f921e.zip
opensim-SC_OLD-cb624a4d4586de1b66b646a2d04c56bb988f921e.tar.gz
opensim-SC_OLD-cb624a4d4586de1b66b646a2d04c56bb988f921e.tar.bz2
opensim-SC_OLD-cb624a4d4586de1b66b646a2d04c56bb988f921e.tar.xz
Renamed folder
-rw-r--r--OpenSim.build6
-rw-r--r--OpenSim.sln2
-rw-r--r--OpenSim/OpenSim.World/Avatar.Client.cs48
-rw-r--r--OpenSim/OpenSim.World/Avatar.Update.cs121
-rw-r--r--OpenSim/OpenSim.World/Avatar.cs206
-rw-r--r--OpenSim/OpenSim.World/AvatarAnimations.cs73
-rw-r--r--OpenSim/OpenSim.World/Entity.cs138
-rw-r--r--OpenSim/OpenSim.World/Estate/EstateManager.cs272
-rw-r--r--OpenSim/OpenSim.World/OpenSim.World.csproj204
-rw-r--r--OpenSim/OpenSim.World/OpenSim.World.dll.build71
-rw-r--r--OpenSim/OpenSim.World/ParcelManager.cs890
-rw-r--r--OpenSim/OpenSim.World/Primitive.cs491
-rw-r--r--OpenSim/OpenSim.World/SceneObject.cs100
-rw-r--r--OpenSim/OpenSim.World/World.PacketHandlers.cs219
-rw-r--r--OpenSim/OpenSim.World/World.Scripting.cs157
-rw-r--r--OpenSim/OpenSim.World/World.cs634
-rw-r--r--OpenSim/OpenSim.World/WorldBase.cs111
-rw-r--r--OpenSim/OpenSim.World/scripting/IScriptContext.cs13
-rw-r--r--OpenSim/OpenSim.World/scripting/IScriptEntity.cs19
-rw-r--r--OpenSim/OpenSim.World/scripting/IScriptHandler.cs98
-rw-r--r--OpenSim/OpenSim.World/scripting/Script.cs26
-rw-r--r--OpenSim/OpenSim.World/scripting/ScriptFactory.cs8
-rw-r--r--OpenSim/OpenSim.World/scripting/Scripts/FollowRandomAvatar.cs37
-rw-r--r--OpenSim/OpenSim.World/types/Mesh.cs41
-rw-r--r--OpenSim/OpenSim.World/types/Triangle.cs37
-rw-r--r--OpenSim/OpenSim/OpenSim.csproj2
-rw-r--r--prebuild.xml2
27 files changed, 6 insertions, 4020 deletions
diff --git a/OpenSim.build b/OpenSim.build
index b50f733..9134ac3 100644
--- a/OpenSim.build
+++ b/OpenSim.build
@@ -51,7 +51,7 @@
51 <nant buildfile="OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build" target="clean" /> 51 <nant buildfile="OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build" target="clean" />
52 <nant buildfile="OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="clean" /> 52 <nant buildfile="OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="clean" />
53 <nant buildfile="Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build" target="clean" /> 53 <nant buildfile="Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build" target="clean" />
54 <nant buildfile="OpenSim/OpenSim.World/OpenSim.Region.dll.build" target="clean" /> 54 <nant buildfile="OpenSim/OpenSim.Region/OpenSim.Region.dll.build" target="clean" />
55 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="clean" /> 55 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="clean" />
56 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="clean" /> 56 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="clean" />
57 <nant buildfile="Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build" target="clean" /> 57 <nant buildfile="Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build" target="clean" />
@@ -87,7 +87,7 @@
87 <nant buildfile="OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build" target="build" /> 87 <nant buildfile="OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build" target="build" />
88 <nant buildfile="OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build" target="build" /> 88 <nant buildfile="OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build" target="build" />
89 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="build" /> 89 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="build" />
90 <nant buildfile="OpenSim/OpenSim.World/OpenSim.Region.dll.build" target="build" /> 90 <nant buildfile="OpenSim/OpenSim.Region/OpenSim.Region.dll.build" target="build" />
91 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="build" /> 91 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="build" />
92 </target> 92 </target>
93 93
@@ -104,7 +104,7 @@
104 <nant buildfile="OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build" target="doc" /> 104 <nant buildfile="OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/OpenSim.Storage.LocalStorageBerkeleyDB.dll.build" target="doc" />
105 <nant buildfile="OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="doc" /> 105 <nant buildfile="OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="doc" />
106 <nant buildfile="Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build" target="doc" /> 106 <nant buildfile="Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.dll.build" target="doc" />
107 <nant buildfile="OpenSim/OpenSim.World/OpenSim.Region.dll.build" target="doc" /> 107 <nant buildfile="OpenSim/OpenSim.Region/OpenSim.Region.dll.build" target="doc" />
108 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="doc" /> 108 <nant buildfile="OpenSim/OpenSim/OpenSim.exe.build" target="doc" />
109 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="doc" /> 109 <nant buildfile="OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="doc" />
110 <nant buildfile="Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build" target="doc" /> 110 <nant buildfile="Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build" target="doc" />
diff --git a/OpenSim.sln b/OpenSim.sln
index ae35340..4b87349 100644
--- a/OpenSim.sln
+++ b/OpenSim.sln
@@ -10,7 +10,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.OdePlugin",
10EndProject 10EndProject
11Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}" 11Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Communications", "Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj", "{683344D5-0000-0000-0000-000000000000}"
12EndProject 12EndProject
13Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region", "OpenSim\OpenSim.World\OpenSim.Region.csproj", "{196916AF-0000-0000-0000-000000000000}" 13Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region", "OpenSim\OpenSim.Region\OpenSim.Region.csproj", "{196916AF-0000-0000-0000-000000000000}"
14EndProject 14EndProject
15Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}" 15Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim", "OpenSim\OpenSim\OpenSim.csproj", "{438A9556-0000-0000-0000-000000000000}"
16EndProject 16EndProject
diff --git a/OpenSim/OpenSim.World/Avatar.Client.cs b/OpenSim/OpenSim.World/Avatar.Client.cs
deleted file mode 100644
index c180b36..0000000
--- a/OpenSim/OpenSim.World/Avatar.Client.cs
+++ /dev/null
@@ -1,48 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife.Packets;
5
6namespace OpenSim.Region
7{
8 partial class Avatar
9 {
10 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> updateList = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
11 private List<Entity> interestList = new List<Entity>();
12
13 /// <summary>
14 /// Forwards a packet to the Avatar's client (IClientAPI object).
15 /// Note: Quite likely to be obsolete once the Client API is finished
16 /// </summary>
17 /// <param name="packet"></param>
18 public void SendPacketToViewer(Packet packet)
19 {
20 this.ControllingClient.OutPacket(packet);
21 }
22
23 /// <summary>
24 ///
25 /// </summary>
26 /// <param name="terseBlock"></param>
27 public void AddTerseUpdateToViewersList(ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock)
28 {
29
30 }
31
32 /// <summary>
33 ///
34 /// </summary>
35 public void SendUpdateListToViewer()
36 {
37
38 }
39
40 /// <summary>
41 ///
42 /// </summary>
43 private void UpdateInterestList()
44 {
45
46 }
47 }
48}
diff --git a/OpenSim/OpenSim.World/Avatar.Update.cs b/OpenSim/OpenSim.World/Avatar.Update.cs
deleted file mode 100644
index 2c28807..0000000
--- a/OpenSim/OpenSim.World/Avatar.Update.cs
+++ /dev/null
@@ -1,121 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces;
8
9namespace OpenSim.Region
10{
11 partial class Avatar
12 {
13 /// <summary>
14 ///
15 /// </summary>
16 public override void update()
17 {
18
19
20 }
21
22 /// <summary>
23 ///
24 /// </summary>
25 /// <param name="remoteAvatar"></param>
26 public void SendUpdateToOtherClient(Avatar remoteAvatar)
27 {
28
29 }
30
31 /// <summary>
32 ///
33 /// </summary>
34 /// <returns></returns>
35 public ObjectUpdatePacket CreateUpdatePacket()
36 {
37 return null;
38 }
39
40 /// <summary>
41 ///
42 /// </summary>
43 public void SendInitialPosition()
44 {
45 this.ControllingClient.SendAvatarData(m_regionInfo, this.firstname, this.lastname, this.uuid, this.localid, new LLVector3(128, 128, 60));
46 }
47
48 /// <summary>
49 ///
50 /// </summary>
51 public void SendOurAppearance()
52 {
53
54 }
55
56 /// <summary>
57 ///
58 /// </summary>
59 /// <param name="OurClient"></param>
60 public void SendOurAppearance(IClientAPI OurClient)
61 {
62 this.ControllingClient.SendWearables(this.Wearables);
63 }
64
65 /// <summary>
66 ///
67 /// </summary>
68 /// <param name="avatarInfo"></param>
69 public void SendAppearanceToOtherAgent(Avatar avatarInfo)
70 {
71
72 }
73
74 /// <summary>
75 ///
76 /// </summary>
77 /// <param name="texture"></param>
78 /// <param name="visualParam"></param>
79 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
80 {
81
82 }
83
84 /// <summary>
85 ///
86 /// </summary>
87 public void StopMovement()
88 {
89
90 }
91
92 /// <summary>
93 /// Very likely to be deleted soon!
94 /// </summary>
95 /// <returns></returns>
96 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
97 {
98 return null;
99 }
100
101 /// <summary>
102 ///
103 /// </summary>
104 /// <param name="animID"></param>
105 /// <param name="seq"></param>
106 public void SendAnimPack(LLUUID animID, int seq)
107 {
108
109
110 }
111
112 /// <summary>
113 ///
114 /// </summary>
115 public void SendAnimPack()
116 {
117
118 }
119
120 }
121}
diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs
deleted file mode 100644
index 88a7969..0000000
--- a/OpenSim/OpenSim.World/Avatar.cs
+++ /dev/null
@@ -1,206 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Physics.Manager;
8using OpenSim.Framework.Inventory;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Types;
11using Axiom.MathLib;
12
13namespace OpenSim.Region
14{
15 public partial class Avatar : Entity
16 {
17 public static bool PhysicsEngineFlying = false;
18 public static AvatarAnimations Animations;
19 public string firstname;
20 public string lastname;
21 public IClientAPI ControllingClient;
22 public LLUUID current_anim;
23 public int anim_seq;
24 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
25 private bool updateflag = false;
26 private byte movementflag = 0;
27 private List<NewForce> forcesList = new List<NewForce>();
28 private short _updateCount = 0;
29 private Axiom.MathLib.Quaternion bodyRot;
30 private LLObject.TextureEntry avatarAppearanceTexture = null;
31 private byte[] visualParams;
32 private AvatarWearable[] Wearables;
33 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
34 private ulong m_regionHandle;
35 private Dictionary<uint, IClientAPI> m_clientThreads;
36 private bool childAvatar = false;
37
38 protected RegionInfo m_regionInfo;
39 /// <summary>
40 ///
41 /// </summary>
42 /// <param name="theClient"></param>
43 /// <param name="world"></param>
44 /// <param name="clientThreads"></param>
45 /// <param name="regionDat"></param>
46 public Avatar(IClientAPI theClient, World world, Dictionary<uint, IClientAPI> clientThreads, RegionInfo reginfo)
47 {
48
49 m_world = world;
50 m_clientThreads = clientThreads;
51 this.uuid = theClient.AgentId;
52
53 m_regionInfo = reginfo;
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)");
55 ControllingClient = theClient;
56 this.firstname = ControllingClient.FirstName;
57 this.lastname = ControllingClient.LastName;
58 localid = this.m_world.NextLocalId;
59 Pos = ControllingClient.StartPos;
60 visualParams = new byte[218];
61 for (int i = 0; i < 218; i++)
62 {
63 visualParams[i] = 100;
64 }
65
66 Wearables = AvatarWearable.DefaultWearables;
67
68 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
69 Console.WriteLine("avatar point 4");
70
71 //register for events
72 ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance);
73 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
74 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
75 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
76 /* ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate);
77 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
78 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
79 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
80 * */
81
82 ControllingClient.OnParcelPropertiesRequest +=new ParcelPropertiesRequest(this.m_world.parcelManager.handleParcelPropertiesRequest);
83 ControllingClient.OnParcelDivideRequest += new ParcelDivideRequest(this.m_world.parcelManager.handleParcelDivideRequest);
84 ControllingClient.OnParcelJoinRequest += new ParcelJoinRequest(this.m_world.parcelManager.handleParcelJoinRequest);
85 ControllingClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(this.m_world.parcelManager.handleParcelPropertiesUpdateRequest);
86
87 ControllingClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(this.m_world.estateManager.handleEstateOwnerMessage);
88 }
89
90 /// <summary>
91 ///
92 /// </summary>
93 public PhysicsActor PhysActor
94 {
95 set
96 {
97 this._physActor = value;
98 }
99 get
100 {
101 return _physActor;
102 }
103 }
104
105 /// <summary>
106 ///
107 /// </summary>
108 /// <param name="status"></param>
109 public void ChildStatusChange(bool status)
110 {
111
112 }
113
114 /// <summary>
115 ///
116 /// </summary>
117 public override void addForces()
118 {
119
120 }
121
122 /// <summary>
123 /// likely to removed very soon
124 /// </summary>
125 /// <param name="name"></param>
126 public static void SetupTemplate(string name)
127 {
128
129 }
130
131 /// <summary>
132 /// likely to removed very soon
133 /// </summary>
134 /// <param name="objdata"></param>
135 protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
136 {
137
138
139
140 }
141
142 /// <summary>
143 ///
144 /// </summary>
145 public void CompleteMovement()
146 {
147 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo);
148 }
149
150 /// <summary>
151 ///
152 /// </summary>
153 /// <param name="pack"></param>
154 public void HandleAgentUpdate(Packet pack)
155 {
156 this.HandleUpdate((AgentUpdatePacket)pack);
157 }
158
159 /// <summary>
160 ///
161 /// </summary>
162 /// <param name="pack"></param>
163 public void HandleUpdate(AgentUpdatePacket pack)
164 {
165
166 }
167
168 /// <summary>
169 ///
170 /// </summary>
171 public void SendRegionHandshake()
172 {
173
174 }
175
176 /// <summary>
177 ///
178 /// </summary>
179 public static void LoadAnims()
180 {
181
182 }
183
184 /// <summary>
185 ///
186 /// </summary>
187 public override void LandRenegerated()
188 {
189
190 }
191
192
193 public class NewForce
194 {
195 public float X;
196 public float Y;
197 public float Z;
198
199 public NewForce()
200 {
201
202 }
203 }
204 }
205
206}
diff --git a/OpenSim/OpenSim.World/AvatarAnimations.cs b/OpenSim/OpenSim.World/AvatarAnimations.cs
deleted file mode 100644
index 585cf3c..0000000
--- a/OpenSim/OpenSim.World/AvatarAnimations.cs
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using System.Xml;
33
34namespace OpenSim.Region
35{
36 public class AvatarAnimations
37 {
38
39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
41
42 public AvatarAnimations()
43 {
44 }
45
46 public void LoadAnims()
47 {
48 //OpenSim.Framework.Console.MainConsole.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
49 XmlTextReader reader = new XmlTextReader("data/avataranimations.xml");
50
51 XmlDocument doc = new XmlDocument();
52 doc.Load(reader);
53 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
54 {
55
56 if ( nod.Attributes["name"] != null)
57 {
58 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
59 }
60
61 }
62
63 reader.Close();
64
65 // OpenSim.Framework.Console.MainConsole.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
66
67 foreach (KeyValuePair<string, LLUUID> kp in OpenSim.Region.Avatar.Animations.AnimsLLUUID)
68 {
69 AnimsNames.Add(kp.Value, kp.Key);
70 }
71 }
72 }
73}
diff --git a/OpenSim/OpenSim.World/Entity.cs b/OpenSim/OpenSim.World/Entity.cs
deleted file mode 100644
index 40f9b13..0000000
--- a/OpenSim/OpenSim.World/Entity.cs
+++ /dev/null
@@ -1,138 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Axiom.MathLib;
5using OpenSim.Physics.Manager;
6using OpenSim.Region.types;
7using libsecondlife;
8using OpenSim.Region.Scripting;
9
10namespace OpenSim.Region
11{
12 public abstract class Entity : IScriptReadonlyEntity
13 {
14 public libsecondlife.LLUUID uuid;
15 public uint localid;
16 public LLVector3 velocity;
17 public Quaternion rotation;
18 protected List<Entity> children;
19 protected LLVector3 m_pos;
20 protected PhysicsActor _physActor;
21 protected World m_world;
22 protected string m_name;
23
24 /// <summary>
25 ///
26 /// </summary>
27 public virtual string Name
28 {
29 get { return m_name; }
30 }
31
32 /// <summary>
33 ///
34 /// </summary>
35 public virtual LLVector3 Pos
36 {
37 get
38 {
39 if (this._physActor != null)
40 {
41 m_pos.X = _physActor.Position.X;
42 m_pos.Y = _physActor.Position.Y;
43 m_pos.Z = _physActor.Position.Z;
44 }
45
46 return m_pos;
47 }
48 set
49 {
50 if (this._physActor != null)
51 {
52 try
53 {
54 lock (this.m_world.SyncRoot)
55 {
56
57 this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
58 }
59 }
60 catch (Exception e)
61 {
62 Console.WriteLine(e.Message);
63 }
64 }
65
66 m_pos = value;
67 }
68 }
69
70 /// <summary>
71 /// Creates a new Entity (should not occur on it's own)
72 /// </summary>
73 public Entity()
74 {
75 uuid = new libsecondlife.LLUUID();
76 localid = 0;
77 m_pos = new LLVector3();
78 velocity = new LLVector3();
79 rotation = new Quaternion();
80 m_name = "(basic entity)";
81 children = new List<Entity>();
82 }
83
84 /// <summary>
85 ///
86 /// </summary>
87 public virtual void addForces()
88 {
89 foreach (Entity child in children)
90 {
91 child.addForces();
92 }
93 }
94
95 /// <summary>
96 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
97 /// </summary>
98 public virtual void update() {
99 // Do any per-frame updates needed that are applicable to every type of entity
100 foreach (Entity child in children)
101 {
102 child.update();
103 }
104 }
105
106 /// <summary>
107 /// Returns a mesh for this object and any dependents
108 /// </summary>
109 /// <returns>The mesh of this entity tree</returns>
110 public virtual Mesh getMesh()
111 {
112 Mesh mesh = new Mesh();
113
114 foreach (Entity child in children)
115 {
116 mesh += child.getMesh();
117 }
118
119 return mesh;
120 }
121
122 /// <summary>
123 /// Called at a set interval to inform entities that they should back themsleves up to the DB
124 /// </summary>
125 public virtual void BackUp()
126 {
127
128 }
129
130 /// <summary>
131 /// Infoms the entity that the land (heightmap) has changed
132 /// </summary>
133 public virtual void LandRenegerated()
134 {
135
136 }
137 }
138}
diff --git a/OpenSim/OpenSim.World/Estate/EstateManager.cs b/OpenSim/OpenSim.World/Estate/EstateManager.cs
deleted file mode 100644
index f136d44..0000000
--- a/OpenSim/OpenSim.World/Estate/EstateManager.cs
+++ /dev/null
@@ -1,272 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Framework.Types;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Region;
8using OpenSim;
9
10using libsecondlife;
11using libsecondlife.Packets;
12
13namespace OpenSim.Region.Estate
14{
15
16 /// <summary>
17 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
18 /// </summary>
19 public class EstateManager
20 {
21 private World m_world;
22 private RegionInfo m_regInfo;
23
24 public EstateManager(World world,RegionInfo reginfo)
25 {
26 m_world = world; //Estate settings found at world.m_regInfo.estateSettings
27 m_regInfo = reginfo;
28 }
29
30 private bool convertParamStringToBool(byte[] field)
31 {
32 string s = Helpers.FieldToUTF8String(field);
33 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true")
34 {
35 return true;
36 }
37 return false;
38 }
39
40 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
41 {
42 if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID)
43 {
44 switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
45 {
46 case "getinfo":
47 Console.WriteLine("GETINFO Requested");
48 this.sendRegionInfoPacketToAll();
49
50 break;
51 case "setregioninfo":
52 if (packet.ParamList.Length != 9)
53 {
54 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
55 }
56 else
57 {
58 m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None;
59
60 if (convertParamStringToBool(packet.ParamList[0].Parameter))
61 {
62 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform;
63 }
64
65 if (convertParamStringToBool(packet.ParamList[1].Parameter))
66 {
67 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly;
68 }
69
70 if (convertParamStringToBool(packet.ParamList[2].Parameter))
71 {
72 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage;
73 }
74
75 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
76 {
77 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell;
78 }
79
80
81 int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
82 m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
83
84 float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
85 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
86
87 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
88 m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel;
89
90
91 if (convertParamStringToBool(packet.ParamList[7].Parameter))
92 {
93 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject;
94 }
95
96 if (convertParamStringToBool(packet.ParamList[8].Parameter))
97 {
98 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges;
99 }
100
101 sendRegionInfoPacketToAll();
102
103 }
104 break;
105 case "texturebase":
106 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
107 {
108 string s = Helpers.FieldToUTF8String(block.Parameter);
109 string[] splitField = s.Split(' ');
110 if (splitField.Length == 2)
111 {
112 LLUUID tempUUID = new LLUUID(splitField[1]);
113 switch (Convert.ToInt16(splitField[0]))
114 {
115 case 0:
116 m_regInfo.estateSettings.terrainBase0 = tempUUID;
117 break;
118 case 1:
119 m_regInfo.estateSettings.terrainBase1 = tempUUID;
120 break;
121 case 2:
122 m_regInfo.estateSettings.terrainBase2 = tempUUID;
123 break;
124 case 3:
125 m_regInfo.estateSettings.terrainBase3 = tempUUID;
126 break;
127 }
128 }
129 }
130 break;
131 case "texturedetail":
132 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
133 {
134
135 string s = Helpers.FieldToUTF8String(block.Parameter);
136 string[] splitField = s.Split(' ');
137 if (splitField.Length == 2)
138 {
139 LLUUID tempUUID = new LLUUID(splitField[1]);
140 switch (Convert.ToInt16(splitField[0]))
141 {
142 case 0:
143 m_regInfo.estateSettings.terrainDetail0 = tempUUID;
144 break;
145 case 1:
146 m_regInfo.estateSettings.terrainDetail1 = tempUUID;
147 break;
148 case 2:
149 m_regInfo.estateSettings.terrainDetail2 = tempUUID;
150 break;
151 case 3:
152 m_regInfo.estateSettings.terrainDetail3 = tempUUID;
153 break;
154 }
155 }
156 }
157 break;
158 case "textureheights":
159 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
160 {
161
162 string s = Helpers.FieldToUTF8String(block.Parameter);
163 string[] splitField = s.Split(' ');
164 if (splitField.Length == 3)
165 {
166
167 float tempHeightLow = (float)Convert.ToDecimal(splitField[1]);
168 float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]);
169
170 switch (Convert.ToInt16(splitField[0]))
171 {
172 case 0:
173 m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow;
174 m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh;
175 break;
176 case 1:
177 m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow;
178 m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh;
179 break;
180 case 2:
181 m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow;
182 m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh;
183 break;
184 case 3:
185 m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow;
186 m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh;
187 break;
188 }
189 }
190 }
191 break;
192 case "texturecommit":
193 sendRegionHandshakeToAll();
194 break;
195 case "setregionterrain":
196 if (packet.ParamList.Length != 9)
197 {
198 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
199 }
200 else
201 {
202 m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
203 m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
204 m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
205 m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
206 m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
207
208 sendRegionInfoPacketToAll();
209 }
210 break;
211 default:
212 OpenSim.Framework.Console.MainConsole.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
213 break;
214 }
215 }
216 }
217
218 public void sendRegionInfoPacketToAll()
219 {
220 List<Avatar> avatars = m_world.RequestAvatarList();
221
222 for (int i = 0; i < avatars.Count; i++)
223 {
224 this.sendRegionInfoPacket(avatars[i].ControllingClient);
225 }
226 }
227
228 public void sendRegionHandshakeToAll()
229 {
230 List<Avatar> avatars = m_world.RequestAvatarList();
231
232 for (int i = 0; i < avatars.Count; i++)
233 {
234 this.sendRegionHandshake(avatars[i].ControllingClient);
235 }
236 }
237
238 public void sendRegionInfoPacket(IClientAPI remote_client)
239 {
240
241 AgentCircuitData circuitData = remote_client.RequestClientInfo();
242
243 RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
244 regionInfoPacket.AgentData.AgentID = circuitData.AgentID;
245 regionInfoPacket.AgentData.SessionID = circuitData.SessionID;
246 regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
247 regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID;
248 regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents;
249 regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor;
250 regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID;
251 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
252 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
253 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
254 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
255 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
256 regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_regInfo.RegionName);
257 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
258 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
259 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
260 regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun;
261 regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight;
262
263 remote_client.OutPacket(regionInfoPacket);
264 }
265
266 public void sendRegionHandshake(IClientAPI remoteClient)
267 {
268 remoteClient.SendRegionHandshake(m_regInfo);
269 }
270
271 }
272}
diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj b/OpenSim/OpenSim.World/OpenSim.World.csproj
deleted file mode 100644
index 46803d6..0000000
--- a/OpenSim/OpenSim.World/OpenSim.World.csproj
+++ /dev/null
@@ -1,204 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{642A14A8-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.World</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.World</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="libsecondlife.dll" >
70 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="Axiom.MathLib.dll" >
74 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
84 <Name>OpenSim.Terrain.BasicTerrain</Name>
85 <Project>{2270B8FE-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
90 <Name>OpenSim.Framework</Name>
91 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\..\Common\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
102 <Name>OpenSim.GenericConfig.Xml</Name>
103 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
108 <Name>OpenSim.Physics.Manager</Name>
109 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 <ProjectReference Include="..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
114 <Name>OpenSim.Servers</Name>
115 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private>
118 </ProjectReference>
119 <ProjectReference Include="..\..\Common\XmlRpcCS\XMLRPC.csproj">
120 <Name>XMLRPC</Name>
121 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private>
124 </ProjectReference>
125 <ProjectReference Include="..\..\Common\OpenGrid.Framework.Communications\OpenGrid.Framework.Communications.csproj">
126 <Name>OpenGrid.Framework.Communications</Name>
127 <Project>{683344D5-0000-0000-0000-000000000000}</Project>
128 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
129 <Private>False</Private>
130 </ProjectReference>
131 </ItemGroup>
132 <ItemGroup>
133 <Compile Include="Avatar.Client.cs">
134 <SubType>Code</SubType>
135 </Compile>
136 <Compile Include="Avatar.cs">
137 <SubType>Code</SubType>
138 </Compile>
139 <Compile Include="Avatar.Update.cs">
140 <SubType>Code</SubType>
141 </Compile>
142 <Compile Include="AvatarAnimations.cs">
143 <SubType>Code</SubType>
144 </Compile>
145 <Compile Include="Entity.cs">
146 <SubType>Code</SubType>
147 </Compile>
148 <Compile Include="ParcelManager.cs">
149 <SubType>Code</SubType>
150 </Compile>
151 <Compile Include="Primitive.cs">
152 <SubType>Code</SubType>
153 </Compile>
154 <Compile Include="SceneObject.cs">
155 <SubType>Code</SubType>
156 </Compile>
157 <Compile Include="World.cs">
158 <SubType>Code</SubType>
159 </Compile>
160 <Compile Include="World.PacketHandlers.cs">
161 <SubType>Code</SubType>
162 </Compile>
163 <Compile Include="World.Scripting.cs">
164 <SubType>Code</SubType>
165 </Compile>
166 <Compile Include="WorldBase.cs">
167 <SubType>Code</SubType>
168 </Compile>
169 <Compile Include="Estate\EstateManager.cs">
170 <SubType>Code</SubType>
171 </Compile>
172 <Compile Include="scripting\IScriptContext.cs">
173 <SubType>Code</SubType>
174 </Compile>
175 <Compile Include="scripting\IScriptEntity.cs">
176 <SubType>Code</SubType>
177 </Compile>
178 <Compile Include="scripting\IScriptHandler.cs">
179 <SubType>Code</SubType>
180 </Compile>
181 <Compile Include="scripting\Script.cs">
182 <SubType>Code</SubType>
183 </Compile>
184 <Compile Include="scripting\ScriptFactory.cs">
185 <SubType>Code</SubType>
186 </Compile>
187 <Compile Include="scripting\Scripts\FollowRandomAvatar.cs">
188 <SubType>Code</SubType>
189 </Compile>
190 <Compile Include="types\Mesh.cs">
191 <SubType>Code</SubType>
192 </Compile>
193 <Compile Include="types\Triangle.cs">
194 <SubType>Code</SubType>
195 </Compile>
196 </ItemGroup>
197 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
198 <PropertyGroup>
199 <PreBuildEvent>
200 </PreBuildEvent>
201 <PostBuildEvent>
202 </PostBuildEvent>
203 </PropertyGroup>
204</Project>
diff --git a/OpenSim/OpenSim.World/OpenSim.World.dll.build b/OpenSim/OpenSim.World/OpenSim.World.dll.build
deleted file mode 100644
index 3fa534e..0000000
--- a/OpenSim/OpenSim.World/OpenSim.World.dll.build
+++ /dev/null
@@ -1,71 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.World" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.World" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Avatar.Client.cs" />
15 <include name="Avatar.cs" />
16 <include name="Avatar.Update.cs" />
17 <include name="AvatarAnimations.cs" />
18 <include name="Entity.cs" />
19 <include name="ParcelManager.cs" />
20 <include name="Primitive.cs" />
21 <include name="SceneObject.cs" />
22 <include name="World.cs" />
23 <include name="World.PacketHandlers.cs" />
24 <include name="World.Scripting.cs" />
25 <include name="WorldBase.cs" />
26 <include name="Estate/EstateManager.cs" />
27 <include name="scripting/IScriptContext.cs" />
28 <include name="scripting/IScriptEntity.cs" />
29 <include name="scripting/IScriptHandler.cs" />
30 <include name="scripting/Script.cs" />
31 <include name="scripting/ScriptFactory.cs" />
32 <include name="scripting/Scripts/FollowRandomAvatar.cs" />
33 <include name="types/Mesh.cs" />
34 <include name="types/Triangle.cs" />
35 </sources>
36 <references basedir="${project::get-base-directory()}">
37 <lib>
38 <include name="${project::get-base-directory()}" />
39 <include name="${project::get-base-directory()}/${build.dir}" />
40 </lib>
41 <include name="System.dll" />
42 <include name="System.Xml.dll" />
43 <include name="../../bin/libsecondlife.dll" />
44 <include name="../../bin/Axiom.MathLib.dll" />
45 <include name="../../bin/Db4objects.Db4o.dll" />
46 <include name="../../bin/OpenSim.Terrain.BasicTerrain.dll" />
47 <include name="../../bin/OpenSim.Framework.dll" />
48 <include name="../../bin/OpenSim.Framework.Console.dll" />
49 <include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
50 <include name="../../bin/OpenSim.Physics.Manager.dll" />
51 <include name="../../bin/OpenSim.Servers.dll" />
52 <include name="../../bin/XMLRPC.dll" />
53 <include name="../../bin/OpenGrid.Framework.Communications.dll" />
54 </references>
55 </csc>
56 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
57 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
58 <copy todir="${project::get-base-directory()}/../../bin/">
59 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
60 <include name="*.dll"/>
61 <include name="*.exe"/>
62 </fileset>
63 </copy>
64 </target>
65 <target name="clean">
66 <delete dir="${bin.dir}" failonerror="false" />
67 <delete dir="${obj.dir}" failonerror="false" />
68 </target>
69 <target name="doc" description="Creates documentation.">
70 </target>
71</project>
diff --git a/OpenSim/OpenSim.World/ParcelManager.cs b/OpenSim/OpenSim.World/ParcelManager.cs
deleted file mode 100644
index 37dd24f..0000000
--- a/OpenSim/OpenSim.World/ParcelManager.cs
+++ /dev/null
@@ -1,890 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types;
35
36namespace OpenSim.Region
37{
38
39
40 #region ParcelManager Class
41 /// <summary>
42 /// Handles Parcel objects and operations requiring information from other Parcel objects (divide, join, etc)
43 /// </summary>
44 public class ParcelManager : OpenSim.Framework.Interfaces.ILocalStorageParcelReceiver
45 {
46
47 #region Constants
48 //Parcel types set with flags in ParcelOverlay.
49 //Only one of these can be used.
50 public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000
51 public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001
52 public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010
53 public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011
54 public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100
55 public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101
56
57
58 //Flags that when set, a border on the given side will be placed
59 //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc)
60 //This took forever to figure out -- jeesh. /blame LL for even having to send these
61 public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
62 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
63
64 //RequestResults (I think these are right, they seem to work):
65 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
66 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
67
68 //These are other constants. Yay!
69 public const int START_PARCEL_LOCAL_ID = 1;
70 #endregion
71
72 #region Member Variables
73 public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>();
74 private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
75 private int[,] parcelIDList = new int[64, 64];
76
77 private World m_world;
78 private RegionInfo m_regInfo;
79
80 #endregion
81
82 #region Constructors
83 public ParcelManager(World world, RegionInfo reginfo)
84 {
85
86 m_world = world;
87 m_regInfo = reginfo;
88 parcelIDList.Initialize();
89
90 }
91 #endregion
92
93 #region Member Functions
94
95 #region Parcel From Storage Functions
96 public void ParcelFromStorage(ParcelData data)
97 {
98 Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world);
99 new_parcel.parcelData = data.Copy();
100 new_parcel.setParcelBitmapFromByteArray();
101 addParcel(new_parcel);
102
103 }
104
105 public void NoParcelDataFromStorage()
106 {
107 resetSimParcels();
108 }
109 #endregion
110
111 #region Parcel Add/Remove/Get/Create
112 /// <summary>
113 /// Creates a basic Parcel object without an owner (a zeroed key)
114 /// </summary>
115 /// <returns></returns>
116 public Parcel createBaseParcel()
117 {
118 return new Parcel(new LLUUID(), false, m_world);
119 }
120
121 /// <summary>
122 /// Adds a parcel to the stored list and adds them to the parcelIDList to what they own
123 /// </summary>
124 /// <param name="new_parcel">The parcel being added</param>
125 public void addParcel(Parcel new_parcel)
126 {
127 lastParcelLocalID++;
128 new_parcel.parcelData.localID = lastParcelLocalID;
129 parcelList.Add(lastParcelLocalID, new_parcel.Copy());
130
131
132 bool[,] parcelBitmap = new_parcel.getParcelBitmap();
133 int x, y;
134 for (x = 0; x < 64; x++)
135 {
136 for (y = 0; y < 64; y++)
137 {
138 if (parcelBitmap[x, y])
139 {
140 parcelIDList[x, y] = lastParcelLocalID;
141 }
142 }
143 }
144 parcelList[lastParcelLocalID].forceUpdateParcelInfo();
145
146
147 }
148 /// <summary>
149 /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList
150 /// </summary>
151 /// <param name="local_id">Parcel.localID of the parcel to remove.</param>
152 public void removeParcel(int local_id)
153 {
154 int x, y;
155 for (x = 0; x < 64; x++)
156 {
157 for (y = 0; y < 64; y++)
158 {
159 if (parcelIDList[x, y] == local_id)
160 {
161 throw new Exception("Could not remove parcel. Still being used at " + x + ", " + y);
162 }
163 }
164 }
165 m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData);
166 parcelList.Remove(local_id);
167 }
168
169 private void performFinalParcelJoin(Parcel master, Parcel slave)
170 {
171 int x, y;
172 bool[,] parcelBitmapSlave = slave.getParcelBitmap();
173 for (x = 0; x < 64; x++)
174 {
175 for (y = 0; y < 64; y++)
176 {
177 if (parcelBitmapSlave[x, y])
178 {
179 parcelIDList[x, y] = master.parcelData.localID;
180 }
181 }
182 }
183 removeParcel(slave.parcelData.localID);
184 }
185 /// <summary>
186 /// Get the parcel at the specified point
187 /// </summary>
188 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
189 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
190 /// <returns>Parcel at the point supplied</returns>
191 public Parcel getParcel(int x, int y)
192 {
193 if (x > 256 || y > 256 || x < 0 || y < 0)
194 {
195 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
196 }
197 else
198 {
199 return parcelList[parcelIDList[x / 4, y / 4]];
200 }
201
202 }
203 #endregion
204
205 #region Parcel Modification
206 /// <summary>
207 /// Subdivides a parcel
208 /// </summary>
209 /// <param name="start_x">West Point</param>
210 /// <param name="start_y">South Point</param>
211 /// <param name="end_x">East Point</param>
212 /// <param name="end_y">North Point</param>
213 /// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param>
214 /// <returns>Returns true if successful</returns>
215 private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
216 {
217 //First, lets loop through the points and make sure they are all in the same parcel
218 //Get the parcel at start
219 Parcel startParcel = getParcel(start_x, start_y);
220 if (startParcel == null) return false; //No such parcel at the beginning
221
222 //Loop through the points
223 try
224 {
225 int totalX = end_x - start_x;
226 int totalY = end_y - start_y;
227 int x, y;
228 for (y = 0; y < totalY; y++)
229 {
230 for (x = 0; x < totalX; x++)
231 {
232 Parcel tempParcel = getParcel(start_x + x, start_y + y);
233 if (tempParcel == null) return false; //No such parcel at that point
234 if (tempParcel != startParcel) return false; //Subdividing over 2 parcels; no-no
235 }
236 }
237 }
238 catch (Exception e)
239 {
240 return false; //Exception. For now, lets skip subdivision
241 }
242
243 //If we are still here, then they are subdividing within one parcel
244 //Check owner
245 if (startParcel.parcelData.ownerID != attempting_user_id)
246 {
247 return false; //They cant do this!
248 }
249
250 //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info)
251 Parcel newParcel = startParcel.Copy();
252 newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName;
253 newParcel.parcelData.globalID = LLUUID.Random();
254
255 newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y));
256
257 //Now, lets set the subdivision area of the original to false
258 int startParcelIndex = startParcel.parcelData.localID;
259 parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false));
260 parcelList[startParcelIndex].forceUpdateParcelInfo();
261
262
263 //Now add the new parcel
264 addParcel(newParcel);
265
266
267
268
269
270 return true;
271 }
272 /// <summary>
273 /// Join 2 parcels together
274 /// </summary>
275 /// <param name="start_x">x value in first parcel</param>
276 /// <param name="start_y">y value in first parcel</param>
277 /// <param name="end_x">x value in second parcel</param>
278 /// <param name="end_y">y value in second parcel</param>
279 /// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param>
280 /// <returns>Returns true if successful</returns>
281 private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
282 {
283 end_x -= 4;
284 end_y -= 4;
285
286 //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
287 //This should be fixed later -- somewhat "incomplete code" --Ming
288 Parcel startParcel, endParcel;
289
290 try
291 {
292 startParcel = getParcel(start_x, start_y);
293 endParcel = getParcel(end_x, end_y);
294 }
295 catch (Exception e)
296 {
297 return false; //Error occured when trying to get the start and end parcels
298 }
299 if (startParcel == endParcel)
300 {
301 return false; //Subdivision of the same parcel is not allowed
302 }
303
304 //Check the parcel owners:
305 if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID)
306 {
307 return false;
308 }
309 if (startParcel.parcelData.ownerID != attempting_user_id)
310 {
311 //TODO: Group editing stuff. Avatar owner support for now
312 return false;
313 }
314
315 //Same owners! Lets join them
316 //Merge them to startParcel
317 parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap()));
318 performFinalParcelJoin(startParcel, endParcel);
319
320 return true;
321
322
323
324 }
325 #endregion
326
327 #region Parcel Updating
328 /// <summary>
329 /// Where we send the ParcelOverlay packet to the client
330 /// </summary>
331 /// <param name="remote_client">The object representing the client</param>
332 public void sendParcelOverlay(IClientAPI remote_client)
333 {
334 const int PARCEL_BLOCKS_PER_PACKET = 1024;
335 int x, y = 0;
336 byte[] byteArray = new byte[PARCEL_BLOCKS_PER_PACKET];
337 int byteArrayCount = 0;
338 int sequenceID = 0;
339 ParcelOverlayPacket packet;
340
341 for (y = 0; y < 64; y++)
342 {
343 for (x = 0; x < 64; x++)
344 {
345 byte tempByte = (byte)0; //This represents the byte for the current 4x4
346 Parcel currentParcelBlock = getParcel(x * 4, y * 4);
347
348 if (currentParcelBlock.parcelData.ownerID == remote_client.AgentId)
349 {
350 //Owner Flag
351 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_REQUESTER);
352 }
353 else if (currentParcelBlock.parcelData.salePrice > 0 && (currentParcelBlock.parcelData.authBuyerID == LLUUID.Zero || currentParcelBlock.parcelData.authBuyerID == remote_client.AgentId))
354 {
355 //Sale Flag
356 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_IS_FOR_SALE);
357 }
358 else if (currentParcelBlock.parcelData.ownerID == LLUUID.Zero)
359 {
360 //Public Flag
361 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_PUBLIC);
362 }
363 else
364 {
365 //Other Flag
366 tempByte = Convert.ToByte(tempByte | PARCEL_TYPE_OWNED_BY_OTHER);
367 }
368
369
370 //Now for border control
371 if (x == 0)
372 {
373 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST);
374 }
375 else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock)
376 {
377 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST);
378 }
379
380 if (y == 0)
381 {
382 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH);
383 }
384 else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock)
385 {
386 tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH);
387 }
388
389 byteArray[byteArrayCount] = tempByte;
390 byteArrayCount++;
391 if (byteArrayCount >= PARCEL_BLOCKS_PER_PACKET)
392 {
393 byteArrayCount = 0;
394 packet = new ParcelOverlayPacket();
395 packet.ParcelData.Data = byteArray;
396 packet.ParcelData.SequenceID = sequenceID;
397 remote_client.OutPacket((Packet)packet);
398 sequenceID++;
399 byteArray = new byte[PARCEL_BLOCKS_PER_PACKET];
400 }
401 }
402 }
403
404 packet = new ParcelOverlayPacket();
405 packet.ParcelData.Data = byteArray;
406 packet.ParcelData.SequenceID = sequenceID; //Eh?
407 remote_client.OutPacket((Packet)packet);
408 }
409
410 public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client)
411 {
412 //Get the parcels within the bounds
413 List<Parcel> temp = new List<Parcel>();
414 int x, y, i;
415 int inc_x = end_x - start_x;
416 int inc_y = end_y - start_y;
417 for (x = 0; x < inc_x; x++)
418 {
419 for (y = 0; y < inc_y; y++)
420 {
421 OpenSim.Region.Parcel currentParcel = getParcel(start_x + x, start_y + y);
422 if (!temp.Contains(currentParcel))
423 {
424 currentParcel.forceUpdateParcelInfo();
425 temp.Add(currentParcel);
426 }
427 }
428 }
429
430 int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL;
431 if (temp.Count > 1)
432 {
433 requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS;
434 }
435
436 for (i = 0; i < temp.Count; i++)
437 {
438 temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client);
439 }
440
441
442 sendParcelOverlay(remote_client);
443 }
444
445 public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
446 {
447 if (parcelList.ContainsKey(packet.ParcelData.LocalID))
448 {
449 parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client);
450 }
451 }
452 public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
453 {
454 subdivide(west, south, east, north, remote_client.AgentId);
455 }
456 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
457 {
458 join(west, south, east, north, remote_client.AgentId);
459
460 }
461 #endregion
462
463 /// <summary>
464 /// Resets the sim to the default parcel (full sim parcel owned by the default user)
465 /// </summary>
466 public void resetSimParcels()
467 {
468 //Remove all the parcels in the sim and add a blank, full sim parcel set to public
469 parcelList.Clear();
470 lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
471 parcelIDList.Initialize();
472
473 Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world);
474
475 fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256));
476 fullSimParcel.parcelData.parcelName = "Your Sim Parcel";
477 fullSimParcel.parcelData.parcelDesc = "";
478
479 fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
480 fullSimParcel.parcelData.salePrice = 1;
481 fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale;
482 fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased;
483
484 addParcel(fullSimParcel);
485
486 }
487 #endregion
488 }
489 #endregion
490
491
492 #region Parcel Class
493 /// <summary>
494 /// Keeps track of a specific parcel's information
495 /// </summary>
496 public class Parcel
497 {
498 #region Member Variables
499 public ParcelData parcelData = new ParcelData();
500 public World m_world;
501
502 private bool[,] parcelBitmap = new bool[64, 64];
503
504 #endregion
505
506
507 #region Constructors
508 public Parcel(LLUUID owner_id, bool is_group_owned, World world)
509 {
510 m_world = world;
511 parcelData.ownerID = owner_id;
512 parcelData.isGroupOwned = is_group_owned;
513
514 }
515 #endregion
516
517
518 #region Member Functions
519
520 #region General Functions
521 /// <summary>
522 /// Checks to see if this parcel contains a point
523 /// </summary>
524 /// <param name="x"></param>
525 /// <param name="y"></param>
526 /// <returns>Returns true if the parcel contains the specified point</returns>
527 public bool containsPoint(int x, int y)
528 {
529 if (x >= 0 && y >= 0 && x <= 256 && x <= 256)
530 {
531 return (parcelBitmap[x / 4, y / 4] == true);
532 }
533 else
534 {
535 return false;
536 }
537 }
538
539 public Parcel Copy()
540 {
541 Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world);
542
543 //Place all new variables here!
544 newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone());
545 newParcel.parcelData = parcelData.Copy();
546
547 return newParcel;
548 }
549
550 #endregion
551
552
553 #region Packet Request Handling
554 /// <summary>
555 /// Sends parcel properties as requested
556 /// </summary>
557 /// <param name="sequence_id">ID sent by client for them to keep track of</param>
558 /// <param name="snap_selection">Bool sent by client for them to use</param>
559 /// <param name="remote_client">Object representing the client</param>
560 public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
561 {
562
563 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
564 updatePacket.ParcelData.AABBMax = parcelData.AABBMax;
565 updatePacket.ParcelData.AABBMin = parcelData.AABBMin;
566 updatePacket.ParcelData.Area = parcelData.area;
567 updatePacket.ParcelData.AuctionID = parcelData.auctionID;
568 updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented
569
570 updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray;
571
572 updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc);
573 updatePacket.ParcelData.Category = (byte)parcelData.category;
574 updatePacket.ParcelData.ClaimDate = parcelData.claimDate;
575 updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice;
576 updatePacket.ParcelData.GroupID = parcelData.groupID;
577 updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
578 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
579 updatePacket.ParcelData.LandingType = (byte)parcelData.landingType;
580 updatePacket.ParcelData.LocalID = parcelData.localID;
581 updatePacket.ParcelData.MaxPrims = 1000; //unemplemented
582 updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale;
583 updatePacket.ParcelData.MediaID = parcelData.mediaID;
584 updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL);
585 updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL);
586 updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName);
587 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
588 updatePacket.ParcelData.OtherCount = 0; //unemplemented
589 updatePacket.ParcelData.OtherPrims = 0; //unemplented
590 updatePacket.ParcelData.OwnerID = parcelData.ownerID;
591 updatePacket.ParcelData.OwnerPrims = 0; //unemplemented
592 updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented
593 updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented
594 updatePacket.ParcelData.PassHours = parcelData.passHours;
595 updatePacket.ParcelData.PassPrice = parcelData.passPrice;
596 updatePacket.ParcelData.PublicCount = 0; //unemplemented
597 updatePacket.ParcelData.RegionDenyAnonymous = false; //unemplemented
598 updatePacket.ParcelData.RegionDenyIdentified = false; //unemplemented
599 updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented
600 updatePacket.ParcelData.RegionPushOverride = true; //unemplemented
601 updatePacket.ParcelData.RentPrice = 0; //??
602 updatePacket.ParcelData.RequestResult = request_result;
603 updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented
604 updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented
605 updatePacket.ParcelData.SelfCount = 0;//unemplemented
606 updatePacket.ParcelData.SequenceID = sequence_id;
607 updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented
608 updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented
609 updatePacket.ParcelData.SnapSelection = snap_selection;
610 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
611 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
612 updatePacket.ParcelData.TotalPrims = 0; //unemplemented
613 updatePacket.ParcelData.UserLocation = parcelData.userLocation;
614 updatePacket.ParcelData.UserLookAt = parcelData.userLookAt;
615 remote_client.OutPacket((Packet)updatePacket);
616 }
617
618 public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
619 {
620 if (remote_client.AgentId == parcelData.ownerID)
621 {
622 //Needs later group support
623 parcelData.authBuyerID = packet.ParcelData.AuthBuyerID;
624 parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category;
625 parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
626 parcelData.groupID = packet.ParcelData.GroupID;
627 parcelData.landingType = packet.ParcelData.LandingType;
628 parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale;
629 parcelData.mediaID = packet.ParcelData.MediaID;
630 parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL);
631 parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL);
632 parcelData.parcelName = libsecondlife.Helpers.FieldToUTF8String(packet.ParcelData.Name);
633 parcelData.parcelFlags = (libsecondlife.Parcel.ParcelFlags)packet.ParcelData.ParcelFlags;
634 parcelData.passHours = packet.ParcelData.PassHours;
635 parcelData.passPrice = packet.ParcelData.PassPrice;
636 parcelData.salePrice = packet.ParcelData.SalePrice;
637 parcelData.snapshotID = packet.ParcelData.SnapshotID;
638 parcelData.userLocation = packet.ParcelData.UserLocation;
639 parcelData.userLookAt = packet.ParcelData.UserLookAt;
640
641 List<Avatar> avatars = m_world.RequestAvatarList();
642
643 for (int i = 0; i < avatars.Count; i++)
644 {
645 Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
646 if (over == this)
647 {
648 sendParcelProperties(0, false, 0, avatars[i].ControllingClient);
649 }
650 }
651
652 }
653 }
654 #endregion
655
656
657 #region Update Functions
658 /// <summary>
659 /// Updates the AABBMin and AABBMax values after area/shape modification of parcel
660 /// </summary>
661 private void updateAABBAndAreaValues()
662 {
663 int min_x = 64;
664 int min_y = 64;
665 int max_x = 0;
666 int max_y = 0;
667 int tempArea = 0;
668 int x, y;
669 for (x = 0; x < 64; x++)
670 {
671 for (y = 0; y < 64; y++)
672 {
673 if (parcelBitmap[x, y] == true)
674 {
675 if (min_x > x) min_x = x;
676 if (min_y > y) min_y = y;
677 if (max_x < x) max_x = x;
678 if (max_y < y) max_y = y;
679 tempArea += 16; //16sqm parcel
680 }
681 }
682 }
683 parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]);
684 parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]);
685 parcelData.area = tempArea;
686 }
687
688 public void updateParcelBitmapByteArray()
689 {
690 parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes();
691 }
692
693 /// <summary>
694 /// Update all settings in parcel such as area, bitmap byte array, etc
695 /// </summary>
696 public void forceUpdateParcelInfo()
697 {
698 this.updateAABBAndAreaValues();
699 this.updateParcelBitmapByteArray();
700 }
701
702 public void setParcelBitmapFromByteArray()
703 {
704 parcelBitmap = convertBytesToParcelBitmap();
705 }
706 #endregion
707
708
709 #region Parcel Bitmap Functions
710 /// <summary>
711 /// Sets the parcel's bitmap manually
712 /// </summary>
713 /// <param name="bitmap">64x64 block representing where this parcel is on a map</param>
714 public void setParcelBitmap(bool[,] bitmap)
715 {
716 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
717 {
718 //Throw an exception - The bitmap is not 64x64
719 throw new Exception("Error: Invalid Parcel Bitmap");
720 }
721 else
722 {
723 //Valid: Lets set it
724 parcelBitmap = bitmap;
725 forceUpdateParcelInfo();
726
727 }
728 }
729 /// <summary>
730 /// Gets the parcels bitmap manually
731 /// </summary>
732 /// <returns></returns>
733 public bool[,] getParcelBitmap()
734 {
735 return parcelBitmap;
736 }
737 /// <summary>
738 /// Converts the parcel bitmap to a packet friendly byte array
739 /// </summary>
740 /// <returns></returns>
741 private byte[] convertParcelBitmapToBytes()
742 {
743 byte[] tempConvertArr = new byte[512];
744 byte tempByte = 0;
745 int x, y, i, byteNum = 0;
746 i = 0;
747 for (y = 0; y < 64; y++)
748 {
749 for (x = 0; x < 64; x++)
750 {
751 tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8));
752 if (i % 8 == 0)
753 {
754 tempConvertArr[byteNum] = tempByte;
755 tempByte = (byte)0;
756 i = 0;
757 byteNum++;
758 }
759 }
760 }
761 return tempConvertArr;
762 }
763
764 private bool[,] convertBytesToParcelBitmap()
765 {
766 bool[,] tempConvertMap = new bool[64, 64];
767 tempConvertMap.Initialize();
768 byte tempByte = 0;
769 int x = 0, y = 0, i = 0, bitNum = 0;
770 for (i = 0; i < 512; i++)
771 {
772 tempByte = parcelData.parcelBitmapByteArray[i];
773 for (bitNum = 0; bitNum < 8; bitNum++)
774 {
775 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
776 tempConvertMap[x, y] = bit;
777 x++;
778 if (x > 63)
779 {
780 x = 0;
781 y++;
782 }
783
784 }
785
786 }
787 return tempConvertMap;
788 }
789 /// <summary>
790 /// Full sim parcel creation
791 /// </summary>
792 /// <returns></returns>
793 public static bool[,] basicFullRegionParcelBitmap()
794 {
795 return getSquareParcelBitmap(0, 0, 256, 256);
796 }
797
798 /// <summary>
799 /// Used to modify the bitmap between the x and y points. Points use 64 scale
800 /// </summary>
801 /// <param name="start_x"></param>
802 /// <param name="start_y"></param>
803 /// <param name="end_x"></param>
804 /// <param name="end_y"></param>
805 /// <returns></returns>
806 public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y)
807 {
808
809 bool[,] tempBitmap = new bool[64, 64];
810 tempBitmap.Initialize();
811
812 tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
813 return tempBitmap;
814 }
815
816 /// <summary>
817 /// Change a parcel's bitmap at within a square and set those points to a specific value
818 /// </summary>
819 /// <param name="parcel_bitmap"></param>
820 /// <param name="start_x"></param>
821 /// <param name="start_y"></param>
822 /// <param name="end_x"></param>
823 /// <param name="end_y"></param>
824 /// <param name="set_value"></param>
825 /// <returns></returns>
826 public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value)
827 {
828 if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2)
829 {
830 //Throw an exception - The bitmap is not 64x64
831 throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()");
832 }
833
834 int x, y;
835 for (y = 0; y < 64; y++)
836 {
837 for (x = 0; x < 64; x++)
838 {
839 if (x >= start_x / 4 && x < end_x / 4
840 && y >= start_y / 4 && y < end_y / 4)
841 {
842 parcel_bitmap[x, y] = set_value;
843 }
844 }
845 }
846 return parcel_bitmap;
847 }
848 /// <summary>
849 /// Join the true values of 2 bitmaps together
850 /// </summary>
851 /// <param name="bitmap_base"></param>
852 /// <param name="bitmap_add"></param>
853 /// <returns></returns>
854 public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
855 {
856 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
857 {
858 //Throw an exception - The bitmap is not 64x64
859 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps");
860 }
861 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2)
862 {
863 //Throw an exception - The bitmap is not 64x64
864 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps");
865
866 }
867
868 int x, y;
869 for (y = 0; y < 64; y++)
870 {
871 for (x = 0; x < 64; x++)
872 {
873 if (bitmap_add[x, y])
874 {
875 bitmap_base[x, y] = true;
876 }
877 }
878 }
879 return bitmap_base;
880 }
881 #endregion
882
883 #endregion
884
885
886 }
887 #endregion
888
889
890}
diff --git a/OpenSim/OpenSim.World/Primitive.cs b/OpenSim/OpenSim.World/Primitive.cs
deleted file mode 100644
index 1b1894b..0000000
--- a/OpenSim/OpenSim.World/Primitive.cs
+++ /dev/null
@@ -1,491 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.types;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Physics.Manager;
9using OpenSim.Framework.Types;
10using OpenSim.Framework.Inventory;
11
12namespace OpenSim.Region
13{
14 public class Primitive : Entity
15 {
16 protected PrimData primData;
17 //private ObjectUpdatePacket OurPacket;
18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
19 private Dictionary<uint, IClientAPI> m_clientThreads;
20 private ulong m_regionHandle;
21 private const uint FULL_MASK_PERMISSIONS = 2147483647;
22 private bool physicsEnabled = false;
23
24 private Dictionary<LLUUID, InventoryItem> inventoryItems;
25
26 #region Properties
27
28 public LLVector3 Scale
29 {
30 set
31 {
32 this.primData.Scale = value;
33 //this.dirtyFlag = true;
34 }
35 get
36 {
37 return this.primData.Scale;
38 }
39 }
40
41 public PhysicsActor PhysActor
42 {
43 set
44 {
45 this._physActor = value;
46 }
47 }
48 public override LLVector3 Pos
49 {
50 get
51 {
52 return base.Pos;
53 }
54 set
55 {
56 base.Pos = value;
57 }
58 }
59 #endregion
60
61 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world)
62 {
63 m_clientThreads = clientThreads;
64 m_regionHandle = regionHandle;
65 m_world = world;
66 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
67 }
68
69 public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner)
70 {
71 m_clientThreads = clientThreads;
72 m_regionHandle = regionHandle;
73 m_world = world;
74 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
75 this.primData = new PrimData();
76 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
77 this.primData.OwnerID = owner;
78 }
79
80 public byte[] GetByteArray()
81 {
82 byte[] result = null;
83 List<byte[]> dataArrays = new List<byte[]>();
84 dataArrays.Add(primData.ToBytes());
85 foreach (Entity child in children)
86 {
87 if (child is OpenSim.Region.Primitive)
88 {
89 dataArrays.Add(((OpenSim.Region.Primitive)child).GetByteArray());
90 }
91 }
92 byte[] primstart = Helpers.StringToField("<Prim>");
93 byte[] primend = Helpers.StringToField("</Prim>");
94 int totalLength = primstart.Length + primend.Length;
95 for (int i = 0; i < dataArrays.Count; i++)
96 {
97 totalLength += dataArrays[i].Length;
98 }
99
100 result = new byte[totalLength];
101 int arraypos = 0;
102 Array.Copy(primstart, 0, result, 0, primstart.Length);
103 arraypos += primstart.Length;
104 for (int i = 0; i < dataArrays.Count; i++)
105 {
106 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
107 arraypos += dataArrays[i].Length;
108 }
109 Array.Copy(primend, 0, result, arraypos, primend.Length);
110
111 return result;
112 }
113
114 #region Overridden Methods
115
116 public override void update()
117 {
118 LLVector3 pos2 = new LLVector3(0, 0, 0);
119 }
120
121 public override void BackUp()
122 {
123
124 }
125
126 #endregion
127
128 #region Packet handlers
129
130 public void UpdatePosition(LLVector3 pos)
131 {
132
133 }
134
135 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
136 {
137 this.primData.PathBegin = addPacket.PathBegin;
138 this.primData.PathEnd = addPacket.PathEnd;
139 this.primData.PathScaleX = addPacket.PathScaleX;
140 this.primData.PathScaleY = addPacket.PathScaleY;
141 this.primData.PathShearX = addPacket.PathShearX;
142 this.primData.PathShearY = addPacket.PathShearY;
143 this.primData.PathSkew = addPacket.PathSkew;
144 this.primData.ProfileBegin = addPacket.ProfileBegin;
145 this.primData.ProfileEnd = addPacket.ProfileEnd;
146 this.primData.PathCurve = addPacket.PathCurve;
147 this.primData.ProfileCurve = addPacket.ProfileCurve;
148 this.primData.ProfileHollow = addPacket.ProfileHollow;
149 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
150 this.primData.PathRevolutions = addPacket.PathRevolutions;
151 this.primData.PathTaperX = addPacket.PathTaperX;
152 this.primData.PathTaperY = addPacket.PathTaperY;
153 this.primData.PathTwist = addPacket.PathTwist;
154 this.primData.PathTwistBegin = addPacket.PathTwistBegin;
155 }
156
157 public void UpdateTexture(byte[] tex)
158 {
159 this.primData.Texture = tex;
160 //this.dirtyFlag = true;
161 }
162
163 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
164 {
165
166 }
167
168 public void AssignToParent(Primitive prim)
169 {
170
171 }
172
173 public void GetProperites(IClientAPI client)
174 {
175 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
176 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
177 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
178 proper.ObjectData[0].ItemID = LLUUID.Zero;
179 proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate;
180 proper.ObjectData[0].CreatorID = this.primData.OwnerID;
181 proper.ObjectData[0].FolderID = LLUUID.Zero;
182 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
183 proper.ObjectData[0].GroupID = LLUUID.Zero;
184 proper.ObjectData[0].InventorySerial = 0;
185 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
186 proper.ObjectData[0].ObjectID = this.uuid;
187 proper.ObjectData[0].OwnerID = primData.OwnerID;
188 proper.ObjectData[0].TouchName = new byte[0];
189 proper.ObjectData[0].TextureID = new byte[0];
190 proper.ObjectData[0].SitName = new byte[0];
191 proper.ObjectData[0].Name = new byte[0];
192 proper.ObjectData[0].Description = new byte[0];
193 proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
194 proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
195 proper.ObjectData[0].GroupMask = this.primData.GroupMask;
196 proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
197 proper.ObjectData[0].BaseMask = this.primData.BaseMask;
198
199 client.OutPacket(proper);
200 }
201
202 #endregion
203
204 # region Inventory Methods
205
206 public bool AddToInventory(InventoryItem item)
207 {
208 return false;
209 }
210
211 public InventoryItem RemoveFromInventory(LLUUID itemID)
212 {
213 return null;
214 }
215
216 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
217 {
218
219 }
220
221 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
222 {
223 //will only currently work if the total size of the inventory data array is under about 1000 bytes
224 SendXferPacketPacket send = new SendXferPacketPacket();
225
226 send.XferID.ID = xferID;
227 send.XferID.Packet = 1 + 2147483648;
228 send.DataPacket.Data = this.ConvertInventoryToBytes();
229
230 simClient.OutPacket(send);
231 }
232
233 public byte[] ConvertInventoryToBytes()
234 {
235 System.Text.Encoding enc = System.Text.Encoding.ASCII;
236 byte[] result = new byte[0];
237 List<byte[]> inventoryData = new List<byte[]>();
238 int totallength = 0;
239 foreach (InventoryItem invItem in inventoryItems.Values)
240 {
241 byte[] data = enc.GetBytes(invItem.ExportString());
242 inventoryData.Add(data);
243 totallength += data.Length;
244 }
245 //TODO: copy arrays into the single result array
246
247 return result;
248 }
249
250 public void CreateInventoryFromBytes(byte[] data)
251 {
252
253 }
254
255 #endregion
256
257 #region Update viewers Methods
258
259 //should change these mehtods, so that outgoing packets are sent through the avatar class
260 public void SendFullUpdateToClient(IClientAPI remoteClient)
261 {
262 LLVector3 lPos;
263 if (this._physActor != null && this.physicsEnabled)
264 {
265 PhysicsVector pPos = this._physActor.Position;
266 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
267 }
268 else
269 {
270 lPos = this.Pos;
271 }
272
273 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
274 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
275 outPacket.ObjectData[0] = this.CreateUpdateBlock();
276 byte[] pb = lPos.GetBytes();
277 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
278
279 remoteClient.OutPacket(outPacket);
280 }
281
282 public void SendFullUpdateToAllClients()
283 {
284
285 }
286
287 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
288 {
289
290 }
291
292 public void SendTerseUpdateToALLClients()
293 {
294
295 }
296
297 #endregion
298
299 #region Create Methods
300
301 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
302 {
303 PrimData PData = new PrimData();
304 this.primData = PData;
305 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
306
307 PData.OwnerID = ownerID;
308 PData.PCode = addPacket.ObjectData.PCode;
309 PData.PathBegin = addPacket.ObjectData.PathBegin;
310 PData.PathEnd = addPacket.ObjectData.PathEnd;
311 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
312 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
313 PData.PathShearX = addPacket.ObjectData.PathShearX;
314 PData.PathShearY = addPacket.ObjectData.PathShearY;
315 PData.PathSkew = addPacket.ObjectData.PathSkew;
316 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
317 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
318 PData.Scale = addPacket.ObjectData.Scale;
319 PData.PathCurve = addPacket.ObjectData.PathCurve;
320 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
321 PData.ParentID = 0;
322 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
323 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
324 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
325 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
326 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
327 PData.PathTwist = addPacket.ObjectData.PathTwist;
328 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
329 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
330 this.primData.FullID = this.uuid = LLUUID.Random();
331 this.localid = (uint)(localID);
332 this.primData.Position = this.Pos = pos1;
333 }
334
335 public void CreateFromBytes(byte[] data)
336 {
337
338 }
339
340 public void CreateFromPrimData(PrimData primData)
341 {
342 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
343 }
344
345 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
346 {
347
348 }
349
350 #endregion
351
352 #region Packet Update Methods
353 protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
354 {
355 objdata.PSBlock = new byte[0];
356 objdata.ExtraParams = new byte[1];
357 objdata.MediaURL = new byte[0];
358 objdata.NameValue = new byte[0];
359 objdata.Text = new byte[0];
360 objdata.TextColor = new byte[4];
361 objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0);
362 objdata.JointPivot = new LLVector3(0, 0, 0);
363 objdata.Material = 3;
364 objdata.TextureAnim = new byte[0];
365 objdata.Sound = LLUUID.Zero;
366 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
367 this.primData.Texture = objdata.TextureEntry = ntex.ToBytes();
368 objdata.State = 0;
369 objdata.Data = new byte[0];
370
371 objdata.ObjectData = new byte[60];
372 objdata.ObjectData[46] = 128;
373 objdata.ObjectData[47] = 63;
374 }
375
376 protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData)
377 {
378 objectData.OwnerID = this.primData.OwnerID;
379 objectData.PCode = this.primData.PCode;
380 objectData.PathBegin = this.primData.PathBegin;
381 objectData.PathEnd = this.primData.PathEnd;
382 objectData.PathScaleX = this.primData.PathScaleX;
383 objectData.PathScaleY = this.primData.PathScaleY;
384 objectData.PathShearX = this.primData.PathShearX;
385 objectData.PathShearY = this.primData.PathShearY;
386 objectData.PathSkew = this.primData.PathSkew;
387 objectData.ProfileBegin = this.primData.ProfileBegin;
388 objectData.ProfileEnd = this.primData.ProfileEnd;
389 objectData.Scale = this.primData.Scale;
390 objectData.PathCurve = this.primData.PathCurve;
391 objectData.ProfileCurve = this.primData.ProfileCurve;
392 objectData.ParentID = this.primData.ParentID;
393 objectData.ProfileHollow = this.primData.ProfileHollow;
394 objectData.PathRadiusOffset = this.primData.PathRadiusOffset;
395 objectData.PathRevolutions = this.primData.PathRevolutions;
396 objectData.PathTaperX = this.primData.PathTaperX;
397 objectData.PathTaperY = this.primData.PathTaperY;
398 objectData.PathTwist = this.primData.PathTwist;
399 objectData.PathTwistBegin = this.primData.PathTwistBegin;
400 }
401
402 #endregion
403 protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock()
404 {
405 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
406 this.SetDefaultPacketValues(objupdate);
407 objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
408 this.SetPacketShapeData(objupdate);
409 byte[] pb = this.Pos.GetBytes();
410 Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length);
411 return objupdate;
412 }
413
414 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
415 {
416 uint ID = this.localid;
417 byte[] bytes = new byte[60];
418
419 int i = 0;
420 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
421 dat.TextureEntry = new byte[0];
422 bytes[i++] = (byte)(ID % 256);
423 bytes[i++] = (byte)((ID >> 8) % 256);
424 bytes[i++] = (byte)((ID >> 16) % 256);
425 bytes[i++] = (byte)((ID >> 24) % 256);
426 bytes[i++] = 0;
427 bytes[i++] = 0;
428
429 LLVector3 lPos;
430 Axiom.MathLib.Quaternion lRot;
431 if (this._physActor != null && this.physicsEnabled)
432 {
433 PhysicsVector pPos = this._physActor.Position;
434 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
435 lRot = this._physActor.Orientation;
436 }
437 else
438 {
439 lPos = this.Pos;
440 lRot = this.rotation;
441 }
442 byte[] pb = lPos.GetBytes();
443 Array.Copy(pb, 0, bytes, i, pb.Length);
444 i += 12;
445 ushort ac = 32767;
446
447 //vel
448 bytes[i++] = (byte)(ac % 256);
449 bytes[i++] = (byte)((ac >> 8) % 256);
450 bytes[i++] = (byte)(ac % 256);
451 bytes[i++] = (byte)((ac >> 8) % 256);
452 bytes[i++] = (byte)(ac % 256);
453 bytes[i++] = (byte)((ac >> 8) % 256);
454
455 //accel
456 bytes[i++] = (byte)(ac % 256);
457 bytes[i++] = (byte)((ac >> 8) % 256);
458 bytes[i++] = (byte)(ac % 256);
459 bytes[i++] = (byte)((ac >> 8) % 256);
460 bytes[i++] = (byte)(ac % 256);
461 bytes[i++] = (byte)((ac >> 8) % 256);
462
463 ushort rw, rx, ry, rz;
464 rw = (ushort)(32768 * (lRot.w + 1));
465 rx = (ushort)(32768 * (lRot.x + 1));
466 ry = (ushort)(32768 * (lRot.y + 1));
467 rz = (ushort)(32768 * (lRot.z + 1));
468
469 //rot
470 bytes[i++] = (byte)(rx % 256);
471 bytes[i++] = (byte)((rx >> 8) % 256);
472 bytes[i++] = (byte)(ry % 256);
473 bytes[i++] = (byte)((ry >> 8) % 256);
474 bytes[i++] = (byte)(rz % 256);
475 bytes[i++] = (byte)((rz >> 8) % 256);
476 bytes[i++] = (byte)(rw % 256);
477 bytes[i++] = (byte)((rw >> 8) % 256);
478
479 //rotation vel
480 bytes[i++] = (byte)(ac % 256);
481 bytes[i++] = (byte)((ac >> 8) % 256);
482 bytes[i++] = (byte)(ac % 256);
483 bytes[i++] = (byte)((ac >> 8) % 256);
484 bytes[i++] = (byte)(ac % 256);
485 bytes[i++] = (byte)((ac >> 8) % 256);
486
487 dat.Data = bytes;
488 return dat;
489 }
490 }
491}
diff --git a/OpenSim/OpenSim.World/SceneObject.cs b/OpenSim/OpenSim.World/SceneObject.cs
deleted file mode 100644
index 9ea631b..0000000
--- a/OpenSim/OpenSim.World/SceneObject.cs
+++ /dev/null
@@ -1,100 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.types;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Physics.Manager;
9using OpenSim.Framework.Types;
10using OpenSim.Framework.Inventory;
11
12namespace OpenSim.Region
13{
14 public class SceneObject : Entity
15 {
16 private LLUUID rootUUID;
17 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>();
18 private Dictionary<uint, IClientAPI> m_clientThreads;
19 private World m_world;
20
21 /// <summary>
22 ///
23 /// </summary>
24 public SceneObject()
25 {
26
27 }
28
29 /// <summary>
30 ///
31 /// </summary>
32 /// <param name="addPacket"></param>
33 /// <param name="agentID"></param>
34 /// <param name="localID"></param>
35 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
36 {
37 }
38
39 /// <summary>
40 ///
41 /// </summary>
42 /// <param name="data"></param>
43 public void CreateFromBytes(byte[] data)
44 {
45
46 }
47
48 /// <summary>
49 ///
50 /// </summary>
51 public override void update()
52 {
53
54 }
55
56 /// <summary>
57 ///
58 /// </summary>
59 public override void BackUp()
60 {
61
62 }
63
64 /// <summary>
65 ///
66 /// </summary>
67 /// <param name="client"></param>
68 public void GetProperites(IClientAPI client)
69 {
70 /*
71 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
72 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
73 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
74 proper.ObjectData[0].ItemID = LLUUID.Zero;
75 proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate;
76 proper.ObjectData[0].CreatorID = this.primData.OwnerID;
77 proper.ObjectData[0].FolderID = LLUUID.Zero;
78 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
79 proper.ObjectData[0].GroupID = LLUUID.Zero;
80 proper.ObjectData[0].InventorySerial = 0;
81 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
82 proper.ObjectData[0].ObjectID = this.uuid;
83 proper.ObjectData[0].OwnerID = primData.OwnerID;
84 proper.ObjectData[0].TouchName = new byte[0];
85 proper.ObjectData[0].TextureID = new byte[0];
86 proper.ObjectData[0].SitName = new byte[0];
87 proper.ObjectData[0].Name = new byte[0];
88 proper.ObjectData[0].Description = new byte[0];
89 proper.ObjectData[0].OwnerMask = this.primData.OwnerMask;
90 proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask;
91 proper.ObjectData[0].GroupMask = this.primData.GroupMask;
92 proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask;
93 proper.ObjectData[0].BaseMask = this.primData.BaseMask;
94
95 client.OutPacket(proper);
96 * */
97 }
98
99 }
100}
diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs
deleted file mode 100644
index c88e920..0000000
--- a/OpenSim/OpenSim.World/World.PacketHandlers.cs
+++ /dev/null
@@ -1,219 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9using OpenSim.Framework.Inventory;
10using OpenSim.Framework.Utilities;
11
12namespace OpenSim.Region
13{
14 public partial class World
15 {
16 /// <summary>
17 ///
18 /// </summary>
19 /// <param name="action"></param>
20 /// <param name="north"></param>
21 /// <param name="west"></param>
22 public void ModifyTerrain(byte action, float north, float west)
23 {
24 switch (action)
25 {
26 case 1:
27 // raise terrain
28 Terrain.raise(north, west, 10.0, 0.001);
29 RegenerateTerrain(true, (int)north, (int)west);
30 break;
31 case 2:
32 //lower terrain
33 Terrain.lower(north, west, 10.0, 0.001);
34 RegenerateTerrain(true, (int)north, (int)west);
35 break;
36 }
37 return;
38 }
39
40 /// <summary>
41 ///
42 /// </summary>
43 /// <param name="message"></param>
44 /// <param name="type"></param>
45 /// <param name="fromPos"></param>
46 /// <param name="fromName"></param>
47 /// <param name="fromAgentID"></param>
48 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
49 {
50 Console.WriteLine("Chat message");
51 Avatar avatar = null;
52 foreach (IClientAPI client in m_clientThreads.Values)
53 {
54 int dis = -1000;
55 if (this.Avatars.ContainsKey(client.AgentId))
56 {
57
58 avatar = this.Avatars[client.AgentId];
59 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
60 dis= (int)avatar.Pos.GetDistanceTo(fromPos);
61 Console.WriteLine("found avatar at " +dis);
62
63 }
64
65 switch (type)
66 {
67 case 0: // Whisper
68 if ((dis < 10) && (dis > -10))
69 {
70 //should change so the message is sent through the avatar rather than direct to the ClientView
71 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
72 }
73 break;
74 case 1: // Say
75 if ((dis < 30) && (dis > -30))
76 {
77 Console.WriteLine("sending chat");
78 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
79 }
80 break;
81 case 2: // Shout
82 if ((dis < 100) && (dis > -100))
83 {
84 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
85 }
86 break;
87
88 case 0xff: // Broadcast
89 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
90 break;
91 }
92
93 }
94 }
95
96 /// <summary>
97 ///
98 /// </summary>
99 /// <param name="primAsset"></param>
100 /// <param name="pos"></param>
101 public void RezObject(AssetBase primAsset, LLVector3 pos)
102 {
103
104 }
105
106 /// <summary>
107 ///
108 /// </summary>
109 /// <param name="packet"></param>
110 /// <param name="simClient"></param>
111 public void DeRezObject(Packet packet, IClientAPI simClient)
112 {
113
114 }
115
116 /// <summary>
117 ///
118 /// </summary>
119 /// <param name="remoteClient"></param>
120 public void SendAvatarsToClient(IClientAPI remoteClient)
121 {
122
123 }
124
125 /// <summary>
126 ///
127 /// </summary>
128 /// <param name="parentPrim"></param>
129 /// <param name="childPrims"></param>
130 public void LinkObjects(uint parentPrim, List<uint> childPrims)
131 {
132
133
134 }
135
136 /// <summary>
137 ///
138 /// </summary>
139 /// <param name="primLocalID"></param>
140 /// <param name="shapeBlock"></param>
141 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
142 {
143
144 }
145
146 /// <summary>
147 ///
148 /// </summary>
149 /// <param name="primLocalID"></param>
150 /// <param name="remoteClient"></param>
151 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
152 {
153
154 }
155
156 /// <summary>
157 ///
158 /// </summary>
159 /// <param name="localID"></param>
160 /// <param name="packet"></param>
161 /// <param name="remoteClient"></param>
162 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
163 {
164
165 }
166
167 /// <summary>
168 ///
169 /// </summary>
170 /// <param name="localID"></param>
171 /// <param name="texture"></param>
172 /// <param name="remoteClient"></param>
173 public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
174 {
175
176 }
177
178 /// <summary>
179 ///
180 /// </summary>
181 /// <param name="localID"></param>
182 /// <param name="pos"></param>
183 /// <param name="remoteClient"></param>
184 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
185 {
186
187 }
188
189 /// <summary>
190 ///
191 /// </summary>
192 /// <param name="localID"></param>
193 /// <param name="rot"></param>
194 /// <param name="remoteClient"></param>
195 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
196 {
197
198 }
199
200 /// <summary>
201 ///
202 /// </summary>
203 /// <param name="localID"></param>
204 /// <param name="scale"></param>
205 /// <param name="remoteClient"></param>
206 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
207 {
208 }
209
210 /// <summary>
211 /// Sends prims to a client
212 /// </summary>
213 /// <param name="RemoteClient">Client to send to</param>
214 public void GetInitialPrims(IClientAPI RemoteClient)
215 {
216
217 }
218 }
219}
diff --git a/OpenSim/OpenSim.World/World.Scripting.cs b/OpenSim/OpenSim.World/World.Scripting.cs
deleted file mode 100644
index 49a0fce..0000000
--- a/OpenSim/OpenSim.World/World.Scripting.cs
+++ /dev/null
@@ -1,157 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5using System.Reflection;
6using OpenSim.Framework;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9using libsecondlife;
10
11namespace OpenSim.Region
12{
13 public partial class World
14 {
15 private Dictionary<string, IScriptEngine> scriptEngines = new Dictionary<string, IScriptEngine>();
16
17 /// <summary>
18 ///
19 /// </summary>
20 private void LoadScriptEngines()
21 {
22 this.LoadScriptPlugins();
23 }
24
25 /// <summary>
26 ///
27 /// </summary>
28 public void LoadScriptPlugins()
29 {
30 string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines");
31 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
32
33
34 for (int i = 0; i < pluginFiles.Length; i++)
35 {
36 this.AddPlugin(pluginFiles[i]);
37 }
38 }
39
40 /// <summary>
41 ///
42 /// </summary>
43 /// <param name="FileName"></param>
44 private void AddPlugin(string FileName)
45 {
46 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
47
48 foreach (Type pluginType in pluginAssembly.GetTypes())
49 {
50 if (pluginType.IsPublic)
51 {
52 if (!pluginType.IsAbstract)
53 {
54 Type typeInterface = pluginType.GetInterface("IScriptEngine", true);
55
56 if (typeInterface != null)
57 {
58 IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
59 plug.Init(this);
60 this.scriptEngines.Add(plug.GetName(), plug);
61
62 }
63
64 typeInterface = null;
65 }
66 }
67 }
68
69 pluginAssembly = null;
70 }
71
72 /// <summary>
73 ///
74 /// </summary>
75 /// <param name="scriptType"></param>
76 /// <param name="scriptName"></param>
77 /// <param name="script"></param>
78 /// <param name="ent"></param>
79 public void LoadScript(string scriptType, string scriptName, string script, Entity ent)
80 {
81 if(this.scriptEngines.ContainsKey(scriptType))
82 {
83 this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.localid);
84 }
85 }
86
87 #region IScriptAPI Methods
88
89 /// <summary>
90 ///
91 /// </summary>
92 /// <param name="localID"></param>
93 /// <returns></returns>
94 public OSVector3 GetEntityPosition(uint localID)
95 {
96 OSVector3 res = new OSVector3();
97 // Console.WriteLine("script- getting entity " + localID + " position");
98 foreach (Entity entity in this.Entities.Values)
99 {
100 if (entity.localid == localID)
101 {
102 res.X = entity.Pos.X;
103 res.Y = entity.Pos.Y;
104 res.Z = entity.Pos.Z;
105 }
106 }
107 return res;
108 }
109
110 /// <summary>
111 ///
112 /// </summary>
113 /// <param name="localID"></param>
114 /// <param name="x"></param>
115 /// <param name="y"></param>
116 /// <param name="z"></param>
117 public void SetEntityPosition(uint localID, float x , float y, float z)
118 {
119 foreach (Entity entity in this.Entities.Values)
120 {
121 if (entity.localid == localID && entity is Primitive)
122 {
123 LLVector3 pos = entity.Pos;
124 pos.X = x;
125 pos.Y = y;
126 Primitive prim = entity as Primitive;
127 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
128 //prim.UpdatePosition(pos);
129 // Console.WriteLine("script- setting entity " + localID + " positon");
130 }
131 }
132
133 }
134
135 /// <summary>
136 ///
137 /// </summary>
138 /// <returns></returns>
139 public uint GetRandomAvatarID()
140 {
141 //Console.WriteLine("script- getting random avatar id");
142 uint res = 0;
143 foreach (Entity entity in this.Entities.Values)
144 {
145 if (entity is Avatar)
146 {
147 res = entity.localid;
148 }
149 }
150 return res;
151 }
152
153 #endregion
154
155
156 }
157}
diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs
deleted file mode 100644
index c5c554d..0000000
--- a/OpenSim/OpenSim.World/World.cs
+++ /dev/null
@@ -1,634 +0,0 @@
1using System;
2using libsecondlife;
3using libsecondlife.Packets;
4using System.Collections.Generic;
5using System.Text;
6using System.Reflection;
7using System.IO;
8using System.Threading;
9using System.Timers;
10using OpenSim.Physics.Manager;
11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Types;
13using OpenSim.Framework.Inventory;
14using OpenSim.Framework;
15using OpenSim.Region.Scripting;
16using OpenSim.Terrain;
17using OpenGrid.Framework.Communications;
18using OpenSim.Region.Estate;
19
20
21namespace OpenSim.Region
22{
23 public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI
24 {
25 protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
26 protected Dictionary<libsecondlife.LLUUID, Avatar> Avatars;
27 protected Dictionary<libsecondlife.LLUUID, Primitive> Prims;
28 private PhysicsScene phyScene;
29 private float timeStep = 0.1f;
30 public ILocalStorage localStorage;
31 private Random Rand = new Random();
32 private uint _primCount = 702000;
33 private int storageCount;
34 private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers;
35 private Dictionary<string, ScriptFactory> m_scripts;
36 private Mutex updateLock;
37 public string m_datastore;
38 protected AuthenticateSessionsBase authenticateHandler;
39 protected RegionCommsHostBase regionCommsHost;
40 protected RegionServerCommsManager commsManager;
41
42 public ParcelManager parcelManager;
43 public EstateManager estateManager;
44
45 #region Properties
46 /// <summary>
47 ///
48 /// </summary>
49 public PhysicsScene PhysScene
50 {
51 set
52 {
53 this.phyScene = value;
54 }
55 get
56 {
57 return (this.phyScene);
58 }
59 }
60
61 #endregion
62
63 #region Constructors
64 /// <summary>
65 /// Creates a new World class, and a region to go with it.
66 /// </summary>
67 /// <param name="clientThreads">Dictionary to contain client threads</param>
68 /// <param name="regionHandle">Region Handle for this region</param>
69 /// <param name="regionName">Region Name for this region</param>
70 public World(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, RegionServerCommsManager commsMan)
71 {
72 try
73 {
74 updateLock = new Mutex(false);
75 this.authenticateHandler = authen;
76 this.commsManager = commsMan;
77 m_clientThreads = clientThreads;
78 m_regInfo = regInfo;
79 m_regionHandle = m_regInfo.RegionHandle;
80 m_regionName = m_regInfo.RegionName;
81 this.m_datastore = m_regInfo.DataStore;
82 this.RegisterRegionWithComms();
83
84 parcelManager = new ParcelManager(this, this.m_regInfo);
85 estateManager = new EstateManager(this, this.m_regInfo);
86
87 m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
88 m_scripts = new Dictionary<string, ScriptFactory>();
89
90 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating new entitities instance");
91 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
92 Avatars = new Dictionary<LLUUID, Avatar>();
93 Prims = new Dictionary<LLUUID, Primitive>();
94
95 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating LandMap");
96 TerrainManager = new TerrainManager(new SecondLife());
97 Terrain = new TerrainEngine();
98 Avatar.SetupTemplate("avatar-texture.dat");
99
100 Avatar.LoadAnims();
101
102 //this.SetDefaultScripts();
103 //this.LoadScriptEngines();
104
105
106 }
107 catch (Exception e)
108 {
109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "World.cs: Constructor failed with exception " + e.ToString());
110 }
111 }
112 #endregion
113
114 /// <summary>
115 ///
116 /// </summary>
117 public void StartTimer()
118 {
119 m_heartbeatTimer.Enabled = true;
120 m_heartbeatTimer.Interval = 100;
121 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
122 }
123
124
125 #region Update Methods
126
127
128 /// <summary>
129 /// Performs per-frame updates regularly
130 /// </summary>
131 /// <param name="sender"></param>
132 /// <param name="e"></param>
133 void Heartbeat(object sender, System.EventArgs e)
134 {
135 this.Update();
136 }
137
138 /// <summary>
139 /// Performs per-frame updates on the world, this should be the central world loop
140 /// </summary>
141 public override void Update()
142 {
143 updateLock.WaitOne();
144 try
145 {
146 if (this.phyScene.IsThreaded)
147 {
148 this.phyScene.GetResults();
149
150 }
151
152 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
153 {
154 Entities[UUID].addForces();
155 }
156
157 lock (this.m_syncRoot)
158 {
159 this.phyScene.Simulate(timeStep);
160 }
161
162 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
163 {
164 Entities[UUID].update();
165 }
166
167 foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values)
168 {
169 scriptHandler.OnFrame();
170 }
171 foreach (IScriptEngine scripteng in this.scriptEngines.Values)
172 {
173 scripteng.OnFrame();
174 }
175 //backup world data
176 this.storageCount++;
177 if (storageCount > 1200) //set to how often you want to backup
178 {
179 this.Backup();
180 storageCount = 0;
181 }
182 }
183 catch (Exception e)
184 {
185 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: Update() - Failed with exception " + e.ToString());
186 }
187 updateLock.ReleaseMutex();
188 }
189
190 /// <summary>
191 ///
192 /// </summary>
193 /// <returns></returns>
194 public bool Backup()
195 {
196 try
197 {
198 // Terrain backup routines
199 if (Terrain.tainted > 0)
200 {
201 Terrain.tainted = 0;
202 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain tainted, saving.");
203 localStorage.SaveMap(Terrain.getHeights1D());
204 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain saved, informing Physics.");
205 lock (this.m_syncRoot)
206 {
207 phyScene.SetTerrain(Terrain.getHeights1D());
208 }
209 }
210
211 // Primitive backup routines
212 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Backing up Primitives");
213 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
214 {
215 Entities[UUID].BackUp();
216 }
217
218 //Parcel backup routines
219 ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
220 int i = 0;
221 foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values)
222 {
223 parcels[i] = parcel.parcelData;
224 i++;
225 }
226 localStorage.SaveParcels(parcels);
227
228 // Backup successful
229 return true;
230 }
231 catch (Exception e)
232 {
233 // Backup failed
234 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString());
235 return false;
236 }
237 }
238 #endregion
239
240 #region Setup Methods
241 /// <summary>
242 /// Loads a new storage subsystem from a named library
243 /// </summary>
244 /// <param name="dllName">Storage Library</param>
245 /// <returns>Successful or not</returns>
246 public bool LoadStorageDLL(string dllName)
247 {
248 try
249 {
250 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
251 ILocalStorage store = null;
252
253 foreach (Type pluginType in pluginAssembly.GetTypes())
254 {
255 if (pluginType.IsPublic)
256 {
257 if (!pluginType.IsAbstract)
258 {
259 Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
260
261 if (typeInterface != null)
262 {
263 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
264 store = plug;
265
266 store.Initialise(this.m_datastore);
267 break;
268 }
269
270 typeInterface = null;
271 }
272 }
273 }
274 pluginAssembly = null;
275 this.localStorage = store;
276 return (store == null);
277 }
278 catch (Exception e)
279 {
280 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
281 return false;
282 }
283 }
284
285 #endregion
286
287
288 #region Regenerate Terrain
289
290 /// <summary>
291 /// Rebuilds the terrain using a procedural algorithm
292 /// </summary>
293 public void RegenerateTerrain()
294 {
295 try
296 {
297 Terrain.hills();
298
299 lock (this.m_syncRoot)
300 {
301 this.phyScene.SetTerrain(Terrain.getHeights1D());
302 }
303 this.localStorage.SaveMap(this.Terrain.getHeights1D());
304
305 foreach (IClientAPI client in m_clientThreads.Values)
306 {
307 this.SendLayerData(client);
308 }
309
310 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
311 {
312 Entities[UUID].LandRenegerated();
313 }
314 }
315 catch (Exception e)
316 {
317 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
318 }
319 }
320
321 /// <summary>
322 /// Rebuilds the terrain using a 2D float array
323 /// </summary>
324 /// <param name="newMap">256,256 float array containing heights</param>
325 public void RegenerateTerrain(float[,] newMap)
326 {
327 try
328 {
329 this.Terrain.setHeights2D(newMap);
330 lock (this.m_syncRoot)
331 {
332 this.phyScene.SetTerrain(this.Terrain.getHeights1D());
333 }
334 this.localStorage.SaveMap(this.Terrain.getHeights1D());
335
336 foreach (IClientAPI client in m_clientThreads.Values)
337 {
338 this.SendLayerData(client);
339 }
340
341 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
342 {
343 Entities[UUID].LandRenegerated();
344 }
345 }
346 catch (Exception e)
347 {
348 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
349 }
350 }
351
352 /// <summary>
353 /// Rebuilds the terrain assuming changes occured at a specified point[?]
354 /// </summary>
355 /// <param name="changes">???</param>
356 /// <param name="pointx">???</param>
357 /// <param name="pointy">???</param>
358 public void RegenerateTerrain(bool changes, int pointx, int pointy)
359 {
360 try
361 {
362 if (changes)
363 {
364 /* Dont save here, rely on tainting system instead */
365
366 foreach (IClientAPI client in m_clientThreads.Values)
367 {
368 this.SendLayerData(pointx, pointy, client);
369 }
370 }
371 }
372 catch (Exception e)
373 {
374 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString());
375 }
376 }
377
378 #endregion
379
380 #region Load Terrain
381 /// <summary>
382 /// Loads the World heightmap
383 /// </summary>
384 public override void LoadWorldMap()
385 {
386 try
387 {
388 float[] map = this.localStorage.LoadWorld();
389 if (map == null)
390 {
391 Console.WriteLine("creating new terrain");
392 this.Terrain.hills();
393
394 this.localStorage.SaveMap(this.Terrain.getHeights1D());
395 }
396 else
397 {
398 this.Terrain.setHeights1D(map);
399 }
400 }
401 catch (Exception e)
402 {
403 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadWorldMap() - Failed with exception " + e.ToString());
404 }
405 }
406 #endregion
407
408 #region Primitives Methods
409
410
411 /// <summary>
412 /// Loads the World's objects
413 /// </summary>
414 public void LoadPrimsFromStorage()
415 {
416 try
417 {
418 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: LoadPrimsFromStorage() - Loading primitives");
419 this.localStorage.LoadPrimitives(this);
420 }
421 catch (Exception e)
422 {
423 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString());
424 }
425 }
426
427 /// <summary>
428 /// Loads a specific object from storage
429 /// </summary>
430 /// <param name="prim">The object to load</param>
431 public void PrimFromStorage(PrimData prim)
432 {
433
434 }
435
436 /// <summary>
437 ///
438 /// </summary>
439 /// <param name="addPacket"></param>
440 /// <param name="agentClient"></param>
441 public void AddNewPrim(Packet addPacket, IClientAPI agentClient)
442 {
443 AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId);
444 }
445
446 /// <summary>
447 ///
448 /// </summary>
449 /// <param name="addPacket"></param>
450 /// <param name="ownerID"></param>
451 public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
452 {
453
454 }
455
456 #endregion
457
458 #region Add/Remove Avatar Methods
459
460 /// <summary>
461 ///
462 /// </summary>
463 /// <param name="remoteClient"></param
464 /// <param name="agentID"></param>
465 /// <param name="child"></param>
466 public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child)
467 {
468 remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
469 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
470 remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
471 remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours);
472
473 Avatar newAvatar = null;
474 try
475 {
476 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
477 newAvatar = new Avatar(remoteClient, this, m_clientThreads, this.m_regInfo);
478 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
479 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
480
481 //newAvatar.SendRegionHandshake();
482 this.estateManager.sendRegionHandshake(remoteClient);
483
484 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
485 lock (this.m_syncRoot)
486 {
487 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
488 }
489
490 lock (Entities)
491 {
492 if (!Entities.ContainsKey(agentID))
493 {
494 this.Entities.Add(agentID, newAvatar);
495 }
496 else
497 {
498 Entities[agentID] = newAvatar;
499 }
500 }
501 lock (Avatars)
502 {
503 if (Avatars.ContainsKey(agentID))
504 {
505 Avatars[agentID] = newAvatar;
506 }
507 else
508 {
509 this.Avatars.Add(agentID, newAvatar);
510 }
511 }
512 }
513 catch (Exception e)
514 {
515 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString());
516 }
517 return;
518 }
519
520 /// <summary>
521 ///
522 /// </summary>
523 protected void InformClientOfNeighbours(IClientAPI remoteClient)
524 {
525 // Console.WriteLine("informing client of neighbouring regions");
526 List<RegionInfo> neighbours = this.commsManager.RequestNeighbours(this.m_regInfo);
527
528 //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
529 if (neighbours != null)
530 {
531 for (int i = 0; i < neighbours.Count; i++)
532 {
533 // Console.WriteLine("sending neighbours data");
534 AgentCircuitData agent = remoteClient.RequestClientInfo();
535 agent.BaseFolder = LLUUID.Zero;
536 agent.InventoryFolder = LLUUID.Zero;
537 agent.startpos = new LLVector3(128, 128, 70);
538 this.commsManager.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
539 remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
540 }
541 }
542 }
543
544 /// <summary>
545 ///
546 /// </summary>
547 /// <param name="agentID"></param>
548 public override void RemoveAvatar(LLUUID agentID)
549 {
550 return;
551 }
552 #endregion
553
554 #region Request Avatars List Methods
555 //The idea is to have a group of method that return a list of avatars meeting some requirement
556 // ie it could be all Avatars within a certain range of the calling prim/avatar.
557
558 /// <summary>
559 /// Request a List of all Avatars in this World
560 /// </summary>
561 /// <returns></returns>
562 public List<Avatar> RequestAvatarList()
563 {
564 List<Avatar> result = new List<Avatar>();
565
566 foreach (Avatar avatar in Avatars.Values)
567 {
568 result.Add(avatar);
569 }
570
571 return result;
572 }
573 #endregion
574
575 #region ShutDown
576 /// <summary>
577 /// Tidy before shutdown
578 /// </summary>
579 public override void Close()
580 {
581 try
582 {
583 this.localStorage.ShutDown();
584 }
585 catch (Exception e)
586 {
587 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
588 }
589 }
590 #endregion
591
592 #region RegionCommsHost
593
594 /// <summary>
595 ///
596 /// </summary>
597 public void RegisterRegionWithComms()
598 {
599 this.regionCommsHost = this.commsManager.RegisterRegion(this.m_regInfo);
600 if (this.regionCommsHost != null)
601 {
602 this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection);
603 }
604 }
605
606 /// <summary>
607 ///
608 /// </summary>
609 /// <param name="regionHandle"></param>
610 /// <param name="agent"></param>
611 public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
612 {
613 // Console.WriteLine("World.cs - add new user connection");
614 //should just check that its meant for this region
615 if (regionHandle == this.m_regInfo.RegionHandle)
616 {
617 this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
618 }
619 }
620
621 #endregion
622
623 /// <summary>
624 ///
625 /// </summary>
626 /// <param name="px"></param>
627 /// <param name="py"></param>
628 /// <param name="RemoteClient"></param>
629 public override void SendLayerData(int px, int py, IClientAPI RemoteClient)
630 {
631 RemoteClient.SendLayerData( Terrain.getHeights1D() );
632 }
633 }
634}
diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs
deleted file mode 100644
index 727d1e8..0000000
--- a/OpenSim/OpenSim.World/WorldBase.cs
+++ /dev/null
@@ -1,111 +0,0 @@
1using System;
2using libsecondlife;
3using libsecondlife.Packets;
4using System.Collections.Generic;
5using System.Text;
6using System.Reflection;
7using System.IO;
8using System.Threading;
9using OpenSim.Physics.Manager;
10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types;
12using OpenSim.Framework.Inventory;
13using OpenSim.Region.Scripting;
14using OpenSim.Terrain;
15
16namespace OpenSim.Region
17{
18 public abstract class WorldBase : IWorld
19 {
20 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
21 protected Dictionary<uint, IClientAPI> m_clientThreads;
22 protected ulong m_regionHandle;
23 protected string m_regionName;
24 protected RegionInfo m_regInfo;
25
26 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
27 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine
28 protected object m_syncRoot = new object();
29 private uint m_nextLocalId = 8880000;
30
31 #region Update Methods
32 /// <summary>
33 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
34 /// </summary>
35 public abstract void Update();
36
37 #endregion
38
39 #region Terrain Methods
40
41 /// <summary>
42 /// Loads the World heightmap
43 /// </summary>
44 public abstract void LoadWorldMap();
45
46 /// <summary>
47 /// Send the region heightmap to the client
48 /// </summary>
49 /// <param name="RemoteClient">Client to send to</param>
50 public virtual void SendLayerData(IClientAPI RemoteClient)
51 {
52 RemoteClient.SendLayerData(Terrain.getHeights1D());
53 }
54
55 /// <summary>
56 /// Sends a specified patch to a client
57 /// </summary>
58 /// <param name="px">Patch coordinate (x) 0..16</param>
59 /// <param name="py">Patch coordinate (y) 0..16</param>
60 /// <param name="RemoteClient">The client to send to</param>
61 public abstract void SendLayerData(int px, int py, IClientAPI RemoteClient);
62
63 #endregion
64
65 #region Add/Remove Agent/Avatar
66 /// <summary>
67 ///
68 /// </summary>
69 /// <param name="remoteClient"></param>
70 /// <param name="agentID"></param>
71 /// <param name="child"></param>
72 public abstract void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child);
73
74 /// <summary>
75 ///
76 /// </summary>
77 /// <param name="agentID"></param>
78 public abstract void RemoveAvatar(LLUUID agentID);
79
80 #endregion
81
82 /// <summary>
83 ///
84 /// </summary>
85 /// <returns></returns>
86 public virtual RegionInfo RegionInfo
87 {
88 get { return null; }
89 }
90
91 public object SyncRoot
92 {
93 get { return m_syncRoot; }
94 }
95
96 public uint NextLocalId
97 {
98 get { return m_nextLocalId++; }
99 }
100
101 #region Shutdown
102 /// <summary>
103 /// Tidy before shutdown
104 /// </summary>
105 public abstract void Close();
106
107 #endregion
108
109
110 }
111}
diff --git a/OpenSim/OpenSim.World/scripting/IScriptContext.cs b/OpenSim/OpenSim.World/scripting/IScriptContext.cs
deleted file mode 100644
index 3dc7dab..0000000
--- a/OpenSim/OpenSim.World/scripting/IScriptContext.cs
+++ /dev/null
@@ -1,13 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Scripting
7{
8 public interface IScriptContext
9 {
10 IScriptEntity Entity { get; }
11 bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar);
12 }
13}
diff --git a/OpenSim/OpenSim.World/scripting/IScriptEntity.cs b/OpenSim/OpenSim.World/scripting/IScriptEntity.cs
deleted file mode 100644
index abb789f..0000000
--- a/OpenSim/OpenSim.World/scripting/IScriptEntity.cs
+++ /dev/null
@@ -1,19 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Scripting
7{
8 public interface IScriptReadonlyEntity
9 {
10 LLVector3 Pos { get; }
11 string Name { get; }
12 }
13
14 public interface IScriptEntity
15 {
16 LLVector3 Pos { get; set; }
17 string Name { get; }
18 }
19}
diff --git a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs b/OpenSim/OpenSim.World/scripting/IScriptHandler.cs
deleted file mode 100644
index 6644649..0000000
--- a/OpenSim/OpenSim.World/scripting/IScriptHandler.cs
+++ /dev/null
@@ -1,98 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Physics.Manager;
6using OpenSim.Region;
7using Avatar=OpenSim.Region.Avatar;
8using Primitive = OpenSim.Region.Primitive;
9
10namespace OpenSim.Region.Scripting
11{
12 public delegate void ScriptEventHandler(IScriptContext context);
13
14 public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity
15 {
16 private World m_world;
17 private Script m_script;
18 private Entity m_entity;
19
20 public LLUUID ScriptId
21 {
22 get
23 {
24 return m_script.ScriptId;
25 }
26 }
27
28 public void OnFrame()
29 {
30 m_script.OnFrame(this);
31 }
32
33 public ScriptHandler(Script script, Entity entity, World world)
34 {
35 m_script = script;
36 m_entity = entity;
37 m_world = world;
38 }
39
40 #region IScriptContext Members
41
42 IScriptEntity IScriptContext.Entity
43 {
44 get
45 {
46 return this;
47 }
48 }
49
50 bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar)
51 {
52 foreach (Entity entity in m_world.Entities.Values )
53 {
54 if( entity is Avatar )
55 {
56 avatar = entity;
57 return true;
58 }
59 }
60
61 avatar = null;
62 return false;
63 }
64
65 #endregion
66
67 #region IScriptEntity and IScriptReadonlyEntity Members
68
69 public string Name
70 {
71 get
72 {
73 return m_entity.Name;
74 }
75 }
76
77 public LLVector3 Pos
78 {
79 get
80 {
81 return m_entity.Pos;
82 }
83
84 set
85 {
86 if (m_entity is Primitive)
87 {
88 Primitive prim = m_entity as Primitive;
89 // Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
90 // prim.UpdatePosition( value );
91 }
92 }
93 }
94
95 #endregion
96 }
97
98}
diff --git a/OpenSim/OpenSim.World/scripting/Script.cs b/OpenSim/OpenSim.World/scripting/Script.cs
deleted file mode 100644
index c0c2c0c..0000000
--- a/OpenSim/OpenSim.World/scripting/Script.cs
+++ /dev/null
@@ -1,26 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Scripting
7{
8 public class Script
9 {
10 private LLUUID m_scriptId;
11 public virtual LLUUID ScriptId
12 {
13 get
14 {
15 return m_scriptId;
16 }
17 }
18
19 public Script( LLUUID scriptId )
20 {
21 m_scriptId = scriptId;
22 }
23
24 public ScriptEventHandler OnFrame;
25 }
26}
diff --git a/OpenSim/OpenSim.World/scripting/ScriptFactory.cs b/OpenSim/OpenSim.World/scripting/ScriptFactory.cs
deleted file mode 100644
index 6f2e5f0..0000000
--- a/OpenSim/OpenSim.World/scripting/ScriptFactory.cs
+++ /dev/null
@@ -1,8 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Scripting
6{
7 public delegate Script ScriptFactory();
8}
diff --git a/OpenSim/OpenSim.World/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/OpenSim.World/scripting/Scripts/FollowRandomAvatar.cs
deleted file mode 100644
index 9c0146b..0000000
--- a/OpenSim/OpenSim.World/scripting/Scripts/FollowRandomAvatar.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Scripting
7{
8 public class FollowRandomAvatar : Script
9 {
10 public FollowRandomAvatar()
11 : base(LLUUID.Random())
12 {
13 OnFrame += MyOnFrame;
14 }
15
16 private void MyOnFrame(IScriptContext context)
17 {
18 LLVector3 pos = context.Entity.Pos;
19
20 IScriptReadonlyEntity avatar;
21
22 if (context.TryGetRandomAvatar(out avatar))
23 {
24 LLVector3 avatarPos = avatar.Pos;
25
26 float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2;
27 float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2;
28
29 LLVector3 newPos = new LLVector3(x, y, pos.Z);
30
31 context.Entity.Pos = newPos;
32 }
33 }
34 }
35
36
37}
diff --git a/OpenSim/OpenSim.World/types/Mesh.cs b/OpenSim/OpenSim.World/types/Mesh.cs
deleted file mode 100644
index ccc55eb..0000000
--- a/OpenSim/OpenSim.World/types/Mesh.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.types
6{
7 // TODO: This will need some performance tuning no doubt.
8 public class Mesh
9 {
10 public List<Triangle> mesh;
11
12 /// <summary>
13 ///
14 /// </summary>
15 public Mesh()
16 {
17 mesh = new List<Triangle>();
18 }
19
20 /// <summary>
21 ///
22 /// </summary>
23 /// <param name="tri"></param>
24 public void AddTri(Triangle tri)
25 {
26 mesh.Add(tri);
27 }
28
29 /// <summary>
30 ///
31 /// </summary>
32 /// <param name="a"></param>
33 /// <param name="b"></param>
34 /// <returns></returns>
35 public static Mesh operator +(Mesh a, Mesh b)
36 {
37 a.mesh.AddRange(b.mesh);
38 return a;
39 }
40 }
41}
diff --git a/OpenSim/OpenSim.World/types/Triangle.cs b/OpenSim/OpenSim.World/types/Triangle.cs
deleted file mode 100644
index 488cc21..0000000
--- a/OpenSim/OpenSim.World/types/Triangle.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Axiom.MathLib;
5
6namespace OpenSim.Region.types
7{
8 public class Triangle
9 {
10 Vector3 a;
11 Vector3 b;
12 Vector3 c;
13
14 /// <summary>
15 ///
16 /// </summary>
17 public Triangle()
18 {
19 a = new Vector3();
20 b = new Vector3();
21 c = new Vector3();
22 }
23
24 /// <summary>
25 ///
26 /// </summary>
27 /// <param name="A"></param>
28 /// <param name="B"></param>
29 /// <param name="C"></param>
30 public Triangle(Vector3 A, Vector3 B, Vector3 C)
31 {
32 a = A;
33 b = B;
34 c = C;
35 }
36 }
37}
diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj
index b5897aa..2308c99 100644
--- a/OpenSim/OpenSim/OpenSim.csproj
+++ b/OpenSim/OpenSim/OpenSim.csproj
@@ -110,7 +110,7 @@
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 111 <Private>False</Private>
112 </ProjectReference> 112 </ProjectReference>
113 <ProjectReference Include="..\OpenSim.World\OpenSim.Region.csproj"> 113 <ProjectReference Include="..\OpenSim.Region\OpenSim.Region.csproj">
114 <Name>OpenSim.Region</Name> 114 <Name>OpenSim.Region</Name>
115 <Project>{196916AF-0000-0000-0000-000000000000}</Project> 115 <Project>{196916AF-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
diff --git a/prebuild.xml b/prebuild.xml
index 62e1229..b878263 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -470,7 +470,7 @@
470 </Project> 470 </Project>
471 471
472 472
473 <Project name="OpenSim.Region" path="OpenSim/OpenSim.World" type="Library"> 473 <Project name="OpenSim.Region" path="OpenSim/OpenSim.Region" type="Library">
474 <Configuration name="Debug"> 474 <Configuration name="Debug">
475 <Options> 475 <Options>
476 <OutputPath>../../bin/</OutputPath> 476 <OutputPath>../../bin/</OutputPath>