mirror of
https://github.com/opensim/opensim.git
synced 2026-07-13 19:14:51 +08:00
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
This commit is contained in:
@@ -52,7 +52,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;
|
||||
@@ -2897,9 +2896,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2930,8 +2931,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9784,90 +9786,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)
|
||||
@@ -9923,4 +9846,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user