aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorUbitUmarov2015-09-02 19:54:53 +0100
committerUbitUmarov2015-09-02 19:54:53 +0100
commita11edceb00b5b86f825bd957bdac9edb91f893dd (patch)
treec192eae26f3aadf365a66f32fc6d9ade2f0a0c61 /OpenSim/Region/ScriptEngine/Shared
parentbad merge? (diff)
downloadopensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.zip
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.gz
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.bz2
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.xz
seems to compile ( tests comented out)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs1196
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs150
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs19
6 files changed, 168 insertions, 1235 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index df1bd8b..84d44a1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -387,28 +387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
387 } 387 }
388 } 388 }
389 389
390 public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) 390
391 {
392 // Remove a specific script
393
394 // Remove dataserver events
395 m_Dataserver[engine].RemoveEvents(localID, itemID);
396
397 IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
398 if (comms != null)
399 comms.DeleteListener(itemID);
400
401 IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
402 if (xmlrpc != null)
403 {
404 xmlrpc.DeleteChannels(itemID);
405 xmlrpc.CancelSRDRequests(itemID);
406 }
407
408 // Remove Sensors
409 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
410
411 }
412 391
413 public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) 392 public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
414 { 393 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f637a1d..f27a122 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -28,13 +28,9 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31<<<<<<< HEAD
32using System.Diagnostics; 31using System.Diagnostics;
33using System.Drawing; 32using System.Drawing;
34using System.Drawing.Imaging; 33using System.Drawing.Imaging;
35=======
36using System.Diagnostics; //for [DebuggerNonUserCode]
37>>>>>>> avn/ubitvar
38using System.Runtime.Remoting.Lifetime; 34using System.Runtime.Remoting.Lifetime;
39using System.Text; 35using System.Text;
40using System.Threading; 36using System.Threading;
@@ -43,11 +39,8 @@ using System.Timers;
43using Nini.Config; 39using Nini.Config;
44using log4net; 40using log4net;
45using OpenMetaverse; 41using OpenMetaverse;
46<<<<<<< HEAD
47using OpenMetaverse.Assets; 42using OpenMetaverse.Assets;
48=======
49using OpenMetaverse.StructuredData; 43using OpenMetaverse.StructuredData;
50>>>>>>> avn/ubitvar
51using OpenMetaverse.Packets; 44using OpenMetaverse.Packets;
52using OpenMetaverse.Rendering; 45using OpenMetaverse.Rendering;
53using OpenSim; 46using OpenSim;
@@ -133,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
133 protected bool m_scriptConsoleChannelEnabled = false; 126 protected bool m_scriptConsoleChannelEnabled = false;
134 protected bool m_debuggerSafe = false; 127 protected bool m_debuggerSafe = false;
135 protected IUrlModule m_UrlModule = null; 128 protected IUrlModule m_UrlModule = null;
136<<<<<<< HEAD 129
137 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>(); 130 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
138 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. 131 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
139 protected int m_sleepMsOnSetTexture = 200; 132 protected int m_sleepMsOnSetTexture = 200;
@@ -254,11 +247,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
254 protected static List<CastRayCall> m_castRayCalls = new List<CastRayCall>(); 247 protected static List<CastRayCall> m_castRayCalls = new List<CastRayCall>();
255 protected bool m_useMeshCacheInCastRay = true; 248 protected bool m_useMeshCacheInCastRay = true;
256 protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes = new Dictionary<ulong, FacetedMesh>(); 249 protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes = new Dictionary<ulong, FacetedMesh>();
257=======
258 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
259 new Dictionary<UUID, UserInfoCacheEntry>();
260 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
261 protected ISoundModule m_SoundModule = null;
262 250
263// protected Timer m_ShoutSayTimer; 251// protected Timer m_ShoutSayTimer;
264 protected int m_SayShoutCount = 0; 252 protected int m_SayShoutCount = 0;
@@ -288,7 +276,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
288 {"TURNRIGHT", "Turning Right"}, 276 {"TURNRIGHT", "Turning Right"},
289 {"WALK", "Walking"} 277 {"WALK", "Walking"}
290 }; 278 };
291>>>>>>> avn/ubitvar
292 279
293 //An array of HTTP/1.1 headers that are not allowed to be used 280 //An array of HTTP/1.1 headers that are not allowed to be used
294 //as custom headers by llHTTPRequest. 281 //as custom headers by llHTTPRequest.
@@ -315,12 +302,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
315 m_ScriptEngine = scriptEngine; 302 m_ScriptEngine = scriptEngine;
316 m_host = host; 303 m_host = host;
317 m_item = item; 304 m_item = item;
318<<<<<<< HEAD
319=======
320 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 305 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
321 m_coopSleepHandle = coopSleepHandle; 306
322>>>>>>> avn/ubitvar
323
324 LoadConfig(); 307 LoadConfig();
325 308
326 m_TransferModule = 309 m_TransferModule =
@@ -634,7 +617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
634 } 617 }
635 618
636 int actualPrimCount = part.ParentGroup.PrimCount; 619 int actualPrimCount = part.ParentGroup.PrimCount;
637 List<ScenePresence> sittingAvatars = part.ParentGroup.GetSittingAvatars(); 620 List<UUID> sittingAvatars = part.ParentGroup.GetSittingAvatars();
638 int adjustedPrimCount = actualPrimCount + sittingAvatars.Count; 621 int adjustedPrimCount = actualPrimCount + sittingAvatars.Count;
639 622
640 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single 623 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
@@ -663,7 +646,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
663 } 646 }
664 else 647 else
665 { 648 {
666 return sittingAvatars[linknum - actualPrimCount - 1]; 649 ScenePresence sp = World.GetScenePresence(sittingAvatars[linknum - actualPrimCount - 1]);
650 if (sp != null)
651 return sp;
652 else
653 return null;
667 } 654 }
668 } 655 }
669 else 656 else
@@ -1316,8 +1303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1316 1303
1317 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 1304 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
1318 if (wComm != null) 1305 if (wComm != null)
1319 if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) 1306 if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error));
1320 LSLError(error);
1321 } 1307 }
1322 1308
1323 public LSL_Integer llListen(int channelID, string name, string ID, string msg) 1309 public LSL_Integer llListen(int channelID, string name, string ID, string msg)
@@ -2373,13 +2359,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2373 m_host.AddScriptLPS(1); 2359 m_host.AddScriptLPS(1);
2374 2360
2375 List<SceneObjectPart> parts = GetLinkParts(linknumber); 2361 List<SceneObjectPart> parts = GetLinkParts(linknumber);
2376<<<<<<< HEAD
2377
2378 foreach (SceneObjectPart part in parts)
2379 SetTexture(part, texture, face);
2380
2381 ScriptSleep(m_sleepMsOnSetLinkTexture);
2382=======
2383 if (parts.Count > 0) 2362 if (parts.Count > 0)
2384 { 2363 {
2385 try 2364 try
@@ -2391,8 +2370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2391 { 2370 {
2392 } 2371 }
2393 } 2372 }
2394 ScriptSleep(200); 2373 ScriptSleep(m_sleepMsOnSetLinkTexture);
2395>>>>>>> avn/ubitvar
2396 } 2374 }
2397 2375
2398 protected void SetTexture(SceneObjectPart part, string texture, int face) 2376 protected void SetTexture(SceneObjectPart part, string texture, int face)
@@ -3038,12 +3016,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3038 if (m_host.ParentGroup.IsAttachment) 3016 if (m_host.ParentGroup.IsAttachment)
3039 { 3017 {
3040 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); 3018 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
3041<<<<<<< HEAD
3042 vel = avatar.GetWorldVelocity();
3043=======
3044 if (avatar != null) 3019 if (avatar != null)
3045 vel = avatar.Velocity; 3020 vel = avatar.GetWorldVelocity();
3046>>>>>>> avn/ubitvar
3047 } 3021 }
3048 else 3022 else
3049 { 3023 {
@@ -3463,15 +3437,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3463 3437
3464 string reason; 3438 string reason;
3465 money.ObjectGiveMoney( 3439 money.ObjectGiveMoney(
3466<<<<<<< HEAD 3440
3467 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
3468 }, null, "LSL_Api.llGiveMoney");
3469=======
3470 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason); 3441 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
3471 }); 3442 }, null, "LSL_Api.llGiveMoney");
3472 3443
3473 return 0; 3444 return 0;
3474>>>>>>> avn/ubitvar
3475 } 3445 }
3476 3446
3477 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 3447 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
@@ -3574,12 +3544,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3574 } 3544 }
3575 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3545 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3576 } 3546 }
3577<<<<<<< HEAD 3547
3578 }, null, "LSL_Api.llRezAtRoot"); 3548 }, null, "LSL_Api.llRezAtRoot");
3579=======
3580 return;
3581 });
3582>>>>>>> avn/ubitvar
3583 3549
3584 //ScriptSleep((int)((groupmass * velmag) / 10)); 3550 //ScriptSleep((int)((groupmass * velmag) / 10));
3585 ScriptSleep(m_sleepMsOnRezAtRoot); 3551 ScriptSleep(m_sleepMsOnRezAtRoot);
@@ -3594,25 +3560,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3594 { 3560 {
3595 m_host.AddScriptLPS(1); 3561 m_host.AddScriptLPS(1);
3596 3562
3597<<<<<<< HEAD
3598 // normalized direction to target
3599 LSL_Vector dir = llVecNorm(target - from);
3600 // use vertical to help compute left axis
3601 LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
3602 // find normalized left axis parallel to horizon
3603 LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
3604 // make up orthogonal to left and dir
3605 up = LSL_Vector.Cross(dir, left);
3606
3607 // compute rotation based on orthogonal axes
3608 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
3609
3610 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3611 // set the rotation of the object, copy that behavior
3612 PhysicsActor pa = m_host.PhysActor;
3613
3614 if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical)
3615=======
3616 // Get the normalized vector to the target 3563 // Get the normalized vector to the target
3617 LSL_Vector d1 = llVecNorm(target - llGetPos()); 3564 LSL_Vector d1 = llVecNorm(target - llGetPos());
3618 3565
@@ -3629,7 +3576,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3629 LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107); 3576 LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107);
3630 3577
3631 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 3578 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical)
3632>>>>>>> avn/ubitvar
3633 { 3579 {
3634 // Do nothing if either value is 0 (this has been checked in SL) 3580 // Do nothing if either value is 0 (this has been checked in SL)
3635 if (strength <= 0.0 || damping <= 0.0) 3581 if (strength <= 0.0 || damping <= 0.0)
@@ -3703,18 +3649,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3703 } 3649 }
3704 } 3650 }
3705 3651
3706<<<<<<< HEAD
3707 public LSL_Float llGetMassMKS()
3708 {
3709 // this is what the wiki says it does!
3710 // http://wiki.secondlife.com/wiki/LlGetMassMKS
3711 return llGetMass() * 100.0;
3712=======
3713
3714 public LSL_Float llGetMassMKS() 3652 public LSL_Float llGetMassMKS()
3715 { 3653 {
3716 return 100f * llGetMass(); 3654 return 100f * llGetMass();
3717>>>>>>> avn/ubitvar
3718 } 3655 }
3719 3656
3720 public void llCollisionFilter(string name, string id, int accept) 3657 public void llCollisionFilter(string name, string id, int accept)
@@ -3863,17 +3800,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3863 3800
3864 public void llInstantMessage(string user, string message) 3801 public void llInstantMessage(string user, string message)
3865 { 3802 {
3803 m_host.AddScriptLPS(1);
3866 UUID result; 3804 UUID result;
3867 if (!UUID.TryParse(user, out result) || result == UUID.Zero) 3805 if (!UUID.TryParse(user, out result) || result == UUID.Zero)
3868 { 3806 {
3869 ShoutError("An invalid key was passed to llInstantMessage"); 3807 Error("llInstantMessage","An invalid key was passed to llInstantMessage");
3870 ScriptSleep(2000); 3808 ScriptSleep(2000);
3871 return; 3809 return;
3872 } 3810 }
3873 3811
3874
3875 m_host.AddScriptLPS(1);
3876
3877 // We may be able to use ClientView.SendInstantMessage here, but we need a client instance. 3812 // We may be able to use ClientView.SendInstantMessage here, but we need a client instance.
3878 // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent, 3813 // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent,
3879 // but I don't think we have a list of scenes available from here. 3814 // but I don't think we have a list of scenes available from here.
@@ -3883,50 +3818,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3883 3818
3884 // TODO: figure out values for client, fromSession, and imSessionID 3819 // TODO: figure out values for client, fromSession, and imSessionID
3885 // client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch()); 3820 // client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch());
3886<<<<<<< HEAD
3887
3888=======
3889 UUID friendTransactionID = UUID.Random(); 3821 UUID friendTransactionID = UUID.Random();
3890 3822
3891 //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); 3823 //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
3892 3824
3893>>>>>>> avn/ubitvar
3894 GridInstantMessage msg = new GridInstantMessage(); 3825 GridInstantMessage msg = new GridInstantMessage();
3895 msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid; 3826 msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid;
3896 msg.toAgentID = new Guid(user); // toAgentID.Guid; 3827 msg.toAgentID = new Guid(user); // toAgentID.Guid;
3897 msg.imSessionID = new Guid(m_host.UUID.ToString()); // This is the item we're mucking with here 3828 msg.imSessionID = new Guid(m_host.UUID.ToString()); // This is the item we're mucking with here
3898// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
3899// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
3900// DateTime dt = DateTime.UtcNow;
3901//
3902// // Ticks from UtcNow, but make it look like local. Evil, huh?
3903// dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
3904//
3905// try
3906// {
3907// // Convert that to the PST timezone
3908// TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
3909// dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
3910// }
3911// catch
3912// {
3913// // No logging here, as it could be VERY spammy
3914// }
3915//
3916// // And make it look local again to fool the unix time util
3917// dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
3918
3919 msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); 3829 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
3830 msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
3920 3831
3921 //if (client != null)
3922 //{
3923 msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
3924 //}
3925 //else
3926 //{
3927 // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it
3928 //}
3929 // Cap the message length at 1024.
3930 if (message != null && message.Length > 1024) 3832 if (message != null && message.Length > 1024)
3931 msg.message = message.Substring(0, 1024); 3833 msg.message = message.Substring(0, 1024);
3932 else 3834 else
@@ -4237,17 +4139,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4237 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 4139 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
4238 ScriptBaseClass.PERMISSION_CONTROL_CAMERA | 4140 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
4239 ScriptBaseClass.PERMISSION_TRACK_CAMERA | 4141 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
4240<<<<<<< HEAD
4241 ScriptBaseClass.PERMISSION_ATTACH;
4242=======
4243 ScriptBaseClass.PERMISSION_ATTACH | 4142 ScriptBaseClass.PERMISSION_ATTACH |
4244 ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS; 4143 ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS;
4245
4246>>>>>>> avn/ubitvar
4247 } 4144 }
4248 else 4145 else
4249 { 4146 {
4250 if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null) 4147 if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(id => id == agentID) != null)
4251 { 4148 {
4252 // When agent is sitting, certain permissions are implicit if requested from sitting agent 4149 // When agent is sitting, certain permissions are implicit if requested from sitting agent
4253 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 4150 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -4409,14 +4306,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4409 public void llCreateLink(string target, int parent) 4306 public void llCreateLink(string target, int parent)
4410 { 4307 {
4411 m_host.AddScriptLPS(1); 4308 m_host.AddScriptLPS(1);
4412<<<<<<< HEAD
4413=======
4414 4309
4415 UUID targetID; 4310 UUID targetID;
4416 4311
4417 if (!UUID.TryParse(target, out targetID)) 4312 if (!UUID.TryParse(target, out targetID))
4418 return; 4313 return;
4419>>>>>>> avn/ubitvar
4420 4314
4421 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 4315 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4422 && !m_automaticLinkPermission) 4316 && !m_automaticLinkPermission)
@@ -4589,30 +4483,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4589 { 4483 {
4590 m_host.AddScriptLPS(1); 4484 m_host.AddScriptLPS(1);
4591 4485
4592<<<<<<< HEAD 4486 TaskInventoryItem item = m_item;
4593 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 4487
4488 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4594 && !m_automaticLinkPermission) 4489 && !m_automaticLinkPermission)
4595 { 4490 {
4596 Error("llBreakAllLinks", "PERMISSION_CHANGE_LINKS permission not set"); 4491 Error("llBreakAllLinks","Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
4597 return; 4492 return;
4598 } 4493 }
4599
4600 BreakAllLinks(); 4494 BreakAllLinks();
4601 } 4495 }
4602 4496
4603 public void BreakAllLinks() 4497 public void BreakAllLinks()
4604 { 4498 {
4605=======
4606 TaskInventoryItem item = m_item;
4607
4608 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4609 && !m_automaticLinkPermission)
4610 {
4611 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
4612 return;
4613 }
4614
4615>>>>>>> avn/ubitvar
4616 SceneObjectGroup parentPrim = m_host.ParentGroup; 4499 SceneObjectGroup parentPrim = m_host.ParentGroup;
4617 if (parentPrim.AttachmentPoint != 0) 4500 if (parentPrim.AttachmentPoint != 0)
4618 return; // Fail silently if attached 4501 return; // Fail silently if attached
@@ -4643,12 +4526,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4643 { 4526 {
4644 linknum -= (m_host.ParentGroup.PrimCount) + 1; 4527 linknum -= (m_host.ParentGroup.PrimCount) + 1;
4645 4528
4646<<<<<<< HEAD
4647 ISceneEntity entity = GetLinkEntity(m_host, linknum);
4648=======
4649 if (linknum < 0) 4529 if (linknum < 0)
4650 return UUID.Zero.ToString(); 4530 return UUID.Zero.ToString();
4651>>>>>>> avn/ubitvar
4652 4531
4653 List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET); 4532 List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
4654 if (avatars.Count > linknum) 4533 if (avatars.Count > linknum)
@@ -4779,14 +4658,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4779 4658
4780 if (item == null) 4659 if (item == null)
4781 { 4660 {
4782<<<<<<< HEAD
4783 Error("llGiveInventory", "Can't find inventory object '" + inventory + "'"); 4661 Error("llGiveInventory", "Can't find inventory object '" + inventory + "'");
4784 return; 4662 return;
4785=======
4786 llSay(0, String.Format("Could not find object '{0}'", inventory));
4787 return;
4788// throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
4789>>>>>>> avn/ubitvar
4790 } 4663 }
4791 4664
4792 UUID objId = item.ItemID; 4665 UUID objId = item.ItemID;
@@ -4845,9 +4718,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4845 4718
4846 ScenePresence sp; 4719 ScenePresence sp;
4847 4720
4848<<<<<<< HEAD
4849 ScriptSleep(m_sleepMsOnGiveInventory);
4850=======
4851 if (World.TryGetScenePresence(destId, out sp)) 4721 if (World.TryGetScenePresence(destId, out sp))
4852 { 4722 {
4853 sp.ControllingClient.SendInstantMessage(msg); 4723 sp.ControllingClient.SendInstantMessage(msg);
@@ -4859,8 +4729,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4859 } 4729 }
4860 4730
4861 //This delay should only occur when giving inventory to avatars. 4731 //This delay should only occur when giving inventory to avatars.
4862 ScriptSleep(3000); 4732 ScriptSleep(m_sleepMsOnGiveInventory);
4863>>>>>>> avn/ubitvar
4864 } 4733 }
4865 } 4734 }
4866 4735
@@ -4919,16 +4788,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4919 { 4788 {
4920 m_host.AddScriptLPS(1); 4789 m_host.AddScriptLPS(1);
4921 4790
4922<<<<<<< HEAD
4923 UUID uuid = (UUID)id;
4924 PresenceInfo pinfo = null;
4925 UserAccount account;
4926
4927 UserInfoCacheEntry ce;
4928
4929 lock (m_userInfoCache)
4930 {
4931=======
4932 UUID uuid; 4791 UUID uuid;
4933 if (UUID.TryParse(id, out uuid)) 4792 if (UUID.TryParse(id, out uuid))
4934 { 4793 {
@@ -4936,7 +4795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4936 UserAccount account; 4795 UserAccount account;
4937 4796
4938 UserInfoCacheEntry ce; 4797 UserInfoCacheEntry ce;
4939>>>>>>> avn/ubitvar
4940 if (!m_userInfoCache.TryGetValue(uuid, out ce)) 4798 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4941 { 4799 {
4942 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 4800 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
@@ -4945,10 +4803,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4945 m_userInfoCache[uuid] = null; // Cache negative 4803 m_userInfoCache[uuid] = null; // Cache negative
4946 return UUID.Zero.ToString(); 4804 return UUID.Zero.ToString();
4947 } 4805 }
4948<<<<<<< HEAD
4949=======
4950
4951>>>>>>> avn/ubitvar
4952 4806
4953 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4807 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4954 if (pinfos != null && pinfos.Length > 0) 4808 if (pinfos != null && pinfos.Length > 0)
@@ -4961,40 +4815,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4961 } 4815 }
4962 } 4816 }
4963 } 4817 }
4964<<<<<<< HEAD
4965
4966 ce = new UserInfoCacheEntry();
4967 ce.time = Util.EnvironmentTickCount();
4968 ce.account = account;
4969 ce.pinfo = pinfo;
4970
4971 m_userInfoCache[uuid] = ce;
4972 }
4973 else
4974 {
4975 if (ce == null)
4976 return UUID.Zero.ToString();
4977
4978 account = ce.account;
4979
4980 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time)
4981 >= LlRequestAgentDataCacheTimeoutMs)
4982 {
4983 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4984 if (pinfos != null && pinfos.Length > 0)
4985 {
4986 foreach (PresenceInfo p in pinfos)
4987 {
4988 if (p.RegionID != UUID.Zero)
4989 {
4990 pinfo = p;
4991 }
4992 }
4993 }
4994 else
4995 {
4996 pinfo = null;
4997=======
4998 4818
4999 ce = new UserInfoCacheEntry(); 4819 ce = new UserInfoCacheEntry();
5000 ce.time = Util.EnvironmentTickCount(); 4820 ce.time = Util.EnvironmentTickCount();
@@ -5022,60 +4842,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5022 { 4842 {
5023 pinfo = p; 4843 pinfo = p;
5024 } 4844 }
5025>>>>>>> avn/ubitvar
5026 } 4845 }
5027
5028 ce.time = Util.EnvironmentTickCount();
5029 ce.pinfo = pinfo;
5030 }
5031 else
5032 {
5033 pinfo = ce.pinfo;
5034 } 4846 }
5035<<<<<<< HEAD
5036 }
5037 }
5038=======
5039 else 4847 else
5040 pinfo = null; 4848 pinfo = null;
5041 4849
5042 ce.time = Util.EnvironmentTickCount(); 4850 ce.time = Util.EnvironmentTickCount();
5043 ce.pinfo = pinfo; 4851 ce.pinfo = pinfo;
5044 } 4852 }
5045>>>>>>> avn/ubitvar
5046 4853
5047 string reply = String.Empty; 4854 string reply = String.Empty;
5048 4855
5049<<<<<<< HEAD
5050 switch (data)
5051 {
5052 case ScriptBaseClass.DATA_ONLINE:
5053 if (pinfo != null && pinfo.RegionID != UUID.Zero)
5054 reply = "1";
5055 else
5056 reply = "0";
5057 break;
5058 case ScriptBaseClass.DATA_NAME: // (First Last)
5059 reply = account.FirstName + " " + account.LastName;
5060 break;
5061 case ScriptBaseClass.DATA_BORN: // (YYYY-MM-DD)
5062 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
5063 born = born.AddSeconds(account.Created);
5064 reply = born.ToString("yyyy-MM-dd");
5065 break;
5066 case ScriptBaseClass.DATA_RATING: // (0,0,0,0,0,0)
5067 reply = "0,0,0,0,0,0";
5068 break;
5069 case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
5070 reply = account.UserLevel.ToString();
5071 break;
5072 case ScriptBaseClass.DATA_PAYINFO: // (0|1|2|3)
5073 reply = "0";
5074 break;
5075 default:
5076 return UUID.Zero.ToString(); // Raise no event
5077 }
5078=======
5079 switch (data) 4856 switch (data)
5080 { 4857 {
5081 case 1: // DATA_ONLINE (0|1) 4858 case 1: // DATA_ONLINE (0|1)
@@ -5101,7 +4878,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5101 default: 4878 default:
5102 return UUID.Zero.ToString(); // Raise no event 4879 return UUID.Zero.ToString(); // Raise no event
5103 } 4880 }
5104>>>>>>> avn/ubitvar
5105 4881
5106 UUID rq = UUID.Random(); 4882 UUID rq = UUID.Random();
5107 4883
@@ -5112,19 +4888,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5112 AsyncCommands. 4888 AsyncCommands.
5113 DataserverPlugin.DataserverReply(rq.ToString(), reply); 4889 DataserverPlugin.DataserverReply(rq.ToString(), reply);
5114 4890
5115<<<<<<< HEAD 4891 ScriptSleep(m_sleepMsOnRequestAgentData);
5116 ScriptSleep(m_sleepMsOnRequestAgentData);
5117 return tid.ToString();
5118=======
5119 ScriptSleep(100);
5120 return tid.ToString(); 4892 return tid.ToString();
5121 } 4893 }
5122 else 4894 else
5123 { 4895 {
5124 ShoutError("Invalid UUID passed to llRequestAgentData."); 4896 Error("llRequestAgentData","Invalid UUID passed to llRequestAgentData.");
5125 } 4897 }
5126 return ""; 4898 return "";
5127>>>>>>> avn/ubitvar
5128 } 4899 }
5129 4900
5130 public LSL_String llRequestInventoryData(string name) 4901 public LSL_String llRequestInventoryData(string name)
@@ -5252,11 +5023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5252 m_host.AddScriptLPS(1); 5023 m_host.AddScriptLPS(1);
5253 UUID agentId = new UUID(); 5024 UUID agentId = new UUID();
5254 5025
5255<<<<<<< HEAD
5256 ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y); 5026 ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y);
5257=======
5258 ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256);
5259>>>>>>> avn/ubitvar
5260 5027
5261 if (UUID.TryParse(agent, out agentId)) 5028 if (UUID.TryParse(agent, out agentId))
5262 { 5029 {
@@ -6057,13 +5824,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6057 // NOTE: 3rd case is needed because a NULL_KEY comes through as 5824 // NOTE: 3rd case is needed because a NULL_KEY comes through as
6058 // type 'obj' and wrongly returns "" 5825 // type 'obj' and wrongly returns ""
6059 else if (!(src.Data[index] is LSL_String || 5826 else if (!(src.Data[index] is LSL_String ||
6060<<<<<<< HEAD
6061 src.Data[index] is LSL_Key || 5827 src.Data[index] is LSL_Key ||
6062 src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000")) 5828 src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
6063=======
6064 src.Data[index] is LSL_Key ||
6065 src.Data[index] is String))
6066>>>>>>> avn/ubitvar
6067 { 5829 {
6068 return ""; 5830 return "";
6069 } 5831 }
@@ -6443,7 +6205,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6443 { 6205 {
6444 m_host.AddScriptLPS(1); 6206 m_host.AddScriptLPS(1);
6445 return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0); 6207 return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0);
6446<<<<<<< HEAD
6447 } 6208 }
6448 6209
6449 public LSL_String llGetEnv(LSL_String name) 6210 public LSL_String llGetEnv(LSL_String name)
@@ -6509,8 +6270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6509 { 6270 {
6510 return ""; 6271 return "";
6511 } 6272 }
6512======= 6273
6513>>>>>>> avn/ubitvar
6514 } 6274 }
6515 6275
6516 /// <summary> 6276 /// <summary>
@@ -7153,11 +6913,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7153 if (UUID.TryParse(id, out key)) 6913 if (UUID.TryParse(id, out key))
7154 { 6914 {
7155 ScenePresence av = World.GetScenePresence(key); 6915 ScenePresence av = World.GetScenePresence(key);
7156 List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); 6916 List<UUID> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
7157 6917
7158 if (av != null) 6918 if (av != null)
7159 { 6919 {
7160 if (sittingAvatars.Contains(av)) 6920 if (sittingAvatars.Contains(key))
7161 { 6921 {
7162 // if the avatar is sitting on this object, then 6922 // if the avatar is sitting on this object, then
7163 // we can unsit them. We don't want random scripts unsitting random people 6923 // we can unsit them. We don't want random scripts unsitting random people
@@ -8152,16 +7912,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8152 UUID av = new UUID(); 7912 UUID av = new UUID();
8153 if (!UUID.TryParse(avatar,out av)) 7913 if (!UUID.TryParse(avatar,out av))
8154 { 7914 {
8155<<<<<<< HEAD
8156 Error("llDialog", "First parameter must be a key"); 7915 Error("llDialog", "First parameter must be a key");
8157=======
8158 //LSLError("First parameter to llDialog needs to be a key");
8159>>>>>>> avn/ubitvar
8160 return; 7916 return;
8161 } 7917 }
8162 if (buttons.Length < 1) 7918 if (buttons.Length < 1)
8163 { 7919 {
8164<<<<<<< HEAD
8165 Error("llDialog", "At least 1 button must be shown"); 7920 Error("llDialog", "At least 1 button must be shown");
8166 return; 7921 return;
8167 } 7922 }
@@ -8169,13 +7924,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8169 { 7924 {
8170 Error("llDialog", "No more than 12 buttons can be shown"); 7925 Error("llDialog", "No more than 12 buttons can be shown");
8171 return; 7926 return;
8172=======
8173 buttons.Add("OK");
8174 }
8175 if (buttons.Length > 12)
8176 {
8177 ShoutError("button list too long, must be 12 or fewer entries");
8178>>>>>>> avn/ubitvar
8179 } 7927 }
8180 int length = buttons.Length; 7928 int length = buttons.Length;
8181 if (length > 12) 7929 if (length > 12)
@@ -8186,20 +7934,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8186 { 7934 {
8187 if (buttons.Data[i].ToString() == String.Empty) 7935 if (buttons.Data[i].ToString() == String.Empty)
8188 { 7936 {
8189<<<<<<< HEAD
8190 Error("llDialog", "Button label cannot be blank"); 7937 Error("llDialog", "Button label cannot be blank");
8191=======
8192 ShoutError("button label cannot be blank");
8193>>>>>>> avn/ubitvar
8194 return; 7938 return;
8195 } 7939 }
8196 if (buttons.Data[i].ToString().Length > 24) 7940 if (buttons.Data[i].ToString().Length > 24)
8197 { 7941 {
8198<<<<<<< HEAD
8199 Error("llDialog", "Button label cannot be longer than 24 characters"); 7942 Error("llDialog", "Button label cannot be longer than 24 characters");
8200=======
8201 ShoutError("button label cannot be longer than 24 characters");
8202>>>>>>> avn/ubitvar
8203 return; 7943 return;
8204 } 7944 }
8205 buts[i] = buttons.Data[i].ToString(); 7945 buts[i] = buttons.Data[i].ToString();
@@ -8750,7 +8490,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8750 ScriptSleep(m_sleepMsOnSetPrimitiveParams); 8490 ScriptSleep(m_sleepMsOnSetPrimitiveParams);
8751 } 8491 }
8752 8492
8753<<<<<<< HEAD
8754 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) 8493 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
8755 { 8494 {
8756 m_host.AddScriptLPS(1); 8495 m_host.AddScriptLPS(1);
@@ -8760,8 +8499,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8760 ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams); 8499 ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
8761 } 8500 }
8762 8501
8763=======
8764>>>>>>> avn/ubitvar
8765 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 8502 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
8766 { 8503 {
8767 m_host.AddScriptLPS(1); 8504 m_host.AddScriptLPS(1);
@@ -8769,13 +8506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8769 SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); 8506 SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
8770 } 8507 }
8771 8508
8772<<<<<<< HEAD 8509 private void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
8773 protected void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
8774 {
8775 SetEntityParams(GetLinkEntities(linknumber), rules, originFunc);
8776 }
8777=======
8778 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
8779 { 8510 {
8780 List<object> parts = new List<object>(); 8511 List<object> parts = new List<object>();
8781 List<SceneObjectPart> prims = GetLinkParts(linknumber); 8512 List<SceneObjectPart> prims = GetLinkParts(linknumber);
@@ -8784,14 +8515,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8784 parts.Add(p); 8515 parts.Add(p);
8785 foreach (ScenePresence p in avatars) 8516 foreach (ScenePresence p in avatars)
8786 parts.Add(p); 8517 parts.Add(p);
8787>>>>>>> avn/ubitvar 8518
8519 LSL_List remaining = new LSL_List();
8520 uint rulesParsed = 0;
8521
8522 if (parts.Count > 0)
8523 {
8524 foreach (object part in parts)
8525 {
8526 if (part is SceneObjectPart)
8527 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8528 else
8529 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
8530 }
8531
8532 while (remaining.Length > 2)
8533 {
8534 linknumber = remaining.GetLSLIntegerItem(0);
8535 rules = remaining.GetSublist(1, -1);
8536 parts.Clear();
8537 prims = GetLinkParts(linknumber);
8538 avatars = GetLinkAvatars(linknumber);
8539 foreach (SceneObjectPart p in prims)
8540 parts.Add(p);
8541 foreach (ScenePresence p in avatars)
8542 parts.Add(p);
8543
8544 remaining = new LSL_List();
8545 foreach (object part in parts)
8546 {
8547 if (part is SceneObjectPart)
8548 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8549 else
8550 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
8551 }
8552 }
8553 }
8554 }
8788 8555
8789 protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc) 8556 protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc)
8790 { 8557 {
8791 LSL_List remaining = new LSL_List(); 8558 LSL_List remaining = new LSL_List();
8792 uint rulesParsed = 0; 8559 uint rulesParsed = 0;
8793 8560
8794<<<<<<< HEAD
8795 foreach (ISceneEntity entity in entities) 8561 foreach (ISceneEntity entity in entities)
8796 { 8562 {
8797 if (entity is SceneObjectPart) 8563 if (entity is SceneObjectPart)
@@ -8826,51 +8592,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8826 } 8592 }
8827 } 8593 }
8828 8594
8829 public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
8830 {
8831 SceneObjectGroup group = m_host.ParentGroup;
8832
8833 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical)
8834 return;
8835 if (group.IsAttachment)
8836 return;
8837
8838 if (frames.Data.Length > 0) // We are getting a new motion
8839=======
8840 if (parts.Count > 0)
8841>>>>>>> avn/ubitvar
8842 {
8843 foreach (object part in parts)
8844 {
8845 if (part is SceneObjectPart)
8846 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8847 else
8848 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
8849 }
8850
8851 while ((object)remaining != null && remaining.Length > 2)
8852 {
8853 linknumber = remaining.GetLSLIntegerItem(0);
8854 rules = remaining.GetSublist(1, -1);
8855 parts.Clear();
8856 prims = GetLinkParts(linknumber);
8857 avatars = GetLinkAvatars(linknumber);
8858 foreach (SceneObjectPart p in prims)
8859 parts.Add(p);
8860 foreach (ScenePresence p in avatars)
8861 parts.Add(p);
8862
8863 remaining = null;
8864 foreach (object part in parts)
8865 {
8866 if (part is SceneObjectPart)
8867 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
8868 else
8869 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
8870 }
8871 }
8872 }
8873 }
8874 8595
8875 public LSL_List llGetPhysicsMaterial() 8596 public LSL_List llGetPhysicsMaterial()
8876 { 8597 {
@@ -8914,13 +8635,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8914 SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier); 8635 SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
8915 } 8636 }
8916 8637
8917 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
8918 {
8919 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
8920 llSetLinkPrimitiveParamsFast(linknumber, rules);
8921 ScriptSleep(200);
8922 }
8923
8924 // vector up using libomv (c&p from sop ) 8638 // vector up using libomv (c&p from sop )
8925 // vector up rotated by r 8639 // vector up rotated by r
8926 private Vector3 Zrot(Quaternion r) 8640 private Vector3 Zrot(Quaternion r)
@@ -8947,7 +8661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8947 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed) 8661 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed)
8948 { 8662 {
8949 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 8663 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
8950 return null; 8664 return new LSL_List();
8951 8665
8952 int idx = 0; 8666 int idx = 0;
8953 int idxStart = 0; 8667 int idxStart = 0;
@@ -8977,26 +8691,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8977 if (remain < 1) 8691 if (remain < 1)
8978 return new LSL_List(); 8692 return new LSL_List();
8979 8693
8980<<<<<<< HEAD
8981 try
8982 {
8983 v = rules.GetVector3Item(idx++);
8984 }
8985 catch(InvalidCastException)
8986 {
8987 if(code == ScriptBaseClass.PRIM_POSITION)
8988 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8989 else
8990 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8991 return new LSL_List();
8992 }
8993=======
8994 v=rules.GetVector3Item(idx++); 8694 v=rules.GetVector3Item(idx++);
8995 if (part.IsRoot && !part.ParentGroup.IsAttachment) 8695 if (part.IsRoot && !part.ParentGroup.IsAttachment)
8996 currentPosition = GetSetPosTarget(part, v, currentPosition, true); 8696 currentPosition = GetSetPosTarget(part, v, currentPosition, true);
8997 else 8697 else
8998 currentPosition = GetSetPosTarget(part, v, currentPosition, false); 8698 currentPosition = GetSetPosTarget(part, v, currentPosition, false);
8999>>>>>>> avn/ubitvar
9000 positionChanged = true; 8699 positionChanged = true;
9001 8700
9002 break; 8701 break;
@@ -10023,12 +9722,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10023 9722
10024 break; 9723 break;
10025 9724
10026<<<<<<< HEAD
10027 case ScriptBaseClass.PRIM_TEMP_ON_REZ:
10028=======
10029 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: 9725 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
10030 if (remain < 5) 9726 if (remain < 5)
10031 return null; 9727 return new LSL_List();
10032 9728
10033 int material_bits = rules.GetLSLIntegerItem(idx++); 9729 int material_bits = rules.GetLSLIntegerItem(idx++);
10034 float material_density = (float)rules.GetLSLFloatItem(idx++); 9730 float material_density = (float)rules.GetLSLFloatItem(idx++);
@@ -10041,7 +9737,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10041 break; 9737 break;
10042 9738
10043 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 9739 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
10044>>>>>>> avn/ubitvar
10045 if (remain < 1) 9740 if (remain < 1)
10046 return new LSL_List(); 9741 return new LSL_List();
10047 string temp = rules.Data[idx++].ToString(); 9742 string temp = rules.Data[idx++].ToString();
@@ -10397,12 +10092,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10397 10092
10398 public LSL_String llXorBase64Strings(string str1, string str2) 10093 public LSL_String llXorBase64Strings(string str1, string str2)
10399 { 10094 {
10400<<<<<<< HEAD
10401 m_host.AddScriptLPS(1);
10402 Deprecated("llXorBase64Strings", "Use llXorBase64 instead");
10403 ScriptSleep(m_sleepMsOnXorBase64Strings);
10404 return String.Empty;
10405=======
10406 int padding = 0; 10095 int padding = 0;
10407 10096
10408 string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 10097 string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -10501,7 +10190,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10501 output += "="; 10190 output += "=";
10502 10191
10503 return output; 10192 return output;
10504>>>>>>> avn/ubitvar
10505 } 10193 }
10506 10194
10507 public void llRemoteDataSetRegion() 10195 public void llRemoteDataSetRegion()
@@ -10645,173 +10333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10645 public LSL_List llGetBoundingBox(string obj) 10333 public LSL_List llGetBoundingBox(string obj)
10646 { 10334 {
10647 m_host.AddScriptLPS(1); 10335 m_host.AddScriptLPS(1);
10648
10649 // Get target avatar if non-seated avatar or attachment, or prim and object
10650 UUID objID = UUID.Zero; 10336 UUID objID = UUID.Zero;
10651 UUID.TryParse(obj, out objID);
10652 ScenePresence agent = World.GetScenePresence(objID);
10653 if (agent != null)
10654 {
10655 if (agent.ParentPart != null)
10656 {
10657 objID = agent.ParentPart.UUID;
10658 agent = null;
10659 }
10660 }
10661 SceneObjectGroup group = null;
10662 SceneObjectPart target = World.GetSceneObjectPart(objID);
10663 if (target != null)
10664 {
10665 group = target.ParentGroup;
10666 if (group.IsAttachment) {
10667 objID = group.AttachedAvatar;
10668 agent = World.GetScenePresence(objID);
10669 group = null;
10670 target = null;
10671 }
10672 }
10673
10674 // Initialize but break if no target
10675 LSL_List result = new LSL_List(); 10337 LSL_List result = new LSL_List();
10676<<<<<<< HEAD
10677 int groupCount = 0;
10678 int partCount = 0;
10679 int vertexCount = 0;
10680 if (target == null && agent == null)
10681=======
10682 10338
10683 // If the ID is not valid, return null result 10339 // If the ID is not valid, return null result
10684 if (!UUID.TryParse(obj, out objID)) 10340 if (!UUID.TryParse(obj, out objID))
10685>>>>>>> avn/ubitvar
10686 { 10341 {
10687 result.Add(new LSL_Vector()); 10342 result.Add(new LSL_Vector());
10688 result.Add(new LSL_Vector()); 10343 result.Add(new LSL_Vector());
10689 if (m_addStatsInGetBoundingBox)
10690 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
10691 return result; 10344 return result;
10692 } 10345 }
10693<<<<<<< HEAD
10694 Vector3 minPosition = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
10695 Vector3 maxPosition = new Vector3(float.MinValue, float.MinValue, float.MinValue);
10696
10697 // Try to get a mesher
10698 IRendering primMesher = null;
10699 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
10700 if (renderers.Count > 0)
10701 primMesher = RenderingLoader.LoadRenderer(renderers[0]);
10702
10703 // Get bounding box of just avatar, seated or not
10704 if (agent != null)
10705 {
10706 bool hasParent = false;
10707 Vector3 lower;
10708 Vector3 upper;
10709 BoundingBoxOfScenePresence(agent, out lower, out upper);
10710 Vector3 offset = Vector3.Zero;
10711
10712 // Since local bounding box unrotated and untilted, keep it simple
10713 AddBoundingBoxOfSimpleBox(lower, upper, offset, agent.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10714 partCount++;
10715 groupCount++;
10716
10717 // Return lower and upper bounding box corners
10718 result.Add(new LSL_Vector(minPosition));
10719 result.Add(new LSL_Vector(maxPosition));
10720 if (m_addStatsInGetBoundingBox)
10721 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
10722 return result;
10723 }
10724 // Get bounding box of object including seated avatars
10725 else if (group != null)
10726 {
10727 // Merge bounding boxes of all parts (prims and mesh)
10728 foreach (SceneObjectPart part in group.Parts)
10729 {
10730 bool hasParent = (!part.IsRoot);
10731 // When requested or if no mesher, keep it simple
10732 if (m_useSimpleBoxesInGetBoundingBox || primMesher == null)
10733 {
10734 AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10735 }
10736 // Do the full mounty
10737 else
10738 {
10739 Primitive omvPrim = part.Shape.ToOmvPrimitive(part.OffsetPosition, part.RotationOffset);
10740 byte[] sculptAsset = null;
10741 if (omvPrim.Sculpt != null)
10742 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
10743
10744 // When part is mesh
10745 // Quirk: Only imports as incompletely populated faceted mesh object, so needs an own handler.
10746 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
10747 {
10748 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
10749 FacetedMesh mesh = null;
10750 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, DetailLevel.Highest, out mesh);
10751 meshAsset = null;
10752 if (mesh != null)
10753 {
10754 AddBoundingBoxOfFacetedMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10755 mesh = null;
10756 }
10757 }
10758
10759 // When part is sculpt
10760 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
10761 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
10762 {
10763 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>();
10764 if (imgDecoder != null)
10765 {
10766 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
10767 if (sculpt != null)
10768 {
10769 SimpleMesh mesh = primMesher.GenerateSimpleSculptMesh(omvPrim, (Bitmap)sculpt, DetailLevel.Medium);
10770 sculpt.Dispose();
10771 if (mesh != null)
10772 {
10773 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10774 mesh = null;
10775 }
10776 }
10777 }
10778 }
10779
10780 // When part is prim
10781 else if (omvPrim.Sculpt == null)
10782 {
10783 SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium);
10784 if (mesh != null)
10785 {
10786 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10787 mesh = null;
10788 }
10789 }
10790
10791 // When all else fails, try fallback to simple box
10792 else
10793 {
10794 AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10795 }
10796 }
10797 partCount++;
10798 }
10799 }
10800
10801 // Merge bounding boxes of seated avatars
10802 foreach (ScenePresence sp in group.GetSittingAvatars())
10803 {
10804 Vector3 lower;
10805 Vector3 upper;
10806 BoundingBoxOfScenePresence(sp, out lower, out upper);
10807 Vector3 offset = sp.OffsetPosition;
10808
10809 bool hasParent = true;
10810 // When requested or if no mesher, keep it simple
10811 if (m_useSimpleBoxesInGetBoundingBox || primMesher == null)
10812 {
10813 AddBoundingBoxOfSimpleBox(lower, upper, offset, sp.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10814=======
10815 10346
10816 // Check if this is an attached prim. If so, replace 10347 // Check if this is an attached prim. If so, replace
10817 // the UUID with the avatar UUID and report it's bounding box 10348 // the UUID with the avatar UUID and report it's bounding box
@@ -10855,68 +10386,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10855 // This is for ground sitting avatars TODO! 10386 // This is for ground sitting avatars TODO!
10856 lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f); 10387 lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f);
10857 upper = new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f); 10388 upper = new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f);
10858>>>>>>> avn/ubitvar
10859 } 10389 }
10860 // Do the full mounty
10861 else 10390 else
10862 { 10391 {
10863<<<<<<< HEAD
10864 // Prim shapes don't do center offsets, so add it here.
10865 offset = offset + (lower + upper) * 0.5f * sp.Rotation;
10866 Primitive omvPrim = MakeOpenMetaversePrim(upper - lower, offset, sp.Rotation, ScriptBaseClass.PRIM_TYPE_SPHERE);
10867 SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium);
10868 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10869 mesh = null;
10870 }
10871 partCount++;
10872 }
10873
10874 groupCount++;
10875
10876 // Return lower and upper bounding box corners
10877 result.Add(new LSL_Vector(minPosition));
10878 result.Add(new LSL_Vector(maxPosition));
10879 if (m_addStatsInGetBoundingBox)
10880 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
10881
10882 primMesher = null;
10883 return result;
10884 }
10885
10886 /// <summary>
10887 /// Helper to calculate bounding box of an avatar.
10888 /// </summary>
10889 private void BoundingBoxOfScenePresence(ScenePresence sp, out Vector3 lower, out Vector3 upper)
10890 {
10891 // Adjust from OS model
10892 // avatar height = visual height - 0.2, bounding box height = visual height
10893 // to SL model
10894 // avatar height = visual height, bounding box height = visual height + 0.2
10895 float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection;
10896
10897 // According to avatar bounding box in SL 2015-04-18:
10898 // standing = <-0.275,-0.35,-0.1-0.5*h> : <0.275,0.35,0.1+0.5*h>
10899 // groundsitting = <-0.3875,-0.5,-0.05-0.375*h> : <0.3875,0.5,0.5>
10900 // sitting = <-0.5875,-0.35,-0.35-0.375*h> : <0.1875,0.35,-0.25+0.25*h>
10901
10902 // When avatar is sitting
10903 if (sp.ParentPart != null)
10904 {
10905 lower = new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height);
10906 upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height);
10907 }
10908 // When avatar is groundsitting
10909 else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
10910 {
10911 lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height);
10912 upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height);
10913 }
10914 // When avatar is standing or flying
10915 else
10916 {
10917 lower = new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height);
10918 upper = new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height);
10919=======
10920 // This is for standing/flying avatars 10392 // This is for standing/flying avatars
10921 lower = new LSL_Vector(-box.X, -box.Y, -box.Z); 10393 lower = new LSL_Vector(-box.X, -box.Y, -box.Z);
10922 upper = new LSL_Vector(box.X, box.Y, box.Z); 10394 upper = new LSL_Vector(box.X, box.Y, box.Z);
@@ -10974,230 +10446,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10974 result.Add(lower); 10446 result.Add(lower);
10975 result.Add(upper); 10447 result.Add(upper);
10976 return result; 10448 return result;
10977>>>>>>> avn/ubitvar
10978 }
10979 }
10980
10981 /// <summary>
10982 /// Helper to approximate a part with a simple box.
10983 /// </summary>
10984 private void AddBoundingBoxOfSimpleBox(Vector3 corner1, Vector3 corner2, Vector3 offset, Quaternion rotation, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
10985 {
10986 // Parse the 8 box corners
10987 for (int i = 0; i < 8; i++)
10988 {
10989 // Calculate each box corner
10990 Vector3 position = corner1;
10991 if ((i & 1) != 0)
10992 position.X = corner2.X;
10993 if ((i & 2) != 0)
10994 position.Y = corner2.Y;
10995 if ((i & 4) != 0)
10996 position.Z = corner2.Z;
10997 // Rotate part unless part is root
10998 if (hasParent)
10999 position = position * rotation;
11000 position = position + offset;
11001 // Adjust lower and upper bounding box corners if needed
11002 lower = Vector3.Min(lower, position);
11003 upper = Vector3.Max(upper, position);
11004 count++;
11005 }
11006 }
11007
11008 /// <summary>
11009 /// Helper to parse a meshed prim and needed especially
11010 /// for accuracy with tortured prims and sculpts.
11011 /// </summary>
11012 private void AddBoundingBoxOfSimpleMesh(SimpleMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
11013 {
11014 // Quirk: A meshed box contains 10 instead of the 8 necessary vertices.
11015 if (mesh != null)
11016 {
11017 // Parse each vertex in mesh
11018 foreach (Vertex vertex in mesh.Vertices)
11019 {
11020 Vector3 position = vertex.Position;
11021 position = position * prim.Scale;
11022 // Rotate part unless part is root
11023 if (hasParent)
11024 position = position * prim.Rotation;
11025 position = position + prim.Position;
11026 // Adjust lower and upper bounding box corners if needed
11027 lower = Vector3.Min(lower, position);
11028 upper = Vector3.Max(upper, position);
11029 count++;
11030 }
11031 }
11032 }
11033
11034 /// <summary>
11035 /// Helper to parse mesh because no method exists
11036 /// to parse mesh assets to SimpleMesh.
11037 /// </summary>
11038 private void AddBoundingBoxOfFacetedMesh(FacetedMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
11039 {
11040 if (mesh != null)
11041 {
11042 // Parse each face in mesh
11043 // since vertex array isn't populated.
11044 // This parses each unique vertex 3-6 times.
11045 foreach (Face face in mesh.Faces)
11046 {
11047 // Parse each vertex in face
11048 foreach (Vertex vertex in face.Vertices)
11049 {
11050 Vector3 position = vertex.Position;
11051 position = position * prim.Scale;
11052 // Rotate part unless part is root
11053 if (hasParent)
11054 position = position * prim.Rotation;
11055 position = position + prim.Position;
11056 // Adjust lower and upper bounding box corners if needed
11057 lower = Vector3.Min(lower, position);
11058 upper = Vector3.Max(upper, position);
11059 count++;
11060 }
11061 }
11062 } 10449 }
11063 }
11064 10450
11065 /// <summary> 10451 // Not found so return empty values
11066 /// Helper to make up an OpenMetaverse prim 10452 result.Add(new LSL_Vector());
11067 /// needed to create mesh from parts. 10453 result.Add(new LSL_Vector());
11068 /// </summary> 10454 return result;
11069 private Primitive MakeOpenMetaversePrim(Vector3 scale, Vector3 position, Quaternion rotation, int primType)
11070 {
11071 // Initialize and set common parameters
11072 Primitive prim = new OpenMetaverse.Primitive();
11073 prim.Scale = scale;
11074 prim.Position = position;
11075 prim.Rotation = rotation;
11076 prim.PrimData.PathShearX = 0.0f;
11077 prim.PrimData.PathShearY = 0.0f;
11078 prim.PrimData.PathBegin = 0.0f;
11079 prim.PrimData.PathEnd = 1.0f;
11080 prim.PrimData.PathScaleX = 1.0f;
11081 prim.PrimData.PathScaleY = 1.0f;
11082 prim.PrimData.PathTaperX = 0.0f;
11083 prim.PrimData.PathTaperY = 0.0f;
11084 prim.PrimData.PathTwistBegin = 0.0f;
11085 prim.PrimData.PathTwist = 0.0f;
11086 prim.PrimData.ProfileBegin = 0.0f;
11087 prim.PrimData.ProfileEnd = 1.0f;
11088 prim.PrimData.ProfileHollow = 0.0f;
11089 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11090 prim.PrimData.ProfileHole = (HoleType)0;
11091 prim.PrimData.PathCurve = (PathCurve)16;
11092 prim.PrimData.PathRadiusOffset = 0.0f;
11093 prim.PrimData.PathRevolutions = 1.0f;
11094 prim.PrimData.PathSkew = 0.0f;
11095 prim.PrimData.PCode = OpenMetaverse.PCode.Prim;
11096 prim.PrimData.State = (byte)0;
11097
11098 // Set type specific parameters
11099 switch (primType)
11100 {
11101 // Set specific parameters for box
11102 case ScriptBaseClass.PRIM_TYPE_BOX:
11103 prim.PrimData.PathScaleY = 1.0f;
11104 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11105 prim.PrimData.PathCurve = (PathCurve)16;
11106 break;
11107 // Set specific parameters for cylinder
11108 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
11109 prim.PrimData.PathScaleY = 1.0f;
11110 prim.PrimData.ProfileCurve = (ProfileCurve)0;
11111 prim.PrimData.PathCurve = (PathCurve)16;
11112 break;
11113 // Set specific parameters for prism
11114 case ScriptBaseClass.PRIM_TYPE_PRISM:
11115 prim.PrimData.PathScaleY = 1.0f;
11116 prim.PrimData.ProfileCurve = (ProfileCurve)3;
11117 prim.PrimData.PathCurve = (PathCurve)16;
11118 break;
11119 // Set specific parameters for sphere
11120 case ScriptBaseClass.PRIM_TYPE_SPHERE:
11121 prim.PrimData.PathScaleY = 1.0f;
11122 prim.PrimData.ProfileCurve = (ProfileCurve)5;
11123 prim.PrimData.PathCurve = (PathCurve)32;
11124 break;
11125 // Set specific parameters for torus
11126 case ScriptBaseClass.PRIM_TYPE_TORUS:
11127 prim.PrimData.PathScaleY = 0.5f;
11128 prim.PrimData.ProfileCurve = (ProfileCurve)0;
11129 prim.PrimData.PathCurve = (PathCurve)32;
11130 break;
11131 // Set specific parameters for tube
11132 case ScriptBaseClass.PRIM_TYPE_TUBE:
11133 prim.PrimData.PathScaleY = 0.5f;
11134 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11135 prim.PrimData.PathCurve = (PathCurve)32;
11136 break;
11137 // Set specific parameters for ring
11138 case ScriptBaseClass.PRIM_TYPE_RING:
11139 prim.PrimData.PathScaleY = 0.5f;
11140 prim.PrimData.ProfileCurve = (ProfileCurve)3;
11141 prim.PrimData.PathCurve = (PathCurve)32;
11142 break;
11143 // Set specific parameters for sculpt
11144 case ScriptBaseClass.PRIM_TYPE_SCULPT:
11145 prim.PrimData.PathScaleY = 1.0f;
11146 prim.PrimData.ProfileCurve = (ProfileCurve)5;
11147 prim.PrimData.PathCurve = (PathCurve)32;
11148 break;
11149 // Default to specific parameters for box
11150 default:
11151 prim.PrimData.PathScaleY = 1.0f;
11152 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11153 prim.PrimData.PathCurve = (PathCurve)16;
11154 break;
11155 }
11156
11157 return prim;
11158 } 10455 }
11159 10456
11160 /// <summary>
11161 /// Implementation of llGetGeometricCenter according to SL 2015-04-30.
11162 /// http://wiki.secondlife.com/wiki/LlGetGeometricCenter
11163 /// Returns the average position offset of all linked parts,
11164 /// including the root prim and seated avatars,
11165 /// relative to the root prim in local coordinates.
11166 /// </summary>
11167 public LSL_Vector llGetGeometricCenter() 10457 public LSL_Vector llGetGeometricCenter()
11168 { 10458 {
11169 // Subtract whatever position the root prim has to make it zero 10459 return new LSL_Vector(m_host.GetGeometricCenter());
11170 Vector3 offset = m_host.ParentGroup.RootPart.OffsetPosition * -1.0f;
11171
11172 // Add all prim/part position offsets
11173 foreach (SceneObjectPart part in m_host.ParentGroup.Parts)
11174 offset = offset + part.OffsetPosition;
11175 // Add all avatar/scene presence position offsets
11176 foreach (ScenePresence sp in m_host.ParentGroup.GetSittingAvatars())
11177 offset = offset + sp.OffsetPosition;
11178
11179 // Calculate and return the average offset
11180 offset = offset / (float)(m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount());
11181 return new LSL_Vector(offset);
11182 } 10460 }
11183 10461
11184 public LSL_List llGetPrimitiveParams(LSL_List rules) 10462 public LSL_List llGetPrimitiveParams(LSL_List rules)
11185 { 10463 {
11186<<<<<<< HEAD
11187 LSL_List result = new LSL_List();
11188 LSL_List remaining;
11189
11190 while (true)
11191 {
11192// m_log.DebugFormat(
11193// "[LSL API]: GetEntityParams has {0} rules with scene entity named {1}",
11194// rules.Length, entity != null ? entity.Name : "NULL");
11195
11196 if (entity == null)
11197 return result;
11198=======
11199 m_host.AddScriptLPS(1); 10464 m_host.AddScriptLPS(1);
11200>>>>>>> avn/ubitvar
11201 10465
11202 LSL_List result = new LSL_List(); 10466 LSL_List result = new LSL_List();
11203 10467
@@ -11207,13 +10471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11207 { 10471 {
11208 int linknumber = remaining.GetLSLIntegerItem(0); 10472 int linknumber = remaining.GetLSLIntegerItem(0);
11209 rules = remaining.GetSublist(1, -1); 10473 rules = remaining.GetSublist(1, -1);
11210<<<<<<< HEAD
11211 entity = GetLinkEntity(m_host, linknumber);
11212 }
11213 }
11214=======
11215 List<SceneObjectPart> parts = GetLinkParts(linknumber); 10474 List<SceneObjectPart> parts = GetLinkParts(linknumber);
11216>>>>>>> avn/ubitvar
11217 10475
11218 foreach (SceneObjectPart part in parts) 10476 foreach (SceneObjectPart part in parts)
11219 remaining = GetPrimParams(part, rules, ref result); 10477 remaining = GetPrimParams(part, rules, ref result);
@@ -11226,185 +10484,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11226 { 10484 {
11227 m_host.AddScriptLPS(1); 10485 m_host.AddScriptLPS(1);
11228 10486
11229<<<<<<< HEAD
11230 return GetEntityParams(GetLinkEntity(m_host, linknumber), rules);
11231 }
11232=======
11233 // acording to SL wiki this must indicate a single link number or link_root or link_this. 10487 // acording to SL wiki this must indicate a single link number or link_root or link_this.
11234 // keep other options as before 10488 // keep other options as before
11235>>>>>>> avn/ubitvar
11236 10489
11237 List<SceneObjectPart> parts; 10490 List<SceneObjectPart> parts;
11238 List<ScenePresence> avatars; 10491 List<ScenePresence> avatars;
11239 10492
11240 LSL_List res = new LSL_List(); 10493 LSL_List res = new LSL_List();
11241 LSL_List remaining = null; 10494 LSL_List remaining = new LSL_List();
11242 10495
11243 while (rules.Length > 0) 10496 while (rules.Length > 0)
11244 { 10497 {
11245 parts = GetLinkParts(linknumber); 10498 parts = GetLinkParts(linknumber);
11246 avatars = GetLinkAvatars(linknumber); 10499 avatars = GetLinkAvatars(linknumber);
11247 10500
11248 remaining = null; 10501 remaining = new LSL_List();
11249 foreach (SceneObjectPart part in parts) 10502 foreach (SceneObjectPart part in parts)
11250 { 10503 {
11251<<<<<<< HEAD
11252 case (int)ScriptBaseClass.PRIM_MATERIAL:
11253 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH));
11254 break;
11255
11256 case (int)ScriptBaseClass.PRIM_PHYSICS:
11257 res.Add(ScriptBaseClass.FALSE);
11258 break;
11259
11260 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
11261 res.Add(ScriptBaseClass.FALSE);
11262 break;
11263
11264 case (int)ScriptBaseClass.PRIM_PHANTOM:
11265 res.Add(ScriptBaseClass.FALSE);
11266 break;
11267
11268 case (int)ScriptBaseClass.PRIM_POSITION:
11269 res.Add(new LSL_Vector(sp.AbsolutePosition));
11270 break;
11271
11272 case (int)ScriptBaseClass.PRIM_SIZE:
11273 res.Add(GetAgentSize(sp));
11274 break;
11275
11276 case (int)ScriptBaseClass.PRIM_ROTATION:
11277 res.Add(sp.GetWorldRotation());
11278 break;
11279
11280 case (int)ScriptBaseClass.PRIM_TYPE:
11281 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
11282 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
11283 res.Add(new LSL_Vector(0, 1, 0));
11284 res.Add(new LSL_Float(0));
11285 res.Add(new LSL_Vector(0, 0, 0));
11286 res.Add(new LSL_Vector(1, 1, 0));
11287 res.Add(new LSL_Vector(0, 0, 0));
11288 break;
11289
11290 case (int)ScriptBaseClass.PRIM_TEXTURE:
11291 if (remain < 1)
11292 return new LSL_List();
11293
11294 int face = (int)rules.GetLSLIntegerItem(idx++);
11295 if (face > 21)
11296 break;
11297
11298 res.Add(new LSL_String(""));
11299 res.Add(ScriptBaseClass.ZERO_VECTOR);
11300 res.Add(ScriptBaseClass.ZERO_VECTOR);
11301 res.Add(new LSL_Float(0));
11302 break;
11303
11304 case (int)ScriptBaseClass.PRIM_COLOR:
11305 if (remain < 1)
11306 return new LSL_List();
11307
11308 face = (int)rules.GetLSLIntegerItem(idx++);
11309 if (face > 21)
11310 break;
11311
11312 res.Add(ScriptBaseClass.ZERO_VECTOR);
11313 res.Add(new LSL_Float(0));
11314 break;
11315
11316 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
11317 if (remain < 1)
11318 return new LSL_List();
11319
11320 face = (int)rules.GetLSLIntegerItem(idx++);
11321 if (face > 21)
11322 break;
11323
11324 res.Add(ScriptBaseClass.PRIM_SHINY_NONE);
11325 res.Add(ScriptBaseClass.PRIM_BUMP_NONE);
11326 break;
11327
11328 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
11329 if (remain < 1)
11330 return new LSL_List();
11331
11332 face = (int)rules.GetLSLIntegerItem(idx++);
11333 if (face > 21)
11334 break;
11335
11336 res.Add(ScriptBaseClass.FALSE);
11337 break;
11338
11339 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
11340 res.Add(ScriptBaseClass.FALSE);
11341 res.Add(new LSL_Integer(0));
11342 res.Add(new LSL_Float(0));
11343 res.Add(new LSL_Float(0));
11344 res.Add(new LSL_Float(0));
11345 res.Add(new LSL_Float(0));
11346 res.Add(ScriptBaseClass.ZERO_VECTOR);
11347 break;
11348
11349 case (int)ScriptBaseClass.PRIM_TEXGEN:
11350 if (remain < 1)
11351 return new LSL_List();
11352
11353 face = (int)rules.GetLSLIntegerItem(idx++);
11354 if (face > 21)
11355 break;
11356
11357 res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT);
11358 break;
11359
11360 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
11361 res.Add(ScriptBaseClass.FALSE);
11362 res.Add(ScriptBaseClass.ZERO_VECTOR);
11363 res.Add(ScriptBaseClass.ZERO_VECTOR);
11364 break;
11365
11366 case (int)ScriptBaseClass.PRIM_GLOW:
11367 if (remain < 1)
11368 return new LSL_List();
11369
11370 face = (int)rules.GetLSLIntegerItem(idx++);
11371 if (face > 21)
11372 break;
11373
11374 res.Add(new LSL_Float(0));
11375 break;
11376
11377 case (int)ScriptBaseClass.PRIM_TEXT:
11378 res.Add(new LSL_String(""));
11379 res.Add(ScriptBaseClass.ZERO_VECTOR);
11380 res.Add(new LSL_Float(1));
11381 break;
11382
11383 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
11384 res.Add(new LSL_Rotation(sp.Rotation));
11385 break;
11386
11387 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
11388 res.Add(new LSL_Vector(sp.OffsetPosition));
11389 break;
11390
11391 case (int)ScriptBaseClass.PRIM_SLICE:
11392 res.Add(new LSL_Vector(0, 1, 0));
11393 break;
11394
11395 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
11396 if(remain < 3)
11397 return new LSL_List();
11398=======
11399 remaining = GetPrimParams(part, rules, ref res); 10504 remaining = GetPrimParams(part, rules, ref res);
11400 } 10505 }
11401 foreach (ScenePresence avatar in avatars) 10506 foreach (ScenePresence avatar in avatars)
11402 { 10507 {
11403 remaining = GetPrimParams(avatar, rules, ref res); 10508 remaining = GetPrimParams(avatar, rules, ref res);
11404 } 10509 }
11405>>>>>>> avn/ubitvar
11406 10510
11407 if ((object)remaining != null && remaining.Length > 0) 10511 if (remaining.Length > 0)
11408 { 10512 {
11409 linknumber = remaining.GetLSLIntegerItem(0); 10513 linknumber = remaining.GetLSLIntegerItem(0);
11410 rules = remaining.GetSublist(1, -1); 10514 rules = remaining.GetSublist(1, -1);
@@ -11413,16 +10517,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11413 break; 10517 break;
11414 } 10518 }
11415 10519
11416<<<<<<< HEAD
11417 return new LSL_List();
11418=======
11419 return res; 10520 return res;
11420>>>>>>> avn/ubitvar
11421 } 10521 }
11422 10522
11423 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) 10523 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
11424 { 10524 {
11425 int idx=0; 10525 int idx = 0;
11426 while (idx < rules.Length) 10526 while (idx < rules.Length)
11427 { 10527 {
11428 int code = (int)rules.GetLSLIntegerItem(idx++); 10528 int code = (int)rules.GetLSLIntegerItem(idx++);
@@ -11470,10 +10570,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11470 res.Add(GetPartRot(part)); 10570 res.Add(GetPartRot(part));
11471 break; 10571 break;
11472 10572
11473 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
11474 res.Add(new LSL_Integer((int)part.PhysicsShapeType));
11475 break;
11476
11477 case (int)ScriptBaseClass.PRIM_TYPE: 10573 case (int)ScriptBaseClass.PRIM_TYPE:
11478 // implementing box 10574 // implementing box
11479 PrimitiveBaseShape Shape = part.Shape; 10575 PrimitiveBaseShape Shape = part.Shape;
@@ -11567,7 +10663,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11567 Primitive.TextureEntry tex = part.Shape.Textures; 10663 Primitive.TextureEntry tex = part.Shape.Textures;
11568 if (face == ScriptBaseClass.ALL_SIDES) 10664 if (face == ScriptBaseClass.ALL_SIDES)
11569 { 10665 {
11570 for (face = 0 ; face < GetNumberOfSides(part); face++) 10666 for (face = 0; face < GetNumberOfSides(part); face++)
11571 { 10667 {
11572 Primitive.TextureEntryFace texface = tex.GetFace((uint)face); 10668 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
11573 10669
@@ -11603,13 +10699,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11603 if (remain < 1) 10699 if (remain < 1)
11604 return new LSL_List(); 10700 return new LSL_List();
11605 10701
11606 face=(int)rules.GetLSLIntegerItem(idx++); 10702 face = (int)rules.GetLSLIntegerItem(idx++);
11607 10703
11608 tex = part.Shape.Textures; 10704 tex = part.Shape.Textures;
11609 Color4 texcolor; 10705 Color4 texcolor;
11610 if (face == ScriptBaseClass.ALL_SIDES) 10706 if (face == ScriptBaseClass.ALL_SIDES)
11611 { 10707 {
11612 for (face = 0 ; face < GetNumberOfSides(part); face++) 10708 for (face = 0; face < GetNumberOfSides(part); face++)
11613 { 10709 {
11614 texcolor = tex.GetFace((uint)face).RGBA; 10710 texcolor = tex.GetFace((uint)face).RGBA;
11615 res.Add(new LSL_Vector(texcolor.R, 10711 res.Add(new LSL_Vector(texcolor.R,
@@ -11666,7 +10762,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11666 Shininess shinyness = tex.GetFace((uint)face).Shiny; 10762 Shininess shinyness = tex.GetFace((uint)face).Shiny;
11667 if (shinyness == Shininess.High) 10763 if (shinyness == Shininess.High)
11668 { 10764 {
11669 shiny = ScriptBaseClass.PRIM_SHINY_HIGH; 10765 shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
11670 } 10766 }
11671 else if (shinyness == Shininess.Medium) 10767 else if (shinyness == Shininess.Medium)
11672 { 10768 {
@@ -11818,7 +10914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11818 res.Add(new LSL_Vector(textColor.R, 10914 res.Add(new LSL_Vector(textColor.R,
11819 textColor.G, 10915 textColor.G,
11820 textColor.B)); 10916 textColor.B));
11821 res.Add(new LSL_Float(1.0 - textColor.A)); 10917 res.Add(new LSL_Float(textColor.A));
11822 break; 10918 break;
11823 10919
11824 case (int)ScriptBaseClass.PRIM_NAME: 10920 case (int)ScriptBaseClass.PRIM_NAME:
@@ -11857,6 +10953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11857 return new LSL_List(); 10953 return new LSL_List();
11858 } 10954 }
11859 10955
10956
11860 public LSL_List llGetPrimMediaParams(int face, LSL_List rules) 10957 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
11861 { 10958 {
11862 m_host.AddScriptLPS(1); 10959 m_host.AddScriptLPS(1);
@@ -13316,16 +12413,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13316 12413
13317 if (quick_pay_buttons.Data.Length < 4) 12414 if (quick_pay_buttons.Data.Length < 4)
13318 { 12415 {
13319<<<<<<< HEAD
13320 Error("llSetPayPrice", "List must have at least 4 elements");
13321 return;
13322=======
13323 int x; 12416 int x;
13324 for (x=quick_pay_buttons.Data.Length; x<= 4; x++) 12417 for (x=quick_pay_buttons.Data.Length; x<= 4; x++)
13325 { 12418 {
13326 quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE); 12419 quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE);
13327 } 12420 }
13328>>>>>>> avn/ubitvar
13329 } 12421 }
13330 int[] nPrice = new int[5]; 12422 int[] nPrice = new int[5];
13331 nPrice[0] = price; 12423 nPrice[0] = price;
@@ -13447,12 +12539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13447 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, 12539 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
13448 simname, pos, lookAt); 12540 simname, pos, lookAt);
13449 } 12541 }
13450<<<<<<< HEAD
13451 ScriptSleep(m_sleepMsOnMapDestination); 12542 ScriptSleep(m_sleepMsOnMapDestination);
13452=======
13453
13454 ScriptSleep(1000);
13455>>>>>>> avn/ubitvar
13456 } 12543 }
13457 12544
13458 public void llAddToLandBanList(string avatar, double hours) 12545 public void llAddToLandBanList(string avatar, double hours)
@@ -13577,7 +12664,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13577 object[] data = rules.Data; 12664 object[] data = rules.Data;
13578 for (int i = 0; i < data.Length; ++i) 12665 for (int i = 0; i < data.Length; ++i)
13579 { 12666 {
13580<<<<<<< HEAD
13581 int type; 12667 int type;
13582 try 12668 try
13583 { 12669 {
@@ -13588,9 +12674,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13588 Error("llSetCameraParams", string.Format("Invalid camera param type {0}", data[i - 1])); 12674 Error("llSetCameraParams", string.Format("Invalid camera param type {0}", data[i - 1]));
13589 return; 12675 return;
13590 } 12676 }
13591=======
13592 int type = Convert.ToInt32(data[i++].ToString());
13593>>>>>>> avn/ubitvar
13594 if (i >= data.Length) break; // odd number of entries => ignore the last 12677 if (i >= data.Length) break; // odd number of entries => ignore the last
13595 12678
13596 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) 12679 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3)
@@ -14242,12 +13325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14242 ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W)); 13325 ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W));
14243 break; 13326 break;
14244 case ScriptBaseClass.OBJECT_VELOCITY: 13327 case ScriptBaseClass.OBJECT_VELOCITY:
14245<<<<<<< HEAD 13328 Vector3 avvel = av.GetWorldVelocity();
14246 ret.Add(new LSL_Vector(av.GetWorldVelocity()));
14247=======
14248 Vector3 avvel = av.Velocity;
14249 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); 13329 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
14250>>>>>>> avn/ubitvar
14251 break; 13330 break;
14252 case ScriptBaseClass.OBJECT_OWNER: 13331 case ScriptBaseClass.OBJECT_OWNER:
14253 ret.Add(new LSL_String(id)); 13332 ret.Add(new LSL_String(id));
@@ -14724,12 +13803,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14724 13803
14725 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) 13804 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
14726 { 13805 {
14727 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); 13806 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
13807
13808 LSL_List result = new LSL_List();
14728 13809
14729 if (obj != null && obj.OwnerID == m_host.OwnerID) 13810 if (obj != null && obj.OwnerID == m_host.OwnerID)
14730 return GetEntityParams(obj, rules); 13811 {
13812 LSL_List remaining = GetPrimParams(obj, rules, ref result);
14731 13813
14732 return new LSL_List(); 13814 while (remaining.Length > 2)
13815 {
13816 int linknumber = remaining.GetLSLIntegerItem(0);
13817 rules = remaining.GetSublist(1, -1);
13818 List<SceneObjectPart> parts = GetLinkParts(linknumber);
13819
13820 foreach (SceneObjectPart part in parts)
13821 remaining = GetPrimParams(part, rules, ref result);
13822 }
13823 }
13824
13825 return result;
14733 } 13826 }
14734 13827
14735 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) 13828 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
@@ -15303,6 +14396,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15303 } 14396 }
15304 14397
15305 /// <summary> 14398 /// <summary>
14399 /// Helper to calculate bounding box of an avatar.
14400 /// </summary>
14401 private void BoundingBoxOfScenePresence(ScenePresence sp, out Vector3 lower, out Vector3 upper)
14402 {
14403 // Adjust from OS model
14404 // avatar height = visual height - 0.2, bounding box height = visual height
14405 // to SL model
14406 // avatar height = visual height, bounding box height = visual height + 0.2
14407 float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection;
14408
14409 // According to avatar bounding box in SL 2015-04-18:
14410 // standing = <-0.275,-0.35,-0.1-0.5*h> : <0.275,0.35,0.1+0.5*h>
14411 // groundsitting = <-0.3875,-0.5,-0.05-0.375*h> : <0.3875,0.5,0.5>
14412 // sitting = <-0.5875,-0.35,-0.35-0.375*h> : <0.1875,0.35,-0.25+0.25*h>
14413
14414 // When avatar is sitting
14415 if (sp.ParentPart != null)
14416 {
14417 lower = new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height);
14418 upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height);
14419 }
14420 // When avatar is groundsitting
14421 else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
14422 {
14423 lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height);
14424 upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height);
14425 }
14426 // When avatar is standing or flying
14427 else
14428 {
14429 lower = new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height);
14430 upper = new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height);
14431 }
14432 }
14433
14434
14435 /// <summary>
15306 /// Implementation of llCastRay similar to SL 2015-04-21. 14436 /// Implementation of llCastRay similar to SL 2015-04-21.
15307 /// http://wiki.secondlife.com/wiki/LlCastRay 14437 /// http://wiki.secondlife.com/wiki/LlCastRay
15308 /// Uses pure geometry, bounding shapes, meshing and no physics 14438 /// Uses pure geometry, bounding shapes, meshing and no physics
@@ -16589,7 +15719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16589 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 15719 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
16590 { 15720 {
16591 if (remain < 1) 15721 if (remain < 1)
16592 return null; 15722 return new LSL_List();
16593 15723
16594 LSL_Vector v; 15724 LSL_Vector v;
16595 v = rules.GetVector3Item(idx++); 15725 v = rules.GetVector3Item(idx++);
@@ -16608,7 +15738,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16608 case (int)ScriptBaseClass.PRIM_ROTATION: 15738 case (int)ScriptBaseClass.PRIM_ROTATION:
16609 { 15739 {
16610 if (remain < 1) 15740 if (remain < 1)
16611 return null; 15741 return new LSL_List();
16612 15742
16613 LSL_Rotation r; 15743 LSL_Rotation r;
16614 r = rules.GetQuaternionItem(idx++); 15744 r = rules.GetQuaternionItem(idx++);
@@ -16628,7 +15758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16628 case (int)ScriptBaseClass.PRIM_NAME: 15758 case (int)ScriptBaseClass.PRIM_NAME:
16629 case (int)ScriptBaseClass.PRIM_DESC: 15759 case (int)ScriptBaseClass.PRIM_DESC:
16630 if (remain < 1) 15760 if (remain < 1)
16631 return null; 15761 return new LSL_List();
16632 idx++; 15762 idx++;
16633 break; 15763 break;
16634 15764
@@ -16636,13 +15766,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16636 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 15766 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
16637 case (int)ScriptBaseClass.PRIM_TEXGEN: 15767 case (int)ScriptBaseClass.PRIM_TEXGEN:
16638 if (remain < 2) 15768 if (remain < 2)
16639 return null; 15769 return new LSL_List();
16640 idx += 2; 15770 idx += 2;
16641 break; 15771 break;
16642 15772
16643 case (int)ScriptBaseClass.PRIM_TYPE: 15773 case (int)ScriptBaseClass.PRIM_TYPE:
16644 if (remain < 3) 15774 if (remain < 3)
16645 return null; 15775 return new LSL_List();
16646 code = (int)rules.GetLSLIntegerItem(idx++); 15776 code = (int)rules.GetLSLIntegerItem(idx++);
16647 remain = rules.Length - idx; 15777 remain = rules.Length - idx;
16648 switch (code) 15778 switch (code)
@@ -16651,13 +15781,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16651 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 15781 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
16652 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 15782 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
16653 if (remain < 6) 15783 if (remain < 6)
16654 return null; 15784 return new LSL_List();
16655 idx += 6; 15785 idx += 6;
16656 break; 15786 break;
16657 15787
16658 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 15788 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
16659 if (remain < 5) 15789 if (remain < 5)
16660 return null; 15790 return new LSL_List();
16661 idx += 5; 15791 idx += 5;
16662 break; 15792 break;
16663 15793
@@ -16665,13 +15795,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16665 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 15795 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
16666 case (int)ScriptBaseClass.PRIM_TYPE_RING: 15796 case (int)ScriptBaseClass.PRIM_TYPE_RING:
16667 if (remain < 11) 15797 if (remain < 11)
16668 return null; 15798 return new LSL_List();
16669 idx += 11; 15799 idx += 11;
16670 break; 15800 break;
16671 15801
16672 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 15802 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
16673 if (remain < 2) 15803 if (remain < 2)
16674 return null; 15804 return new LSL_List();
16675 idx += 2; 15805 idx += 2;
16676 break; 15806 break;
16677 } 15807 }
@@ -16682,7 +15812,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16682 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 15812 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
16683 case (int)ScriptBaseClass.PRIM_OMEGA: 15813 case (int)ScriptBaseClass.PRIM_OMEGA:
16684 if (remain < 3) 15814 if (remain < 3)
16685 return null; 15815 return new LSL_List();
16686 idx += 3; 15816 idx += 3;
16687 break; 15817 break;
16688 15818
@@ -16690,20 +15820,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16690 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 15820 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
16691 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: 15821 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
16692 if (remain < 5) 15822 if (remain < 5)
16693 return null; 15823 return new LSL_List();
16694 idx += 5; 15824 idx += 5;
16695 break; 15825 break;
16696 15826
16697 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 15827 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
16698 if (remain < 7) 15828 if (remain < 7)
16699 return null; 15829 return new LSL_List();
16700 15830
16701 idx += 7; 15831 idx += 7;
16702 break; 15832 break;
16703 15833
16704 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 15834 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
16705 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 15835 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
16706 return null; 15836 return new LSL_List();
16707 15837
16708 return rules.GetSublist(idx, -1); 15838 return rules.GetSublist(idx, -1);
16709 } 15839 }
@@ -16711,9 +15841,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16711 } 15841 }
16712 catch (InvalidCastException e) 15842 catch (InvalidCastException e)
16713 { 15843 {
16714 ShoutError(string.Format( 15844 Error(originFunc,string.Format(
16715 "{0} error running rule #{1}: arg #{2} ", 15845 " error running rule #{1}: arg #{2} ",
16716 originFunc, rulesParsed, idx - idxStart) + e.Message); 15846 rulesParsed, idx - idxStart) + e.Message);
16717 } 15847 }
16718 finally 15848 finally
16719 { 15849 {
@@ -16725,7 +15855,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16725 positionChanged = false; 15855 positionChanged = false;
16726 } 15856 }
16727 } 15857 }
16728 return null; 15858 return new LSL_List();
16729 } 15859 }
16730 15860
16731 public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) 15861 public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res)
@@ -16794,7 +15924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16794 15924
16795 case (int)ScriptBaseClass.PRIM_TEXTURE: 15925 case (int)ScriptBaseClass.PRIM_TEXTURE:
16796 if (remain < 1) 15926 if (remain < 1)
16797 return null; 15927 return new LSL_List();
16798 15928
16799 int face = (int)rules.GetLSLIntegerItem(idx++); 15929 int face = (int)rules.GetLSLIntegerItem(idx++);
16800 if (face == ScriptBaseClass.ALL_SIDES) 15930 if (face == ScriptBaseClass.ALL_SIDES)
@@ -16821,7 +15951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16821 15951
16822 case (int)ScriptBaseClass.PRIM_COLOR: 15952 case (int)ScriptBaseClass.PRIM_COLOR:
16823 if (remain < 1) 15953 if (remain < 1)
16824 return null; 15954 return new LSL_List();
16825 15955
16826 face = (int)rules.GetLSLIntegerItem(idx++); 15956 face = (int)rules.GetLSLIntegerItem(idx++);
16827 15957
@@ -16842,7 +15972,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16842 15972
16843 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 15973 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
16844 if (remain < 1) 15974 if (remain < 1)
16845 return null; 15975 return new LSL_List();
16846 face = (int)rules.GetLSLIntegerItem(idx++); 15976 face = (int)rules.GetLSLIntegerItem(idx++);
16847 15977
16848 if (face == ScriptBaseClass.ALL_SIDES) 15978 if (face == ScriptBaseClass.ALL_SIDES)
@@ -16862,7 +15992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16862 15992
16863 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 15993 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
16864 if (remain < 1) 15994 if (remain < 1)
16865 return null; 15995 return new LSL_List();
16866 face = (int)rules.GetLSLIntegerItem(idx++); 15996 face = (int)rules.GetLSLIntegerItem(idx++);
16867 15997
16868 if (face == ScriptBaseClass.ALL_SIDES) 15998 if (face == ScriptBaseClass.ALL_SIDES)
@@ -16891,7 +16021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16891 case (int)ScriptBaseClass.PRIM_TEXGEN: 16021 case (int)ScriptBaseClass.PRIM_TEXGEN:
16892 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) 16022 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
16893 if (remain < 1) 16023 if (remain < 1)
16894 return null; 16024 return new LSL_List();
16895 face = (int)rules.GetLSLIntegerItem(idx++); 16025 face = (int)rules.GetLSLIntegerItem(idx++);
16896 16026
16897 if (face == ScriptBaseClass.ALL_SIDES) 16027 if (face == ScriptBaseClass.ALL_SIDES)
@@ -16917,7 +16047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16917 16047
16918 case (int)ScriptBaseClass.PRIM_GLOW: 16048 case (int)ScriptBaseClass.PRIM_GLOW:
16919 if (remain < 1) 16049 if (remain < 1)
16920 return null; 16050 return new LSL_List();
16921 face = (int)rules.GetLSLIntegerItem(idx++); 16051 face = (int)rules.GetLSLIntegerItem(idx++);
16922 16052
16923 if (face == ScriptBaseClass.ALL_SIDES) 16053 if (face == ScriptBaseClass.ALL_SIDES)
@@ -16971,13 +16101,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
16971 16101
16972 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 16102 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
16973 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 16103 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
16974 return null; 16104 return new LSL_List();
16975 16105
16976 return rules.GetSublist(idx, -1); 16106 return rules.GetSublist(idx, -1);
16977 } 16107 }
16978 } 16108 }
16979 16109
16980 return null; 16110 return new LSL_List();
16981 } 16111 }
16982 16112
16983 public void llSetContentType(LSL_Key id, LSL_Integer content_type) 16113 public void llSetContentType(LSL_Key id, LSL_Integer content_type)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5d8f0f6..a87ee73 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -829,10 +829,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
829 private void TeleportAgent(string agent, int regionX, int regionY, 829 private void TeleportAgent(string agent, int regionX, int regionY,
830 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) 830 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
831 { 831 {
832<<<<<<< HEAD
833 // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
834=======
835>>>>>>> avn/ubitvar
836 ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); 832 ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY);
837 833
838 m_host.AddScriptLPS(1); 834 m_host.AddScriptLPS(1);
@@ -3265,15 +3261,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3265 } 3261 }
3266 else 3262 else
3267 { 3263 {
3268<<<<<<< HEAD
3269 Scene scene = m_ScriptEngine.World; 3264 Scene scene = m_ScriptEngine.World;
3270 GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); 3265 GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
3271 return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeX, Constants.RegionHeight); 3266 return new LSL_Vector(region.RegionSizeX, region.RegionSizeY, Constants.RegionHeight);
3272=======
3273 return new LSL_Vector((float)World.RegionInfo.RegionSizeX,
3274 (float)World.RegionInfo.RegionSizeY,
3275 (float)World.RegionInfo.RegionSizeZ );
3276>>>>>>> avn/ubitvar
3277 } 3267 }
3278 } 3268 }
3279 3269
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 5fdbf9d..6e8a96d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -739,11 +739,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
739 if (Position.y > ((int)Constants.RegionSize - 1)) 739 if (Position.y > ((int)Constants.RegionSize - 1))
740 Position.y = ((int)Constants.RegionSize - 1); 740 Position.y = ((int)Constants.RegionSize - 1);
741 */ 741 */
742<<<<<<< HEAD
743 if (Position.z > Constants.RegionHeight) 742 if (Position.z > Constants.RegionHeight)
744 Position.z = Constants.RegionHeight; 743 Position.z = Constants.RegionHeight;
745=======
746>>>>>>> avn/ubitvar
747 if (Position.x < 0) 744 if (Position.x < 0)
748 Position.x = 0; 745 Position.x = 0;
749 if (Position.y < 0) 746 if (Position.y < 0)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 49df5e7..2633f30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -654,7 +654,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
654 if (state == State) 654 if (state == State)
655 return; 655 return;
656 656
657<<<<<<< HEAD
658 EventParams lastTimerEv = null; 657 EventParams lastTimerEv = null;
659 658
660 lock (EventQueue) 659 lock (EventQueue)
@@ -682,15 +681,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
682 m_StateChangeInProgress = true; 681 m_StateChangeInProgress = true;
683 } 682 }
684 683
685=======
686 PostEvent(new EventParams("state_exit", new Object[0],
687 new DetectParams[0]));
688 PostEvent(new EventParams("state", new Object[] { state },
689 new DetectParams[0]));
690 PostEvent(new EventParams("state_entry", new Object[0],
691 new DetectParams[0]));
692
693>>>>>>> avn/ubitvar
694 throw new EventAbortException(); 684 throw new EventAbortException();
695 } 685 }
696 686
@@ -789,9 +779,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
789 if (!Running) 779 if (!Running)
790 return 0; 780 return 0;
791 781
782 lock (m_Script)
783 {
792// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); 784// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
793 785
794<<<<<<< HEAD
795 if (Suspended) 786 if (Suspended)
796 return 0; 787 return 0;
797 788
@@ -817,14 +808,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
817 lock (EventQueue) 808 lock (EventQueue)
818 { 809 {
819 data = (EventParams)EventQueue.Dequeue(); 810 data = (EventParams)EventQueue.Dequeue();
820=======
821 if (Suspended)
822 return 0;
823
824 lock (EventQueue)
825 {
826 data = (EventParams) EventQueue.Dequeue();
827>>>>>>> avn/ubitvar
828 if (data == null) // Shouldn't happen 811 if (data == null) // Shouldn't happen
829 { 812 {
830 if (EventQueue.Count > 0 && Running && !ShuttingDown) 813 if (EventQueue.Count > 0 && Running && !ShuttingDown)
@@ -849,7 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
849 m_CollisionInQueue = false; 832 m_CollisionInQueue = false;
850 } 833 }
851 834
852<<<<<<< HEAD
853 if (DebugLevel >= 2) 835 if (DebugLevel >= 2)
854 m_log.DebugFormat( 836 m_log.DebugFormat(
855 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", 837 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
@@ -879,26 +861,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
879 Part.ParentGroup.UUID, 861 Part.ParentGroup.UUID,
880 Part.AbsolutePosition, 862 Part.AbsolutePosition,
881 Part.ParentGroup.Scene.Name); 863 Part.ParentGroup.Scene.Name);
882=======
883 lock(m_Script)
884 {
885
886// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this);
887 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
888
889 if (DebugLevel >= 2)
890 m_log.DebugFormat(
891 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
892 data.EventName,
893 ScriptName,
894 part.Name,
895 part.LocalId,
896 part.ParentGroup.Name,
897 part.ParentGroup.UUID,
898 part.AbsolutePosition,
899 part.ParentGroup.Scene.Name);
900>>>>>>> avn/ubitvar
901
902 AsyncCommandManager.StateChange(Engine, 864 AsyncCommandManager.StateChange(Engine,
903 LocalID, ItemID); 865 LocalID, ItemID);
904 // we are effectively in the new state now, so we can resume queueing 866 // we are effectively in the new state now, so we can resume queueing
@@ -915,35 +877,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
915 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 877 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
916 // PrimName, ScriptName, data.EventName, State); 878 // PrimName, ScriptName, data.EventName, State);
917 879
918<<<<<<< HEAD 880
919 try 881 try
920=======
921 if (DebugLevel >= 1)
922 m_log.DebugFormat(
923 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
924 State,
925 ScriptName,
926 part.Name,
927 part.LocalId,
928 part.ParentGroup.Name,
929 part.ParentGroup.UUID,
930 part.AbsolutePosition,
931 part.ParentGroup.Scene.Name);
932
933 AsyncCommandManager.RemoveScript(Engine,
934 LocalID, ItemID);
935
936 if (part != null)
937 {
938 part.SetScriptEvents(ItemID,
939 (int)m_Script.GetStateEventFlags(State));
940 }
941 }
942 else
943 {
944 if (Engine.World.PipeEventsForScript(LocalID) ||
945 data.EventName == "control") // Don't freeze avies!
946>>>>>>> avn/ubitvar
947 { 882 {
948 m_CurrentEvent = data.EventName; 883 m_CurrentEvent = data.EventName;
949 m_EventStart = DateTime.Now; 884 m_EventStart = DateTime.Now;
@@ -981,7 +916,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
981 && !(e.InnerException is ScriptCoopStopException))) 916 && !(e.InnerException is ScriptCoopStopException)))
982 && !(e is ThreadAbortException)) 917 && !(e is ThreadAbortException))
983 { 918 {
984<<<<<<< HEAD
985 try 919 try
986 { 920 {
987 // DISPLAY ERROR INWORLD 921 // DISPLAY ERROR INWORLD
@@ -1004,88 +938,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1004 Part.AbsolutePosition, 938 Part.AbsolutePosition,
1005 Part.ParentGroup.Scene.Name), 939 Part.ParentGroup.Scene.Name),
1006 e); 940 e);
1007=======
1008// m_log.DebugFormat(
1009// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
1010// ScriptName, ItemID, e.Message, e.StackTrace);
1011
1012 m_InEvent = false;
1013 m_CurrentEvent = String.Empty;
1014
1015 if ((!(e is TargetInvocationException)
1016 || (!(e.InnerException is SelfDeleteException)
1017 && !(e.InnerException is ScriptDeleteException)
1018 && !(e.InnerException is ScriptCoopStopException)))
1019 && !(e is ThreadAbortException))
1020 {
1021 try
1022 {
1023 // DISPLAY ERROR INWORLD
1024 string text = FormatException(e);
1025
1026 if (text.Length > 1000)
1027 text = text.Substring(0, 1000);
1028 Engine.World.SimChat(Utils.StringToBytes(text),
1029 ChatTypeEnum.DebugChannel, 2147483647,
1030 part.AbsolutePosition,
1031 part.Name, part.UUID, false);
1032
1033
1034 m_log.DebugFormat(
1035 "[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}",
1036 ScriptName,
1037 PrimName,
1038 part.UUID,
1039 part.AbsolutePosition,
1040 part.ParentGroup.Scene.Name,
1041 text.Replace("\n", "\\n"),
1042 e.InnerException);
1043 }
1044 catch (Exception)
1045 {
1046 }
1047 // catch (Exception e2) // LEGIT: User Scripting
1048 // {
1049 // m_log.Error("[SCRIPT]: "+
1050 // "Error displaying error in-world: " +
1051 // e2.ToString());
1052 // m_log.Error("[SCRIPT]: " +
1053 // "Errormessage: Error compiling script:\r\n" +
1054 // e.ToString());
1055 // }
1056 }
1057 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
1058 {
1059 m_InSelfDelete = true;
1060 if (part != null)
1061 Engine.World.DeleteSceneObject(part.ParentGroup, false);
1062>>>>>>> avn/ubitvar
1063 } 941 }
1064 catch (Exception) 942 catch (Exception)
1065 { 943 {
1066<<<<<<< HEAD
1067=======
1068 m_InSelfDelete = true;
1069 if (part != null)
1070 part.Inventory.RemoveInventoryItem(ItemID);
1071 }
1072 else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
1073 {
1074 if (DebugLevel >= 1)
1075 m_log.DebugFormat(
1076 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
1077 PrimName, ScriptName, data.EventName, State);
1078>>>>>>> avn/ubitvar
1079 } 944 }
1080 // catch (Exception e2) // LEGIT: User Scripting
1081 // {
1082 // m_log.Error("[SCRIPT]: "+
1083 // "Error displaying error in-world: " +
1084 // e2.ToString());
1085 // m_log.Error("[SCRIPT]: " +
1086 // "Errormessage: Error compiling script:\r\n" +
1087 // e.ToString());
1088 // }
1089 } 945 }
1090 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) 946 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
1091 { 947 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 885559a..5fce15c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -102,31 +102,19 @@ namespace OpenSim.Region.ScriptEngine.Shared
102 102
103 public override string ToString() 103 public override string ToString()
104 { 104 {
105<<<<<<< HEAD
106 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
107=======
108 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); 105 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z);
109>>>>>>> avn/ubitvar
110 return s; 106 return s;
111 } 107 }
112 108
113 public static explicit operator LSLString(Vector3 vec) 109 public static explicit operator LSLString(Vector3 vec)
114 { 110 {
115<<<<<<< HEAD
116 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
117=======
118 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); 111 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
119>>>>>>> avn/ubitvar
120 return new LSLString(s); 112 return new LSLString(s);
121 } 113 }
122 114
123 public static explicit operator string(Vector3 vec) 115 public static explicit operator string(Vector3 vec)
124 { 116 {
125<<<<<<< HEAD
126 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
127=======
128 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); 117 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
129>>>>>>> avn/ubitvar
130 return s; 118 return s;
131 } 119 }
132 120
@@ -727,17 +715,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
727 private void ExtendAndAdd(object o) 715 private void ExtendAndAdd(object o)
728 { 716 {
729 object[] tmp; 717 object[] tmp;
730<<<<<<< HEAD
731 tmp = new object[Data.Length + 1]; 718 tmp = new object[Data.Length + 1];
732 Data.CopyTo(tmp, 0); 719 Data.CopyTo(tmp, 0);
733 tmp.SetValue(o, tmp.Length - 1); 720 tmp.SetValue(o, tmp.Length - 1);
734 Data = tmp; 721 Data = tmp;
735=======
736 tmp = new object[m_data.Length + 1];
737 m_data.CopyTo(tmp, 0);
738 tmp.SetValue(o, tmp.Length - 1);
739 m_data = tmp;
740>>>>>>> avn/ubitvar
741 } 722 }
742 723
743 public static list operator +(list a, LSLString s) 724 public static list operator +(list a, LSLString s)