bad merge?

This commit is contained in:
UbitUmarov
2015-09-01 14:54:35 +01:00
406 changed files with 62562 additions and 8067 deletions

View File

@@ -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>();

View 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;
}
}
}

View File

@@ -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)

View File

@@ -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
}
}

View File

@@ -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;
}
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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.Collections;
using OpenSim.Region.ScriptEngine.Interfaces;
using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
public interface ICM_Api
{
string cmDetectedCountry(int num);
string cmGetAgentCountry(key key);
}
}

View File

@@ -127,6 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llGetEnv(LSL_String name);
LSL_Vector llGetForce();
LSL_Integer llGetFreeMemory();
LSL_Integer llGetUsedMemory();
LSL_Integer llGetFreeURLs();
LSL_Vector llGetGeometricCenter();
LSL_Float llGetGMTclock();
@@ -204,12 +205,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llGetTimestamp();
LSL_Vector llGetTorque();
LSL_Integer llGetUnixTime();
LSL_Integer llGetUsedMemory();
LSL_Vector llGetVel();
LSL_Float llGetWallclock();
void llGiveInventory(string destination, string inventory);
void llGiveInventoryList(string destination, string category, LSL_List inventory);
void llGiveMoney(string destination, int amount);
LSL_Integer llGiveMoney(string destination, int amount);
LSL_String llTransferLindenDollars(string destination, int amount);
void llGodLikeRezObject(string inventory, LSL_Vector pos);
LSL_Float llGround(LSL_Vector offset);
@@ -344,7 +344,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetDamage(double damage);
void llSetForce(LSL_Vector force, int local);
void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
void llSetVelocity(LSL_Vector velocity, int local);
void llSetAngularVelocity(LSL_Vector angularVelocity, int local);
void llSetHoverHeight(double height, int water, double tau);
void llSetInventoryPermMask(string item, int mask, int value);
@@ -362,11 +361,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetParcelMusicURL(string url);
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
void llSetPos(LSL_Vector pos);
LSL_Integer llSetRegionPos(LSL_Vector pos);
LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
void llSetPrimitiveParams(LSL_List rules);
void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
void llSetPrimURL(string url);
LSL_Integer llSetRegionPos(LSL_Vector pos);
void llSetRemoteScriptAccessPin(int pin);
void llSetRot(LSL_Rotation rot);
void llSetScale(LSL_Vector scale);
@@ -429,10 +428,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Vector llWind(LSL_Vector offset);
LSL_String llXorBase64Strings(string str1, string str2);
LSL_String llXorBase64StringsCorrect(string str1, string str2);
void print(string str);
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
LSL_List llGetPhysicsMaterial();
void llSetAnimationOverride(LSL_String animState, LSL_String anim);
void llResetAnimationOverride(LSL_String anim_state);
LSL_String llGetAnimationOverride(LSL_String anim_state);
LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers);
LSL_List llJson2List(LSL_String json);
LSL_String llList2Json(LSL_String type, LSL_List values);
LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value);
LSL_String llJsonValueType(LSL_String json, LSL_List specifiers);
}
}

View File

@@ -144,7 +144,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Avatar Info Commands
string osGetAgentIP(string agent);
LSL_List osGetAgents();
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -261,7 +261,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetSimulatorVersion();
LSL_Integer osCheckODE();
string osGetPhysicsEngineType();
Object osParseJSONNew(string JSON);
Hashtable osParseJSON(string JSON);
void osMessageObject(key objectUUID,string message);

View File

