aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/OpenSim.Region.Environment.csproj6
-rw-r--r--OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build2
-rw-r--r--OpenSim/Region/Environment/Scenes/Entity.cs85
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs133
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs532
-rw-r--r--OpenSim/Region/Environment/Scenes/PrimitiveOld.cs582
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs131
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs80
11 files changed, 943 insertions, 630 deletions
diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
index 428f381..9e9405e 100644
--- a/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
+++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj
@@ -156,12 +156,18 @@
156 <Compile Include="Scenes\Entity.cs"> 156 <Compile Include="Scenes\Entity.cs">
157 <SubType>Code</SubType> 157 <SubType>Code</SubType>
158 </Compile> 158 </Compile>
159 <Compile Include="Scenes\EntityBase.cs">
160 <SubType>Code</SubType>
161 </Compile>
159 <Compile Include="Scenes\IScenePresenceBody.cs"> 162 <Compile Include="Scenes\IScenePresenceBody.cs">
160 <SubType>Code</SubType> 163 <SubType>Code</SubType>
161 </Compile> 164 </Compile>
162 <Compile Include="Scenes\Primitive.cs"> 165 <Compile Include="Scenes\Primitive.cs">
163 <SubType>Code</SubType> 166 <SubType>Code</SubType>
164 </Compile> 167 </Compile>
168 <Compile Include="Scenes\PrimitiveOld.cs">
169 <SubType>Code</SubType>
170 </Compile>
165 <Compile Include="Scenes\Scene.cs"> 171 <Compile Include="Scenes\Scene.cs">
166 <SubType>Code</SubType> 172 <SubType>Code</SubType>
167 </Compile> 173 </Compile>
diff --git a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
index 2fa5e76..d4b163e 100644
--- a/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
+++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.dll.build
@@ -15,8 +15,10 @@
15 <include name="ParcelManager.cs" /> 15 <include name="ParcelManager.cs" />
16 <include name="RegionManager.cs" /> 16 <include name="RegionManager.cs" />
17 <include name="Scenes/Entity.cs" /> 17 <include name="Scenes/Entity.cs" />
18 <include name="Scenes/EntityBase.cs" />
18 <include name="Scenes/IScenePresenceBody.cs" /> 19 <include name="Scenes/IScenePresenceBody.cs" />
19 <include name="Scenes/Primitive.cs" /> 20 <include name="Scenes/Primitive.cs" />
21 <include name="Scenes/PrimitiveOld.cs" />
20 <include name="Scenes/Scene.cs" /> 22 <include name="Scenes/Scene.cs" />
21 <include name="Scenes/Scene.PacketHandlers.cs" /> 23 <include name="Scenes/Scene.PacketHandlers.cs" />
22 <include name="Scenes/SceneBase.cs" /> 24 <include name="Scenes/SceneBase.cs" />
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index db5070d..9603f7f 100644
--- a/OpenSim/Region/Environment/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -34,29 +34,14 @@ using libsecondlife;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public abstract class Entity 37 public abstract class Entity :EntityBase //will be phased out
38 { 38 {
39 public libsecondlife.LLUUID uuid;
40 public Quaternion rotation;
41 protected List<Entity> children;
42
43 protected PhysicsActor _physActor; 39 protected PhysicsActor _physActor;
44 protected Scene m_world;
45 protected string m_name;
46 40
47 /// <summary> 41 /// <summary>
48 /// 42 ///
49 /// </summary> 43 /// </summary>
50 public virtual string Name 44 public override LLVector3 Pos
51 {
52 get { return m_name; }
53 }
54
55 protected LLVector3 m_pos;
56 /// <summary>
57 ///
58 /// </summary>
59 public virtual LLVector3 Pos
60 { 45 {
61 get 46 get
62 { 47 {
@@ -91,12 +76,11 @@ namespace OpenSim.Region.Environment.Scenes
91 } 76 }
92 } 77 }
93 78
94 public LLVector3 velocity; 79
95
96 /// <summary> 80 /// <summary>
97 /// 81 ///
98 /// </summary> 82 /// </summary>
99 public virtual LLVector3 Velocity 83 public override LLVector3 Velocity
100 { 84 {
101 get 85 get
102 { 86 {
@@ -130,64 +114,5 @@ namespace OpenSim.Region.Environment.Scenes
130 velocity = value; 114 velocity = value;
131 } 115 }
132 } 116 }
133
134 protected uint m_localId;
135
136 public uint LocalId
137 {
138 get { return m_localId; }
139 }
140
141 /// <summary>
142 /// Creates a new Entity (should not occur on it's own)
143 /// </summary>
144 public Entity()
145 {
146 uuid = new libsecondlife.LLUUID();
147
148 m_pos = new LLVector3();
149 velocity = new LLVector3();
150 rotation = new Quaternion();
151 m_name = "(basic entity)";
152 children = new List<Entity>();
153 }
154
155 /// <summary>
156 ///
157 /// </summary>
158 public virtual void updateMovement()
159 {
160 foreach (Entity child in children)
161 {
162 child.updateMovement();
163 }
164 }
165
166 /// <summary>
167 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
168 /// </summary>
169 public virtual void update() {
170 // Do any per-frame updates needed that are applicable to every type of entity
171 foreach (Entity child in children)
172 {
173 child.update();
174 }
175 }
176
177 /// <summary>
178 /// Called at a set interval to inform entities that they should back themsleves up to the DB
179 /// </summary>
180 public virtual void BackUp()
181 {
182
183 }
184
185 /// <summary>
186 /// Infoms the entity that the land (heightmap) has changed
187 /// </summary>
188 public virtual void LandRenegerated()
189 {
190
191 }
192 } 117 }
193} 118}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
new file mode 100644
index 0000000..edd72c5
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -0,0 +1,133 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Axiom.MathLib;
5using libsecondlife;
6
7namespace OpenSim.Region.Environment.Scenes
8{
9 public abstract class EntityBase
10 {
11 public libsecondlife.LLUUID uuid;
12
13 protected List<EntityBase> children;
14
15 protected Scene m_world;
16 protected string m_name;
17
18 /// <summary>
19 ///
20 /// </summary>
21 public virtual string Name
22 {
23 get { return m_name; }
24 }
25
26 protected LLVector3 m_pos;
27 /// <summary>
28 ///
29 /// </summary>
30 public virtual LLVector3 Pos
31 {
32 get
33 {
34 return m_pos;
35 }
36 set
37 {
38 m_pos = value;
39 }
40 }
41
42 public LLVector3 velocity;
43
44 /// <summary>
45 ///
46 /// </summary>
47 public virtual LLVector3 Velocity
48 {
49 get
50 {
51 return velocity;
52 }
53 set
54 {
55 velocity = value;
56 }
57 }
58
59 public Quaternion _rotation;
60
61 public virtual Quaternion rotation
62 {
63 get
64 {
65 return _rotation;
66 }
67 set
68 {
69 _rotation = value;
70 }
71 }
72
73 protected uint m_localId;
74
75 public uint LocalId
76 {
77 get { return m_localId; }
78 }
79
80 /// <summary>
81 /// Creates a new Entity (should not occur on it's own)
82 /// </summary>
83 public EntityBase()
84 {
85 uuid = new libsecondlife.LLUUID();
86
87 m_pos = new LLVector3();
88 velocity = new LLVector3();
89 rotation = new Quaternion();
90 m_name = "(basic entity)";
91 children = new List<EntityBase>();
92 }
93
94 /// <summary>
95 ///
96 /// </summary>
97 public virtual void updateMovement()
98 {
99 foreach (EntityBase child in children)
100 {
101 child.updateMovement();
102 }
103 }
104
105 /// <summary>
106 /// Performs any updates that need to be done at each frame. This function is overridable from it's children.
107 /// </summary>
108 public virtual void update()
109 {
110 // Do any per-frame updates needed that are applicable to every type of entity
111 foreach (EntityBase child in children)
112 {
113 child.update();
114 }
115 }
116
117 /// <summary>
118 /// Called at a set interval to inform entities that they should back themsleves up to the DB
119 /// </summary>
120 public virtual void BackUp()
121 {
122
123 }
124
125 /// <summary>
126 /// Infoms the entity that the land (heightmap) has changed
127 /// </summary>
128 public virtual void LandRenegerated()
129 {
130
131 }
132 }
133}
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 0f649b2..497196d 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -1,31 +1,3 @@
1
2/*
3* Copyright (c) Contributors, http://www.openmetaverse.org/
4* See CONTRIBUTORS.TXT for a full list of copyright holders.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the OpenSim Project nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*
28*/
29using System; 1using System;
30using System.Collections.Generic; 2using System.Collections.Generic;
31using System.Text; 3using System.Text;
@@ -38,175 +10,66 @@ using OpenSim.Framework.Inventory;
38 10
39namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
40{ 12{
41 public class Primitive : Entity 13 public class Primitive : EntityBase
42 { 14 {
43 internal PrimData primData; 15 private const uint FULL_MASK_PERMISSIONS = 2147483647;
16
44 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 17 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
45 // private Dictionary<uint, IClientAPI> m_clientThreads;
46 private ulong m_regionHandle; 18 private ulong m_regionHandle;
47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48 private bool physicsEnabled = false;
49 private byte updateFlag = 0; 19 private byte updateFlag = 0;
50 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; 20 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
51 21
52 private Dictionary<LLUUID, InventoryItem> inventoryItems; 22 private Dictionary<LLUUID, InventoryItem> inventoryItems;
53 23
54 #region Properties 24 public LLUUID OwnerID;
25 public Int32 CreationDate;
26 public uint OwnerMask = FULL_MASK_PERMISSIONS;
27 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
28 public uint GroupMask = FULL_MASK_PERMISSIONS;
29 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
30 public uint BaseMask = FULL_MASK_PERMISSIONS;
55 31
56 public LLVector3 Scale 32 private PrimitiveBaseShape m_Shape;
57 {
58 set
59 {
60 this.primData.Scale = value;
61 //this.dirtyFlag = true;
62 }
63 get
64 {
65 return this.primData.Scale;
66 }
67 }
68 33
69 public PhysicsActor PhysActor 34 private SceneObject m_RootParent;
70 { 35 private bool isRootPrim;
71 set 36 private EntityBase m_Parent;
72 {
73 this._physActor = value;
74 }
75 }
76 37
77 public override LLVector3 Pos 38 public override LLVector3 Pos
78 { 39 {
79 get 40 get
80 { 41 {
81 return base.Pos; 42 if (isRootPrim)
43 {
44 return this.m_pos + m_Parent.Pos;
45 }
46 else
47 {
48 return this.m_pos;
49 }
82 } 50 }
83 set 51 set
84 { 52 {
85 base.Pos = value; 53 this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position
86 } 54 }
87 }
88 #endregion
89 55
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="clientThreads"></param>
94 /// <param name="regionHandle"></param>
95 /// <param name="world"></param>
96 public Primitive( ulong regionHandle, Scene world)
97 {
98 // m_clientThreads = clientThreads;
99 m_regionHandle = regionHandle;
100 m_world = world;
101 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
102 } 56 }
103 57
104 /// <summary> 58 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject)
105 ///
106 /// </summary>
107 /// <param name="regionHandle"></param>
108 /// <param name="world"></param>
109 /// <param name="addPacket"></param>
110 /// <param name="ownerID"></param>
111 /// <param name="localID"></param>
112 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
113 { 59 {
114 // m_clientThreads = clientThreads;
115 m_regionHandle = regionHandle; 60 m_regionHandle = regionHandle;
116 m_world = world; 61 m_world = world;
117 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 62 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
63 this.m_Parent = parent;
64 this.isRootPrim = isRoot;
65 this.m_RootParent = rootObject;
118 this.CreateFromPacket(addPacket, ownerID, localID); 66 this.CreateFromPacket(addPacket, ownerID, localID);
119 } 67 }
120 68
121 /// <summary> 69 /// <summary>
122 /// 70 ///
123 /// </summary> 71 /// </summary>
124 /// <param name="clientThreads"></param> 72 public override void update()
125 /// <param name="regionHandle"></param>
126 /// <param name="world"></param>
127 /// <param name="owner"></param>
128 /// <param name="fullID"></param>
129 /// <param name="localID"></param>
130 public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID)
131 {
132 // m_clientThreads = clientThreads;
133 m_regionHandle = regionHandle;
134 m_world = world;
135 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
136 this.primData = new PrimData();
137 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
138 this.primData.OwnerID = owner;
139 this.primData.FullID = this.uuid = fullID;
140 this.primData.LocalID = m_localId = localID;
141 }
142
143 /// <summary>
144 /// Constructor to create a default cube
145 /// </summary>
146 /// <param name="clientThreads"></param>
147 /// <param name="regionHandle"></param>
148 /// <param name="world"></param>
149 /// <param name="owner"></param>
150 /// <param name="localID"></param>
151 /// <param name="position"></param>
152 public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position)
153 {
154 //m_clientThreads = clientThreads;
155 m_regionHandle = regionHandle;
156 m_world = world;
157 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
158 this.primData = PrimData.DefaultCube();
159 this.primData.OwnerID = owner;
160 this.primData.LocalID = m_localId = localID;
161 this.Pos = this.primData.Position = position;
162
163 this.updateFlag = 1;
164 }
165
166 /// <summary>
167 ///
168 /// </summary>
169 /// <returns></returns>
170 public byte[] GetByteArray()
171 {
172 byte[] result = null;
173 List<byte[]> dataArrays = new List<byte[]>();
174 dataArrays.Add(primData.ToBytes());
175 foreach (Entity child in children)
176 {
177 if (child is OpenSim.Region.Environment.Scenes.Primitive)
178 {
179 dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray());
180 }
181 }
182 byte[] primstart = Helpers.StringToField("<Prim>");
183 byte[] primend = Helpers.StringToField("</Prim>");
184 int totalLength = primstart.Length + primend.Length;
185 for (int i = 0; i < dataArrays.Count; i++)
186 {
187 totalLength += dataArrays[i].Length;
188 }
189
190 result = new byte[totalLength];
191 int arraypos = 0;
192 Array.Copy(primstart, 0, result, 0, primstart.Length);
193 arraypos += primstart.Length;
194 for (int i = 0; i < dataArrays.Count; i++)
195 {
196 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
197 arraypos += dataArrays[i].Length;
198 }
199 Array.Copy(primend, 0, result, arraypos, primend.Length);
200
201 return result;
202 }
203
204 #region Overridden Methods
205
206 /// <summary>
207 ///
208 /// </summary>
209 public override void update()
210 { 73 {
211 if (this.updateFlag == 1) // is a new prim just been created/reloaded 74 if (this.updateFlag == 1) // is a new prim just been created/reloaded
212 { 75 {
@@ -218,112 +81,53 @@ namespace OpenSim.Region.Environment.Scenes
218 this.SendTerseUpdateToALLClients(); 81 this.SendTerseUpdateToALLClients();
219 this.updateFlag = 0; 82 this.updateFlag = 0;
220 } 83 }
221 }
222
223 /// <summary>
224 ///
225 /// </summary>
226 public override void BackUp()
227 {
228 84
229 } 85 base.update();
230
231 #endregion
232
233 #region Packet handlers
234
235 /// <summary>
236 ///
237 /// </summary>
238 /// <param name="pos"></param>
239 public void UpdatePosition(LLVector3 pos)
240 {
241 this.Pos = new LLVector3(pos.X, pos.Y, pos.Z);
242 this.updateFlag = 2;
243 } 86 }
244 87
245 /// <summary> 88 /// <summary>
246 /// 89 ///
247 /// </summary> 90 /// </summary>
248 /// <param name="addPacket"></param> 91 /// <param name="addPacket"></param>
249 public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) 92 /// <param name="ownerID"></param>
250 { 93 /// <param name="localID"></param>
251 this.primData.PathBegin = updatePacket.PathBegin; 94 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
252 this.primData.PathEnd = updatePacket.PathEnd;
253 this.primData.PathScaleX = updatePacket.PathScaleX;
254 this.primData.PathScaleY = updatePacket.PathScaleY;
255 this.primData.PathShearX = updatePacket.PathShearX;
256 this.primData.PathShearY = updatePacket.PathShearY;
257 this.primData.PathSkew = updatePacket.PathSkew;
258 this.primData.ProfileBegin = updatePacket.ProfileBegin;
259 this.primData.ProfileEnd = updatePacket.ProfileEnd;
260 this.primData.PathCurve = updatePacket.PathCurve;
261 this.primData.ProfileCurve = updatePacket.ProfileCurve;
262 this.primData.ProfileHollow = updatePacket.ProfileHollow;
263 this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset;
264 this.primData.PathRevolutions = updatePacket.PathRevolutions;
265 this.primData.PathTaperX = updatePacket.PathTaperX;
266 this.primData.PathTaperY = updatePacket.PathTaperY;
267 this.primData.PathTwist = updatePacket.PathTwist;
268 this.primData.PathTwistBegin = updatePacket.PathTwistBegin;
269 }
270
271 /// <summary>
272 ///
273 /// </summary>
274 /// <param name="tex"></param>
275 public void UpdateTexture(byte[] tex)
276 {
277 this.primData.TextureEntry = tex;
278 }
279
280 /// <summary>
281 ///
282 /// </summary>
283 /// <param name="pack"></param>
284 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
285 {
286
287 }
288
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="prim"></param>
293 public void AssignToParent(Primitive prim)
294 {
295
296 }
297
298 #endregion
299
300 # region Inventory Methods
301 /// <summary>
302 ///
303 /// </summary>
304 /// <param name="item"></param>
305 /// <returns></returns>
306 public bool AddToInventory(InventoryItem item)
307 { 95 {
308 return false; 96 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
309 } 97 this.OwnerID = ownerID;
98 this.Pos = addPacket.ObjectData.RayEnd;
99 this.uuid = LLUUID.Random();
100 this.m_localId = (uint)(localID);
101
102 PrimitiveBaseShape pShape = new PrimitiveBaseShape();
103 this.m_Shape = pShape;
104
105 pShape.PCode = addPacket.ObjectData.PCode;
106 pShape.PathBegin = addPacket.ObjectData.PathBegin;
107 pShape.PathEnd = addPacket.ObjectData.PathEnd;
108 pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
109 pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
110 pShape.PathShearX = addPacket.ObjectData.PathShearX;
111 pShape.PathShearY = addPacket.ObjectData.PathShearY;
112 pShape.PathSkew = addPacket.ObjectData.PathSkew;
113 pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
114 pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
115 pShape.Scale = addPacket.ObjectData.Scale;
116 pShape.PathCurve = addPacket.ObjectData.PathCurve;
117 pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
118 pShape.ParentID = 0;
119 pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
120 pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
121 pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
122 pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
123 pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
124 pShape.PathTwist = addPacket.ObjectData.PathTwist;
125 pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
310 126
311 /// <summary> 127 this.updateFlag = 1;
312 ///
313 /// </summary>
314 /// <param name="itemID"></param>
315 /// <returns></returns>
316 public InventoryItem RemoveFromInventory(LLUUID itemID)
317 {
318 return null;
319 } 128 }
320 129
321 /// <summary> 130 public void AddToChildren(SceneObject linkObject)
322 ///
323 /// </summary>
324 /// <param name="simClient"></param>
325 /// <param name="packet"></param>
326 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
327 { 131 {
328 132
329 } 133 }
@@ -331,53 +135,19 @@ namespace OpenSim.Region.Environment.Scenes
331 /// <summary> 135 /// <summary>
332 /// 136 ///
333 /// </summary> 137 /// </summary>
334 /// <param name="simClient"></param> 138 /// <param name="pos"></param>
335 /// <param name="xferID"></param> 139 public void UpdatePosition(LLVector3 pos)
336 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
337 {
338 //will only currently work if the total size of the inventory data array is under about 1000 bytes
339 SendXferPacketPacket send = new SendXferPacketPacket();
340
341 send.XferID.ID = xferID;
342 send.XferID.Packet = 1 + 2147483648;
343 send.DataPacket.Data = this.ConvertInventoryToBytes();
344
345 simClient.OutPacket(send);
346 }
347
348 /// <summary>
349 ///
350 /// </summary>
351 /// <returns></returns>
352 public byte[] ConvertInventoryToBytes()
353 { 140 {
354 System.Text.Encoding enc = System.Text.Encoding.ASCII; 141 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
355 byte[] result = new byte[0]; 142 if (this.isRootPrim)
356 List<byte[]> inventoryData = new List<byte[]>();
357 int totallength = 0;
358 foreach (InventoryItem invItem in inventoryItems.Values)
359 { 143 {
360 byte[] data = enc.GetBytes(invItem.ExportString()); 144 this.m_Parent.Pos = newPos;
361 inventoryData.Add(data);
362 totallength += data.Length;
363 } 145 }
364 //TODO: copy arrays into the single result array 146 this.Pos = newPos;
365 147 this.updateFlag = 2;
366 return result;
367 }
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="data"></param>
373 public void CreateInventoryFromBytes(byte[] data)
374 {
375
376 } 148 }
377 149
378 #endregion 150 #region Client Update Methods
379
380 #region Update viewers Methods
381 151
382 /// <summary> 152 /// <summary>
383 /// 153 ///
@@ -402,17 +172,9 @@ namespace OpenSim.Region.Environment.Scenes
402 public void SendFullUpdateToClient(IClientAPI remoteClient) 172 public void SendFullUpdateToClient(IClientAPI remoteClient)
403 { 173 {
404 LLVector3 lPos; 174 LLVector3 lPos;
405 if (this._physActor != null && this.physicsEnabled) 175 lPos = this.Pos;
406 {
407 PhysicsVector pPos = this._physActor.Position;
408 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
409 }
410 else
411 {
412 lPos = this.Pos;
413 }
414 176
415 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); 177 remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID);
416 } 178 }
417 179
418 /// <summary> 180 /// <summary>
@@ -430,22 +192,31 @@ namespace OpenSim.Region.Environment.Scenes
430 /// <summary> 192 /// <summary>
431 /// 193 ///
432 /// </summary> 194 /// </summary>
195 /// <param name="remoteClient"></param>
196 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
197 {
198 this.SendTerseUpdateToClient(remoteClient);
199 for (int i = 0; i < this.children.Count; i++)
200 {
201 if (this.children[i] is Primitive)
202 {
203 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient);
204 }
205 }
206 }
207
208 /// <summary>
209 ///
210 /// </summary>
433 /// <param name="RemoteClient"></param> 211 /// <param name="RemoteClient"></param>
434 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 212 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
435 { 213 {
436 LLVector3 lPos; 214 LLVector3 lPos;
437 Axiom.MathLib.Quaternion lRot; 215 Axiom.MathLib.Quaternion lRot;
438 if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? 216
439 { 217 lPos = this.Pos;
440 PhysicsVector pPos = this._physActor.Position; 218 lRot = this.rotation;
441 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); 219
442 lRot = this._physActor.Orientation;
443 }
444 else
445 {
446 lPos = this.Pos;
447 lRot = this.rotation;
448 }
449 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); 220 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
450 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); 221 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
451 } 222 }
@@ -463,120 +234,5 @@ namespace OpenSim.Region.Environment.Scenes
463 } 234 }
464 235
465 #endregion 236 #endregion
466
467 #region Create Methods
468
469 /// <summary>
470 ///
471 /// </summary>
472 /// <param name="addPacket"></param>
473 /// <param name="ownerID"></param>
474 /// <param name="localID"></param>
475 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
476 {
477 PrimData PData = new PrimData();
478 this.primData = PData;
479 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
480
481 PData.OwnerID = ownerID;
482 PData.PCode = addPacket.ObjectData.PCode;
483 PData.PathBegin = addPacket.ObjectData.PathBegin;
484 PData.PathEnd = addPacket.ObjectData.PathEnd;
485 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
486 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
487 PData.PathShearX = addPacket.ObjectData.PathShearX;
488 PData.PathShearY = addPacket.ObjectData.PathShearY;
489 PData.PathSkew = addPacket.ObjectData.PathSkew;
490 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
491 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
492 PData.Scale = addPacket.ObjectData.Scale;
493 PData.PathCurve = addPacket.ObjectData.PathCurve;
494 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
495 PData.ParentID = 0;
496 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
497 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
498 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
499 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
500 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
501 PData.PathTwist = addPacket.ObjectData.PathTwist;
502 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
503 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
504 this.primData.FullID = this.uuid = LLUUID.Random();
505 this.primData.LocalID = m_localId = (uint)(localID);
506 this.primData.Position = this.Pos = pos1;
507
508 this.updateFlag = 1;
509 }
510
511 /// <summary>
512 ///
513 /// </summary>
514 /// <param name="data"></param>
515 public void CreateFromBytes(byte[] data)
516 {
517
518 }
519
520 /// <summary>
521 ///
522 /// </summary>
523 /// <param name="primData"></param>
524 public void CreateFromPrimData(PrimData primData)
525 {
526 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
527 }
528
529 /// <summary>
530 ///
531 /// </summary>
532 /// <param name="primData"></param>
533 /// <param name="posi"></param>
534 /// <param name="localID"></param>
535 /// <param name="newprim"></param>
536 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
537 {
538
539 }
540
541 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
542 {
543 // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z);
544 this.Pos = pos;
545 this.SendTerseUpdateToALLClients();
546 }
547
548 public void GetProperites(IClientAPI client)
549 {
550 //needs changing
551 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
552 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
553 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
554 proper.ObjectData[0].ItemID = LLUUID.Zero;
555 proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate;
556 proper.ObjectData[0].CreatorID = primData.OwnerID;
557 proper.ObjectData[0].FolderID = LLUUID.Zero;
558 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
559 proper.ObjectData[0].GroupID = LLUUID.Zero;
560 proper.ObjectData[0].InventorySerial = 0;
561 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
562 proper.ObjectData[0].ObjectID = this.uuid;
563 proper.ObjectData[0].OwnerID = primData.OwnerID;
564 proper.ObjectData[0].TouchName = new byte[0];
565 proper.ObjectData[0].TextureID = new byte[0];
566 proper.ObjectData[0].SitName = new byte[0];
567 proper.ObjectData[0].Name = new byte[0];
568 proper.ObjectData[0].Description = new byte[0];
569 proper.ObjectData[0].OwnerMask = primData.OwnerMask;
570 proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask;
571 proper.ObjectData[0].GroupMask = primData.GroupMask;
572 proper.ObjectData[0].EveryoneMask = primData.EveryoneMask;
573 proper.ObjectData[0].BaseMask = primData.BaseMask;
574
575 client.OutPacket(proper);
576
577 }
578
579 #endregion
580
581 } 237 }
582} 238}
diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
new file mode 100644
index 0000000..d703857
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
@@ -0,0 +1,582 @@
1
2/*
3* Copyright (c) Contributors, http://www.openmetaverse.org/
4* See CONTRIBUTORS.TXT for a full list of copyright holders.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the OpenSim Project nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*
28*/
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Physics.Manager;
36using OpenSim.Framework.Types;
37using OpenSim.Framework.Inventory;
38
39namespace OpenSim.Region.Environment.Scenes
40{
41 public class PrimitiveOld : Entity
42 {
43 internal PrimData primData;
44 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
45 // private Dictionary<uint, IClientAPI> m_clientThreads;
46 private ulong m_regionHandle;
47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48 private bool physicsEnabled = false;
49 private byte updateFlag = 0;
50 private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
51
52 private Dictionary<LLUUID, InventoryItem> inventoryItems;
53
54 #region Properties
55
56 public LLVector3 Scale
57 {
58 set
59 {
60 this.primData.Scale = value;
61 //this.dirtyFlag = true;
62 }
63 get
64 {
65 return this.primData.Scale;
66 }
67 }
68
69 public PhysicsActor PhysActor
70 {
71 set
72 {
73 this._physActor = value;
74 }
75 }
76
77 public override LLVector3 Pos
78 {
79 get
80 {
81 return base.Pos;
82 }
83 set
84 {
85 base.Pos = value;
86 }
87 }
88 #endregion
89
90 /// <summary>
91 ///
92 /// </summary>
93 /// <param name="clientThreads"></param>
94 /// <param name="regionHandle"></param>
95 /// <param name="world"></param>
96 public PrimitiveOld( ulong regionHandle, Scene world)
97 {
98 // m_clientThreads = clientThreads;
99 m_regionHandle = regionHandle;
100 m_world = world;
101 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
102 }
103
104 /// <summary>
105 ///
106 /// </summary>
107 /// <param name="regionHandle"></param>
108 /// <param name="world"></param>
109 /// <param name="addPacket"></param>
110 /// <param name="ownerID"></param>
111 /// <param name="localID"></param>
112 public PrimitiveOld(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
113 {
114 // m_clientThreads = clientThreads;
115 m_regionHandle = regionHandle;
116 m_world = world;
117 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
118 this.CreateFromPacket(addPacket, ownerID, localID);
119 }
120
121 /// <summary>
122 ///
123 /// </summary>
124 /// <param name="clientThreads"></param>
125 /// <param name="regionHandle"></param>
126 /// <param name="world"></param>
127 /// <param name="owner"></param>
128 /// <param name="fullID"></param>
129 /// <param name="localID"></param>
130 public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID)
131 {
132 // m_clientThreads = clientThreads;
133 m_regionHandle = regionHandle;
134 m_world = world;
135 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
136 this.primData = new PrimData();
137 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
138 this.primData.OwnerID = owner;
139 this.primData.FullID = this.uuid = fullID;
140 this.primData.LocalID = m_localId = localID;
141 }
142
143 /// <summary>
144 /// Constructor to create a default cube
145 /// </summary>
146 /// <param name="clientThreads"></param>
147 /// <param name="regionHandle"></param>
148 /// <param name="world"></param>
149 /// <param name="owner"></param>
150 /// <param name="localID"></param>
151 /// <param name="position"></param>
152 public PrimitiveOld( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position)
153 {
154 //m_clientThreads = clientThreads;
155 m_regionHandle = regionHandle;
156 m_world = world;
157 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
158 this.primData = PrimData.DefaultCube();
159 this.primData.OwnerID = owner;
160 this.primData.LocalID = m_localId = localID;
161 this.Pos = this.primData.Position = position;
162
163 this.updateFlag = 1;
164 }
165
166 /// <summary>
167 ///
168 /// </summary>
169 /// <returns></returns>
170 public byte[] GetByteArray()
171 {
172 byte[] result = null;
173 List<byte[]> dataArrays = new List<byte[]>();
174 dataArrays.Add(primData.ToBytes());
175 foreach (Entity child in children)
176 {
177 if (child is OpenSim.Region.Environment.Scenes.PrimitiveOld)
178 {
179 dataArrays.Add(((OpenSim.Region.Environment.Scenes.PrimitiveOld)child).GetByteArray());
180 }
181 }
182 byte[] primstart = Helpers.StringToField("<Prim>");
183 byte[] primend = Helpers.StringToField("</Prim>");
184 int totalLength = primstart.Length + primend.Length;
185 for (int i = 0; i < dataArrays.Count; i++)
186 {
187 totalLength += dataArrays[i].Length;
188 }
189
190 result = new byte[totalLength];
191 int arraypos = 0;
192 Array.Copy(primstart, 0, result, 0, primstart.Length);
193 arraypos += primstart.Length;
194 for (int i = 0; i < dataArrays.Count; i++)
195 {
196 Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length);
197 arraypos += dataArrays[i].Length;
198 }
199 Array.Copy(primend, 0, result, arraypos, primend.Length);
200
201 return result;
202 }
203
204 #region Overridden Methods
205
206 /// <summary>
207 ///
208 /// </summary>
209 public override void update()
210 {
211 if (this.updateFlag == 1) // is a new prim just been created/reloaded
212 {
213 this.SendFullUpdateToAllClients();
214 this.updateFlag = 0;
215 }
216 if (this.updateFlag == 2) //some change has been made so update the clients
217 {
218 this.SendTerseUpdateToALLClients();
219 this.updateFlag = 0;
220 }
221 }
222
223 /// <summary>
224 ///
225 /// </summary>
226 public override void BackUp()
227 {
228
229 }
230
231 #endregion
232
233 #region Packet handlers
234
235 /// <summary>
236 ///
237 /// </summary>
238 /// <param name="pos"></param>
239 public void UpdatePosition(LLVector3 pos)
240 {
241 this.Pos = new LLVector3(pos.X, pos.Y, pos.Z);
242 this.updateFlag = 2;
243 }
244
245 /// <summary>
246 ///
247 /// </summary>
248 /// <param name="addPacket"></param>
249 public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket)
250 {
251 this.primData.PathBegin = updatePacket.PathBegin;
252 this.primData.PathEnd = updatePacket.PathEnd;
253 this.primData.PathScaleX = updatePacket.PathScaleX;
254 this.primData.PathScaleY = updatePacket.PathScaleY;
255 this.primData.PathShearX = updatePacket.PathShearX;
256 this.primData.PathShearY = updatePacket.PathShearY;
257 this.primData.PathSkew = updatePacket.PathSkew;
258 this.primData.ProfileBegin = updatePacket.ProfileBegin;
259 this.primData.ProfileEnd = updatePacket.ProfileEnd;
260 this.primData.PathCurve = updatePacket.PathCurve;
261 this.primData.ProfileCurve = updatePacket.ProfileCurve;
262 this.primData.ProfileHollow = updatePacket.ProfileHollow;
263 this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset;
264 this.primData.PathRevolutions = updatePacket.PathRevolutions;
265 this.primData.PathTaperX = updatePacket.PathTaperX;
266 this.primData.PathTaperY = updatePacket.PathTaperY;
267 this.primData.PathTwist = updatePacket.PathTwist;
268 this.primData.PathTwistBegin = updatePacket.PathTwistBegin;
269 }
270
271 /// <summary>
272 ///
273 /// </summary>
274 /// <param name="tex"></param>
275 public void UpdateTexture(byte[] tex)
276 {
277 this.primData.TextureEntry = tex;
278 }
279
280 /// <summary>
281 ///
282 /// </summary>
283 /// <param name="pack"></param>
284 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
285 {
286
287 }
288
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="prim"></param>
293 public void AssignToParent(PrimitiveOld prim)
294 {
295
296 }
297
298 #endregion
299
300 # region Inventory Methods
301 /// <summary>
302 ///
303 /// </summary>
304 /// <param name="item"></param>
305 /// <returns></returns>
306 public bool AddToInventory(InventoryItem item)
307 {
308 return false;
309 }
310
311 /// <summary>
312 ///
313 /// </summary>
314 /// <param name="itemID"></param>
315 /// <returns></returns>
316 public InventoryItem RemoveFromInventory(LLUUID itemID)
317 {
318 return null;
319 }
320
321 /// <summary>
322 ///
323 /// </summary>
324 /// <param name="simClient"></param>
325 /// <param name="packet"></param>
326 public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet)
327 {
328
329 }
330
331 /// <summary>
332 ///
333 /// </summary>
334 /// <param name="simClient"></param>
335 /// <param name="xferID"></param>
336 public void RequestXferInventory(IClientAPI simClient, ulong xferID)
337 {
338 //will only currently work if the total size of the inventory data array is under about 1000 bytes
339 SendXferPacketPacket send = new SendXferPacketPacket();
340
341 send.XferID.ID = xferID;
342 send.XferID.Packet = 1 + 2147483648;
343 send.DataPacket.Data = this.ConvertInventoryToBytes();
344
345 simClient.OutPacket(send);
346 }
347
348 /// <summary>
349 ///
350 /// </summary>
351 /// <returns></returns>
352 public byte[] ConvertInventoryToBytes()
353 {
354 System.Text.Encoding enc = System.Text.Encoding.ASCII;
355 byte[] result = new byte[0];
356 List<byte[]> inventoryData = new List<byte[]>();
357 int totallength = 0;
358 foreach (InventoryItem invItem in inventoryItems.Values)
359 {
360 byte[] data = enc.GetBytes(invItem.ExportString());
361 inventoryData.Add(data);
362 totallength += data.Length;
363 }
364 //TODO: copy arrays into the single result array
365
366 return result;
367 }
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="data"></param>
373 public void CreateInventoryFromBytes(byte[] data)
374 {
375
376 }
377
378 #endregion
379
380 #region Update viewers Methods
381
382 /// <summary>
383 ///
384 /// </summary>
385 /// <param name="remoteClient"></param>
386 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
387 {
388 this.SendFullUpdateToClient(remoteClient);
389 for (int i = 0; i < this.children.Count; i++)
390 {
391 if (this.children[i] is PrimitiveOld)
392 {
393 ((PrimitiveOld)this.children[i]).SendFullUpdateForAllChildren(remoteClient);
394 }
395 }
396 }
397
398 /// <summary>
399 ///
400 /// </summary>
401 /// <param name="remoteClient"></param>
402 public void SendFullUpdateToClient(IClientAPI remoteClient)
403 {
404 LLVector3 lPos;
405 if (this._physActor != null && this.physicsEnabled)
406 {
407 PhysicsVector pPos = this._physActor.Position;
408 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
409 }
410 else
411 {
412 lPos = this.Pos;
413 }
414
415 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags);
416 }
417
418 /// <summary>
419 ///
420 /// </summary>
421 public void SendFullUpdateToAllClients()
422 {
423 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
424 for (int i = 0; i < avatars.Count; i++)
425 {
426 this.SendFullUpdateToClient(avatars[i].ControllingClient);
427 }
428 }
429
430 /// <summary>
431 ///
432 /// </summary>
433 /// <param name="RemoteClient"></param>
434 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
435 {
436 LLVector3 lPos;
437 Axiom.MathLib.Quaternion lRot;
438 if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us?
439 {
440 PhysicsVector pPos = this._physActor.Position;
441 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
442 lRot = this._physActor.Orientation;
443 }
444 else
445 {
446 lPos = this.Pos;
447 lRot = this.rotation;
448 }
449 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
450 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot);
451 }
452
453 /// <summary>
454 ///
455 /// </summary>
456 public void SendTerseUpdateToALLClients()
457 {
458 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
459 for (int i = 0; i < avatars.Count; i++)
460 {
461 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
462 }
463 }
464
465 #endregion
466
467 #region Create Methods
468
469 /// <summary>
470 ///
471 /// </summary>
472 /// <param name="addPacket"></param>
473 /// <param name="ownerID"></param>
474 /// <param name="localID"></param>
475 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
476 {
477 PrimData PData = new PrimData();
478 this.primData = PData;
479 this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
480
481 PData.OwnerID = ownerID;
482 PData.PCode = addPacket.ObjectData.PCode;
483 PData.PathBegin = addPacket.ObjectData.PathBegin;
484 PData.PathEnd = addPacket.ObjectData.PathEnd;
485 PData.PathScaleX = addPacket.ObjectData.PathScaleX;
486 PData.PathScaleY = addPacket.ObjectData.PathScaleY;
487 PData.PathShearX = addPacket.ObjectData.PathShearX;
488 PData.PathShearY = addPacket.ObjectData.PathShearY;
489 PData.PathSkew = addPacket.ObjectData.PathSkew;
490 PData.ProfileBegin = addPacket.ObjectData.ProfileBegin;
491 PData.ProfileEnd = addPacket.ObjectData.ProfileEnd;
492 PData.Scale = addPacket.ObjectData.Scale;
493 PData.PathCurve = addPacket.ObjectData.PathCurve;
494 PData.ProfileCurve = addPacket.ObjectData.ProfileCurve;
495 PData.ParentID = 0;
496 PData.ProfileHollow = addPacket.ObjectData.ProfileHollow;
497 PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
498 PData.PathRevolutions = addPacket.ObjectData.PathRevolutions;
499 PData.PathTaperX = addPacket.ObjectData.PathTaperX;
500 PData.PathTaperY = addPacket.ObjectData.PathTaperY;
501 PData.PathTwist = addPacket.ObjectData.PathTwist;
502 PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
503 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
504 this.primData.FullID = this.uuid = LLUUID.Random();
505 this.primData.LocalID = m_localId = (uint)(localID);
506 this.primData.Position = this.Pos = pos1;
507
508 this.updateFlag = 1;
509 }
510
511 /// <summary>
512 ///
513 /// </summary>
514 /// <param name="data"></param>
515 public void CreateFromBytes(byte[] data)
516 {
517
518 }
519
520 /// <summary>
521 ///
522 /// </summary>
523 /// <param name="primData"></param>
524 public void CreateFromPrimData(PrimData primData)
525 {
526 this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
527 }
528
529 /// <summary>
530 ///
531 /// </summary>
532 /// <param name="primData"></param>
533 /// <param name="posi"></param>
534 /// <param name="localID"></param>
535 /// <param name="newprim"></param>
536 public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
537 {
538
539 }
540
541 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
542 {
543 // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z);
544 this.Pos = pos;
545 this.SendTerseUpdateToALLClients();
546 }
547
548 public void GetProperites(IClientAPI client)
549 {
550 //needs changing
551 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
552 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
553 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
554 proper.ObjectData[0].ItemID = LLUUID.Zero;
555 proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate;
556 proper.ObjectData[0].CreatorID = primData.OwnerID;
557 proper.ObjectData[0].FolderID = LLUUID.Zero;
558 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
559 proper.ObjectData[0].GroupID = LLUUID.Zero;
560 proper.ObjectData[0].InventorySerial = 0;
561 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
562 proper.ObjectData[0].ObjectID = this.uuid;
563 proper.ObjectData[0].OwnerID = primData.OwnerID;
564 proper.ObjectData[0].TouchName = new byte[0];
565 proper.ObjectData[0].TextureID = new byte[0];
566 proper.ObjectData[0].SitName = new byte[0];
567 proper.ObjectData[0].Name = new byte[0];
568 proper.ObjectData[0].Description = new byte[0];
569 proper.ObjectData[0].OwnerMask = primData.OwnerMask;
570 proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask;
571 proper.ObjectData[0].GroupMask = primData.GroupMask;
572 proper.ObjectData[0].EveryoneMask = primData.EveryoneMask;
573 proper.ObjectData[0].BaseMask = primData.BaseMask;
574
575 client.OutPacket(proper);
576
577 }
578
579 #endregion
580
581 }
582}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 1d55c4d..f3d461a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -214,12 +214,16 @@ namespace OpenSim.Region.Environment.Scenes
214 /// <param name="remoteClient"></param> 214 /// <param name="remoteClient"></param>
215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 215 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
216 { 216 {
217 foreach (Entity ent in Entities.Values) 217 Console.WriteLine("prim selected :" + primLocalID);
218 foreach (EntityBase ent in Entities.Values)
218 { 219 {
219 if (ent.LocalId == primLocalID) 220 if (ent is SceneObject)
220 { 221 {
221 ((OpenSim.Region.Environment.Scenes.Primitive)ent).GetProperites(remoteClient); 222 if (((SceneObject)ent).rootLocalID == primLocalID)
222 break; 223 {
224 ((OpenSim.Region.Environment.Scenes.SceneObject)ent).GetProperites(remoteClient);
225 break;
226 }
223 } 227 }
224 } 228 }
225 } 229 }
@@ -228,7 +232,7 @@ namespace OpenSim.Region.Environment.Scenes
228 { 232 {
229 if (this.Entities.ContainsKey(objectID)) 233 if (this.Entities.ContainsKey(objectID))
230 { 234 {
231 ((Primitive)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); 235 ((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
232 } 236 }
233 } 237 }
234 238
@@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
266 { 270 {
267 if (ent.LocalId == localID) 271 if (ent.LocalId == localID)
268 { 272 {
269 ((OpenSim.Region.Environment.Scenes.Primitive)ent).UpdatePosition(pos); 273 ((OpenSim.Region.Environment.Scenes.PrimitiveOld)ent).UpdatePosition(pos);
270 break; 274 break;
271 } 275 }
272 } 276 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index dbf385d..2ff3976 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -63,12 +63,12 @@ namespace OpenSim.Region.Environment.Scenes
63 private uint _primCount = 702000; 63 private uint _primCount = 702000;
64 private int storageCount; 64 private int storageCount;
65 private Mutex updateLock; 65 private Mutex updateLock;
66 66
67 protected AuthenticateSessionsBase authenticateHandler; 67 protected AuthenticateSessionsBase authenticateHandler;
68 protected RegionCommsListener regionCommsHost; 68 protected RegionCommsListener regionCommsHost;
69 protected CommunicationsManager commsManager; 69 protected CommunicationsManager commsManager;
70 70
71 protected Dictionary<LLUUID,Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 71 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
72 protected BaseHttpServer httpListener; 72 protected BaseHttpServer httpListener;
73 73
74 public ParcelManager parcelManager; 74 public ParcelManager parcelManager;
@@ -121,21 +121,21 @@ namespace OpenSim.Region.Environment.Scenes
121 scriptManager = new ScriptManager(this); 121 scriptManager = new ScriptManager(this);
122 eventManager = new EventManager(); 122 eventManager = new EventManager();
123 123
124 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); 124 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance");
125 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 125 Entities = new Dictionary<libsecondlife.LLUUID, EntityBase>();
126 Avatars = new Dictionary<LLUUID, ScenePresence>(); 126 Avatars = new Dictionary<LLUUID, ScenePresence>();
127 Prims = new Dictionary<LLUUID, Primitive>(); 127 Prims = new Dictionary<LLUUID, Primitive>();
128 128
129 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); 129 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap");
130 Terrain = new TerrainEngine(); 130 Terrain = new TerrainEngine();
131 131
132 ScenePresence.LoadAnims(); 132 ScenePresence.LoadAnims();
133 this.httpListener = httpServer; 133 this.httpListener = httpServer;
134 134
135 } 135 }
136 catch (Exception e) 136 catch (Exception e)
137 { 137 {
138 OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); 138 OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString());
139 } 139 }
140 } 140 }
141 #endregion 141 #endregion
@@ -218,49 +218,7 @@ namespace OpenSim.Region.Environment.Scenes
218 /// <returns></returns> 218 /// <returns></returns>
219 public bool Backup() 219 public bool Backup()
220 { 220 {
221 /* 221
222 try
223 {
224 // Terrain backup routines
225 if (Terrain.tainted > 0)
226 {
227 Terrain.tainted = 0;
228 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving.");
229 localStorage.SaveMap(Terrain.getHeights1D());
230 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics.");
231 lock (this.m_syncRoot)
232 {
233 phyScene.SetTerrain(Terrain.getHeights1D());
234 }
235 }
236
237 // Primitive backup routines
238 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives");
239 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
240 {
241 Entities[UUID].BackUp();
242 }
243
244 //Parcel backup routines
245 ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
246 int i = 0;
247 foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values)
248 {
249 parcels[i] = parcel.parcelData;
250 i++;
251 }
252 localStorage.SaveParcels(parcels);
253
254 // Backup successful
255 return true;
256 }
257 catch (Exception e)
258 {
259 // Backup failed
260 OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString());
261 return false;
262 }
263 */
264 return true; 222 return true;
265 } 223 }
266 #endregion 224 #endregion
@@ -432,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes
432 { 390 {
433 try 391 try
434 { 392 {
435 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); 393 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives");
436 this.localStorage.LoadPrimitives(this); 394 this.localStorage.LoadPrimitives(this);
437 } 395 }
438 catch (Exception e) 396 catch (Exception e)
@@ -469,13 +427,12 @@ namespace OpenSim.Region.Environment.Scenes
469 { 427 {
470 try 428 try
471 { 429 {
472 Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); 430 SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount);
473 431 this.Entities.Add(sceneOb.rootUUID, sceneOb);
474 this.Entities.Add(prim.uuid, prim);
475 this._primCount++; 432 this._primCount++;
476 433
477 // Trigger event for listeners 434 // Trigger event for listeners
478 eventManager.TriggerOnNewPrimitive(prim); 435 // eventManager.TriggerOnNewPrimitive(prim);
479 } 436 }
480 catch (Exception e) 437 catch (Exception e)
481 { 438 {
@@ -500,11 +457,11 @@ namespace OpenSim.Region.Environment.Scenes
500 client.OnChatFromViewer += this.SimChat; 457 client.OnChatFromViewer += this.SimChat;
501 client.OnRequestWearables += this.InformClientOfNeighbours; 458 client.OnRequestWearables += this.InformClientOfNeighbours;
502 client.OnAddPrim += this.AddNewPrim; 459 client.OnAddPrim += this.AddNewPrim;
503 client.OnUpdatePrimPosition += this.UpdatePrimPosition; 460 //client.OnUpdatePrimPosition += this.UpdatePrimPosition;
504 client.OnRequestMapBlocks += this.RequestMapBlocks; 461 client.OnRequestMapBlocks += this.RequestMapBlocks;
505 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 462 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
506 //remoteClient.OnObjectSelect += this.SelectPrim; 463 client.OnObjectSelect += this.SelectPrim;
507 client.OnGrapUpdate += this.MoveObject; 464 // client.OnGrapUpdate += this.MoveObject;
508 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 465 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
509 466
510 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); 467 /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
@@ -523,39 +480,39 @@ namespace OpenSim.Region.Environment.Scenes
523 { 480 {
524 ScenePresence newAvatar = null; 481 ScenePresence newAvatar = null;
525 482
526 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 483 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
527 newAvatar = new ScenePresence(client, this, this.m_regInfo); 484 newAvatar = new ScenePresence(client, this, this.m_regInfo);
528 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); 485 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world");
529 OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); 486 OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake ");
530 487
531 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 488 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
532 lock (this.m_syncRoot) 489 lock (this.m_syncRoot)
490 {
491 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
492 }
493
494 lock (Entities)
495 {
496 if (!Entities.ContainsKey(client.AgentId))
533 { 497 {
534 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 498 this.Entities.Add(client.AgentId, newAvatar);
535 } 499 }
536 500 else
537 lock (Entities)
538 { 501 {
539 if (!Entities.ContainsKey(client.AgentId)) 502 Entities[client.AgentId] = newAvatar;
540 {
541 this.Entities.Add(client.AgentId, newAvatar);
542 }
543 else
544 {
545 Entities[client.AgentId] = newAvatar;
546 }
547 } 503 }
548 lock (Avatars) 504 }
505 lock (Avatars)
506 {
507 if (Avatars.ContainsKey(client.AgentId))
549 { 508 {
550 if (Avatars.ContainsKey(client.AgentId)) 509 Avatars[client.AgentId] = newAvatar;
551 {
552 Avatars[client.AgentId] = newAvatar;
553 }
554 else
555 {
556 this.Avatars.Add(client.AgentId, newAvatar);
557 }
558 } 510 }
511 else
512 {
513 this.Avatars.Add(client.AgentId, newAvatar);
514 }
515 }
559 } 516 }
560 517
561 518
@@ -634,7 +591,7 @@ namespace OpenSim.Region.Environment.Scenes
634 public void RegisterRegionWithComms() 591 public void RegisterRegionWithComms()
635 { 592 {
636 GridInfo gridSettings = new GridInfo(); 593 GridInfo gridSettings = new GridInfo();
637 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); 594 this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings);
638 if (this.regionCommsHost != null) 595 if (this.regionCommsHost != null)
639 { 596 {
640 this.regionCommsHost.OnExpectUser += this.NewUserConnection; 597 this.regionCommsHost.OnExpectUser += this.NewUserConnection;
@@ -757,7 +714,9 @@ namespace OpenSim.Region.Environment.Scenes
757 agent.child = true; 714 agent.child = true;
758 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 715 this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
759 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); 716 this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
717
760 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); 718 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4));
719
761 } 720 }
762 //remoteClient.SendTeleportCancel(); 721 //remoteClient.SendTeleportCancel();
763 } 722 }
@@ -771,7 +730,7 @@ namespace OpenSim.Region.Environment.Scenes
771 /// <param name="position"></param> 730 /// <param name="position"></param>
772 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) 731 public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
773 { 732 {
774 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); 733 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
775 } 734 }
776 735
777 #endregion 736 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index e06acbd..00ab194 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public abstract class SceneBase : IWorld 45 public abstract class SceneBase : IWorld
46 { 46 {
47 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 47 public Dictionary<libsecondlife.LLUUID, EntityBase> Entities;
48 protected Dictionary<uint, IClientAPI> m_clientThreads; 48 protected Dictionary<uint, IClientAPI> m_clientThreads;
49 protected ulong m_regionHandle; 49 protected ulong m_regionHandle;
50 protected string m_regionName; 50 protected string m_regionName;
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index fa1bacb..ac887c0 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Scenes
15 public delegate void OnNewPresenceDelegate(ScenePresence presence); 15 public delegate void OnNewPresenceDelegate(ScenePresence presence);
16 public event OnNewPresenceDelegate OnNewPresence; 16 public event OnNewPresenceDelegate OnNewPresence;
17 17
18 public delegate void OnNewPrimitiveDelegate(Primitive prim); 18 public delegate void OnNewPrimitiveDelegate(PrimitiveOld prim);
19 public event OnNewPrimitiveDelegate OnNewPrimitive; 19 public event OnNewPrimitiveDelegate OnNewPrimitive;
20 20
21 public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); 21 public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid);
@@ -29,7 +29,7 @@ namespace OpenSim.Region.Environment.Scenes
29 } 29 }
30 } 30 }
31 31
32 public void TriggerOnNewPrimitive(Primitive prim) 32 public void TriggerOnNewPrimitive(PrimitiveOld prim)
33 { 33 {
34 if (OnNewPrimitive != null) 34 if (OnNewPrimitive != null)
35 OnNewPrimitive(prim); 35 OnNewPrimitive(prim);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 88fb160..a228638 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -37,22 +37,46 @@ using OpenSim.Framework.Inventory;
37 37
38namespace OpenSim.Region.Environment.Scenes 38namespace OpenSim.Region.Environment.Scenes
39{ 39{
40 public class SceneObject : Entity 40 public class SceneObject : EntityBase
41 { 41 {
42 private LLUUID rootUUID; 42
43 //private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); 43 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
44 protected Primitive rootPrimitive; 44 protected Primitive rootPrimitive;
45 private Scene m_world; 45 private Scene m_world;
46 protected ulong regionHandle; 46 protected ulong m_regionHandle;
47 47
48 private bool physicsEnabled = false;
49 private PhysicsScene m_PhysScene;
50 private PhysicsActor m_PhysActor;
51
52 public LLUUID rootUUID
53 {
54 get
55 {
56 this.uuid = this.rootPrimitive.uuid;
57 return this.uuid;
58 }
59 }
60
61 public uint rootLocalID
62 {
63 get
64 {
65 this.m_localId = this.rootPrimitive.LocalId;
66 return this.LocalId;
67 }
68 }
48 /// <summary> 69 /// <summary>
49 /// 70 ///
50 /// </summary> 71 /// </summary>
51 public SceneObject() 72 public SceneObject(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
52 { 73 {
74 m_regionHandle = regionHandle;
75 m_world = world;
76 this.Pos = addPacket.ObjectData.RayEnd;
77 this.CreateFromPacket(addPacket, ownerID, localID);
53 78
54 } 79 }
55
56 /// <summary> 80 /// <summary>
57 /// 81 ///
58 /// </summary> 82 /// </summary>
@@ -61,7 +85,9 @@ namespace OpenSim.Region.Environment.Scenes
61 /// <param name="localID"></param> 85 /// <param name="localID"></param>
62 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) 86 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
63 { 87 {
64 this.rootPrimitive = new Primitive( this.regionHandle, this.m_world, addPacket, agentID, localID); 88 this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this);
89 this.children.Add(rootPrimitive);
90 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
65 } 91 }
66 92
67 /// <summary> 93 /// <summary>
@@ -76,11 +102,19 @@ namespace OpenSim.Region.Environment.Scenes
76 /// <summary> 102 /// <summary>
77 /// 103 ///
78 /// </summary> 104 /// </summary>
79 public override void update() 105 /// <param name="primID"></param>
106 /// <returns></returns>
107 public Primitive HasChildPrim(LLUUID primID)
80 { 108 {
109 if (this.ChildPrimitives.ContainsKey(primID))
110 {
111 return this.ChildPrimitives[primID];
112 }
81 113
114 return null;
82 } 115 }
83 116
117
84 /// <summary> 118 /// <summary>
85 /// 119 ///
86 /// </summary> 120 /// </summary>
@@ -92,6 +126,18 @@ namespace OpenSim.Region.Environment.Scenes
92 /// <summary> 126 /// <summary>
93 /// 127 ///
94 /// </summary> 128 /// </summary>
129 /// <param name="offset"></param>
130 /// <param name="pos"></param>
131 /// <param name="remoteClient"></param>
132 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
133 {
134 this.Pos = pos;
135 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
136 }
137
138 /// <summary>
139 ///
140 /// </summary>
95 /// <param name="client"></param> 141 /// <param name="client"></param>
96 public void GetProperites(IClientAPI client) 142 public void GetProperites(IClientAPI client)
97 { 143 {
@@ -100,25 +146,25 @@ namespace OpenSim.Region.Environment.Scenes
100 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 146 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
101 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 147 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
102 proper.ObjectData[0].ItemID = LLUUID.Zero; 148 proper.ObjectData[0].ItemID = LLUUID.Zero;
103 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.primData.CreationDate; 149 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
104 proper.ObjectData[0].CreatorID = this.rootPrimitive.primData.OwnerID; 150 proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID;
105 proper.ObjectData[0].FolderID = LLUUID.Zero; 151 proper.ObjectData[0].FolderID = LLUUID.Zero;
106 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 152 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
107 proper.ObjectData[0].GroupID = LLUUID.Zero; 153 proper.ObjectData[0].GroupID = LLUUID.Zero;
108 proper.ObjectData[0].InventorySerial = 0; 154 proper.ObjectData[0].InventorySerial = 0;
109 proper.ObjectData[0].LastOwnerID = LLUUID.Zero; 155 proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
110 proper.ObjectData[0].ObjectID = this.uuid; 156 proper.ObjectData[0].ObjectID = this.rootUUID;
111 proper.ObjectData[0].OwnerID = this.rootPrimitive.primData.OwnerID; 157 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
112 proper.ObjectData[0].TouchName = new byte[0]; 158 proper.ObjectData[0].TouchName = new byte[0];
113 proper.ObjectData[0].TextureID = new byte[0]; 159 proper.ObjectData[0].TextureID = new byte[0];
114 proper.ObjectData[0].SitName = new byte[0]; 160 proper.ObjectData[0].SitName = new byte[0];
115 proper.ObjectData[0].Name = new byte[0]; 161 proper.ObjectData[0].Name = new byte[0];
116 proper.ObjectData[0].Description = new byte[0]; 162 proper.ObjectData[0].Description = new byte[0];
117 proper.ObjectData[0].OwnerMask = this.rootPrimitive.primData.OwnerMask; 163 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
118 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.primData.NextOwnerMask; 164 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
119 proper.ObjectData[0].GroupMask = this.rootPrimitive.primData.GroupMask; 165 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
120 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.primData.EveryoneMask; 166 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
121 proper.ObjectData[0].BaseMask = this.rootPrimitive.primData.BaseMask; 167 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
122 168
123 client.OutPacket(proper); 169 client.OutPacket(proper);
124 170