mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -53,7 +53,6 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||
using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
|
||||
@@ -3066,9 +3065,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||
|
||||
m_ScriptEngine.World.AttachObject(presence.ControllingClient,
|
||||
grp.LocalId, (uint)attachment, Quaternion.Identity,
|
||||
Vector3.Zero, false);
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
if (attachmentsModule != null)
|
||||
attachmentsModule.AttachObject(
|
||||
presence.ControllingClient, grp.LocalId,
|
||||
(uint)attachment, Quaternion.Identity, Vector3.Zero, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3105,8 +3106,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||
|
||||
m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID,
|
||||
presence.ControllingClient);
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
if (attachmentsModule != null)
|
||||
attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5598,12 +5600,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate);
|
||||
}
|
||||
|
||||
public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
List<SceneObjectPart> parts = GetLinkParts(linknumber);
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
|
||||
{
|
||||
|
||||
Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
|
||||
pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
|
||||
|
||||
//ALL_SIDES
|
||||
if (face == ScriptBaseClass.ALL_SIDES)
|
||||
face = 255;
|
||||
face = 255;
|
||||
|
||||
pTexAnim.Face = (uint)face;
|
||||
pTexAnim.Length = (float)length;
|
||||
@@ -5612,9 +5633,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
pTexAnim.SizeY = (uint)sizey;
|
||||
pTexAnim.Start = (float)start;
|
||||
|
||||
m_host.AddTextureAnimation(pTexAnim);
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.AddTextureAnimation(pTexAnim);
|
||||
part.SendFullUpdateToAllClients();
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
|
||||
@@ -6011,13 +6032,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return ps;
|
||||
}
|
||||
|
||||
public void llLinkParticleSystem(int linknumber, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
List<SceneObjectPart> parts = GetLinkParts(linknumber);
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
SetParticleSystem(part, rules);
|
||||
}
|
||||
}
|
||||
|
||||
public void llParticleSystem(LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
SetParticleSystem(m_host, rules);
|
||||
}
|
||||
|
||||
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
|
||||
|
||||
|
||||
if (rules.Length == 0)
|
||||
{
|
||||
m_host.RemoveParticleSystem();
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.RemoveParticleSystem();
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6128,7 +6167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
prules.Target = m_host.UUID;
|
||||
prules.Target = part.UUID;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -6154,10 +6193,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
prules.CRC = 1;
|
||||
|
||||
m_host.AddNewParticleSystem(prules);
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.AddNewParticleSystem(prules);
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
m_host.SendFullUpdateToAllClients();
|
||||
part.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
public void llGroundRepel(double height, int water, double tau)
|
||||
@@ -6966,6 +7005,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
SetPrimParams(part, rules);
|
||||
}
|
||||
|
||||
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
|
||||
{
|
||||
llSetLinkPrimitiveParams(linknumber, rules);
|
||||
}
|
||||
|
||||
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
|
||||
{
|
||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||
@@ -7324,6 +7368,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
face = rules.GetLSLIntegerItem(idx++);
|
||||
int style = rules.GetLSLIntegerItem(idx++);
|
||||
SetTexGen(part, face, style);
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_TEXT:
|
||||
if (remain < 3)
|
||||
return;
|
||||
string primText = rules.GetLSLStringItem(idx++);
|
||||
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
|
||||
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
|
||||
Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
|
||||
Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
|
||||
Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
|
||||
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -7568,6 +7624,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return GetLinkPrimitiveParams(m_host, rules);
|
||||
}
|
||||
|
||||
public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
List<SceneObjectPart> parts = GetLinkParts(linknumber);
|
||||
|
||||
LSL_List res = new LSL_List();
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
LSL_List partRes = GetLinkPrimitiveParams(part, rules);
|
||||
res += partRes;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
|
||||
{
|
||||
LSL_List res = new LSL_List();
|
||||
@@ -7951,6 +8024,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
res.Add(new LSL_Float(primglow));
|
||||
}
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_TEXT:
|
||||
Color4 textColor = part.GetTextColor();
|
||||
res.Add(part.Text);
|
||||
res.Add(new LSL_Vector(textColor.R,
|
||||
textColor.G,
|
||||
textColor.B));
|
||||
res.Add(new LSL_Float(textColor.A));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@@ -10050,90 +10131,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
Notecard nc = new Notecard();
|
||||
nc.lastRef = DateTime.Now;
|
||||
nc.text = ParseText(text.Replace("\r", "").Split('\n'));
|
||||
nc.text = SLUtil.ParseNotecardToList(text).ToArray();
|
||||
m_Notecards[assetID] = nc;
|
||||
}
|
||||
}
|
||||
|
||||
protected static string[] ParseText(string[] input)
|
||||
{
|
||||
int idx = 0;
|
||||
int level = 0;
|
||||
List<string> output = new List<string>();
|
||||
string[] words;
|
||||
|
||||
while (idx < input.Length)
|
||||
{
|
||||
if (input[idx] == "{")
|
||||
{
|
||||
level++;
|
||||
idx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input[idx]== "}")
|
||||
{
|
||||
level--;
|
||||
idx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
words = input[idx].Split(' '); // Linden text ver
|
||||
// Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
|
||||
if (words.Length < 3)
|
||||
return new String[0];
|
||||
|
||||
int version = int.Parse(words[3]);
|
||||
if (version != 2)
|
||||
return new String[0];
|
||||
break;
|
||||
case 1:
|
||||
words = input[idx].Split(' ');
|
||||
if (words[0] == "LLEmbeddedItems")
|
||||
break;
|
||||
if (words[0] == "Text")
|
||||
{
|
||||
int len = int.Parse(words[2]);
|
||||
idx++;
|
||||
|
||||
int count = -1;
|
||||
|
||||
while (count < len)
|
||||
{
|
||||
// int l = input[idx].Length;
|
||||
string ln = input[idx];
|
||||
|
||||
int need = len-count-1;
|
||||
if (ln.Length > need)
|
||||
ln = ln.Substring(0, need);
|
||||
|
||||
output.Add(ln);
|
||||
count += ln.Length + 1;
|
||||
idx++;
|
||||
}
|
||||
|
||||
return output.ToArray();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
words = input[idx].Split(' '); // count
|
||||
if (words[0] == "count")
|
||||
{
|
||||
int c = int.Parse(words[1]);
|
||||
if (c > 0)
|
||||
return new String[0];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
|
||||
public static bool IsCached(UUID assetID)
|
||||
{
|
||||
lock (m_Notecards)
|
||||
@@ -10189,4 +10191,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user