@@ -0,0 +1,71 @@
/*
* 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.Runtime.Remoting.Lifetime;
using System.Threading;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
public partial class ScriptBaseClass : MarshalByRefObject
{
public ICM_Api m_CM_Functions;
public void ApiTypeCM(IScriptApi api)
{
if (!(api is ICM_Api))
return;
m_CM_Functions = (ICM_Api)api;
}
public string cmDetectedCountry(int num)
{
return m_CM_Functions.cmDetectedCountry(num);
}
public string cmGetAgentCountry(key key)
{
return m_CM_Functions.cmGetAgentCountry(key);
}
}
}

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Reflection;
using System.Runtime.Remoting.Lifetime;
using OpenSim.Region.ScriptEngine.Shared;
@@ -133,6 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (eventFlags);
}
[DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.

View File

@@ -57,7 +57,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int ACTIVE = 2;
public const int PASSIVE = 4;
public const int SCRIPTED = 8;
public const int OS_NPC = 0x01000000;
public const int CONTROL_FWD = 1;
public const int CONTROL_BACK = 2;
@@ -82,6 +81,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PERMISSION_CHANGE_PERMISSIONS = 512;
public const int PERMISSION_TRACK_CAMERA = 1024;
public const int PERMISSION_CONTROL_CAMERA = 2048;
public const int PERMISSION_TELEPORT = 4096;
public const int PERMISSION_OVERRIDE_ANIMATIONS = 0x8000;
public const int AGENT_FLYING = 1;
public const int AGENT_ATTACHMENTS = 2;
@@ -96,6 +97,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int AGENT_CROUCHING = 1024;
public const int AGENT_BUSY = 2048;
public const int AGENT_ALWAYS_RUN = 4096;
public const int AGENT_MALE = 8192;
//Particle Systems
public const int PSYS_PART_INTERP_COLOR_MASK = 1;
@@ -353,6 +355,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int CHANGED_REGION_START = 1024; //LL Changed the constant from CHANGED_REGION_RESTART
public const int CHANGED_MEDIA = 2048;
public const int CHANGED_ANIMATION = 16384;
public const int CHANGED_POSITION = 32768;
public const int TYPE_INVALID = 0;
public const int TYPE_INTEGER = 1;
public const int TYPE_FLOAT = 2;
@@ -708,7 +711,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int FRICTION = 2;
public const int RESTITUTION = 4;
public const int GRAVITY_MULTIPLIER = 8;
// extra constants for llSetPrimMediaParams
public static readonly LSLInteger LSL_STATUS_OK = new LSLInteger(0);
public static readonly LSLInteger LSL_STATUS_MALFORMED_PARAMS = new LSLInteger(1000);
@@ -795,6 +798,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int KFM_CMD_STOP = 1;
public const int KFM_CMD_PAUSE = 2;
public const string JSON_ARRAY = "JSON_ARRAY";
public const string JSON_OBJECT = "JSON_OBJECT";
public const string JSON_INVALID = "JSON_INVALID";
public const string JSON_NUMBER = "JSON_NUMBER";
public const string JSON_STRING = "JSON_STRING";
public const string JSON_TRUE = "JSON_TRUE";
public const string JSON_FALSE = "JSON_FALSE";
public const string JSON_NULL = "JSON_NULL";
public const string JSON_APPEND = "JSON_APPEND";
/// <summary>
/// process name parameter as regex
/// </summary>

View File

@@ -26,6 +26,7 @@
*/
using System;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting.Lifetime;
using System.Threading;
using System.Reflection;
@@ -314,6 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
}
[DebuggerNonUserCode]
public void llDie()
{
m_LSL_Functions.llDie();
@@ -479,6 +481,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetFreeMemory();
}
public LSL_Integer llGetUsedMemory()
{
return m_LSL_Functions.llGetUsedMemory();
}
public LSL_Integer llGetFreeURLs()
{
return m_LSL_Functions.llGetFreeURLs();
@@ -559,11 +566,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetLinkNumberOfSides(link);
}
public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
{
m_LSL_Functions.llSetKeyframedMotion(frames, options);
}
public LSL_Integer llGetListEntryType(LSL_List src, int index)
{
return m_LSL_Functions.llGetListEntryType(src, index);
@@ -859,11 +861,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetUnixTime();
}
public LSL_Integer llGetUsedMemory()
{
return m_LSL_Functions.llGetUsedMemory();
}
public LSL_Vector llGetVel()
{
return m_LSL_Functions.llGetVel();
@@ -884,9 +881,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
}
public void llGiveMoney(string destination, int amount)
public LSL_Integer llGiveMoney(string destination, int amount)
{
m_LSL_Functions.llGiveMoney(destination, amount);
return m_LSL_Functions.llGiveMoney(destination, amount);
}
public LSL_String llTransferLindenDollars(string destination, int amount)
@@ -1558,11 +1555,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetForceAndTorque(force, torque, local);
}
public void llSetVelocity(LSL_Vector force, int local)
{
m_LSL_Functions.llSetVelocity(force, local);
}
public void llSetAngularVelocity(LSL_Vector force, int local)
{
m_LSL_Functions.llSetAngularVelocity(force, local);
@@ -1643,6 +1635,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetPos(pos);
}
public LSL_Integer llSetRegionPos(LSL_Vector pos)
{
return m_LSL_Functions.llSetRegionPos(pos);
}
public void llSetPrimitiveParams(LSL_List rules)
{
m_LSL_Functions.llSetPrimitiveParams(rules);
@@ -1658,11 +1655,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetPrimURL(url);
}
public LSL_Integer llSetRegionPos(LSL_Vector pos)
{
return m_LSL_Functions.llSetRegionPos(pos);
}
public void llSetRemoteScriptAccessPin(int pin)
{
m_LSL_Functions.llSetRemoteScriptAccessPin(pin);
@@ -2008,9 +2000,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llClearLinkMedia(link, face);
}
public void print(string str)
public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
{
m_LSL_Functions.print(str);
return m_LSL_Functions.llGetLinkNumberOfSides(link);
}
public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
{
m_LSL_Functions.llSetKeyframedMotion(frames, options);
}
public void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density)
{
m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
}
public LSL_List llGetPhysicsMaterial()
{
return m_LSL_Functions.llGetPhysicsMaterial();
}
public void llSetAnimationOverride(LSL_String animState, LSL_String anim)
{
m_LSL_Functions.llSetAnimationOverride(animState, anim);
}
public void llResetAnimationOverride(LSL_String anim_state)
{
m_LSL_Functions.llResetAnimationOverride(anim_state);
}
public LSL_String llGetAnimationOverride(LSL_String anim_state)
{
return m_LSL_Functions.llGetAnimationOverride(anim_state);
}
public LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers)
{
return m_LSL_Functions.llJsonGetValue(json, specifiers);
}
public LSL_List llJson2List(LSL_String json)
{
return m_LSL_Functions.llJson2List(json);
}
public LSL_String llList2Json(LSL_String type, LSL_List values)
{
return m_LSL_Functions.llList2Json(type, values);
}
public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value)
{
return m_LSL_Functions.llJsonSetValue(json, specifiers, value);
}
public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers)
{
return m_LSL_Functions.llJsonValueType(json, specifiers);
}
}
}

