Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-06-12 00:17:18 +02:00
commit 124bf79658
5 changed files with 86 additions and 9 deletions

View File

@ -2992,10 +2992,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!m_rootPart.BlockGrab) if (!m_rootPart.BlockGrab)
{ {
Vector3 llmoveforce = pos - AbsolutePosition; /* Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce; Vector3 grabforce = llmoveforce;
grabforce = (grabforce / 10) * pa.Mass; grabforce = (grabforce / 10) * pa.Mass;
pa.AddForce(grabforce, true); */
// empirically convert distance diference to a impulse
Vector3 grabforce = pos - AbsolutePosition;
grabforce = grabforce * (pa.Mass/ 10.0f);
pa.AddForce(grabforce, false);
m_scene.PhysicsScene.AddPhysicsActorTaint(pa); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }

View File

@ -1051,6 +1051,7 @@ namespace OpenSim.Region.Framework.Scenes
IsChildAgent = true; IsChildAgent = true;
m_scene.SwapRootAgentCount(true); m_scene.SwapRootAgentCount(true);
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
ParentID = 0; // Child agents can't be sitting
// FIXME: Set RegionHandle to the region handle of the scene this agent is moving into // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into
@ -2091,6 +2092,9 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
{ {
if (IsChildAgent)
return;
if (ParentID != 0) if (ParentID != 0)
{ {
StandUp(); StandUp();
@ -2893,8 +2897,9 @@ namespace OpenSim.Region.Framework.Scenes
// If we don't have a PhysActor, we can't cross anyway // If we don't have a PhysActor, we can't cross anyway
// Also don't do this while sat, sitting avatars cross with the // Also don't do this while sat, sitting avatars cross with the
// object they sit on. // object they sit on. ParentUUID denoted a pending sit, don't
if (ParentID != 0 || PhysicsActor == null) // interfere with it.
if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
return; return;
if (!IsInTransit) if (!IsInTransit)

View File

@ -4732,10 +4732,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(5000); ScriptSleep(5000);
} }
public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID agentId = new UUID(); UUID agentId = new UUID();
Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
if (UUID.TryParse(agent, out agentId)) if (UUID.TryParse(agent, out agentId))
{ {
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentId);
@ -4744,26 +4748,84 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// agent must not be a god // agent must not be a god
if (presence.GodLevel >= 200) return; if (presence.GodLevel >= 200) return;
if (simname == String.Empty) if (destination == String.Empty)
simname = World.RegionInfo.RegionName; destination = World.RegionInfo.RegionName;
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject( if (m_host.OwnerID == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{ {
World.RequestTeleportLocation(presence.ControllingClient, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z), (uint)TeleportFlags.ViaLocation); DoLLTeleport(presence, destination, targetPos, targetLookAt);
} }
else // or must be wearing the prim else // or must be wearing the prim
{ {
if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
{ {
World.RequestTeleportLocation(presence.ControllingClient, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z), (uint)TeleportFlags.ViaLocation); DoLLTeleport(presence, destination, targetPos, targetLookAt);
} }
} }
} }
} }
} }
public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null && presence.PresenceType != PresenceType.Npc)
{
// agent must not be a god
if (presence.GodLevel >= 200) return;
// agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}
else // or must be wearing the prim
{
if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
{
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}
}
}
}
}
private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
{
UUID assetID = KeyOrName(destination);
// The destinaion is not an asset ID and also doesn't name a landmark.
// Use it as a sim name
if (assetID == UUID.Zero)
{
World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
return;
}
AssetBase lma = World.AssetService.Get(assetID.ToString());
if (lma == null)
return;
if (lma.Type != (sbyte)AssetType.Landmark)
return;
AssetLandmark lm = new AssetLandmark(lma);
World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}
public void llTextBox(string agent, string message, int chatChannel) public void llTextBox(string agent, string message, int chatChannel)
{ {
IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); IDialogModule dm = World.RequestModuleInterface<IDialogModule>();

View File

@ -402,6 +402,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llTargetRemove(int number); void llTargetRemove(int number);
void llTeleportAgentHome(string agent); void llTeleportAgentHome(string agent);
void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt);
void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt);
void llTextBox(string avatar, string message, int chat_channel); void llTextBox(string avatar, string message, int chat_channel);
LSL_String llToLower(string source); LSL_String llToLower(string source);
LSL_String llToUpper(string source); LSL_String llToUpper(string source);

View File

@ -1835,6 +1835,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt);
} }
public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt)
{
m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt);
}
public void llTeleportAgentHome(string agent) public void llTeleportAgentHome(string agent)
{ {
m_LSL_Functions.llTeleportAgentHome(agent); m_LSL_Functions.llTeleportAgentHome(agent);