mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Merge branch 'avination' into careminster
Conflicts: OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -618,18 +618,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
double x,y,z,s;
|
||||
v.x *= 0.5;
|
||||
v.y *= 0.5;
|
||||
v.z *= 0.5;
|
||||
double c1 = Math.Cos(v.x);
|
||||
double c2 = Math.Cos(v.y);
|
||||
double c1c2 = c1 * c2;
|
||||
double s1 = Math.Sin(v.x);
|
||||
double s2 = Math.Sin(v.y);
|
||||
double s1s2 = s1 * s2;
|
||||
double c1s2 = c1 * s2;
|
||||
double s1c2 = s1 * c2;
|
||||
double c3 = Math.Cos(v.z);
|
||||
double s3 = Math.Sin(v.z);
|
||||
|
||||
double c1 = Math.Cos(v.x * 0.5);
|
||||
double c2 = Math.Cos(v.y * 0.5);
|
||||
double c3 = Math.Cos(v.z * 0.5);
|
||||
double s1 = Math.Sin(v.x * 0.5);
|
||||
double s2 = Math.Sin(v.y * 0.5);
|
||||
double s3 = Math.Sin(v.z * 0.5);
|
||||
|
||||
x = s1 * c2 * c3 + c1 * s2 * s3;
|
||||
y = c1 * s2 * c3 - s1 * c2 * s3;
|
||||
z = s1 * s2 * c3 + c1 * c2 * s3;
|
||||
s = c1 * c2 * c3 - s1 * s2 * s3;
|
||||
x = s1c2 * c3 + c1s2 * s3;
|
||||
y = c1s2 * c3 - s1c2 * s3;
|
||||
z = s1s2 * c3 + c1c2 * s3;
|
||||
s = c1c2 * c3 - s1s2 * s3;
|
||||
|
||||
return new LSL_Rotation(x, y, z, s);
|
||||
}
|
||||
@@ -1869,11 +1875,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||
Color4 texcolor;
|
||||
LSL_Vector rgb = new LSL_Vector();
|
||||
int nsides = GetNumberOfSides(part);
|
||||
|
||||
if (face == ScriptBaseClass.ALL_SIDES)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < GetNumberOfSides(part); i++)
|
||||
for (i = 0; i < nsides; i++)
|
||||
{
|
||||
texcolor = tex.GetFace((uint)i).RGBA;
|
||||
rgb.x += texcolor.R;
|
||||
@@ -1881,14 +1888,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
rgb.z += texcolor.B;
|
||||
}
|
||||
|
||||
rgb.x /= (float)GetNumberOfSides(part);
|
||||
rgb.y /= (float)GetNumberOfSides(part);
|
||||
rgb.z /= (float)GetNumberOfSides(part);
|
||||
float invnsides = 1.0f / (float)nsides;
|
||||
|
||||
rgb.x *= invnsides;
|
||||
rgb.y *= invnsides;
|
||||
rgb.z *= invnsides;
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
||||
if (face >= 0 && face < GetNumberOfSides(part))
|
||||
if (face >= 0 && face < nsides)
|
||||
{
|
||||
texcolor = tex.GetFace((uint)face).RGBA;
|
||||
rgb.x = texcolor.R;
|
||||
@@ -2288,15 +2296,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// (root prim). ParentID may be nonzero in attachments and
|
||||
// using it would cause attachments and HUDs to rotate
|
||||
// to the wrong positions.
|
||||
|
||||
SetRot(m_host, Rot2Quaternion(rot));
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
|
||||
SceneObjectPart rootPart = m_host.ParentGroup.RootPart;
|
||||
if (rootPart != null) // better safe than sorry
|
||||
SceneObjectPart rootPart;
|
||||
if (m_host.ParentGroup != null) // better safe than sorry
|
||||
{
|
||||
SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
|
||||
rootPart = m_host.ParentGroup.RootPart;
|
||||
if (rootPart != null)
|
||||
SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2306,6 +2317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llSetLocalRot(LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
SetRot(m_host, Rot2Quaternion(rot));
|
||||
ScriptSleep(200);
|
||||
}
|
||||
@@ -2315,25 +2327,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
part.UpdateRotation(rot);
|
||||
// Update rotation does not move the object in the physics scene if it's a linkset.
|
||||
bool isroot = (part == part.ParentGroup.RootPart);
|
||||
bool isphys;
|
||||
|
||||
//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
|
||||
// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
|
||||
|
||||
// So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
|
||||
// is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
|
||||
// It's perfectly okay when the object is not an active physical body though.
|
||||
// So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against
|
||||
// but only if the object is not physial and active. This is important for rotating doors.
|
||||
// without the absoluteposition = absoluteposition happening, the doors do not move in the physics
|
||||
// scene
|
||||
PhysicsActor pa = part.PhysActor;
|
||||
|
||||
if (pa != null && !pa.IsPhysical && part == part.ParentGroup.RootPart)
|
||||
// keep using physactor ideia of isphysical
|
||||
// it should be SOP ideia of that
|
||||
// not much of a issue with ubitODE
|
||||
if (pa != null && pa.IsPhysical)
|
||||
isphys = true;
|
||||
else
|
||||
isphys = false;
|
||||
|
||||
// SL doesn't let scripts rotate root of physical linksets
|
||||
if (isroot && isphys)
|
||||
return;
|
||||
|
||||
part.UpdateRotation(rot);
|
||||
|
||||
// Update rotation does not move the object in the physics engine if it's a non physical linkset
|
||||
// so do a nasty update of parts positions if is a root part rotation
|
||||
if (isroot && pa != null) // with if above implies non physical root part
|
||||
{
|
||||
part.ParentGroup.ResetChildPrimPhysicsPositions();
|
||||
}
|
||||
else // fix sitting avatars. This is only needed bc of how we link avas to child parts, not root part
|
||||
{
|
||||
List<ScenePresence> sittingavas = part.ParentGroup.GetLinkedAvatars();
|
||||
if (sittingavas.Count > 0)
|
||||
{
|
||||
foreach (ScenePresence av in sittingavas)
|
||||
{
|
||||
if (isroot || part.LocalId == av.ParentID)
|
||||
av.SendTerseUpdateToAllClients();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2382,7 +2412,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Rotation llGetLocalRot()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Rotation(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W);
|
||||
Quaternion rot = m_host.RotationOffset;
|
||||
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
|
||||
}
|
||||
|
||||
public void llSetForce(LSL_Vector force, int local)
|
||||
@@ -2466,6 +2497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.ApplyImpulse(v, local != 0);
|
||||
}
|
||||
|
||||
|
||||
public void llApplyRotationalImpulse(LSL_Vector force, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -2492,6 +2524,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
llSetTorque(torque, local);
|
||||
}
|
||||
|
||||
public void llSetVelocity(LSL_Vector vel, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0);
|
||||
}
|
||||
|
||||
public LSL_Vector llGetVel()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -2518,10 +2556,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z);
|
||||
}
|
||||
|
||||
|
||||
public void llSetAngularVelocity(LSL_Vector avel, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// Still not done !!!!
|
||||
// m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0);
|
||||
}
|
||||
|
||||
public LSL_Vector llGetOmega()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Vector(m_host.AngularVelocity.X, m_host.AngularVelocity.Y, m_host.AngularVelocity.Z);
|
||||
Vector3 avel = m_host.AngularVelocity;
|
||||
return new LSL_Vector(avel.X, avel.Y, avel.Z);
|
||||
}
|
||||
|
||||
public LSL_Float llGetTimeOfDay()
|
||||
@@ -7740,7 +7787,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
Quaternion srot = sitpart.RotationOffset;
|
||||
rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
|
||||
av.Rotation = rot;
|
||||
av.SendAvatarDataToAllAgents();
|
||||
// av.SendAvatarDataToAllAgents();
|
||||
av.SendTerseUpdateToAllClients();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -7760,7 +7808,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
|
||||
}
|
||||
av.Rotation = rot;
|
||||
av.SendAvatarDataToAllAgents();
|
||||
// av.SendAvatarDataToAllAgents();
|
||||
av.SendTerseUpdateToAllClients();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -7855,7 +7904,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
positionChanged = false;
|
||||
av.OffsetPosition = finalPos;
|
||||
av.SendAvatarDataToAllAgents();
|
||||
// av.SendAvatarDataToAllAgents();
|
||||
av.SendTerseUpdateToAllClients();
|
||||
}
|
||||
|
||||
LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
|
||||
@@ -7871,7 +7921,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (positionChanged)
|
||||
{
|
||||
av.OffsetPosition = finalPos;
|
||||
av.SendAvatarDataToAllAgents();
|
||||
// av.SendAvatarDataToAllAgents();
|
||||
av.SendTerseUpdateToAllClients();
|
||||
positionChanged = false;
|
||||
}
|
||||
}
|
||||
@@ -8280,6 +8331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
|
||||
if (remain < 1)
|
||||
return;
|
||||
|
||||
LSL_Rotation lr = rules.GetQuaternionItem(idx++);
|
||||
SetRot(part, Rot2Quaternion(lr));
|
||||
break;
|
||||
@@ -8379,10 +8431,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
public LSL_String llXorBase64Strings(string str1, string str2)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
Deprecated("llXorBase64Strings");
|
||||
string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
ScriptSleep(300);
|
||||
return String.Empty;
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (str1 == String.Empty)
|
||||
return String.Empty;
|
||||
if (str2 == String.Empty)
|
||||
return str1;
|
||||
|
||||
int len = str2.Length;
|
||||
if ((len % 4) != 0) // LL is EVIL!!!!
|
||||
{
|
||||
while (str2.EndsWith("="))
|
||||
str2 = str2.Substring(0, str2.Length - 1);
|
||||
|
||||
len = str2.Length;
|
||||
int mod = len % 4;
|
||||
|
||||
if (mod == 1)
|
||||
str2 = str2.Substring(0, str2.Length - 1);
|
||||
else if (mod == 2)
|
||||
str2 += "==";
|
||||
else if (mod == 3)
|
||||
str2 += "=";
|
||||
}
|
||||
|
||||
byte[] data1;
|
||||
byte[] data2;
|
||||
try
|
||||
{
|
||||
data1 = Convert.FromBase64String(str1);
|
||||
data2 = Convert.FromBase64String(str2);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return new LSL_String(String.Empty);
|
||||
}
|
||||
|
||||
// For cases where the decoded length of s2 is greater
|
||||
// than the decoded length of s1, simply perform a normal
|
||||
// decode and XOR
|
||||
//
|
||||
if (data2.Length >= data1.Length)
|
||||
{
|
||||
for (int pos = 0 ; pos < data1.Length ; pos++ )
|
||||
data1[pos] ^= data2[pos];
|
||||
|
||||
return Convert.ToBase64String(data1);
|
||||
}
|
||||
|
||||
// Remove padding
|
||||
while (str1.EndsWith("="))
|
||||
str1 = str1.Substring(0, str1.Length - 1);
|
||||
while (str2.EndsWith("="))
|
||||
str2 = str2.Substring(0, str2.Length - 1);
|
||||
|
||||
byte[] d1 = new byte[str1.Length];
|
||||
byte[] d2 = new byte[str2.Length];
|
||||
|
||||
for (int i = 0 ; i < str1.Length ; i++)
|
||||
{
|
||||
int idx = b64.IndexOf(str1.Substring(i, 1));
|
||||
if (idx == -1)
|
||||
idx = 0;
|
||||
d1[i] = (byte)idx;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < str2.Length ; i++)
|
||||
{
|
||||
int idx = b64.IndexOf(str2.Substring(i, 1));
|
||||
if (idx == -1)
|
||||
idx = 0;
|
||||
d2[i] = (byte)idx;
|
||||
}
|
||||
|
||||
string output = String.Empty;
|
||||
|
||||
for (int pos = 0 ; pos < d1.Length ; pos++)
|
||||
output += b64[d1[pos] ^ d2[pos % d2.Length]];
|
||||
|
||||
while (output.Length % 3 > 0)
|
||||
output += "=";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public void llRemoteDataSetRegion()
|
||||
@@ -12254,7 +12387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL);
|
||||
|
||||
|
||||
if (false)// World.SuportsRayCastFiltered())
|
||||
if (World.SuportsRayCastFiltered())
|
||||
{
|
||||
if (dist == 0)
|
||||
return list;
|
||||
|
||||
@@ -332,6 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llSensorRemove();
|
||||
void llSensorRepeat(string name, string id, int type, double range, double arc, double rate);
|
||||
void llSetAlpha(double alpha, int face);
|
||||
void llSetAngularVelocity(LSL_Vector angvelocity, int local);
|
||||
void llSetBuoyancy(double buoyancy);
|
||||
void llSetCameraAtOffset(LSL_Vector offset);
|
||||
void llSetCameraEyeOffset(LSL_Vector offset);
|
||||
@@ -381,6 +382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llSetVehicleRotationParam(int param, LSL_Rotation rot);
|
||||
void llSetVehicleType(int type);
|
||||
void llSetVehicleVectorParam(int param, LSL_Vector vec);
|
||||
void llSetVelocity(LSL_Vector velocity, int local);
|
||||
void llShout(int channelID, string text);
|
||||
LSL_Float llSin(double f);
|
||||
void llSitTarget(LSL_Vector offset, LSL_Rotation rot);
|
||||
|
||||
@@ -1495,6 +1495,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llSetAlpha(alpha, face);
|
||||
}
|
||||
|
||||
public void llSetAngularVelocity(LSL_Vector angvelocity, int local)
|
||||
{
|
||||
m_LSL_Functions.llSetAngularVelocity(angvelocity, local);
|
||||
}
|
||||
|
||||
public void llSetBuoyancy(double buoyancy)
|
||||
{
|
||||
m_LSL_Functions.llSetBuoyancy(buoyancy);
|
||||
@@ -1730,6 +1735,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llSetVehicleVectorParam(param, vec);
|
||||
}
|
||||
|
||||
public void llSetVelocity(LSL_Vector velocity, int local)
|
||||
{
|
||||
m_LSL_Functions.llSetVelocity(velocity, local);
|
||||
}
|
||||
|
||||
public void llShout(int channelID, string text)
|
||||
{
|
||||
m_LSL_Functions.llShout(channelID, text);
|
||||
|
||||
Reference in New Issue
Block a user