View File

@@ -72,9 +72,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
}
public void lsClearWindlightScene()
{
m_LS_Functions.lsClearWindlightScene();
}
public LSL_List cmGetWindlightScene(LSL_List rules)
{
return m_LS_Functions.lsGetWindlightScene(rules);
}
public int cmSetWindlightScene(LSL_List rules)
{
return m_LS_Functions.lsSetWindlightScene(rules);
}
public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
{
return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
}
public void cmClearWindlightScene()
{
m_LS_Functions.lsClearWindlightScene();
}
}
}

View File

@@ -440,11 +440,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osParseJSON(JSON);
}
public Object osParseJSONNew(string JSON)
{
return m_OSSL_Functions.osParseJSONNew(JSON);
}
public void osMessageObject(key objectUUID,string message)
{
m_OSSL_Functions.osMessageObject(objectUUID,message);
@@ -744,14 +739,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
if (Position.y > ((int)Constants.RegionSize - 1))
Position.y = ((int)Constants.RegionSize - 1);
*/
<<<<<<< HEAD
if (Position.z > Constants.RegionHeight)
Position.z = Constants.RegionHeight;
=======
>>>>>>> avn/ubitvar
if (Position.x < 0)
Position.x = 0;
if (Position.y < 0)
Position.y = 0;
if (Position.z < 0)
Position.z = 0;
if (Position.z > Constants.RegionHeight)
Position.z = Constants.RegionHeight;
prim.OSSL.llSetPos(Position);
}

View File

