mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
bad merge?
This commit is contained in:
@@ -28,9 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
@@ -39,6 +37,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using Timer=OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
@@ -269,6 +269,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// <param name="itemID"></param>
|
||||
public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
|
||||
{
|
||||
// Remove a specific script
|
||||
// m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);
|
||||
|
||||
lock (staticLock)
|
||||
@@ -282,7 +283,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// Remove from: HttpRequest
|
||||
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
|
||||
if (iHttpReq != null)
|
||||
iHttpReq.StopHttpRequestsForScript(itemID);
|
||||
iHttpReq.StopHttpRequest(localID, itemID);
|
||||
|
||||
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
|
||||
if (comms != null)
|
||||
@@ -386,6 +387,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
|
||||
{
|
||||
// Remove a specific script
|
||||
|
||||
// Remove dataserver events
|
||||
m_Dataserver[engine].RemoveEvents(localID, itemID);
|
||||
|
||||
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
|
||||
if (comms != null)
|
||||
comms.DeleteListener(itemID);
|
||||
|
||||
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
|
||||
if (xmlrpc != null)
|
||||
{
|
||||
xmlrpc.DeleteChannels(itemID);
|
||||
xmlrpc.CancelSRDRequests(itemID);
|
||||
}
|
||||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
|
||||
}
|
||||
|
||||
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
|
||||
{
|
||||
List<Object> data = new List<Object>();
|
||||
|
||||
117
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
Normal file
117
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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.Threading;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.World.LightShare;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
||||
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
||||
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
|
||||
using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
|
||||
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
[Serializable]
|
||||
public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi
|
||||
{
|
||||
internal IScriptEngine m_ScriptEngine;
|
||||
internal SceneObjectPart m_host;
|
||||
internal TaskInventoryItem m_item;
|
||||
internal bool m_CMFunctionsEnabled = false;
|
||||
|
||||
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
|
||||
{
|
||||
m_ScriptEngine = ScriptEngine;
|
||||
m_host = host;
|
||||
m_item = item;
|
||||
|
||||
if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
|
||||
m_CMFunctionsEnabled = true;
|
||||
}
|
||||
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
|
||||
// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
|
||||
public Scene World
|
||||
{
|
||||
get { return m_ScriptEngine.World; }
|
||||
}
|
||||
|
||||
public string cmDetectedCountry(int number)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
|
||||
if (detectedParams == null)
|
||||
return String.Empty;
|
||||
return detectedParams.Country;
|
||||
}
|
||||
|
||||
public string cmGetAgentCountry(LSL_Key key)
|
||||
{
|
||||
if (!World.Permissions.IsGod(m_host.OwnerID))
|
||||
return String.Empty;
|
||||
|
||||
UUID uuid;
|
||||
|
||||
if (!UUID.TryParse(key, out uuid))
|
||||
return String.Empty;
|
||||
|
||||
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
|
||||
return account.UserCountry;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -136,7 +136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType);
|
||||
|
||||
Type returntype = m_comms.LookupReturnType(fname);
|
||||
if (returntype != typeof(string))
|
||||
if (returntype != typeof(void))
|
||||
MODError(String.Format("return type mismatch for {0}",fname));
|
||||
|
||||
modInvoke(fname,parms);
|
||||
@@ -329,6 +329,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
Type returntype = m_comms.LookupReturnType(fname);
|
||||
if (returntype == typeof(void))
|
||||
return null;
|
||||
|
||||
MODError(String.Format("Invocation of {0} failed; null return value",fname));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
|
||||
internal float m_ScriptDelayFactor = 1.0f;
|
||||
internal float m_ScriptDistanceFactor = 1.0f;
|
||||
internal bool m_debuggerSafe = false;
|
||||
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
|
||||
|
||||
protected IUrlModule m_UrlModule = null;
|
||||
@@ -150,6 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_ScriptEngine = scriptEngine;
|
||||
m_host = host;
|
||||
m_item = item;
|
||||
m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
|
||||
|
||||
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
|
||||
|
||||
@@ -216,7 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
internal void OSSLError(string msg)
|
||||
{
|
||||
throw new ScriptException("OSSL Runtime Error: " + msg);
|
||||
if (m_debuggerSafe)
|
||||
{
|
||||
OSSLShoutError(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ScriptException("OSSL Runtime Error: " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -820,7 +829,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
private void TeleportAgent(string agent, int regionX, int regionY,
|
||||
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
// ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY);
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -993,18 +1005,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (target != null)
|
||||
{
|
||||
UUID animID=UUID.Zero;
|
||||
lock (m_host.TaskInventory)
|
||||
m_host.TaskInventory.LockItemsForRead(true);
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||
if (inv.Value.Name == animation)
|
||||
{
|
||||
if (inv.Value.Name == animation)
|
||||
{
|
||||
if (inv.Value.Type == (int)AssetType.Animation)
|
||||
animID = inv.Value.AssetID;
|
||||
continue;
|
||||
}
|
||||
if (inv.Value.Type == (int)AssetType.Animation)
|
||||
animID = inv.Value.AssetID;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
m_host.TaskInventory.LockItemsForRead(false);
|
||||
if (animID == UUID.Zero)
|
||||
target.Animator.AddAnimation(animation, m_host.UUID);
|
||||
else
|
||||
@@ -1046,6 +1057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
animID = UUID.Zero;
|
||||
}
|
||||
|
||||
|
||||
if (animID == UUID.Zero)
|
||||
target.Animator.RemoveAnimation(animation);
|
||||
else
|
||||
@@ -1487,7 +1499,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return;
|
||||
}
|
||||
|
||||
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions))
|
||||
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
|
||||
{
|
||||
OSSLShoutError("You do not have permission to modify the parcel");
|
||||
return;
|
||||
@@ -1722,7 +1734,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public Object osParseJSONNew(string JSON)
|
||||
private Object osParseJSONNew(string JSON)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.None, "osParseJSONNew");
|
||||
|
||||
@@ -1934,15 +1946,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
UUID assetID = UUID.Zero;
|
||||
|
||||
if (!UUID.TryParse(notecardNameOrUuid, out assetID))
|
||||
bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID);
|
||||
|
||||
if (!notecardNameIsUUID)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||
{
|
||||
if (item.Type == 7 && item.Name == notecardNameOrUuid)
|
||||
{
|
||||
assetID = item.AssetID;
|
||||
}
|
||||
}
|
||||
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
|
||||
}
|
||||
|
||||
if (assetID == UUID.Zero)
|
||||
@@ -1953,13 +1961,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
AssetBase a = World.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (a == null)
|
||||
return UUID.Zero;
|
||||
{
|
||||
// Whoops, it's still possible here that the notecard name was properly
|
||||
// formatted like a UUID but isn't an asset UUID so lets look it up by name after all
|
||||
assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid);
|
||||
if (assetID == UUID.Zero)
|
||||
return UUID.Zero;
|
||||
|
||||
if (!NotecardCache.IsCached(assetID))
|
||||
{
|
||||
a = World.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (a == null)
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NotecardCache.Cache(assetID, a.Data);
|
||||
};
|
||||
|
||||
return assetID;
|
||||
}
|
||||
protected UUID SearchTaskInventoryForAssetId(string name)
|
||||
{
|
||||
UUID assetId = UUID.Zero;
|
||||
m_host.TaskInventory.LockItemsForRead(true);
|
||||
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
|
||||
{
|
||||
if (item.Type == 7 && item.Name == name)
|
||||
{
|
||||
assetId = item.AssetID;
|
||||
}
|
||||
}
|
||||
m_host.TaskInventory.LockItemsForRead(false);
|
||||
return assetId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Directly get an entire notecard at once.
|
||||
@@ -2544,7 +2582,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
return NpcCreate(firstname, lastname, position, notecard, false, false);
|
||||
return NpcCreate(firstname, lastname, position, notecard, true, false);
|
||||
}
|
||||
|
||||
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options)
|
||||
@@ -2555,24 +2593,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return NpcCreate(
|
||||
firstname, lastname, position, notecard,
|
||||
(options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
|
||||
(options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
|
||||
false);
|
||||
// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
|
||||
}
|
||||
|
||||
private LSL_Key NpcCreate(
|
||||
string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent)
|
||||
{
|
||||
if (!owned)
|
||||
OSSLError("Unowned NPCs are unsupported");
|
||||
|
||||
string groupTitle = String.Empty;
|
||||
|
||||
if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z)))
|
||||
return new LSL_Key(UUID.Zero.ToString());
|
||||
|
||||
if (firstname != String.Empty || lastname != String.Empty)
|
||||
{
|
||||
if (firstname != "Shown outfit:")
|
||||
groupTitle = "- NPC -";
|
||||
}
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
AvatarAppearance appearance = null;
|
||||
|
||||
UUID id;
|
||||
if (UUID.TryParse(notecard, out id))
|
||||
{
|
||||
ScenePresence clonePresence = World.GetScenePresence(id);
|
||||
if (clonePresence != null)
|
||||
appearance = clonePresence.Appearance;
|
||||
}
|
||||
// UUID id;
|
||||
// if (UUID.TryParse(notecard, out id))
|
||||
// {
|
||||
// ScenePresence clonePresence = World.GetScenePresence(id);
|
||||
// if (clonePresence != null)
|
||||
// appearance = clonePresence.Appearance;
|
||||
// }
|
||||
|
||||
if (appearance == null)
|
||||
{
|
||||
@@ -2580,9 +2633,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
if (appearanceSerialized != null)
|
||||
{
|
||||
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
|
||||
appearance = new AvatarAppearance();
|
||||
appearance.Unpack(appearanceOsd);
|
||||
try
|
||||
{
|
||||
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
|
||||
appearance = new AvatarAppearance();
|
||||
appearance.Unpack(appearanceOsd);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return UUID.Zero.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2601,6 +2661,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
World,
|
||||
appearance);
|
||||
|
||||
ScenePresence sp;
|
||||
if (World.TryGetScenePresence(x, out sp))
|
||||
{
|
||||
sp.Grouptitle = groupTitle;
|
||||
sp.SendAvatarDataToAllAgents();
|
||||
}
|
||||
return new LSL_Key(x.ToString());
|
||||
}
|
||||
|
||||
@@ -2898,16 +2964,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID npcId = new UUID(npc.m_string);
|
||||
ManualResetEvent ev = new ManualResetEvent(false);
|
||||
|
||||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
Util.FireAndForget(delegate(object x) {
|
||||
try
|
||||
{
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID npcId = new UUID(npc.m_string);
|
||||
|
||||
module.DeleteNPC(npcId, World);
|
||||
}
|
||||
ILandObject l = World.LandChannel.GetLandObject(m_host.GroupPosition.X, m_host.GroupPosition.Y);
|
||||
if (l == null || m_host.OwnerID != l.LandData.OwnerID)
|
||||
{
|
||||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
}
|
||||
|
||||
module.DeleteNPC(npcId, World);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ev.Set();
|
||||
}
|
||||
});
|
||||
ev.WaitOne();
|
||||
}
|
||||
|
||||
public void osNpcPlayAnimation(LSL_Key npc, string animation)
|
||||
@@ -3183,9 +3265,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Scene scene = m_ScriptEngine.World;
|
||||
GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
|
||||
return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeX, Constants.RegionHeight);
|
||||
=======
|
||||
return new LSL_Vector((float)World.RegionInfo.RegionSizeX,
|
||||
(float)World.RegionInfo.RegionSizeY,
|
||||
(float)World.RegionInfo.RegionSizeZ );
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
private const int AGENT = 1;
|
||||
private const int AGENT_BY_USERNAME = 0x10;
|
||||
private const int NPC = 0x20;
|
||||
private const int OS_NPC = 0x01000000;
|
||||
private const int ACTIVE = 2;
|
||||
private const int PASSIVE = 4;
|
||||
private const int SCRIPTED = 8;
|
||||
@@ -240,7 +239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||
|
||||
// Is the sensor type is AGENT and not SCRIPTED then include agents
|
||||
if ((ts.type & (AGENT | AGENT_BY_USERNAME | NPC | OS_NPC)) != 0 && (ts.type & SCRIPTED) == 0)
|
||||
if ((ts.type & (AGENT | AGENT_BY_USERNAME | NPC)) != 0 && (ts.type & SCRIPTED) == 0)
|
||||
{
|
||||
sensedEntities.AddRange(doAgentSensor(ts));
|
||||
}
|
||||
@@ -339,7 +338,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
float dy;
|
||||
float dz;
|
||||
|
||||
Quaternion q = SensePoint.GetWorldRotation();
|
||||
// Quaternion q = SensePoint.RotationOffset;
|
||||
Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation!
|
||||
if (SensePoint.ParentGroup.IsAttachment)
|
||||
{
|
||||
// In attachments, rotate the sensor cone with the
|
||||
@@ -358,7 +358,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
if (avatar == null)
|
||||
return sensedEntities;
|
||||
|
||||
q = avatar.GetWorldRotation() * q;
|
||||
fromRegionPos = avatar.AbsolutePosition;
|
||||
q = avatar.Rotation;
|
||||
}
|
||||
|
||||
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
|
||||
@@ -402,7 +403,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
objtype = 0;
|
||||
|
||||
part = ((SceneObjectGroup)ent).RootPart;
|
||||
if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore
|
||||
if (part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.Tree &&
|
||||
part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.NewTree &&
|
||||
part.ParentGroup.AttachmentPoint != 0) // Attached so ignore
|
||||
continue;
|
||||
|
||||
if (part.Inventory.ContainsScripts())
|
||||
@@ -489,8 +492,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
// Don't proceed if the avatar for this attachment has since been removed from the scene.
|
||||
if (avatar == null)
|
||||
return sensedEntities;
|
||||
|
||||
q = avatar.GetWorldRotation() * q;
|
||||
fromRegionPos = avatar.AbsolutePosition;
|
||||
q = avatar.Rotation;
|
||||
}
|
||||
|
||||
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
|
||||
@@ -506,7 +509,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}",
|
||||
// presence.Name, presence.PresenceType, ts.name, ts.type);
|
||||
|
||||
if ((ts.type & NPC) == 0 && (ts.type & OS_NPC) == 0 && presence.PresenceType == PresenceType.Npc)
|
||||
if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
|
||||
{
|
||||
INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
if (npcData == null || !npcData.SenseAsAgent)
|
||||
@@ -546,7 +549,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return;
|
||||
|
||||
toRegionPos = presence.AbsolutePosition;
|
||||
dis = Math.Abs(Util.GetDistanceTo(toRegionPos, fromRegionPos));
|
||||
dis = Util.GetDistanceTo(toRegionPos, fromRegionPos);
|
||||
if (presence.IsSatOnObject && presence.ParentPart != null &&
|
||||
presence.ParentPart.ParentGroup != null &&
|
||||
presence.ParentPart.ParentGroup.RootPart != null)
|
||||
{
|
||||
Vector3 rpos = presence.ParentPart.ParentGroup.RootPart.AbsolutePosition;
|
||||
double dis2 = Util.GetDistanceTo(rpos, fromRegionPos);
|
||||
if (dis > dis2)
|
||||
dis = dis2;
|
||||
}
|
||||
|
||||
// Disabled for now since all osNpc* methods check for appropriate ownership permission.
|
||||
// Perhaps could be re-enabled as an NPC setting at some point since being able to make NPCs not
|
||||
@@ -706,4 +718,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,25 +123,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
if (Timers.Count == 0)
|
||||
return;
|
||||
|
||||
Dictionary<string, TimerInfo> tvals;
|
||||
lock (TimerListLock)
|
||||
{
|
||||
// Go through all timers
|
||||
Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values;
|
||||
foreach (TimerInfo ts in tvals)
|
||||
{
|
||||
// Time has passed?
|
||||
if (ts.next < DateTime.Now.Ticks)
|
||||
{
|
||||
//m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
|
||||
// Add it to queue
|
||||
m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
|
||||
new EventParams("timer", new Object[0],
|
||||
new DetectParams[0]));
|
||||
// set next interval
|
||||
tvals = new Dictionary<string, TimerInfo>(Timers);
|
||||
}
|
||||
|
||||
//ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
||||
ts.next = DateTime.Now.Ticks + ts.interval;
|
||||
}
|
||||
foreach (TimerInfo ts in tvals.Values)
|
||||
{
|
||||
// Time has passed?
|
||||
if (ts.next < DateTime.Now.Ticks)
|
||||
{
|
||||
//m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
|
||||
// Add it to queue
|
||||
m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
|
||||
new EventParams("timer", new Object[0],
|
||||
new DetectParams[0]));
|
||||
// set next interval
|
||||
|
||||
//ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
||||
ts.next = DateTime.Now.Ticks + ts.interval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user