mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Merge branch 'master' of brain.opensimulator.org:/var/git/opensim
This commit is contained in:
224
OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
Normal file
224
OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using Mono.Addins;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateAcessCapModule")]
|
||||
public class EstateAccessCapModule : INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private bool m_Enabled = false;
|
||||
private string m_capUrl;
|
||||
//IEstateModule m_EstateModule;
|
||||
|
||||
#region INonSharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource pSource)
|
||||
{
|
||||
IConfig config = pSource.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_capUrl = config.GetString("Cap_EstateAccess", string.Empty);
|
||||
if (!String.IsNullOrEmpty(m_capUrl) && m_capUrl.Equals("localhost"))
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_scene = scene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (m_scene == scene)
|
||||
{
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (scene.RegionInfo == null || scene.RegionInfo.EstateSettings == null)
|
||||
{
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IEstateModule m_EstateModule = scene.RequestModuleInterface<IEstateModule>();
|
||||
if(m_EstateModule == null)
|
||||
{
|
||||
m_Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "EstateAccessCapModule"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl = "/CAPS/" + UUID.Random() + "/";
|
||||
|
||||
caps.RegisterHandler(
|
||||
"EstateAccess",
|
||||
new RestHTTPHandler(
|
||||
"GET",
|
||||
capUrl,
|
||||
httpMethod => ProcessRequest(httpMethod, agentID, caps),
|
||||
"EstateAccess",
|
||||
agentID.ToString())); ;
|
||||
}
|
||||
|
||||
public Hashtable ProcessRequest(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
|
||||
ScenePresence avatar;
|
||||
if (!m_scene.TryGetScenePresence(AgentId, out avatar))
|
||||
{
|
||||
responsedata["str_response_string"] = "<llsd><array /></llsd>"; ;
|
||||
responsedata["keepalive"] = false;
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
if (m_scene.RegionInfo == null
|
||||
|| m_scene.RegionInfo.EstateSettings == null
|
||||
||!m_scene.Permissions.CanIssueEstateCommand(AgentId, false))
|
||||
{
|
||||
responsedata["str_response_string"] = "<llsd><array /></llsd>"; ;
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
EstateSettings regionSettings = m_scene.RegionInfo.EstateSettings;
|
||||
UUID[] managers = regionSettings.EstateManagers;
|
||||
UUID[] allowed = regionSettings.EstateAccess;
|
||||
UUID[] groups = regionSettings.EstateGroups;
|
||||
EstateBan[] EstateBans = regionSettings.EstateBans;
|
||||
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
LLSDxmlEncode.AddArray(sb);
|
||||
|
||||
if (allowed != null && allowed.Length > 0)
|
||||
{
|
||||
LLSDxmlEncode.AddMap("AllowedAgents", sb);
|
||||
for (int i = 0; i < allowed.Length; ++i)
|
||||
{
|
||||
UUID id = allowed[i];
|
||||
if (id == UUID.Zero)
|
||||
continue;
|
||||
LLSDxmlEncode.AddElem("id", id, sb);
|
||||
}
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
}
|
||||
|
||||
if (groups != null && groups.Length > 0)
|
||||
{
|
||||
LLSDxmlEncode.AddMap("AllowedGroups", sb);
|
||||
for (int i = 0; i < groups.Length; ++i)
|
||||
{
|
||||
UUID id = groups[i];
|
||||
if (id == UUID.Zero)
|
||||
continue;
|
||||
LLSDxmlEncode.AddElem("id", id, sb);
|
||||
}
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
}
|
||||
|
||||
if (EstateBans != null && EstateBans.Length > 0)
|
||||
{
|
||||
LLSDxmlEncode.AddMap("BannedAgents", sb);
|
||||
for (int i = 0; i < EstateBans.Length; ++i)
|
||||
{
|
||||
UUID id = EstateBans[i].BannedUserID;
|
||||
if (id == UUID.Zero)
|
||||
continue;
|
||||
LLSDxmlEncode.AddElem("id", id, sb);
|
||||
}
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
}
|
||||
|
||||
if (managers != null && managers.Length > 0)
|
||||
{
|
||||
LLSDxmlEncode.AddMap("Managers", sb);
|
||||
for (int i = 0; i < managers.Length; ++i)
|
||||
LLSDxmlEncode.AddElem("id", managers[i], sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
responsedata["str_response_string"] = LLSDxmlEncode.End(sb);
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -994,7 +994,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
else
|
||||
{
|
||||
// keeping previus odd average
|
||||
// keeping previous odd average
|
||||
avgx = (avgx * tempArea + x) / (tempArea + 1);
|
||||
avgy = (avgy * tempArea + y) / (tempArea + 1);
|
||||
}
|
||||
|
||||
@@ -441,6 +441,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||
startHeights[0], startHeights[2],
|
||||
startHeights[1], startHeights[3],
|
||||
pctX, pctY);
|
||||
if (float.IsNaN(startHeight))
|
||||
return 0;
|
||||
|
||||
startHeight = Utils.Clamp(startHeight, 0f, 255f);
|
||||
|
||||
float heightRange = ImageUtils.Bilinear(
|
||||
@@ -448,7 +451,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||
heightRanges[1], heightRanges[3],
|
||||
pctX, pctY);
|
||||
heightRange = Utils.Clamp(heightRange, 0f, 255f);
|
||||
if(heightRange == 0f)
|
||||
if(heightRange == 0f || float.IsNaN(heightRange))
|
||||
return 0;
|
||||
|
||||
// Generate two frequencies of perlin noise based on our global position
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if(group == null || group.IsDeleted)
|
||||
return;
|
||||
|
||||
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
||||
if (Permissions.CanMoveObject(group, remoteClient))
|
||||
{
|
||||
group.GrabMovement(objectID, offset, pos, remoteClient);
|
||||
}
|
||||
@@ -359,16 +359,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Vector3 grabOffset = pos - part.AbsolutePosition;
|
||||
// If the touched prim handles touches, deliver it
|
||||
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
||||
// EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
||||
EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, remoteClient, surfaceArg);
|
||||
|
||||
// Deliver to the root prim if the touched prim doesn't handle touches
|
||||
// or if we're meant to pass on touches anyway.
|
||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
||||
{
|
||||
// EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
|
||||
EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, grabOffset, remoteClient, surfaceArg);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
||||
|
||||
@@ -2086,13 +2086,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
|
||||
if (m_rootPart.LocalId == localId)
|
||||
{
|
||||
if((RootPart.ScriptEvents & scriptEvents.anytouch) != 0)
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabGroup(offsetPos, remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = GetPart(localId);
|
||||
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabPart(part, offsetPos, remoteClient);
|
||||
}
|
||||
}
|
||||
@@ -3615,6 +3622,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
|
||||
}
|
||||
|
||||
double lastTouchTime = 0;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, apply force to move it around
|
||||
/// If object is not physical, just put it at the resulting location
|
||||
@@ -3623,7 +3634,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
|
||||
/// <param name="pos">New position. We do the math here to turn it into a force</param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
|
||||
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClienth)
|
||||
{
|
||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||
{
|
||||
@@ -3650,24 +3661,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
if(IsAttachment)
|
||||
return;
|
||||
|
||||
// block movement if there was a touch at start
|
||||
double now = Util.GetTimeStampMS();
|
||||
if (now - lastTouchTime < 250)
|
||||
{
|
||||
lastTouchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
// a touch or pass may had become active ??
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
{
|
||||
lastTouchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
lastTouchTime = 0;
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
|
||||
/// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
|
||||
/// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
|
||||
/// block grab on prims with touch events.
|
||||
/// </summary>
|
||||
/// <param name="pos">New Position</param>
|
||||
public void NonPhysicalGrabMovement(Vector3 pos)
|
||||
{
|
||||
if(!IsAttachment && ScriptCount() == 0)
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, prepare for spinning torques (set flag to save old orientation)
|
||||
/// </summary>
|
||||
|
||||
@@ -3023,11 +3023,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (m_scriptEvents.ContainsKey(scriptid))
|
||||
{
|
||||
scriptEvents oldparts = scriptEvents.None;
|
||||
oldparts = (scriptEvents) m_scriptEvents[scriptid];
|
||||
|
||||
// remove values from aggregated script events
|
||||
AggregateScriptEvents &= ~oldparts;
|
||||
m_scriptEvents.Remove(scriptid);
|
||||
aggregateScriptEvents();
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_part.ParentGroup.InvalidateDeepEffectivePerms();
|
||||
|
||||
m_inventorySerial++;
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
@@ -1115,6 +1114,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_part.ScheduleFullUpdate();
|
||||
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
return type;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -272,17 +272,19 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
if (elemOsd != null && elemOsd is OSDMap)
|
||||
{
|
||||
OSDMap matMap = elemOsd as OSDMap;
|
||||
if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material"))
|
||||
OSD OSDID;
|
||||
OSD OSDMaterial;
|
||||
if (matMap.TryGetValue("ID", out OSDID) && matMap.TryGetValue("Material", out OSDMaterial) && OSDMaterial is OSDMap)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (materialslock)
|
||||
{
|
||||
UUID id = matMap["ID"].AsUUID();
|
||||
UUID id = OSDID.AsUUID();
|
||||
if(m_Materials.ContainsKey(id))
|
||||
continue;
|
||||
|
||||
OSDMap theMatMap = (OSDMap)matMap["Material"];
|
||||
OSDMap theMatMap = (OSDMap)OSDMaterial;
|
||||
FaceMaterial fmat = new FaceMaterial(theMatMap);
|
||||
|
||||
if(fmat == null ||
|
||||
@@ -290,7 +292,7 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
&& fmat.NormalMapID == UUID.Zero
|
||||
&& fmat.SpecularMapID == UUID.Zero))
|
||||
continue;
|
||||
|
||||
|
||||
fmat.ID = id;
|
||||
m_Materials[id] = fmat;
|
||||
m_MaterialsRefCount[id] = 0;
|
||||
@@ -459,12 +461,13 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
OSDArray respArr = new OSDArray();
|
||||
OSD tmpOSD;
|
||||
|
||||
if (req.ContainsKey("Zipped"))
|
||||
if (req.TryGetValue("Zipped", out tmpOSD))
|
||||
{
|
||||
OSD osd = null;
|
||||
|
||||
byte[] inBytes = req["Zipped"].AsBinary();
|
||||
byte[] inBytes = tmpOSD.AsBinary();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -531,12 +534,13 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
|
||||
OSDArray respArr = new OSDArray();
|
||||
|
||||
OSD tmpOSD;
|
||||
HashSet<SceneObjectPart> parts = new HashSet<SceneObjectPart>();
|
||||
if (req.ContainsKey("Zipped"))
|
||||
if (req.TryGetValue("Zipped", out tmpOSD))
|
||||
{
|
||||
OSD osd = null;
|
||||
|
||||
byte[] inBytes = req["Zipped"].AsBinary();
|
||||
byte[] inBytes = tmpOSD.AsBinary();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -546,145 +550,140 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
{
|
||||
materialsFromViewer = osd as OSDMap;
|
||||
|
||||
if (materialsFromViewer.ContainsKey("FullMaterialsPerFace"))
|
||||
if (materialsFromViewer.TryGetValue("FullMaterialsPerFace", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
{
|
||||
OSD matsOsd = materialsFromViewer["FullMaterialsPerFace"];
|
||||
if (matsOsd is OSDArray)
|
||||
OSDArray matsArr = tmpOSD as OSDArray;
|
||||
try
|
||||
{
|
||||
OSDArray matsArr = matsOsd as OSDArray;
|
||||
|
||||
try
|
||||
foreach (OSDMap matsMap in matsArr)
|
||||
{
|
||||
foreach (OSDMap matsMap in matsArr)
|
||||
uint primLocalID = 0;
|
||||
try
|
||||
{
|
||||
uint primLocalID = 0;
|
||||
try
|
||||
{
|
||||
primLocalID = matsMap["ID"].AsUInteger();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
|
||||
continue;
|
||||
}
|
||||
primLocalID = matsMap["ID"].AsUInteger();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[Materials]: cannot decode \"ID\" from matsMap: " + e.Message);
|
||||
continue;
|
||||
}
|
||||
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
|
||||
if (sop == null)
|
||||
{
|
||||
m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString());
|
||||
continue;
|
||||
}
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(primLocalID);
|
||||
if (sop == null)
|
||||
{
|
||||
m_log.WarnFormat("[Materials]: SOP not found for localId: {0}", primLocalID.ToString());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID))
|
||||
{
|
||||
m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
|
||||
continue;
|
||||
}
|
||||
if (!m_scene.Permissions.CanEditObject(sop.UUID, agentID))
|
||||
{
|
||||
m_log.WarnFormat("User {0} can't edit object {1} {2}", agentID, sop.Name, sop.UUID);
|
||||
continue;
|
||||
}
|
||||
|
||||
OSDMap mat = null;
|
||||
try
|
||||
{
|
||||
mat = matsMap["Material"] as OSDMap;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
|
||||
continue;
|
||||
}
|
||||
OSDMap mat = null;
|
||||
try
|
||||
{
|
||||
mat = matsMap["Material"] as OSDMap;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[Materials]: cannot decode \"Material\" from matsMap: " + e.Message);
|
||||
continue;
|
||||
}
|
||||
|
||||
Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
|
||||
if (te == null)
|
||||
{
|
||||
m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID);
|
||||
continue;
|
||||
}
|
||||
Primitive.TextureEntry te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
|
||||
if (te == null)
|
||||
{
|
||||
m_log.WarnFormat("[Materials]: Error in TextureEntry for SOP {0} {1}", sop.Name, sop.UUID);
|
||||
continue;
|
||||
}
|
||||
|
||||
int face = -1;
|
||||
UUID oldid = UUID.Zero;
|
||||
Primitive.TextureEntryFace faceEntry = null;
|
||||
if (matsMap.ContainsKey("Face"))
|
||||
{
|
||||
face = matsMap["Face"].AsInteger();
|
||||
faceEntry = te.CreateFace((uint)face);
|
||||
}
|
||||
else
|
||||
faceEntry = te.DefaultTexture;
|
||||
int face = -1;
|
||||
UUID oldid = UUID.Zero;
|
||||
Primitive.TextureEntryFace faceEntry = null;
|
||||
if (matsMap.TryGetValue("Face", out tmpOSD))
|
||||
{
|
||||
face = tmpOSD.AsInteger();
|
||||
faceEntry = te.CreateFace((uint)face);
|
||||
}
|
||||
else
|
||||
faceEntry = te.DefaultTexture;
|
||||
|
||||
if (faceEntry == null)
|
||||
continue;
|
||||
if (faceEntry == null)
|
||||
continue;
|
||||
|
||||
UUID id;
|
||||
FaceMaterial newFaceMat = null;
|
||||
if (mat == null)
|
||||
{
|
||||
// This happens then the user removes a material from a prim
|
||||
UUID id;
|
||||
FaceMaterial newFaceMat = null;
|
||||
if (mat == null)
|
||||
{
|
||||
// This happens then the user removes a material from a prim
|
||||
id = UUID.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
newFaceMat = new FaceMaterial(mat);
|
||||
if(newFaceMat.DiffuseAlphaMode == 1
|
||||
&& newFaceMat.NormalMapID == UUID.Zero
|
||||
&& newFaceMat.SpecularMapID == UUID.Zero
|
||||
)
|
||||
id = UUID.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
newFaceMat = new FaceMaterial(mat);
|
||||
if(newFaceMat.DiffuseAlphaMode == 1
|
||||
&& newFaceMat.NormalMapID == UUID.Zero
|
||||
&& newFaceMat.SpecularMapID == UUID.Zero
|
||||
)
|
||||
id = UUID.Zero;
|
||||
newFaceMat.genID();
|
||||
id = newFaceMat.ID;
|
||||
}
|
||||
}
|
||||
|
||||
oldid = faceEntry.MaterialID;
|
||||
|
||||
if(oldid == id)
|
||||
continue;
|
||||
|
||||
if (faceEntry != null)
|
||||
{
|
||||
faceEntry.MaterialID = id;
|
||||
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
|
||||
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
|
||||
sop.Shape.TextureEntry = te.GetBytes(9);
|
||||
}
|
||||
|
||||
if(oldid != UUID.Zero)
|
||||
RemoveMaterial(oldid);
|
||||
|
||||
lock(materialslock)
|
||||
{
|
||||
if(id != UUID.Zero)
|
||||
{
|
||||
if (m_Materials.ContainsKey(id))
|
||||
m_MaterialsRefCount[id]++;
|
||||
else
|
||||
{
|
||||
newFaceMat.genID();
|
||||
id = newFaceMat.ID;
|
||||
m_Materials[id] = newFaceMat;
|
||||
m_MaterialsRefCount[id] = 1;
|
||||
m_changed[newFaceMat] = Util.GetTimeStamp();
|
||||
}
|
||||
}
|
||||
|
||||
oldid = faceEntry.MaterialID;
|
||||
|
||||
if(oldid == id)
|
||||
continue;
|
||||
|
||||
if (faceEntry != null)
|
||||
{
|
||||
faceEntry.MaterialID = id;
|
||||
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
|
||||
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
|
||||
sop.Shape.TextureEntry = te.GetBytes(9);
|
||||
}
|
||||
|
||||
if(oldid != UUID.Zero)
|
||||
RemoveMaterial(oldid);
|
||||
|
||||
lock(materialslock)
|
||||
{
|
||||
if(id != UUID.Zero)
|
||||
{
|
||||
if (m_Materials.ContainsKey(id))
|
||||
m_MaterialsRefCount[id]++;
|
||||
else
|
||||
{
|
||||
m_Materials[id] = newFaceMat;
|
||||
m_MaterialsRefCount[id] = 1;
|
||||
m_changed[newFaceMat] = Util.GetTimeStamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!parts.Contains(sop))
|
||||
parts.Add(sop);
|
||||
}
|
||||
|
||||
foreach(SceneObjectPart sop in parts)
|
||||
{
|
||||
if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
|
||||
{
|
||||
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
|
||||
sop.ScheduleFullUpdate();
|
||||
sop.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
if(!parts.Contains(sop))
|
||||
parts.Add(sop);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
foreach(SceneObjectPart sop in parts)
|
||||
{
|
||||
m_log.Warn("[Materials]: exception processing received material ", e);
|
||||
if (sop.ParentGroup != null && !sop.ParentGroup.IsDeleted)
|
||||
{
|
||||
sop.TriggerScriptChangedEvent(Changed.TEXTURE);
|
||||
sop.ScheduleFullUpdate();
|
||||
sop.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[Materials]: exception processing received material ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
if(numCoords < 3 || (!needsConvexProcessing && numFaces < 1))
|
||||
{
|
||||
m_log.ErrorFormat("[MESH]: invalid degenerated mesh for prim {0} ignored", primName);
|
||||
m_log.ErrorFormat("[ubODEMesh]: invalid degenerated mesh for prim {0} ignored", primName);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
|
||||
if(mesh.numberVertices() < 3 || mesh.numberTriangles() < 1)
|
||||
{
|
||||
m_log.ErrorFormat("[MESH]: invalid degenerated mesh for prim {0} ignored", primName);
|
||||
m_log.ErrorFormat("[ubODEMesh]: invalid degenerated mesh for prim {0} ignored", primName);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -784,25 +784,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Float llCos(double f)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Cos(f);
|
||||
return Math.Cos(f);
|
||||
}
|
||||
|
||||
public LSL_Float llTan(double f)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Tan(f);
|
||||
return Math.Tan(f);
|
||||
}
|
||||
|
||||
public LSL_Float llAtan2(double x, double y)
|
||||
public LSL_Float llAtan2(LSL_Float x, LSL_Float y)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Atan2(x, y);
|
||||
return Math.Atan2(x, y);
|
||||
}
|
||||
|
||||
public LSL_Float llSqrt(double f)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Sqrt(f);
|
||||
return Math.Sqrt(f);
|
||||
}
|
||||
|
||||
public LSL_Float llPow(double fbase, double fexponent)
|
||||
@@ -811,7 +811,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return (double)Math.Pow(fbase, fexponent);
|
||||
}
|
||||
|
||||
public LSL_Integer llAbs(int i)
|
||||
public LSL_Integer llAbs(LSL_Integer i)
|
||||
{
|
||||
// changed to replicate LSL behaviour whereby minimum int value is returned untouched.
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -3069,7 +3069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.ParentGroup.StopMoveToTarget();
|
||||
}
|
||||
|
||||
public void llApplyImpulse(LSL_Vector force, int local)
|
||||
public void llApplyImpulse(LSL_Vector force, LSL_Integer local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
//No energy force yet
|
||||
@@ -3526,7 +3526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return src.ToLower();
|
||||
}
|
||||
|
||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||
public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount)
|
||||
{
|
||||
Util.FireAndForget(x =>
|
||||
{
|
||||
@@ -3785,7 +3785,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return 100f * llGetMass();
|
||||
}
|
||||
|
||||
public void llCollisionFilter(string name, string id, int accept)
|
||||
public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.CollisionFilter.Clear();
|
||||
@@ -4513,7 +4513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public void llCreateLink(LSL_String target, LSL_Integer parent)
|
||||
public void llCreateLink(LSL_Key target, LSL_Integer parent)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -4847,7 +4847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public void llGiveInventory(string destination, string inventory)
|
||||
public void llGiveInventory(LSL_Key destination, LSL_String inventory)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -5317,7 +5317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public void llCollisionSound(string impact_sound, double impact_volume)
|
||||
public void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -5344,11 +5344,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.aggregateScriptEvents();
|
||||
}
|
||||
|
||||
public LSL_String llGetAnimation(string id)
|
||||
public LSL_String llGetAnimation(LSL_Key id)
|
||||
{
|
||||
// This should only return a value if the avatar is in the same region
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID avatar = (UUID)id;
|
||||
UUID avatar;
|
||||
if(!UUID.TryParse(id, out avatar))
|
||||
return "";
|
||||
ScenePresence presence = World.GetScenePresence(avatar);
|
||||
if (presence == null)
|
||||
return "";
|
||||
@@ -5698,13 +5700,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return angle;
|
||||
}
|
||||
|
||||
public LSL_Float llAcos(double val)
|
||||
public LSL_Float llAcos(LSL_Float val)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Acos(val);
|
||||
}
|
||||
|
||||
public LSL_Float llAsin(double val)
|
||||
public LSL_Float llAsin(LSL_Float val)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return (double)Math.Asin(val);
|
||||
@@ -5744,7 +5746,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return UUID.Zero.ToString();
|
||||
}
|
||||
|
||||
public void llAllowInventoryDrop(int add)
|
||||
public void llAllowInventoryDrop(LSL_Integer add)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -6387,75 +6389,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_String llGetEnv(LSL_String name)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (name == "agent_limit")
|
||||
switch(name)
|
||||
{
|
||||
return World.RegionInfo.RegionSettings.AgentLimit.ToString();
|
||||
}
|
||||
else if (name == "dynamic_pathfinding")
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
else if (name == "estate_id")
|
||||
{
|
||||
return World.RegionInfo.EstateSettings.EstateID.ToString();
|
||||
}
|
||||
else if (name == "estate_name")
|
||||
{
|
||||
return World.RegionInfo.EstateSettings.EstateName;
|
||||
}
|
||||
else if (name == "frame_number")
|
||||
{
|
||||
return World.Frame.ToString();
|
||||
}
|
||||
else if (name == "region_cpu_ratio")
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
else if (name == "region_idle")
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
else if (name == "region_product_name")
|
||||
{
|
||||
if (World.RegionInfo.RegionType != String.Empty)
|
||||
return World.RegionInfo.RegionType;
|
||||
else
|
||||
case "agent_limit":
|
||||
return World.RegionInfo.RegionSettings.AgentLimit.ToString();
|
||||
|
||||
case "dynamic_pathfinding":
|
||||
return "0";
|
||||
|
||||
case "estate_id":
|
||||
return World.RegionInfo.EstateSettings.EstateID.ToString();
|
||||
|
||||
case "estate_name":
|
||||
return World.RegionInfo.EstateSettings.EstateName;
|
||||
|
||||
case "frame_number":
|
||||
return World.Frame.ToString();
|
||||
|
||||
case "region_cpu_ratio":
|
||||
return "1";
|
||||
|
||||
case "region_idle":
|
||||
return "0";
|
||||
|
||||
case "region_product_name":
|
||||
if (World.RegionInfo.RegionType != String.Empty)
|
||||
return World.RegionInfo.RegionType;
|
||||
else
|
||||
return "";
|
||||
|
||||
case "region_product_sku":
|
||||
return "OpenSim";
|
||||
|
||||
case "region_start_time":
|
||||
return World.UnixStartTime.ToString();
|
||||
|
||||
case "region_up_time":
|
||||
int time = Util.UnixTimeSinceEpoch() - World.UnixStartTime;
|
||||
return time.ToString();
|
||||
|
||||
case "sim_channel":
|
||||
return "OpenSim";
|
||||
|
||||
case "sim_version":
|
||||
return World.GetSimulatorVersion();
|
||||
|
||||
case "simulator_hostname":
|
||||
IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
|
||||
return UrlModule.ExternalHostNameForLSL;
|
||||
|
||||
case "region_max_prims":
|
||||
return World.RegionInfo.ObjectCapacity.ToString();
|
||||
|
||||
case "region_object_bonus":
|
||||
return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
else if (name == "region_product_sku")
|
||||
{
|
||||
return "OpenSim";
|
||||
}
|
||||
else if (name == "region_start_time")
|
||||
{
|
||||
return World.UnixStartTime.ToString();
|
||||
}
|
||||
else if (name == "sim_channel")
|
||||
{
|
||||
return "OpenSim";
|
||||
}
|
||||
else if (name == "sim_version")
|
||||
{
|
||||
return World.GetSimulatorVersion();
|
||||
}
|
||||
else if (name == "simulator_hostname")
|
||||
{
|
||||
IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
|
||||
return UrlModule.ExternalHostNameForLSL;
|
||||
}
|
||||
else if (name == "region_max_prims")
|
||||
{
|
||||
return World.RegionInfo.ObjectCapacity.ToString();
|
||||
}
|
||||
else if (name == "region_object_bonus")
|
||||
{
|
||||
return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -6650,7 +6641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// AGENT_BUSY
|
||||
/// Remove as they are done
|
||||
/// </summary>
|
||||
public LSL_Integer llGetAgentInfo(string id)
|
||||
public LSL_Integer llGetAgentInfo(LSL_Key id)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -6757,7 +6748,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return flags;
|
||||
}
|
||||
|
||||
public LSL_String llGetAgentLanguage(string id)
|
||||
public LSL_String llGetAgentLanguage(LSL_Key id)
|
||||
{
|
||||
// This should only return a value if the avatar is in the same region, but eh. idc.
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -6868,7 +6859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return result;
|
||||
}
|
||||
|
||||
public void llAdjustSoundVolume(double volume)
|
||||
public void llAdjustSoundVolume(LSL_Float volume)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.AdjustSoundGain(volume);
|
||||
@@ -6881,7 +6872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.SoundRadius = radius;
|
||||
}
|
||||
|
||||
public LSL_String llKey2Name(string id)
|
||||
public LSL_String llKey2Name(LSL_Key id)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key = new UUID();
|
||||
@@ -7055,22 +7046,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// only the height of avatars vary and that says:
|
||||
/// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
|
||||
/// </summary>
|
||||
public LSL_Vector llGetAgentSize(string id)
|
||||
public LSL_Vector llGetAgentSize(LSL_Key id)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScenePresence avatar = World.GetScenePresence((UUID)id);
|
||||
LSL_Vector agentSize;
|
||||
UUID avID;
|
||||
if(!UUID.TryParse(id, out avID))
|
||||
return ScriptBaseClass.ZERO_VECTOR;
|
||||
|
||||
ScenePresence avatar = World.GetScenePresence(avID);
|
||||
if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region
|
||||
{
|
||||
agentSize = ScriptBaseClass.ZERO_VECTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ScriptBaseClass.ZERO_VECTOR;
|
||||
|
||||
// agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight);
|
||||
Vector3 s = avatar.Appearance.AvatarSize;
|
||||
agentSize = new LSL_Vector(s.X, s.Y, s.Z);
|
||||
}
|
||||
return agentSize;
|
||||
Vector3 s = avatar.Appearance.AvatarSize;
|
||||
return new LSL_Vector(s.X, s.Y, s.Z);
|
||||
}
|
||||
|
||||
public LSL_Integer llSameGroup(string id)
|
||||
@@ -7246,12 +7235,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return m_host.ParentGroup.AttachmentPoint;
|
||||
}
|
||||
|
||||
public LSL_List llGetAttachedList(string id)
|
||||
public LSL_List llGetAttachedList(LSL_Key id)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
ScenePresence av = World.GetScenePresence((UUID)id);
|
||||
UUID avID;
|
||||
if(!UUID.TryParse(id, out avID))
|
||||
return new LSL_List("NOT_FOUND");
|
||||
|
||||
ScenePresence av = World.GetScenePresence(avID);
|
||||
if (av == null || av.IsDeleted)
|
||||
return new LSL_List("NOT_FOUND");
|
||||
|
||||
@@ -7836,7 +7828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public void llGiveInventoryList(string destination, string category, LSL_List inventory)
|
||||
public void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -8014,7 +8006,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
|
||||
public void llAddToLandPassList(LSL_Key avatar, double hours)
|
||||
public void llAddToLandPassList(LSL_Key avatar, LSL_Float hours)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key;
|
||||
@@ -11086,16 +11078,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return (double)Math.Log(val);
|
||||
}
|
||||
|
||||
public LSL_List llGetAnimationList(string id)
|
||||
public LSL_List llGetAnimationList(LSL_Key id)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
LSL_List l = new LSL_List();
|
||||
ScenePresence av = World.GetScenePresence((UUID)id);
|
||||
UUID avID;
|
||||
if(!UUID.TryParse(id, out avID))
|
||||
return new LSL_List();
|
||||
|
||||
ScenePresence av = World.GetScenePresence(avID);
|
||||
if (av == null || av.IsChildAgent) // only if in the region
|
||||
return l;
|
||||
return new LSL_List();
|
||||
|
||||
UUID[] anims;
|
||||
anims = av.Animator.GetAnimationArray();
|
||||
LSL_List l = new LSL_List();
|
||||
foreach (UUID foo in anims)
|
||||
l.Add(new LSL_Key(foo.ToString()));
|
||||
return l;
|
||||
@@ -13619,7 +13616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ScriptSleep(m_sleepMsOnMapDestination);
|
||||
}
|
||||
|
||||
public void llAddToLandBanList(LSL_Key avatar, double hours)
|
||||
public void llAddToLandBanList(LSL_Key avatar, LSL_Float hours)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key;
|
||||
@@ -14343,6 +14340,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case "5":
|
||||
ret.Add(new LSL_Key(land.GlobalID.ToString()));
|
||||
break;
|
||||
case "64":
|
||||
ret.Add(new LSL_Integer(land.Dwell));
|
||||
break;
|
||||
default:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
@@ -15056,7 +15056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return name.Replace(" ", ".").ToLower();
|
||||
}
|
||||
|
||||
public LSL_String llGetUsername(string id)
|
||||
public LSL_String llGetUsername(LSL_Key id)
|
||||
{
|
||||
return Name2Username(llKey2Name(id));
|
||||
}
|
||||
@@ -16599,7 +16599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value);
|
||||
}
|
||||
|
||||
public void llCollisionSprite(string impact_sprite)
|
||||
public void llCollisionSprite(LSL_String impact_sprite)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// Viewer 2.0 broke this and it's likely LL has no intention
|
||||
@@ -16660,7 +16660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
new DetectParams[0]));
|
||||
}
|
||||
|
||||
public LSL_Key llTransferLindenDollars(string destination, int amount)
|
||||
public LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount)
|
||||
{
|
||||
UUID txn = UUID.Random();
|
||||
|
||||
|
||||
@@ -1600,6 +1600,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public LSL_Integer osGetParcelDwell(LSL_Vector pos)
|
||||
{
|
||||
LandData land = World.GetLandData(pos);
|
||||
if (land != null)
|
||||
{
|
||||
return (int)land.Dwell;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Routines for creating and managing parcels programmatically
|
||||
public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2)
|
||||
{
|
||||
|
||||
@@ -41,20 +41,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
{
|
||||
void state(string newState);
|
||||
|
||||
LSL_Integer llAbs(int val);
|
||||
LSL_Float llAcos(double val);
|
||||
LSL_Integer llAbs(LSL_Integer val);
|
||||
LSL_Float llAcos(LSL_Float val);
|
||||
//ApiDesc Sleep 0.1
|
||||
void llAddToLandBanList(LSL_Key avatarId, double hours);
|
||||
void llAddToLandBanList(LSL_Key avatarId, LSL_Float hours);
|
||||
//ApiDesc Sleep 0.1
|
||||
void llAddToLandPassList(LSL_Key avatarId, double hours);
|
||||
void llAddToLandPassList(LSL_Key avatarId, LSL_Float hours);
|
||||
//ApiDesc Sleep 0.1
|
||||
void llAdjustSoundVolume(double volume);
|
||||
void llAllowInventoryDrop(int add);
|
||||
void llAdjustSoundVolume(LSL_Float volume);
|
||||
void llAllowInventoryDrop(LSL_Integer add);
|
||||
LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b);
|
||||
void llApplyImpulse(LSL_Vector force, int local);
|
||||
void llApplyImpulse(LSL_Vector force, LSL_Integer local);
|
||||
void llApplyRotationalImpulse(LSL_Vector force, int local);
|
||||
LSL_Float llAsin(double val);
|
||||
LSL_Float llAtan2(double x, double y);
|
||||
LSL_Float llAsin(LSL_Float val);
|
||||
LSL_Float llAtan2(LSL_Float x, LSL_Float y);
|
||||
void llAttachToAvatar(LSL_Integer attachment);
|
||||
void llAttachToAvatarTemp(LSL_Integer attachmentPoint);
|
||||
LSL_Key llAvatarOnSitTarget();
|
||||
@@ -74,13 +74,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
//ApiDesc Sleep 1.0
|
||||
void llCloseRemoteDataChannel(string channel);
|
||||
LSL_Float llCloud(LSL_Vector offset);
|
||||
void llCollisionFilter(string name, string id, int accept);
|
||||
void llCollisionSound(string impact_sound, double impact_volume);
|
||||
void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept);
|
||||
void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume);
|
||||
//ApiDesc Not Supported - does nothing
|
||||
void llCollisionSprite(string impact_sprite);
|
||||
void llCollisionSprite(LSL_String impact_sprite);
|
||||
LSL_Float llCos(double f);
|
||||
//ApiDesc Sleep 1.0
|
||||
void llCreateLink(LSL_String targetId, LSL_Integer parent);
|
||||
void llCreateLink(LSL_Key targetId, LSL_Integer parent);
|
||||
LSL_List llCSV2List(string src);
|
||||
LSL_List llDeleteSubList(LSL_List src, int start, int end);
|
||||
LSL_String llDeleteSubString(string src, int start, int end);
|
||||
@@ -116,16 +116,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Float llFrand(double mag);
|
||||
LSL_Key llGenerateKey();
|
||||
LSL_Vector llGetAccel();
|
||||
LSL_Integer llGetAgentInfo(string id);
|
||||
LSL_String llGetAgentLanguage(string id);
|
||||
LSL_Integer llGetAgentInfo(LSL_Key id);
|
||||
LSL_String llGetAgentLanguage(LSL_Key id);
|
||||
LSL_List llGetAgentList(LSL_Integer scope, LSL_List options);
|
||||
LSL_Vector llGetAgentSize(string id);
|
||||
LSL_Vector llGetAgentSize(LSL_Key id);
|
||||
LSL_Float llGetAlpha(int face);
|
||||
LSL_Float llGetAndResetTime();
|
||||
LSL_String llGetAnimation(string id);
|
||||
LSL_List llGetAnimationList(string id);
|
||||
LSL_String llGetAnimation(LSL_Key id);
|
||||
LSL_List llGetAnimationList(LSL_Key id);
|
||||
LSL_Integer llGetAttached();
|
||||
LSL_List llGetAttachedList(string id);
|
||||
LSL_List llGetAttachedList(LSL_Key id);
|
||||
LSL_List llGetBoundingBox(string obj);
|
||||
LSL_Vector llGetCameraPos();
|
||||
LSL_Rotation llGetCameraRot();
|
||||
@@ -217,10 +217,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Integer llGetUnixTime();
|
||||
LSL_Vector llGetVel();
|
||||
LSL_Float llGetWallclock();
|
||||
void llGiveInventory(string destination, string inventory);
|
||||
void llGiveInventoryList(string destination, string category, LSL_List inventory);
|
||||
LSL_Integer llGiveMoney(string destination, int amount);
|
||||
LSL_Key llTransferLindenDollars(string destination, int amount);
|
||||
void llGiveInventory(LSL_Key destination, LSL_String inventory);
|
||||
void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory);
|
||||
LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount);
|
||||
LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount);
|
||||
void llGodLikeRezObject(string inventory, LSL_Vector pos);
|
||||
LSL_Float llGround(LSL_Vector offset);
|
||||
LSL_Vector llGroundContour(LSL_Vector offset);
|
||||
@@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_String llInsertString(string dst, int position, string src);
|
||||
void llInstantMessage(string user, string message);
|
||||
LSL_String llIntegerToBase64(int number);
|
||||
LSL_String llKey2Name(string id);
|
||||
LSL_String llGetUsername(string id);
|
||||
LSL_String llKey2Name(LSL_Key id);
|
||||
LSL_String llGetUsername(LSL_Key id);
|
||||
LSL_Key llRequestUsername(string id);
|
||||
LSL_String llGetDisplayName(string id);
|
||||
LSL_Key llRequestDisplayName(string id);
|
||||
|
||||
@@ -260,6 +260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Float osGetWindParam(string plugin, string param);
|
||||
|
||||
// Parcel commands
|
||||
LSL_Integer osGetParcelDwell(vector pos);
|
||||
void osParcelJoin(vector pos1, vector pos2);
|
||||
void osParcelSubdivide(vector pos1, vector pos2);
|
||||
void osSetParcelDetails(vector pos, LSL_List rules);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public partial class ScriptBaseClass
|
||||
{
|
||||
// SCRIPTS CONSTANTS
|
||||
public static readonly LSLInteger OS_APIVERSION = 4;
|
||||
public static readonly LSLInteger OS_APIVERSION = 5;
|
||||
|
||||
public static readonly LSLInteger TRUE = 1;
|
||||
public static readonly LSLInteger FALSE = 0;
|
||||
@@ -728,6 +728,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public const int PARCEL_DETAILS_SEE_AVATARS = 6;
|
||||
public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7;
|
||||
public const int PARCEL_DETAILS_GROUP_SOUNDS = 8;
|
||||
// constants for llGetParcelDetails os specific
|
||||
public const int PARCEL_DETAILS_DWELL = 64;
|
||||
|
||||
//osSetParcelDetails
|
||||
public const int PARCEL_DETAILS_CLAIMDATE = 10;
|
||||
|
||||
@@ -65,32 +65,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
//
|
||||
// Script functions
|
||||
//
|
||||
public LSL_Integer llAbs(int i)
|
||||
public LSL_Integer llAbs(LSL_Integer i)
|
||||
{
|
||||
return m_LSL_Functions.llAbs(i);
|
||||
}
|
||||
|
||||
public LSL_Float llAcos(double val)
|
||||
public LSL_Float llAcos(LSL_Float val)
|
||||
{
|
||||
return m_LSL_Functions.llAcos(val);
|
||||
}
|
||||
|
||||
public void llAddToLandBanList(string avatar, double hours)
|
||||
public void llAddToLandBanList(LSL_Key avatar, LSL_Float hours)
|
||||
{
|
||||
m_LSL_Functions.llAddToLandBanList(avatar, hours);
|
||||
}
|
||||
|
||||
public void llAddToLandPassList(string avatar, double hours)
|
||||
public void llAddToLandPassList(LSL_Key avatar, LSL_Float hours)
|
||||
{
|
||||
m_LSL_Functions.llAddToLandPassList(avatar, hours);
|
||||
}
|
||||
|
||||
public void llAdjustSoundVolume(double volume)
|
||||
public void llAdjustSoundVolume(LSL_Float volume)
|
||||
{
|
||||
m_LSL_Functions.llAdjustSoundVolume(volume);
|
||||
}
|
||||
|
||||
public void llAllowInventoryDrop(int add)
|
||||
public void llAllowInventoryDrop(LSL_Integer add)
|
||||
{
|
||||
m_LSL_Functions.llAllowInventoryDrop(add);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llAngleBetween(a, b);
|
||||
}
|
||||
|
||||
public void llApplyImpulse(LSL_Vector force, int local)
|
||||
public void llApplyImpulse(LSL_Vector force, LSL_Integer local)
|
||||
{
|
||||
m_LSL_Functions.llApplyImpulse(force, local);
|
||||
}
|
||||
@@ -110,12 +110,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llApplyRotationalImpulse(force, local);
|
||||
}
|
||||
|
||||
public LSL_Float llAsin(double val)
|
||||
public LSL_Float llAsin(LSL_Float val)
|
||||
{
|
||||
return m_LSL_Functions.llAsin(val);
|
||||
}
|
||||
|
||||
public LSL_Float llAtan2(double x, double y)
|
||||
public LSL_Float llAtan2(LSL_Float x, LSL_Float y)
|
||||
{
|
||||
return m_LSL_Functions.llAtan2(x, y);
|
||||
}
|
||||
@@ -190,17 +190,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llCloud(offset);
|
||||
}
|
||||
|
||||
public void llCollisionFilter(string name, string id, int accept)
|
||||
public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept)
|
||||
{
|
||||
m_LSL_Functions.llCollisionFilter(name, id, accept);
|
||||
}
|
||||
|
||||
public void llCollisionSound(string impact_sound, double impact_volume)
|
||||
public void llCollisionSound(LSL_String impact_sound, LSL_Float impact_volume)
|
||||
{
|
||||
m_LSL_Functions.llCollisionSound(impact_sound, impact_volume);
|
||||
}
|
||||
|
||||
public void llCollisionSprite(string impact_sprite)
|
||||
public void llCollisionSprite(LSL_String impact_sprite)
|
||||
{
|
||||
m_LSL_Functions.llCollisionSprite(impact_sprite);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llCos(f);
|
||||
}
|
||||
|
||||
public void llCreateLink(LSL_String target, LSL_Integer parent)
|
||||
public void llCreateLink(LSL_Key target, LSL_Integer parent)
|
||||
{
|
||||
m_LSL_Functions.llCreateLink(target, parent);
|
||||
}
|
||||
@@ -386,12 +386,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGetAccel();
|
||||
}
|
||||
|
||||
public LSL_Integer llGetAgentInfo(string id)
|
||||
public LSL_Integer llGetAgentInfo(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAgentInfo(id);
|
||||
}
|
||||
|
||||
public LSL_String llGetAgentLanguage(string id)
|
||||
public LSL_String llGetAgentLanguage(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAgentLanguage(id);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGetAgentList(scope, options);
|
||||
}
|
||||
|
||||
public LSL_Vector llGetAgentSize(string id)
|
||||
public LSL_Vector llGetAgentSize(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAgentSize(id);
|
||||
}
|
||||
@@ -416,12 +416,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGetAndResetTime();
|
||||
}
|
||||
|
||||
public LSL_String llGetAnimation(string id)
|
||||
public LSL_String llGetAnimation(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAnimation(id);
|
||||
}
|
||||
|
||||
public LSL_List llGetAnimationList(string id)
|
||||
public LSL_List llGetAnimationList(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAnimationList(id);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGetAttached();
|
||||
}
|
||||
|
||||
public LSL_List llGetAttachedList(string id)
|
||||
public LSL_List llGetAttachedList(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetAttachedList(id);
|
||||
}
|
||||
@@ -881,27 +881,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGetWallclock();
|
||||
}
|
||||
|
||||
public void llGiveInventory(string destination, string inventory)
|
||||
public void llGiveInventory(LSL_Key destination, LSL_String inventory)
|
||||
{
|
||||
m_LSL_Functions.llGiveInventory(destination, inventory);
|
||||
}
|
||||
|
||||
public void llGiveInventoryList(string destination, string category, LSL_List inventory)
|
||||
public void llGiveInventoryList(LSL_Key destination, LSL_String category, LSL_List inventory)
|
||||
{
|
||||
m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
|
||||
}
|
||||
|
||||
public LSL_Integer llGiveMoney(string destination, int amount)
|
||||
public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount)
|
||||
{
|
||||
return m_LSL_Functions.llGiveMoney(destination, amount);
|
||||
}
|
||||
|
||||
public LSL_Key llTransferLindenDollars(string destination, int amount)
|
||||
public LSL_Key llTransferLindenDollars(LSL_Key destination, LSL_Integer amount)
|
||||
{
|
||||
return m_LSL_Functions.llTransferLindenDollars(destination, amount);
|
||||
}
|
||||
|
||||
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
|
||||
public void llGodLikeRezObject(LSL_String inventory, LSL_Vector pos)
|
||||
{
|
||||
m_LSL_Functions.llGodLikeRezObject(inventory, pos);
|
||||
}
|
||||
@@ -931,22 +931,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llGroundSlope(offset);
|
||||
}
|
||||
|
||||
public LSL_Key llHTTPRequest(string url, LSL_List parameters, string body)
|
||||
public LSL_Key llHTTPRequest(LSL_String url, LSL_List parameters, LSL_String body)
|
||||
{
|
||||
return m_LSL_Functions.llHTTPRequest(url, parameters, body);
|
||||
}
|
||||
|
||||
public void llHTTPResponse(LSL_Key id, int status, string body)
|
||||
public void llHTTPResponse(LSL_Key id, int status, LSL_String body)
|
||||
{
|
||||
m_LSL_Functions.llHTTPResponse(id, status, body);
|
||||
}
|
||||
|
||||
public LSL_String llInsertString(string dst, int position, string src)
|
||||
public LSL_String llInsertString(LSL_String dst, int position, LSL_String src)
|
||||
{
|
||||
return m_LSL_Functions.llInsertString(dst, position, src);
|
||||
}
|
||||
|
||||
public void llInstantMessage(string user, string message)
|
||||
public void llInstantMessage(LSL_String user, LSL_String message)
|
||||
{
|
||||
m_LSL_Functions.llInstantMessage(user, message);
|
||||
}
|
||||
@@ -956,12 +956,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llIntegerToBase64(number);
|
||||
}
|
||||
|
||||
public LSL_String llKey2Name(string id)
|
||||
public LSL_String llKey2Name(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llKey2Name(id);
|
||||
}
|
||||
|
||||
public LSL_String llGetUsername(string id)
|
||||
public LSL_String llGetUsername(LSL_Key id)
|
||||
{
|
||||
return m_LSL_Functions.llGetUsername(id);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_OSSL_Functions.osGetWindParam(plugin, param);
|
||||
}
|
||||
|
||||
public LSL_Integer osGetParcelDwell(vector pos)
|
||||
{
|
||||
return m_OSSL_Functions.osGetParcelDwell(pos);
|
||||
}
|
||||
|
||||
public void osParcelJoin(vector pos1, vector pos2)
|
||||
{
|
||||
m_OSSL_Functions.osParcelJoin(pos1,pos2);
|
||||
|
||||
@@ -490,6 +490,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
{
|
||||
ReleaseControls();
|
||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||
if (part != null)
|
||||
part.RemoveScriptEvents(ItemID);
|
||||
}
|
||||
|
||||
public void RemoveState()
|
||||
|
||||
@@ -533,8 +533,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
|
||||
public static Quaternion operator /(Quaternion a, Quaternion b)
|
||||
{
|
||||
// assuming normalized
|
||||
b.s = -b.s;
|
||||
// assume normalized
|
||||
// if not, sl seems to not normalize either
|
||||
b.x = -b.x;
|
||||
b.y = -b.y;
|
||||
b.z = -b.z;
|
||||
|
||||
return a * b;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user