@@ -33,6 +33,7 @@ using System.Threading;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (int)m_Executor.GetStateEventFlags(state);
}
[DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
m_Executor.ExecuteEvent(state, FunctionName, args);

View File

@@ -35,6 +35,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.CoreModules;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.ScriptEngine.Shared
@@ -120,6 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
Type = 0;
Velocity = new LSL_Types.Vector3();
initializeSurfaceTouch();
Country = String.Empty;
}
public UUID Key;
@@ -151,6 +153,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
private int touchFace;
public int TouchFace { get { return touchFace; } }
public string Country;
// This can be done in two places including the constructor
// so be carefull what gets added here
private void initializeSurfaceTouch()
@@ -198,6 +202,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
return;
Name = presence.Firstname + " " + presence.Lastname;
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, Key);
if (account != null)
Country = account.UserCountry;
Owner = Key;
Position = new LSL_Types.Vector3(presence.AbsolutePosition);
Rotation = new LSL_Types.Quaternion(
@@ -207,22 +215,27 @@ namespace OpenSim.Region.ScriptEngine.Shared
presence.Rotation.W);
Velocity = new LSL_Types.Vector3(presence.Velocity);
if (presence.PresenceType != PresenceType.Npc)
{
Type = AGENT;
}
else
{
Type = OS_NPC;
Type = 0x01; // Avatar
if (presence.PresenceType == PresenceType.Npc)
Type = 0x20;
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
// Cope Impl. We don't use OS_NPC.
//if (presence.PresenceType != PresenceType.Npc)
//{
// Type = AGENT;
//}
//else
//{
// Type = OS_NPC;
if (npcData.SenseAsAgent)
{
Type |= AGENT;
}
}
// INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
// INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
// if (npcData.SenseAsAgent)
// {
// Type |= AGENT;
// }
//}
if (presence.Velocity != Vector3.Zero)
Type |= ACTIVE;

View File

