Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
1afae01311
|
@ -79,14 +79,7 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
ret.PrincipalID = principalID;
|
ret.PrincipalID = principalID;
|
||||||
|
|
||||||
if (m_ColumnNames == null)
|
CheckColumnNames(result);
|
||||||
{
|
|
||||||
m_ColumnNames = new List<string>();
|
|
||||||
|
|
||||||
DataTable schemaTable = result.GetSchemaTable();
|
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
|
||||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string s in m_ColumnNames)
|
foreach (string s in m_ColumnNames)
|
||||||
{
|
{
|
||||||
|
@ -105,6 +98,20 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckColumnNames(IDataReader result)
|
||||||
|
{
|
||||||
|
if (m_ColumnNames != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<string> columnNames = new List<string>();
|
||||||
|
|
||||||
|
DataTable schemaTable = result.GetSchemaTable();
|
||||||
|
foreach (DataRow row in schemaTable.Rows)
|
||||||
|
columnNames.Add(row["ColumnName"].ToString());
|
||||||
|
|
||||||
|
m_ColumnNames = columnNames;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Store(AuthenticationData data)
|
public bool Store(AuthenticationData data)
|
||||||
{
|
{
|
||||||
if (data.Data.ContainsKey("UUID"))
|
if (data.Data.ContainsKey("UUID"))
|
||||||
|
|
|
@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL
|
||||||
if (m_ColumnNames != null)
|
if (m_ColumnNames != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ColumnNames = new List<string>();
|
List<string> columnNames = new List<string>();
|
||||||
|
|
||||||
DataTable schemaTable = reader.GetSchemaTable();
|
DataTable schemaTable = reader.GetSchemaTable();
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
foreach (DataRow row in schemaTable.Rows)
|
||||||
{
|
{
|
||||||
if (row["ColumnName"] != null &&
|
if (row["ColumnName"] != null &&
|
||||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
columnNames.Add(row["ColumnName"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ColumnNames = columnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T[] Get(string field, string key)
|
public virtual T[] Get(string field, string key)
|
||||||
|
|
|
@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL
|
||||||
ret.sizeX = Convert.ToInt32(result["sizeX"]);
|
ret.sizeX = Convert.ToInt32(result["sizeX"]);
|
||||||
ret.sizeY = Convert.ToInt32(result["sizeY"]);
|
ret.sizeY = Convert.ToInt32(result["sizeY"]);
|
||||||
|
|
||||||
if (m_ColumnNames == null)
|
CheckColumnNames(result);
|
||||||
{
|
|
||||||
m_ColumnNames = new List<string>();
|
|
||||||
|
|
||||||
DataTable schemaTable = result.GetSchemaTable();
|
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
|
||||||
{
|
|
||||||
if (row["ColumnName"] != null)
|
|
||||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string s in m_ColumnNames)
|
foreach (string s in m_ColumnNames)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL
|
||||||
if (s == "locY")
|
if (s == "locY")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret.Data[s] = result[s].ToString();
|
object value = result[s];
|
||||||
|
if (value is DBNull)
|
||||||
|
ret.Data[s] = null;
|
||||||
|
else
|
||||||
|
ret.Data[s] = result[s].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
retList.Add(ret);
|
retList.Add(ret);
|
||||||
|
@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckColumnNames(IDataReader result)
|
||||||
|
{
|
||||||
|
if (m_ColumnNames != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<string> columnNames = new List<string>();
|
||||||
|
|
||||||
|
DataTable schemaTable = result.GetSchemaTable();
|
||||||
|
foreach (DataRow row in schemaTable.Rows)
|
||||||
|
{
|
||||||
|
if (row["ColumnName"] != null)
|
||||||
|
columnNames.Add(row["ColumnName"].ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ColumnNames = columnNames;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Store(RegionData data)
|
public bool Store(RegionData data)
|
||||||
{
|
{
|
||||||
if (data.Data.ContainsKey("uuid"))
|
if (data.Data.ContainsKey("uuid"))
|
||||||
|
|
|
@ -296,6 +296,10 @@ namespace OpenSim.Framework.Console
|
||||||
matches[0].Groups["Category"].Value);
|
matches[0].Groups["Category"].Value);
|
||||||
System.Console.Write("]:");
|
System.Console.Write("]:");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outText = outText.Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level == "error")
|
if (level == "error")
|
||||||
|
|
|
@ -51,10 +51,12 @@ namespace OpenSim.Framework
|
||||||
protected object m_senderObject;
|
protected object m_senderObject;
|
||||||
protected ChatTypeEnum m_type;
|
protected ChatTypeEnum m_type;
|
||||||
protected UUID m_fromID;
|
protected UUID m_fromID;
|
||||||
|
protected UUID m_toID;
|
||||||
|
|
||||||
public OSChatMessage()
|
public OSChatMessage()
|
||||||
{
|
{
|
||||||
m_position = new Vector3();
|
m_position = new Vector3();
|
||||||
|
m_toID = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -102,6 +104,15 @@ namespace OpenSim.Framework
|
||||||
set { m_from = value; }
|
set { m_from = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the sender (needed for scripts)
|
||||||
|
/// </summary>
|
||||||
|
public string To
|
||||||
|
{
|
||||||
|
get { return m_from; }
|
||||||
|
set { m_from = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#region IEventArgs Members
|
#region IEventArgs Members
|
||||||
|
|
||||||
/// TODO: Sender and SenderObject should just be Sender and of
|
/// TODO: Sender and SenderObject should just be Sender and of
|
||||||
|
@ -131,6 +142,15 @@ namespace OpenSim.Framework
|
||||||
set { m_fromID = value; }
|
set { m_fromID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The single recipient or all if not set.
|
||||||
|
/// </summary>
|
||||||
|
public UUID TargetUUID
|
||||||
|
{
|
||||||
|
get { return m_toID; }
|
||||||
|
set { m_toID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -662,11 +662,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace);
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||||
SendHTML500(response);
|
SendHTML500(response);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -143,7 +143,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace);
|
UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId;
|
||||||
|
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}",
|
||||||
|
attach.ItemID, attach.AssetID, p, agentId, e.Message, e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
lock (sp.AttachmentsSyncLock)
|
lock (sp.AttachmentsSyncLock)
|
||||||
{
|
{
|
||||||
// Save avatar attachment information
|
// Save avatar attachment information
|
||||||
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
|
// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
|
||||||
|
|
||||||
bool changed = sp.Appearance.DetachAttachment(itemID);
|
bool changed = sp.Appearance.DetachAttachment(itemID);
|
||||||
if (changed && m_scene.AvatarFactory != null)
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
|
@ -469,9 +471,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
|
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
// "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||||
grp.UUID, grp.AttachmentPoint);
|
// grp.UUID, grp.AttachmentPoint);
|
||||||
|
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||||
|
|
||||||
|
@ -502,12 +504,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
// "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||||
grp.UUID, grp.AttachmentPoint);
|
// grp.UUID, grp.AttachmentPoint);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -889,13 +891,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
// m_log.Debug(
|
||||||
|
// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||||
|
// + ", AttachmentPoint: " + AttachmentPt);
|
||||||
|
|
||||||
// Save avatar attachment information
|
// Save avatar attachment information
|
||||||
m_log.Debug(
|
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
||||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
|
||||||
+ ", AttachmentPoint: " + AttachmentPt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
// Process the baked texture array
|
// Process the baked texture array
|
||||||
if (textureEntry != null)
|
if (textureEntry != null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
|
// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
|
||||||
|
|
||||||
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
||||||
|
|
||||||
|
@ -208,7 +208,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
||||||
if (sp == null)
|
if (sp == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
|
// This is expected if the user has gone away.
|
||||||
|
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,10 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
if (bakedTextureFace == null)
|
if (bakedTextureFace == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
// This can happen legitimately, since some baked textures might not exist
|
||||||
"[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
|
//m_log.WarnFormat(
|
||||||
bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
// "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
|
||||||
|
// bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
|
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
|
||||||
|
|
||||||
// If we only found default textures, then the appearance is not cached
|
// If we only found default textures, then the appearance is not cached
|
||||||
return (defonly ? false : true);
|
return (defonly ? false : true);
|
||||||
|
@ -417,7 +418,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
||||||
|
|
||||||
int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
|
int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
|
||||||
bakedTextures[bakeType] = faceTextures[ftIndex];
|
Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture
|
||||||
|
bakedTextures[bakeType] = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bakedTextures;
|
return bakedTextures;
|
||||||
|
@ -482,7 +484,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
ScenePresence sp = m_scene.GetScenePresence(agentid);
|
ScenePresence sp = m_scene.GetScenePresence(agentid);
|
||||||
if (sp == null)
|
if (sp == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
|
// This is expected if the user has gone away.
|
||||||
|
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||||
{
|
{
|
||||||
string fromName = c.From;
|
string fromName = c.From;
|
||||||
UUID fromID = UUID.Zero;
|
UUID fromID = UUID.Zero;
|
||||||
|
UUID targetID = c.TargetUUID;
|
||||||
string message = c.Message;
|
string message = c.Message;
|
||||||
IScene scene = c.Scene;
|
IScene scene = c.Scene;
|
||||||
Vector3 fromPos = c.Position;
|
Vector3 fromPos = c.Position;
|
||||||
|
@ -221,22 +222,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||||
message = message.Substring(0, 1000);
|
message = message.Substring(0, 1000);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
|
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}",
|
||||||
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
|
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID);
|
||||||
|
|
||||||
HashSet<UUID> receiverIDs = new HashSet<UUID>();
|
HashSet<UUID> receiverIDs = new HashSet<UUID>();
|
||||||
|
|
||||||
foreach (Scene s in m_scenes)
|
foreach (Scene s in m_scenes)
|
||||||
{
|
{
|
||||||
// This should use ForEachClient, but clients don't have a position.
|
if (targetID == UUID.Zero)
|
||||||
// If camera is moved into client, then camera position can be used
|
{
|
||||||
s.ForEachRootScenePresence(
|
// This should use ForEachClient, but clients don't have a position.
|
||||||
delegate(ScenePresence presence)
|
// If camera is moved into client, then camera position can be used
|
||||||
|
s.ForEachRootScenePresence(
|
||||||
|
delegate(ScenePresence presence)
|
||||||
|
{
|
||||||
|
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false))
|
||||||
|
receiverIDs.Add(presence.UUID);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is a send to a specific client eg from llRegionSayTo
|
||||||
|
// no need to check distance etc, jand send is as say
|
||||||
|
ScenePresence presence = s.GetScenePresence(targetID);
|
||||||
|
if (presence != null && !presence.IsChildAgent)
|
||||||
{
|
{
|
||||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType))
|
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true))
|
||||||
receiverIDs.Add(presence.UUID);
|
receiverIDs.Add(presence.UUID);
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(scene as Scene).EventManager.TriggerOnChatToClients(
|
(scene as Scene).EventManager.TriggerOnChatToClients(
|
||||||
|
@ -315,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||||
/// precondition</returns>
|
/// precondition</returns>
|
||||||
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
|
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
|
||||||
UUID fromAgentID, string fromName, ChatTypeEnum type,
|
UUID fromAgentID, string fromName, ChatTypeEnum type,
|
||||||
string message, ChatSourceType src)
|
string message, ChatSourceType src, bool ignoreDistance)
|
||||||
{
|
{
|
||||||
// don't send stuff to child agents
|
// don't send stuff to child agents
|
||||||
if (presence.IsChildAgent) return false;
|
if (presence.IsChildAgent) return false;
|
||||||
|
@ -327,11 +342,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||||
|
|
||||||
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
|
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
|
||||||
|
|
||||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
if (!ignoreDistance)
|
||||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
|
||||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
|
||||||
{
|
{
|
||||||
return false;
|
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||||
|
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||||
|
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
||||||
|
|
|
@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
Scene scene = (Scene)(client.Scene);
|
Scene scene = (Scene)(client.Scene);
|
||||||
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
||||||
|
|
||||||
|
// Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given
|
||||||
|
// a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on
|
||||||
|
// arrival.
|
||||||
|
//
|
||||||
|
// Ideally we would give the exact float position adjusting for the relative height of the two avatars
|
||||||
|
// but it looks like a float component isn't possible with a parcel ID.
|
||||||
UUID dest = Util.BuildFakeParcelID(
|
UUID dest = Util.BuildFakeParcelID(
|
||||||
scene.RegionInfo.RegionHandle,
|
scene.RegionInfo.RegionHandle,
|
||||||
(uint)presence.AbsolutePosition.X,
|
(uint)presence.AbsolutePosition.X,
|
||||||
(uint)presence.AbsolutePosition.Y,
|
(uint)presence.AbsolutePosition.Y,
|
||||||
(uint)presence.AbsolutePosition.Z);
|
(uint)Math.Ceiling(presence.AbsolutePosition.Z));
|
||||||
|
|
||||||
m_log.DebugFormat("TP invite with message {0}", message);
|
m_log.DebugFormat("TP invite with message {0}", message);
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
set { m_MaxTransferDistance = value; }
|
set { m_MaxTransferDistance = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int m_levelHGTeleport = 0;
|
|
||||||
|
|
||||||
protected bool m_Enabled = false;
|
protected bool m_Enabled = false;
|
||||||
protected Scene m_aScene;
|
protected Scene m_aScene;
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (transferConfig != null)
|
if (transferConfig != null)
|
||||||
{
|
{
|
||||||
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
||||||
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_agentsInTransit = new List<UUID>();
|
m_agentsInTransit = new List<UUID>();
|
||||||
|
@ -172,13 +169,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// Reset animations; the viewer does that in teleports.
|
// Reset animations; the viewer does that in teleports.
|
||||||
sp.Animator.ResetAnimations();
|
sp.Animator.ResetAnimations();
|
||||||
|
|
||||||
|
string destinationRegionName = "(not found)";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
|
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
|
||||||
{
|
{
|
||||||
|
destinationRegionName = sp.Scene.RegionInfo.RegionName;
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
|
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation for {0} to {1} within existing region {2}",
|
||||||
position, sp.Scene.RegionInfo.RegionName);
|
sp.Name, position, destinationRegionName);
|
||||||
|
|
||||||
// Teleport within the same region
|
// Teleport within the same region
|
||||||
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
||||||
|
@ -188,6 +189,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
|
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
|
||||||
position, sp.Name, sp.UUID, emergencyPos);
|
position, sp.Name, sp.UUID, emergencyPos);
|
||||||
|
|
||||||
position = emergencyPos;
|
position = emergencyPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||||
|
|
||||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||||
|
sp.Velocity = Vector3.Zero;
|
||||||
sp.Teleport(position);
|
sp.Teleport(position);
|
||||||
|
|
||||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||||
|
@ -233,15 +236,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if HyperGrid teleport is allowed, based on user level
|
destinationRegionName = finalDestination.RegionName;
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID);
|
|
||||||
|
|
||||||
if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
|
|
||||||
sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint curX = 0, curY = 0;
|
uint curX = 0, curY = 0;
|
||||||
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
||||||
|
@ -307,7 +302,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace);
|
m_log.ErrorFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
|
||||||
|
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
|
||||||
sp.ControllingClient.SendTeleportFailed("Internal error");
|
sp.ControllingClient.SendTeleportFailed("Internal error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +401,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
bool logout = false;
|
bool logout = false;
|
||||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}",
|
||||||
reason));
|
reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Initialized = false;
|
private bool m_Initialized = false;
|
||||||
|
private int m_levelHGTeleport = 0;
|
||||||
|
|
||||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
|
IConfig transferConfig = source.Configs["EntityTransfer"];
|
||||||
|
if (transferConfig != null)
|
||||||
|
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
||||||
|
|
||||||
InitialiseCommon(source);
|
InitialiseCommon(source);
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
{
|
{
|
||||||
// this user is going to another grid
|
// this user is going to another grid
|
||||||
|
// check if HyperGrid teleport is allowed, based on user level
|
||||||
|
if (sp.UserLevel < m_levelHGTeleport)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
|
||||||
|
reason = "HyperGrid teleport not permitted";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||||
{
|
{
|
||||||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||||
|
|
|
@ -308,56 +308,56 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
/// <param name='msg'>
|
/// <param name='msg'>
|
||||||
/// Message.
|
/// Message.
|
||||||
/// </param>
|
/// </param>
|
||||||
public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
|
public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg)
|
||||||
{
|
{
|
||||||
error = null;
|
|
||||||
// Is id an avatar?
|
// Is id an avatar?
|
||||||
ScenePresence sp = m_scene.GetScenePresence(target);
|
ScenePresence sp = m_scene.GetScenePresence(target);
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
// Send message to avatar
|
// ignore if a child agent this is restricted to inside one region
|
||||||
|
if (sp.IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Send message to the avatar.
|
||||||
|
// Channel zero only goes to the avatar
|
||||||
|
// non zero channel messages only go to the attachments
|
||||||
if (channel == 0)
|
if (channel == 0)
|
||||||
{
|
{
|
||||||
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false);
|
m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
|
||||||
|
|
||||||
if (attachments.Count == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Get uuid of attachments
|
|
||||||
List<UUID> targets = new List<UUID>();
|
|
||||||
foreach (SceneObjectGroup sog in attachments)
|
|
||||||
{
|
{
|
||||||
if (!sog.IsDeleted)
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
targets.Add(sog.UUID);
|
if (attachments.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get uuid of attachments
|
||||||
|
List<UUID> targets = new List<UUID>();
|
||||||
|
foreach (SceneObjectGroup sog in attachments)
|
||||||
|
{
|
||||||
|
if (!sog.IsDeleted)
|
||||||
|
targets.Add(sog.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to check each attachment
|
||||||
|
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||||
|
{
|
||||||
|
if (li.GetHostID().Equals(id))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (targets.Contains(li.GetHostID()))
|
||||||
|
QueueMessage(new ListenerInfo(li, name, id, msg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to check each attachment
|
return;
|
||||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
|
||||||
{
|
|
||||||
if (li.GetHostID().Equals(id))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (targets.Contains(li.GetHostID()))
|
|
||||||
QueueMessage(new ListenerInfo(li, name, id, msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Need to toss an error here
|
|
||||||
if (channel == 0)
|
|
||||||
{
|
|
||||||
error = "Cannot use llRegionSayTo to message objects on channel 0";
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No avatar found so look for an object
|
||||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||||
{
|
{
|
||||||
// Dont process if this message is from yourself!
|
// Dont process if this message is from yourself!
|
||||||
|
@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void QueueMessage(ListenerInfo li)
|
protected void QueueMessage(ListenerInfo li)
|
||||||
|
|
|
@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
// Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||||
|
|
||||||
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
|
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SceneObjectPart CreateSceneObjectPart2()
|
protected SceneObjectPart CreateSceneObjectPart2()
|
||||||
|
|
|
@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
int tc = 0;
|
int tc = 0;
|
||||||
double[,] hm = whichScene.Heightmap.GetDoubles();
|
double[,] hm = whichScene.Heightmap.GetDoubles();
|
||||||
tc = Environment.TickCount;
|
tc = Environment.TickCount;
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
||||||
EntityBase[] objs = whichScene.GetEntities();
|
EntityBase[] objs = whichScene.GetEntities();
|
||||||
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
|
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
|
||||||
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
|
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
|
||||||
|
@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
g.Dispose();
|
g.Dispose();
|
||||||
} // lock entities objs
|
} // lock entities objs
|
||||||
|
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
|
||||||
return mapbmp;
|
return mapbmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
public void TerrainToBitmap(Bitmap mapbmp)
|
public void TerrainToBitmap(Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
int tc = Environment.TickCount;
|
int tc = Environment.TickCount;
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||||
|
|
||||||
double[,] hm = m_scene.Heightmap.GetDoubles();
|
double[,] hm = m_scene.Heightmap.GetDoubles();
|
||||||
bool ShadowDebugContinue = true;
|
bool ShadowDebugContinue = true;
|
||||||
|
@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
public void TerrainToBitmap(Bitmap mapbmp)
|
public void TerrainToBitmap(Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
int tc = Environment.TickCount;
|
int tc = Environment.TickCount;
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||||
|
|
||||||
// These textures should be in the AssetCache anyway, as every client conneting to this
|
// These textures should be in the AssetCache anyway, as every client conneting to this
|
||||||
// region needs them. Except on start, when the map is recreated (before anyone connected),
|
// region needs them. Except on start, when the map is recreated (before anyone connected),
|
||||||
|
@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName);
|
sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
sb.AppendFormat("Parent: {0}",
|
sb.AppendFormat("Parent: {0}",
|
||||||
sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID));
|
sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID));
|
||||||
sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());;
|
sb.AppendFormat("Link number: {0}\n", sop.LinkNum);
|
||||||
|
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,28 +59,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <returns>A terrain channel generated from the image.</returns>
|
/// <returns>A terrain channel generated from the image.</returns>
|
||||||
public virtual ITerrainChannel LoadFile(string filename)
|
public virtual ITerrainChannel LoadFile(string filename)
|
||||||
{
|
{
|
||||||
return LoadBitmap(new Bitmap(filename));
|
using (Bitmap b = new Bitmap(filename))
|
||||||
|
return LoadBitmap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
|
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
|
||||||
{
|
{
|
||||||
Bitmap bitmap = new Bitmap(filename);
|
using (Bitmap bitmap = new Bitmap(filename))
|
||||||
ITerrainChannel retval = new TerrainChannel(true);
|
|
||||||
|
|
||||||
for (int x = 0; x < retval.Width; x++)
|
|
||||||
{
|
{
|
||||||
for (int y = 0; y < retval.Height; y++)
|
ITerrainChannel retval = new TerrainChannel(true);
|
||||||
{
|
|
||||||
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
for (int x = 0; x < retval.Width; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < retval.Height; y++)
|
||||||
|
{
|
||||||
|
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ITerrainChannel LoadStream(Stream stream)
|
public virtual ITerrainChannel LoadStream(Stream stream)
|
||||||
{
|
{
|
||||||
return LoadBitmap(new Bitmap(stream));
|
using (Bitmap b = new Bitmap(stream))
|
||||||
|
return LoadBitmap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap)
|
protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap)
|
||||||
|
@ -134,35 +138,53 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
||||||
string tempName = Path.GetTempFileName();
|
string tempName = Path.GetTempFileName();
|
||||||
|
|
||||||
Bitmap entireBitmap = null;
|
Bitmap existingBitmap = null;
|
||||||
Bitmap thisBitmap = null;
|
Bitmap thisBitmap = null;
|
||||||
if (File.Exists(filename))
|
Bitmap newBitmap = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
File.Copy(filename, tempName, true);
|
if (File.Exists(filename))
|
||||||
entireBitmap = new Bitmap(tempName);
|
|
||||||
if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
|
|
||||||
{
|
{
|
||||||
// old file, let's overwrite it
|
File.Copy(filename, tempName, true);
|
||||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
existingBitmap = new Bitmap(tempName);
|
||||||
|
if (existingBitmap.Width != fileWidth * regionSizeX || existingBitmap.Height != fileHeight * regionSizeY)
|
||||||
|
{
|
||||||
|
// old file, let's overwrite it
|
||||||
|
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newBitmap = existingBitmap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||||
|
}
|
||||||
|
|
||||||
|
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
||||||
|
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
||||||
|
for (int x = 0; x < regionSizeX; x++)
|
||||||
|
for (int y = 0; y < regionSizeY; y++)
|
||||||
|
newBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
||||||
|
|
||||||
|
Save(newBitmap, filename);
|
||||||
}
|
}
|
||||||
else
|
finally
|
||||||
{
|
{
|
||||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
if (existingBitmap != null)
|
||||||
|
existingBitmap.Dispose();
|
||||||
|
|
||||||
|
if (thisBitmap != null)
|
||||||
|
thisBitmap.Dispose();
|
||||||
|
|
||||||
|
if (newBitmap != null)
|
||||||
|
newBitmap.Dispose();
|
||||||
|
|
||||||
|
if (File.Exists(tempName))
|
||||||
|
File.Delete(tempName);
|
||||||
}
|
}
|
||||||
|
|
||||||
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
|
||||||
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
|
||||||
for (int x = 0; x < regionSizeX; x++)
|
|
||||||
for (int y = 0; y < regionSizeY; y++)
|
|
||||||
entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
|
||||||
|
|
||||||
Save(entireBitmap, filename);
|
|
||||||
thisBitmap.Dispose();
|
|
||||||
entireBitmap.Dispose();
|
|
||||||
|
|
||||||
if (File.Exists(tempName))
|
|
||||||
File.Delete(tempName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Save(Bitmap bmp, string filename)
|
protected virtual void Save(Bitmap bmp, string filename)
|
||||||
|
@ -226,16 +248,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
/// <returns>A System.Drawing.Bitmap containing a coloured image</returns>
|
/// <returns>A System.Drawing.Bitmap containing a coloured image</returns>
|
||||||
protected static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
protected static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
int pallete;
|
||||||
|
Bitmap bmp;
|
||||||
|
Color[] colours;
|
||||||
|
|
||||||
int pallete = gradientmapLd.Height;
|
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
|
||||||
Color[] colours = new Color[pallete];
|
|
||||||
|
|
||||||
for (int i = 0; i < pallete; i++)
|
|
||||||
{
|
{
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
pallete = gradientmapLd.Height;
|
||||||
|
|
||||||
|
bmp = new Bitmap(map.Width, map.Height);
|
||||||
|
colours = new Color[pallete];
|
||||||
|
|
||||||
|
for (int i = 0; i < pallete; i++)
|
||||||
|
{
|
||||||
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < map.Height; y++)
|
for (int y = 0; y < map.Height; y++)
|
||||||
|
|
|
@ -99,16 +99,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||||
|
|
||||||
private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||||
{
|
{
|
||||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
int pallete;
|
||||||
|
Bitmap bmp;
|
||||||
|
Color[] colours;
|
||||||
|
|
||||||
int pallete = gradientmapLd.Height;
|
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
|
||||||
Color[] colours = new Color[pallete];
|
|
||||||
|
|
||||||
for (int i = 0; i < pallete; i++)
|
|
||||||
{
|
{
|
||||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
pallete = gradientmapLd.Height;
|
||||||
|
|
||||||
|
bmp = new Bitmap(map.Width, map.Height);
|
||||||
|
colours = new Color[pallete];
|
||||||
|
|
||||||
|
for (int i = 0; i < pallete; i++)
|
||||||
|
{
|
||||||
|
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < map.Height; y++)
|
for (int y = 0; y < map.Height; y++)
|
||||||
|
|
|
@ -88,11 +88,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
if (renderers.Count > 0)
|
if (renderers.Count > 0)
|
||||||
{
|
{
|
||||||
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
|
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
|
||||||
m_log.Info("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
|
m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
|
m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
|
m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name='msg'>
|
/// <param name='msg'>
|
||||||
/// Message.
|
/// Message.
|
||||||
/// </param>
|
/// </param>
|
||||||
bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error);
|
void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Are there any listen events ready to be dispatched?
|
/// Are there any listen events ready to be dispatched?
|
||||||
|
|
|
@ -38,8 +38,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
public partial class Scene
|
public partial class Scene
|
||||||
{
|
{
|
||||||
|
|
||||||
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||||
UUID fromID, bool fromAgent, bool broadcast)
|
UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
|
||||||
{
|
{
|
||||||
OSChatMessage args = new OSChatMessage();
|
OSChatMessage args = new OSChatMessage();
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
args.From = fromName;
|
args.From = fromName;
|
||||||
//args.
|
args.TargetUUID = targetID;
|
||||||
|
|
||||||
if (broadcast)
|
if (broadcast)
|
||||||
EventManager.TriggerOnChatBroadcast(this, args);
|
EventManager.TriggerOnChatBroadcast(this, args);
|
||||||
|
@ -71,6 +72,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
EventManager.TriggerOnChatFromWorld(this, args);
|
EventManager.TriggerOnChatFromWorld(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||||
|
UUID fromID, bool fromAgent, bool broadcast)
|
||||||
|
{
|
||||||
|
SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -108,6 +115,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true);
|
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="fromPos"></param>
|
||||||
|
/// <param name="fromName"></param>
|
||||||
|
/// <param name="fromAgentID"></param>
|
||||||
|
/// <param name="targetID"></param>
|
||||||
|
public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent)
|
||||||
|
{
|
||||||
|
SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when the client requests a prim.
|
/// Invoked when the client requests a prim.
|
||||||
|
|
|
@ -684,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//Animation states
|
//Animation states
|
||||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||||
|
|
||||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
|
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
|
||||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
|
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
|
||||||
|
|
||||||
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
||||||
if (RegionInfo.NonphysPrimMax > 0)
|
if (RegionInfo.NonphysPrimMax > 0)
|
||||||
|
@ -800,13 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mock constructor for scene group persistency unit tests.
|
|
||||||
/// SceneObjectGroup RegionId property is delegated to Scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="regInfo"></param>
|
|
||||||
public Scene(RegionInfo regInfo)
|
public Scene(RegionInfo regInfo)
|
||||||
{
|
{
|
||||||
|
PhysicalPrims = true;
|
||||||
|
CollidablePrims = true;
|
||||||
|
|
||||||
BordersLocked = true;
|
BordersLocked = true;
|
||||||
Border northBorder = new Border();
|
Border northBorder = new Border();
|
||||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
||||||
|
@ -833,8 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_eventManager = new EventManager();
|
m_eventManager = new EventManager();
|
||||||
|
|
||||||
m_permissions = new ScenePermissions(this);
|
m_permissions = new ScenePermissions(this);
|
||||||
|
|
||||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -91,6 +91,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lock to prevent object group update, linking and delinking operations from running concurrently.
|
||||||
|
/// </summary>
|
||||||
private Object m_updateLock = new Object();
|
private Object m_updateLock = new Object();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -1962,6 +1962,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Link the prims in a given group to this group
|
/// Link the prims in a given group to this group
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
|
||||||
|
/// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="objectGroup">The group of prims which should be linked to this group</param>
|
/// <param name="objectGroup">The group of prims which should be linked to this group</param>
|
||||||
public void LinkToGroup(SceneObjectGroup objectGroup)
|
public void LinkToGroup(SceneObjectGroup objectGroup)
|
||||||
{
|
{
|
||||||
|
@ -2006,6 +2010,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
linkPart.CreateSelected = true;
|
linkPart.CreateSelected = true;
|
||||||
|
|
||||||
linkPart.LinkNum = linkNum++;
|
linkPart.LinkNum = linkNum++;
|
||||||
|
linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
|
||||||
|
|
||||||
SceneObjectPart[] ogParts = objectGroup.Parts;
|
SceneObjectPart[] ogParts = objectGroup.Parts;
|
||||||
Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
|
Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
|
||||||
|
@ -2045,6 +2050,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Delink the given prim from this group. The delinked prim is established as
|
/// Delink the given prim from this group. The delinked prim is established as
|
||||||
/// an independent SceneObjectGroup.
|
/// an independent SceneObjectGroup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||||
|
/// condition. But currently there is no
|
||||||
|
/// alternative method that does take a lonk to delink a single prim.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="partID"></param>
|
/// <param name="partID"></param>
|
||||||
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
||||||
public SceneObjectGroup DelinkFromGroup(uint partID)
|
public SceneObjectGroup DelinkFromGroup(uint partID)
|
||||||
|
@ -2056,6 +2066,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Delink the given prim from this group. The delinked prim is established as
|
/// Delink the given prim from this group. The delinked prim is established as
|
||||||
/// an independent SceneObjectGroup.
|
/// an independent SceneObjectGroup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||||
|
/// condition. But currently there is no
|
||||||
|
/// alternative method that does take a lonk to delink a single prim.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="partID"></param>
|
/// <param name="partID"></param>
|
||||||
/// <param name="sendEvents"></param>
|
/// <param name="sendEvents"></param>
|
||||||
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
||||||
|
@ -2081,6 +2096,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// Delink the given prim from this group. The delinked prim is established as
|
/// Delink the given prim from this group. The delinked prim is established as
|
||||||
/// an independent SceneObjectGroup.
|
/// an independent SceneObjectGroup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||||
|
/// condition. But currently there is no
|
||||||
|
/// alternative method that does take a lonk to delink a single prim.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="partID"></param>
|
/// <param name="partID"></param>
|
||||||
/// <param name="sendEvents"></param>
|
/// <param name="sendEvents"></param>
|
||||||
/// <returns>The object group of the newly delinked prim.</returns>
|
/// <returns>The object group of the newly delinked prim.</returns>
|
||||||
|
@ -2201,6 +2221,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
oldRot = part.RotationOffset;
|
oldRot = part.RotationOffset;
|
||||||
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
|
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
|
||||||
part.RotationOffset = newRot;
|
part.RotationOffset = newRot;
|
||||||
|
|
||||||
|
part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1706,6 +1706,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="isNew"></param>
|
/// <param name="isNew"></param>
|
||||||
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
|
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
|
||||||
{
|
{
|
||||||
|
if (ParentGroup.Scene == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
|
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -4161,7 +4164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// For now, we use the NINJA naming scheme for identifying joints.
|
// For now, we use the NINJA naming scheme for identifying joints.
|
||||||
// In the future, we can support other joint specification schemes such as a
|
// In the future, we can support other joint specification schemes such as a
|
||||||
// custom checkbox in the viewer GUI.
|
// custom checkbox in the viewer GUI.
|
||||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||||
{
|
{
|
||||||
string hingeString = "hingejoint";
|
string hingeString = "hingejoint";
|
||||||
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
|
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
|
||||||
|
@ -4177,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// For now, we use the NINJA naming scheme for identifying joints.
|
// For now, we use the NINJA naming scheme for identifying joints.
|
||||||
// In the future, we can support other joint specification schemes such as a
|
// In the future, we can support other joint specification schemes such as a
|
||||||
// custom checkbox in the viewer GUI.
|
// custom checkbox in the viewer GUI.
|
||||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||||
{
|
{
|
||||||
string ballString = "balljoint";
|
string ballString = "balljoint";
|
||||||
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
|
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
|
||||||
|
@ -4193,7 +4196,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// For now, we use the NINJA naming scheme for identifying joints.
|
// For now, we use the NINJA naming scheme for identifying joints.
|
||||||
// In the future, we can support other joint specification schemes such as a
|
// In the future, we can support other joint specification schemes such as a
|
||||||
// custom checkbox in the viewer GUI.
|
// custom checkbox in the viewer GUI.
|
||||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||||
{
|
{
|
||||||
return IsHingeJoint() || IsBallJoint();
|
return IsHingeJoint() || IsBallJoint();
|
||||||
}
|
}
|
||||||
|
@ -4287,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AddFlag(PrimFlags.Phantom);
|
AddFlag(PrimFlags.Phantom);
|
||||||
|
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
RemoveFromPhysics();
|
RemoveFromPhysics();
|
||||||
|
pa = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // Not phantom
|
else // Not phantom
|
||||||
{
|
{
|
||||||
|
@ -4353,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
pa.SetVolumeDetect(1);
|
pa.SetVolumeDetect(1);
|
||||||
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
||||||
this.VolumeDetectActive = true;
|
VolumeDetectActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4361,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
||||||
// (mumbles, well, at least if you have infinte CPU powers :-))
|
// (mumbles, well, at least if you have infinte CPU powers :-))
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
PhysActor.SetVolumeDetect(0);
|
pa.SetVolumeDetect(0);
|
||||||
|
|
||||||
this.VolumeDetectActive = false;
|
VolumeDetectActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetTemporary)
|
if (SetTemporary)
|
||||||
|
|
|
@ -990,23 +990,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
public void Teleport(Vector3 pos)
|
public void Teleport(Vector3 pos)
|
||||||
{
|
{
|
||||||
bool isFlying = Flying;
|
TeleportWithMomentum(pos, null);
|
||||||
RemoveFromPhysicalScene();
|
|
||||||
Velocity = Vector3.Zero;
|
|
||||||
CheckLandingPoint(ref pos);
|
|
||||||
AbsolutePosition = pos;
|
|
||||||
AddToPhysicalScene(isFlying);
|
|
||||||
|
|
||||||
SendTerseUpdateToAllClients();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TeleportWithMomentum(Vector3 pos)
|
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
||||||
{
|
{
|
||||||
bool isFlying = Flying;
|
bool isFlying = Flying;
|
||||||
|
Vector3 vel = Velocity;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
CheckLandingPoint(ref pos);
|
CheckLandingPoint(ref pos);
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
AddToPhysicalScene(isFlying);
|
AddToPhysicalScene(isFlying);
|
||||||
|
if (PhysicsActor != null)
|
||||||
|
{
|
||||||
|
if (v.HasValue)
|
||||||
|
PhysicsActor.SetMomentum((Vector3)v);
|
||||||
|
else
|
||||||
|
PhysicsActor.SetMomentum(vel);
|
||||||
|
}
|
||||||
|
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -43,24 +44,141 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SceneObjectStatusTests
|
public class SceneObjectStatusTests
|
||||||
{
|
{
|
||||||
|
private TestScene m_scene;
|
||||||
|
private UUID m_ownerId = TestHelpers.ParseTail(0x1);
|
||||||
|
private SceneObjectGroup m_so1;
|
||||||
|
private SceneObjectGroup m_so2;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
m_scene = SceneHelpers.SetupScene();
|
||||||
|
m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
|
||||||
|
m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSetPhantom()
|
public void TestSetPhantomSinglePrim()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
// Scene scene = SceneSetupHelpers.SetupScene();
|
m_scene.AddSceneObject(m_so1);
|
||||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
|
|
||||||
SceneObjectPart rootPart = so.RootPart;
|
SceneObjectPart rootPart = m_so1.RootPart;
|
||||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
|
||||||
so.ScriptSetPhantomStatus(true);
|
m_so1.ScriptSetPhantomStatus(true);
|
||||||
|
|
||||||
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
||||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
|
||||||
|
|
||||||
so.ScriptSetPhantomStatus(false);
|
m_so1.ScriptSetPhantomStatus(false);
|
||||||
|
|
||||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSetPhysicsSinglePrim()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(m_so1);
|
||||||
|
|
||||||
|
SceneObjectPart rootPart = m_so1.RootPart;
|
||||||
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
||||||
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(false);
|
||||||
|
|
||||||
|
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSetPhysicsLinkset()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(m_so1);
|
||||||
|
m_scene.AddSceneObject(m_so2);
|
||||||
|
|
||||||
|
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(false);
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test that linking results in the correct physical status for all linkees.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestLinkPhysicsBothPhysical()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(m_so1);
|
||||||
|
m_scene.AddSceneObject(m_so2);
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(true);
|
||||||
|
m_so2.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test that linking results in the correct physical status for all linkees.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestLinkPhysicsRootPhysicalOnly()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(m_so1);
|
||||||
|
m_scene.AddSceneObject(m_so2);
|
||||||
|
|
||||||
|
m_so1.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test that linking results in the correct physical status for all linkees.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestLinkPhysicsChildPhysicalOnly()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
m_scene.AddSceneObject(m_so1);
|
||||||
|
m_scene.AddSceneObject(m_so2);
|
||||||
|
|
||||||
|
m_so2.ScriptSetPhysicsStatus(true);
|
||||||
|
|
||||||
|
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||||
|
|
||||||
|
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,6 +33,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
|
@ -47,6 +48,41 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ScenePresenceTeleportTests
|
public class ScenePresenceTeleportTests
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestSameRegionTeleport()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
EntityTransferModule etm = new EntityTransferModule();
|
||||||
|
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
// Not strictly necessary since FriendsModule assumes it is the default (!)
|
||||||
|
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
|
||||||
|
|
||||||
|
TestScene scene = SceneHelpers.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||||
|
SceneHelpers.SetupSceneModules(scene, config, etm);
|
||||||
|
|
||||||
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||||
|
sp.AbsolutePosition = new Vector3(30, 31, 32);
|
||||||
|
scene.RequestTeleportLocation(
|
||||||
|
sp.ControllingClient,
|
||||||
|
scene.RegionInfo.RegionHandle,
|
||||||
|
teleportPosition,
|
||||||
|
teleportLookAt,
|
||||||
|
(uint)TeleportFlags.ViaLocation);
|
||||||
|
|
||||||
|
Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
|
||||||
|
|
||||||
|
// Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
|
||||||
|
// position instead).
|
||||||
|
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
|
/// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private IFriendsModule m_friendsModule;
|
private IFriendsModule m_friendsModule;
|
||||||
private IUserManagement m_userManagementModule;
|
private IUserManagement m_userManagementModule;
|
||||||
|
private IPresenceService m_presenceService;
|
||||||
|
|
||||||
// private IAvatarFactoryModule m_avatarFactory;
|
// private IAvatarFactoryModule m_avatarFactory;
|
||||||
|
|
||||||
|
@ -99,8 +100,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||||
|
|
||||||
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||||
m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
|
m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
m_presenceService = m_scene.RequestModuleInterface<IPresenceService>();
|
||||||
|
|
||||||
if (m_friendsModule != null && m_userManagementModule != null)
|
if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
|
||||||
{
|
{
|
||||||
m_scene.AddCommand(
|
m_scene.AddCommand(
|
||||||
"Friends", this, "friends show",
|
"Friends", this, "friends show",
|
||||||
|
@ -162,7 +164,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId);
|
MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId);
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat("UUID, Name, MyFlags, TheirFlags");
|
MainConsole.Instance.OutputFormat(
|
||||||
|
"{0,-36} {1,-36} {2,-7} {3,7} {4,10}", "UUID", "Name", "Status", "MyFlags", "TheirFlags");
|
||||||
|
|
||||||
foreach (FriendInfo friend in friends)
|
foreach (FriendInfo friend in friends)
|
||||||
{
|
{
|
||||||
|
@ -175,14 +178,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||||
|
|
||||||
UUID friendId;
|
UUID friendId;
|
||||||
string friendName;
|
string friendName;
|
||||||
|
string onlineText;
|
||||||
|
|
||||||
if (UUID.TryParse(friend.Friend, out friendId))
|
if (UUID.TryParse(friend.Friend, out friendId))
|
||||||
friendName = m_userManagementModule.GetUserName(friendId);
|
friendName = m_userManagementModule.GetUserName(friendId);
|
||||||
else
|
else
|
||||||
friendName = friend.Friend;
|
friendName = friend.Friend;
|
||||||
|
|
||||||
|
OpenSim.Services.Interfaces.PresenceInfo[] pi = m_presenceService.GetAgents(new string[] { friend.Friend });
|
||||||
|
if (pi.Length > 0)
|
||||||
|
onlineText = "online";
|
||||||
|
else
|
||||||
|
onlineText = "offline";
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat(
|
MainConsole.Instance.OutputFormat(
|
||||||
"{0} {1} {2} {3}", friend.Friend, friendName, friend.MyFlags, friend.TheirFlags);
|
"{0,-36} {1,-36} {2,-7} {3,-7} {4,-10}",
|
||||||
|
friend.Friend, friendName, onlineText, friend.MyFlags, friend.TheirFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
public Vector3 WorldPosition
|
public Vector3 WorldPosition
|
||||||
{
|
{
|
||||||
get { return GetSP().AbsolutePosition; }
|
get { return GetSP().AbsolutePosition; }
|
||||||
set { GetSP().TeleportWithMomentum(value); }
|
set { GetSP().Teleport(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsChildAgent
|
public bool IsChildAgent
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
sp.CompleteMovement(npcAvatar, false);
|
sp.CompleteMovement(npcAvatar, false);
|
||||||
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
|
||||||
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
|
m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
|
||||||
|
|
||||||
return npcAvatar.AgentId;
|
return npcAvatar.AgentId;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
scene.RemoveClient(agentID, false);
|
scene.RemoveClient(agentID, false);
|
||||||
m_avatars.Remove(agentID);
|
m_avatars.Remove(agentID);
|
||||||
|
|
||||||
// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name);
|
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
public class BasicActor : PhysicsActor
|
public class BasicActor : PhysicsActor
|
||||||
{
|
{
|
||||||
private Vector3 _position;
|
|
||||||
private Vector3 _velocity;
|
|
||||||
private Vector3 _acceleration;
|
|
||||||
private Vector3 _size;
|
private Vector3 _size;
|
||||||
private Vector3 m_rotationalVelocity;
|
|
||||||
private bool flying;
|
|
||||||
private bool iscolliding;
|
|
||||||
|
|
||||||
public BasicActor(Vector3 size)
|
public BasicActor(Vector3 size)
|
||||||
{
|
{
|
||||||
|
@ -55,11 +49,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 RotationalVelocity
|
public override Vector3 RotationalVelocity { get; set; }
|
||||||
{
|
|
||||||
get { return m_rotationalVelocity; }
|
|
||||||
set { m_rotationalVelocity = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool SetAlwaysRun
|
public override bool SetAlwaysRun
|
||||||
{
|
{
|
||||||
|
@ -105,17 +95,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Flying
|
public override bool Flying { get; set; }
|
||||||
{
|
|
||||||
get { return flying; }
|
|
||||||
set { flying = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsColliding
|
public override bool IsColliding { get; set; }
|
||||||
{
|
|
||||||
get { return iscolliding; }
|
|
||||||
set { iscolliding = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CollidingGround
|
public override bool CollidingGround
|
||||||
{
|
{
|
||||||
|
@ -134,11 +116,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 Position
|
public override Vector3 Position { get; set; }
|
||||||
{
|
|
||||||
get { return _position; }
|
|
||||||
set { _position = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
|
@ -206,11 +184,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
get { return Vector3.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 Velocity
|
public override Vector3 Velocity { get; set; }
|
||||||
{
|
|
||||||
get { return _velocity; }
|
|
||||||
set { _velocity = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
|
@ -230,11 +204,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 Acceleration
|
public override Vector3 Acceleration { get; set; }
|
||||||
{
|
|
||||||
get { return _acceleration; }
|
|
||||||
set { _acceleration = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Kinematic
|
public override bool Kinematic
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,314 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
|
{
|
||||||
|
public class BasicPhysicsPrim : PhysicsActor
|
||||||
|
{
|
||||||
|
private Vector3 _size;
|
||||||
|
private PrimitiveBaseShape _shape;
|
||||||
|
|
||||||
|
public BasicPhysicsPrim(
|
||||||
|
string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
LocalID = localId;
|
||||||
|
Position = position;
|
||||||
|
Size = size;
|
||||||
|
Orientation = orientation;
|
||||||
|
Shape = shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int PhysicsActorType
|
||||||
|
{
|
||||||
|
get { return (int) ActorTypes.Agent; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 RotationalVelocity { get; set; }
|
||||||
|
|
||||||
|
public override bool SetAlwaysRun
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override uint LocalID
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Grabbed
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Selected
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float Buoyancy
|
||||||
|
{
|
||||||
|
get { return 0f; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool FloatOnWater
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsPhysical
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool ThrottleUpdates
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Flying { get; set; }
|
||||||
|
|
||||||
|
public override bool IsColliding { get; set; }
|
||||||
|
|
||||||
|
public override bool CollidingGround
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CollidingObj
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Stopped
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 Position { get; set; }
|
||||||
|
|
||||||
|
public override Vector3 Size
|
||||||
|
{
|
||||||
|
get { return _size; }
|
||||||
|
set {
|
||||||
|
_size = value;
|
||||||
|
_size.Z = _size.Z / 2.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PrimitiveBaseShape Shape
|
||||||
|
{
|
||||||
|
set { _shape = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float Mass
|
||||||
|
{
|
||||||
|
get { return 0f; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 Force
|
||||||
|
{
|
||||||
|
get { return Vector3.Zero; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int VehicleType
|
||||||
|
{
|
||||||
|
get { return 0; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void VehicleFloatParam(int param, float value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void VehicleRotationParam(int param, Quaternion rotation)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void VehicleFlags(int param, bool remove)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetVolumeDetect(int param)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 CenterOfMass
|
||||||
|
{
|
||||||
|
get { return Vector3.Zero; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 GeometricCenter
|
||||||
|
{
|
||||||
|
get { return Vector3.Zero; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 Velocity { get; set; }
|
||||||
|
|
||||||
|
public override Vector3 Torque
|
||||||
|
{
|
||||||
|
get { return Vector3.Zero; }
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float CollisionScore
|
||||||
|
{
|
||||||
|
get { return 0f; }
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Quaternion Orientation { get; set; }
|
||||||
|
|
||||||
|
public override Vector3 Acceleration { get; set; }
|
||||||
|
|
||||||
|
public override bool Kinematic
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void link(PhysicsActor obj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void delink()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetMomentum(Vector3 momentum)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CrossingFailure()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Vector3 PIDTarget
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool PIDActive
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float PIDTau
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float PIDHoverHeight
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool PIDHoverActive
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PIDHoverType PIDHoverType
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float PIDHoverTau
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Quaternion APIDTarget
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool APIDActive
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float APIDStrength
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override float APIDDamping
|
||||||
|
{
|
||||||
|
set { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SubscribeEvents(int ms)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UnSubscribeEvents()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool SubscribedEvents()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,9 +34,17 @@ using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This is an incomplete extremely basic physics implementation
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Not useful for anything at the moment apart from some regression testing in other components where some form
|
||||||
|
/// of physics plugin is needed.
|
||||||
|
/// </remarks>
|
||||||
public class BasicScene : PhysicsScene
|
public class BasicScene : PhysicsScene
|
||||||
{
|
{
|
||||||
private List<BasicActor> _actors = new List<BasicActor>();
|
private List<BasicActor> _actors = new List<BasicActor>();
|
||||||
|
private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
|
||||||
private float[] _heightMap;
|
private float[] _heightMap;
|
||||||
|
|
||||||
//protected internal string sceneIdentifier;
|
//protected internal string sceneIdentifier;
|
||||||
|
@ -50,10 +58,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose() {}
|
||||||
{
|
|
||||||
|
|
||||||
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
|
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
|
||||||
|
{
|
||||||
|
BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
|
||||||
|
prim.IsPhysical = isPhysical;
|
||||||
|
|
||||||
|
_prims.Add(prim);
|
||||||
|
|
||||||
|
return prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
BasicActor act = new BasicActor(size);
|
BasicActor act = new BasicActor(size);
|
||||||
|
@ -63,30 +80,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemovePrim(PhysicsActor prim)
|
public override void RemovePrim(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
|
BasicPhysicsPrim prim = (BasicPhysicsPrim)actor;
|
||||||
|
if (_prims.Contains(prim))
|
||||||
|
_prims.Remove(prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemoveAvatar(PhysicsActor actor)
|
public override void RemoveAvatar(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
BasicActor act = (BasicActor) actor;
|
BasicActor act = (BasicActor)actor;
|
||||||
if (_actors.Contains(act))
|
if (_actors.Contains(act))
|
||||||
{
|
|
||||||
_actors.Remove(act);
|
_actors.Remove(act);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
|
||||||
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddPhysicsActorTaint(PhysicsActor prim)
|
public override void AddPhysicsActorTaint(PhysicsActor prim)
|
||||||
|
|
|
@ -156,7 +156,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr m_targetSpace = IntPtr.Zero;
|
public IntPtr m_targetSpace = IntPtr.Zero;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The prim geometry, used for collision detection.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is never null except for a brief period when the geometry needs to be replaced (due to resizing or
|
||||||
|
/// mesh change) or when the physical prim is being removed from the scene.
|
||||||
|
/// </remarks>
|
||||||
public IntPtr prim_geom { get; private set; }
|
public IntPtr prim_geom { get; private set; }
|
||||||
|
|
||||||
public IntPtr _triMeshData { get; private set; }
|
public IntPtr _triMeshData { get; private set; }
|
||||||
|
|
||||||
private IntPtr _linkJointGroup = IntPtr.Zero;
|
private IntPtr _linkJointGroup = IntPtr.Zero;
|
||||||
|
@ -325,14 +333,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
prim_geom = geom;
|
prim_geom = geom;
|
||||||
//Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
|
//Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
|
||||||
if (prim_geom != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
|
|
||||||
_parent_scene.geom_name_map[prim_geom] = Name;
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
_parent_scene.actor_name_map[prim_geom] = this;
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
}
|
|
||||||
|
_parent_scene.geom_name_map[prim_geom] = Name;
|
||||||
|
_parent_scene.actor_name_map[prim_geom] = this;
|
||||||
|
|
||||||
if (childPrim)
|
if (childPrim)
|
||||||
{
|
{
|
||||||
|
@ -765,11 +771,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_collisionCategories &= ~CollisionCategories.Body;
|
m_collisionCategories &= ~CollisionCategories.Body;
|
||||||
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
|
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
{
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
d.BodyDestroy(Body);
|
d.BodyDestroy(Body);
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
|
@ -793,11 +796,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_collisionCategories &= ~CollisionCategories.Body;
|
m_collisionCategories &= ~CollisionCategories.Body;
|
||||||
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
|
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
{
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
Body = IntPtr.Zero;
|
Body = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
@ -864,10 +864,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (prim_geom == IntPtr.Zero)
|
SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null));
|
||||||
{
|
|
||||||
SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (AccessViolationException)
|
catch (AccessViolationException)
|
||||||
{
|
{
|
||||||
|
@ -890,73 +887,67 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
#if SPAM
|
#if SPAM
|
||||||
Console.WriteLine("ZProcessTaints for " + Name);
|
Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This must be processed as the very first taint so that later operations have a prim_geom to work with
|
||||||
|
// if this is a new prim.
|
||||||
if (m_taintadd)
|
if (m_taintadd)
|
||||||
{
|
|
||||||
changeadd();
|
changeadd();
|
||||||
}
|
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
if (!_position.ApproxEquals(m_taintposition, 0f))
|
||||||
|
changemove();
|
||||||
|
|
||||||
|
if (m_taintrot != _orientation)
|
||||||
{
|
{
|
||||||
if (!_position.ApproxEquals(m_taintposition, 0f))
|
if (childPrim && IsPhysical) // For physical child prim...
|
||||||
changemove();
|
{
|
||||||
|
rotate();
|
||||||
if (m_taintrot != _orientation)
|
// KF: ODE will also rotate the parent prim!
|
||||||
{
|
// so rotate the root back to where it was
|
||||||
if (childPrim && IsPhysical) // For physical child prim...
|
OdePrim parent = (OdePrim)_parent;
|
||||||
{
|
parent.rotate();
|
||||||
rotate();
|
}
|
||||||
// KF: ODE will also rotate the parent prim!
|
else
|
||||||
// so rotate the root back to where it was
|
{
|
||||||
OdePrim parent = (OdePrim)_parent;
|
//Just rotate the prim
|
||||||
parent.rotate();
|
rotate();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Just rotate the prim
|
|
||||||
rotate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent))
|
|
||||||
changePhysicsStatus();
|
|
||||||
|
|
||||||
if (!_size.ApproxEquals(m_taintsize, 0f))
|
|
||||||
changesize();
|
|
||||||
|
|
||||||
if (m_taintshape)
|
|
||||||
changeshape();
|
|
||||||
|
|
||||||
if (m_taintforce)
|
|
||||||
changeAddForce();
|
|
||||||
|
|
||||||
if (m_taintaddangularforce)
|
|
||||||
changeAddAngularForce();
|
|
||||||
|
|
||||||
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
|
||||||
changeSetTorque();
|
|
||||||
|
|
||||||
if (m_taintdisable)
|
|
||||||
changedisable();
|
|
||||||
|
|
||||||
if (m_taintselected != m_isSelected)
|
|
||||||
changeSelectedStatus();
|
|
||||||
|
|
||||||
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
|
||||||
changevelocity();
|
|
||||||
|
|
||||||
if (m_taintparent != _parent)
|
|
||||||
changelink();
|
|
||||||
|
|
||||||
if (m_taintCollidesWater != m_collidesWater)
|
|
||||||
changefloatonwater();
|
|
||||||
|
|
||||||
if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
|
|
||||||
changeAngularLock();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PHYSICS]: The scene reused a disposed PhysActor for {0}! *waves finger*, Don't be evil. A couple of things can cause this. An improper prim breakdown(be sure to set prim_geom to zero after d.GeomDestroy! An improper buildup (creating the geom failed). Or, the Scene Reused a physics actor after disposing it.)", Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent))
|
||||||
|
changePhysicsStatus();
|
||||||
|
|
||||||
|
if (!_size.ApproxEquals(m_taintsize, 0f))
|
||||||
|
changesize();
|
||||||
|
|
||||||
|
if (m_taintshape)
|
||||||
|
changeshape();
|
||||||
|
|
||||||
|
if (m_taintforce)
|
||||||
|
changeAddForce();
|
||||||
|
|
||||||
|
if (m_taintaddangularforce)
|
||||||
|
changeAddAngularForce();
|
||||||
|
|
||||||
|
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
|
changeSetTorque();
|
||||||
|
|
||||||
|
if (m_taintdisable)
|
||||||
|
changedisable();
|
||||||
|
|
||||||
|
if (m_taintselected != m_isSelected)
|
||||||
|
changeSelectedStatus();
|
||||||
|
|
||||||
|
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
|
changevelocity();
|
||||||
|
|
||||||
|
if (m_taintparent != _parent)
|
||||||
|
changelink();
|
||||||
|
|
||||||
|
if (m_taintCollidesWater != m_collidesWater)
|
||||||
|
changefloatonwater();
|
||||||
|
|
||||||
|
if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
|
||||||
|
changeAngularLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1052,150 +1043,146 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
/// <param name="prim">Child prim</param>
|
/// <param name="prim">Child prim</param>
|
||||||
private void AddChildPrim(OdePrim prim)
|
private void AddChildPrim(OdePrim prim)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("AddChildPrim " + Name);
|
if (LocalID == prim.LocalID)
|
||||||
if (LocalID != prim.LocalID)
|
return;
|
||||||
|
|
||||||
|
if (Body == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (Body == IntPtr.Zero)
|
Body = d.BodyCreate(_parent_scene.world);
|
||||||
|
setMass();
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (childrenPrim)
|
||||||
|
{
|
||||||
|
if (childrenPrim.Contains(prim))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: Linking prim {0} {1} to {2} {3}", prim.Name, prim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
|
childrenPrim.Add(prim);
|
||||||
|
|
||||||
|
foreach (OdePrim prm in childrenPrim)
|
||||||
{
|
{
|
||||||
Body = d.BodyCreate(_parent_scene.world);
|
d.Mass m2;
|
||||||
setMass();
|
d.MassSetZero(out m2);
|
||||||
|
d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
||||||
|
|
||||||
|
d.Quaternion quat = new d.Quaternion();
|
||||||
|
quat.W = prm._orientation.W;
|
||||||
|
quat.X = prm._orientation.X;
|
||||||
|
quat.Y = prm._orientation.Y;
|
||||||
|
quat.Z = prm._orientation.Z;
|
||||||
|
|
||||||
|
d.Matrix3 mat = new d.Matrix3();
|
||||||
|
d.RfromQ(out mat, ref quat);
|
||||||
|
d.MassRotate(ref m2, ref mat);
|
||||||
|
d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
||||||
|
d.MassAdd(ref pMass, ref m2);
|
||||||
}
|
}
|
||||||
if (Body != IntPtr.Zero)
|
|
||||||
|
foreach (OdePrim prm in childrenPrim)
|
||||||
{
|
{
|
||||||
lock (childrenPrim)
|
prm.m_collisionCategories |= CollisionCategories.Body;
|
||||||
{
|
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||||
if (!childrenPrim.Contains(prim))
|
|
||||||
{
|
|
||||||
//Console.WriteLine("childrenPrim.Add " + prim);
|
|
||||||
childrenPrim.Add(prim);
|
|
||||||
|
|
||||||
foreach (OdePrim prm in childrenPrim)
|
|
||||||
{
|
|
||||||
d.Mass m2;
|
|
||||||
d.MassSetZero(out m2);
|
|
||||||
d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
|
||||||
|
|
||||||
d.Quaternion quat = new d.Quaternion();
|
|
||||||
quat.W = prm._orientation.W;
|
|
||||||
quat.X = prm._orientation.X;
|
|
||||||
quat.Y = prm._orientation.Y;
|
|
||||||
quat.Z = prm._orientation.Z;
|
|
||||||
|
|
||||||
d.Matrix3 mat = new d.Matrix3();
|
|
||||||
d.RfromQ(out mat, ref quat);
|
|
||||||
d.MassRotate(ref m2, ref mat);
|
|
||||||
d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
|
||||||
d.MassAdd(ref pMass, ref m2);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (OdePrim prm in childrenPrim)
|
|
||||||
{
|
|
||||||
prm.m_collisionCategories |= CollisionCategories.Body;
|
|
||||||
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
|
||||||
|
|
||||||
if (prm.prim_geom == IntPtr.Zero)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[PHYSICS]: Unable to link one of the linkset elements {0} for parent {1}. No geom yet",
|
|
||||||
prm.Name, prim.Name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
|
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
|
||||||
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
|
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
|
||||||
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
|
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
|
||||||
|
|
||||||
|
d.Quaternion quat = new d.Quaternion();
|
||||||
|
quat.W = prm._orientation.W;
|
||||||
|
quat.X = prm._orientation.X;
|
||||||
|
quat.Y = prm._orientation.Y;
|
||||||
|
quat.Z = prm._orientation.Z;
|
||||||
|
|
||||||
d.Quaternion quat = new d.Quaternion();
|
d.Matrix3 mat = new d.Matrix3();
|
||||||
quat.W = prm._orientation.W;
|
d.RfromQ(out mat, ref quat);
|
||||||
quat.X = prm._orientation.X;
|
if (Body != IntPtr.Zero)
|
||||||
quat.Y = prm._orientation.Y;
|
{
|
||||||
quat.Z = prm._orientation.Z;
|
d.GeomSetBody(prm.prim_geom, Body);
|
||||||
|
prm.childPrim = true;
|
||||||
|
d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
||||||
|
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||||
|
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||||
|
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||||
|
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||||
|
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
||||||
|
//d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
|
||||||
|
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||||
|
d.BodySetMass(Body, ref pMass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name);
|
||||||
|
}
|
||||||
|
|
||||||
d.Matrix3 mat = new d.Matrix3();
|
prm.m_interpenetrationcount = 0;
|
||||||
d.RfromQ(out mat, ref quat);
|
prm.m_collisionscore = 0;
|
||||||
if (Body != IntPtr.Zero)
|
prm.m_disabled = false;
|
||||||
{
|
|
||||||
d.GeomSetBody(prm.prim_geom, Body);
|
|
||||||
prm.childPrim = true;
|
|
||||||
d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
|
||||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
|
||||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
|
||||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
|
||||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
|
||||||
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
|
||||||
//d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
|
|
||||||
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
|
||||||
d.BodySetMass(Body, ref pMass);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
prm.m_interpenetrationcount = 0;
|
// The body doesn't already have a finite rotation mode set here
|
||||||
prm.m_collisionscore = 0;
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
prm.m_disabled = false;
|
{
|
||||||
|
prm.createAMotor(m_angularlock);
|
||||||
|
}
|
||||||
|
prm.Body = Body;
|
||||||
|
_parent_scene.ActivatePrim(prm);
|
||||||
|
}
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
m_collisionCategories |= CollisionCategories.Body;
|
||||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||||
{
|
|
||||||
prm.createAMotor(m_angularlock);
|
|
||||||
}
|
|
||||||
prm.Body = Body;
|
|
||||||
_parent_scene.ActivatePrim(prm);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_collisionCategories |= CollisionCategories.Body;
|
|
||||||
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
|
||||||
|
|
||||||
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
|
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
//Console.WriteLine(" Post GeomSetCategoryBits 2");
|
//Console.WriteLine(" Post GeomSetCategoryBits 2");
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
|
||||||
d.Quaternion quat2 = new d.Quaternion();
|
d.Quaternion quat2 = new d.Quaternion();
|
||||||
quat2.W = _orientation.W;
|
quat2.W = _orientation.W;
|
||||||
quat2.X = _orientation.X;
|
quat2.X = _orientation.X;
|
||||||
quat2.Y = _orientation.Y;
|
quat2.Y = _orientation.Y;
|
||||||
quat2.Z = _orientation.Z;
|
quat2.Z = _orientation.Z;
|
||||||
|
|
||||||
d.Matrix3 mat2 = new d.Matrix3();
|
d.Matrix3 mat2 = new d.Matrix3();
|
||||||
d.RfromQ(out mat2, ref quat2);
|
d.RfromQ(out mat2, ref quat2);
|
||||||
d.GeomSetBody(prim_geom, Body);
|
d.GeomSetBody(prim_geom, Body);
|
||||||
d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
||||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||||
//d.GeomSetOffsetRotation(prim_geom, ref mat2);
|
//d.GeomSetOffsetRotation(prim_geom, ref mat2);
|
||||||
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||||
d.BodySetMass(Body, ref pMass);
|
d.BodySetMass(Body, ref pMass);
|
||||||
|
|
||||||
d.BodySetAutoDisableFlag(Body, true);
|
d.BodySetAutoDisableFlag(Body, true);
|
||||||
d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||||
|
|
||||||
m_interpenetrationcount = 0;
|
m_interpenetrationcount = 0;
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
m_disabled = false;
|
m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
createAMotor(m_angularlock);
|
createAMotor(m_angularlock);
|
||||||
}
|
|
||||||
d.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
|
||||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
|
||||||
m_vehicle.Enable(Body, _parent_scene);
|
|
||||||
|
|
||||||
_parent_scene.ActivatePrim(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
||||||
|
|
||||||
|
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
|
m_vehicle.Enable(Body, _parent_scene);
|
||||||
|
|
||||||
|
_parent_scene.ActivatePrim(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChildSetGeom(OdePrim odePrim)
|
private void ChildSetGeom(OdePrim odePrim)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: ChildSetGeom {0} {1} for {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
//if (IsPhysical && Body != IntPtr.Zero)
|
//if (IsPhysical && Body != IntPtr.Zero)
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1210,12 +1197,14 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
//prm.childPrim = false;
|
//prm.childPrim = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disableBody();
|
disableBody();
|
||||||
|
|
||||||
if (Body != IntPtr.Zero)
|
// Spurious - Body == IntPtr.Zero after disableBody()
|
||||||
{
|
// if (Body != IntPtr.Zero)
|
||||||
_parent_scene.DeactivatePrim(this);
|
// {
|
||||||
}
|
// _parent_scene.DeactivatePrim(this);
|
||||||
|
// }
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1229,6 +1218,9 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
|
|
||||||
private void ChildDelink(OdePrim odePrim)
|
private void ChildDelink(OdePrim odePrim)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: Delinking prim {0} {1} from {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
// Okay, we have a delinked child.. need to rebuild the body.
|
// Okay, we have a delinked child.. need to rebuild the body.
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1243,6 +1235,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
//prm.childPrim = false;
|
//prm.childPrim = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disableBody();
|
disableBody();
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
|
@ -1251,10 +1244,11 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
childrenPrim.Remove(odePrim);
|
childrenPrim.Remove(odePrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Body != IntPtr.Zero)
|
// Spurious - Body == IntPtr.Zero after disableBody()
|
||||||
{
|
// if (Body != IntPtr.Zero)
|
||||||
_parent_scene.DeactivatePrim(this);
|
// {
|
||||||
}
|
// _parent_scene.DeactivatePrim(this);
|
||||||
|
// }
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1303,11 +1297,8 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
disableBodySoft();
|
disableBodySoft();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
{
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
|
@ -1328,11 +1319,8 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
if (m_collidesWater)
|
if (m_collidesWater)
|
||||||
m_collisionFlags |= CollisionCategories.Water;
|
m_collisionFlags |= CollisionCategories.Water;
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
{
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
|
@ -1472,6 +1460,9 @@ Console.WriteLine("CreateGeom:");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[ODE PRIM]: Called RemoveGeom() on {0} {1} where geometry was already null.", Name, LocalID);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1505,16 +1496,13 @@ Console.WriteLine("changeadd 1");
|
||||||
#endif
|
#endif
|
||||||
CreateGeom(m_targetSpace, mesh);
|
CreateGeom(m_targetSpace, mesh);
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||||
{
|
d.Quaternion myrot = new d.Quaternion();
|
||||||
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
myrot.X = _orientation.X;
|
||||||
d.Quaternion myrot = new d.Quaternion();
|
myrot.Y = _orientation.Y;
|
||||||
myrot.X = _orientation.X;
|
myrot.Z = _orientation.Z;
|
||||||
myrot.Y = _orientation.Y;
|
myrot.W = _orientation.W;
|
||||||
myrot.Z = _orientation.Z;
|
d.GeomSetQuaternion(prim_geom, ref myrot);
|
||||||
myrot.W = _orientation.W;
|
|
||||||
d.GeomSetQuaternion(prim_geom, ref myrot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPhysical && Body == IntPtr.Zero)
|
if (IsPhysical && Body == IntPtr.Zero)
|
||||||
enableBody();
|
enableBody();
|
||||||
|
@ -1579,24 +1567,20 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
//m_log.Debug("[BUG]: race!");
|
//m_log.Debug("[BUG]: race!");
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
|
|
||||||
// int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
|
|
||||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
|
||||||
|
|
||||||
IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
|
// string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
|
||||||
m_targetSpace = tempspace;
|
// int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
|
||||||
|
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
|
|
||||||
|
IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
|
||||||
|
m_targetSpace = tempspace;
|
||||||
|
|
||||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
if (prim_geom != IntPtr.Zero)
|
|
||||||
{
|
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||||
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
|
||||||
|
|
||||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
d.SpaceAdd(m_targetSpace, prim_geom);
|
d.SpaceAdd(m_targetSpace, prim_geom);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
changeSelectedStatus();
|
changeSelectedStatus();
|
||||||
|
|
||||||
|
@ -2047,18 +2031,16 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
{
|
{
|
||||||
m_collidesWater = m_taintCollidesWater;
|
m_collidesWater = m_taintCollidesWater;
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
if (m_collidesWater)
|
||||||
{
|
{
|
||||||
if (m_collidesWater)
|
m_collisionFlags |= CollisionCategories.Water;
|
||||||
{
|
|
||||||
m_collisionFlags |= CollisionCategories.Water;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_collisionFlags &= ~CollisionCategories.Water;
|
|
||||||
}
|
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_collisionFlags &= ~CollisionCategories.Water;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2226,7 +2226,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <param name="prim"></param>
|
/// <param name="prim"></param>
|
||||||
internal void RemovePrimThreadLocked(OdePrim prim)
|
internal void RemovePrimThreadLocked(OdePrim prim)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
|
// m_log.DebugFormat("[ODE SCENE]: Removing physical prim {0} {1}", prim.Name, prim.LocalID);
|
||||||
|
|
||||||
lock (prim)
|
lock (prim)
|
||||||
{
|
{
|
||||||
RemoveCollisionEventReporting(prim);
|
RemoveCollisionEventReporting(prim);
|
||||||
|
|
|
@ -29,42 +29,43 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
public class ApiManager
|
public class ApiManager
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>();
|
private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>();
|
||||||
|
|
||||||
public string[] GetApis()
|
public string[] GetApis()
|
||||||
{
|
{
|
||||||
if (m_Apis.Count > 0)
|
if (m_Apis.Count <= 0)
|
||||||
{
|
{
|
||||||
List<string> l = new List<string>(m_Apis.Keys);
|
Assembly a = Assembly.GetExecutingAssembly();
|
||||||
return l.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
Assembly a = Assembly.GetExecutingAssembly();
|
Type[] types = a.GetExportedTypes();
|
||||||
|
|
||||||
Type[] types = a.GetExportedTypes();
|
foreach (Type t in types)
|
||||||
|
|
||||||
foreach (Type t in types)
|
|
||||||
{
|
|
||||||
string name = t.ToString();
|
|
||||||
int idx = name.LastIndexOf('.');
|
|
||||||
if (idx != -1)
|
|
||||||
name = name.Substring(idx+1);
|
|
||||||
|
|
||||||
if (name.EndsWith("_Api"))
|
|
||||||
{
|
{
|
||||||
name = name.Substring(0, name.Length - 4);
|
string name = t.ToString();
|
||||||
m_Apis[name] = t;
|
int idx = name.LastIndexOf('.');
|
||||||
|
if (idx != -1)
|
||||||
|
name = name.Substring(idx+1);
|
||||||
|
|
||||||
|
if (name.EndsWith("_Api"))
|
||||||
|
{
|
||||||
|
name = name.Substring(0, name.Length - 4);
|
||||||
|
m_Apis[name] = t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> ret = new List<string>(m_Apis.Keys);
|
// m_log.DebugFormat("[API MANAGER]: Found {0} apis", m_Apis.Keys.Count);
|
||||||
return ret.ToArray();
|
|
||||||
|
return new List<string>(m_Apis.Keys).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScriptApi CreateApi(string api)
|
public IScriptApi CreateApi(string api)
|
||||||
|
|
|
@ -85,7 +85,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected IScriptEngine m_ScriptEngine;
|
protected IScriptEngine m_ScriptEngine;
|
||||||
protected SceneObjectPart m_host;
|
protected SceneObjectPart m_host;
|
||||||
protected uint m_localID;
|
protected uint m_localID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The UUID of the item that hosts this script
|
||||||
|
/// </summary>
|
||||||
protected UUID m_itemID;
|
protected UUID m_itemID;
|
||||||
|
|
||||||
protected bool throwErrorOnNotImplemented = true;
|
protected bool throwErrorOnNotImplemented = true;
|
||||||
protected AsyncCommandManager AsyncCommands = null;
|
protected AsyncCommandManager AsyncCommands = null;
|
||||||
protected float m_ScriptDelayFactor = 1.0f;
|
protected float m_ScriptDelayFactor = 1.0f;
|
||||||
|
@ -267,23 +272,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UUID InventorySelf()
|
/// <summary>
|
||||||
|
/// Get the inventory item that hosts ourselves.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need
|
||||||
|
/// to keep looking ourselves up.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected TaskInventoryItem GetSelfInventoryItem()
|
||||||
{
|
{
|
||||||
UUID invItemID = new UUID();
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
return m_host.TaskInventory[m_itemID];
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
|
|
||||||
{
|
|
||||||
invItemID = inv.Key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return invItemID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UUID InventoryKey(string name, int type)
|
protected UUID InventoryKey(string name, int type)
|
||||||
|
@ -839,13 +839,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (channel == ScriptBaseClass.DEBUG_CHANNEL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UUID TargetID;
|
UUID TargetID;
|
||||||
UUID.TryParse(target, out TargetID);
|
UUID.TryParse(target, out TargetID);
|
||||||
|
|
||||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||||
if (wComm != null)
|
if (wComm != null)
|
||||||
if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error))
|
wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg);
|
||||||
LSLError(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llListen(int channelID, string name, string ID, string msg)
|
public LSL_Integer llListen(int channelID, string name, string ID, string msg)
|
||||||
|
@ -2697,18 +2701,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||||
{
|
{
|
||||||
UUID invItemID=InventorySelf();
|
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
TaskInventoryItem item = m_host.TaskInventory[invItemID];
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
item = m_host.TaskInventory[invItemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2951,15 +2946,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void llTakeControls(int controls, int accept, int pass_on)
|
public void llTakeControls(int controls, int accept, int pass_on)
|
||||||
{
|
{
|
||||||
TaskInventoryItem item;
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter != UUID.Zero)
|
if (item.PermsGranter != UUID.Zero)
|
||||||
{
|
{
|
||||||
|
@ -2979,18 +2966,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void llReleaseControls()
|
public void llReleaseControls()
|
||||||
{
|
{
|
||||||
TaskInventoryItem item;
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
if (item.PermsGranter != UUID.Zero)
|
if (item.PermsGranter != UUID.Zero)
|
||||||
{
|
{
|
||||||
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
ScenePresence presence = World.GetScenePresence(item.PermsGranter);
|
||||||
|
@ -3015,64 +2994,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_UrlModule.ReleaseURL(url);
|
m_UrlModule.ReleaseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llAttachToAvatar(int attachment)
|
/// <summary>
|
||||||
|
/// Attach the object containing this script to the avatar that owns it.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param>
|
||||||
|
/// <returns>true if the attach suceeded, false if it did not</returns>
|
||||||
|
public bool AttachToAvatar(int attachmentPoint)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
SceneObjectGroup grp = m_host.ParentGroup;
|
||||||
|
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||||
|
|
||||||
// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
|
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||||
// return;
|
|
||||||
|
|
||||||
TaskInventoryItem item;
|
if (attachmentsModule != null)
|
||||||
|
return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false);
|
||||||
lock (m_host.TaskInventory)
|
else
|
||||||
{
|
return false;
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter != m_host.OwnerID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
|
||||||
{
|
|
||||||
SceneObjectGroup grp = m_host.ParentGroup;
|
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
|
||||||
|
|
||||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
|
||||||
if (attachmentsModule != null)
|
|
||||||
attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llDetachFromAvatar()
|
/// <summary>
|
||||||
|
/// Detach the object containing this script from the avatar it is attached to.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Nothing happens if the object is not attached.
|
||||||
|
/// </remarks>
|
||||||
|
public void DetachFromAvatar()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
Util.FireAndForget(DetachWrapper, m_host);
|
||||||
|
|
||||||
if (m_host.ParentGroup.AttachmentPoint == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TaskInventoryItem item;
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter != m_host.OwnerID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
|
||||||
{
|
|
||||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
|
||||||
if (attachmentsModule != null)
|
|
||||||
Util.FireAndForget(DetachWrapper, m_host);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DetachWrapper(object o)
|
private void DetachWrapper(object o)
|
||||||
|
@ -3088,6 +3036,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
|
attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void llAttachToAvatar(int attachmentPoint)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
|
if (item.PermsGranter != m_host.OwnerID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||||
|
AttachToAvatar(attachmentPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void llDetachFromAvatar()
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (m_host.ParentGroup.AttachmentPoint == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
|
if (item.PermsGranter != m_host.OwnerID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||||
|
DetachFromAvatar();
|
||||||
|
}
|
||||||
|
|
||||||
public void llTakeCamera(string avatar)
|
public void llTakeCamera(string avatar)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -3313,19 +3293,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
UUID invItemID = InventorySelf();
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TaskInventoryItem item;
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
@ -3350,19 +3318,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
UUID invItemID=InventorySelf();
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TaskInventoryItem item;
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
item = m_host.TaskInventory[InventorySelf()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.PermsGranter == UUID.Zero)
|
if (item.PermsGranter == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
@ -3417,22 +3373,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public void llRequestPermissions(string agent, int perm)
|
public void llRequestPermissions(string agent, int perm)
|
||||||
{
|
{
|
||||||
UUID agentID = new UUID();
|
UUID agentID;
|
||||||
|
|
||||||
if (!UUID.TryParse(agent, out agentID))
|
if (!UUID.TryParse(agent, out agentID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID invItemID = InventorySelf();
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return; // Not in a prim? How??
|
|
||||||
|
|
||||||
TaskInventoryItem item;
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
item = m_host.TaskInventory[invItemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
|
||||||
{
|
{
|
||||||
|
@ -3466,8 +3412,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = perm;
|
m_host.TaskInventory[m_itemID].PermsMask = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
|
@ -3490,8 +3436,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = perm;
|
m_host.TaskInventory[m_itemID].PermsMask = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
|
@ -3515,8 +3461,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsGranter = agentID;
|
m_host.TaskInventory[m_itemID].PermsGranter = agentID;
|
||||||
m_host.TaskInventory[invItemID].PermsMask = 0;
|
m_host.TaskInventory[m_itemID].PermsMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
|
||||||
|
@ -3524,7 +3470,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
presence.ControllingClient.SendScriptQuestion(
|
presence.ControllingClient.SendScriptQuestion(
|
||||||
m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
|
m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3541,20 +3487,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (taskID != m_host.UUID)
|
if (taskID != m_host.UUID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID invItemID = InventorySelf();
|
client.OnScriptAnswer -= handleScriptAnswer;
|
||||||
|
m_waitingForScriptAnswer = false;
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
client.OnScriptAnswer-=handleScriptAnswer;
|
|
||||||
m_waitingForScriptAnswer=false;
|
|
||||||
|
|
||||||
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
|
||||||
llReleaseControls();
|
llReleaseControls();
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
lock (m_host.TaskInventory)
|
||||||
{
|
{
|
||||||
m_host.TaskInventory[invItemID].PermsMask = answer;
|
m_host.TaskInventory[m_itemID].PermsMask = answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
|
||||||
|
@ -3567,39 +3508,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
return GetSelfInventoryItem().PermsGranter.ToString();
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
|
||||||
{
|
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
|
||||||
{
|
|
||||||
return item.PermsGranter.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return UUID.Zero.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetPermissions()
|
public LSL_Integer llGetPermissions()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
int perms = GetSelfInventoryItem().PermsMask;
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
|
||||||
{
|
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
|
||||||
{
|
|
||||||
int perms = item.PermsMask;
|
|
||||||
if (m_automaticLinkPermission)
|
|
||||||
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
|
||||||
return perms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
if (m_automaticLinkPermission)
|
||||||
|
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||||
|
|
||||||
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetLinkNumber()
|
public LSL_Integer llGetLinkNumber()
|
||||||
|
@ -3627,17 +3548,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llCreateLink(string target, int parent)
|
public void llCreateLink(string target, int parent)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
|
||||||
UUID targetID;
|
UUID targetID;
|
||||||
|
|
||||||
if (!UUID.TryParse(target, out targetID))
|
if (!UUID.TryParse(target, out targetID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TaskInventoryItem item;
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
item = m_host.TaskInventory[invItemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
||||||
&& !m_automaticLinkPermission)
|
&& !m_automaticLinkPermission)
|
||||||
|
@ -3688,16 +3605,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void llBreakLink(int linknum)
|
public void llBreakLink(int linknum)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
||||||
|
&& !m_automaticLinkPermission)
|
||||||
{
|
{
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
|
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
||||||
&& !m_automaticLinkPermission)
|
return;
|
||||||
{
|
|
||||||
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linknum < ScriptBaseClass.LINK_THIS)
|
if (linknum < ScriptBaseClass.LINK_THIS)
|
||||||
|
@ -4574,23 +4487,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public LSL_String llGetScriptName()
|
public LSL_String llGetScriptName()
|
||||||
{
|
{
|
||||||
string result = String.Empty;
|
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
|
||||||
{
|
|
||||||
if (item.Type == 10 && item.ItemID == m_itemID)
|
|
||||||
{
|
|
||||||
result = item.Name != null ? item.Name : String.Empty;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return item.Name != null ? item.Name : String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetLinkNumberOfSides(int link)
|
public LSL_Integer llGetLinkNumberOfSides(int link)
|
||||||
|
@ -9691,21 +9592,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Vector llGetCameraPos()
|
public LSL_Vector llGetCameraPos()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
|
||||||
|
|
||||||
if (invItemID == UUID.Zero)
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
return new LSL_Vector();
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
if (item.PermsGranter == UUID.Zero)
|
||||||
|
return new LSL_Vector();
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
||||||
{
|
{
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
ShoutError("No permissions to track the camera");
|
||||||
return new LSL_Vector();
|
return new LSL_Vector();
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
|
||||||
{
|
|
||||||
ShoutError("No permissions to track the camera");
|
|
||||||
return new LSL_Vector();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||||
|
@ -9720,20 +9616,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Rotation llGetCameraRot()
|
public LSL_Rotation llGetCameraRot()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
UUID invItemID = InventorySelf();
|
|
||||||
if (invItemID == UUID.Zero)
|
|
||||||
return new LSL_Rotation();
|
|
||||||
|
|
||||||
lock (m_host.TaskInventory)
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
|
if (item.PermsGranter == UUID.Zero)
|
||||||
|
return new LSL_Rotation();
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
||||||
{
|
{
|
||||||
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
|
ShoutError("No permissions to track the camera");
|
||||||
return new LSL_Rotation();
|
return new LSL_Rotation();
|
||||||
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
|
|
||||||
{
|
|
||||||
ShoutError("No permissions to track the camera");
|
|
||||||
return new LSL_Rotation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||||
|
@ -9907,23 +9799,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
// our key in the object we are in
|
|
||||||
UUID invItemID = InventorySelf();
|
|
||||||
if (invItemID == UUID.Zero) return;
|
|
||||||
|
|
||||||
// the object we are in
|
// the object we are in
|
||||||
UUID objectID = m_host.ParentUUID;
|
UUID objectID = m_host.ParentUUID;
|
||||||
if (objectID == UUID.Zero) return;
|
if (objectID == UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
UUID agentID;
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
|
||||||
// we need the permission first, to know which avatar we want to set the camera for
|
|
||||||
agentID = m_host.TaskInventory[invItemID].PermsGranter;
|
|
||||||
|
|
||||||
if (agentID == UUID.Zero) return;
|
// we need the permission first, to know which avatar we want to set the camera for
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
UUID agentID = item.PermsGranter;
|
||||||
}
|
|
||||||
|
if (agentID == UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
|
||||||
|
@ -9963,27 +9853,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
// our key in the object we are in
|
|
||||||
UUID invItemID=InventorySelf();
|
|
||||||
if (invItemID == UUID.Zero) return;
|
|
||||||
|
|
||||||
// the object we are in
|
// the object we are in
|
||||||
UUID objectID = m_host.ParentUUID;
|
UUID objectID = m_host.ParentUUID;
|
||||||
if (objectID == UUID.Zero) return;
|
if (objectID == UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TaskInventoryItem item = GetSelfInventoryItem();
|
||||||
|
|
||||||
// we need the permission first, to know which avatar we want to clear the camera for
|
// we need the permission first, to know which avatar we want to clear the camera for
|
||||||
UUID agentID;
|
UUID agentID = item.PermsGranter;
|
||||||
lock (m_host.TaskInventory)
|
|
||||||
{
|
if (agentID == UUID.Zero)
|
||||||
agentID = m_host.TaskInventory[invItemID].PermsGranter;
|
return;
|
||||||
if (agentID == UUID.Zero) return;
|
|
||||||
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
|
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
|
||||||
}
|
return;
|
||||||
|
|
||||||
ScenePresence presence = World.GetScenePresence(agentID);
|
ScenePresence presence = World.GetScenePresence(agentID);
|
||||||
|
|
||||||
// we are not interested in child-agents
|
// we are not interested in child-agents
|
||||||
if (presence.IsChildAgent) return;
|
if (presence.IsChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
presence.ControllingClient.SendClearFollowCamProperties(objectID);
|
presence.ControllingClient.SendClearFollowCamProperties(objectID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,6 +209,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
throw new Exception("OSSL Runtime Error: " + msg);
|
throw new Exception("OSSL Runtime Error: " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize the LSL interface.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no
|
||||||
|
/// guarantee the interface is present on Initialize(). There needs to be another post initialize call from
|
||||||
|
/// ScriptInstance.
|
||||||
|
/// </remarks>
|
||||||
private void InitLSL()
|
private void InitLSL()
|
||||||
{
|
{
|
||||||
if (m_LSL_Api != null)
|
if (m_LSL_Api != null)
|
||||||
|
@ -1609,7 +1617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
public Object osParseJSONNew(string JSON)
|
public Object osParseJSONNew(string JSON)
|
||||||
{
|
{
|
||||||
CheckThreatLevel(ThreatLevel.None, "osParseJSON");
|
CheckThreatLevel(ThreatLevel.None, "osParseJSONNew");
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
@ -3093,5 +3101,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
|
estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osForceAttachToAvatar(int attachmentPoint)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
InitLSL();
|
||||||
|
((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osForceDetachFromAvatar()
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
InitLSL();
|
||||||
|
((LSL_Api)m_LSL_Api).DetachFromAvatar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -98,6 +98,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
void osAvatarPlayAnimation(string avatar, string animation);
|
void osAvatarPlayAnimation(string avatar, string animation);
|
||||||
void osAvatarStopAnimation(string avatar, string animation);
|
void osAvatarStopAnimation(string avatar, string animation);
|
||||||
|
|
||||||
|
// Attachment commands
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
|
||||||
|
void osForceAttachToAvatar(int attachment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Nothing happens if the object is not attached.</remarks>
|
||||||
|
void osForceDetachFromAvatar();
|
||||||
|
|
||||||
//texture draw functions
|
//texture draw functions
|
||||||
string osMovePen(string drawList, int x, int y);
|
string osMovePen(string drawList, int x, int y);
|
||||||
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
|
string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
|
||||||
|
|
|
@ -289,8 +289,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
|
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avatar functions
|
||||||
|
|
||||||
//Texture Draw functions
|
public void osForceAttachToAvatar(int attachmentPoint)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osForceDetachFromAvatar()
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osForceDetachFromAvatar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Texture Draw functions
|
||||||
|
|
||||||
public string osMovePen(string drawList, int x, int y)
|
public string osMovePen(string drawList, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -964,7 +964,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public IScriptApi GetApi(string name)
|
public IScriptApi GetApi(string name)
|
||||||
{
|
{
|
||||||
if (m_Apis.ContainsKey(name))
|
if (m_Apis.ContainsKey(name))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[SCRIPT INSTANCE]: Found api {0} in {1}@{2}", name, ScriptName, PrimName);
|
||||||
|
|
||||||
return m_Apis[name];
|
return m_Apis[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[SCRIPT INSTANCE]: Did not find api {0} in {1}@{2}", name, ScriptName, PrimName);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1021,11 +1021,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
AppDomain sandbox;
|
AppDomain sandbox;
|
||||||
if (m_AppDomainLoading)
|
if (m_AppDomainLoading)
|
||||||
|
{
|
||||||
sandbox = AppDomain.CreateDomain(
|
sandbox = AppDomain.CreateDomain(
|
||||||
m_Scene.RegionInfo.RegionID.ToString(),
|
m_Scene.RegionInfo.RegionID.ToString(),
|
||||||
evidence, appSetup);
|
evidence, appSetup);
|
||||||
|
sandbox.AssemblyResolve +=
|
||||||
|
new ResolveEventHandler(
|
||||||
|
AssemblyResolver.OnAssemblyResolve);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sandbox = AppDomain.CurrentDomain;
|
sandbox = AppDomain.CurrentDomain;
|
||||||
|
}
|
||||||
|
|
||||||
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
|
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
|
||||||
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
|
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
|
||||||
|
@ -1037,9 +1044,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
m_AppDomains[appDomain] = sandbox;
|
m_AppDomains[appDomain] = sandbox;
|
||||||
|
|
||||||
m_AppDomains[appDomain].AssemblyResolve +=
|
|
||||||
new ResolveEventHandler(
|
|
||||||
AssemblyResolver.OnAssemblyResolve);
|
|
||||||
m_DomainScripts[appDomain] = new List<UUID>();
|
m_DomainScripts[appDomain] = new List<UUID>();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -1808,9 +1812,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
|
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string textpath = path + ".text";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (FileStream fs = File.Create(path + ".text"))
|
using (FileStream fs = File.Create(textpath))
|
||||||
{
|
{
|
||||||
using (StreamWriter sw = new StreamWriter(fs))
|
using (StreamWriter sw = new StreamWriter(fs))
|
||||||
{
|
{
|
||||||
|
@ -1823,7 +1829,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
|
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1872,7 +1878,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// if there already exists a file at that location, it may be locked.
|
// if there already exists a file at that location, it may be locked.
|
||||||
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
|
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,10 @@ namespace OpenSim.Server.Base
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (!(e is System.MissingMethodException))
|
if (!(e is System.MissingMethodException))
|
||||||
m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
|
{
|
||||||
|
m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}",
|
||||||
|
interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Services.AvatarService
|
||||||
if (kvp.Key.StartsWith("_"))
|
if (kvp.Key.StartsWith("_"))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count);
|
// m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count);
|
||||||
m_Database.Delete("PrincipalID", principalID.ToString());
|
m_Database.Delete("PrincipalID", principalID.ToString());
|
||||||
|
|
||||||
AvatarBaseData av = new AvatarBaseData();
|
AvatarBaseData av = new AvatarBaseData();
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
|
|
||||||
UUID mapTile = m_HGMapImage;
|
UUID mapTile = m_HGMapImage;
|
||||||
string filename = string.Empty;
|
string filename = string.Empty;
|
||||||
Bitmap bitmap = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WebClient c = new WebClient();
|
WebClient c = new WebClient();
|
||||||
|
@ -167,11 +167,18 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
c.DownloadFile(imageURL, filename);
|
c.DownloadFile(imageURL, filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
|
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] imageData = null;
|
||||||
|
|
||||||
|
using (Bitmap bitmap = new Bitmap(filename))
|
||||||
|
{
|
||||||
|
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
||||||
|
imageData = OpenJPEG.EncodeFromImage(bitmap, true);
|
||||||
|
}
|
||||||
|
|
||||||
bitmap = new Bitmap(filename);
|
|
||||||
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
|
|
||||||
byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
|
|
||||||
AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
|
AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
|
||||||
|
|
||||||
// !!! for now
|
// !!! for now
|
||||||
|
|
|
@ -349,7 +349,31 @@ namespace OpenSim.Services.LLLoginService
|
||||||
|
|
||||||
private void SetDefaultValues()
|
private void SetDefaultValues()
|
||||||
{
|
{
|
||||||
DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
|
TimeZoneInfo gridTimeZone;
|
||||||
|
|
||||||
|
// Disabled for now pending making timezone a config value, which can at some point have a default of
|
||||||
|
// a ; separated list of possible timezones.
|
||||||
|
// The problem here is that US/Pacific (or even the Olsen America/Los_Angeles) is not universal across
|
||||||
|
// windows, mac and various distributions of linux, introducing another element of consistency.
|
||||||
|
// The server operator needs to be able to control this setting
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// // First try to fetch DST from Pacific Standard Time, because this is
|
||||||
|
// // the one expected by the viewer. "US/Pacific" is the string to search
|
||||||
|
// // on linux and mac, and should work also on Windows (to confirm)
|
||||||
|
// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific");
|
||||||
|
// }
|
||||||
|
// catch (Exception e)
|
||||||
|
// {
|
||||||
|
// m_log.WarnFormat(
|
||||||
|
// "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time",
|
||||||
|
// e.Message);
|
||||||
|
|
||||||
|
gridTimeZone = TimeZoneInfo.Local;
|
||||||
|
// }
|
||||||
|
|
||||||
|
DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
|
||||||
|
|
||||||
StipendSinceLogin = "N";
|
StipendSinceLogin = "N";
|
||||||
Gendered = "Y";
|
Gendered = "Y";
|
||||||
EverLoggedIn = "Y";
|
EverLoggedIn = "Y";
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace OpenSim.Tests.Common
|
||||||
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
||||||
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
||||||
testScene.PhysicsScene
|
testScene.PhysicsScene
|
||||||
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
|
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
|
||||||
|
|
||||||
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
||||||
testScene.LoginsDisabled = false;
|
testScene.LoginsDisabled = false;
|
||||||
|
|
Loading…
Reference in New Issue