diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
10 files changed, 500 insertions, 422 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs index 47ed6ba..684138f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs | |||
@@ -29,42 +29,43 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | ||
32 | using OpenSim.Region.ScriptEngine.Interfaces; | 33 | using OpenSim.Region.ScriptEngine.Interfaces; |
33 | 34 | ||
34 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 35 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
35 | { | 36 | { |
36 | public class ApiManager | 37 | public class ApiManager |
37 | { | 38 | { |
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
38 | private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>(); | 41 | private Dictionary<string,Type> m_Apis = new Dictionary<string,Type>(); |
39 | 42 | ||
40 | public string[] GetApis() | 43 | public string[] GetApis() |
41 | { | 44 | { |
42 | if (m_Apis.Count > 0) | 45 | if (m_Apis.Count <= 0) |
43 | { | 46 | { |
44 | List<string> l = new List<string>(m_Apis.Keys); | 47 | Assembly a = Assembly.GetExecutingAssembly(); |
45 | return l.ToArray(); | ||
46 | } | ||
47 | 48 | ||
48 | Assembly a = Assembly.GetExecutingAssembly(); | 49 | Type[] types = a.GetExportedTypes(); |
49 | 50 | ||
50 | Type[] types = a.GetExportedTypes(); | 51 | foreach (Type t in types) |
51 | |||
52 | foreach (Type t in types) | ||
53 | { | ||
54 | string name = t.ToString(); | ||
55 | int idx = name.LastIndexOf('.'); | ||
56 | if (idx != -1) | ||
57 | name = name.Substring(idx+1); | ||
58 | |||
59 | if (name.EndsWith("_Api")) | ||
60 | { | 52 | { |
61 | name = name.Substring(0, name.Length - 4); | 53 | string name = t.ToString(); |
62 | m_Apis[name] = t; | 54 | int idx = name.LastIndexOf('.'); |
55 | if (idx != -1) | ||
56 | name = name.Substring(idx+1); | ||
57 | |||
58 | if (name.EndsWith("_Api")) | ||
59 | { | ||
60 | name = name.Substring(0, name.Length - 4); | ||
61 | m_Apis[name] = t; | ||
62 | } | ||
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | List<string> ret = new List<string>(m_Apis.Keys); | 66 | // m_log.DebugFormat("[API MANAGER]: Found {0} apis", m_Apis.Keys.Count); |
67 | return ret.ToArray(); | 67 | |
68 | return new List<string>(m_Apis.Keys).ToArray(); | ||
68 | } | 69 | } |
69 | 70 | ||
70 | public IScriptApi CreateApi(string api) | 71 | public IScriptApi CreateApi(string api) |
@@ -76,4 +77,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
76 | return ret; | 77 | return ret; |
77 | } | 78 | } |
78 | } | 79 | } |
79 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0c28bf5..9208034 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -89,7 +89,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
89 | protected IScriptEngine m_ScriptEngine; | 89 | protected IScriptEngine m_ScriptEngine; |
90 | protected SceneObjectPart m_host; | 90 | protected SceneObjectPart m_host; |
91 | protected uint m_localID; | 91 | protected uint m_localID; |
92 | |||
93 | /// <summary> | ||
94 | /// The UUID of the item that hosts this script | ||
95 | /// </summary> | ||
92 | protected UUID m_itemID; | 96 | protected UUID m_itemID; |
97 | |||
93 | protected bool throwErrorOnNotImplemented = true; | 98 | protected bool throwErrorOnNotImplemented = true; |
94 | protected AsyncCommandManager AsyncCommands = null; | 99 | protected AsyncCommandManager AsyncCommands = null; |
95 | protected float m_ScriptDelayFactor = 1.0f; | 100 | protected float m_ScriptDelayFactor = 1.0f; |
@@ -336,28 +341,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
336 | } | 341 | } |
337 | } | 342 | } |
338 | 343 | ||
339 | protected UUID InventorySelf() | 344 | /// <summary> |
345 | /// Get the inventory item that hosts ourselves. | ||
346 | /// </summary> | ||
347 | /// <remarks> | ||
348 | /// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need | ||
349 | /// to keep looking ourselves up. | ||
350 | /// </remarks> | ||
351 | /// <returns></returns> | ||
352 | protected TaskInventoryItem GetSelfInventoryItem() | ||
340 | { | 353 | { |
341 | UUID invItemID = new UUID(); | 354 | TaskInventoryItem invItem = null; |
355 | |||
342 | bool unlock = false; | 356 | bool unlock = false; |
343 | if (!m_host.TaskInventory.IsReadLockedByMe()) | 357 | if (!m_host.TaskInventory.IsReadLockedByMe()) |
344 | { | 358 | { |
345 | m_host.TaskInventory.LockItemsForRead(true); | 359 | m_host.TaskInventory.LockItemsForRead(true); |
346 | unlock = true; | 360 | unlock = true; |
347 | } | 361 | } |
348 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 362 | |
349 | { | 363 | invItem = m_host.TaskInventory[m_itemID]; |
350 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | 364 | |
351 | { | ||
352 | invItemID = inv.Key; | ||
353 | break; | ||
354 | } | ||
355 | } | ||
356 | if (unlock) | 365 | if (unlock) |
357 | { | 366 | { |
358 | m_host.TaskInventory.LockItemsForRead(false); | 367 | m_host.TaskInventory.LockItemsForRead(false); |
359 | } | 368 | } |
360 | return invItemID; | 369 | |
370 | return invItem; | ||
361 | } | 371 | } |
362 | 372 | ||
363 | protected UUID InventoryKey(string name, int type) | 373 | protected UUID InventoryKey(string name, int type) |
@@ -941,20 +951,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
941 | 951 | ||
942 | public void llRegionSayTo(string target, int channel, string msg) | 952 | public void llRegionSayTo(string target, int channel, string msg) |
943 | { | 953 | { |
944 | string error = String.Empty; | ||
945 | |||
946 | if (msg.Length > 1023) | 954 | if (msg.Length > 1023) |
947 | msg = msg.Substring(0, 1023); | 955 | msg = msg.Substring(0, 1023); |
948 | 956 | ||
949 | m_host.AddScriptLPS(1); | 957 | m_host.AddScriptLPS(1); |
950 | 958 | ||
959 | if (channel == ScriptBaseClass.DEBUG_CHANNEL) | ||
960 | { | ||
961 | return; | ||
962 | } | ||
963 | |||
951 | UUID TargetID; | 964 | UUID TargetID; |
952 | UUID.TryParse(target, out TargetID); | 965 | UUID.TryParse(target, out TargetID); |
953 | 966 | ||
954 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 967 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
955 | if (wComm != null) | 968 | if (wComm != null) |
956 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) | 969 | wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); |
957 | LSLError(error); | ||
958 | } | 970 | } |
959 | 971 | ||
960 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 972 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |
@@ -1910,6 +1922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1910 | rgb.y = texcolor.G; | 1922 | rgb.y = texcolor.G; |
1911 | rgb.z = texcolor.B; | 1923 | rgb.z = texcolor.B; |
1912 | return rgb; | 1924 | return rgb; |
1925 | |||
1913 | } | 1926 | } |
1914 | else | 1927 | else |
1915 | { | 1928 | { |
@@ -2948,15 +2961,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2948 | 2961 | ||
2949 | public LSL_Integer llGiveMoney(string destination, int amount) | 2962 | public LSL_Integer llGiveMoney(string destination, int amount) |
2950 | { | 2963 | { |
2951 | UUID invItemID=InventorySelf(); | ||
2952 | if (invItemID == UUID.Zero) | ||
2953 | return 0; | ||
2954 | |||
2955 | m_host.AddScriptLPS(1); | 2964 | m_host.AddScriptLPS(1); |
2956 | 2965 | ||
2957 | m_host.TaskInventory.LockItemsForRead(true); | 2966 | TaskInventoryItem item = GetSelfInventoryItem(); |
2958 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
2959 | m_host.TaskInventory.LockItemsForRead(false); | ||
2960 | 2967 | ||
2961 | if (item.PermsGranter == UUID.Zero) | 2968 | if (item.PermsGranter == UUID.Zero) |
2962 | return 0; | 2969 | return 0; |
@@ -3210,19 +3217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3210 | 3217 | ||
3211 | public void llTakeControls(int controls, int accept, int pass_on) | 3218 | public void llTakeControls(int controls, int accept, int pass_on) |
3212 | { | 3219 | { |
3213 | TaskInventoryItem item; | 3220 | TaskInventoryItem item = GetSelfInventoryItem(); |
3214 | |||
3215 | m_host.TaskInventory.LockItemsForRead(true); | ||
3216 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3217 | { | ||
3218 | m_host.TaskInventory.LockItemsForRead(false); | ||
3219 | return; | ||
3220 | } | ||
3221 | else | ||
3222 | { | ||
3223 | item = m_host.TaskInventory[InventorySelf()]; | ||
3224 | } | ||
3225 | m_host.TaskInventory.LockItemsForRead(false); | ||
3226 | 3221 | ||
3227 | if (item.PermsGranter != UUID.Zero) | 3222 | if (item.PermsGranter != UUID.Zero) |
3228 | { | 3223 | { |
@@ -3242,26 +3237,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3242 | 3237 | ||
3243 | public void llReleaseControls() | 3238 | public void llReleaseControls() |
3244 | { | 3239 | { |
3245 | TaskInventoryItem item; | ||
3246 | |||
3247 | m_host.TaskInventory.LockItemsForRead(true); | ||
3248 | lock (m_host.TaskInventory) | ||
3249 | { | ||
3250 | |||
3251 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3252 | { | ||
3253 | m_host.TaskInventory.LockItemsForRead(false); | ||
3254 | return; | ||
3255 | } | ||
3256 | else | ||
3257 | { | ||
3258 | item = m_host.TaskInventory[InventorySelf()]; | ||
3259 | } | ||
3260 | } | ||
3261 | m_host.TaskInventory.LockItemsForRead(false); | ||
3262 | |||
3263 | m_host.AddScriptLPS(1); | 3240 | m_host.AddScriptLPS(1); |
3264 | 3241 | ||
3242 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
3243 | |||
3265 | if (item.PermsGranter != UUID.Zero) | 3244 | if (item.PermsGranter != UUID.Zero) |
3266 | { | 3245 | { |
3267 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3246 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); |
@@ -3286,86 +3265,77 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3286 | m_UrlModule.ReleaseURL(url); | 3265 | m_UrlModule.ReleaseURL(url); |
3287 | } | 3266 | } |
3288 | 3267 | ||
3289 | public void llAttachToAvatar(int attachment) | 3268 | /// <summary> |
3269 | /// Attach the object containing this script to the avatar that owns it. | ||
3270 | /// </summary> | ||
3271 | /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> | ||
3272 | /// <returns>true if the attach suceeded, false if it did not</returns> | ||
3273 | public bool AttachToAvatar(int attachmentPoint) | ||
3290 | { | 3274 | { |
3291 | m_host.AddScriptLPS(1); | 3275 | SceneObjectGroup grp = m_host.ParentGroup; |
3292 | 3276 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | |
3293 | TaskInventoryItem item; | ||
3294 | 3277 | ||
3295 | m_host.TaskInventory.LockItemsForRead(true); | 3278 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3296 | 3279 | ||
3297 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3280 | if (attachmentsModule != null) |
3298 | { | 3281 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); |
3299 | m_host.TaskInventory.LockItemsForRead(false); | ||
3300 | return; | ||
3301 | } | ||
3302 | else | 3282 | else |
3303 | { | 3283 | return false; |
3304 | item = m_host.TaskInventory[InventorySelf()]; | 3284 | } |
3305 | } | ||
3306 | |||
3307 | m_host.TaskInventory.LockItemsForRead(false); | ||
3308 | 3285 | ||
3309 | if (item.PermsGranter != m_host.OwnerID) | 3286 | /// <summary> |
3310 | return; | 3287 | /// Detach the object containing this script from the avatar it is attached to. |
3288 | /// </summary> | ||
3289 | /// <remarks> | ||
3290 | /// Nothing happens if the object is not attached. | ||
3291 | /// </remarks> | ||
3292 | public void DetachFromAvatar() | ||
3293 | { | ||
3294 | Util.FireAndForget(DetachWrapper, m_host); | ||
3295 | } | ||
3311 | 3296 | ||
3312 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3297 | private void DetachWrapper(object o) |
3313 | { | 3298 | { |
3314 | SceneObjectGroup grp = m_host.ParentGroup; | 3299 | SceneObjectPart host = (SceneObjectPart)o; |
3315 | 3300 | ||
3316 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3301 | SceneObjectGroup grp = host.ParentGroup; |
3302 | UUID itemID = grp.FromItemID; | ||
3303 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3317 | 3304 | ||
3318 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3305 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3319 | if (attachmentsModule != null) | 3306 | if (attachmentsModule != null) |
3320 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); | 3307 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); |
3321 | } | ||
3322 | } | 3308 | } |
3323 | 3309 | ||
3324 | public void llDetachFromAvatar() | 3310 | public void llAttachToAvatar(int attachmentPoint) |
3325 | { | 3311 | { |
3326 | m_host.AddScriptLPS(1); | 3312 | m_host.AddScriptLPS(1); |
3327 | 3313 | ||
3328 | if (m_host.ParentGroup.AttachmentPoint == 0) | 3314 | TaskInventoryItem item = GetSelfInventoryItem(); |
3329 | return; | ||
3330 | 3315 | ||
3331 | TaskInventoryItem item; | ||
3332 | |||
3333 | m_host.TaskInventory.LockItemsForRead(true); | ||
3334 | |||
3335 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3336 | { | ||
3337 | m_host.TaskInventory.LockItemsForRead(false); | ||
3338 | return; | ||
3339 | } | ||
3340 | else | ||
3341 | { | ||
3342 | item = m_host.TaskInventory[InventorySelf()]; | ||
3343 | } | ||
3344 | m_host.TaskInventory.LockItemsForRead(false); | 3316 | m_host.TaskInventory.LockItemsForRead(false); |
3345 | 3317 | ||
3346 | |||
3347 | if (item.PermsGranter != m_host.OwnerID) | 3318 | if (item.PermsGranter != m_host.OwnerID) |
3348 | return; | 3319 | return; |
3349 | 3320 | ||
3350 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3321 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3351 | { | 3322 | AttachToAvatar(attachmentPoint); |
3352 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3353 | if (attachmentsModule != null) | ||
3354 | Util.FireAndForget(DetachWrapper, m_host); | ||
3355 | } | ||
3356 | } | 3323 | } |
3357 | 3324 | ||
3358 | private void DetachWrapper(object o) | 3325 | public void llDetachFromAvatar() |
3359 | { | 3326 | { |
3360 | SceneObjectPart host = (SceneObjectPart)o; | 3327 | m_host.AddScriptLPS(1); |
3361 | 3328 | ||
3362 | SceneObjectGroup grp = host.ParentGroup; | 3329 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3363 | UUID itemID = grp.FromItemID; | 3330 | return; |
3364 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3365 | 3331 | ||
3366 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3332 | TaskInventoryItem item = GetSelfInventoryItem(); |
3367 | if (attachmentsModule != null) | 3333 | |
3368 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); | 3334 | if (item.PermsGranter != m_host.OwnerID) |
3335 | return; | ||
3336 | |||
3337 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | ||
3338 | DetachFromAvatar(); | ||
3369 | } | 3339 | } |
3370 | 3340 | ||
3371 | public void llTakeCamera(string avatar) | 3341 | public void llTakeCamera(string avatar) |
@@ -3523,6 +3493,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3523 | return m_host.UUID.ToString(); | 3493 | return m_host.UUID.ToString(); |
3524 | } | 3494 | } |
3525 | 3495 | ||
3496 | public LSL_Key llGenerateKey() | ||
3497 | { | ||
3498 | m_host.AddScriptLPS(1); | ||
3499 | return UUID.Random().ToString(); | ||
3500 | } | ||
3501 | |||
3526 | public void llSetBuoyancy(double buoyancy) | 3502 | public void llSetBuoyancy(double buoyancy) |
3527 | { | 3503 | { |
3528 | m_host.AddScriptLPS(1); | 3504 | m_host.AddScriptLPS(1); |
@@ -3622,23 +3598,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3622 | { | 3598 | { |
3623 | m_host.AddScriptLPS(1); | 3599 | m_host.AddScriptLPS(1); |
3624 | 3600 | ||
3625 | UUID invItemID = InventorySelf(); | 3601 | TaskInventoryItem item = GetSelfInventoryItem(); |
3626 | if (invItemID == UUID.Zero) | ||
3627 | return; | ||
3628 | |||
3629 | TaskInventoryItem item; | ||
3630 | 3602 | ||
3631 | m_host.TaskInventory.LockItemsForRead(true); | ||
3632 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3633 | { | ||
3634 | m_host.TaskInventory.LockItemsForRead(false); | ||
3635 | return; | ||
3636 | } | ||
3637 | else | ||
3638 | { | ||
3639 | item = m_host.TaskInventory[InventorySelf()]; | ||
3640 | } | ||
3641 | m_host.TaskInventory.LockItemsForRead(false); | ||
3642 | if (item.PermsGranter == UUID.Zero) | 3603 | if (item.PermsGranter == UUID.Zero) |
3643 | return; | 3604 | return; |
3644 | 3605 | ||
@@ -3662,24 +3623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3662 | { | 3623 | { |
3663 | m_host.AddScriptLPS(1); | 3624 | m_host.AddScriptLPS(1); |
3664 | 3625 | ||
3665 | UUID invItemID=InventorySelf(); | 3626 | TaskInventoryItem item = GetSelfInventoryItem(); |
3666 | if (invItemID == UUID.Zero) | ||
3667 | return; | ||
3668 | |||
3669 | TaskInventoryItem item; | ||
3670 | |||
3671 | m_host.TaskInventory.LockItemsForRead(true); | ||
3672 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3673 | { | ||
3674 | m_host.TaskInventory.LockItemsForRead(false); | ||
3675 | return; | ||
3676 | } | ||
3677 | else | ||
3678 | { | ||
3679 | item = m_host.TaskInventory[InventorySelf()]; | ||
3680 | } | ||
3681 | m_host.TaskInventory.LockItemsForRead(false); | ||
3682 | |||
3683 | 3627 | ||
3684 | if (item.PermsGranter == UUID.Zero) | 3628 | if (item.PermsGranter == UUID.Zero) |
3685 | return; | 3629 | return; |
@@ -3734,30 +3678,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3734 | 3678 | ||
3735 | public void llRequestPermissions(string agent, int perm) | 3679 | public void llRequestPermissions(string agent, int perm) |
3736 | { | 3680 | { |
3737 | UUID agentID = new UUID(); | 3681 | UUID agentID; |
3738 | 3682 | ||
3739 | if (!UUID.TryParse(agent, out agentID)) | 3683 | if (!UUID.TryParse(agent, out agentID)) |
3740 | return; | 3684 | return; |
3741 | 3685 | ||
3742 | UUID invItemID = InventorySelf(); | 3686 | TaskInventoryItem item = GetSelfInventoryItem(); |
3743 | |||
3744 | if (invItemID == UUID.Zero) | ||
3745 | return; // Not in a prim? How?? | ||
3746 | |||
3747 | TaskInventoryItem item; | ||
3748 | |||
3749 | |||
3750 | m_host.TaskInventory.LockItemsForRead(true); | ||
3751 | if (!m_host.TaskInventory.ContainsKey(invItemID)) | ||
3752 | { | ||
3753 | m_host.TaskInventory.LockItemsForRead(false); | ||
3754 | return; | ||
3755 | } | ||
3756 | else | ||
3757 | { | ||
3758 | item = m_host.TaskInventory[invItemID]; | ||
3759 | } | ||
3760 | m_host.TaskInventory.LockItemsForRead(false); | ||
3761 | 3687 | ||
3762 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3688 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3763 | { | 3689 | { |
@@ -3791,8 +3717,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3791 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3717 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3792 | { | 3718 | { |
3793 | m_host.TaskInventory.LockItemsForWrite(true); | 3719 | m_host.TaskInventory.LockItemsForWrite(true); |
3794 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3720 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3795 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3721 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3796 | m_host.TaskInventory.LockItemsForWrite(false); | 3722 | m_host.TaskInventory.LockItemsForWrite(false); |
3797 | 3723 | ||
3798 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3724 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3830,8 +3756,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3830 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3756 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3831 | { | 3757 | { |
3832 | m_host.TaskInventory.LockItemsForWrite(true); | 3758 | m_host.TaskInventory.LockItemsForWrite(true); |
3833 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3759 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3834 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3760 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3835 | m_host.TaskInventory.LockItemsForWrite(false); | 3761 | m_host.TaskInventory.LockItemsForWrite(false); |
3836 | 3762 | ||
3837 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3763 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3855,8 +3781,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3855 | if (!m_waitingForScriptAnswer) | 3781 | if (!m_waitingForScriptAnswer) |
3856 | { | 3782 | { |
3857 | m_host.TaskInventory.LockItemsForWrite(true); | 3783 | m_host.TaskInventory.LockItemsForWrite(true); |
3858 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3784 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3859 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3785 | m_host.TaskInventory[m_itemID].PermsMask = 0; |
3860 | m_host.TaskInventory.LockItemsForWrite(false); | 3786 | m_host.TaskInventory.LockItemsForWrite(false); |
3861 | 3787 | ||
3862 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3788 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
@@ -3864,7 +3790,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3864 | } | 3790 | } |
3865 | 3791 | ||
3866 | presence.ControllingClient.SendScriptQuestion( | 3792 | presence.ControllingClient.SendScriptQuestion( |
3867 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3793 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); |
3868 | 3794 | ||
3869 | return; | 3795 | return; |
3870 | } | 3796 | } |
@@ -3881,23 +3807,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3881 | if (taskID != m_host.UUID) | 3807 | if (taskID != m_host.UUID) |
3882 | return; | 3808 | return; |
3883 | 3809 | ||
3884 | UUID invItemID = InventorySelf(); | 3810 | client.OnScriptAnswer -= handleScriptAnswer; |
3885 | 3811 | m_waitingForScriptAnswer = false; | |
3886 | if (invItemID == UUID.Zero) | ||
3887 | return; | ||
3888 | |||
3889 | client.OnScriptAnswer-=handleScriptAnswer; | ||
3890 | m_waitingForScriptAnswer=false; | ||
3891 | 3812 | ||
3892 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3813 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3893 | llReleaseControls(); | 3814 | llReleaseControls(); |
3894 | 3815 | ||
3895 | |||
3896 | m_host.TaskInventory.LockItemsForWrite(true); | 3816 | m_host.TaskInventory.LockItemsForWrite(true); |
3897 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3817 | m_host.TaskInventory[m_itemID].PermsMask = answer; |
3898 | m_host.TaskInventory.LockItemsForWrite(false); | 3818 | m_host.TaskInventory.LockItemsForWrite(false); |
3899 | 3819 | ||
3900 | |||
3901 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3820 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
3902 | "run_time_permissions", new Object[] { | 3821 | "run_time_permissions", new Object[] { |
3903 | new LSL_Integer(answer) }, | 3822 | new LSL_Integer(answer) }, |
@@ -3908,41 +3827,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3908 | { | 3827 | { |
3909 | m_host.AddScriptLPS(1); | 3828 | m_host.AddScriptLPS(1); |
3910 | 3829 | ||
3911 | m_host.TaskInventory.LockItemsForRead(true); | 3830 | return GetSelfInventoryItem().PermsGranter.ToString(); |
3912 | |||
3913 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3914 | { | ||
3915 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3916 | { | ||
3917 | m_host.TaskInventory.LockItemsForRead(false); | ||
3918 | return item.PermsGranter.ToString(); | ||
3919 | } | ||
3920 | } | ||
3921 | m_host.TaskInventory.LockItemsForRead(false); | ||
3922 | |||
3923 | return UUID.Zero.ToString(); | ||
3924 | } | 3831 | } |
3925 | 3832 | ||
3926 | public LSL_Integer llGetPermissions() | 3833 | public LSL_Integer llGetPermissions() |
3927 | { | 3834 | { |
3928 | m_host.AddScriptLPS(1); | 3835 | m_host.AddScriptLPS(1); |
3929 | 3836 | ||
3930 | m_host.TaskInventory.LockItemsForRead(true); | 3837 | int perms = GetSelfInventoryItem().PermsMask; |
3931 | 3838 | ||
3932 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3839 | if (m_automaticLinkPermission) |
3933 | { | 3840 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
3934 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3935 | { | ||
3936 | int perms = item.PermsMask; | ||
3937 | if (m_automaticLinkPermission) | ||
3938 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3939 | m_host.TaskInventory.LockItemsForRead(false); | ||
3940 | return perms; | ||
3941 | } | ||
3942 | } | ||
3943 | m_host.TaskInventory.LockItemsForRead(false); | ||
3944 | 3841 | ||
3945 | return 0; | 3842 | return perms; |
3946 | } | 3843 | } |
3947 | 3844 | ||
3948 | public LSL_Integer llGetLinkNumber() | 3845 | public LSL_Integer llGetLinkNumber() |
@@ -3980,17 +3877,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3980 | public void llCreateLink(string target, int parent) | 3877 | public void llCreateLink(string target, int parent) |
3981 | { | 3878 | { |
3982 | m_host.AddScriptLPS(1); | 3879 | m_host.AddScriptLPS(1); |
3983 | UUID invItemID = InventorySelf(); | 3880 | |
3984 | UUID targetID; | 3881 | UUID targetID; |
3985 | 3882 | ||
3986 | if (!UUID.TryParse(target, out targetID)) | 3883 | if (!UUID.TryParse(target, out targetID)) |
3987 | return; | 3884 | return; |
3988 | 3885 | ||
3989 | TaskInventoryItem item; | 3886 | TaskInventoryItem item = GetSelfInventoryItem(); |
3990 | m_host.TaskInventory.LockItemsForRead(true); | 3887 | |
3991 | item = m_host.TaskInventory[invItemID]; | ||
3992 | m_host.TaskInventory.LockItemsForRead(false); | ||
3993 | |||
3994 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3888 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3995 | && !m_automaticLinkPermission) | 3889 | && !m_automaticLinkPermission) |
3996 | { | 3890 | { |
@@ -4045,18 +3939,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4045 | public void llBreakLink(int linknum) | 3939 | public void llBreakLink(int linknum) |
4046 | { | 3940 | { |
4047 | m_host.AddScriptLPS(1); | 3941 | m_host.AddScriptLPS(1); |
4048 | UUID invItemID = InventorySelf(); | ||
4049 | 3942 | ||
4050 | m_host.TaskInventory.LockItemsForRead(true); | 3943 | if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4051 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3944 | && !m_automaticLinkPermission) |
4052 | && !m_automaticLinkPermission) | 3945 | { |
4053 | { | 3946 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
4054 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3947 | return; |
4055 | m_host.TaskInventory.LockItemsForRead(false); | 3948 | } |
4056 | return; | 3949 | |
4057 | } | ||
4058 | m_host.TaskInventory.LockItemsForRead(false); | ||
4059 | |||
4060 | if (linknum < ScriptBaseClass.LINK_THIS) | 3950 | if (linknum < ScriptBaseClass.LINK_THIS) |
4061 | return; | 3951 | return; |
4062 | 3952 | ||
@@ -4155,12 +4045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4155 | { | 4045 | { |
4156 | m_host.AddScriptLPS(1); | 4046 | m_host.AddScriptLPS(1); |
4157 | 4047 | ||
4158 | UUID invItemID = InventorySelf(); | 4048 | TaskInventoryItem item = GetSelfInventoryItem(); |
4159 | |||
4160 | TaskInventoryItem item; | ||
4161 | m_host.TaskInventory.LockItemsForRead(true); | ||
4162 | item = m_host.TaskInventory[invItemID]; | ||
4163 | m_host.TaskInventory.LockItemsForRead(false); | ||
4164 | 4049 | ||
4165 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 4050 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4166 | && !m_automaticLinkPermission) | 4051 | && !m_automaticLinkPermission) |
@@ -5033,22 +4918,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5033 | 4918 | ||
5034 | public LSL_String llGetScriptName() | 4919 | public LSL_String llGetScriptName() |
5035 | { | 4920 | { |
5036 | string result = String.Empty; | ||
5037 | |||
5038 | m_host.AddScriptLPS(1); | 4921 | m_host.AddScriptLPS(1); |
5039 | 4922 | ||
5040 | m_host.TaskInventory.LockItemsForRead(true); | 4923 | TaskInventoryItem item = GetSelfInventoryItem(); |
5041 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
5042 | { | ||
5043 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
5044 | { | ||
5045 | result = item.Name!=null?item.Name:String.Empty; | ||
5046 | break; | ||
5047 | } | ||
5048 | } | ||
5049 | m_host.TaskInventory.LockItemsForRead(false); | ||
5050 | 4924 | ||
5051 | return result; | 4925 | return item.Name != null ? item.Name : String.Empty; |
5052 | } | 4926 | } |
5053 | 4927 | ||
5054 | public LSL_Integer llGetLinkNumberOfSides(int link) | 4928 | public LSL_Integer llGetLinkNumberOfSides(int link) |
@@ -6248,7 +6122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6248 | if (m_host.OwnerID == land.LandData.OwnerID) | 6122 | if (m_host.OwnerID == land.LandData.OwnerID) |
6249 | { | 6123 | { |
6250 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); | 6124 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); |
6251 | presence.TeleportWithMomentum(pos); | 6125 | presence.TeleportWithMomentum(pos, null); |
6252 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | 6126 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); |
6253 | } | 6127 | } |
6254 | } | 6128 | } |
@@ -8064,7 +7938,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8064 | return; | 7938 | return; |
8065 | face = (int)rules.GetLSLIntegerItem(idx++); | 7939 | face = (int)rules.GetLSLIntegerItem(idx++); |
8066 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 7940 | int shiny = (int)rules.GetLSLIntegerItem(idx++); |
8067 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | 7941 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); |
8068 | 7942 | ||
8069 | SetShiny(part, face, shiny, bump); | 7943 | SetShiny(part, face, shiny, bump); |
8070 | 7944 | ||
@@ -9991,7 +9865,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9991 | // child agents have a mass of 1.0 | 9865 | // child agents have a mass of 1.0 |
9992 | return 1; | 9866 | return 1; |
9993 | else | 9867 | else |
9994 | return avatar.GetMass(); | 9868 | return (double)avatar.GetMass(); |
9995 | } | 9869 | } |
9996 | catch (KeyNotFoundException) | 9870 | catch (KeyNotFoundException) |
9997 | { | 9871 | { |
@@ -10434,22 +10308,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10434 | public LSL_Vector llGetCameraPos() | 10308 | public LSL_Vector llGetCameraPos() |
10435 | { | 10309 | { |
10436 | m_host.AddScriptLPS(1); | 10310 | m_host.AddScriptLPS(1); |
10437 | UUID invItemID = InventorySelf(); | ||
10438 | 10311 | ||
10439 | if (invItemID == UUID.Zero) | 10312 | TaskInventoryItem item = GetSelfInventoryItem(); |
10440 | return new LSL_Vector(); | ||
10441 | 10313 | ||
10442 | m_host.TaskInventory.LockItemsForRead(true); | 10314 | if (item.PermsGranter == UUID.Zero) |
10443 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10315 | return new LSL_Vector(); |
10444 | { | ||
10445 | m_host.TaskInventory.LockItemsForRead(false); | ||
10446 | return new LSL_Vector(); | ||
10447 | } | ||
10448 | 10316 | ||
10449 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10317 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10450 | { | 10318 | { |
10451 | ShoutError("No permissions to track the camera"); | 10319 | ShoutError("No permissions to track the camera"); |
10452 | m_host.TaskInventory.LockItemsForRead(false); | ||
10453 | return new LSL_Vector(); | 10320 | return new LSL_Vector(); |
10454 | } | 10321 | } |
10455 | m_host.TaskInventory.LockItemsForRead(false); | 10322 | m_host.TaskInventory.LockItemsForRead(false); |
@@ -10466,20 +10333,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10466 | public LSL_Rotation llGetCameraRot() | 10333 | public LSL_Rotation llGetCameraRot() |
10467 | { | 10334 | { |
10468 | m_host.AddScriptLPS(1); | 10335 | m_host.AddScriptLPS(1); |
10469 | UUID invItemID = InventorySelf(); | ||
10470 | if (invItemID == UUID.Zero) | ||
10471 | return new LSL_Rotation(); | ||
10472 | 10336 | ||
10473 | m_host.TaskInventory.LockItemsForRead(true); | 10337 | TaskInventoryItem item = GetSelfInventoryItem(); |
10474 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10338 | |
10475 | { | 10339 | if (item.PermsGranter == UUID.Zero) |
10476 | m_host.TaskInventory.LockItemsForRead(false); | 10340 | return new LSL_Rotation(); |
10477 | return new LSL_Rotation(); | 10341 | |
10478 | } | 10342 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10479 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | ||
10480 | { | 10343 | { |
10481 | ShoutError("No permissions to track the camera"); | 10344 | ShoutError("No permissions to track the camera"); |
10482 | m_host.TaskInventory.LockItemsForRead(false); | ||
10483 | return new LSL_Rotation(); | 10345 | return new LSL_Rotation(); |
10484 | } | 10346 | } |
10485 | m_host.TaskInventory.LockItemsForRead(false); | 10347 | m_host.TaskInventory.LockItemsForRead(false); |
@@ -10667,30 +10529,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10667 | { | 10529 | { |
10668 | m_host.AddScriptLPS(1); | 10530 | m_host.AddScriptLPS(1); |
10669 | 10531 | ||
10670 | // our key in the object we are in | ||
10671 | UUID invItemID = InventorySelf(); | ||
10672 | if (invItemID == UUID.Zero) return; | ||
10673 | |||
10674 | // the object we are in | 10532 | // the object we are in |
10675 | UUID objectID = m_host.ParentUUID; | 10533 | UUID objectID = m_host.ParentUUID; |
10676 | if (objectID == UUID.Zero) return; | 10534 | if (objectID == UUID.Zero) |
10535 | return; | ||
10536 | |||
10537 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
10677 | 10538 | ||
10678 | UUID agentID; | ||
10679 | m_host.TaskInventory.LockItemsForRead(true); | ||
10680 | // we need the permission first, to know which avatar we want to set the camera for | 10539 | // we need the permission first, to know which avatar we want to set the camera for |
10681 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 10540 | UUID agentID = item.PermsGranter; |
10682 | 10541 | ||
10683 | if (agentID == UUID.Zero) | 10542 | if (agentID == UUID.Zero) |
10684 | { | ||
10685 | m_host.TaskInventory.LockItemsForRead(false); | ||
10686 | return; | 10543 | return; |
10687 | } | 10544 | |
10688 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10545 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10689 | { | ||
10690 | m_host.TaskInventory.LockItemsForRead(false); | ||
10691 | return; | 10546 | return; |
10692 | } | ||
10693 | m_host.TaskInventory.LockItemsForRead(false); | ||
10694 | 10547 | ||
10695 | ScenePresence presence = World.GetScenePresence(agentID); | 10548 | ScenePresence presence = World.GetScenePresence(agentID); |
10696 | 10549 | ||
@@ -10732,34 +10585,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10732 | { | 10585 | { |
10733 | m_host.AddScriptLPS(1); | 10586 | m_host.AddScriptLPS(1); |
10734 | 10587 | ||
10735 | // our key in the object we are in | ||
10736 | UUID invItemID=InventorySelf(); | ||
10737 | if (invItemID == UUID.Zero) return; | ||
10738 | |||
10739 | // the object we are in | 10588 | // the object we are in |
10740 | UUID objectID = m_host.ParentUUID; | 10589 | UUID objectID = m_host.ParentUUID; |
10741 | if (objectID == UUID.Zero) return; | 10590 | if (objectID == UUID.Zero) |
10591 | return; | ||
10592 | |||
10593 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
10742 | 10594 | ||
10743 | // we need the permission first, to know which avatar we want to clear the camera for | 10595 | // we need the permission first, to know which avatar we want to clear the camera for |
10744 | UUID agentID; | 10596 | UUID agentID = item.PermsGranter; |
10745 | m_host.TaskInventory.LockItemsForRead(true); | 10597 | |
10746 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
10747 | if (agentID == UUID.Zero) | 10598 | if (agentID == UUID.Zero) |
10748 | { | ||
10749 | m_host.TaskInventory.LockItemsForRead(false); | ||
10750 | return; | 10599 | return; |
10751 | } | 10600 | |
10752 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10601 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10753 | { | ||
10754 | m_host.TaskInventory.LockItemsForRead(false); | ||
10755 | return; | 10602 | return; |
10756 | } | ||
10757 | m_host.TaskInventory.LockItemsForRead(false); | ||
10758 | 10603 | ||
10759 | ScenePresence presence = World.GetScenePresence(agentID); | 10604 | ScenePresence presence = World.GetScenePresence(agentID); |
10760 | 10605 | ||
10761 | // we are not interested in child-agents | 10606 | // we are not interested in child-agents |
10762 | if (presence.IsChildAgent) return; | 10607 | if (presence.IsChildAgent) |
10608 | return; | ||
10763 | 10609 | ||
10764 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 10610 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
10765 | } | 10611 | } |
@@ -11183,19 +11029,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11183 | break; | 11029 | break; |
11184 | // For the following 8 see the Object version below | 11030 | // For the following 8 see the Object version below |
11185 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11031 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11186 | ret.Add(new LSL_Integer(0)); | 11032 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11187 | break; | 11033 | break; |
11188 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11034 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11189 | ret.Add(new LSL_Integer(0)); | 11035 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11190 | break; | 11036 | break; |
11191 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11037 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11192 | ret.Add(new LSL_Integer(0)); | 11038 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11193 | break; | 11039 | break; |
11194 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11040 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11195 | ret.Add(new LSL_Float(0)); | 11041 | ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); |
11196 | break; | 11042 | break; |
11197 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11043 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11198 | ret.Add(new LSL_Integer(0)); | 11044 | ret.Add(new LSL_Integer(1)); |
11199 | break; | 11045 | break; |
11200 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11046 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11201 | ret.Add(new LSL_Float(0)); | 11047 | ret.Add(new LSL_Float(0)); |
@@ -11247,43 +11093,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11247 | case ScriptBaseClass.OBJECT_CREATOR: | 11093 | case ScriptBaseClass.OBJECT_CREATOR: |
11248 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11094 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11249 | break; | 11095 | break; |
11250 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11251 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11252 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11253 | // I have intentionally left these all at zero rather than return possibly | ||
11254 | // missleading numbers | ||
11255 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11096 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11256 | // in SL this currently includes crashed scripts | 11097 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11257 | ret.Add(new LSL_Integer(0)); | ||
11258 | break; | 11098 | break; |
11259 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11099 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11260 | ret.Add(new LSL_Integer(0)); | 11100 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11261 | break; | 11101 | break; |
11262 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11102 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11263 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11103 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11264 | ret.Add(new LSL_Integer(0)); | 11104 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11105 | // is coded to give the LSO value use it here | ||
11106 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11265 | break; | 11107 | break; |
11266 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11108 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11267 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11109 | // Average cpu time in seconds per simulator frame expended on all scripts in the object |
11268 | ret.Add(new LSL_Float(0)); | 11110 | ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); |
11269 | break; | 11111 | break; |
11270 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11112 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11271 | // according to the SL wiki A prim or linkset will have prim | 11113 | // according to the SL wiki A prim or linkset will have prim |
11272 | // equivalent of the number of prims in a linkset if it does not | 11114 | // equivalent of the number of prims in a linkset if it does not |
11273 | // contain a mesh anywhere in the link set or is not a normal prim | 11115 | // contain a mesh anywhere in the link set or is not a normal prim |
11274 | // The value returned in SL for normal prims is prim count | 11116 | // The value returned in SL for normal prims is prim count |
11275 | ret.Add(new LSL_Integer(0)); | 11117 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11276 | break; | 11118 | break; |
11119 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11120 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11121 | // to OpenSim and are not yet complete in SL | ||
11277 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11122 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11278 | // The value returned in SL for normal prims is prim count | 11123 | // The linden calculation is here |
11124 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11125 | // The value returned in SL for normal prims looks like the prim count | ||
11279 | ret.Add(new LSL_Float(0)); | 11126 | ret.Add(new LSL_Float(0)); |
11280 | break; | 11127 | break; |
11281 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11128 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11282 | // The value returned in SL for normal prims is prim count * 0.06 | 11129 | // The linden calculation is here |
11130 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11131 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11283 | ret.Add(new LSL_Float(0)); | 11132 | ret.Add(new LSL_Float(0)); |
11284 | break; | 11133 | break; |
11285 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11134 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11286 | // The value returned in SL for normal prims is prim count | 11135 | // The linden calculation is here |
11136 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11137 | // The value returned in SL for normal prims looks like the prim count | ||
11287 | ret.Add(new LSL_Float(0)); | 11138 | ret.Add(new LSL_Float(0)); |
11288 | break; | 11139 | break; |
11289 | default: | 11140 | default: |
@@ -12038,7 +11889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12038 | bool isAccount = false; | 11889 | bool isAccount = false; |
12039 | bool isGroup = false; | 11890 | bool isGroup = false; |
12040 | 11891 | ||
12041 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) | 11892 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) |
12042 | return 0; | 11893 | return 0; |
12043 | 11894 | ||
12044 | UUID id = new UUID(); | 11895 | UUID id = new UUID(); |
@@ -12100,35 +11951,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12100 | return 1; | 11951 | return 1; |
12101 | } | 11952 | } |
12102 | 11953 | ||
12103 | #region Not Implemented | 11954 | public LSL_Integer llGetMemoryLimit() |
12104 | // | 11955 | { |
12105 | // Listing the unimplemented lsl functions here, please move | 11956 | m_host.AddScriptLPS(1); |
12106 | // them from this region as they are completed | 11957 | // The value returned for LSO scripts in SL |
12107 | // | 11958 | return 16384; |
11959 | } | ||
12108 | 11960 | ||
12109 | public void llGetEnv(LSL_String name) | 11961 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12110 | { | 11962 | { |
12111 | m_host.AddScriptLPS(1); | 11963 | m_host.AddScriptLPS(1); |
12112 | NotImplemented("llGetEnv"); | 11964 | // Treat as an LSO script |
11965 | return ScriptBaseClass.FALSE; | ||
12113 | } | 11966 | } |
12114 | 11967 | ||
12115 | public void llGetSPMaxMemory() | 11968 | public LSL_Integer llGetSPMaxMemory() |
12116 | { | 11969 | { |
12117 | m_host.AddScriptLPS(1); | 11970 | m_host.AddScriptLPS(1); |
12118 | NotImplemented("llGetSPMaxMemory"); | 11971 | // The value returned for LSO scripts in SL |
11972 | return 16384; | ||
12119 | } | 11973 | } |
12120 | 11974 | ||
12121 | public virtual LSL_Integer llGetUsedMemory() | 11975 | public virtual LSL_Integer llGetUsedMemory() |
12122 | { | 11976 | { |
12123 | m_host.AddScriptLPS(1); | 11977 | m_host.AddScriptLPS(1); |
12124 | NotImplemented("llGetUsedMemory"); | 11978 | // The value returned for LSO scripts in SL |
12125 | return 0; | 11979 | return 16384; |
12126 | } | 11980 | } |
12127 | 11981 | ||
12128 | public void llScriptProfiler(LSL_Integer flags) | 11982 | public void llScriptProfiler(LSL_Integer flags) |
12129 | { | 11983 | { |
12130 | m_host.AddScriptLPS(1); | 11984 | m_host.AddScriptLPS(1); |
12131 | //NotImplemented("llScriptProfiler"); | 11985 | // This does nothing for LSO scripts in SL |
11986 | } | ||
11987 | |||
11988 | #region Not Implemented | ||
11989 | // | ||
11990 | // Listing the unimplemented lsl functions here, please move | ||
11991 | // them from this region as they are completed | ||
11992 | // | ||
11993 | |||
11994 | public void llGetEnv(LSL_String name) | ||
11995 | { | ||
11996 | m_host.AddScriptLPS(1); | ||
11997 | NotImplemented("llGetEnv"); | ||
12132 | } | 11998 | } |
12133 | 11999 | ||
12134 | public void llSetSoundQueueing(int queue) | 12000 | public void llSetSoundQueueing(int queue) |
@@ -12208,8 +12074,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12208 | 12074 | ||
12209 | try | 12075 | try |
12210 | { | 12076 | { |
12211 | UUID invItemID=InventorySelf(); | 12077 | TaskInventoryItem item = GetSelfInventoryItem(); |
12212 | if (invItemID == UUID.Zero) | 12078 | if (item == null) |
12213 | { | 12079 | { |
12214 | replydata = "SERVICE_ERROR"; | 12080 | replydata = "SERVICE_ERROR"; |
12215 | return; | 12081 | return; |
@@ -12217,10 +12083,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12217 | 12083 | ||
12218 | m_host.AddScriptLPS(1); | 12084 | m_host.AddScriptLPS(1); |
12219 | 12085 | ||
12220 | m_host.TaskInventory.LockItemsForRead(true); | ||
12221 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
12222 | m_host.TaskInventory.LockItemsForRead(false); | ||
12223 | |||
12224 | if (item.PermsGranter == UUID.Zero) | 12086 | if (item.PermsGranter == UUID.Zero) |
12225 | { | 12087 | { |
12226 | replydata = "MISSING_PERMISSION_DEBIT"; | 12088 | replydata = "MISSING_PERMISSION_DEBIT"; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d..df20126 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -449,7 +449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
449 | LSShoutError("LightShare functions are not enabled."); | 449 | LSShoutError("LightShare functions are not enabled."); |
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 452 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
453 | { | 453 | { |
454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
455 | return 0; | 455 | return 0; |
@@ -477,7 +477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
477 | LSShoutError("LightShare functions are not enabled."); | 477 | LSShoutError("LightShare functions are not enabled."); |
478 | return; | 478 | return; |
479 | } | 479 | } |
480 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 480 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
481 | { | 481 | { |
482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
483 | return; | 483 | return; |
@@ -500,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
500 | LSShoutError("LightShare functions are not enabled."); | 500 | LSShoutError("LightShare functions are not enabled."); |
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 503 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
504 | { | 504 | { |
505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
506 | return 0; | 506 | return 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..60568a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -218,6 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /// <summary> | ||
222 | /// Initialize the LSL interface. | ||
223 | /// </summary> | ||
224 | /// <remarks> | ||
225 | /// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no | ||
226 | /// guarantee the interface is present on Initialize(). There needs to be another post initialize call from | ||
227 | /// ScriptInstance. | ||
228 | /// </remarks> | ||
221 | private void InitLSL() | 229 | private void InitLSL() |
222 | { | 230 | { |
223 | if (m_LSL_Api != null) | 231 | if (m_LSL_Api != null) |
@@ -352,7 +360,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
352 | 360 | ||
353 | UUID ownerID = ti.OwnerID; | 361 | UUID ownerID = ti.OwnerID; |
354 | 362 | ||
355 | //OSSL only may be used if objet is in the same group as the parcel | 363 | //OSSL only may be used if object is in the same group as the parcel |
356 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 364 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
357 | { | 365 | { |
358 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 366 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
@@ -378,7 +386,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) | 386 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) |
379 | { | 387 | { |
380 | //Only Estate Managers may use the function | 388 | //Only Estate Managers may use the function |
381 | if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 389 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
382 | { | 390 | { |
383 | return; | 391 | return; |
384 | } | 392 | } |
@@ -730,11 +738,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
730 | 738 | ||
731 | m_host.AddScriptLPS(1); | 739 | m_host.AddScriptLPS(1); |
732 | 740 | ||
741 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions | ||
733 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 742 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
734 | { | 743 | { |
735 | MainConsole.Instance.RunCommand(command); | 744 | MainConsole.Instance.RunCommand(command); |
736 | return true; | 745 | return true; |
737 | } | 746 | } |
747 | |||
738 | return false; | 748 | return false; |
739 | } | 749 | } |
740 | 750 | ||
@@ -1186,12 +1196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1196 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1187 | 1197 | ||
1188 | m_host.AddScriptLPS(1); | 1198 | m_host.AddScriptLPS(1); |
1189 | //Check to make sure that the script's owner is the estate manager/master | 1199 | |
1190 | //World.Permissions.GenericEstatePermission( | 1200 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1191 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1192 | { | ||
1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | ||
1194 | } | ||
1195 | } | 1201 | } |
1196 | 1202 | ||
1197 | /// <summary> | 1203 | /// <summary> |
@@ -1202,27 +1208,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1202 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1208 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1203 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) | 1209 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) |
1204 | { | 1210 | { |
1205 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); | 1211 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1206 | 1212 | ||
1207 | m_host.AddScriptLPS(1); | 1213 | m_host.AddScriptLPS(1); |
1208 | //Check to make sure that the script's owner is the estate manager/master | ||
1209 | //World.Permissions.GenericEstatePermission( | ||
1210 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1211 | { | ||
1212 | while (sunHour > 24.0) | ||
1213 | sunHour -= 24.0; | ||
1214 | 1214 | ||
1215 | while (sunHour < 0) | 1215 | while (sunHour > 24.0) |
1216 | sunHour += 24.0; | 1216 | sunHour -= 24.0; |
1217 | 1217 | ||
1218 | while (sunHour < 0) | ||
1219 | sunHour += 24.0; | ||
1218 | 1220 | ||
1219 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1221 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1220 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1222 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1221 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1223 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1222 | World.RegionInfo.RegionSettings.Save(); | 1224 | World.RegionInfo.RegionSettings.Save(); |
1223 | 1225 | ||
1224 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | 1226 | World.EventManager.TriggerEstateToolsSunUpdate( |
1225 | } | 1227 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); |
1226 | } | 1228 | } |
1227 | 1229 | ||
1228 | /// <summary> | 1230 | /// <summary> |
@@ -1232,26 +1234,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1232 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1234 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1233 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | 1235 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) |
1234 | { | 1236 | { |
1235 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | 1237 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1236 | 1238 | ||
1237 | m_host.AddScriptLPS(1); | 1239 | m_host.AddScriptLPS(1); |
1238 | //Check to make sure that the script's owner is the estate manager/master | ||
1239 | //World.Permissions.GenericEstatePermission( | ||
1240 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1241 | { | ||
1242 | while (sunHour > 24.0) | ||
1243 | sunHour -= 24.0; | ||
1244 | 1240 | ||
1245 | while (sunHour < 0) | 1241 | while (sunHour > 24.0) |
1246 | sunHour += 24.0; | 1242 | sunHour -= 24.0; |
1247 | 1243 | ||
1248 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | 1244 | while (sunHour < 0) |
1249 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | 1245 | sunHour += 24.0; |
1250 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1251 | World.RegionInfo.EstateSettings.Save(); | ||
1252 | 1246 | ||
1253 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | 1247 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; |
1254 | } | 1248 | World.RegionInfo.EstateSettings.SunPosition = sunHour; |
1249 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1250 | World.RegionInfo.EstateSettings.Save(); | ||
1251 | |||
1252 | World.EventManager.TriggerEstateToolsSunUpdate( | ||
1253 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1255 | } | 1254 | } |
1256 | 1255 | ||
1257 | /// <summary> | 1256 | /// <summary> |
@@ -1627,7 +1626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1627 | 1626 | ||
1628 | public Object osParseJSONNew(string JSON) | 1627 | public Object osParseJSONNew(string JSON) |
1629 | { | 1628 | { |
1630 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1629 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1631 | 1630 | ||
1632 | m_host.AddScriptLPS(1); | 1631 | m_host.AddScriptLPS(1); |
1633 | 1632 | ||
@@ -2555,7 +2554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2555 | 2554 | ||
2556 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2555 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2557 | { | 2556 | { |
2558 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2557 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
2559 | m_host.AddScriptLPS(1); | 2558 | m_host.AddScriptLPS(1); |
2560 | 2559 | ||
2561 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2560 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -2572,6 +2571,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2572 | 2571 | ||
2573 | public void osNpcSay(LSL_Key npc, string message) | 2572 | public void osNpcSay(LSL_Key npc, string message) |
2574 | { | 2573 | { |
2574 | osNpcSay(npc, 0, message); | ||
2575 | } | ||
2576 | |||
2577 | public void osNpcSay(LSL_Key npc, int channel, string message) | ||
2578 | { | ||
2575 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2579 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2576 | m_host.AddScriptLPS(1); | 2580 | m_host.AddScriptLPS(1); |
2577 | 2581 | ||
@@ -2583,7 +2587,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2583 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | 2587 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2584 | return; | 2588 | return; |
2585 | 2589 | ||
2586 | module.Say(npcId, World, message); | 2590 | module.Say(npcId, World, message, channel); |
2591 | } | ||
2592 | } | ||
2593 | |||
2594 | public void osNpcShout(LSL_Key npc, int channel, string message) | ||
2595 | { | ||
2596 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | ||
2597 | m_host.AddScriptLPS(1); | ||
2598 | |||
2599 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2600 | if (module != null) | ||
2601 | { | ||
2602 | UUID npcId = new UUID(npc.m_string); | ||
2603 | |||
2604 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2605 | return; | ||
2606 | |||
2607 | module.Shout(npcId, World, message, channel); | ||
2587 | } | 2608 | } |
2588 | } | 2609 | } |
2589 | 2610 | ||
@@ -2684,6 +2705,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2684 | } | 2705 | } |
2685 | } | 2706 | } |
2686 | 2707 | ||
2708 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | ||
2709 | { | ||
2710 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | ||
2711 | m_host.AddScriptLPS(1); | ||
2712 | |||
2713 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2714 | if (module != null) | ||
2715 | { | ||
2716 | UUID npcId = new UUID(npc.m_string); | ||
2717 | |||
2718 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2719 | return; | ||
2720 | |||
2721 | module.Whisper(npcId, World, message, channel); | ||
2722 | } | ||
2723 | } | ||
2724 | |||
2687 | /// <summary> | 2725 | /// <summary> |
2688 | /// Save the current appearance of the script owner permanently to the named notecard. | 2726 | /// Save the current appearance of the script owner permanently to the named notecard. |
2689 | /// </summary> | 2727 | /// </summary> |
@@ -2835,21 +2873,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2835 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2873 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2836 | m_host.AddScriptLPS(1); | 2874 | m_host.AddScriptLPS(1); |
2837 | 2875 | ||
2838 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2876 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
2839 | { | 2877 | { |
2840 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2878 | if (sp.Firstname == FirstName && sp.Lastname == SurName) |
2841 | { | 2879 | { |
2842 | if (sp.Firstname == FirstName && sp.Lastname == SurName) | 2880 | // kick client... |
2843 | { | 2881 | if (alert != null) |
2844 | // kick client... | 2882 | sp.ControllingClient.Kick(alert); |
2845 | if (alert != null) | ||
2846 | sp.ControllingClient.Kick(alert); | ||
2847 | 2883 | ||
2848 | // ...and close on our side | 2884 | // ...and close on our side |
2849 | sp.Scene.IncomingCloseAgent(sp.UUID); | 2885 | sp.Scene.IncomingCloseAgent(sp.UUID); |
2850 | } | 2886 | } |
2851 | }); | 2887 | }); |
2852 | } | ||
2853 | } | 2888 | } |
2854 | 2889 | ||
2855 | public void osCauseDamage(string avatar, double damage) | 2890 | public void osCauseDamage(string avatar, double damage) |
@@ -3095,5 +3130,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3130 | ||
3096 | return ScriptBaseClass.TRUE; | 3131 | return ScriptBaseClass.TRUE; |
3097 | } | 3132 | } |
3133 | |||
3134 | /// <summary> | ||
3135 | /// Sets terrain estate texture | ||
3136 | /// </summary> | ||
3137 | /// <param name="level"></param> | ||
3138 | /// <param name="texture"></param> | ||
3139 | /// <returns></returns> | ||
3140 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3141 | { | ||
3142 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3143 | |||
3144 | m_host.AddScriptLPS(1); | ||
3145 | //Check to make sure that the script's owner is the estate manager/master | ||
3146 | //World.Permissions.GenericEstatePermission( | ||
3147 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3148 | { | ||
3149 | if (level < 0 || level > 3) | ||
3150 | return; | ||
3151 | |||
3152 | UUID textureID = new UUID(); | ||
3153 | if (!UUID.TryParse(texture, out textureID)) | ||
3154 | return; | ||
3155 | |||
3156 | // estate module is required | ||
3157 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3158 | if (estate != null) | ||
3159 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3160 | } | ||
3161 | } | ||
3162 | |||
3163 | /// <summary> | ||
3164 | /// Sets terrain heights of estate | ||
3165 | /// </summary> | ||
3166 | /// <param name="corner"></param> | ||
3167 | /// <param name="low"></param> | ||
3168 | /// <param name="high"></param> | ||
3169 | /// <returns></returns> | ||
3170 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3171 | { | ||
3172 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3173 | |||
3174 | m_host.AddScriptLPS(1); | ||
3175 | //Check to make sure that the script's owner is the estate manager/master | ||
3176 | //World.Permissions.GenericEstatePermission( | ||
3177 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3178 | { | ||
3179 | if (corner < 0 || corner > 3) | ||
3180 | return; | ||
3181 | |||
3182 | // estate module is required | ||
3183 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3184 | if (estate != null) | ||
3185 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3186 | } | ||
3187 | } | ||
3188 | |||
3189 | public void osForceAttachToAvatar(int attachmentPoint) | ||
3190 | { | ||
3191 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); | ||
3192 | |||
3193 | m_host.AddScriptLPS(1); | ||
3194 | |||
3195 | InitLSL(); | ||
3196 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); | ||
3197 | } | ||
3198 | |||
3199 | public void osForceDetachFromAvatar() | ||
3200 | { | ||
3201 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); | ||
3202 | |||
3203 | m_host.AddScriptLPS(1); | ||
3204 | |||
3205 | InitLSL(); | ||
3206 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); | ||
3207 | } | ||
3098 | } | 3208 | } |
3099 | } | 3209 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1373971..19f3ce1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
308 | } | 308 | } |
309 | SceneObjectPart SensePoint = ts.host; | 309 | SceneObjectPart SensePoint = ts.host; |
310 | 310 | ||
311 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; | 311 | Vector3 fromRegionPos = SensePoint.GetWorldPosition(); |
312 | 312 | ||
313 | // pre define some things to avoid repeated definitions in the loop body | 313 | // pre define some things to avoid repeated definitions in the loop body |
314 | Vector3 toRegionPos; | 314 | Vector3 toRegionPos; |
@@ -323,13 +323,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
323 | Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation! | 323 | Quaternion q = SensePoint.GetWorldRotation(); // non-attached prim Sensor *always* uses World rotation! |
324 | if (SensePoint.ParentGroup.IsAttachment) | 324 | if (SensePoint.ParentGroup.IsAttachment) |
325 | { | 325 | { |
326 | // In attachments, the sensor cone always orients with the | 326 | // In attachments, rotate the sensor cone with the |
327 | // avatar rotation. This may include a nonzero elevation if | 327 | // avatar rotation. This may include a nonzero elevation if |
328 | // in mouselook. | 328 | // in mouselook. |
329 | // This will not include the rotation and position of the | ||
330 | // attachment point (e.g. your head when a sensor is in your | ||
331 | // hair attached to your scull. Your hair will turn with | ||
332 | // your head but the sensor will stay with your (global) | ||
333 | // avatar rotation and position. | ||
334 | // Position of a sensor in a child prim attached to an avatar | ||
335 | // will be still wrong. | ||
329 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 336 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
330 | fromRegionPos = avatar.AbsolutePosition; | 337 | fromRegionPos = avatar.AbsolutePosition; |
331 | q = avatar.Rotation; | 338 | q = avatar.Rotation; |
332 | } | 339 | } |
340 | |||
333 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); | 341 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); |
334 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); | 342 | LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); |
335 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); | 343 | double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); |
@@ -441,14 +449,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
441 | return sensedEntities; | 449 | return sensedEntities; |
442 | 450 | ||
443 | SceneObjectPart SensePoint = ts.host; | 451 | SceneObjectPart SensePoint = ts.host; |
444 | Vector3 fromRegionPos = SensePoint.AbsolutePosition; | 452 | Vector3 fromRegionPos = SensePoint.GetWorldPosition(); |
445 | 453 | ||
446 | Quaternion q = SensePoint.RotationOffset; | 454 | Quaternion q = SensePoint.GetWorldRotation(); |
447 | if (SensePoint.ParentGroup.IsAttachment) | 455 | if (SensePoint.ParentGroup.IsAttachment) |
448 | { | 456 | { |
449 | // In attachments, the sensor cone always orients with the | 457 | // In attachments, rotate the sensor cone with the |
450 | // avatar rotation. This may include a nonzero elevation if | 458 | // avatar rotation. This may include a nonzero elevation if |
451 | // in mouselook. | 459 | // in mouselook. |
460 | // This will not include the rotation and position of the | ||
461 | // attachment point (e.g. your head when a sensor is in your | ||
462 | // hair attached to your scull. Your hair will turn with | ||
463 | // your head but the sensor will stay with your (global) | ||
464 | // avatar rotation and position. | ||
465 | // Position of a sensor in a child prim attached to an avatar | ||
466 | // will be still wrong. | ||
452 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 467 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
453 | if (avatar == null) | 468 | if (avatar == null) |
454 | return sensedEntities; | 469 | return sensedEntities; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5c528977..2ecc455 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -105,6 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
105 | LSL_Integer llFloor(double f); | 105 | LSL_Integer llFloor(double f); |
106 | void llForceMouselook(int mouselook); | 106 | void llForceMouselook(int mouselook); |
107 | LSL_Float llFrand(double mag); | 107 | LSL_Float llFrand(double mag); |
108 | LSL_Key llGenerateKey(); | ||
108 | LSL_Vector llGetAccel(); | 109 | LSL_Vector llGetAccel(); |
109 | LSL_Integer llGetAgentInfo(string id); | 110 | LSL_Integer llGetAgentInfo(string id); |
110 | LSL_String llGetAgentLanguage(string id); | 111 | LSL_String llGetAgentLanguage(string id); |
@@ -149,7 +150,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
149 | LSL_Rotation llGetLocalRot(); | 150 | LSL_Rotation llGetLocalRot(); |
150 | LSL_Float llGetMass(); | 151 | LSL_Float llGetMass(); |
151 | LSL_Float llGetMassMKS(); | 152 | LSL_Float llGetMassMKS(); |
152 | void llGetNextEmail(string address, string subject); | 153 | LSL_Integer llGetMemoryLimit(); |
154 | void llGetNextEmail(string address, string subject); | ||
153 | LSL_String llGetNotecardLine(string name, int line); | 155 | LSL_String llGetNotecardLine(string name, int line); |
154 | LSL_Key llGetNumberOfNotecardLines(string name); | 156 | LSL_Key llGetNumberOfNotecardLines(string name); |
155 | LSL_Integer llGetNumberOfPrims(); | 157 | LSL_Integer llGetNumberOfPrims(); |
@@ -187,6 +189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
187 | LSL_String llGetScriptName(); | 189 | LSL_String llGetScriptName(); |
188 | LSL_Integer llGetScriptState(string name); | 190 | LSL_Integer llGetScriptState(string name); |
189 | LSL_String llGetSimulatorHostname(); | 191 | LSL_String llGetSimulatorHostname(); |
192 | LSL_Integer llGetSPMaxMemory(); | ||
190 | LSL_Integer llGetStartParameter(); | 193 | LSL_Integer llGetStartParameter(); |
191 | LSL_Integer llGetStatus(int status); | 194 | LSL_Integer llGetStatus(int status); |
192 | LSL_String llGetSubString(string src, int start, int end); | 195 | LSL_String llGetSubString(string src, int start, int end); |
@@ -322,6 +325,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
322 | void llSay(int channelID, string text); | 325 | void llSay(int channelID, string text); |
323 | void llScaleTexture(double u, double v, int face); | 326 | void llScaleTexture(double u, double v, int face); |
324 | LSL_Integer llScriptDanger(LSL_Vector pos); | 327 | LSL_Integer llScriptDanger(LSL_Vector pos); |
328 | void llScriptProfiler(LSL_Integer flag); | ||
325 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); | 329 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); |
326 | void llSensor(string name, string id, int type, double range, double arc); | 330 | void llSensor(string name, string id, int type, double range, double arc); |
327 | void llSensorRemove(); | 331 | void llSensorRemove(); |
@@ -345,6 +349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
345 | void llSetLinkTexture(int linknumber, string texture, int face); | 349 | void llSetLinkTexture(int linknumber, string texture, int face); |
346 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 350 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
347 | void llSetLocalRot(LSL_Rotation rot); | 351 | void llSetLocalRot(LSL_Rotation rot); |
352 | LSL_Integer llSetMemoryLimit(LSL_Integer limit); | ||
348 | void llSetObjectDesc(string desc); | 353 | void llSetObjectDesc(string desc); |
349 | void llSetObjectName(string name); | 354 | void llSetObjectName(string name); |
350 | void llSetObjectPermMask(int mask, int value); | 355 | void llSetObjectPermMask(int mask, int value); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 444a681..7382495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -98,6 +98,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
98 | void osAvatarPlayAnimation(string avatar, string animation); | 98 | void osAvatarPlayAnimation(string avatar, string animation); |
99 | void osAvatarStopAnimation(string avatar, string animation); | 99 | void osAvatarStopAnimation(string avatar, string animation); |
100 | 100 | ||
101 | // Attachment commands | ||
102 | |||
103 | /// <summary> | ||
104 | /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH | ||
105 | /// </summary> | ||
106 | /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param> | ||
107 | void osForceAttachToAvatar(int attachment); | ||
108 | |||
109 | /// <summary> | ||
110 | /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH | ||
111 | /// </summary> | ||
112 | /// <remarks>Nothing happens if the object is not attached.</remarks> | ||
113 | void osForceDetachFromAvatar(); | ||
114 | |||
101 | //texture draw functions | 115 | //texture draw functions |
102 | string osMovePen(string drawList, int x, int y); | 116 | string osMovePen(string drawList, int x, int y); |
103 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); | 117 | string osDrawLine(string drawList, int startX, int startY, int endX, int endY); |
@@ -203,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
203 | void osNpcSetRot(LSL_Key npc, rotation rot); | 217 | void osNpcSetRot(LSL_Key npc, rotation rot); |
204 | void osNpcStopMoveToTarget(LSL_Key npc); | 218 | void osNpcStopMoveToTarget(LSL_Key npc); |
205 | void osNpcSay(key npc, string message); | 219 | void osNpcSay(key npc, string message); |
220 | void osNpcSay(key npc, int channel, string message); | ||
221 | void osNpcShout(key npc, int channel, string message); | ||
206 | void osNpcSit(key npc, key target, int options); | 222 | void osNpcSit(key npc, key target, int options); |
207 | void osNpcStand(LSL_Key npc); | 223 | void osNpcStand(LSL_Key npc); |
208 | void osNpcRemove(key npc); | 224 | void osNpcRemove(key npc); |
209 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 225 | void osNpcPlayAnimation(LSL_Key npc, string animation); |
210 | void osNpcStopAnimation(LSL_Key npc, string animation); | 226 | void osNpcStopAnimation(LSL_Key npc, string animation); |
227 | void osNpcWhisper(key npc, int channel, string message); | ||
211 | 228 | ||
212 | LSL_Key osOwnerSaveAppearance(string notecard); | 229 | LSL_Key osOwnerSaveAppearance(string notecard); |
213 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 230 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); |
@@ -234,5 +251,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
234 | 251 | ||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | 252 | LSL_Integer osInviteToGroup(LSL_Key agentId); |
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | 253 | LSL_Integer osEjectFromGroup(LSL_Key agentId); |
254 | |||
255 | void osSetTerrainTexture(int level, LSL_Key texture); | ||
256 | void osSetTerrainTextureHeight(int corner, double low, double high); | ||
237 | } | 257 | } |
238 | } | 258 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 6246b57..23b4336 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -383,6 +383,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; | 383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; |
384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; | 384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; |
385 | 385 | ||
386 | public const int PROFILE_NONE = 0; | ||
387 | public const int PROFILE_SCRIPT_MEMORY = 1; | ||
388 | |||
386 | public const int MASK_BASE = 0; | 389 | public const int MASK_BASE = 0; |
387 | public const int MASK_OWNER = 1; | 390 | public const int MASK_OWNER = 1; |
388 | public const int MASK_GROUP = 2; | 391 | public const int MASK_GROUP = 2; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 70c5fcd..8db4006 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -376,6 +376,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
376 | return m_LSL_Functions.llFrand(mag); | 376 | return m_LSL_Functions.llFrand(mag); |
377 | } | 377 | } |
378 | 378 | ||
379 | public LSL_Key llGenerateKey() | ||
380 | { | ||
381 | return m_LSL_Functions.llGenerateKey(); | ||
382 | } | ||
383 | |||
379 | public LSL_Vector llGetAccel() | 384 | public LSL_Vector llGetAccel() |
380 | { | 385 | { |
381 | return m_LSL_Functions.llGetAccel(); | 386 | return m_LSL_Functions.llGetAccel(); |
@@ -586,6 +591,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
586 | return m_LSL_Functions.llGetMassMKS(); | 591 | return m_LSL_Functions.llGetMassMKS(); |
587 | } | 592 | } |
588 | 593 | ||
594 | public LSL_Integer llGetMemoryLimit() | ||
595 | { | ||
596 | return m_LSL_Functions.llGetMemoryLimit(); | ||
597 | } | ||
598 | |||
589 | public void llGetNextEmail(string address, string subject) | 599 | public void llGetNextEmail(string address, string subject) |
590 | { | 600 | { |
591 | m_LSL_Functions.llGetNextEmail(address, subject); | 601 | m_LSL_Functions.llGetNextEmail(address, subject); |
@@ -776,6 +786,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
776 | return m_LSL_Functions.llGetSimulatorHostname(); | 786 | return m_LSL_Functions.llGetSimulatorHostname(); |
777 | } | 787 | } |
778 | 788 | ||
789 | public LSL_Integer llGetSPMaxMemory() | ||
790 | { | ||
791 | return m_LSL_Functions.llGetSPMaxMemory(); | ||
792 | } | ||
793 | |||
779 | public LSL_Integer llGetStartParameter() | 794 | public LSL_Integer llGetStartParameter() |
780 | { | 795 | { |
781 | return m_LSL_Functions.llGetStartParameter(); | 796 | return m_LSL_Functions.llGetStartParameter(); |
@@ -1445,6 +1460,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1445 | return m_LSL_Functions.llScriptDanger(pos); | 1460 | return m_LSL_Functions.llScriptDanger(pos); |
1446 | } | 1461 | } |
1447 | 1462 | ||
1463 | public void llScriptProfiler(LSL_Integer flags) | ||
1464 | { | ||
1465 | m_LSL_Functions.llScriptProfiler(flags); | ||
1466 | } | ||
1467 | |||
1448 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) | 1468 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) |
1449 | { | 1469 | { |
1450 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); | 1470 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
@@ -1555,6 +1575,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1555 | m_LSL_Functions.llSetLocalRot(rot); | 1575 | m_LSL_Functions.llSetLocalRot(rot); |
1556 | } | 1576 | } |
1557 | 1577 | ||
1578 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) | ||
1579 | { | ||
1580 | return m_LSL_Functions.llSetMemoryLimit(limit); | ||
1581 | } | ||
1582 | |||
1558 | public void llSetObjectDesc(string desc) | 1583 | public void llSetObjectDesc(string desc) |
1559 | { | 1584 | { |
1560 | m_LSL_Functions.llSetObjectDesc(desc); | 1585 | m_LSL_Functions.llSetObjectDesc(desc); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4..d230662 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -289,8 +289,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
289 | m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); | 289 | m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); |
290 | } | 290 | } |
291 | 291 | ||
292 | // Avatar functions | ||
292 | 293 | ||
293 | //Texture Draw functions | 294 | public void osForceAttachToAvatar(int attachmentPoint) |
295 | { | ||
296 | m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint); | ||
297 | } | ||
298 | |||
299 | public void osForceDetachFromAvatar() | ||
300 | { | ||
301 | m_OSSL_Functions.osForceDetachFromAvatar(); | ||
302 | } | ||
303 | |||
304 | // Texture Draw functions | ||
294 | 305 | ||
295 | public string osMovePen(string drawList, int x, int y) | 306 | public string osMovePen(string drawList, int x, int y) |
296 | { | 307 | { |
@@ -569,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
569 | m_OSSL_Functions.osNpcSay(npc, message); | 580 | m_OSSL_Functions.osNpcSay(npc, message); |
570 | } | 581 | } |
571 | 582 | ||
583 | public void osNpcSay(key npc, int channel, string message) | ||
584 | { | ||
585 | m_OSSL_Functions.osNpcSay(npc, channel, message); | ||
586 | } | ||
587 | |||
588 | |||
589 | public void osNpcShout(key npc, int channel, string message) | ||
590 | { | ||
591 | m_OSSL_Functions.osNpcShout(npc, channel, message); | ||
592 | } | ||
593 | |||
572 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 594 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
573 | { | 595 | { |
574 | m_OSSL_Functions.osNpcSit(npc, target, options); | 596 | m_OSSL_Functions.osNpcSit(npc, target, options); |
@@ -594,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
594 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); | 616 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); |
595 | } | 617 | } |
596 | 618 | ||
619 | public void osNpcWhisper(key npc, int channel, string message) | ||
620 | { | ||
621 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); | ||
622 | } | ||
623 | |||
597 | public LSL_Key osOwnerSaveAppearance(string notecard) | 624 | public LSL_Key osOwnerSaveAppearance(string notecard) |
598 | { | 625 | { |
599 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 626 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |
@@ -878,5 +905,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
878 | { | 905 | { |
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | 906 | return m_OSSL_Functions.osEjectFromGroup(agentId); |
880 | } | 907 | } |
908 | |||
909 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
910 | { | ||
911 | m_OSSL_Functions.osSetTerrainTexture(level, texture); | ||
912 | } | ||
913 | |||
914 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
915 | { | ||
916 | m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); | ||
917 | } | ||
881 | } | 918 | } |
882 | } | 919 | } |