@@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Lifetime;
@@ -186,13 +187,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public UUID ItemID { get; private set; }
public UUID ObjectID { get { return Part.UUID; } }
public UUID ObjectID { get; private set; }
public uint LocalID { get { return Part.LocalId; } }
public uint LocalID { get; private set; }
public UUID RootObjectID { get { return Part.ParentGroup.UUID; } }
public UUID RootObjectID { get; private set; }
public uint RootLocalID { get { return Part.ParentGroup.LocalId; } }
public uint RootLocalID { get; private set; }
public UUID AssetID { get; private set; }
@@ -251,13 +252,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ItemID = ScriptTask.ItemID;
AssetID = ScriptTask.AssetID;
}
LocalID = part.LocalId;
PrimName = part.ParentGroup.Name;
StartParam = startParam;
m_MaxScriptQueue = maxScriptQueue;
m_postOnRez = postOnRez;
m_AttachedAvatar = Part.ParentGroup.AttachedAvatar;
m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID;
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
m_SaveState = StatePersistedHere;
@@ -456,27 +458,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
PostEvent(new EventParams("attach",
new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
}
}
}
private void ReleaseControls()
{
int permsMask;
UUID permsGranter;
lock (Part.TaskInventory)
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
if (part != null)
{
if (!Part.TaskInventory.ContainsKey(ItemID))
int permsMask;
UUID permsGranter;
part.TaskInventory.LockItemsForRead(true);
if (!part.TaskInventory.ContainsKey(ItemID))
{
part.TaskInventory.LockItemsForRead(false);
return;
}
permsGranter = part.TaskInventory[ItemID].PermsGranter;
permsMask = part.TaskInventory[ItemID].PermsMask;
part.TaskInventory.LockItemsForRead(false);
permsGranter = Part.TaskInventory[ItemID].PermsGranter;
permsMask = Part.TaskInventory[ItemID].PermsMask;
}
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
{
ScenePresence presence = Engine.World.GetScenePresence(permsGranter);
if (presence != null)
presence.UnRegisterControlEventsToScript(LocalID, ItemID);
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
{
ScenePresence presence = Engine.World.GetScenePresence(permsGranter);
if (presence != null)
presence.UnRegisterControlEventsToScript(LocalID, ItemID);
}
}
}
@@ -639,11 +648,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return true;
}
[DebuggerNonUserCode] //Prevents the debugger from farting in this function
public void SetState(string state)
{
if (state == State)
return;
<<<<<<< HEAD
EventParams lastTimerEv = null;
lock (EventQueue)
@@ -671,6 +682,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_StateChangeInProgress = true;
}
=======
PostEvent(new EventParams("state_exit", new Object[0],
new DetectParams[0]));
PostEvent(new EventParams("state", new Object[] { state },
new DetectParams[0]));
PostEvent(new EventParams("state_entry", new Object[0],
new DetectParams[0]));
>>>>>>> avn/ubitvar
throw new EventAbortException();
}
@@ -764,14 +784,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// <returns></returns>
public object EventProcessor()
{
EventParams data = null;
// We check here as the thread stopping this instance from running may itself hold the m_Script lock.
if (!Running)
return 0;
lock (m_Script)
{
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
<<<<<<< HEAD
if (Suspended)
return 0;
@@ -797,6 +817,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
lock (EventQueue)
{
data = (EventParams)EventQueue.Dequeue();
=======
if (Suspended)
return 0;
lock (EventQueue)
{
data = (EventParams) EventQueue.Dequeue();
>>>>>>> avn/ubitvar
if (data == null) // Shouldn't happen
{
if (EventQueue.Count > 0 && Running && !ShuttingDown)
@@ -821,6 +849,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_CollisionInQueue = false;
}
<<<<<<< HEAD
if (DebugLevel >= 2)
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
@@ -850,6 +879,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
Part.ParentGroup.UUID,
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name);
=======
lock(m_Script)
{
// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this);
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
if (DebugLevel >= 2)
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
data.EventName,
ScriptName,
part.Name,
part.LocalId,
part.ParentGroup.Name,
part.ParentGroup.UUID,
part.AbsolutePosition,
part.ParentGroup.Scene.Name);
>>>>>>> avn/ubitvar
AsyncCommandManager.StateChange(Engine,
LocalID, ItemID);
@@ -867,7 +915,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// PrimName, ScriptName, data.EventName, State);
<<<<<<< HEAD
try
=======
if (DebugLevel >= 1)
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
State,
ScriptName,
part.Name,
part.LocalId,
part.ParentGroup.Name,
part.ParentGroup.UUID,
part.AbsolutePosition,
part.ParentGroup.Scene.Name);
AsyncCommandManager.RemoveScript(Engine,
LocalID, ItemID);
if (part != null)
{
part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State));
}
}
else
{
if (Engine.World.PipeEventsForScript(LocalID) ||
data.EventName == "control") // Don't freeze avies!
>>>>>>> avn/ubitvar
{
m_CurrentEvent = data.EventName;
m_EventStart = DateTime.Now;
@@ -905,6 +981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
&& !(e.InnerException is ScriptCoopStopException)))
&& !(e is ThreadAbortException))
{
<<<<<<< HEAD
try
{
// DISPLAY ERROR INWORLD
@@ -927,9 +1004,78 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name),
e);
=======
// m_log.DebugFormat(
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
// ScriptName, ItemID, e.Message, e.StackTrace);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if ((!(e is TargetInvocationException)
|| (!(e.InnerException is SelfDeleteException)
&& !(e.InnerException is ScriptDeleteException)
&& !(e.InnerException is ScriptCoopStopException)))
&& !(e is ThreadAbortException))
{
try
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition,
part.Name, part.UUID, false);
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}",
ScriptName,
PrimName,
part.UUID,
part.AbsolutePosition,
part.ParentGroup.Scene.Name,
text.Replace("\n", "\\n"),
e.InnerException);
}
catch (Exception)
{
}
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[SCRIPT]: "+
// "Error displaying error in-world: " +
// e2.ToString());
// m_log.Error("[SCRIPT]: " +
// "Errormessage: Error compiling script:\r\n" +
// e.ToString());
// }
}
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
{
m_InSelfDelete = true;
if (part != null)
Engine.World.DeleteSceneObject(part.ParentGroup, false);
>>>>>>> avn/ubitvar
}
catch (Exception)
{
<<<<<<< HEAD
=======
m_InSelfDelete = true;
if (part != null)
part.Inventory.RemoveInventoryItem(ItemID);
}
else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
{
if (DebugLevel >= 1)
m_log.DebugFormat(
"[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
PrimName, ScriptName, data.EventName, State);
>>>>>>> avn/ubitvar
}
// catch (Exception e2) // LEGIT: User Scripting
// {
@@ -1012,15 +1158,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ReleaseControls();
Stop(timeout);
Part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
Part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
part.CollisionSound = UUID.Zero;
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
EventQueue.Clear();
m_Script.ResetVars();
StartParam = 0;
State = "default";
Part.SetScriptEvents(ItemID,
part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State));
if (running)
Start();
@@ -1031,6 +1179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new Object[0], new DetectParams[0]));
}
[DebuggerNonUserCode] //Stops the VS debugger from farting in this function
public void ApiResetScript()
{
// bool running = Running;
@@ -1039,8 +1188,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ReleaseControls();
m_Script.ResetVars();
Part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
Part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
part.CollisionSound = UUID.Zero;
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
EventQueue.Clear();
@@ -1049,7 +1200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
StartParam = 0;
State = "default";
Part.SetScriptEvents(ItemID,
part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State));
if (m_CurrentEvent != "state_entry" || oldState != "default")
@@ -1063,10 +1214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public Dictionary<string, object> GetVars()
{
if (m_Script != null)
return m_Script.GetVars();
else
return new Dictionary<string, object>();
return m_Script.GetVars();
}
public void SetVars(Dictionary<string, object> vars)

