diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
7 files changed, 235 insertions, 278 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 36c9d5e..d4c872c 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) |
@@ -839,13 +839,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
839 | 839 | ||
840 | m_host.AddScriptLPS(1); | 840 | m_host.AddScriptLPS(1); |
841 | 841 | ||
842 | if (channel == ScriptBaseClass.DEBUG_CHANNEL) | ||
843 | { | ||
844 | return; | ||
845 | } | ||
846 | |||
842 | UUID TargetID; | 847 | UUID TargetID; |
843 | UUID.TryParse(target, out TargetID); | 848 | UUID.TryParse(target, out TargetID); |
844 | 849 | ||
845 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 850 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
846 | if (wComm != null) | 851 | if (wComm != null) |
847 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) | 852 | wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); |
848 | LSLError(error); | ||
849 | } | 853 | } |
850 | 854 | ||
851 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 855 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |
@@ -2697,18 +2701,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2697 | 2701 | ||
2698 | public LSL_Integer llGiveMoney(string destination, int amount) | 2702 | public LSL_Integer llGiveMoney(string destination, int amount) |
2699 | { | 2703 | { |
2700 | UUID invItemID=InventorySelf(); | ||
2701 | if (invItemID == UUID.Zero) | ||
2702 | return 0; | ||
2703 | |||
2704 | m_host.AddScriptLPS(1); | 2704 | m_host.AddScriptLPS(1); |
2705 | 2705 | ||
2706 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | 2706 | TaskInventoryItem item = GetSelfInventoryItem(); |
2707 | |||
2708 | lock (m_host.TaskInventory) | ||
2709 | { | ||
2710 | item = m_host.TaskInventory[invItemID]; | ||
2711 | } | ||
2712 | 2707 | ||
2713 | if (item.PermsGranter == UUID.Zero) | 2708 | if (item.PermsGranter == UUID.Zero) |
2714 | return 0; | 2709 | return 0; |
@@ -2951,15 +2946,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2951 | 2946 | ||
2952 | public void llTakeControls(int controls, int accept, int pass_on) | 2947 | public void llTakeControls(int controls, int accept, int pass_on) |
2953 | { | 2948 | { |
2954 | TaskInventoryItem item; | 2949 | TaskInventoryItem item = GetSelfInventoryItem(); |
2955 | |||
2956 | lock (m_host.TaskInventory) | ||
2957 | { | ||
2958 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2959 | return; | ||
2960 | else | ||
2961 | item = m_host.TaskInventory[InventorySelf()]; | ||
2962 | } | ||
2963 | 2950 | ||
2964 | if (item.PermsGranter != UUID.Zero) | 2951 | if (item.PermsGranter != UUID.Zero) |
2965 | { | 2952 | { |
@@ -2979,18 +2966,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2979 | 2966 | ||
2980 | public void llReleaseControls() | 2967 | public void llReleaseControls() |
2981 | { | 2968 | { |
2982 | TaskInventoryItem item; | ||
2983 | |||
2984 | lock (m_host.TaskInventory) | ||
2985 | { | ||
2986 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
2987 | return; | ||
2988 | else | ||
2989 | item = m_host.TaskInventory[InventorySelf()]; | ||
2990 | } | ||
2991 | |||
2992 | m_host.AddScriptLPS(1); | 2969 | m_host.AddScriptLPS(1); |
2993 | 2970 | ||
2971 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
2972 | |||
2994 | if (item.PermsGranter != UUID.Zero) | 2973 | if (item.PermsGranter != UUID.Zero) |
2995 | { | 2974 | { |
2996 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 2975 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); |
@@ -3015,36 +2994,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3015 | m_UrlModule.ReleaseURL(url); | 2994 | m_UrlModule.ReleaseURL(url); |
3016 | } | 2995 | } |
3017 | 2996 | ||
3018 | public void llAttachToAvatar(int attachment) | 2997 | /// <summary> |
2998 | /// Attach the object containing this script to the avatar that owns it. | ||
2999 | /// </summary> | ||
3000 | /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> | ||
3001 | /// <returns>true if the attach suceeded, false if it did not</returns> | ||
3002 | public bool AttachToAvatar(int attachmentPoint) | ||
3003 | { | ||
3004 | SceneObjectGroup grp = m_host.ParentGroup; | ||
3005 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | ||
3006 | |||
3007 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3008 | |||
3009 | if (attachmentsModule != null) | ||
3010 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); | ||
3011 | else | ||
3012 | return false; | ||
3013 | } | ||
3014 | |||
3015 | /// <summary> | ||
3016 | /// Detach the object containing this script from the avatar it is attached to. | ||
3017 | /// </summary> | ||
3018 | /// <remarks> | ||
3019 | /// Nothing happens if the object is not attached. | ||
3020 | /// </remarks> | ||
3021 | public void DetachFromAvatar() | ||
3022 | { | ||
3023 | Util.FireAndForget(DetachWrapper, m_host); | ||
3024 | } | ||
3025 | |||
3026 | private void DetachWrapper(object o) | ||
3027 | { | ||
3028 | SceneObjectPart host = (SceneObjectPart)o; | ||
3029 | |||
3030 | SceneObjectGroup grp = host.ParentGroup; | ||
3031 | UUID itemID = grp.FromItemID; | ||
3032 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3033 | |||
3034 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3035 | if (attachmentsModule != null) | ||
3036 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); | ||
3037 | } | ||
3038 | |||
3039 | public void llAttachToAvatar(int attachmentPoint) | ||
3019 | { | 3040 | { |
3020 | m_host.AddScriptLPS(1); | 3041 | m_host.AddScriptLPS(1); |
3021 | 3042 | ||
3022 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) | 3043 | // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) |
3023 | // return; | 3044 | // return; |
3024 | 3045 | ||
3025 | TaskInventoryItem item; | 3046 | TaskInventoryItem item = GetSelfInventoryItem(); |
3026 | |||
3027 | lock (m_host.TaskInventory) | ||
3028 | { | ||
3029 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3030 | return; | ||
3031 | else | ||
3032 | item = m_host.TaskInventory[InventorySelf()]; | ||
3033 | } | ||
3034 | 3047 | ||
3035 | if (item.PermsGranter != m_host.OwnerID) | 3048 | if (item.PermsGranter != m_host.OwnerID) |
3036 | return; | 3049 | return; |
3037 | 3050 | ||
3038 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3051 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3039 | { | 3052 | AttachToAvatar(attachmentPoint); |
3040 | SceneObjectGroup grp = m_host.ParentGroup; | ||
3041 | |||
3042 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | ||
3043 | |||
3044 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3045 | if (attachmentsModule != null) | ||
3046 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); | ||
3047 | } | ||
3048 | } | 3053 | } |
3049 | 3054 | ||
3050 | public void llDetachFromAvatar() | 3055 | public void llDetachFromAvatar() |
@@ -3054,38 +3059,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3054 | if (m_host.ParentGroup.AttachmentPoint == 0) | 3059 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3055 | return; | 3060 | return; |
3056 | 3061 | ||
3057 | TaskInventoryItem item; | 3062 | TaskInventoryItem item = GetSelfInventoryItem(); |
3058 | |||
3059 | lock (m_host.TaskInventory) | ||
3060 | { | ||
3061 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3062 | return; | ||
3063 | else | ||
3064 | item = m_host.TaskInventory[InventorySelf()]; | ||
3065 | } | ||
3066 | 3063 | ||
3067 | if (item.PermsGranter != m_host.OwnerID) | 3064 | if (item.PermsGranter != m_host.OwnerID) |
3068 | return; | 3065 | return; |
3069 | 3066 | ||
3070 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3067 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3071 | { | 3068 | DetachFromAvatar(); |
3072 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3073 | if (attachmentsModule != null) | ||
3074 | Util.FireAndForget(DetachWrapper, m_host); | ||
3075 | } | ||
3076 | } | ||
3077 | |||
3078 | private void DetachWrapper(object o) | ||
3079 | { | ||
3080 | SceneObjectPart host = (SceneObjectPart)o; | ||
3081 | |||
3082 | SceneObjectGroup grp = host.ParentGroup; | ||
3083 | UUID itemID = grp.FromItemID; | ||
3084 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3085 | |||
3086 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3087 | if (attachmentsModule != null) | ||
3088 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); | ||
3089 | } | 3069 | } |
3090 | 3070 | ||
3091 | public void llTakeCamera(string avatar) | 3071 | public void llTakeCamera(string avatar) |
@@ -3313,19 +3293,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3313 | { | 3293 | { |
3314 | m_host.AddScriptLPS(1); | 3294 | m_host.AddScriptLPS(1); |
3315 | 3295 | ||
3316 | UUID invItemID = InventorySelf(); | 3296 | TaskInventoryItem item = GetSelfInventoryItem(); |
3317 | if (invItemID == UUID.Zero) | ||
3318 | return; | ||
3319 | |||
3320 | TaskInventoryItem item; | ||
3321 | |||
3322 | lock (m_host.TaskInventory) | ||
3323 | { | ||
3324 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3325 | return; | ||
3326 | else | ||
3327 | item = m_host.TaskInventory[InventorySelf()]; | ||
3328 | } | ||
3329 | 3297 | ||
3330 | if (item.PermsGranter == UUID.Zero) | 3298 | if (item.PermsGranter == UUID.Zero) |
3331 | return; | 3299 | return; |
@@ -3350,19 +3318,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3350 | { | 3318 | { |
3351 | m_host.AddScriptLPS(1); | 3319 | m_host.AddScriptLPS(1); |
3352 | 3320 | ||
3353 | UUID invItemID=InventorySelf(); | 3321 | TaskInventoryItem item = GetSelfInventoryItem(); |
3354 | if (invItemID == UUID.Zero) | ||
3355 | return; | ||
3356 | |||
3357 | TaskInventoryItem item; | ||
3358 | |||
3359 | lock (m_host.TaskInventory) | ||
3360 | { | ||
3361 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3362 | return; | ||
3363 | else | ||
3364 | item = m_host.TaskInventory[InventorySelf()]; | ||
3365 | } | ||
3366 | 3322 | ||
3367 | if (item.PermsGranter == UUID.Zero) | 3323 | if (item.PermsGranter == UUID.Zero) |
3368 | return; | 3324 | return; |
@@ -3417,22 +3373,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3417 | 3373 | ||
3418 | public void llRequestPermissions(string agent, int perm) | 3374 | public void llRequestPermissions(string agent, int perm) |
3419 | { | 3375 | { |
3420 | UUID agentID = new UUID(); | 3376 | UUID agentID; |
3421 | 3377 | ||
3422 | if (!UUID.TryParse(agent, out agentID)) | 3378 | if (!UUID.TryParse(agent, out agentID)) |
3423 | return; | 3379 | return; |
3424 | 3380 | ||
3425 | UUID invItemID = InventorySelf(); | 3381 | TaskInventoryItem item = GetSelfInventoryItem(); |
3426 | |||
3427 | if (invItemID == UUID.Zero) | ||
3428 | return; // Not in a prim? How?? | ||
3429 | |||
3430 | TaskInventoryItem item; | ||
3431 | |||
3432 | lock (m_host.TaskInventory) | ||
3433 | { | ||
3434 | item = m_host.TaskInventory[invItemID]; | ||
3435 | } | ||
3436 | 3382 | ||
3437 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3383 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3438 | { | 3384 | { |
@@ -3466,8 +3412,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3466 | { | 3412 | { |
3467 | lock (m_host.TaskInventory) | 3413 | lock (m_host.TaskInventory) |
3468 | { | 3414 | { |
3469 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3415 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3470 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3416 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3471 | } | 3417 | } |
3472 | 3418 | ||
3473 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3419 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3490,8 +3436,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3490 | { | 3436 | { |
3491 | lock (m_host.TaskInventory) | 3437 | lock (m_host.TaskInventory) |
3492 | { | 3438 | { |
3493 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3439 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3494 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3440 | m_host.TaskInventory[m_itemID].PermsMask = perm; |
3495 | } | 3441 | } |
3496 | 3442 | ||
3497 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3443 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3515,8 +3461,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3515 | { | 3461 | { |
3516 | lock (m_host.TaskInventory) | 3462 | lock (m_host.TaskInventory) |
3517 | { | 3463 | { |
3518 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3464 | m_host.TaskInventory[m_itemID].PermsGranter = agentID; |
3519 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3465 | m_host.TaskInventory[m_itemID].PermsMask = 0; |
3520 | } | 3466 | } |
3521 | 3467 | ||
3522 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3468 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
@@ -3524,7 +3470,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3524 | } | 3470 | } |
3525 | 3471 | ||
3526 | presence.ControllingClient.SendScriptQuestion( | 3472 | presence.ControllingClient.SendScriptQuestion( |
3527 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3473 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); |
3528 | 3474 | ||
3529 | return; | 3475 | return; |
3530 | } | 3476 | } |
@@ -3541,20 +3487,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3541 | if (taskID != m_host.UUID) | 3487 | if (taskID != m_host.UUID) |
3542 | return; | 3488 | return; |
3543 | 3489 | ||
3544 | UUID invItemID = InventorySelf(); | 3490 | client.OnScriptAnswer -= handleScriptAnswer; |
3545 | 3491 | m_waitingForScriptAnswer = false; | |
3546 | if (invItemID == UUID.Zero) | ||
3547 | return; | ||
3548 | |||
3549 | client.OnScriptAnswer-=handleScriptAnswer; | ||
3550 | m_waitingForScriptAnswer=false; | ||
3551 | 3492 | ||
3552 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3493 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3553 | llReleaseControls(); | 3494 | llReleaseControls(); |
3554 | 3495 | ||
3555 | lock (m_host.TaskInventory) | 3496 | lock (m_host.TaskInventory) |
3556 | { | 3497 | { |
3557 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3498 | m_host.TaskInventory[m_itemID].PermsMask = answer; |
3558 | } | 3499 | } |
3559 | 3500 | ||
3560 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3501 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( |
@@ -3567,39 +3508,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3567 | { | 3508 | { |
3568 | m_host.AddScriptLPS(1); | 3509 | m_host.AddScriptLPS(1); |
3569 | 3510 | ||
3570 | lock (m_host.TaskInventory) | 3511 | return GetSelfInventoryItem().PermsGranter.ToString(); |
3571 | { | ||
3572 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3573 | { | ||
3574 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3575 | { | ||
3576 | return item.PermsGranter.ToString(); | ||
3577 | } | ||
3578 | } | ||
3579 | } | ||
3580 | |||
3581 | return UUID.Zero.ToString(); | ||
3582 | } | 3512 | } |
3583 | 3513 | ||
3584 | public LSL_Integer llGetPermissions() | 3514 | public LSL_Integer llGetPermissions() |
3585 | { | 3515 | { |
3586 | m_host.AddScriptLPS(1); | 3516 | m_host.AddScriptLPS(1); |
3587 | 3517 | ||
3588 | lock (m_host.TaskInventory) | 3518 | int perms = GetSelfInventoryItem().PermsMask; |
3589 | { | ||
3590 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3591 | { | ||
3592 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3593 | { | ||
3594 | int perms = item.PermsMask; | ||
3595 | if (m_automaticLinkPermission) | ||
3596 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3597 | return perms; | ||
3598 | } | ||
3599 | } | ||
3600 | } | ||
3601 | 3519 | ||
3602 | return 0; | 3520 | if (m_automaticLinkPermission) |
3521 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3522 | |||
3523 | return perms; | ||
3603 | } | 3524 | } |
3604 | 3525 | ||
3605 | public LSL_Integer llGetLinkNumber() | 3526 | public LSL_Integer llGetLinkNumber() |
@@ -3627,17 +3548,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3627 | public void llCreateLink(string target, int parent) | 3548 | public void llCreateLink(string target, int parent) |
3628 | { | 3549 | { |
3629 | m_host.AddScriptLPS(1); | 3550 | m_host.AddScriptLPS(1); |
3630 | UUID invItemID = InventorySelf(); | 3551 | |
3631 | UUID targetID; | 3552 | UUID targetID; |
3632 | 3553 | ||
3633 | if (!UUID.TryParse(target, out targetID)) | 3554 | if (!UUID.TryParse(target, out targetID)) |
3634 | return; | 3555 | return; |
3635 | 3556 | ||
3636 | TaskInventoryItem item; | 3557 | TaskInventoryItem item = GetSelfInventoryItem(); |
3637 | lock (m_host.TaskInventory) | ||
3638 | { | ||
3639 | item = m_host.TaskInventory[invItemID]; | ||
3640 | } | ||
3641 | 3558 | ||
3642 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3559 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3643 | && !m_automaticLinkPermission) | 3560 | && !m_automaticLinkPermission) |
@@ -3688,16 +3605,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3688 | public void llBreakLink(int linknum) | 3605 | public void llBreakLink(int linknum) |
3689 | { | 3606 | { |
3690 | m_host.AddScriptLPS(1); | 3607 | m_host.AddScriptLPS(1); |
3691 | UUID invItemID = InventorySelf(); | ||
3692 | 3608 | ||
3693 | lock (m_host.TaskInventory) | 3609 | if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3610 | && !m_automaticLinkPermission) | ||
3694 | { | 3611 | { |
3695 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3612 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
3696 | && !m_automaticLinkPermission) | 3613 | return; |
3697 | { | ||
3698 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | ||
3699 | return; | ||
3700 | } | ||
3701 | } | 3614 | } |
3702 | 3615 | ||
3703 | if (linknum < ScriptBaseClass.LINK_THIS) | 3616 | if (linknum < ScriptBaseClass.LINK_THIS) |
@@ -4574,23 +4487,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4574 | 4487 | ||
4575 | public LSL_String llGetScriptName() | 4488 | public LSL_String llGetScriptName() |
4576 | { | 4489 | { |
4577 | string result = String.Empty; | ||
4578 | |||
4579 | m_host.AddScriptLPS(1); | 4490 | m_host.AddScriptLPS(1); |
4580 | 4491 | ||
4581 | lock (m_host.TaskInventory) | 4492 | TaskInventoryItem item = GetSelfInventoryItem(); |
4582 | { | ||
4583 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
4584 | { | ||
4585 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
4586 | { | ||
4587 | result = item.Name != null ? item.Name : String.Empty; | ||
4588 | break; | ||
4589 | } | ||
4590 | } | ||
4591 | } | ||
4592 | 4493 | ||
4593 | return result; | 4494 | return item.Name != null ? item.Name : String.Empty; |
4594 | } | 4495 | } |
4595 | 4496 | ||
4596 | public LSL_Integer llGetLinkNumberOfSides(int link) | 4497 | public LSL_Integer llGetLinkNumberOfSides(int link) |
@@ -9691,21 +9592,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9691 | public LSL_Vector llGetCameraPos() | 9592 | public LSL_Vector llGetCameraPos() |
9692 | { | 9593 | { |
9693 | m_host.AddScriptLPS(1); | 9594 | m_host.AddScriptLPS(1); |
9694 | UUID invItemID = InventorySelf(); | ||
9695 | 9595 | ||
9696 | if (invItemID == UUID.Zero) | 9596 | TaskInventoryItem item = GetSelfInventoryItem(); |
9697 | return new LSL_Vector(); | ||
9698 | 9597 | ||
9699 | lock (m_host.TaskInventory) | 9598 | if (item.PermsGranter == UUID.Zero) |
9700 | { | 9599 | return new LSL_Vector(); |
9701 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
9702 | return new LSL_Vector(); | ||
9703 | 9600 | ||
9704 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9601 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
9705 | { | 9602 | { |
9706 | ShoutError("No permissions to track the camera"); | 9603 | ShoutError("No permissions to track the camera"); |
9707 | return new LSL_Vector(); | 9604 | return new LSL_Vector(); |
9708 | } | ||
9709 | } | 9605 | } |
9710 | 9606 | ||
9711 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9607 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
@@ -9720,20 +9616,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9720 | public LSL_Rotation llGetCameraRot() | 9616 | public LSL_Rotation llGetCameraRot() |
9721 | { | 9617 | { |
9722 | m_host.AddScriptLPS(1); | 9618 | m_host.AddScriptLPS(1); |
9723 | UUID invItemID = InventorySelf(); | ||
9724 | if (invItemID == UUID.Zero) | ||
9725 | return new LSL_Rotation(); | ||
9726 | 9619 | ||
9727 | lock (m_host.TaskInventory) | 9620 | TaskInventoryItem item = GetSelfInventoryItem(); |
9728 | { | ||
9729 | if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | ||
9730 | return new LSL_Rotation(); | ||
9731 | 9621 | ||
9732 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 9622 | if (item.PermsGranter == UUID.Zero) |
9733 | { | 9623 | return new LSL_Rotation(); |
9734 | ShoutError("No permissions to track the camera"); | 9624 | |
9735 | return new LSL_Rotation(); | 9625 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
9736 | } | 9626 | { |
9627 | ShoutError("No permissions to track the camera"); | ||
9628 | return new LSL_Rotation(); | ||
9737 | } | 9629 | } |
9738 | 9630 | ||
9739 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 9631 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
@@ -9907,23 +9799,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9907 | { | 9799 | { |
9908 | m_host.AddScriptLPS(1); | 9800 | m_host.AddScriptLPS(1); |
9909 | 9801 | ||
9910 | // our key in the object we are in | ||
9911 | UUID invItemID = InventorySelf(); | ||
9912 | if (invItemID == UUID.Zero) return; | ||
9913 | |||
9914 | // the object we are in | 9802 | // the object we are in |
9915 | UUID objectID = m_host.ParentUUID; | 9803 | UUID objectID = m_host.ParentUUID; |
9916 | if (objectID == UUID.Zero) return; | 9804 | if (objectID == UUID.Zero) |
9805 | return; | ||
9917 | 9806 | ||
9918 | UUID agentID; | 9807 | TaskInventoryItem item = GetSelfInventoryItem(); |
9919 | lock (m_host.TaskInventory) | ||
9920 | { | ||
9921 | // we need the permission first, to know which avatar we want to set the camera for | ||
9922 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
9923 | 9808 | ||
9924 | if (agentID == UUID.Zero) return; | 9809 | // we need the permission first, to know which avatar we want to set the camera for |
9925 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 9810 | UUID agentID = item.PermsGranter; |
9926 | } | 9811 | |
9812 | if (agentID == UUID.Zero) | ||
9813 | return; | ||
9814 | |||
9815 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | ||
9816 | return; | ||
9927 | 9817 | ||
9928 | ScenePresence presence = World.GetScenePresence(agentID); | 9818 | ScenePresence presence = World.GetScenePresence(agentID); |
9929 | 9819 | ||
@@ -9963,27 +9853,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9963 | { | 9853 | { |
9964 | m_host.AddScriptLPS(1); | 9854 | m_host.AddScriptLPS(1); |
9965 | 9855 | ||
9966 | // our key in the object we are in | ||
9967 | UUID invItemID=InventorySelf(); | ||
9968 | if (invItemID == UUID.Zero) return; | ||
9969 | |||
9970 | // the object we are in | 9856 | // the object we are in |
9971 | UUID objectID = m_host.ParentUUID; | 9857 | UUID objectID = m_host.ParentUUID; |
9972 | if (objectID == UUID.Zero) return; | 9858 | if (objectID == UUID.Zero) |
9859 | return; | ||
9860 | |||
9861 | TaskInventoryItem item = GetSelfInventoryItem(); | ||
9973 | 9862 | ||
9974 | // we need the permission first, to know which avatar we want to clear the camera for | 9863 | // we need the permission first, to know which avatar we want to clear the camera for |
9975 | UUID agentID; | 9864 | UUID agentID = item.PermsGranter; |
9976 | lock (m_host.TaskInventory) | 9865 | |
9977 | { | 9866 | if (agentID == UUID.Zero) |
9978 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 9867 | return; |
9979 | if (agentID == UUID.Zero) return; | 9868 | |
9980 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; | 9869 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
9981 | } | 9870 | return; |
9982 | 9871 | ||
9983 | ScenePresence presence = World.GetScenePresence(agentID); | 9872 | ScenePresence presence = World.GetScenePresence(agentID); |
9984 | 9873 | ||
9985 | // we are not interested in child-agents | 9874 | // we are not interested in child-agents |
9986 | if (presence.IsChildAgent) return; | 9875 | if (presence.IsChildAgent) |
9876 | return; | ||
9987 | 9877 | ||
9988 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 9878 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
9989 | } | 9879 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fe94b79..7fc7337 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -209,6 +209,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
209 | throw new Exception("OSSL Runtime Error: " + msg); | 209 | throw new Exception("OSSL Runtime Error: " + msg); |
210 | } | 210 | } |
211 | 211 | ||
212 | /// <summary> | ||
213 | /// Initialize the LSL interface. | ||
214 | /// </summary> | ||
215 | /// <remarks> | ||
216 | /// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no | ||
217 | /// guarantee the interface is present on Initialize(). There needs to be another post initialize call from | ||
218 | /// ScriptInstance. | ||
219 | /// </remarks> | ||
212 | private void InitLSL() | 220 | private void InitLSL() |
213 | { | 221 | { |
214 | if (m_LSL_Api != null) | 222 | if (m_LSL_Api != null) |
@@ -1609,7 +1617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1609 | 1617 | ||
1610 | public Object osParseJSONNew(string JSON) | 1618 | public Object osParseJSONNew(string JSON) |
1611 | { | 1619 | { |
1612 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1620 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1613 | 1621 | ||
1614 | m_host.AddScriptLPS(1); | 1622 | m_host.AddScriptLPS(1); |
1615 | 1623 | ||
@@ -3093,5 +3101,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3093 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | 3101 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); |
3094 | } | 3102 | } |
3095 | } | 3103 | } |
3104 | |||
3105 | public void osForceAttachToAvatar(int attachmentPoint) | ||
3106 | { | ||
3107 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); | ||
3108 | |||
3109 | m_host.AddScriptLPS(1); | ||
3110 | |||
3111 | InitLSL(); | ||
3112 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); | ||
3113 | } | ||
3114 | |||
3115 | public void osForceDetachFromAvatar() | ||
3116 | { | ||
3117 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); | ||
3118 | |||
3119 | m_host.AddScriptLPS(1); | ||
3120 | |||
3121 | InitLSL(); | ||
3122 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); | ||
3123 | } | ||
3096 | } | 3124 | } |
3097 | } \ No newline at end of file | 3125 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 545bbee..d0c852b 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); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index b94b9bf..36ac0e3 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 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 6e36742..2c8af81 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -964,7 +964,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
964 | public IScriptApi GetApi(string name) | 964 | public IScriptApi GetApi(string name) |
965 | { | 965 | { |
966 | if (m_Apis.ContainsKey(name)) | 966 | if (m_Apis.ContainsKey(name)) |
967 | { | ||
968 | // m_log.DebugFormat("[SCRIPT INSTANCE]: Found api {0} in {1}@{2}", name, ScriptName, PrimName); | ||
969 | |||
967 | return m_Apis[name]; | 970 | return m_Apis[name]; |
971 | } | ||
972 | |||
973 | // m_log.DebugFormat("[SCRIPT INSTANCE]: Did not find api {0} in {1}@{2}", name, ScriptName, PrimName); | ||
974 | |||
968 | return null; | 975 | return null; |
969 | } | 976 | } |
970 | 977 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b7903d5..a9b6e67 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1021,11 +1021,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1021 | 1021 | ||
1022 | AppDomain sandbox; | 1022 | AppDomain sandbox; |
1023 | if (m_AppDomainLoading) | 1023 | if (m_AppDomainLoading) |
1024 | { | ||
1024 | sandbox = AppDomain.CreateDomain( | 1025 | sandbox = AppDomain.CreateDomain( |
1025 | m_Scene.RegionInfo.RegionID.ToString(), | 1026 | m_Scene.RegionInfo.RegionID.ToString(), |
1026 | evidence, appSetup); | 1027 | evidence, appSetup); |
1028 | sandbox.AssemblyResolve += | ||
1029 | new ResolveEventHandler( | ||
1030 | AssemblyResolver.OnAssemblyResolve); | ||
1031 | } | ||
1027 | else | 1032 | else |
1033 | { | ||
1028 | sandbox = AppDomain.CurrentDomain; | 1034 | sandbox = AppDomain.CurrentDomain; |
1035 | } | ||
1029 | 1036 | ||
1030 | //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); | 1037 | //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); |
1031 | //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); | 1038 | //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); |
@@ -1037,9 +1044,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1037 | 1044 | ||
1038 | m_AppDomains[appDomain] = sandbox; | 1045 | m_AppDomains[appDomain] = sandbox; |
1039 | 1046 | ||
1040 | m_AppDomains[appDomain].AssemblyResolve += | ||
1041 | new ResolveEventHandler( | ||
1042 | AssemblyResolver.OnAssemblyResolve); | ||
1043 | m_DomainScripts[appDomain] = new List<UUID>(); | 1047 | m_DomainScripts[appDomain] = new List<UUID>(); |
1044 | } | 1048 | } |
1045 | catch (Exception e) | 1049 | catch (Exception e) |
@@ -1808,9 +1812,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1808 | // if there already exists a file at that location, it may be locked. | 1812 | // if there already exists a file at that location, it may be locked. |
1809 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | 1813 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); |
1810 | } | 1814 | } |
1815 | |||
1816 | string textpath = path + ".text"; | ||
1811 | try | 1817 | try |
1812 | { | 1818 | { |
1813 | using (FileStream fs = File.Create(path + ".text")) | 1819 | using (FileStream fs = File.Create(textpath)) |
1814 | { | 1820 | { |
1815 | using (StreamWriter sw = new StreamWriter(fs)) | 1821 | using (StreamWriter sw = new StreamWriter(fs)) |
1816 | { | 1822 | { |
@@ -1823,7 +1829,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1823 | catch (IOException ex) | 1829 | catch (IOException ex) |
1824 | { | 1830 | { |
1825 | // if there already exists a file at that location, it may be locked. | 1831 | // if there already exists a file at that location, it may be locked. |
1826 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message); | 1832 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message); |
1827 | } | 1833 | } |
1828 | } | 1834 | } |
1829 | } | 1835 | } |
@@ -1872,7 +1878,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1872 | catch (IOException ex) | 1878 | catch (IOException ex) |
1873 | { | 1879 | { |
1874 | // if there already exists a file at that location, it may be locked. | 1880 | // if there already exists a file at that location, it may be locked. |
1875 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message); | 1881 | m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message); |
1876 | } | 1882 | } |
1877 | } | 1883 | } |
1878 | 1884 | ||
@@ -1984,4 +1990,4 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1984 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); | 1990 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); |
1985 | } | 1991 | } |
1986 | } | 1992 | } |
1987 | } \ No newline at end of file | 1993 | } |