aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs416
1 files changed, 412 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 2c201ba..fabc3ed 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -34,10 +34,14 @@ using OpenSim.Framework;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Types; 35using OpenSim.Region.Environment.Types;
36using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
37using OpenSim.Region.Environment.Interfaces;
38using System.Runtime.Serialization;
39using System.Security.Permissions;
37 40
38namespace OpenSim.Region.Environment.Scenes 41namespace OpenSim.Region.Environment.Scenes
39{ 42{
40 public class ScenePresence : EntityBase 43 [Serializable]
44 public class ScenePresence : EntityBase, ISerializable
41 { 45 {
42// ~ScenePresence() 46// ~ScenePresence()
43// { 47// {
@@ -156,6 +160,12 @@ namespace OpenSim.Region.Environment.Scenes
156 get { return m_physicsActor; } 160 get { return m_physicsActor; }
157 } 161 }
158 162
163 public byte MovementFlag
164 {
165 set { m_movementflag = value; }
166 get { return m_movementflag; }
167 }
168
159 public bool KnownPrim(LLUUID primID) 169 public bool KnownPrim(LLUUID primID)
160 { 170 {
161 if (m_knownPrimUUID.Contains(primID)) 171 if (m_knownPrimUUID.Contains(primID))
@@ -215,13 +225,14 @@ namespace OpenSim.Region.Environment.Scenes
215 /// <summary> 225 /// <summary>
216 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager 226 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager
217 /// </summary> 227 /// </summary>
218 private readonly IClientAPI m_controllingClient; 228 private IClientAPI m_controllingClient;
219 229
220 protected PhysicsActor m_physicsActor; 230 protected PhysicsActor m_physicsActor;
221 231
222 public IClientAPI ControllingClient 232 public IClientAPI ControllingClient
223 { 233 {
224 get { return m_controllingClient; } 234 get { return m_controllingClient; }
235 set { m_controllingClient = value; }
225 } 236 }
226 237
227 protected LLVector3 m_parentPosition = new LLVector3(); 238 protected LLVector3 m_parentPosition = new LLVector3();
@@ -379,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes
379 m_appearance = appearance; 390 m_appearance = appearance;
380 } 391 }
381 392
382 private void RegisterToEvents() 393 public void RegisterToEvents()
383 { 394 {
384 m_controllingClient.OnRequestWearables += SendOwnAppearance; 395 m_controllingClient.OnRequestWearables += SendOwnAppearance;
385 m_controllingClient.OnSetAppearance += SetAppearance; 396 m_controllingClient.OnSetAppearance += SetAppearance;
@@ -1706,6 +1717,7 @@ namespace OpenSim.Region.Environment.Scenes
1706 DefaultTexture = textu.ToBytes(); 1717 DefaultTexture = textu.ToBytes();
1707 } 1718 }
1708 1719
1720 [Serializable]
1709 public class NewForce 1721 public class NewForce
1710 { 1722 {
1711 public float X; 1723 public float X;
@@ -1717,7 +1729,8 @@ namespace OpenSim.Region.Environment.Scenes
1717 } 1729 }
1718 } 1730 }
1719 1731
1720 public class ScenePartUpdate 1732 [Serializable]
1733 public class ScenePartUpdate : ISerializable
1721 { 1734 {
1722 public LLUUID FullID; 1735 public LLUUID FullID;
1723 public uint LastFullUpdateTime; 1736 public uint LastFullUpdateTime;
@@ -1729,6 +1742,38 @@ namespace OpenSim.Region.Environment.Scenes
1729 LastFullUpdateTime = 0; 1742 LastFullUpdateTime = 0;
1730 LastTerseUpdateTime = 0; 1743 LastTerseUpdateTime = 0;
1731 } 1744 }
1745
1746 protected ScenePartUpdate(SerializationInfo info, StreamingContext context)
1747 {
1748 //System.Console.WriteLine("ScenePartUpdate Deserialize BGN");
1749
1750 if (info == null)
1751 {
1752 throw new System.ArgumentNullException("info");
1753 }
1754
1755 FullID = new LLUUID((Guid)info.GetValue("FullID", typeof(Guid)));
1756 LastFullUpdateTime = (uint)info.GetValue("LastFullUpdateTime", typeof(uint));
1757 LastTerseUpdateTime = (uint)info.GetValue("LastTerseUpdateTime", typeof(uint));
1758
1759 //System.Console.WriteLine("ScenePartUpdate Deserialize END");
1760 }
1761
1762 [SecurityPermission(SecurityAction.LinkDemand,
1763 Flags = SecurityPermissionFlag.SerializationFormatter)]
1764 public virtual void GetObjectData(
1765 SerializationInfo info, StreamingContext context)
1766 {
1767 if (info == null)
1768 {
1769 throw new System.ArgumentNullException("info");
1770 }
1771
1772 info.AddValue("FullID", FullID.UUID);
1773 info.AddValue("LastFullUpdateTime", LastFullUpdateTime);
1774 info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime);
1775
1776 }
1732 } 1777 }
1733 1778
1734 public override void SetText(string text, Vector3 color, double alpha) 1779 public override void SetText(string text, Vector3 color, double alpha)
@@ -1787,5 +1832,368 @@ namespace OpenSim.Region.Environment.Scenes
1787 RemoveFromPhysicalScene(); 1832 RemoveFromPhysicalScene();
1788 GC.Collect(); 1833 GC.Collect();
1789 } 1834 }
1835
1836 public ScenePresence()
1837 {
1838/* JB
1839 if (Animations == null)
1840 {
1841 Animations = new AvatarAnimations();
1842 Animations.LoadAnims();
1843 }
1844*/
1845 if (DefaultTexture == null)
1846 {
1847 LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry();
1848 DefaultTexture = textu.ToBytes();
1849 }
1850 }
1851
1852 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
1853 {
1854 m_controllingClient = client;
1855 m_regionInfo = region;
1856 m_scene = scene;
1857 RegisterToEvents();
1858
1859 /*
1860 AbsolutePosition = client.StartPos;
1861
1862 Animations = new AvatarAnimations();
1863 Animations.LoadAnims();
1864
1865 m_animations = new List<LLUUID>();
1866 m_animations.Add(Animations.AnimsLLUUID["STAND"]);
1867 m_animationSeqs.Add(1);
1868
1869 SetDirectionVectors();
1870 */
1871 }
1872
1873 protected ScenePresence(SerializationInfo info, StreamingContext context)
1874 : base (info, context)
1875 {
1876 //System.Console.WriteLine("ScenePresence Deserialize BGN");
1877
1878 if (info == null)
1879 {
1880 throw new System.ArgumentNullException("info");
1881 }
1882/* JB
1883 if (Animations == null)
1884 {
1885 Animations = new AvatarAnimations();
1886 Animations.LoadAnims();
1887 }
1888*/
1889 if (DefaultTexture == null)
1890 {
1891 LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry();
1892 DefaultTexture = textu.ToBytes();
1893 }
1894
1895 List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>));
1896
1897 foreach (Guid guid in animations_work)
1898 {
1899 m_animations.Add(new LLUUID(guid));
1900 }
1901
1902 m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>));
1903 m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool));
1904 m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte));
1905 m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>));
1906 m_updateCount = (short)info.GetValue("m_updateCount", typeof(short));
1907 m_requestedSitTargetID = (uint)info.GetValue("m_requestedSitTargetID", typeof(uint));
1908
1909 m_requestedSitOffset
1910 = new LLVector3(
1911 (float)info.GetValue("m_requestedSitOffset.X", typeof(float)),
1912 (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)),
1913 (float)info.GetValue("m_requestedSitOffset.Z", typeof(float)));
1914
1915 m_sitAvatarHeight = (float)info.GetValue("m_sitAvatarHeight", typeof(float));
1916 m_godlevel = (float)info.GetValue("m_godlevel", typeof(float));
1917 m_setAlwaysRun = (bool)info.GetValue("m_setAlwaysRun", typeof(bool));
1918
1919 m_bodyRot
1920 = new Quaternion(
1921 (float)info.GetValue("m_bodyRot.w", typeof(float)),
1922 (float)info.GetValue("m_bodyRot.x", typeof(float)),
1923 (float)info.GetValue("m_bodyRot.y", typeof(float)),
1924 (float)info.GetValue("m_bodyRot.z", typeof(float)));
1925
1926 IsRestrictedToRegion = (bool)info.GetValue("IsRestrictedToRegion", typeof(bool));
1927 m_newForce = (bool)info.GetValue("m_newForce", typeof(bool));
1928 //m_newAvatar = (bool)info.GetValue("m_newAvatar", typeof(bool));
1929 m_newCoarseLocations = (bool)info.GetValue("m_newCoarseLocations", typeof(bool));
1930 m_gotAllObjectsInScene = (bool)info.GetValue("m_gotAllObjectsInScene", typeof(bool));
1931 m_avHeight = (float)info.GetValue("m_avHeight", typeof(float));
1932 crossingFromRegion = (ulong)info.GetValue("crossingFromRegion", typeof(ulong));
1933
1934 List<float[]> Dir_Vectors_work = (List<float[]>)info.GetValue("Dir_Vectors", typeof(List<float[]>));
1935 List<Vector3> Dir_Vectors_work2 = new List<Vector3>();
1936
1937 foreach (float[] f3 in Dir_Vectors_work)
1938 {
1939 Dir_Vectors_work2.Add(new Vector3(f3[0], f3[1], f3[2]));
1940 }
1941
1942 Dir_Vectors = Dir_Vectors_work2.ToArray();
1943
1944 lastPhysPos
1945 = new LLVector3(
1946 (float)info.GetValue("lastPhysPos.X", typeof(float)),
1947 (float)info.GetValue("lastPhysPos.Y", typeof(float)),
1948 (float)info.GetValue("lastPhysPos.Z", typeof(float)));
1949
1950 m_CameraCenter
1951 = new Vector3(
1952 (float)info.GetValue("m_CameraCenter.X", typeof(float)),
1953 (float)info.GetValue("m_CameraCenter.Y", typeof(float)),
1954 (float)info.GetValue("m_CameraCenter.Z", typeof(float)));
1955
1956 m_CameraAtAxis
1957 = new Vector3(
1958 (float)info.GetValue("m_CameraAtAxis.X", typeof(float)),
1959 (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)),
1960 (float)info.GetValue("m_CameraAtAxis.Z", typeof(float)));
1961
1962 m_CameraLeftAxis
1963 = new Vector3(
1964 (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)),
1965 (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)),
1966 (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float)));
1967
1968 m_CameraUpAxis
1969 = new Vector3(
1970 (float)info.GetValue("m_CameraUpAxis.X", typeof(float)),
1971 (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)),
1972 (float)info.GetValue("m_CameraUpAxis.Z", typeof(float)));
1973
1974 m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float));
1975 m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance));
1976 m_knownChildRegions = (List<ulong>)info.GetValue("m_knownChildRegions", typeof(List<ulong>));
1977
1978 posLastSignificantMove
1979 = new LLVector3(
1980 (float)info.GetValue("posLastSignificantMove.X", typeof(float)),
1981 (float)info.GetValue("posLastSignificantMove.Y", typeof(float)),
1982 (float)info.GetValue("posLastSignificantMove.Z", typeof(float)));
1983
1984 // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue));
1985
1986 /*
1987 Dictionary<Guid, ScenePartUpdate> updateTimes_work
1988 = (Dictionary<Guid, ScenePartUpdate>)info.GetValue("m_updateTimes", typeof(Dictionary<Guid, ScenePartUpdate>));
1989
1990 foreach (Guid id in updateTimes_work.Keys)
1991 {
1992 m_updateTimes.Add(new LLUUID(id), updateTimes_work[id]);
1993 }
1994 */
1995 m_regionHandle = (ulong)info.GetValue("m_regionHandle", typeof(ulong));
1996 m_firstname = (string)info.GetValue("m_firstname", typeof(string));
1997 m_lastname = (string)info.GetValue("m_lastname", typeof(string));
1998 m_allowMovement = (bool)info.GetValue("m_allowMovement", typeof(bool));
1999 m_parentPosition = new LLVector3((float)info.GetValue("m_parentPosition.X", typeof(float)),
2000 (float)info.GetValue("m_parentPosition.Y", typeof(float)),
2001 (float)info.GetValue("m_parentPosition.Z", typeof(float)));
2002
2003 m_isChildAgent = (bool)info.GetValue("m_isChildAgent", typeof(bool));
2004 m_parentID = (uint)info.GetValue("m_parentID", typeof(uint));
2005
2006// for OpenSim_v0.5
2007 currentParcelUUID = new LLUUID((Guid)info.GetValue("currentParcelUUID", typeof(Guid)));
2008
2009 lastKnownAllowedPosition
2010 = new Vector3(
2011 (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)),
2012 (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)),
2013 (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float)));
2014
2015 sentMessageAboutRestrictedParcelFlyingDown = (bool)info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof(bool));
2016
2017 m_LastChildAgentUpdatePosition
2018 = new LLVector3(
2019 (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)),
2020 (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)),
2021 (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float)));
2022
2023 m_perfMonMS = (int)info.GetValue("m_perfMonMS", typeof(int));
2024 m_AgentControlFlags = (uint)info.GetValue("m_AgentControlFlags", typeof(uint));
2025
2026 m_headrotation
2027 = new LLQuaternion(
2028 (float)info.GetValue("m_headrotation.W", typeof(float)),
2029 (float)info.GetValue("m_headrotation.X", typeof(float)),
2030 (float)info.GetValue("m_headrotation.Y", typeof(float)),
2031 (float)info.GetValue("m_headrotation.Z", typeof(float)));
2032
2033 m_state = (byte)info.GetValue("m_state", typeof(byte));
2034
2035 List<Guid> knownPrimUUID_work = (List<Guid>)info.GetValue("m_knownPrimUUID", typeof(List<Guid>));
2036
2037 foreach (Guid id in knownPrimUUID_work)
2038 {
2039 m_knownPrimUUID.Add(new LLUUID(id));
2040 }
2041
2042 //System.Console.WriteLine("ScenePresence Deserialize END");
2043 }
2044
2045 [SecurityPermission(SecurityAction.LinkDemand,
2046 Flags = SecurityPermissionFlag.SerializationFormatter)]
2047 public override void GetObjectData(
2048 SerializationInfo info, StreamingContext context)
2049 {
2050 if (info == null)
2051 {
2052 throw new System.ArgumentNullException("info");
2053 }
2054
2055 base.GetObjectData(info, context);
2056
2057 List<Guid> animations_work = new List<Guid>();
2058
2059 foreach (LLUUID uuid in m_animations)
2060 {
2061 animations_work.Add(uuid.UUID);
2062 }
2063
2064 info.AddValue("m_animations", animations_work);
2065
2066 info.AddValue("m_animationSeqs", m_animationSeqs);
2067 info.AddValue("m_updateflag", m_updateflag);
2068 info.AddValue("m_movementflag", m_movementflag);
2069 info.AddValue("m_forcesList", m_forcesList);
2070 info.AddValue("m_updateCount", m_updateCount);
2071 info.AddValue("m_requestedSitTargetID", m_requestedSitTargetID);
2072
2073 // LLVector3
2074 info.AddValue("m_requestedSitOffset.X", m_requestedSitOffset.X);
2075 info.AddValue("m_requestedSitOffset.Y", m_requestedSitOffset.Y);
2076 info.AddValue("m_requestedSitOffset.Z", m_requestedSitOffset.Z);
2077
2078 info.AddValue("m_sitAvatarHeight", m_sitAvatarHeight);
2079 info.AddValue("m_godlevel", m_godlevel);
2080 info.AddValue("m_setAlwaysRun", m_setAlwaysRun);
2081
2082 // Quaternion
2083 info.AddValue("m_bodyRot.w", m_bodyRot.w);
2084 info.AddValue("m_bodyRot.x", m_bodyRot.x);
2085 info.AddValue("m_bodyRot.y", m_bodyRot.y);
2086 info.AddValue("m_bodyRot.z", m_bodyRot.z);
2087
2088 info.AddValue("IsRestrictedToRegion", IsRestrictedToRegion);
2089 info.AddValue("m_newForce", m_newForce);
2090 //info.AddValue("m_newAvatar", m_newAvatar);
2091 info.AddValue("m_newCoarseLocations", m_newCoarseLocations);
2092 info.AddValue("m_gotAllObjectsInScene", m_gotAllObjectsInScene);
2093 info.AddValue("m_avHeight", m_avHeight);
2094
2095 // info.AddValue("m_regionInfo", m_regionInfo);
2096
2097 info.AddValue("crossingFromRegion", crossingFromRegion);
2098
2099 List<float[]> Dir_Vectors_work = new List<float[]>();
2100
2101 foreach (Vector3 v3 in Dir_Vectors)
2102 {
2103 Dir_Vectors_work.Add(new float[] { v3.x, v3.y, v3.z });
2104 }
2105
2106 info.AddValue("Dir_Vectors", Dir_Vectors_work);
2107
2108 // LLVector3
2109 info.AddValue("lastPhysPos.X", lastPhysPos.X);
2110 info.AddValue("lastPhysPos.Y", lastPhysPos.Y);
2111 info.AddValue("lastPhysPos.Z", lastPhysPos.Z);
2112
2113 // Vector3
2114 info.AddValue("m_CameraCenter.X", m_CameraCenter.x);
2115 info.AddValue("m_CameraCenter.Y", m_CameraCenter.y);
2116 info.AddValue("m_CameraCenter.Z", m_CameraCenter.z);
2117
2118 // Vector3
2119 info.AddValue("m_CameraAtAxis.X", m_CameraAtAxis.x);
2120 info.AddValue("m_CameraAtAxis.Y", m_CameraAtAxis.y);
2121 info.AddValue("m_CameraAtAxis.Z", m_CameraAtAxis.z);
2122
2123 // Vector3
2124 info.AddValue("m_CameraLeftAxis.X", m_CameraLeftAxis.x);
2125 info.AddValue("m_CameraLeftAxis.Y", m_CameraLeftAxis.y);
2126 info.AddValue("m_CameraLeftAxis.Z", m_CameraLeftAxis.z);
2127
2128 // Vector3
2129 info.AddValue("m_CameraUpAxis.X", m_CameraUpAxis.x);
2130 info.AddValue("m_CameraUpAxis.Y", m_CameraUpAxis.y);
2131 info.AddValue("m_CameraUpAxis.Z", m_CameraUpAxis.z);
2132
2133 info.AddValue("m_DrawDistance", m_DrawDistance);
2134 info.AddValue("m_appearance", m_appearance);
2135 info.AddValue("m_knownChildRegions", m_knownChildRegions);
2136
2137 // LLVector3
2138 info.AddValue("posLastSignificantMove.X", posLastSignificantMove.X);
2139 info.AddValue("posLastSignificantMove.Y", posLastSignificantMove.Y);
2140 info.AddValue("posLastSignificantMove.Z", posLastSignificantMove.Z);
2141
2142 //info.AddValue("m_partsUpdateQueue", m_partsUpdateQueue);
2143
2144 /*
2145 Dictionary<Guid, ScenePartUpdate> updateTimes_work = new Dictionary<Guid, ScenePartUpdate>();
2146
2147 foreach ( LLUUID id in m_updateTimes.Keys)
2148 {
2149 updateTimes_work.Add(id.UUID, m_updateTimes[id]);
2150 }
2151
2152 info.AddValue("m_updateTimes", updateTimes_work);
2153 */
2154
2155 info.AddValue("m_regionHandle", m_regionHandle);
2156 info.AddValue("m_firstname", m_firstname);
2157 info.AddValue("m_lastname", m_lastname);
2158 info.AddValue("m_allowMovement", m_allowMovement);
2159 //info.AddValue("m_physicsActor", m_physicsActor);
2160 info.AddValue("m_parentPosition.X", m_parentPosition.X);
2161 info.AddValue("m_parentPosition.Y", m_parentPosition.Y);
2162 info.AddValue("m_parentPosition.Z", m_parentPosition.Z);
2163 info.AddValue("m_isChildAgent", m_isChildAgent);
2164 info.AddValue("m_parentID", m_parentID);
2165
2166// for OpenSim_v0.5
2167 info.AddValue("currentParcelUUID", currentParcelUUID.UUID);
2168
2169 info.AddValue("lastKnownAllowedPosition.X", lastKnownAllowedPosition.x);
2170 info.AddValue("lastKnownAllowedPosition.Y", lastKnownAllowedPosition.y);
2171 info.AddValue("lastKnownAllowedPosition.Z", lastKnownAllowedPosition.z);
2172
2173 info.AddValue("sentMessageAboutRestrictedParcelFlyingDown", sentMessageAboutRestrictedParcelFlyingDown);
2174
2175 info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X);
2176 info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y);
2177 info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z);
2178
2179 info.AddValue("m_perfMonMS", m_perfMonMS);
2180 info.AddValue("m_AgentControlFlags", m_AgentControlFlags);
2181
2182 info.AddValue("m_headrotation.W", m_headrotation.W);
2183 info.AddValue("m_headrotation.X", m_headrotation.X);
2184 info.AddValue("m_headrotation.Y", m_headrotation.Y);
2185 info.AddValue("m_headrotation.Z", m_headrotation.Z);
2186
2187 info.AddValue("m_state", m_state);
2188
2189 List<Guid> knownPrimUUID_work = new List<Guid>();
2190
2191 foreach (LLUUID id in m_knownPrimUUID)
2192 {
2193 knownPrimUUID_work.Add(id.UUID);
2194 }
2195
2196 info.AddValue("m_knownPrimUUID", knownPrimUUID_work);
2197 }
1790 } 2198 }
1791} 2199}