View File

@@ -102,19 +102,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
public override string ToString()
{
<<<<<<< HEAD
string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
=======
string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z);
>>>>>>> avn/ubitvar
return s;
}
public static explicit operator LSLString(Vector3 vec)
{
<<<<<<< HEAD
string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
=======
string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
>>>>>>> avn/ubitvar
return new LSLString(s);
}
public static explicit operator string(Vector3 vec)
{
<<<<<<< HEAD
string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
=======
string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
>>>>>>> avn/ubitvar
return s;
}
@@ -414,19 +426,19 @@ namespace OpenSim.Region.ScriptEngine.Shared
public override string ToString()
{
string st=String.Format(Culture.FormatProvider, "<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s);
string st=String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", x, y, z, s);
return st;
}
public static explicit operator string(Quaternion r)
{
string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s);
return s;
}
public static explicit operator LSLString(Quaternion r)
{
string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s);
return new LSLString(s);
}
@@ -537,7 +549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
else if (o is LSL_Types.LSLFloat)
size += 8;
else if (o is LSL_Types.LSLString)
size += ((LSL_Types.LSLString)o).m_string.Length;
size += ((LSL_Types.LSLString)o).m_string == null ? 0 : ((LSL_Types.LSLString)o).m_string.Length;
else if (o is LSL_Types.key)
size += ((LSL_Types.key)o).value.Length;
else if (o is LSL_Types.Vector3)
@@ -546,6 +558,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
size += 64;
else if (o is int)
size += 4;
else if (o is uint)
size += 4;
else if (o is string)
size += ((string)o).Length;
else if (o is float)
@@ -713,10 +727,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
private void ExtendAndAdd(object o)
{
object[] tmp;
<<<<<<< HEAD
tmp = new object[Data.Length + 1];
Data.CopyTo(tmp, 0);
tmp.SetValue(o, tmp.Length - 1);
Data = tmp;
=======
tmp = new object[m_data.Length + 1];
m_data.CopyTo(tmp, 0);
tmp.SetValue(o, tmp.Length - 1);
m_data = tmp;
>>>>>>> avn/ubitvar
}
public static list operator +(list a, LSLString s)
@@ -739,24 +760,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static bool operator ==(list a, list b)
{
int la = -1;
int lb = -1;
try { la = a.Length; }
catch (NullReferenceException) { }
try { lb = b.Length; }
catch (NullReferenceException) { }
int la = a.Length;
int lb = b.Length;
return la == lb;
}
public static bool operator !=(list a, list b)
{
int la = -1;
int lb = -1;
try { la = a.Length; }
catch (NullReferenceException) { }
try {lb = b.Length;}
catch (NullReferenceException) { }
int la = a.Length;
int lb = b.Length;
return la != lb;
}
@@ -990,7 +1003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r));
}
if (ascending == 0)
if (ascending != 1)
{
ret = 0 - ret;
}
@@ -1023,6 +1036,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
stride = 1;
}
if ((Data.Length % stride) != 0)
return new list(ret);
// we can optimize here in the case where stride == 1 and the list
// consists of homogeneous types
@@ -1042,7 +1058,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
if (homogeneous)
{
Array.Sort(ret, new HomogeneousComparer());
if (ascending == 0)
if (ascending != 1)
{
Array.Reverse(ret);
}