diff options
Diffstat (limited to 'OpenSim.RegionServer/world/Avatar.cs')
-rw-r--r-- | OpenSim.RegionServer/world/Avatar.cs | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index c8a4539..75f2cff 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs | |||
@@ -5,6 +5,7 @@ using System.Text; | |||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using libsecondlife.Packets; | 6 | using libsecondlife.Packets; |
7 | using OpenSim.Physics.Manager; | 7 | using OpenSim.Physics.Manager; |
8 | using OpenSim.Framework.Inventory; | ||
8 | using Axiom.MathLib; | 9 | using Axiom.MathLib; |
9 | 10 | ||
10 | namespace OpenSim.world | 11 | namespace OpenSim.world |
@@ -25,6 +26,9 @@ namespace OpenSim.world | |||
25 | private List<NewForce> forcesList = new List<NewForce>(); | 26 | private List<NewForce> forcesList = new List<NewForce>(); |
26 | private short _updateCount = 0; | 27 | private short _updateCount = 0; |
27 | private Axiom.MathLib.Quaternion bodyRot; | 28 | private Axiom.MathLib.Quaternion bodyRot; |
29 | private LLObject.TextureEntry avatarAppearanceTexture = null; | ||
30 | private byte[] visualParams; | ||
31 | private AvatarWearable[] Wearables; | ||
28 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 32 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
29 | 33 | ||
30 | public Avatar(SimClient TheClient) | 34 | public Avatar(SimClient TheClient) |
@@ -34,6 +38,21 @@ namespace OpenSim.world | |||
34 | localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); | 38 | localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++); |
35 | position = new LLVector3(100.0f, 100.0f, 30.0f); | 39 | position = new LLVector3(100.0f, 100.0f, 30.0f); |
36 | position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; | 40 | position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1; |
41 | visualParams = new byte[218]; | ||
42 | for (int i = 0; i < 218; i++) | ||
43 | { | ||
44 | visualParams[i] = 100; | ||
45 | } | ||
46 | Wearables = new AvatarWearable[13]; //should be 13 of these | ||
47 | for (int i = 0; i < 13; i++) | ||
48 | { | ||
49 | Wearables[i] = new AvatarWearable(); | ||
50 | } | ||
51 | this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
52 | this.Wearables[0].ItemID = LLUUID.Random(); | ||
53 | |||
54 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
55 | |||
37 | } | 56 | } |
38 | 57 | ||
39 | public PhysicsActor PhysActor | 58 | public PhysicsActor PhysActor |
@@ -97,7 +116,6 @@ namespace OpenSim.world | |||
97 | _updateCount++; | 116 | _updateCount++; |
98 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) | 117 | if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) |
99 | { | 118 | { |
100 | //Console.WriteLine("been a while since update so have one"); | ||
101 | //It has been a while since last update was sent so lets send one. | 119 | //It has been a while since last update was sent so lets send one. |
102 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); | 120 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); |
103 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 121 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
@@ -119,6 +137,7 @@ namespace OpenSim.world | |||
119 | } | 137 | } |
120 | 138 | ||
121 | } | 139 | } |
140 | this.positionLastFrame = pos2; | ||
122 | } | 141 | } |
123 | 142 | ||
124 | public static void SetupTemplate(string name) | 143 | public static void SetupTemplate(string name) |
@@ -204,18 +223,13 @@ namespace OpenSim.world | |||
204 | aw.AgentData.SessionID = ControllingClient.SessionID; | 223 | aw.AgentData.SessionID = ControllingClient.SessionID; |
205 | 224 | ||
206 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 225 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
207 | AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 226 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
208 | awb.WearableType = (byte)0; | 227 | for (int i = 0; i < 13; i++) |
209 | awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
210 | awb.ItemID = LLUUID.Random(); | ||
211 | aw.WearableData[0] = awb; | ||
212 | |||
213 | for (int i = 1; i < 13; i++) | ||
214 | { | 228 | { |
215 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 229 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
216 | awb.WearableType = (byte)i; | 230 | awb.WearableType = (byte)i; |
217 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 231 | awb.AssetID = this.Wearables[i].AssetID; |
218 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 232 | awb.ItemID = this.Wearables[i].ItemID; |
219 | aw.WearableData[i] = awb; | 233 | aw.WearableData[i] = awb; |
220 | } | 234 | } |
221 | 235 | ||
@@ -253,14 +267,15 @@ namespace OpenSim.world | |||
253 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 267 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; |
254 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); | 268 | //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); |
255 | 269 | ||
256 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); | 270 | //LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); |
257 | avp.ObjectData.TextureEntry = ntex.ToBytes(); | 271 | //avp.ObjectData.TextureEntry = ntex.ToBytes(); |
272 | avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); | ||
258 | 273 | ||
259 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 274 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
260 | for (int i = 0; i < 218; i++) | 275 | for (int i = 0; i < 218; i++) |
261 | { | 276 | { |
262 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | 277 | avblock = new AvatarAppearancePacket.VisualParamBlock(); |
263 | avblock.ParamValue = (byte)100; | 278 | avblock.ParamValue = visualParams[i]; |
264 | avp.VisualParam[i] = avblock; | 279 | avp.VisualParam[i] = avblock; |
265 | } | 280 | } |
266 | 281 | ||
@@ -269,6 +284,24 @@ namespace OpenSim.world | |||
269 | userInfo.OutPacket(avp); | 284 | userInfo.OutPacket(avp); |
270 | 285 | ||
271 | } | 286 | } |
287 | public void SetAppearance(AgentSetAppearancePacket appear) | ||
288 | { | ||
289 | LLObject.TextureEntry tex = new LLObject.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | ||
290 | this.avatarAppearanceTexture = tex; | ||
291 | for (int i = 0; i < appear.VisualParam.Length; i++) | ||
292 | { | ||
293 | this.visualParams[i] = appear.VisualParam[i].ParamValue; | ||
294 | } | ||
295 | |||
296 | foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) | ||
297 | { | ||
298 | if (client.AgentID != ControllingClient.AgentID) | ||
299 | { | ||
300 | SendAppearanceToOtherAgent(client); | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | |||
272 | 305 | ||
273 | public void HandleUpdate(AgentUpdatePacket pack) | 306 | public void HandleUpdate(AgentUpdatePacket pack) |
274 | { | 307 | { |
@@ -479,7 +512,7 @@ namespace OpenSim.world | |||
479 | int i = 0; | 512 | int i = 0; |
480 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 513 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
481 | 514 | ||
482 | dat.TextureEntry = AvatarTemplate.TextureEntry; | 515 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; |
483 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); | 516 | libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); |
484 | 517 | ||
485 | uint ID = this.localid; | 518 | uint ID = this.localid; |