Formatting cleanup.

trunk
Jeff Ames 2009-07-28 09:40:07 +00:00
parent aec16c2a0a
commit a1786d4c39
1 changed files with 197 additions and 204 deletions

View File

@ -1849,16 +1849,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(200); ScriptSleep(200);
} }
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
// note linked setpos is capped "differently" // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end) // note linked setpos is capped "differently"
{ private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end)
if ( llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor ) { {
return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start); if (llVecDist(start, end) > 10.0f * m_ScriptDistanceFactor)
} else { return start + m_ScriptDistanceFactor * 10.0f * llVecNorm(end - start);
return end; else
} return end;
} }
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
{ {
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
@ -1867,32 +1868,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
if (part.ParentGroup == null) if (part.ParentGroup == null)
{ {
if ((targetPos.z < ground) && disable_underground_movement) if ((targetPos.z < ground) && disable_underground_movement)
targetPos.z = ground; targetPos.z = ground;
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); } part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
}
else if (part.ParentGroup.RootPart == part) else if (part.ParentGroup.RootPart == part)
{ {
if ((targetPos.z < ground) && disable_underground_movement) if ((targetPos.z < ground) && disable_underground_movement)
targetPos.z = ground; targetPos.z = ground;
SceneObjectGroup parent = part.ParentGroup; SceneObjectGroup parent = part.ParentGroup;
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
} }
else else
{ {
//it's late... i think this is right ? //it's late... i think this is right ?
if ( llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f ) if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f)
{ {
part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
SceneObjectGroup parent = part.ParentGroup; SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true; parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate(); parent.ScheduleGroupForTerseUpdate();
} }
} }
} }
public LSL_Vector llGetPos() public LSL_Vector llGetPos()
@ -1908,14 +1909,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentID != 0) if (m_host.ParentID != 0)
{ {
return new LSL_Vector(m_host.OffsetPosition.X, return new LSL_Vector(m_host.OffsetPosition.X,
m_host.OffsetPosition.Y, m_host.OffsetPosition.Y,
m_host.OffsetPosition.Z); m_host.OffsetPosition.Z);
} }
else else
{ {
return new LSL_Vector(m_host.AbsolutePosition.X, return new LSL_Vector(m_host.AbsolutePosition.X,
m_host.AbsolutePosition.Y, m_host.AbsolutePosition.Y,
m_host.AbsolutePosition.Z); m_host.AbsolutePosition.Z);
} }
} }
@ -2072,7 +2073,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0); m_host.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0);
} }
public void llSetTorque(LSL_Vector torque, int local) public void llSetTorque(LSL_Vector torque, int local)
@ -2512,9 +2512,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0; return 0;
} }
bool result bool result = money.ObjectGiveMoney(
= money.ObjectGiveMoney( m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
if (result) if (result)
return 1; return 1;
@ -3859,8 +3858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null) if (presence != null)
{ {
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID if (m_host.OwnerID == World.LandChannel.GetLandObject(
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
{ {
presence.ControllingClient.SendTeleportLocationStart(); presence.ControllingClient.SendTeleportLocationStart();
@ -3991,7 +3989,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 PusheePos = Vector3.Zero; Vector3 PusheePos = Vector3.Zero;
SceneObjectPart pusheeob = null; SceneObjectPart pusheeob = null;
ScenePresence avatar = World.GetScenePresence(targetID); ScenePresence avatar = World.GetScenePresence(targetID);
if (avatar != null) if (avatar != null)
{ {
@ -4439,7 +4436,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
} }
} }
} }
return UUID.Zero.ToString(); return UUID.Zero.ToString();
@ -5397,8 +5394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null) if (presence != null)
{ {
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID if (m_host.OwnerID == World.LandChannel.GetLandObject(
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
World.TeleportClientHome(agentId, presence.ControllingClient); World.TeleportClientHome(agentId, presence.ControllingClient);
} }
@ -5514,7 +5510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary> /// <summary>
/// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize
/// only the height of avatars vary and that says:- /// only the height of avatars vary and that says:
/// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
/// </summary> /// </summary>
public LSL_Vector llGetAgentSize(string id) public LSL_Vector llGetAgentSize(string id)
@ -7358,10 +7354,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// vector tapera // vector tapera
res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
// float revolutions, // float revolutions
res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :(
// float radiusoffset, // float radiusoffset
res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
// float skew // float skew
@ -9012,9 +9008,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["Network"] != null) if (config.Configs["Network"] != null)
{ {
shard shard = config.Configs["Network"].GetString(
= config.Configs["Network"].GetString( "user_server_url", "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString());
"user_server_url", "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString());
shard = config.Configs["Network"].GetString("shard", shard); shard = config.Configs["Network"].GetString("shard", shard);
} }
@ -9512,15 +9507,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string data = enc.GetString(a.Data); string data = enc.GetString(a.Data);
//m_log.Debug(data); //m_log.Debug(data);
NotecardCache.Cache(id, data); NotecardCache.Cache(id, data);
AsyncCommands. AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(),
DataserverPlugin.DataserverReply(id.ToString(), NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
}); });
ConditionalScriptSleep(100); ConditionalScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
} }
public class NotecardCache public class NotecardCache
@ -9532,7 +9525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
protected static Dictionary<UUID, Notecard> m_Notecards = protected static Dictionary<UUID, Notecard> m_Notecards =
new Dictionary<UUID, Notecard>(); new Dictionary<UUID, Notecard>();
public static void Cache(UUID assetID, string text) public static void Cache(UUID assetID, string text)
{ {