diff options
author | Melanie | 2013-01-06 10:52:22 +0000 |
---|---|---|
committer | Melanie | 2013-01-06 10:52:22 +0000 |
commit | 083ac92b344262ae72516ba05cc93cdcd2f2a454 (patch) | |
tree | 1992de8e08171aac3e811fb1d43abc6ad8b894af /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | bug fix, cleanup... (diff) | |
download | opensim-SC-083ac92b344262ae72516ba05cc93cdcd2f2a454.zip opensim-SC-083ac92b344262ae72516ba05cc93cdcd2f2a454.tar.gz opensim-SC-083ac92b344262ae72516ba05cc93cdcd2f2a454.tar.bz2 opensim-SC-083ac92b344262ae72516ba05cc93cdcd2f2a454.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 162 |
2 files changed, 115 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs index 34aca33..d25c930 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs | |||
@@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | 35 | ||
36 | public interface IAvatarFactoryModule | 36 | public interface IAvatarFactoryModule |
37 | { | 37 | { |
38 | void SetAppearance(IScenePresence sp, AvatarAppearance appearance); | 38 | void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems); |
39 | void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); | 39 | void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems); |
40 | 40 | ||
41 | /// <summary> | 41 | /// <summary> |
42 | /// Send the appearance of an avatar to others in the scene. | 42 | /// Send the appearance of an avatar to others in the scene. |
@@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns> | 52 | /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns> |
53 | Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId); | 53 | Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId); |
54 | 54 | ||
55 | |||
56 | WearableCacheItem[] GetCachedItems(UUID agentId); | ||
55 | /// <summary> | 57 | /// <summary> |
56 | /// Save the baked textures for the given agent permanently in the asset database. | 58 | /// Save the baked textures for the given agent permanently in the asset database. |
57 | /// </summary> | 59 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fa1a5af..b9cd3fc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -923,6 +923,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
923 | 923 | ||
924 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 924 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
925 | 925 | ||
926 | UUID groupUUID = UUID.Zero; | ||
927 | string GroupName = string.Empty; | ||
928 | ulong groupPowers = 0; | ||
929 | |||
930 | // ---------------------------------- | ||
931 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status | ||
932 | try | ||
933 | { | ||
934 | if (gm != null) | ||
935 | { | ||
936 | groupUUID = ControllingClient.ActiveGroupId; | ||
937 | GroupRecord record = gm.GetGroupRecord(groupUUID); | ||
938 | if (record != null) | ||
939 | GroupName = record.GroupName; | ||
940 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); | ||
941 | if (groupMembershipData != null) | ||
942 | groupPowers = groupMembershipData.GroupPowers; | ||
943 | } | ||
944 | ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, | ||
945 | Grouptitle); | ||
946 | } | ||
947 | catch (Exception e) | ||
948 | { | ||
949 | m_log.Debug("[AGENTUPDATE]: " + e.ToString()); | ||
950 | } | ||
951 | // ------------------------------------ | ||
952 | |||
926 | if (ParentID == 0) | 953 | if (ParentID == 0) |
927 | { | 954 | { |
928 | // Moved this from SendInitialData to ensure that Appearance is initialized | 955 | // Moved this from SendInitialData to ensure that Appearance is initialized |
@@ -1961,7 +1988,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1961 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); | 1988 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); |
1962 | 1989 | ||
1963 | MovingToTarget = false; | 1990 | MovingToTarget = false; |
1964 | MoveToPositionTarget = Vector3.Zero; | 1991 | // MoveToPositionTarget = Vector3.Zero; |
1992 | m_forceToApply = null; // cancel possible last action | ||
1965 | 1993 | ||
1966 | // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct | 1994 | // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct |
1967 | // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. | 1995 | // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. |
@@ -2080,9 +2108,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2080 | if (part == null) | 2108 | if (part == null) |
2081 | return; | 2109 | return; |
2082 | 2110 | ||
2083 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client | ||
2084 | // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it | ||
2085 | |||
2086 | if (PhysicsActor != null) | 2111 | if (PhysicsActor != null) |
2087 | m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; | 2112 | m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; |
2088 | 2113 | ||
@@ -2101,25 +2126,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2101 | } | 2126 | } |
2102 | else | 2127 | else |
2103 | { | 2128 | { |
2104 | // if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | 2129 | if (PhysicsSit(part,offset)) // physics engine |
2105 | // { | 2130 | return; |
2106 | // m_log.DebugFormat( | ||
2107 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", | ||
2108 | // Name, part.Name, part.LocalId); | ||
2109 | |||
2110 | if (m_scene.PhysicsScene != null && | ||
2111 | part.PhysActor != null && | ||
2112 | Util.GetDistanceTo(AbsolutePosition, pos) <= 30) | ||
2113 | { | ||
2114 | |||
2115 | Vector3 camdif = CameraPosition - part.AbsolutePosition; | ||
2116 | camdif.Normalize(); | ||
2117 | |||
2118 | // m_log.InfoFormat("sit {0} {1}", offset.ToString(), camdif.ToString()); | ||
2119 | |||
2120 | if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0) | ||
2121 | return; | ||
2122 | } | ||
2123 | 2131 | ||
2124 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | 2132 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) |
2125 | { | 2133 | { |
@@ -2127,22 +2135,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2127 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); | 2135 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); |
2128 | canSit = true; | 2136 | canSit = true; |
2129 | } | 2137 | } |
2130 | // else | ||
2131 | // { | ||
2132 | // m_log.DebugFormat( | ||
2133 | // "[SCENE PRESENCE]: Ignoring sit request of {0} on {1} {2} because sit target is unset and outside 10m", | ||
2134 | // Name, part.Name, part.LocalId); | ||
2135 | // } | ||
2136 | } | 2138 | } |
2137 | 2139 | ||
2138 | if (canSit) | 2140 | if (canSit) |
2139 | { | 2141 | { |
2142 | |||
2140 | if (PhysicsActor != null) | 2143 | if (PhysicsActor != null) |
2141 | { | 2144 | { |
2142 | // We can remove the physicsActor until they stand up. | 2145 | // We can remove the physicsActor until they stand up. |
2143 | RemoveFromPhysicalScene(); | 2146 | RemoveFromPhysicalScene(); |
2144 | } | 2147 | } |
2145 | 2148 | ||
2149 | if (MovingToTarget) | ||
2150 | ResetMoveToTarget(); | ||
2151 | |||
2152 | Velocity = Vector3.Zero; | ||
2153 | |||
2146 | part.AddSittingAvatar(UUID); | 2154 | part.AddSittingAvatar(UUID); |
2147 | 2155 | ||
2148 | cameraAtOffset = part.GetCameraAtOffset(); | 2156 | cameraAtOffset = part.GetCameraAtOffset(); |
@@ -2179,14 +2187,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2179 | m_requestedSitTargetID = part.LocalId; | 2187 | m_requestedSitTargetID = part.LocalId; |
2180 | m_requestedSitTargetUUID = targetID; | 2188 | m_requestedSitTargetUUID = targetID; |
2181 | 2189 | ||
2182 | // m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); | ||
2183 | |||
2184 | if (m_scene.PhysicsScene.SupportsRayCast()) | ||
2185 | { | ||
2186 | //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback()); | ||
2187 | //SitRayCastAvatarPosition(part); | ||
2188 | //return; | ||
2189 | } | ||
2190 | } | 2190 | } |
2191 | else | 2191 | else |
2192 | { | 2192 | { |
@@ -2196,28 +2196,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
2196 | SendSitResponse(targetID, offset, Quaternion.Identity); | 2196 | SendSitResponse(targetID, offset, Quaternion.Identity); |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) | 2199 | // returns false if does not suport so older sit can be tried |
2200 | public bool PhysicsSit(SceneObjectPart part, Vector3 offset) | ||
2200 | { | 2201 | { |
2202 | if (part == null || part.ParentGroup.IsAttachment) | ||
2203 | { | ||
2204 | return true; | ||
2205 | } | ||
2201 | 2206 | ||
2202 | if (status < 0) | 2207 | if ( m_scene.PhysicsScene == null) |
2208 | return false; | ||
2209 | |||
2210 | if (part.PhysActor == null) | ||
2203 | { | 2211 | { |
2204 | ControllingClient.SendAlertMessage("Sit position no longer exists"); | 2212 | // none physcis shape |
2205 | return; | 2213 | if (part.PhysicsShapeType == (byte)PhysicsShapeType.None) |
2214 | ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); | ||
2215 | else | ||
2216 | { // non physical phantom TODO | ||
2217 | ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); | ||
2218 | return false; | ||
2219 | } | ||
2220 | return true; | ||
2206 | } | 2221 | } |
2207 | 2222 | ||
2223 | |||
2224 | // not doing autopilot | ||
2225 | m_requestedSitTargetID = 0; | ||
2226 | |||
2227 | if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0) | ||
2228 | return true; | ||
2229 | |||
2230 | return false; | ||
2231 | } | ||
2232 | |||
2233 | |||
2234 | private bool CanEnterLandPosition(Vector3 testPos) | ||
2235 | { | ||
2236 | ILandObject land = m_scene.LandChannel.GetLandObject(testPos.X, testPos.Y); | ||
2237 | |||
2238 | if (land == null || land.LandData.Name == "NO_LAND") | ||
2239 | return true; | ||
2240 | |||
2241 | return land.CanBeOnThisLand(UUID,testPos.Z); | ||
2242 | } | ||
2243 | |||
2244 | // status | ||
2245 | // < 0 ignore | ||
2246 | // 0 bad sit spot | ||
2247 | public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) | ||
2248 | { | ||
2249 | if (status < 0) | ||
2250 | return; | ||
2251 | |||
2208 | if (status == 0) | 2252 | if (status == 0) |
2253 | { | ||
2254 | ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); | ||
2209 | return; | 2255 | return; |
2256 | } | ||
2210 | 2257 | ||
2211 | SceneObjectPart part = m_scene.GetSceneObjectPart(partID); | 2258 | SceneObjectPart part = m_scene.GetSceneObjectPart(partID); |
2212 | if (part == null || part.ParentGroup.IsAttachment) | 2259 | if (part == null) |
2260 | return; | ||
2261 | |||
2262 | Vector3 targetPos = part.GetWorldPosition() + offset * part.GetWorldRotation(); | ||
2263 | if(!CanEnterLandPosition(targetPos)) | ||
2213 | { | 2264 | { |
2265 | ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot"); | ||
2214 | return; | 2266 | return; |
2215 | } | 2267 | } |
2216 | |||
2217 | // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); | 2268 | // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); |
2218 | 2269 | ||
2270 | RemoveFromPhysicalScene(); | ||
2271 | |||
2272 | if (MovingToTarget) | ||
2273 | ResetMoveToTarget(); | ||
2274 | |||
2275 | Velocity = Vector3.Zero; | ||
2276 | |||
2219 | part.AddSittingAvatar(UUID); | 2277 | part.AddSittingAvatar(UUID); |
2220 | 2278 | ||
2279 | |||
2221 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); | 2280 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); |
2222 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 2281 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
2223 | bool forceMouselook = part.GetForceMouselook(); | 2282 | bool forceMouselook = part.GetForceMouselook(); |
@@ -2225,23 +2284,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2225 | ControllingClient.SendSitResponse( | 2284 | ControllingClient.SendSitResponse( |
2226 | part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); | 2285 | part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); |
2227 | 2286 | ||
2228 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 2287 | // not using autopilot |
2229 | |||
2230 | // assuming no autopilot in use | ||
2231 | Velocity = Vector3.Zero; | ||
2232 | RemoveFromPhysicalScene(); | ||
2233 | 2288 | ||
2234 | Rotation = Orientation; | 2289 | Rotation = Orientation; |
2235 | m_pos = offset; | 2290 | m_pos = offset; |
2236 | 2291 | ||
2237 | m_requestedSitTargetID = 0; // invalidate the viewer sit comand for now | 2292 | m_requestedSitTargetID = 0; |
2238 | part.ParentGroup.AddAvatar(UUID); | 2293 | part.ParentGroup.AddAvatar(UUID); |
2239 | 2294 | ||
2240 | ParentPart = part; | 2295 | ParentPart = part; |
2241 | ParentID = part.LocalId; | 2296 | ParentID = part.LocalId; |
2242 | 2297 | if(status == 3) | |
2243 | Animator.TrySetMovementAnimation("SIT"); | 2298 | Animator.TrySetMovementAnimation("SIT_GROUND"); |
2299 | else | ||
2300 | Animator.TrySetMovementAnimation("SIT"); | ||
2244 | SendAvatarDataToAllAgents(); | 2301 | SendAvatarDataToAllAgents(); |
2302 | |||
2303 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | ||
2245 | } | 2304 | } |
2246 | 2305 | ||
2247 | 2306 | ||
@@ -2260,6 +2319,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2260 | return; | 2319 | return; |
2261 | } | 2320 | } |
2262 | 2321 | ||
2322 | |||
2263 | if (part.SitTargetAvatar == UUID) | 2323 | if (part.SitTargetAvatar == UUID) |
2264 | { | 2324 | { |
2265 | Vector3 sitTargetPos = part.SitTargetPosition; | 2325 | Vector3 sitTargetPos = part.SitTargetPosition; |