diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 307 |
1 files changed, 88 insertions, 219 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a2176ba..9cb97f9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -85,7 +85,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
85 | protected IScriptEngine m_ScriptEngine; | 85 | protected IScriptEngine m_ScriptEngine; |
86 | protected SceneObjectPart m_host; | 86 | protected SceneObjectPart m_host; |
87 | protected uint m_localID; | 87 | protected uint m_localID; |
88 | |||
89 | /// <summary> | ||
90 | /// The UUID of the item that hosts this script | ||
91 | /// </summary> | ||
88 | protected UUID m_itemID; | 92 | protected UUID m_itemID; |
93 | |||
89 | protected bool throwErrorOnNotImplemented = true; | 94 | protected bool throwErrorOnNotImplemented = true; |
90 | protected AsyncCommandManager AsyncCommands = null; | 95 | protected AsyncCommandManager AsyncCommands = null; |
91 | protected float m_ScriptDelayFactor = 1.0f; | 96 | protected float m_ScriptDelayFactor = 1.0f; |
@@ -267,23 +272,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
267 | } | 272 | } |
268 | } | 273 | } |
269 | 274 | ||
270 | protected UUID InventorySelf() | 275 | /// <summary> |
276 | /// Get the inventory item that hosts ourselves. | ||
277 | /// </summary> | ||
278 | /// <remarks> | ||
279 | /// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need | ||
280 | /// to keep looking ourselves up. | ||
281 | /// </remarks> | ||
282 | /// <returns></returns> | ||
283 | protected TaskInventoryItem GetSelfInventoryItem() | ||
271 | { | 284 | { |
272 | UUID invItemID = new UUID(); | ||
273 | |||
274 | lock (m_host.TaskInventory) | 285 | lock (m_host.TaskInventory) |
275 | { | 286 | return m_host.TaskInventory[m_itemID]; |
276 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
277 | { | ||
278 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | ||
279 | { | ||
280 | invItemID = inv.Key; | ||
281 | break; | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 | return invItemID; | ||
287 | } | 287 | } |
288 | 288 | ||
289 | protected UUID InventoryKey(string name, int type) | 289 | protected UUID InventoryKey(string name, int type) |
@@ -2701,18 +2701,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2701 | 2701 | ||
2702 | public LSL_Integer llGiveMoney(string destination, int amount) | 2702 | public LSL_Integer llGiveMoney(string destination, int amount) |
2703 | { | 2703 | { |
2704 | UUID invItemID=InventorySelf(); | ||
2705 | if (invItemID == UUID.Zero) | ||
2706 | return 0; | ||
2707 | |||
2708 | m_host.AddScriptLPS(1); | 2704 | m_host.AddScriptLPS(1); |
2709 | 2705 | ||
2710 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | 2706 | TaskInventoryItem item = GetSelfInventoryItem(); |
2711 | |||
2712 | lock (m_host.TaskInventory) | ||
2713 | { | ||
2714 | item = m_host.TaskInventory[invItemID]; | ||
2715 | } | ||
2716 | 2707 | ||
2717 | if (item.PermsGranter == UUID.Zero) | 2708 | if (item.PermsGranter == UUID.Zero) |
2718 | return 0; | 2709 | return 0; |
@@ -2955,15 +2946,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2955 | 2946 | ||
2956 | public void llTakeControls(int controls, int accept, int pass_on) | 2947 | public void llTakeControls(int controls, int accept, int pass_on) |
2957 | { | 2948 | { |
2958 | TaskInventoryItem item; | 2949 | TaskInventoryItem item = GetSelfInventoryItem(); |
2959 | |||
2960 | lock (m_host.TaskInventory) | ||
2961 | { | ||
2962 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2963 | return; | ||
2964 | else | ||
2965 | item = m_host.TaskInventory[InventorySelf()]; | ||
2966 | } | ||
2967 | 2950 | ||
2968 | if (item.PermsGranter != UUID.Zero) | 2951 | if (item.PermsGranter != UUID.Zero) |
2969 | { | 2952 | { |
@@ -2983,18 +2966,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2983 | 2966 | ||
2984 | public void llReleaseControls() | 2967 | public void llReleaseControls() |
2985 | { | 2968 | { |
2986 | TaskInventoryItem item; | ||
2987 | |||
2988 | lock (m_host.TaskInventory) | ||
2989 | { | ||
2990 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2991 | return; | ||
2992 | else | ||
2993 | item = m_host.TaskInventory[InventorySelf()]; | ||
2994 | } | ||
2995 | |||
2996 | m_host.AddScriptLPS(1); | 2969 | m_host.AddScriptLPS(1); |
2997 | 2970 | ||
2971 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
2972 | |||
2998 | if (item.PermsGranter != UUID.Zero) | 2973 | if (item.PermsGranter != UUID.Zero) |
2999 | { | 2974 | { |
3000 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 2975 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); |
@@ -3026,15 +3001,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3026 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) | 3001 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) |
3027 | // return; | 3002 | // return; |
3028 | 3003 | ||
3029 | TaskInventoryItem item; | 3004 | TaskInventoryItem item = GetSelfInventoryItem(); |
3030 | |||
3031 | lock (m_host.TaskInventory) | ||
3032 | { | ||
3033 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3034 | return; | ||
3035 | else | ||
3036 | item = m_host.TaskInventory[InventorySelf()]; | ||
3037 | } | ||
3038 | 3005 | ||
3039 | if (item.PermsGranter != m_host.OwnerID) | 3006 | if (item.PermsGranter != m_host.OwnerID) |
3040 | return; | 3007 | return; |
@@ -3058,15 +3025,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3058 | if (m_host.ParentGroup.AttachmentPoint == 0) | 3025 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3059 | return; | 3026 | return; |
3060 | 3027 | ||
3061 | TaskInventoryItem item; | 3028 | TaskInventoryItem item = GetSelfInventoryItem(); |
3062 | |||
3063 | lock (m_host.TaskInventory) | ||
3064 | { | ||
3065 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3066 | return; | ||
3067 | else | ||
3068 | item = m_host.TaskInventory[InventorySelf()]; | ||
3069 | } | ||
3070 | 3029 | ||
3071 | if (item.PermsGranter != m_host.OwnerID) | 3030 | if (item.PermsGranter != m_host.OwnerID) |
3072 | return; | 3031 | return; |
@@ -3317,19 +3276,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3317 | { | 3276 | { |
3318 | m_host.AddScriptLPS(1); | 3277 | m_host.AddScriptLPS(1); |
3319 | 3278 | ||
3320 | UUID invItemID = InventorySelf(); | 3279 | TaskInventoryItem item = GetSelfInventoryItem(); |
3321 | if (invItemID == UUID.Zero) | ||
3322 | return; | ||
3323 | |||
3324 | TaskInventoryItem item; | ||
3325 | |||
3326 | lock (m_host.TaskInventory) | ||
3327 | { | ||
3328 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3329 | return; | ||
3330 | else | ||
3331 | item = m_host.TaskInventory[InventorySelf()]; | ||
3332 | } | ||
3333 | 3280 | ||
3334 | if (item.PermsGranter == UUID.Zero) | 3281 | if (item.PermsGranter == UUID.Zero) |
3335 | return; | 3282 | return; |
@@ -3354,19 +3301,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3354 | { | 3301 | { |
3355 | m_host.AddScriptLPS(1); | 3302 | m_host.AddScriptLPS(1); |
3356 | 3303 | ||
3357 | UUID invItemID=InventorySelf(); | 3304 | TaskInventoryItem item = GetSelfInventoryItem(); |
3358 | if (invItemID == UUID.Zero) | ||
3359 | return; | ||
3360 | |||
3361 | TaskInventoryItem item; | ||
3362 | |||
3363 | lock (m_host.TaskInventory) | ||
3364 | { | ||
3365 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3366 | return; | ||
3367 | else | ||
3368 | item = m_host.TaskInventory[InventorySelf()]; | ||
3369 | } | ||
3370 | 3305 | ||
3371 | if (item.PermsGranter == UUID.Zero) | 3306 | if (item.PermsGranter == UUID.Zero) |
3372 | return; | 3307 | return; |
@@ -3421,22 +3356,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3421 | 3356 | ||
3422 | public void llRequestPermissions(string agent, int perm) | 3357 | public void llRequestPermissions(string agent, int perm) |
3423 | { | 3358 | { |
3424 | UUID agentID = new UUID(); | 3359 | UUID agentID; |
3425 | 3360 | ||
3426 | if (!UUID.TryParse(agent, out agentID)) | 3361 | if (!UUID.TryParse(agent, out agentID)) |
3427 | return; | 3362 | return; |
3428 | 3363 | ||
3429 | UUID invItemID = InventorySelf(); | 3364 | TaskInventoryItem item = GetSelfInventoryItem(); |
3430 | |||
3431 | if (invItemID == UUID.Zero) | ||
3432 | return; // Not in a prim? How?? | ||
3433 | |||
3434 | TaskInventoryItem item; | ||
3435 | |||
3436 | lock (m_host.TaskInventory) | ||
3437 | { | ||
3438 | item = m_host.TaskInventory[invItemID]; | ||
3439 | } | ||
3440 | 3365 | ||
3441 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3366 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3442 | { | 3367 | { |
@@ -3470,8 +3395,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3470 | { | 3395 | { |
3471 | lock (m_host.TaskInventory) | 3396 | lock (m_host.TaskInventory) |
3472 | { | 3397 | { |
3473 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3398 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3474 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3399 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3475 | } | 3400 | } |
3476 | 3401 | ||
3477 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3402 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3494,8 +3419,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3494 | { | 3419 | { |
3495 | lock (m_host.TaskInventory) | 3420 | lock (m_host.TaskInventory) |
3496 | { | 3421 | { |
3497 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3422 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3498 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3423 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3499 | } | 3424 | } |
3500 | 3425 | ||
3501 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3426 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3519,8 +3444,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3519 | { | 3444 | { |
3520 | lock (m_host.TaskInventory) | 3445 | lock (m_host.TaskInventory) |
3521 | { | 3446 | { |
3522 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3447 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3523 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3448 | m_host.TaskInventory[m_itemID].PermsMask = 0; |
3524 | } | 3449 | } |
3525 | 3450 | ||
3526 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3451 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
@@ -3528,7 +3453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3528 | } | 3453 | } |
3529 | 3454 | ||
3530 | presence.ControllingClient.SendScriptQuestion( | 3455 | presence.ControllingClient.SendScriptQuestion( |
3531 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3456 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); |
3532 | 3457 | ||
3533 | return; | 3458 | return; |
3534 | } | 3459 | } |
@@ -3545,20 +3470,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3545 | if (taskID != m_host.UUID) | 3470 | if (taskID != m_host.UUID) |
3546 | return; | 3471 | return; |
3547 | 3472 | ||
3548 | UUID invItemID = InventorySelf(); | 3473 | client.OnScriptAnswer -= handleScriptAnswer; |
3549 | 3474 | m_waitingForScriptAnswer = false; | |
3550 | if (invItemID == UUID.Zero) | ||
3551 | return; | ||
3552 | |||
3553 | client.OnScriptAnswer-=handleScriptAnswer; | ||
3554 | m_waitingForScriptAnswer=false; | ||
3555 | 3475 | ||
3556 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3476 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3557 | llReleaseControls(); | 3477 | llReleaseControls(); |
3558 | 3478 | ||
3559 | lock (m_host.TaskInventory) | 3479 | lock (m_host.TaskInventory) |
3560 | { | 3480 | { |
3561 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3481 | m_host.TaskInventory[m_itemID].PermsMask = answer; |
3562 | } | 3482 | } |
3563 | 3483 | ||
3564 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3484 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3571,39 +3491,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3571 | { | 3491 | { |
3572 | m_host.AddScriptLPS(1); | 3492 | m_host.AddScriptLPS(1); |
3573 | 3493 | ||
3574 | lock (m_host.TaskInventory) | 3494 | return GetSelfInventoryItem().PermsGranter.ToString(); |
3575 | { | ||
3576 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3577 | { | ||
3578 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3579 | { | ||
3580 | return item.PermsGranter.ToString(); | ||
3581 | } | ||
3582 | } | ||
3583 | } | ||
3584 | |||
3585 | return UUID.Zero.ToString(); | ||
3586 | } | 3495 | } |
3587 | 3496 | ||
3588 | public LSL_Integer llGetPermissions() | 3497 | public LSL_Integer llGetPermissions() |
3589 | { | 3498 | { |
3590 | m_host.AddScriptLPS(1); | 3499 | m_host.AddScriptLPS(1); |
3591 | 3500 | ||
3592 | lock (m_host.TaskInventory) | 3501 | int perms = GetSelfInventoryItem().PermsMask; |
3593 | { | ||
3594 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3595 | { | ||
3596 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3597 | { | ||
3598 | int perms = item.PermsMask; | ||
3599 | if (m_automaticLinkPermission) | ||
3600 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3601 | return perms; | ||
3602 | } | ||
3603 | } | ||
3604 | } | ||
3605 | 3502 | ||
3606 | return 0; | 3503 | if (m_automaticLinkPermission) |
3504 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3505 | |||
3506 | return perms; | ||
3607 | } | 3507 | } |
3608 | 3508 | ||
3609 | public LSL_Integer llGetLinkNumber() | 3509 | public LSL_Integer llGetLinkNumber() |
@@ -3631,17 +3531,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3631 | public void llCreateLink(string target, int parent) | 3531 | public void llCreateLink(string target, int parent) |
3632 | { | 3532 | { |
3633 | m_host.AddScriptLPS(1); | 3533 | m_host.AddScriptLPS(1); |
3634 | UUID invItemID = InventorySelf(); | 3534 | |
3635 | UUID targetID; | 3535 | UUID targetID; |
3636 | 3536 | ||
3637 | if (!UUID.TryParse(target, out targetID)) | 3537 | if (!UUID.TryParse(target, out targetID)) |
3638 | return; | 3538 | return; |
3639 | 3539 | ||
3640 | TaskInventoryItem item; | 3540 | TaskInventoryItem item = GetSelfInventoryItem(); |
3641 | lock (m_host.TaskInventory) | ||
3642 | { | ||
3643 | item = m_host.TaskInventory[invItemID]; | ||
3644 | } | ||
3645 | 3541 | ||
3646 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3542 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3647 | && !m_automaticLinkPermission) | 3543 | && !m_automaticLinkPermission) |
@@ -3692,16 +3588,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3692 | public void llBreakLink(int linknum) | 3588 | public void llBreakLink(int linknum) |
3693 | { | 3589 | { |
3694 | m_host.AddScriptLPS(1); | 3590 | m_host.AddScriptLPS(1); |
3695 | UUID invItemID = InventorySelf(); | ||
3696 | 3591 | ||
3697 | lock (m_host.TaskInventory) | 3592 | if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3593 | && !m_automaticLinkPermission) | ||
3698 | { | 3594 | { |
3699 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3595 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
3700 | && !m_automaticLinkPermission) | 3596 | return; |
3701 | { | ||
3702 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | ||
3703 | return; | ||
3704 | } | ||
3705 | } | 3597 | } |
3706 | 3598 | ||
3707 | if (linknum < ScriptBaseClass.LINK_THIS) | 3599 | if (linknum < ScriptBaseClass.LINK_THIS) |
@@ -4578,23 +4470,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4578 | 4470 | ||
4579 | public LSL_String llGetScriptName() | 4471 | public LSL_String llGetScriptName() |
4580 | { | 4472 | { |
4581 | string result = String.Empty; | ||
4582 | |||
4583 | m_host.AddScriptLPS(1); | 4473 | m_host.AddScriptLPS(1); |
4584 | 4474 | ||
4585 | lock (m_host.TaskInventory) | 4475 | TaskInventoryItem item = GetSelfInventoryItem(); |
4586 | { | ||
4587 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
4588 | { | ||
4589 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
4590 | { | ||
4591 | result = item.Name != null ? item.Name : String.Empty; | ||
4592 | break; | ||
4593 | } | ||
4594 | } | ||
4595 | } | ||
4596 | 4476 | ||
4597 | return result; | 4477 | return item.Name != null ? item.Name : String.Empty; |
4598 | } | 4478 | } |
4599 | 4479 | ||
4600 | public LSL_Integer llGetLinkNumberOfSides(int link) | 4480 | public LSL_Integer llGetLinkNumberOfSides(int link) |
@@ -9695,21 +9575,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9695 | public LSL_Vector llGetCameraPos() | 9575 | public LSL_Vector llGetCameraPos() |
9696 | { | 9576 | { |
9697 | m_host.AddScriptLPS(1); | 9577 | m_host.AddScriptLPS(1); |
9698 | UUID invItemID = InventorySelf(); | ||
9699 | 9578 | ||
9700 | if (invItemID == UUID.Zero) | 9579 | TaskInventoryItem item = GetSelfInventoryItem(); |
9701 | return new LSL_Vector(); | ||
9702 | 9580 | ||
9703 | lock (m_host.TaskInventory) | 9581 | if (item.PermsGranter == UUID.Zero) |
9704 | { | 9582 | return new LSL_Vector(); |
9705 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
9706 | return new LSL_Vector(); | ||
9707 | 9583 | ||
9708 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9584 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
9709 | { | 9585 | { |
9710 | ShoutError("No permissions to track the camera"); | 9586 | ShoutError("No permissions to track the camera"); |
9711 | return new LSL_Vector(); | 9587 | return new LSL_Vector(); |
9712 | } | ||
9713 | } | 9588 | } |
9714 | 9589 | ||
9715 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9590 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
@@ -9724,20 +9599,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9724 | public LSL_Rotation llGetCameraRot() | 9599 | public LSL_Rotation llGetCameraRot() |
9725 | { | 9600 | { |
9726 | m_host.AddScriptLPS(1); | 9601 | m_host.AddScriptLPS(1); |
9727 | UUID invItemID = InventorySelf(); | ||
9728 | if (invItemID == UUID.Zero) | ||
9729 | return new LSL_Rotation(); | ||
9730 | 9602 | ||
9731 | lock (m_host.TaskInventory) | 9603 | TaskInventoryItem item = GetSelfInventoryItem(); |
9732 | { | ||
9733 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
9734 | return new LSL_Rotation(); | ||
9735 | 9604 | ||
9736 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9605 | if (item.PermsGranter == UUID.Zero) |
9737 | { | 9606 | return new LSL_Rotation(); |
9738 | ShoutError("No permissions to track the camera"); | 9607 | |
9739 | return new LSL_Rotation(); | 9608 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
9740 | } | 9609 | { |
9610 | ShoutError("No permissions to track the camera"); | ||
9611 | return new LSL_Rotation(); | ||
9741 | } | 9612 | } |
9742 | 9613 | ||
9743 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9614 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
@@ -9911,23 +9782,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9911 | { | 9782 | { |
9912 | m_host.AddScriptLPS(1); | 9783 | m_host.AddScriptLPS(1); |
9913 | 9784 | ||
9914 | // our key in the object we are in | ||
9915 | UUID invItemID = InventorySelf(); | ||
9916 | if (invItemID == UUID.Zero) return; | ||
9917 | |||
9918 | // the object we are in | 9785 | // the object we are in |
9919 | UUID objectID = m_host.ParentUUID; | 9786 | UUID objectID = m_host.ParentUUID; |
9920 | if (objectID == UUID.Zero) return; | 9787 | if (objectID == UUID.Zero) |
9788 | return; | ||
9921 | 9789 | ||
9922 | UUID agentID; | 9790 | TaskInventoryItem item = GetSelfInventoryItem(); |
9923 | lock (m_host.TaskInventory) | ||
9924 | { | ||
9925 | // we need the permission first, to know which avatar we want to set the camera for | ||
9926 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
9927 | 9791 | ||
9928 | if (agentID == UUID.Zero) return; | 9792 | // we need the permission first, to know which avatar we want to set the camera for |
9929 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 9793 | UUID agentID = item.PermsGranter; |
9930 | } | 9794 | |
9795 | if (agentID == UUID.Zero) | ||
9796 | return; | ||
9797 | |||
9798 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | ||
9799 | return; | ||
9931 | 9800 | ||
9932 | ScenePresence presence = World.GetScenePresence(agentID); | 9801 | ScenePresence presence = World.GetScenePresence(agentID); |
9933 | 9802 | ||
@@ -9967,27 +9836,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9967 | { | 9836 | { |
9968 | m_host.AddScriptLPS(1); | 9837 | m_host.AddScriptLPS(1); |
9969 | 9838 | ||
9970 | // our key in the object we are in | ||
9971 | UUID invItemID=InventorySelf(); | ||
9972 | if (invItemID == UUID.Zero) return; | ||
9973 | |||
9974 | // the object we are in | 9839 | // the object we are in |
9975 | UUID objectID = m_host.ParentUUID; | 9840 | UUID objectID = m_host.ParentUUID; |
9976 | if (objectID == UUID.Zero) return; | 9841 | if (objectID == UUID.Zero) |
9842 | return; | ||
9843 | |||
9844 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
9977 | 9845 | ||
9978 | // we need the permission first, to know which avatar we want to clear the camera for | 9846 | // we need the permission first, to know which avatar we want to clear the camera for |
9979 | UUID agentID; | 9847 | UUID agentID = item.PermsGranter; |
9980 | lock (m_host.TaskInventory) | 9848 | |
9981 | { | 9849 | if (agentID == UUID.Zero) |
9982 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 9850 | return; |
9983 | if (agentID == UUID.Zero) return; | 9851 | |
9984 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 9852 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
9985 | } | 9853 | return; |
9986 | 9854 | ||
9987 | ScenePresence presence = World.GetScenePresence(agentID); | 9855 | ScenePresence presence = World.GetScenePresence(agentID); |
9988 | 9856 | ||
9989 | // we are not interested in child-agents | 9857 | // we are not interested in child-agents |
9990 | if (presence.IsChildAgent) return; | 9858 | if (presence.IsChildAgent) |
9859 | return; | ||
9991 | 9860 | ||
9992 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 9861 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
9993 | } | 9862 | } |