Avatar.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using libsecondlife;
  6. using libsecondlife.Packets;
  7. using OpenSim.Physics.Manager;
  8. using OpenSim.Framework.Inventory;
  9. using OpenSim.Framework.Interfaces;
  10. using OpenSim.Framework.Types;
  11. using Axiom.MathLib;
  12. namespace OpenSim.world
  13. {
  14. public partial class Avatar : Entity
  15. {
  16. public static bool PhysicsEngineFlying = false;
  17. public static AvatarAnimations Animations;
  18. public string firstname;
  19. public string lastname;
  20. public IClientAPI ControllingClient;
  21. public LLUUID current_anim;
  22. public int anim_seq;
  23. private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
  24. private bool updateflag = false;
  25. private byte movementflag = 0;
  26. private List<NewForce> forcesList = new List<NewForce>();
  27. private short _updateCount = 0;
  28. private Axiom.MathLib.Quaternion bodyRot;
  29. private LLObject.TextureEntry avatarAppearanceTexture = null;
  30. private byte[] visualParams;
  31. private AvatarWearable[] Wearables;
  32. private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
  33. private ulong m_regionHandle;
  34. private Dictionary<uint, IClientAPI> m_clientThreads;
  35. private string m_regionName;
  36. private ushort m_regionWaterHeight;
  37. private bool m_regionTerraform;
  38. private bool childAvatar = false;
  39. private RegionInfo regionData;
  40. /// <summary>
  41. ///
  42. /// </summary>
  43. /// <param name="theClient"></param>
  44. /// <param name="world"></param>
  45. /// <param name="clientThreads"></param>
  46. /// <param name="regionDat"></param>
  47. public Avatar(IClientAPI theClient, World world, Dictionary<uint, IClientAPI> clientThreads, RegionInfo regionDat)
  48. {
  49. m_world = world;
  50. m_clientThreads = clientThreads;
  51. regionData = regionDat;
  52. this.uuid = theClient.AgentId;
  53. m_regionName = regionData.RegionName;
  54. m_regionHandle = regionData.RegionHandle;
  55. m_regionTerraform = regionData.RegionTerraform;
  56. m_regionWaterHeight = regionData.RegionWaterHeight;
  57. OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)");
  58. ControllingClient = theClient;
  59. this.firstname = ControllingClient.FirstName;
  60. this.lastname = ControllingClient.LastName;
  61. localid = 8880000 + (this.m_world._localNumber++);
  62. Pos = ControllingClient.StartPos;
  63. visualParams = new byte[218];
  64. for (int i = 0; i < 218; i++)
  65. {
  66. visualParams[i] = 100;
  67. }
  68. Wearables = new AvatarWearable[13]; //should be 13 of these
  69. for (int i = 0; i < 13; i++)
  70. {
  71. Wearables[i] = new AvatarWearable();
  72. }
  73. this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
  74. this.Wearables[0].ItemID = LLUUID.Random();
  75. this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
  76. Console.WriteLine("avatar point 4");
  77. //register for events
  78. ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance);
  79. //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
  80. ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
  81. ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
  82. /* ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate);
  83. ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
  84. ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
  85. ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
  86. * */
  87. }
  88. /// <summary>
  89. ///
  90. /// </summary>
  91. public PhysicsActor PhysActor
  92. {
  93. set
  94. {
  95. this._physActor = value;
  96. }
  97. get
  98. {
  99. return _physActor;
  100. }
  101. }
  102. /// <summary>
  103. ///
  104. /// </summary>
  105. /// <param name="status"></param>
  106. public void ChildStatusChange(bool status)
  107. {
  108. }
  109. /// <summary>
  110. ///
  111. /// </summary>
  112. public override void addForces()
  113. {
  114. }
  115. /// <summary>
  116. /// likely to removed very soon
  117. /// </summary>
  118. /// <param name="name"></param>
  119. public static void SetupTemplate(string name)
  120. {
  121. }
  122. /// <summary>
  123. /// likely to removed very soon
  124. /// </summary>
  125. /// <param name="objdata"></param>
  126. protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
  127. {
  128. }
  129. /// <summary>
  130. ///
  131. /// </summary>
  132. public void CompleteMovement()
  133. {
  134. this.ControllingClient.MoveAgentIntoRegion(this.regionData);
  135. }
  136. /// <summary>
  137. ///
  138. /// </summary>
  139. /// <param name="pack"></param>
  140. public void HandleAgentUpdate(Packet pack)
  141. {
  142. this.HandleUpdate((AgentUpdatePacket)pack);
  143. }
  144. /// <summary>
  145. ///
  146. /// </summary>
  147. /// <param name="pack"></param>
  148. public void HandleUpdate(AgentUpdatePacket pack)
  149. {
  150. }
  151. /// <summary>
  152. ///
  153. /// </summary>
  154. public void SendRegionHandshake()
  155. {
  156. this.ControllingClient.SendRegionHandshake(this.regionData);
  157. }
  158. /// <summary>
  159. ///
  160. /// </summary>
  161. public static void LoadAnims()
  162. {
  163. }
  164. /// <summary>
  165. ///
  166. /// </summary>
  167. public override void LandRenegerated()
  168. {
  169. }
  170. public class NewForce
  171. {
  172. public float X;
  173. public float Y;
  174. public float Z;
  175. public NewForce()
  176. {
  177. }
  178. }
  179. }
  180. }