diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
12 files changed, 681 insertions, 666 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/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index 489c1c6..b5fa6de 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -59,16 +59,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
59 | { | 59 | { |
60 | internal IScriptEngine m_ScriptEngine; | 60 | internal IScriptEngine m_ScriptEngine; |
61 | internal SceneObjectPart m_host; | 61 | internal SceneObjectPart m_host; |
62 | internal uint m_localID; | 62 | internal TaskInventoryItem m_item; |
63 | internal UUID m_itemID; | ||
64 | internal bool m_CMFunctionsEnabled = false; | 63 | internal bool m_CMFunctionsEnabled = false; |
65 | 64 | ||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
67 | { | 66 | { |
68 | m_ScriptEngine = ScriptEngine; | 67 | m_ScriptEngine = ScriptEngine; |
69 | m_host = host; | 68 | m_host = host; |
70 | m_localID = localID; | 69 | m_item = item; |
71 | m_itemID = itemID; | ||
72 | 70 | ||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | 71 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) |
74 | m_CMFunctionsEnabled = true; | 72 | m_CMFunctionsEnabled = true; |
@@ -95,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
95 | public string cmDetectedCountry(int number) | 93 | public string cmDetectedCountry(int number) |
96 | { | 94 | { |
97 | m_host.AddScriptLPS(1); | 95 | m_host.AddScriptLPS(1); |
98 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 96 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
99 | if (detectedParams == null) | 97 | if (detectedParams == null) |
100 | return String.Empty; | 98 | return String.Empty; |
101 | return detectedParams.Country; | 99 | return detectedParams.Country; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index eb68038..03f4108 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -88,8 +88,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
88 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 88 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
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 | |
92 | protected UUID m_itemID; | 92 | /// <summary> |
93 | /// The item that hosts this script | ||
94 | /// </summary> | ||
95 | protected TaskInventoryItem m_item; | ||
96 | |||
93 | protected bool throwErrorOnNotImplemented = true; | 97 | protected bool throwErrorOnNotImplemented = true; |
94 | protected AsyncCommandManager AsyncCommands = null; | 98 | protected AsyncCommandManager AsyncCommands = null; |
95 | protected float m_ScriptDelayFactor = 1.0f; | 99 | protected float m_ScriptDelayFactor = 1.0f; |
@@ -107,11 +111,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
107 | protected IUrlModule m_UrlModule = null; | 111 | protected IUrlModule m_UrlModule = null; |
108 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | 112 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = |
109 | new Dictionary<UUID, UserInfoCacheEntry>(); | 113 | new Dictionary<UUID, UserInfoCacheEntry>(); |
114 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | ||
110 | 115 | ||
111 | protected Timer m_ShoutSayTimer; | 116 | protected Timer m_ShoutSayTimer; |
112 | protected int m_SayShoutCount = 0; | 117 | protected int m_SayShoutCount = 0; |
113 | 118 | ||
114 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 119 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
115 | { | 120 | { |
116 | m_ShoutSayTimer = new Timer(1000); | 121 | m_ShoutSayTimer = new Timer(1000); |
117 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; | 122 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; |
@@ -120,10 +125,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
120 | 125 | ||
121 | m_ScriptEngine = ScriptEngine; | 126 | m_ScriptEngine = ScriptEngine; |
122 | m_host = host; | 127 | m_host = host; |
123 | m_localID = localID; | 128 | m_item = item; |
124 | m_itemID = itemID; | ||
125 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 129 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
126 | 130 | ||
131 | LoadLimits(); // read script limits from config. | ||
132 | |||
133 | m_TransferModule = | ||
134 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | ||
135 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | ||
136 | |||
137 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | ||
138 | } | ||
139 | |||
140 | /* load configuration items that affect script, object and run-time behavior. */ | ||
141 | private void LoadLimits() | ||
142 | { | ||
127 | m_ScriptDelayFactor = | 143 | m_ScriptDelayFactor = |
128 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); | 144 | m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); |
129 | m_ScriptDistanceFactor = | 145 | m_ScriptDistanceFactor = |
@@ -136,12 +152,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
136 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 152 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
137 | if (m_notecardLineReadCharsMax > 65535) | 153 | if (m_notecardLineReadCharsMax > 65535) |
138 | m_notecardLineReadCharsMax = 65535; | 154 | m_notecardLineReadCharsMax = 65535; |
139 | 155 | // load limits for particular subsystems. | |
140 | m_TransferModule = | 156 | IConfig SMTPConfig; |
141 | m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); | 157 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
142 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 158 | // there's an smtp config, so load in the snooze time. |
143 | 159 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | |
144 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 160 | } |
145 | } | 161 | } |
146 | 162 | ||
147 | public override Object InitializeLifetimeService() | 163 | public override Object InitializeLifetimeService() |
@@ -173,7 +189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
173 | [DebuggerNonUserCode] | 189 | [DebuggerNonUserCode] |
174 | public void state(string newState) | 190 | public void state(string newState) |
175 | { | 191 | { |
176 | m_ScriptEngine.SetState(m_itemID, newState); | 192 | m_ScriptEngine.SetState(m_item.ItemID, newState); |
177 | } | 193 | } |
178 | 194 | ||
179 | /// <summary> | 195 | /// <summary> |
@@ -184,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
184 | public void llResetScript() | 200 | public void llResetScript() |
185 | { | 201 | { |
186 | m_host.AddScriptLPS(1); | 202 | m_host.AddScriptLPS(1); |
187 | m_ScriptEngine.ApiResetScript(m_itemID); | 203 | m_ScriptEngine.ApiResetScript(m_item.ItemID); |
188 | } | 204 | } |
189 | 205 | ||
190 | public void llResetOtherScript(string name) | 206 | public void llResetOtherScript(string name) |
@@ -336,77 +352,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
336 | } | 352 | } |
337 | } | 353 | } |
338 | 354 | ||
339 | protected UUID InventorySelf() | ||
340 | { | ||
341 | UUID invItemID = new UUID(); | ||
342 | bool unlock = false; | ||
343 | if (!m_host.TaskInventory.IsReadLockedByMe()) | ||
344 | { | ||
345 | m_host.TaskInventory.LockItemsForRead(true); | ||
346 | unlock = true; | ||
347 | } | ||
348 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
349 | { | ||
350 | if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) | ||
351 | { | ||
352 | invItemID = inv.Key; | ||
353 | break; | ||
354 | } | ||
355 | } | ||
356 | if (unlock) | ||
357 | { | ||
358 | m_host.TaskInventory.LockItemsForRead(false); | ||
359 | } | ||
360 | return invItemID; | ||
361 | } | ||
362 | |||
363 | protected UUID InventoryKey(string name, int type) | 355 | protected UUID InventoryKey(string name, int type) |
364 | { | 356 | { |
365 | m_host.AddScriptLPS(1); | 357 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); |
366 | m_host.TaskInventory.LockItemsForRead(true); | ||
367 | |||
368 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
369 | { | ||
370 | if (inv.Value.Name == name) | ||
371 | { | ||
372 | m_host.TaskInventory.LockItemsForRead(false); | ||
373 | |||
374 | if (inv.Value.Type != type) | ||
375 | { | ||
376 | return UUID.Zero; | ||
377 | } | ||
378 | |||
379 | return inv.Value.AssetID; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | m_host.TaskInventory.LockItemsForRead(false); | ||
384 | return UUID.Zero; | ||
385 | } | ||
386 | |||
387 | protected UUID InventoryKey(string name) | ||
388 | { | ||
389 | m_host.AddScriptLPS(1); | ||
390 | 358 | ||
391 | 359 | if (item != null && item.Type == type) | |
392 | m_host.TaskInventory.LockItemsForRead(true); | 360 | return item.AssetID; |
393 | 361 | else | |
394 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 362 | return UUID.Zero; |
395 | { | ||
396 | if (inv.Value.Name == name) | ||
397 | { | ||
398 | m_host.TaskInventory.LockItemsForRead(false); | ||
399 | return inv.Value.AssetID; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | m_host.TaskInventory.LockItemsForRead(false); | ||
404 | |||
405 | |||
406 | return UUID.Zero; | ||
407 | } | 363 | } |
408 | 364 | ||
409 | |||
410 | /// <summary> | 365 | /// <summary> |
411 | /// accepts a valid UUID, -or- a name of an inventory item. | 366 | /// accepts a valid UUID, -or- a name of an inventory item. |
412 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found | 367 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found |
@@ -416,19 +371,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
416 | /// <returns></returns> | 371 | /// <returns></returns> |
417 | protected UUID KeyOrName(string k) | 372 | protected UUID KeyOrName(string k) |
418 | { | 373 | { |
419 | UUID key = UUID.Zero; | 374 | UUID key; |
420 | 375 | ||
421 | // if we can parse the string as a key, use it. | 376 | // if we can parse the string as a key, use it. |
422 | if (UUID.TryParse(k, out key)) | ||
423 | { | ||
424 | return key; | ||
425 | } | ||
426 | // else try to locate the name in inventory of object. found returns key, | 377 | // else try to locate the name in inventory of object. found returns key, |
427 | // not found returns UUID.Zero which will translate to the default particle texture | 378 | // not found returns UUID.Zero |
428 | else | 379 | if (!UUID.TryParse(k, out key)) |
429 | { | 380 | { |
430 | return InventoryKey(k); | 381 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); |
382 | |||
383 | if (item != null) | ||
384 | key = item.AssetID; | ||
385 | else | ||
386 | key = UUID.Zero; | ||
431 | } | 387 | } |
388 | |||
389 | return key; | ||
432 | } | 390 | } |
433 | 391 | ||
434 | // convert a LSL_Rotation to a Quaternion | 392 | // convert a LSL_Rotation to a Quaternion |
@@ -941,20 +899,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
941 | 899 | ||
942 | public void llRegionSayTo(string target, int channel, string msg) | 900 | public void llRegionSayTo(string target, int channel, string msg) |
943 | { | 901 | { |
944 | string error = String.Empty; | ||
945 | |||
946 | if (msg.Length > 1023) | 902 | if (msg.Length > 1023) |
947 | msg = msg.Substring(0, 1023); | 903 | msg = msg.Substring(0, 1023); |
948 | 904 | ||
949 | m_host.AddScriptLPS(1); | 905 | m_host.AddScriptLPS(1); |
950 | 906 | ||
907 | if (channel == ScriptBaseClass.DEBUG_CHANNEL) | ||
908 | { | ||
909 | return; | ||
910 | } | ||
911 | |||
951 | UUID TargetID; | 912 | UUID TargetID; |
952 | UUID.TryParse(target, out TargetID); | 913 | UUID.TryParse(target, out TargetID); |
953 | 914 | ||
954 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 915 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
955 | if (wComm != null) | 916 | if (wComm != null) |
956 | if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) | 917 | wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); |
957 | LSLError(error); | ||
958 | } | 918 | } |
959 | 919 | ||
960 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) | 920 | public LSL_Integer llListen(int channelID, string name, string ID, string msg) |
@@ -964,7 +924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
964 | UUID.TryParse(ID, out keyID); | 924 | UUID.TryParse(ID, out keyID); |
965 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 925 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
966 | if (wComm != null) | 926 | if (wComm != null) |
967 | return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); | 927 | return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); |
968 | else | 928 | else |
969 | return -1; | 929 | return -1; |
970 | } | 930 | } |
@@ -974,7 +934,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
974 | m_host.AddScriptLPS(1); | 934 | m_host.AddScriptLPS(1); |
975 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 935 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
976 | if (wComm != null) | 936 | if (wComm != null) |
977 | wComm.ListenControl(m_itemID, number, active); | 937 | wComm.ListenControl(m_item.ItemID, number, active); |
978 | } | 938 | } |
979 | 939 | ||
980 | public void llListenRemove(int number) | 940 | public void llListenRemove(int number) |
@@ -982,7 +942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
982 | m_host.AddScriptLPS(1); | 942 | m_host.AddScriptLPS(1); |
983 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 943 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
984 | if (wComm != null) | 944 | if (wComm != null) |
985 | wComm.ListenRemove(m_itemID, number); | 945 | wComm.ListenRemove(m_item.ItemID, number); |
986 | } | 946 | } |
987 | 947 | ||
988 | public void llSensor(string name, string id, int type, double range, double arc) | 948 | public void llSensor(string name, string id, int type, double range, double arc) |
@@ -991,7 +951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
991 | UUID keyID = UUID.Zero; | 951 | UUID keyID = UUID.Zero; |
992 | UUID.TryParse(id, out keyID); | 952 | UUID.TryParse(id, out keyID); |
993 | 953 | ||
994 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); | 954 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host); |
995 | } | 955 | } |
996 | 956 | ||
997 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | 957 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) |
@@ -1000,13 +960,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1000 | UUID keyID = UUID.Zero; | 960 | UUID keyID = UUID.Zero; |
1001 | UUID.TryParse(id, out keyID); | 961 | UUID.TryParse(id, out keyID); |
1002 | 962 | ||
1003 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); | 963 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); |
1004 | } | 964 | } |
1005 | 965 | ||
1006 | public void llSensorRemove() | 966 | public void llSensorRemove() |
1007 | { | 967 | { |
1008 | m_host.AddScriptLPS(1); | 968 | m_host.AddScriptLPS(1); |
1009 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID); | 969 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID); |
1010 | } | 970 | } |
1011 | 971 | ||
1012 | public string resolveName(UUID objecUUID) | 972 | public string resolveName(UUID objecUUID) |
@@ -1047,7 +1007,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1047 | public LSL_String llDetectedName(int number) | 1007 | public LSL_String llDetectedName(int number) |
1048 | { | 1008 | { |
1049 | m_host.AddScriptLPS(1); | 1009 | m_host.AddScriptLPS(1); |
1050 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1010 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1051 | if (detectedParams == null) | 1011 | if (detectedParams == null) |
1052 | return String.Empty; | 1012 | return String.Empty; |
1053 | return detectedParams.Name; | 1013 | return detectedParams.Name; |
@@ -1056,7 +1016,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1056 | public LSL_String llDetectedKey(int number) | 1016 | public LSL_String llDetectedKey(int number) |
1057 | { | 1017 | { |
1058 | m_host.AddScriptLPS(1); | 1018 | m_host.AddScriptLPS(1); |
1059 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1019 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1060 | if (detectedParams == null) | 1020 | if (detectedParams == null) |
1061 | return String.Empty; | 1021 | return String.Empty; |
1062 | return detectedParams.Key.ToString(); | 1022 | return detectedParams.Key.ToString(); |
@@ -1065,7 +1025,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1065 | public LSL_String llDetectedOwner(int number) | 1025 | public LSL_String llDetectedOwner(int number) |
1066 | { | 1026 | { |
1067 | m_host.AddScriptLPS(1); | 1027 | m_host.AddScriptLPS(1); |
1068 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1028 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1069 | if (detectedParams == null) | 1029 | if (detectedParams == null) |
1070 | return String.Empty; | 1030 | return String.Empty; |
1071 | return detectedParams.Owner.ToString(); | 1031 | return detectedParams.Owner.ToString(); |
@@ -1074,7 +1034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1074 | public LSL_Integer llDetectedType(int number) | 1034 | public LSL_Integer llDetectedType(int number) |
1075 | { | 1035 | { |
1076 | m_host.AddScriptLPS(1); | 1036 | m_host.AddScriptLPS(1); |
1077 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1037 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1078 | if (detectedParams == null) | 1038 | if (detectedParams == null) |
1079 | return 0; | 1039 | return 0; |
1080 | return new LSL_Integer(detectedParams.Type); | 1040 | return new LSL_Integer(detectedParams.Type); |
@@ -1083,7 +1043,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1083 | public LSL_Vector llDetectedPos(int number) | 1043 | public LSL_Vector llDetectedPos(int number) |
1084 | { | 1044 | { |
1085 | m_host.AddScriptLPS(1); | 1045 | m_host.AddScriptLPS(1); |
1086 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1046 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1087 | if (detectedParams == null) | 1047 | if (detectedParams == null) |
1088 | return new LSL_Vector(); | 1048 | return new LSL_Vector(); |
1089 | return detectedParams.Position; | 1049 | return detectedParams.Position; |
@@ -1092,7 +1052,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1092 | public LSL_Vector llDetectedVel(int number) | 1052 | public LSL_Vector llDetectedVel(int number) |
1093 | { | 1053 | { |
1094 | m_host.AddScriptLPS(1); | 1054 | m_host.AddScriptLPS(1); |
1095 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1055 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1096 | if (detectedParams == null) | 1056 | if (detectedParams == null) |
1097 | return new LSL_Vector(); | 1057 | return new LSL_Vector(); |
1098 | return detectedParams.Velocity; | 1058 | return detectedParams.Velocity; |
@@ -1101,7 +1061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1101 | public LSL_Vector llDetectedGrab(int number) | 1061 | public LSL_Vector llDetectedGrab(int number) |
1102 | { | 1062 | { |
1103 | m_host.AddScriptLPS(1); | 1063 | m_host.AddScriptLPS(1); |
1104 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1064 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1105 | if (parms == null) | 1065 | if (parms == null) |
1106 | return new LSL_Vector(0, 0, 0); | 1066 | return new LSL_Vector(0, 0, 0); |
1107 | 1067 | ||
@@ -1111,7 +1071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1111 | public LSL_Rotation llDetectedRot(int number) | 1071 | public LSL_Rotation llDetectedRot(int number) |
1112 | { | 1072 | { |
1113 | m_host.AddScriptLPS(1); | 1073 | m_host.AddScriptLPS(1); |
1114 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1074 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1115 | if (detectedParams == null) | 1075 | if (detectedParams == null) |
1116 | return new LSL_Rotation(); | 1076 | return new LSL_Rotation(); |
1117 | return detectedParams.Rotation; | 1077 | return detectedParams.Rotation; |
@@ -1120,7 +1080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1120 | public LSL_Integer llDetectedGroup(int number) | 1080 | public LSL_Integer llDetectedGroup(int number) |
1121 | { | 1081 | { |
1122 | m_host.AddScriptLPS(1); | 1082 | m_host.AddScriptLPS(1); |
1123 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1083 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1124 | if (detectedParams == null) | 1084 | if (detectedParams == null) |
1125 | return new LSL_Integer(0); | 1085 | return new LSL_Integer(0); |
1126 | if (m_host.GroupID == detectedParams.Group) | 1086 | if (m_host.GroupID == detectedParams.Group) |
@@ -1131,7 +1091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1131 | public LSL_Integer llDetectedLinkNumber(int number) | 1091 | public LSL_Integer llDetectedLinkNumber(int number) |
1132 | { | 1092 | { |
1133 | m_host.AddScriptLPS(1); | 1093 | m_host.AddScriptLPS(1); |
1134 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); | 1094 | DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
1135 | if (parms == null) | 1095 | if (parms == null) |
1136 | return new LSL_Integer(0); | 1096 | return new LSL_Integer(0); |
1137 | 1097 | ||
@@ -1144,7 +1104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1144 | public LSL_Vector llDetectedTouchBinormal(int index) | 1104 | public LSL_Vector llDetectedTouchBinormal(int index) |
1145 | { | 1105 | { |
1146 | m_host.AddScriptLPS(1); | 1106 | m_host.AddScriptLPS(1); |
1147 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1107 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1148 | if (detectedParams == null) | 1108 | if (detectedParams == null) |
1149 | return new LSL_Vector(); | 1109 | return new LSL_Vector(); |
1150 | return detectedParams.TouchBinormal; | 1110 | return detectedParams.TouchBinormal; |
@@ -1156,7 +1116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1156 | public LSL_Integer llDetectedTouchFace(int index) | 1116 | public LSL_Integer llDetectedTouchFace(int index) |
1157 | { | 1117 | { |
1158 | m_host.AddScriptLPS(1); | 1118 | m_host.AddScriptLPS(1); |
1159 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1119 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1160 | if (detectedParams == null) | 1120 | if (detectedParams == null) |
1161 | return new LSL_Integer(-1); | 1121 | return new LSL_Integer(-1); |
1162 | return new LSL_Integer(detectedParams.TouchFace); | 1122 | return new LSL_Integer(detectedParams.TouchFace); |
@@ -1168,7 +1128,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1168 | public LSL_Vector llDetectedTouchNormal(int index) | 1128 | public LSL_Vector llDetectedTouchNormal(int index) |
1169 | { | 1129 | { |
1170 | m_host.AddScriptLPS(1); | 1130 | m_host.AddScriptLPS(1); |
1171 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1131 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1172 | if (detectedParams == null) | 1132 | if (detectedParams == null) |
1173 | return new LSL_Vector(); | 1133 | return new LSL_Vector(); |
1174 | return detectedParams.TouchNormal; | 1134 | return detectedParams.TouchNormal; |
@@ -1180,7 +1140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1180 | public LSL_Vector llDetectedTouchPos(int index) | 1140 | public LSL_Vector llDetectedTouchPos(int index) |
1181 | { | 1141 | { |
1182 | m_host.AddScriptLPS(1); | 1142 | m_host.AddScriptLPS(1); |
1183 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1143 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1184 | if (detectedParams == null) | 1144 | if (detectedParams == null) |
1185 | return new LSL_Vector(); | 1145 | return new LSL_Vector(); |
1186 | return detectedParams.TouchPos; | 1146 | return detectedParams.TouchPos; |
@@ -1192,7 +1152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1192 | public LSL_Vector llDetectedTouchST(int index) | 1152 | public LSL_Vector llDetectedTouchST(int index) |
1193 | { | 1153 | { |
1194 | m_host.AddScriptLPS(1); | 1154 | m_host.AddScriptLPS(1); |
1195 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1155 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1196 | if (detectedParams == null) | 1156 | if (detectedParams == null) |
1197 | return new LSL_Vector(-1.0, -1.0, 0.0); | 1157 | return new LSL_Vector(-1.0, -1.0, 0.0); |
1198 | return detectedParams.TouchST; | 1158 | return detectedParams.TouchST; |
@@ -1204,7 +1164,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1204 | public LSL_Vector llDetectedTouchUV(int index) | 1164 | public LSL_Vector llDetectedTouchUV(int index) |
1205 | { | 1165 | { |
1206 | m_host.AddScriptLPS(1); | 1166 | m_host.AddScriptLPS(1); |
1207 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); | 1167 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); |
1208 | if (detectedParams == null) | 1168 | if (detectedParams == null) |
1209 | return new LSL_Vector(-1.0, -1.0, 0.0); | 1169 | return new LSL_Vector(-1.0, -1.0, 0.0); |
1210 | return detectedParams.TouchUV; | 1170 | return detectedParams.TouchUV; |
@@ -1903,12 +1863,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1903 | 1863 | ||
1904 | return rgb; | 1864 | return rgb; |
1905 | } | 1865 | } |
1866 | |||
1906 | if (face >= 0 && face < GetNumberOfSides(part)) | 1867 | if (face >= 0 && face < GetNumberOfSides(part)) |
1907 | { | 1868 | { |
1908 | texcolor = tex.GetFace((uint)face).RGBA; | 1869 | texcolor = tex.GetFace((uint)face).RGBA; |
1909 | rgb.x = texcolor.R; | 1870 | rgb.x = texcolor.R; |
1910 | rgb.y = texcolor.G; | 1871 | rgb.y = texcolor.G; |
1911 | rgb.z = texcolor.B; | 1872 | rgb.z = texcolor.B; |
1873 | |||
1912 | return rgb; | 1874 | return rgb; |
1913 | } | 1875 | } |
1914 | else | 1876 | else |
@@ -2948,20 +2910,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2948 | 2910 | ||
2949 | public LSL_Integer llGiveMoney(string destination, int amount) | 2911 | public LSL_Integer llGiveMoney(string destination, int amount) |
2950 | { | 2912 | { |
2951 | UUID invItemID=InventorySelf(); | ||
2952 | if (invItemID == UUID.Zero) | ||
2953 | return 0; | ||
2954 | |||
2955 | m_host.AddScriptLPS(1); | 2913 | m_host.AddScriptLPS(1); |
2956 | 2914 | ||
2957 | m_host.TaskInventory.LockItemsForRead(true); | 2915 | if (m_item.PermsGranter == UUID.Zero) |
2958 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
2959 | m_host.TaskInventory.LockItemsForRead(false); | ||
2960 | |||
2961 | if (item.PermsGranter == UUID.Zero) | ||
2962 | return 0; | 2916 | return 0; |
2963 | 2917 | ||
2964 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | 2918 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) |
2965 | { | 2919 | { |
2966 | LSLError("No permissions to give money"); | 2920 | LSLError("No permissions to give money"); |
2967 | return 0; | 2921 | return 0; |
@@ -3148,11 +3102,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3148 | sec = m_MinTimerInterval; | 3102 | sec = m_MinTimerInterval; |
3149 | m_host.AddScriptLPS(1); | 3103 | m_host.AddScriptLPS(1); |
3150 | // Setting timer repeat | 3104 | // Setting timer repeat |
3151 | AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec); | 3105 | AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec); |
3152 | } | 3106 | } |
3153 | 3107 | ||
3154 | public virtual void llSleep(double sec) | 3108 | public virtual void llSleep(double sec) |
3155 | { | 3109 | { |
3110 | // m_log.Info("llSleep snoozing " + sec + "s."); | ||
3156 | m_host.AddScriptLPS(1); | 3111 | m_host.AddScriptLPS(1); |
3157 | Thread.Sleep((int)(sec * 1000)); | 3112 | Thread.Sleep((int)(sec * 1000)); |
3158 | } | 3113 | } |
@@ -3211,29 +3166,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3211 | 3166 | ||
3212 | public void llTakeControls(int controls, int accept, int pass_on) | 3167 | public void llTakeControls(int controls, int accept, int pass_on) |
3213 | { | 3168 | { |
3214 | TaskInventoryItem item; | 3169 | if (m_item.PermsGranter != UUID.Zero) |
3215 | |||
3216 | m_host.TaskInventory.LockItemsForRead(true); | ||
3217 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3218 | { | 3170 | { |
3219 | m_host.TaskInventory.LockItemsForRead(false); | 3171 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3220 | return; | ||
3221 | } | ||
3222 | else | ||
3223 | { | ||
3224 | item = m_host.TaskInventory[InventorySelf()]; | ||
3225 | } | ||
3226 | m_host.TaskInventory.LockItemsForRead(false); | ||
3227 | |||
3228 | if (item.PermsGranter != UUID.Zero) | ||
3229 | { | ||
3230 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | ||
3231 | 3172 | ||
3232 | if (presence != null) | 3173 | if (presence != null) |
3233 | { | 3174 | { |
3234 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 3175 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
3235 | { | 3176 | { |
3236 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); | 3177 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID); |
3237 | } | 3178 | } |
3238 | } | 3179 | } |
3239 | } | 3180 | } |
@@ -3243,38 +3184,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3243 | 3184 | ||
3244 | public void llReleaseControls() | 3185 | public void llReleaseControls() |
3245 | { | 3186 | { |
3246 | TaskInventoryItem item; | ||
3247 | |||
3248 | m_host.TaskInventory.LockItemsForRead(true); | ||
3249 | lock (m_host.TaskInventory) | ||
3250 | { | ||
3251 | |||
3252 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3253 | { | ||
3254 | m_host.TaskInventory.LockItemsForRead(false); | ||
3255 | return; | ||
3256 | } | ||
3257 | else | ||
3258 | { | ||
3259 | item = m_host.TaskInventory[InventorySelf()]; | ||
3260 | } | ||
3261 | } | ||
3262 | m_host.TaskInventory.LockItemsForRead(false); | ||
3263 | |||
3264 | m_host.AddScriptLPS(1); | 3187 | m_host.AddScriptLPS(1); |
3265 | 3188 | ||
3266 | if (item.PermsGranter != UUID.Zero) | 3189 | if (m_item.PermsGranter != UUID.Zero) |
3267 | { | 3190 | { |
3268 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3191 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3269 | 3192 | ||
3270 | if (presence != null) | 3193 | if (presence != null) |
3271 | { | 3194 | { |
3272 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 3195 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
3273 | { | 3196 | { |
3274 | // Unregister controls from Presence | 3197 | // Unregister controls from Presence |
3275 | presence.UnRegisterControlEventsToScript(m_localID, m_itemID); | 3198 | presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID); |
3276 | // Remove Take Control permission. | 3199 | // Remove Take Control permission. |
3277 | item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; | 3200 | m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; |
3278 | } | 3201 | } |
3279 | } | 3202 | } |
3280 | } | 3203 | } |
@@ -3287,86 +3210,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3287 | m_UrlModule.ReleaseURL(url); | 3210 | m_UrlModule.ReleaseURL(url); |
3288 | } | 3211 | } |
3289 | 3212 | ||
3290 | public void llAttachToAvatar(int attachment) | 3213 | /// <summary> |
3214 | /// Attach the object containing this script to the avatar that owns it. | ||
3215 | /// </summary> | ||
3216 | /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param> | ||
3217 | /// <returns>true if the attach suceeded, false if it did not</returns> | ||
3218 | public bool AttachToAvatar(int attachmentPoint) | ||
3291 | { | 3219 | { |
3292 | m_host.AddScriptLPS(1); | 3220 | SceneObjectGroup grp = m_host.ParentGroup; |
3221 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | ||
3293 | 3222 | ||
3294 | TaskInventoryItem item; | 3223 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3295 | |||
3296 | m_host.TaskInventory.LockItemsForRead(true); | ||
3297 | 3224 | ||
3298 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3225 | if (attachmentsModule != null) |
3299 | { | 3226 | return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); |
3300 | m_host.TaskInventory.LockItemsForRead(false); | ||
3301 | return; | ||
3302 | } | ||
3303 | else | 3227 | else |
3304 | { | 3228 | return false; |
3305 | item = m_host.TaskInventory[InventorySelf()]; | 3229 | } |
3306 | } | ||
3307 | |||
3308 | m_host.TaskInventory.LockItemsForRead(false); | ||
3309 | 3230 | ||
3310 | if (item.PermsGranter != m_host.OwnerID) | 3231 | /// <summary> |
3311 | return; | 3232 | /// Detach the object containing this script from the avatar it is attached to. |
3233 | /// </summary> | ||
3234 | /// <remarks> | ||
3235 | /// Nothing happens if the object is not attached. | ||
3236 | /// </remarks> | ||
3237 | public void DetachFromAvatar() | ||
3238 | { | ||
3239 | Util.FireAndForget(DetachWrapper, m_host); | ||
3240 | } | ||
3312 | 3241 | ||
3313 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3242 | private void DetachWrapper(object o) |
3314 | { | 3243 | { |
3315 | SceneObjectGroup grp = m_host.ParentGroup; | 3244 | SceneObjectPart host = (SceneObjectPart)o; |
3316 | 3245 | ||
3317 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 3246 | SceneObjectGroup grp = host.ParentGroup; |
3247 | UUID itemID = grp.FromItemID; | ||
3248 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3318 | 3249 | ||
3319 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3250 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3320 | if (attachmentsModule != null) | 3251 | if (attachmentsModule != null) |
3321 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); | 3252 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); |
3322 | } | ||
3323 | } | 3253 | } |
3324 | 3254 | ||
3325 | public void llDetachFromAvatar() | 3255 | public void llAttachToAvatar(int attachmentPoint) |
3326 | { | 3256 | { |
3327 | m_host.AddScriptLPS(1); | 3257 | m_host.AddScriptLPS(1); |
3328 | 3258 | ||
3329 | if (m_host.ParentGroup.AttachmentPoint == 0) | 3259 | if (m_item.PermsGranter != m_host.OwnerID) |
3330 | return; | 3260 | return; |
3331 | 3261 | ||
3332 | TaskInventoryItem item; | 3262 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3263 | AttachToAvatar(attachmentPoint); | ||
3264 | } | ||
3333 | 3265 | ||
3334 | m_host.TaskInventory.LockItemsForRead(true); | 3266 | public void llDetachFromAvatar() |
3267 | { | ||
3268 | m_host.AddScriptLPS(1); | ||
3335 | 3269 | ||
3336 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | 3270 | if (m_host.ParentGroup.AttachmentPoint == 0) |
3337 | { | ||
3338 | m_host.TaskInventory.LockItemsForRead(false); | ||
3339 | return; | 3271 | return; |
3340 | } | ||
3341 | else | ||
3342 | { | ||
3343 | item = m_host.TaskInventory[InventorySelf()]; | ||
3344 | } | ||
3345 | m_host.TaskInventory.LockItemsForRead(false); | ||
3346 | |||
3347 | 3272 | ||
3348 | if (item.PermsGranter != m_host.OwnerID) | 3273 | if (m_item.PermsGranter != m_host.OwnerID) |
3349 | return; | 3274 | return; |
3350 | 3275 | ||
3351 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 3276 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
3352 | { | 3277 | DetachFromAvatar(); |
3353 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3354 | if (attachmentsModule != null) | ||
3355 | Util.FireAndForget(DetachWrapper, m_host); | ||
3356 | } | ||
3357 | } | ||
3358 | |||
3359 | private void DetachWrapper(object o) | ||
3360 | { | ||
3361 | SceneObjectPart host = (SceneObjectPart)o; | ||
3362 | |||
3363 | SceneObjectGroup grp = host.ParentGroup; | ||
3364 | UUID itemID = grp.FromItemID; | ||
3365 | ScenePresence presence = World.GetScenePresence(host.OwnerID); | ||
3366 | |||
3367 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3368 | if (attachmentsModule != null) | ||
3369 | attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); | ||
3370 | } | 3278 | } |
3371 | 3279 | ||
3372 | public void llTakeCamera(string avatar) | 3280 | public void llTakeCamera(string avatar) |
@@ -3487,7 +3395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3487 | } | 3395 | } |
3488 | 3396 | ||
3489 | emailModule.SendEmail(m_host.UUID, address, subject, message); | 3397 | emailModule.SendEmail(m_host.UUID, address, subject, message); |
3490 | ScriptSleep(15000); | 3398 | ScriptSleep(EMAIL_PAUSE_TIME * 1000); |
3491 | } | 3399 | } |
3492 | 3400 | ||
3493 | public void llGetNextEmail(string address, string subject) | 3401 | public void llGetNextEmail(string address, string subject) |
@@ -3524,6 +3432,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3524 | return m_host.UUID.ToString(); | 3432 | return m_host.UUID.ToString(); |
3525 | } | 3433 | } |
3526 | 3434 | ||
3435 | public LSL_Key llGenerateKey() | ||
3436 | { | ||
3437 | m_host.AddScriptLPS(1); | ||
3438 | return UUID.Random().ToString(); | ||
3439 | } | ||
3440 | |||
3527 | public void llSetBuoyancy(double buoyancy) | 3441 | public void llSetBuoyancy(double buoyancy) |
3528 | { | 3442 | { |
3529 | m_host.AddScriptLPS(1); | 3443 | m_host.AddScriptLPS(1); |
@@ -3570,7 +3484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3570 | m_host.AddScriptLPS(1); | 3484 | m_host.AddScriptLPS(1); |
3571 | try | 3485 | try |
3572 | { | 3486 | { |
3573 | m_ScriptEngine.SetMinEventDelay(m_itemID, delay); | 3487 | m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay); |
3574 | } | 3488 | } |
3575 | catch (NotImplementedException) | 3489 | catch (NotImplementedException) |
3576 | { | 3490 | { |
@@ -3623,29 +3537,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3623 | { | 3537 | { |
3624 | m_host.AddScriptLPS(1); | 3538 | m_host.AddScriptLPS(1); |
3625 | 3539 | ||
3626 | UUID invItemID = InventorySelf(); | 3540 | if (m_item.PermsGranter == UUID.Zero) |
3627 | if (invItemID == UUID.Zero) | ||
3628 | return; | ||
3629 | |||
3630 | TaskInventoryItem item; | ||
3631 | |||
3632 | m_host.TaskInventory.LockItemsForRead(true); | ||
3633 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3634 | { | ||
3635 | m_host.TaskInventory.LockItemsForRead(false); | ||
3636 | return; | ||
3637 | } | ||
3638 | else | ||
3639 | { | ||
3640 | item = m_host.TaskInventory[InventorySelf()]; | ||
3641 | } | ||
3642 | m_host.TaskInventory.LockItemsForRead(false); | ||
3643 | if (item.PermsGranter == UUID.Zero) | ||
3644 | return; | 3541 | return; |
3645 | 3542 | ||
3646 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | 3543 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3647 | { | 3544 | { |
3648 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | 3545 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3649 | 3546 | ||
3650 | if (presence != null) | 3547 | if (presence != null) |
3651 | { | 3548 | { |
@@ -3663,41 +3560,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3663 | { | 3560 | { |
3664 | m_host.AddScriptLPS(1); | 3561 | m_host.AddScriptLPS(1); |
3665 | 3562 | ||
3666 | UUID invItemID=InventorySelf(); | 3563 | if (m_item.PermsGranter == UUID.Zero) |
3667 | if (invItemID == UUID.Zero) | ||
3668 | return; | 3564 | return; |
3669 | 3565 | ||
3670 | TaskInventoryItem item; | 3566 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3671 | |||
3672 | m_host.TaskInventory.LockItemsForRead(true); | ||
3673 | if (!m_host.TaskInventory.ContainsKey(InventorySelf())) | ||
3674 | { | 3567 | { |
3675 | m_host.TaskInventory.LockItemsForRead(false); | 3568 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3676 | return; | ||
3677 | } | ||
3678 | else | ||
3679 | { | ||
3680 | item = m_host.TaskInventory[InventorySelf()]; | ||
3681 | } | ||
3682 | m_host.TaskInventory.LockItemsForRead(false); | ||
3683 | |||
3684 | |||
3685 | if (item.PermsGranter == UUID.Zero) | ||
3686 | return; | ||
3687 | |||
3688 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | ||
3689 | { | ||
3690 | UUID animID = new UUID(); | ||
3691 | |||
3692 | if (!UUID.TryParse(anim, out animID)) | ||
3693 | { | ||
3694 | animID=InventoryKey(anim); | ||
3695 | } | ||
3696 | |||
3697 | ScenePresence presence = World.GetScenePresence(item.PermsGranter); | ||
3698 | 3569 | ||
3699 | if (presence != null) | 3570 | if (presence != null) |
3700 | { | 3571 | { |
3572 | UUID animID = KeyOrName(anim); | ||
3573 | |||
3701 | if (animID == UUID.Zero) | 3574 | if (animID == UUID.Zero) |
3702 | presence.Animator.RemoveAnimation(anim); | 3575 | presence.Animator.RemoveAnimation(anim); |
3703 | else | 3576 | else |
@@ -3730,44 +3603,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3730 | public LSL_Integer llGetStartParameter() | 3603 | public LSL_Integer llGetStartParameter() |
3731 | { | 3604 | { |
3732 | m_host.AddScriptLPS(1); | 3605 | m_host.AddScriptLPS(1); |
3733 | return m_ScriptEngine.GetStartParameter(m_itemID); | 3606 | return m_ScriptEngine.GetStartParameter(m_item.ItemID); |
3734 | } | 3607 | } |
3735 | 3608 | ||
3736 | public void llRequestPermissions(string agent, int perm) | 3609 | public void llRequestPermissions(string agent, int perm) |
3737 | { | 3610 | { |
3738 | UUID agentID = new UUID(); | 3611 | UUID agentID; |
3739 | 3612 | ||
3740 | if (!UUID.TryParse(agent, out agentID)) | 3613 | if (!UUID.TryParse(agent, out agentID)) |
3741 | return; | 3614 | return; |
3742 | 3615 | ||
3743 | UUID invItemID = InventorySelf(); | ||
3744 | |||
3745 | if (invItemID == UUID.Zero) | ||
3746 | return; // Not in a prim? How?? | ||
3747 | |||
3748 | TaskInventoryItem item; | ||
3749 | |||
3750 | |||
3751 | m_host.TaskInventory.LockItemsForRead(true); | ||
3752 | if (!m_host.TaskInventory.ContainsKey(invItemID)) | ||
3753 | { | ||
3754 | m_host.TaskInventory.LockItemsForRead(false); | ||
3755 | return; | ||
3756 | } | ||
3757 | else | ||
3758 | { | ||
3759 | item = m_host.TaskInventory[invItemID]; | ||
3760 | } | ||
3761 | m_host.TaskInventory.LockItemsForRead(false); | ||
3762 | |||
3763 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions | 3616 | if (agentID == UUID.Zero || perm == 0) // Releasing permissions |
3764 | { | 3617 | { |
3765 | llReleaseControls(); | 3618 | llReleaseControls(); |
3766 | 3619 | ||
3767 | item.PermsGranter = UUID.Zero; | 3620 | m_item.PermsGranter = UUID.Zero; |
3768 | item.PermsMask = 0; | 3621 | m_item.PermsMask = 0; |
3769 | 3622 | ||
3770 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3623 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3771 | "run_time_permissions", new Object[] { | 3624 | "run_time_permissions", new Object[] { |
3772 | new LSL_Integer(0) }, | 3625 | new LSL_Integer(0) }, |
3773 | new DetectParams[0])); | 3626 | new DetectParams[0])); |
@@ -3775,7 +3628,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3775 | return; | 3628 | return; |
3776 | } | 3629 | } |
3777 | 3630 | ||
3778 | if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3631 | if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3779 | llReleaseControls(); | 3632 | llReleaseControls(); |
3780 | 3633 | ||
3781 | m_host.AddScriptLPS(1); | 3634 | m_host.AddScriptLPS(1); |
@@ -3792,11 +3645,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3792 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3645 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3793 | { | 3646 | { |
3794 | m_host.TaskInventory.LockItemsForWrite(true); | 3647 | m_host.TaskInventory.LockItemsForWrite(true); |
3795 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3648 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3796 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3649 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; |
3797 | m_host.TaskInventory.LockItemsForWrite(false); | 3650 | m_host.TaskInventory.LockItemsForWrite(false); |
3798 | 3651 | ||
3799 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3652 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3800 | "run_time_permissions", new Object[] { | 3653 | "run_time_permissions", new Object[] { |
3801 | new LSL_Integer(perm) }, | 3654 | new LSL_Integer(perm) }, |
3802 | new DetectParams[0])); | 3655 | new DetectParams[0])); |
@@ -3831,11 +3684,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3831 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms | 3684 | if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms |
3832 | { | 3685 | { |
3833 | m_host.TaskInventory.LockItemsForWrite(true); | 3686 | m_host.TaskInventory.LockItemsForWrite(true); |
3834 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3687 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3835 | m_host.TaskInventory[invItemID].PermsMask = perm; | 3688 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; |
3836 | m_host.TaskInventory.LockItemsForWrite(false); | 3689 | m_host.TaskInventory.LockItemsForWrite(false); |
3837 | 3690 | ||
3838 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3691 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
3839 | "run_time_permissions", new Object[] { | 3692 | "run_time_permissions", new Object[] { |
3840 | new LSL_Integer(perm) }, | 3693 | new LSL_Integer(perm) }, |
3841 | new DetectParams[0])); | 3694 | new DetectParams[0])); |
@@ -3846,9 +3699,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3846 | } | 3699 | } |
3847 | 3700 | ||
3848 | ScenePresence presence = World.GetScenePresence(agentID); | 3701 | ScenePresence presence = World.GetScenePresence(agentID); |
3849 | |||
3850 | if (presence != null) | 3702 | if (presence != null) |
3851 | { | 3703 | { |
3704 | // If permissions are being requested from an NPC and were not implicitly granted above then | ||
3705 | // auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner | ||
3706 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | ||
3707 | if (npcModule != null && npcModule.IsNPC(agentID, World)) | ||
3708 | { | ||
3709 | if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) | ||
3710 | { | ||
3711 | lock (m_host.TaskInventory) | ||
3712 | { | ||
3713 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; | ||
3714 | m_host.TaskInventory[m_item.ItemID].PermsMask = perm; | ||
3715 | } | ||
3716 | |||
3717 | m_ScriptEngine.PostScriptEvent( | ||
3718 | m_item.ItemID, | ||
3719 | new EventParams( | ||
3720 | "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); | ||
3721 | } | ||
3722 | |||
3723 | // it is an NPC, exit even if the permissions werent granted above, they are not going to answer | ||
3724 | // the question! | ||
3725 | return; | ||
3726 | } | ||
3727 | |||
3852 | string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); | 3728 | string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); |
3853 | if (ownerName == String.Empty) | 3729 | if (ownerName == String.Empty) |
3854 | ownerName = "(hippos)"; | 3730 | ownerName = "(hippos)"; |
@@ -3856,8 +3732,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3856 | if (!m_waitingForScriptAnswer) | 3732 | if (!m_waitingForScriptAnswer) |
3857 | { | 3733 | { |
3858 | m_host.TaskInventory.LockItemsForWrite(true); | 3734 | m_host.TaskInventory.LockItemsForWrite(true); |
3859 | m_host.TaskInventory[invItemID].PermsGranter = agentID; | 3735 | m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; |
3860 | m_host.TaskInventory[invItemID].PermsMask = 0; | 3736 | m_host.TaskInventory[m_item.ItemID].PermsMask = 0; |
3861 | m_host.TaskInventory.LockItemsForWrite(false); | 3737 | m_host.TaskInventory.LockItemsForWrite(false); |
3862 | 3738 | ||
3863 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; | 3739 | presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; |
@@ -3865,16 +3741,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3865 | } | 3741 | } |
3866 | 3742 | ||
3867 | presence.ControllingClient.SendScriptQuestion( | 3743 | presence.ControllingClient.SendScriptQuestion( |
3868 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); | 3744 | m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm); |
3869 | 3745 | ||
3870 | return; | 3746 | return; |
3871 | } | 3747 | } |
3872 | 3748 | ||
3873 | // Requested agent is not in range, refuse perms | 3749 | // Requested agent is not in range, refuse perms |
3874 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 3750 | m_ScriptEngine.PostScriptEvent( |
3875 | "run_time_permissions", new Object[] { | 3751 | m_item.ItemID, |
3876 | new LSL_Integer(0) }, | 3752 | new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); |
3877 | new DetectParams[0])); | ||
3878 | } | 3753 | } |
3879 | 3754 | ||
3880 | void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) | 3755 | void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) |
@@ -3882,24 +3757,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3882 | if (taskID != m_host.UUID) | 3757 | if (taskID != m_host.UUID) |
3883 | return; | 3758 | return; |
3884 | 3759 | ||
3885 | UUID invItemID = InventorySelf(); | 3760 | client.OnScriptAnswer -= handleScriptAnswer; |
3886 | 3761 | m_waitingForScriptAnswer = false; | |
3887 | if (invItemID == UUID.Zero) | ||
3888 | return; | ||
3889 | |||
3890 | client.OnScriptAnswer-=handleScriptAnswer; | ||
3891 | m_waitingForScriptAnswer=false; | ||
3892 | 3762 | ||
3893 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) | 3763 | if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) |
3894 | llReleaseControls(); | 3764 | llReleaseControls(); |
3895 | 3765 | ||
3896 | |||
3897 | m_host.TaskInventory.LockItemsForWrite(true); | 3766 | m_host.TaskInventory.LockItemsForWrite(true); |
3898 | m_host.TaskInventory[invItemID].PermsMask = answer; | 3767 | m_host.TaskInventory[m_item.ItemID].PermsMask = answer; |
3899 | m_host.TaskInventory.LockItemsForWrite(false); | 3768 | m_host.TaskInventory.LockItemsForWrite(false); |
3900 | 3769 | ||
3901 | 3770 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( | |
3902 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | ||
3903 | "run_time_permissions", new Object[] { | 3771 | "run_time_permissions", new Object[] { |
3904 | new LSL_Integer(answer) }, | 3772 | new LSL_Integer(answer) }, |
3905 | new DetectParams[0])); | 3773 | new DetectParams[0])); |
@@ -3909,41 +3777,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3909 | { | 3777 | { |
3910 | m_host.AddScriptLPS(1); | 3778 | m_host.AddScriptLPS(1); |
3911 | 3779 | ||
3912 | m_host.TaskInventory.LockItemsForRead(true); | 3780 | return m_item.PermsGranter.ToString(); |
3913 | |||
3914 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
3915 | { | ||
3916 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3917 | { | ||
3918 | m_host.TaskInventory.LockItemsForRead(false); | ||
3919 | return item.PermsGranter.ToString(); | ||
3920 | } | ||
3921 | } | ||
3922 | m_host.TaskInventory.LockItemsForRead(false); | ||
3923 | |||
3924 | return UUID.Zero.ToString(); | ||
3925 | } | 3781 | } |
3926 | 3782 | ||
3927 | public LSL_Integer llGetPermissions() | 3783 | public LSL_Integer llGetPermissions() |
3928 | { | 3784 | { |
3929 | m_host.AddScriptLPS(1); | 3785 | m_host.AddScriptLPS(1); |
3930 | 3786 | ||
3931 | m_host.TaskInventory.LockItemsForRead(true); | 3787 | int perms = m_item.PermsMask; |
3932 | 3788 | ||
3933 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | 3789 | if (m_automaticLinkPermission) |
3934 | { | 3790 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
3935 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
3936 | { | ||
3937 | int perms = item.PermsMask; | ||
3938 | if (m_automaticLinkPermission) | ||
3939 | perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | ||
3940 | m_host.TaskInventory.LockItemsForRead(false); | ||
3941 | return perms; | ||
3942 | } | ||
3943 | } | ||
3944 | m_host.TaskInventory.LockItemsForRead(false); | ||
3945 | 3791 | ||
3946 | return 0; | 3792 | return perms; |
3947 | } | 3793 | } |
3948 | 3794 | ||
3949 | public LSL_Integer llGetLinkNumber() | 3795 | public LSL_Integer llGetLinkNumber() |
@@ -3981,18 +3827,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3981 | public void llCreateLink(string target, int parent) | 3827 | public void llCreateLink(string target, int parent) |
3982 | { | 3828 | { |
3983 | m_host.AddScriptLPS(1); | 3829 | m_host.AddScriptLPS(1); |
3984 | UUID invItemID = InventorySelf(); | 3830 | |
3985 | UUID targetID; | 3831 | UUID targetID; |
3986 | 3832 | ||
3987 | if (!UUID.TryParse(target, out targetID)) | 3833 | if (!UUID.TryParse(target, out targetID)) |
3988 | return; | 3834 | return; |
3989 | 3835 | ||
3990 | TaskInventoryItem item; | 3836 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3991 | m_host.TaskInventory.LockItemsForRead(true); | ||
3992 | item = m_host.TaskInventory[invItemID]; | ||
3993 | m_host.TaskInventory.LockItemsForRead(false); | ||
3994 | |||
3995 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | ||
3996 | && !m_automaticLinkPermission) | 3837 | && !m_automaticLinkPermission) |
3997 | { | 3838 | { |
3998 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3839 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
@@ -4000,7 +3841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4000 | } | 3841 | } |
4001 | 3842 | ||
4002 | IClientAPI client = null; | 3843 | IClientAPI client = null; |
4003 | ScenePresence sp = World.GetScenePresence(item.PermsGranter); | 3844 | ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); |
4004 | if (sp != null) | 3845 | if (sp != null) |
4005 | client = sp.ControllingClient; | 3846 | client = sp.ControllingClient; |
4006 | 3847 | ||
@@ -4046,18 +3887,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4046 | public void llBreakLink(int linknum) | 3887 | public void llBreakLink(int linknum) |
4047 | { | 3888 | { |
4048 | m_host.AddScriptLPS(1); | 3889 | m_host.AddScriptLPS(1); |
4049 | UUID invItemID = InventorySelf(); | ||
4050 | 3890 | ||
4051 | m_host.TaskInventory.LockItemsForRead(true); | 3891 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4052 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3892 | && !m_automaticLinkPermission) |
4053 | && !m_automaticLinkPermission) | 3893 | { |
4054 | { | 3894 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); |
4055 | ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); | 3895 | return; |
4056 | m_host.TaskInventory.LockItemsForRead(false); | 3896 | } |
4057 | return; | 3897 | |
4058 | } | ||
4059 | m_host.TaskInventory.LockItemsForRead(false); | ||
4060 | |||
4061 | if (linknum < ScriptBaseClass.LINK_THIS) | 3898 | if (linknum < ScriptBaseClass.LINK_THIS) |
4062 | return; | 3899 | return; |
4063 | 3900 | ||
@@ -4156,12 +3993,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4156 | { | 3993 | { |
4157 | m_host.AddScriptLPS(1); | 3994 | m_host.AddScriptLPS(1); |
4158 | 3995 | ||
4159 | UUID invItemID = InventorySelf(); | 3996 | TaskInventoryItem item = m_item; |
4160 | |||
4161 | TaskInventoryItem item; | ||
4162 | m_host.TaskInventory.LockItemsForRead(true); | ||
4163 | item = m_host.TaskInventory[invItemID]; | ||
4164 | m_host.TaskInventory.LockItemsForRead(false); | ||
4165 | 3997 | ||
4166 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3998 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
4167 | && !m_automaticLinkPermission) | 3999 | && !m_automaticLinkPermission) |
@@ -4472,7 +4304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4472 | { | 4304 | { |
4473 | if (item.Name == name) | 4305 | if (item.Name == name) |
4474 | { | 4306 | { |
4475 | if (item.ItemID == m_itemID) | 4307 | if (item.ItemID == m_item.ItemID) |
4476 | throw new ScriptDeleteException(); | 4308 | throw new ScriptDeleteException(); |
4477 | else | 4309 | else |
4478 | m_host.Inventory.RemoveInventoryItem(item.ItemID); | 4310 | m_host.Inventory.RemoveInventoryItem(item.ItemID); |
@@ -4606,8 +4438,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4606 | UUID rq = UUID.Random(); | 4438 | UUID rq = UUID.Random(); |
4607 | 4439 | ||
4608 | UUID tid = AsyncCommands. | 4440 | UUID tid = AsyncCommands. |
4609 | DataserverPlugin.RegisterRequest(m_localID, | 4441 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4610 | m_itemID, rq.ToString()); | 4442 | m_item.ItemID, rq.ToString()); |
4611 | 4443 | ||
4612 | AsyncCommands. | 4444 | AsyncCommands. |
4613 | DataserverPlugin.DataserverReply(rq.ToString(), reply); | 4445 | DataserverPlugin.DataserverReply(rq.ToString(), reply); |
@@ -4634,8 +4466,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4634 | if (item.Type == 3 && item.Name == name) | 4466 | if (item.Type == 3 && item.Name == name) |
4635 | { | 4467 | { |
4636 | UUID tid = AsyncCommands. | 4468 | UUID tid = AsyncCommands. |
4637 | DataserverPlugin.RegisterRequest(m_localID, | 4469 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4638 | m_itemID, item.AssetID.ToString()); | 4470 | m_item.ItemID, item.AssetID.ToString()); |
4639 | 4471 | ||
4640 | Vector3 region = new Vector3( | 4472 | Vector3 region = new Vector3( |
4641 | World.RegionInfo.RegionLocX * Constants.RegionSize, | 4473 | World.RegionInfo.RegionLocX * Constants.RegionSize, |
@@ -5040,22 +4872,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5040 | 4872 | ||
5041 | public LSL_String llGetScriptName() | 4873 | public LSL_String llGetScriptName() |
5042 | { | 4874 | { |
5043 | string result = String.Empty; | ||
5044 | |||
5045 | m_host.AddScriptLPS(1); | 4875 | m_host.AddScriptLPS(1); |
5046 | 4876 | ||
5047 | m_host.TaskInventory.LockItemsForRead(true); | 4877 | return m_item.Name != null ? m_item.Name : String.Empty; |
5048 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
5049 | { | ||
5050 | if (item.Type == 10 && item.ItemID == m_itemID) | ||
5051 | { | ||
5052 | result = item.Name!=null?item.Name:String.Empty; | ||
5053 | break; | ||
5054 | } | ||
5055 | } | ||
5056 | m_host.TaskInventory.LockItemsForRead(false); | ||
5057 | |||
5058 | return result; | ||
5059 | } | 4878 | } |
5060 | 4879 | ||
5061 | public LSL_Integer llGetLinkNumberOfSides(int link) | 4880 | public LSL_Integer llGetLinkNumberOfSides(int link) |
@@ -6340,7 +6159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6340 | if (m_host.OwnerID == land.LandData.OwnerID) | 6159 | if (m_host.OwnerID == land.LandData.OwnerID) |
6341 | { | 6160 | { |
6342 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); | 6161 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); |
6343 | presence.TeleportWithMomentum(pos); | 6162 | presence.TeleportWithMomentum(pos, null); |
6344 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | 6163 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); |
6345 | } | 6164 | } |
6346 | } | 6165 | } |
@@ -7287,14 +7106,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7287 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7106 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7288 | if (xmlrpcMod.IsEnabled()) | 7107 | if (xmlrpcMod.IsEnabled()) |
7289 | { | 7108 | { |
7290 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); | 7109 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
7291 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 7110 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
7292 | if (xmlRpcRouter != null) | 7111 | if (xmlRpcRouter != null) |
7293 | { | 7112 | { |
7294 | string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; | 7113 | string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; |
7295 | 7114 | ||
7296 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, | 7115 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, |
7297 | m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, | 7116 | m_item.ItemID, String.Format("http://{0}:{1}/", ExternalHostName, |
7298 | xmlrpcMod.Port.ToString())); | 7117 | xmlrpcMod.Port.ToString())); |
7299 | } | 7118 | } |
7300 | object[] resobj = new object[] | 7119 | object[] resobj = new object[] |
@@ -7306,7 +7125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7306 | new LSL_Integer(0), | 7125 | new LSL_Integer(0), |
7307 | new LSL_String(String.Empty) | 7126 | new LSL_String(String.Empty) |
7308 | }; | 7127 | }; |
7309 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, | 7128 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, |
7310 | new DetectParams[0])); | 7129 | new DetectParams[0])); |
7311 | } | 7130 | } |
7312 | ScriptSleep(1000); | 7131 | ScriptSleep(1000); |
@@ -7317,7 +7136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7317 | m_host.AddScriptLPS(1); | 7136 | m_host.AddScriptLPS(1); |
7318 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7137 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7319 | ScriptSleep(3000); | 7138 | ScriptSleep(3000); |
7320 | return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); | 7139 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
7321 | } | 7140 | } |
7322 | 7141 | ||
7323 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | 7142 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
@@ -8156,7 +7975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8156 | return; | 7975 | return; |
8157 | face = (int)rules.GetLSLIntegerItem(idx++); | 7976 | face = (int)rules.GetLSLIntegerItem(idx++); |
8158 | int shiny = (int)rules.GetLSLIntegerItem(idx++); | 7977 | int shiny = (int)rules.GetLSLIntegerItem(idx++); |
8159 | Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); | 7978 | Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); |
8160 | 7979 | ||
8161 | SetShiny(part, face, shiny, bump); | 7980 | SetShiny(part, face, shiny, bump); |
8162 | 7981 | ||
@@ -9621,7 +9440,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9621 | public LSL_String llGetSimulatorHostname() | 9440 | public LSL_String llGetSimulatorHostname() |
9622 | { | 9441 | { |
9623 | m_host.AddScriptLPS(1); | 9442 | m_host.AddScriptLPS(1); |
9624 | return System.Environment.MachineName; | 9443 | IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>(); |
9444 | return UrlModule.ExternalHostNameForLSL; | ||
9625 | } | 9445 | } |
9626 | 9446 | ||
9627 | // <summary> | 9447 | // <summary> |
@@ -9960,13 +9780,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9960 | { | 9780 | { |
9961 | m_host.AddScriptLPS(1); | 9781 | m_host.AddScriptLPS(1); |
9962 | if (m_UrlModule != null) | 9782 | if (m_UrlModule != null) |
9963 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); | 9783 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); |
9964 | return UUID.Zero.ToString(); | 9784 | return UUID.Zero.ToString(); |
9965 | } | 9785 | } |
9966 | 9786 | ||
9967 | public LSL_String llRequestSimulatorData(string simulator, int data) | 9787 | public LSL_String llRequestSimulatorData(string simulator, int data) |
9968 | { | 9788 | { |
9969 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); | 9789 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); |
9970 | 9790 | ||
9971 | try | 9791 | try |
9972 | { | 9792 | { |
@@ -9976,7 +9796,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9976 | 9796 | ||
9977 | GridRegion info; | 9797 | GridRegion info; |
9978 | 9798 | ||
9979 | if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) | 9799 | if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator? |
9800 | |||
9980 | info = new GridRegion(m_ScriptEngine.World.RegionInfo); | 9801 | info = new GridRegion(m_ScriptEngine.World.RegionInfo); |
9981 | else | 9802 | else |
9982 | info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); | 9803 | info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); |
@@ -9989,10 +9810,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9989 | ScriptSleep(1000); | 9810 | ScriptSleep(1000); |
9990 | return UUID.Zero.ToString(); | 9811 | return UUID.Zero.ToString(); |
9991 | } | 9812 | } |
9992 | reply = new LSL_Vector( | 9813 | if (m_ScriptEngine.World.RegionInfo.RegionName != simulator) |
9993 | info.RegionLocX, | 9814 | { |
9994 | info.RegionLocY, | 9815 | //Hypergrid Region co-ordinates |
9995 | 0).ToString(); | 9816 | uint rx = 0, ry = 0; |
9817 | Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); | ||
9818 | |||
9819 | reply = new LSL_Vector( | ||
9820 | rx, | ||
9821 | ry, | ||
9822 | 0).ToString(); | ||
9823 | } | ||
9824 | else | ||
9825 | { | ||
9826 | //Local-cooridnates | ||
9827 | reply = new LSL_Vector( | ||
9828 | info.RegionLocX, | ||
9829 | info.RegionLocY, | ||
9830 | 0).ToString(); | ||
9831 | } | ||
9996 | break; | 9832 | break; |
9997 | case ScriptBaseClass.DATA_SIM_STATUS: | 9833 | case ScriptBaseClass.DATA_SIM_STATUS: |
9998 | if (info != null) | 9834 | if (info != null) |
@@ -10028,7 +9864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10028 | UUID rq = UUID.Random(); | 9864 | UUID rq = UUID.Random(); |
10029 | 9865 | ||
10030 | UUID tid = AsyncCommands. | 9866 | UUID tid = AsyncCommands. |
10031 | DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 9867 | DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
10032 | 9868 | ||
10033 | AsyncCommands. | 9869 | AsyncCommands. |
10034 | DataserverPlugin.DataserverReply(rq.ToString(), reply); | 9870 | DataserverPlugin.DataserverReply(rq.ToString(), reply); |
@@ -10047,7 +9883,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10047 | m_host.AddScriptLPS(1); | 9883 | m_host.AddScriptLPS(1); |
10048 | 9884 | ||
10049 | if (m_UrlModule != null) | 9885 | if (m_UrlModule != null) |
10050 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); | 9886 | return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); |
10051 | return UUID.Zero.ToString(); | 9887 | return UUID.Zero.ToString(); |
10052 | } | 9888 | } |
10053 | 9889 | ||
@@ -10083,7 +9919,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10083 | // child agents have a mass of 1.0 | 9919 | // child agents have a mass of 1.0 |
10084 | return 1; | 9920 | return 1; |
10085 | else | 9921 | else |
10086 | return avatar.GetMass(); | 9922 | return (double)avatar.GetMass(); |
10087 | } | 9923 | } |
10088 | catch (KeyNotFoundException) | 9924 | catch (KeyNotFoundException) |
10089 | { | 9925 | { |
@@ -10526,32 +10362,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10526 | public LSL_Vector llGetCameraPos() | 10362 | public LSL_Vector llGetCameraPos() |
10527 | { | 10363 | { |
10528 | m_host.AddScriptLPS(1); | 10364 | m_host.AddScriptLPS(1); |
10529 | UUID invItemID = InventorySelf(); | ||
10530 | |||
10531 | if (invItemID == UUID.Zero) | ||
10532 | return new LSL_Vector(); | ||
10533 | |||
10534 | m_host.TaskInventory.LockItemsForRead(true); | ||
10535 | |||
10536 | UUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
10537 | 10365 | ||
10538 | // if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10366 | if (m_item.PermsGranter == UUID.Zero) |
10539 | if (agentID == UUID.Zero) | 10367 | return new LSL_Vector(); |
10540 | { | ||
10541 | m_host.TaskInventory.LockItemsForRead(false); | ||
10542 | return new LSL_Vector(); | ||
10543 | } | ||
10544 | 10368 | ||
10545 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10369 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10546 | { | 10370 | { |
10547 | ShoutError("No permissions to track the camera"); | 10371 | ShoutError("No permissions to track the camera"); |
10548 | m_host.TaskInventory.LockItemsForRead(false); | ||
10549 | return new LSL_Vector(); | 10372 | return new LSL_Vector(); |
10550 | } | 10373 | } |
10551 | m_host.TaskInventory.LockItemsForRead(false); | 10374 | m_host.TaskInventory.LockItemsForRead(false); |
10552 | 10375 | ||
10553 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10376 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10554 | ScenePresence presence = World.GetScenePresence(agentID); | 10377 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10555 | if (presence != null) | 10378 | if (presence != null) |
10556 | { | 10379 | { |
10557 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); | 10380 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); |
@@ -10563,30 +10386,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10563 | public LSL_Rotation llGetCameraRot() | 10386 | public LSL_Rotation llGetCameraRot() |
10564 | { | 10387 | { |
10565 | m_host.AddScriptLPS(1); | 10388 | m_host.AddScriptLPS(1); |
10566 | UUID invItemID = InventorySelf(); | ||
10567 | if (invItemID == UUID.Zero) | ||
10568 | return new LSL_Rotation(); | ||
10569 | |||
10570 | m_host.TaskInventory.LockItemsForRead(true); | ||
10571 | 10389 | ||
10572 | UUID agentID = m_host.TaskInventory[invItemID].PermsGranter; | 10390 | if (m_item.PermsGranter == UUID.Zero) |
10391 | return new LSL_Rotation(); | ||
10573 | 10392 | ||
10574 | // if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) | 10393 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10575 | if (agentID == UUID.Zero) | ||
10576 | { | ||
10577 | m_host.TaskInventory.LockItemsForRead(false); | ||
10578 | return new LSL_Rotation(); | ||
10579 | } | ||
10580 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | ||
10581 | { | 10394 | { |
10582 | ShoutError("No permissions to track the camera"); | 10395 | ShoutError("No permissions to track the camera"); |
10583 | m_host.TaskInventory.LockItemsForRead(false); | ||
10584 | return new LSL_Rotation(); | 10396 | return new LSL_Rotation(); |
10585 | } | 10397 | } |
10586 | m_host.TaskInventory.LockItemsForRead(false); | 10398 | m_host.TaskInventory.LockItemsForRead(false); |
10587 | 10399 | ||
10588 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10400 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10589 | ScenePresence presence = World.GetScenePresence(agentID); | 10401 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10590 | if (presence != null) | 10402 | if (presence != null) |
10591 | { | 10403 | { |
10592 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); | 10404 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); |
@@ -10645,7 +10457,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10645 | public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) | 10457 | public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) |
10646 | { | 10458 | { |
10647 | m_host.AddScriptLPS(1); | 10459 | m_host.AddScriptLPS(1); |
10648 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); | 10460 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0); |
10649 | if (detectedParams == null) | 10461 | if (detectedParams == null) |
10650 | { | 10462 | { |
10651 | if (m_host.ParentGroup.IsAttachment == true) | 10463 | if (m_host.ParentGroup.IsAttachment == true) |
@@ -10769,30 +10581,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10769 | { | 10581 | { |
10770 | m_host.AddScriptLPS(1); | 10582 | m_host.AddScriptLPS(1); |
10771 | 10583 | ||
10772 | // our key in the object we are in | ||
10773 | UUID invItemID = InventorySelf(); | ||
10774 | if (invItemID == UUID.Zero) return; | ||
10775 | |||
10776 | // the object we are in | 10584 | // the object we are in |
10777 | UUID objectID = m_host.ParentUUID; | 10585 | UUID objectID = m_host.ParentUUID; |
10778 | if (objectID == UUID.Zero) return; | 10586 | if (objectID == UUID.Zero) |
10587 | return; | ||
10779 | 10588 | ||
10780 | UUID agentID; | ||
10781 | m_host.TaskInventory.LockItemsForRead(true); | ||
10782 | // we need the permission first, to know which avatar we want to set the camera for | 10589 | // we need the permission first, to know which avatar we want to set the camera for |
10783 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | 10590 | UUID agentID = m_item.PermsGranter; |
10784 | 10591 | ||
10785 | if (agentID == UUID.Zero) | 10592 | if (agentID == UUID.Zero) |
10786 | { | ||
10787 | m_host.TaskInventory.LockItemsForRead(false); | ||
10788 | return; | 10593 | return; |
10789 | } | 10594 | |
10790 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10595 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10791 | { | ||
10792 | m_host.TaskInventory.LockItemsForRead(false); | ||
10793 | return; | 10596 | return; |
10794 | } | ||
10795 | m_host.TaskInventory.LockItemsForRead(false); | ||
10796 | 10597 | ||
10797 | ScenePresence presence = World.GetScenePresence(agentID); | 10598 | ScenePresence presence = World.GetScenePresence(agentID); |
10798 | 10599 | ||
@@ -10834,34 +10635,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10834 | { | 10635 | { |
10835 | m_host.AddScriptLPS(1); | 10636 | m_host.AddScriptLPS(1); |
10836 | 10637 | ||
10837 | // our key in the object we are in | ||
10838 | UUID invItemID=InventorySelf(); | ||
10839 | if (invItemID == UUID.Zero) return; | ||
10840 | |||
10841 | // the object we are in | 10638 | // the object we are in |
10842 | UUID objectID = m_host.ParentUUID; | 10639 | UUID objectID = m_host.ParentUUID; |
10843 | if (objectID == UUID.Zero) return; | 10640 | if (objectID == UUID.Zero) |
10641 | return; | ||
10844 | 10642 | ||
10845 | // we need the permission first, to know which avatar we want to clear the camera for | 10643 | // we need the permission first, to know which avatar we want to clear the camera for |
10846 | UUID agentID; | 10644 | UUID agentID = m_item.PermsGranter; |
10847 | m_host.TaskInventory.LockItemsForRead(true); | 10645 | |
10848 | agentID = m_host.TaskInventory[invItemID].PermsGranter; | ||
10849 | if (agentID == UUID.Zero) | 10646 | if (agentID == UUID.Zero) |
10850 | { | ||
10851 | m_host.TaskInventory.LockItemsForRead(false); | ||
10852 | return; | 10647 | return; |
10853 | } | 10648 | |
10854 | if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) | 10649 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) |
10855 | { | ||
10856 | m_host.TaskInventory.LockItemsForRead(false); | ||
10857 | return; | 10650 | return; |
10858 | } | ||
10859 | m_host.TaskInventory.LockItemsForRead(false); | ||
10860 | 10651 | ||
10861 | ScenePresence presence = World.GetScenePresence(agentID); | 10652 | ScenePresence presence = World.GetScenePresence(agentID); |
10862 | 10653 | ||
10863 | // we are not interested in child-agents | 10654 | // we are not interested in child-agents |
10864 | if (presence.IsChildAgent) return; | 10655 | if (presence.IsChildAgent) |
10656 | return; | ||
10865 | 10657 | ||
10866 | presence.ControllingClient.SendClearFollowCamProperties(objectID); | 10658 | presence.ControllingClient.SendClearFollowCamProperties(objectID); |
10867 | } | 10659 | } |
@@ -11052,8 +10844,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11052 | } | 10844 | } |
11053 | } | 10845 | } |
11054 | 10846 | ||
11055 | UUID reqID = httpScriptMod. | 10847 | UUID reqID |
11056 | StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); | 10848 | = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body); |
11057 | 10849 | ||
11058 | if (reqID != UUID.Zero) | 10850 | if (reqID != UUID.Zero) |
11059 | return reqID.ToString(); | 10851 | return reqID.ToString(); |
@@ -11285,19 +11077,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11285 | break; | 11077 | break; |
11286 | // For the following 8 see the Object version below | 11078 | // For the following 8 see the Object version below |
11287 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11079 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11288 | ret.Add(new LSL_Integer(0)); | 11080 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11289 | break; | 11081 | break; |
11290 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11082 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11291 | ret.Add(new LSL_Integer(0)); | 11083 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11292 | break; | 11084 | break; |
11293 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11085 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11294 | ret.Add(new LSL_Integer(0)); | 11086 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11295 | break; | 11087 | break; |
11296 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11088 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11297 | ret.Add(new LSL_Float(0)); | 11089 | ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); |
11298 | break; | 11090 | break; |
11299 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11091 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11300 | ret.Add(new LSL_Integer(0)); | 11092 | ret.Add(new LSL_Integer(1)); |
11301 | break; | 11093 | break; |
11302 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11094 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11303 | ret.Add(new LSL_Float(0)); | 11095 | ret.Add(new LSL_Float(0)); |
@@ -11349,43 +11141,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11349 | case ScriptBaseClass.OBJECT_CREATOR: | 11141 | case ScriptBaseClass.OBJECT_CREATOR: |
11350 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11142 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11351 | break; | 11143 | break; |
11352 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11353 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11354 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11355 | // I have intentionally left these all at zero rather than return possibly | ||
11356 | // missleading numbers | ||
11357 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11144 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11358 | // in SL this currently includes crashed scripts | 11145 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11359 | ret.Add(new LSL_Integer(0)); | ||
11360 | break; | 11146 | break; |
11361 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11147 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11362 | ret.Add(new LSL_Integer(0)); | 11148 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11363 | break; | 11149 | break; |
11364 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11150 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11365 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11151 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11366 | ret.Add(new LSL_Integer(0)); | 11152 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11153 | // is coded to give the LSO value use it here | ||
11154 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11367 | break; | 11155 | break; |
11368 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11156 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11369 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11157 | // Average cpu time in seconds per simulator frame expended on all scripts in the object |
11370 | ret.Add(new LSL_Float(0)); | 11158 | ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); |
11371 | break; | 11159 | break; |
11372 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11160 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11373 | // according to the SL wiki A prim or linkset will have prim | 11161 | // according to the SL wiki A prim or linkset will have prim |
11374 | // equivalent of the number of prims in a linkset if it does not | 11162 | // equivalent of the number of prims in a linkset if it does not |
11375 | // contain a mesh anywhere in the link set or is not a normal prim | 11163 | // contain a mesh anywhere in the link set or is not a normal prim |
11376 | // The value returned in SL for normal prims is prim count | 11164 | // The value returned in SL for normal prims is prim count |
11377 | ret.Add(new LSL_Integer(0)); | 11165 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11378 | break; | 11166 | break; |
11167 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11168 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11169 | // to OpenSim and are not yet complete in SL | ||
11379 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11170 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11380 | // The value returned in SL for normal prims is prim count | 11171 | // The linden calculation is here |
11172 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11173 | // The value returned in SL for normal prims looks like the prim count | ||
11381 | ret.Add(new LSL_Float(0)); | 11174 | ret.Add(new LSL_Float(0)); |
11382 | break; | 11175 | break; |
11383 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11176 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11384 | // The value returned in SL for normal prims is prim count * 0.06 | 11177 | // The linden calculation is here |
11178 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11179 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11385 | ret.Add(new LSL_Float(0)); | 11180 | ret.Add(new LSL_Float(0)); |
11386 | break; | 11181 | break; |
11387 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11182 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11388 | // The value returned in SL for normal prims is prim count | 11183 | // The linden calculation is here |
11184 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11185 | // The value returned in SL for normal prims looks like the prim count | ||
11389 | ret.Add(new LSL_Float(0)); | 11186 | ret.Add(new LSL_Float(0)); |
11390 | break; | 11187 | break; |
11391 | default: | 11188 | default: |
@@ -11483,7 +11280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11483 | } | 11280 | } |
11484 | 11281 | ||
11485 | // was: UUID tid = tid = AsyncCommands. | 11282 | // was: UUID tid = tid = AsyncCommands. |
11486 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); | 11283 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
11487 | 11284 | ||
11488 | if (NotecardCache.IsCached(assetID)) | 11285 | if (NotecardCache.IsCached(assetID)) |
11489 | { | 11286 | { |
@@ -11546,7 +11343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11546 | } | 11343 | } |
11547 | 11344 | ||
11548 | // was: UUID tid = tid = AsyncCommands. | 11345 | // was: UUID tid = tid = AsyncCommands. |
11549 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); | 11346 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
11550 | 11347 | ||
11551 | if (NotecardCache.IsCached(assetID)) | 11348 | if (NotecardCache.IsCached(assetID)) |
11552 | { | 11349 | { |
@@ -11630,7 +11427,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11630 | { | 11427 | { |
11631 | UUID rq = UUID.Random(); | 11428 | UUID rq = UUID.Random(); |
11632 | 11429 | ||
11633 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 11430 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
11634 | 11431 | ||
11635 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | 11432 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); |
11636 | 11433 | ||
@@ -11646,7 +11443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11646 | { | 11443 | { |
11647 | UUID rq = UUID.Random(); | 11444 | UUID rq = UUID.Random(); |
11648 | 11445 | ||
11649 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | 11446 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
11650 | 11447 | ||
11651 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | 11448 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); |
11652 | 11449 | ||
@@ -12140,7 +11937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12140 | bool isAccount = false; | 11937 | bool isAccount = false; |
12141 | bool isGroup = false; | 11938 | bool isGroup = false; |
12142 | 11939 | ||
12143 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) | 11940 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) |
12144 | return 0; | 11941 | return 0; |
12145 | 11942 | ||
12146 | UUID id = new UUID(); | 11943 | UUID id = new UUID(); |
@@ -12202,35 +11999,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12202 | return 1; | 11999 | return 1; |
12203 | } | 12000 | } |
12204 | 12001 | ||
12205 | #region Not Implemented | 12002 | public LSL_Integer llGetMemoryLimit() |
12206 | // | 12003 | { |
12207 | // Listing the unimplemented lsl functions here, please move | 12004 | m_host.AddScriptLPS(1); |
12208 | // them from this region as they are completed | 12005 | // The value returned for LSO scripts in SL |
12209 | // | 12006 | return 16384; |
12007 | } | ||
12210 | 12008 | ||
12211 | public void llGetEnv(LSL_String name) | 12009 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12212 | { | 12010 | { |
12213 | m_host.AddScriptLPS(1); | 12011 | m_host.AddScriptLPS(1); |
12214 | NotImplemented("llGetEnv"); | 12012 | // Treat as an LSO script |
12013 | return ScriptBaseClass.FALSE; | ||
12215 | } | 12014 | } |
12216 | 12015 | ||
12217 | public void llGetSPMaxMemory() | 12016 | public LSL_Integer llGetSPMaxMemory() |
12218 | { | 12017 | { |
12219 | m_host.AddScriptLPS(1); | 12018 | m_host.AddScriptLPS(1); |
12220 | NotImplemented("llGetSPMaxMemory"); | 12019 | // The value returned for LSO scripts in SL |
12020 | return 16384; | ||
12221 | } | 12021 | } |
12222 | 12022 | ||
12223 | public virtual LSL_Integer llGetUsedMemory() | 12023 | public virtual LSL_Integer llGetUsedMemory() |
12224 | { | 12024 | { |
12225 | m_host.AddScriptLPS(1); | 12025 | m_host.AddScriptLPS(1); |
12226 | NotImplemented("llGetUsedMemory"); | 12026 | // The value returned for LSO scripts in SL |
12227 | return 0; | 12027 | return 16384; |
12228 | } | 12028 | } |
12229 | 12029 | ||
12230 | public void llScriptProfiler(LSL_Integer flags) | 12030 | public void llScriptProfiler(LSL_Integer flags) |
12231 | { | 12031 | { |
12232 | m_host.AddScriptLPS(1); | 12032 | m_host.AddScriptLPS(1); |
12233 | //NotImplemented("llScriptProfiler"); | 12033 | // This does nothing for LSO scripts in SL |
12034 | } | ||
12035 | |||
12036 | #region Not Implemented | ||
12037 | // | ||
12038 | // Listing the unimplemented lsl functions here, please move | ||
12039 | // them from this region as they are completed | ||
12040 | // | ||
12041 | |||
12042 | public void llGetEnv(LSL_String name) | ||
12043 | { | ||
12044 | m_host.AddScriptLPS(1); | ||
12045 | NotImplemented("llGetEnv"); | ||
12234 | } | 12046 | } |
12235 | 12047 | ||
12236 | public void llSetSoundQueueing(int queue) | 12048 | public void llSetSoundQueueing(int queue) |
@@ -12310,8 +12122,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12310 | 12122 | ||
12311 | try | 12123 | try |
12312 | { | 12124 | { |
12313 | UUID invItemID=InventorySelf(); | 12125 | TaskInventoryItem item = m_item; |
12314 | if (invItemID == UUID.Zero) | 12126 | if (item == null) |
12315 | { | 12127 | { |
12316 | replydata = "SERVICE_ERROR"; | 12128 | replydata = "SERVICE_ERROR"; |
12317 | return; | 12129 | return; |
@@ -12319,10 +12131,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12319 | 12131 | ||
12320 | m_host.AddScriptLPS(1); | 12132 | m_host.AddScriptLPS(1); |
12321 | 12133 | ||
12322 | m_host.TaskInventory.LockItemsForRead(true); | ||
12323 | TaskInventoryItem item = m_host.TaskInventory[invItemID]; | ||
12324 | m_host.TaskInventory.LockItemsForRead(false); | ||
12325 | |||
12326 | if (item.PermsGranter == UUID.Zero) | 12134 | if (item.PermsGranter == UUID.Zero) |
12327 | { | 12135 | { |
12328 | replydata = "MISSING_PERMISSION_DEBIT"; | 12136 | replydata = "MISSING_PERMISSION_DEBIT"; |
@@ -12364,7 +12172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12364 | } | 12172 | } |
12365 | finally | 12173 | finally |
12366 | { | 12174 | { |
12367 | m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( | 12175 | m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( |
12368 | "transaction_result", new Object[] { | 12176 | "transaction_result", new Object[] { |
12369 | new LSL_String(txn.ToString()), | 12177 | new LSL_String(txn.ToString()), |
12370 | new LSL_Integer(replycode), | 12178 | new LSL_Integer(replycode), |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d..795de80 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -58,17 +58,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
58 | { | 58 | { |
59 | internal IScriptEngine m_ScriptEngine; | 59 | internal IScriptEngine m_ScriptEngine; |
60 | internal SceneObjectPart m_host; | 60 | internal SceneObjectPart m_host; |
61 | internal uint m_localID; | ||
62 | internal UUID m_itemID; | ||
63 | internal bool m_LSFunctionsEnabled = false; | 61 | internal bool m_LSFunctionsEnabled = false; |
64 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
65 | 63 | ||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
67 | { | 65 | { |
68 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
69 | m_host = host; | 67 | m_host = host; |
70 | m_localID = localID; | ||
71 | m_itemID = itemID; | ||
72 | 68 | ||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
74 | m_LSFunctionsEnabled = true; | 70 | m_LSFunctionsEnabled = true; |
@@ -449,7 +445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
449 | LSShoutError("LightShare functions are not enabled."); | 445 | LSShoutError("LightShare functions are not enabled."); |
450 | return 0; | 446 | return 0; |
451 | } | 447 | } |
452 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 448 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
453 | { | 449 | { |
454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 450 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
455 | return 0; | 451 | return 0; |
@@ -477,7 +473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
477 | LSShoutError("LightShare functions are not enabled."); | 473 | LSShoutError("LightShare functions are not enabled."); |
478 | return; | 474 | return; |
479 | } | 475 | } |
480 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 476 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
481 | { | 477 | { |
482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 478 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
483 | return; | 479 | return; |
@@ -500,7 +496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
500 | LSShoutError("LightShare functions are not enabled."); | 496 | LSShoutError("LightShare functions are not enabled."); |
501 | return 0; | 497 | return 0; |
502 | } | 498 | } |
503 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 499 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
504 | { | 500 | { |
505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 501 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
506 | return 0; | 502 | return 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7c07e15..4bd3dff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -57,17 +57,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
57 | { | 57 | { |
58 | internal IScriptEngine m_ScriptEngine; | 58 | internal IScriptEngine m_ScriptEngine; |
59 | internal SceneObjectPart m_host; | 59 | internal SceneObjectPart m_host; |
60 | internal uint m_localID; | 60 | internal TaskInventoryItem m_item; |
61 | internal UUID m_itemID; | ||
62 | internal bool m_MODFunctionsEnabled = false; | 61 | internal bool m_MODFunctionsEnabled = false; |
63 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
64 | 63 | ||
65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
66 | { | 65 | { |
67 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
68 | m_host = host; | 67 | m_host = host; |
69 | m_localID = localID; | 68 | m_item = item; |
70 | m_itemID = itemID; | ||
71 | 69 | ||
72 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) | 70 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) |
73 | m_MODFunctionsEnabled = true; | 71 | m_MODFunctionsEnabled = true; |
@@ -252,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
252 | // non-null but don't trust it completely | 250 | // non-null but don't trust it completely |
253 | try | 251 | try |
254 | { | 252 | { |
255 | object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms); | 253 | object result = m_comms.InvokeOperation(m_host.UUID, m_item.ItemID, fname, convertedParms); |
256 | if (result != null) | 254 | if (result != null) |
257 | return result; | 255 | return result; |
258 | 256 | ||
@@ -279,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
279 | 277 | ||
280 | UUID req = UUID.Random(); | 278 | UUID req = UUID.Random(); |
281 | 279 | ||
282 | m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k); | 280 | m_comms.RaiseEvent(m_item.ItemID, req.ToString(), module, command, k); |
283 | 281 | ||
284 | return req.ToString(); | 282 | return req.ToString(); |
285 | } | 283 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..8237b60 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -128,11 +128,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
128 | { | 128 | { |
129 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 129 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
130 | 130 | ||
131 | public const string GridInfoServiceConfigSectionName = "GridInfoService"; | ||
132 | |||
131 | internal IScriptEngine m_ScriptEngine; | 133 | internal IScriptEngine m_ScriptEngine; |
132 | internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there | 134 | internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there |
133 | internal SceneObjectPart m_host; | 135 | internal SceneObjectPart m_host; |
134 | internal uint m_localID; | 136 | internal TaskInventoryItem m_item; |
135 | internal UUID m_itemID; | ||
136 | internal bool m_OSFunctionsEnabled = false; | 137 | internal bool m_OSFunctionsEnabled = false; |
137 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; | 138 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; |
138 | internal float m_ScriptDelayFactor = 1.0f; | 139 | internal float m_ScriptDelayFactor = 1.0f; |
@@ -140,12 +141,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
140 | internal bool m_debuggerSafe = false; | 141 | internal bool m_debuggerSafe = false; |
141 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
142 | 143 | ||
143 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 144 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
144 | { | 145 | { |
145 | m_ScriptEngine = ScriptEngine; | 146 | m_ScriptEngine = ScriptEngine; |
146 | m_host = host; | 147 | m_host = host; |
147 | m_localID = localID; | 148 | m_item = item; |
148 | m_itemID = itemID; | ||
149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
150 | 150 | ||
151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
@@ -218,12 +218,20 @@ 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) |
224 | return; | 232 | return; |
225 | 233 | ||
226 | m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL"); | 234 | m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL"); |
227 | } | 235 | } |
228 | 236 | ||
229 | // | 237 | // |
@@ -342,22 +350,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | return; | 350 | return; |
343 | } | 351 | } |
344 | 352 | ||
345 | TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); | 353 | UUID ownerID = m_item.OwnerID; |
346 | if (ti == null) | ||
347 | { | ||
348 | OSSLError( | ||
349 | String.Format("{0} permission error. Can't find script in prim inventory.", | ||
350 | function)); | ||
351 | } | ||
352 | |||
353 | UUID ownerID = ti.OwnerID; | ||
354 | 354 | ||
355 | //OSSL only may be used if objet is in the same group as the parcel | 355 | //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")) | 356 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
357 | { | 357 | { |
358 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 358 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
359 | 359 | ||
360 | if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) | 360 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
361 | { | 361 | { |
362 | return; | 362 | return; |
363 | } | 363 | } |
@@ -378,7 +378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) | 378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) |
379 | { | 379 | { |
380 | //Only Estate Managers may use the function | 380 | //Only Estate Managers may use the function |
381 | if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 381 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
382 | { | 382 | { |
383 | return; | 383 | return; |
384 | } | 384 | } |
@@ -393,13 +393,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
396 | if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) | 396 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
397 | OSSLError( | 397 | OSSLError( |
398 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 398 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
399 | function)); | 399 | function)); |
400 | if (ti.CreatorID != ownerID) | 400 | |
401 | if (m_item.CreatorID != ownerID) | ||
401 | { | 402 | { |
402 | if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 403 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
403 | OSSLError( | 404 | OSSLError( |
404 | String.Format("{0} permission denied. Script permissions error.", | 405 | String.Format("{0} permission denied. Script permissions error.", |
405 | function)); | 406 | function)); |
@@ -730,11 +731,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
730 | 731 | ||
731 | m_host.AddScriptLPS(1); | 732 | m_host.AddScriptLPS(1); |
732 | 733 | ||
734 | // 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)) | 735 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
734 | { | 736 | { |
735 | MainConsole.Instance.RunCommand(command); | 737 | MainConsole.Instance.RunCommand(command); |
736 | return true; | 738 | return true; |
737 | } | 739 | } |
740 | |||
738 | return false; | 741 | return false; |
739 | } | 742 | } |
740 | 743 | ||
@@ -957,21 +960,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
957 | UUID avatarID = (UUID)avatar; | 960 | UUID avatarID = (UUID)avatar; |
958 | 961 | ||
959 | m_host.AddScriptLPS(1); | 962 | m_host.AddScriptLPS(1); |
963 | |||
964 | // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common | ||
965 | // method (though see that doesn't do the is animation check, which is probably a bug) and have both | ||
966 | // these functions call that common code. However, this does mean navigating the brain-dead requirement | ||
967 | // of calling InitLSL() | ||
960 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) | 968 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) |
961 | { | 969 | { |
962 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 970 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; |
963 | if (target != null) | 971 | if (target != null) |
964 | { | 972 | { |
965 | UUID animID = UUID.Zero; | 973 | UUID animID; |
966 | m_host.TaskInventory.LockItemsForRead(true); | 974 | |
967 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 975 | if (!UUID.TryParse(animation, out animID)) |
968 | { | 976 | { |
969 | if (inv.Value.Name == animation) | 977 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation); |
970 | { | 978 | if (item != null && item.Type == (int)AssetType.Animation) |
971 | if (inv.Value.Type == (int)AssetType.Animation) | 979 | animID = item.AssetID; |
972 | animID = inv.Value.AssetID; | 980 | else |
973 | continue; | 981 | animID = UUID.Zero; |
974 | } | ||
975 | } | 982 | } |
976 | m_host.TaskInventory.LockItemsForRead(false); | 983 | m_host.TaskInventory.LockItemsForRead(false); |
977 | 984 | ||
@@ -1178,7 +1185,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1178 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); | 1185 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); |
1179 | m_host.AddScriptLPS(1); | 1186 | m_host.AddScriptLPS(1); |
1180 | 1187 | ||
1181 | m_host.SetScriptEvents(m_itemID, events); | 1188 | m_host.SetScriptEvents(m_item.ItemID, events); |
1182 | } | 1189 | } |
1183 | 1190 | ||
1184 | public void osSetRegionWaterHeight(double height) | 1191 | public void osSetRegionWaterHeight(double height) |
@@ -1186,12 +1193,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1193 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1187 | 1194 | ||
1188 | m_host.AddScriptLPS(1); | 1195 | m_host.AddScriptLPS(1); |
1189 | //Check to make sure that the script's owner is the estate manager/master | 1196 | |
1190 | //World.Permissions.GenericEstatePermission( | 1197 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1191 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1192 | { | ||
1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | ||
1194 | } | ||
1195 | } | 1198 | } |
1196 | 1199 | ||
1197 | /// <summary> | 1200 | /// <summary> |
@@ -1202,27 +1205,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> | 1205 | /// <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) | 1206 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) |
1204 | { | 1207 | { |
1205 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); | 1208 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1206 | 1209 | ||
1207 | m_host.AddScriptLPS(1); | 1210 | 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 | 1211 | ||
1215 | while (sunHour < 0) | 1212 | while (sunHour > 24.0) |
1216 | sunHour += 24.0; | 1213 | sunHour -= 24.0; |
1217 | 1214 | ||
1215 | while (sunHour < 0) | ||
1216 | sunHour += 24.0; | ||
1218 | 1217 | ||
1219 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1218 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1220 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1219 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1221 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1220 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1222 | World.RegionInfo.RegionSettings.Save(); | 1221 | World.RegionInfo.RegionSettings.Save(); |
1223 | 1222 | ||
1224 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | 1223 | World.EventManager.TriggerEstateToolsSunUpdate( |
1225 | } | 1224 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); |
1226 | } | 1225 | } |
1227 | 1226 | ||
1228 | /// <summary> | 1227 | /// <summary> |
@@ -1232,26 +1231,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> | 1231 | /// <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) | 1232 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) |
1234 | { | 1233 | { |
1235 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | 1234 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1236 | 1235 | ||
1237 | m_host.AddScriptLPS(1); | 1236 | 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 | 1237 | ||
1245 | while (sunHour < 0) | 1238 | while (sunHour > 24.0) |
1246 | sunHour += 24.0; | 1239 | sunHour -= 24.0; |
1247 | 1240 | ||
1248 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | 1241 | while (sunHour < 0) |
1249 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | 1242 | sunHour += 24.0; |
1250 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1251 | World.RegionInfo.EstateSettings.Save(); | ||
1252 | 1243 | ||
1253 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | 1244 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; |
1254 | } | 1245 | World.RegionInfo.EstateSettings.SunPosition = sunHour; |
1246 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1247 | World.RegionInfo.EstateSettings.Save(); | ||
1248 | |||
1249 | World.EventManager.TriggerEstateToolsSunUpdate( | ||
1250 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1255 | } | 1251 | } |
1256 | 1252 | ||
1257 | /// <summary> | 1253 | /// <summary> |
@@ -1627,7 +1623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1627 | 1623 | ||
1628 | public Object osParseJSONNew(string JSON) | 1624 | public Object osParseJSONNew(string JSON) |
1629 | { | 1625 | { |
1630 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1626 | CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); |
1631 | 1627 | ||
1632 | m_host.AddScriptLPS(1); | 1628 | m_host.AddScriptLPS(1); |
1633 | 1629 | ||
@@ -2042,8 +2038,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2042 | string nick = String.Empty; | 2038 | string nick = String.Empty; |
2043 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2039 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2044 | 2040 | ||
2045 | if (config.Configs["GridInfo"] != null) | 2041 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2046 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); | 2042 | nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); |
2047 | 2043 | ||
2048 | if (String.IsNullOrEmpty(nick)) | 2044 | if (String.IsNullOrEmpty(nick)) |
2049 | nick = GridUserInfo(InfoType.Nick); | 2045 | nick = GridUserInfo(InfoType.Nick); |
@@ -2059,8 +2055,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2059 | string name = String.Empty; | 2055 | string name = String.Empty; |
2060 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2056 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2061 | 2057 | ||
2062 | if (config.Configs["GridInfo"] != null) | 2058 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2063 | name = config.Configs["GridInfo"].GetString("gridname", name); | 2059 | name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); |
2064 | 2060 | ||
2065 | if (String.IsNullOrEmpty(name)) | 2061 | if (String.IsNullOrEmpty(name)) |
2066 | name = GridUserInfo(InfoType.Name); | 2062 | name = GridUserInfo(InfoType.Name); |
@@ -2076,8 +2072,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2076 | string loginURI = String.Empty; | 2072 | string loginURI = String.Empty; |
2077 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2073 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2078 | 2074 | ||
2079 | if (config.Configs["GridInfo"] != null) | 2075 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2080 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); | 2076 | loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); |
2081 | 2077 | ||
2082 | if (String.IsNullOrEmpty(loginURI)) | 2078 | if (String.IsNullOrEmpty(loginURI)) |
2083 | loginURI = GridUserInfo(InfoType.Login); | 2079 | loginURI = GridUserInfo(InfoType.Login); |
@@ -2124,8 +2120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2124 | string retval = String.Empty; | 2120 | string retval = String.Empty; |
2125 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2121 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2126 | 2122 | ||
2127 | if (config.Configs["GridInfo"] != null) | 2123 | if (config.Configs[GridInfoServiceConfigSectionName] != null) |
2128 | retval = config.Configs["GridInfo"].GetString(key, retval); | 2124 | retval = config.Configs[GridInfoServiceConfigSectionName].GetString(key, retval); |
2129 | 2125 | ||
2130 | if (String.IsNullOrEmpty(retval)) | 2126 | if (String.IsNullOrEmpty(retval)) |
2131 | retval = GridUserInfo(InfoType.Custom, key); | 2127 | retval = GridUserInfo(InfoType.Custom, key); |
@@ -2480,7 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2480 | return; | 2476 | return; |
2481 | 2477 | ||
2482 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); | 2478 | Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); |
2483 | module.MoveToTarget(npcId, World, pos, false, true); | 2479 | module.MoveToTarget(npcId, World, pos, false, true, false); |
2484 | } | 2480 | } |
2485 | } | 2481 | } |
2486 | 2482 | ||
@@ -2505,7 +2501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2505 | World, | 2501 | World, |
2506 | pos, | 2502 | pos, |
2507 | (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, | 2503 | (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, |
2508 | (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); | 2504 | (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, |
2505 | (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); | ||
2509 | } | 2506 | } |
2510 | } | 2507 | } |
2511 | 2508 | ||
@@ -2555,7 +2552,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2555 | 2552 | ||
2556 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2553 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2557 | { | 2554 | { |
2558 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2555 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
2559 | m_host.AddScriptLPS(1); | 2556 | m_host.AddScriptLPS(1); |
2560 | 2557 | ||
2561 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2558 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -2572,6 +2569,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2572 | 2569 | ||
2573 | public void osNpcSay(LSL_Key npc, string message) | 2570 | public void osNpcSay(LSL_Key npc, string message) |
2574 | { | 2571 | { |
2572 | osNpcSay(npc, 0, message); | ||
2573 | } | ||
2574 | |||
2575 | public void osNpcSay(LSL_Key npc, int channel, string message) | ||
2576 | { | ||
2575 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2577 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2576 | m_host.AddScriptLPS(1); | 2578 | m_host.AddScriptLPS(1); |
2577 | 2579 | ||
@@ -2583,7 +2585,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2583 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | 2585 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2584 | return; | 2586 | return; |
2585 | 2587 | ||
2586 | module.Say(npcId, World, message); | 2588 | module.Say(npcId, World, message, channel); |
2589 | } | ||
2590 | } | ||
2591 | |||
2592 | public void osNpcShout(LSL_Key npc, int channel, string message) | ||
2593 | { | ||
2594 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | ||
2595 | m_host.AddScriptLPS(1); | ||
2596 | |||
2597 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2598 | if (module != null) | ||
2599 | { | ||
2600 | UUID npcId = new UUID(npc.m_string); | ||
2601 | |||
2602 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2603 | return; | ||
2604 | |||
2605 | module.Shout(npcId, World, message, channel); | ||
2587 | } | 2606 | } |
2588 | } | 2607 | } |
2589 | 2608 | ||
@@ -2684,6 +2703,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2684 | } | 2703 | } |
2685 | } | 2704 | } |
2686 | 2705 | ||
2706 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | ||
2707 | { | ||
2708 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | ||
2709 | m_host.AddScriptLPS(1); | ||
2710 | |||
2711 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2712 | if (module != null) | ||
2713 | { | ||
2714 | UUID npcId = new UUID(npc.m_string); | ||
2715 | |||
2716 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2717 | return; | ||
2718 | |||
2719 | module.Whisper(npcId, World, message, channel); | ||
2720 | } | ||
2721 | } | ||
2722 | |||
2687 | /// <summary> | 2723 | /// <summary> |
2688 | /// Save the current appearance of the script owner permanently to the named notecard. | 2724 | /// Save the current appearance of the script owner permanently to the named notecard. |
2689 | /// </summary> | 2725 | /// </summary> |
@@ -2835,21 +2871,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2835 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2871 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2836 | m_host.AddScriptLPS(1); | 2872 | m_host.AddScriptLPS(1); |
2837 | 2873 | ||
2838 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2874 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
2839 | { | 2875 | { |
2840 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2876 | if (sp.Firstname == FirstName && sp.Lastname == SurName) |
2841 | { | 2877 | { |
2842 | if (sp.Firstname == FirstName && sp.Lastname == SurName) | 2878 | // kick client... |
2843 | { | 2879 | if (alert != null) |
2844 | // kick client... | 2880 | sp.ControllingClient.Kick(alert); |
2845 | if (alert != null) | ||
2846 | sp.ControllingClient.Kick(alert); | ||
2847 | 2881 | ||
2848 | // ...and close on our side | 2882 | // ...and close on our side |
2849 | sp.Scene.IncomingCloseAgent(sp.UUID); | 2883 | sp.Scene.IncomingCloseAgent(sp.UUID); |
2850 | } | 2884 | } |
2851 | }); | 2885 | }); |
2852 | } | ||
2853 | } | 2886 | } |
2854 | 2887 | ||
2855 | public void osCauseDamage(string avatar, double damage) | 2888 | public void osCauseDamage(string avatar, double damage) |
@@ -3095,5 +3128,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3128 | ||
3096 | return ScriptBaseClass.TRUE; | 3129 | return ScriptBaseClass.TRUE; |
3097 | } | 3130 | } |
3131 | |||
3132 | /// <summary> | ||
3133 | /// Sets terrain estate texture | ||
3134 | /// </summary> | ||
3135 | /// <param name="level"></param> | ||
3136 | /// <param name="texture"></param> | ||
3137 | /// <returns></returns> | ||
3138 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3139 | { | ||
3140 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3141 | |||
3142 | m_host.AddScriptLPS(1); | ||
3143 | //Check to make sure that the script's owner is the estate manager/master | ||
3144 | //World.Permissions.GenericEstatePermission( | ||
3145 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3146 | { | ||
3147 | if (level < 0 || level > 3) | ||
3148 | return; | ||
3149 | |||
3150 | UUID textureID = new UUID(); | ||
3151 | if (!UUID.TryParse(texture, out textureID)) | ||
3152 | return; | ||
3153 | |||
3154 | // estate module is required | ||
3155 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3156 | if (estate != null) | ||
3157 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3158 | } | ||
3159 | } | ||
3160 | |||
3161 | /// <summary> | ||
3162 | /// Sets terrain heights of estate | ||
3163 | /// </summary> | ||
3164 | /// <param name="corner"></param> | ||
3165 | /// <param name="low"></param> | ||
3166 | /// <param name="high"></param> | ||
3167 | /// <returns></returns> | ||
3168 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3169 | { | ||
3170 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3171 | |||
3172 | m_host.AddScriptLPS(1); | ||
3173 | //Check to make sure that the script's owner is the estate manager/master | ||
3174 | //World.Permissions.GenericEstatePermission( | ||
3175 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3176 | { | ||
3177 | if (corner < 0 || corner > 3) | ||
3178 | return; | ||
3179 | |||
3180 | // estate module is required | ||
3181 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3182 | if (estate != null) | ||
3183 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3184 | } | ||
3185 | } | ||
3186 | |||
3187 | public void osForceAttachToAvatar(int attachmentPoint) | ||
3188 | { | ||
3189 | CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); | ||
3190 | |||
3191 | m_host.AddScriptLPS(1); | ||
3192 | |||
3193 | InitLSL(); | ||
3194 | ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); | ||
3195 | } | ||
3196 | |||
3197 | public void osForceDetachFromAvatar() | ||
3198 | { | ||
3199 | CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); | ||
3200 | |||
3201 | m_host.AddScriptLPS(1); | ||
3202 | |||
3203 | InitLSL(); | ||
3204 | ((LSL_Api)m_LSL_Api).DetachFromAvatar(); | ||
3205 | } | ||
3098 | } | 3206 | } |
3099 | } | 3207 | } |
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 be5740e..048124d 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); |
@@ -150,7 +151,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
150 | LSL_Rotation llGetLocalRot(); | 151 | LSL_Rotation llGetLocalRot(); |
151 | LSL_Float llGetMass(); | 152 | LSL_Float llGetMass(); |
152 | LSL_Float llGetMassMKS(); | 153 | LSL_Float llGetMassMKS(); |
153 | void llGetNextEmail(string address, string subject); | 154 | LSL_Integer llGetMemoryLimit(); |
155 | void llGetNextEmail(string address, string subject); | ||
154 | LSL_String llGetNotecardLine(string name, int line); | 156 | LSL_String llGetNotecardLine(string name, int line); |
155 | LSL_Key llGetNumberOfNotecardLines(string name); | 157 | LSL_Key llGetNumberOfNotecardLines(string name); |
156 | LSL_Integer llGetNumberOfPrims(); | 158 | LSL_Integer llGetNumberOfPrims(); |
@@ -188,6 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
188 | LSL_String llGetScriptName(); | 190 | LSL_String llGetScriptName(); |
189 | LSL_Integer llGetScriptState(string name); | 191 | LSL_Integer llGetScriptState(string name); |
190 | LSL_String llGetSimulatorHostname(); | 192 | LSL_String llGetSimulatorHostname(); |
193 | LSL_Integer llGetSPMaxMemory(); | ||
191 | LSL_Integer llGetStartParameter(); | 194 | LSL_Integer llGetStartParameter(); |
192 | LSL_Integer llGetStatus(int status); | 195 | LSL_Integer llGetStatus(int status); |
193 | LSL_String llGetSubString(string src, int start, int end); | 196 | LSL_String llGetSubString(string src, int start, int end); |
@@ -323,6 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
323 | void llSay(int channelID, string text); | 326 | void llSay(int channelID, string text); |
324 | void llScaleTexture(double u, double v, int face); | 327 | void llScaleTexture(double u, double v, int face); |
325 | LSL_Integer llScriptDanger(LSL_Vector pos); | 328 | LSL_Integer llScriptDanger(LSL_Vector pos); |
329 | void llScriptProfiler(LSL_Integer flag); | ||
326 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); | 330 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); |
327 | void llSensor(string name, string id, int type, double range, double arc); | 331 | void llSensor(string name, string id, int type, double range, double arc); |
328 | void llSensorRemove(); | 332 | void llSensorRemove(); |
@@ -346,6 +350,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
346 | void llSetLinkTexture(int linknumber, string texture, int face); | 350 | void llSetLinkTexture(int linknumber, string texture, int face); |
347 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 351 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
348 | void llSetLocalRot(LSL_Rotation rot); | 352 | void llSetLocalRot(LSL_Rotation rot); |
353 | LSL_Integer llSetMemoryLimit(LSL_Integer limit); | ||
349 | void llSetObjectDesc(string desc); | 354 | void llSetObjectDesc(string desc); |
350 | void llSetObjectName(string name); | 355 | void llSetObjectName(string name); |
351 | void llSetObjectPermMask(int mask, int value); | 356 | 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 278f74e..5c6ad8a 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; |
@@ -641,6 +644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
641 | public const int OS_NPC_FLY = 0; | 644 | public const int OS_NPC_FLY = 0; |
642 | public const int OS_NPC_NO_FLY = 1; | 645 | public const int OS_NPC_NO_FLY = 1; |
643 | public const int OS_NPC_LAND_AT_TARGET = 2; | 646 | public const int OS_NPC_LAND_AT_TARGET = 2; |
647 | public const int OS_NPC_RUNNING = 4; | ||
644 | 648 | ||
645 | public const int OS_NPC_SIT_NOW = 0; | 649 | public const int OS_NPC_SIT_NOW = 0; |
646 | 650 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 9ba9561..2d23d30 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(); |
@@ -591,6 +596,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
591 | return m_LSL_Functions.llGetMassMKS(); | 596 | return m_LSL_Functions.llGetMassMKS(); |
592 | } | 597 | } |
593 | 598 | ||
599 | public LSL_Integer llGetMemoryLimit() | ||
600 | { | ||
601 | return m_LSL_Functions.llGetMemoryLimit(); | ||
602 | } | ||
603 | |||
594 | public void llGetNextEmail(string address, string subject) | 604 | public void llGetNextEmail(string address, string subject) |
595 | { | 605 | { |
596 | m_LSL_Functions.llGetNextEmail(address, subject); | 606 | m_LSL_Functions.llGetNextEmail(address, subject); |
@@ -781,6 +791,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
781 | return m_LSL_Functions.llGetSimulatorHostname(); | 791 | return m_LSL_Functions.llGetSimulatorHostname(); |
782 | } | 792 | } |
783 | 793 | ||
794 | public LSL_Integer llGetSPMaxMemory() | ||
795 | { | ||
796 | return m_LSL_Functions.llGetSPMaxMemory(); | ||
797 | } | ||
798 | |||
784 | public LSL_Integer llGetStartParameter() | 799 | public LSL_Integer llGetStartParameter() |
785 | { | 800 | { |
786 | return m_LSL_Functions.llGetStartParameter(); | 801 | return m_LSL_Functions.llGetStartParameter(); |
@@ -1450,6 +1465,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1450 | return m_LSL_Functions.llScriptDanger(pos); | 1465 | return m_LSL_Functions.llScriptDanger(pos); |
1451 | } | 1466 | } |
1452 | 1467 | ||
1468 | public void llScriptProfiler(LSL_Integer flags) | ||
1469 | { | ||
1470 | m_LSL_Functions.llScriptProfiler(flags); | ||
1471 | } | ||
1472 | |||
1453 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) | 1473 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) |
1454 | { | 1474 | { |
1455 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); | 1475 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
@@ -1560,6 +1580,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1560 | m_LSL_Functions.llSetLocalRot(rot); | 1580 | m_LSL_Functions.llSetLocalRot(rot); |
1561 | } | 1581 | } |
1562 | 1582 | ||
1583 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) | ||
1584 | { | ||
1585 | return m_LSL_Functions.llSetMemoryLimit(limit); | ||
1586 | } | ||
1587 | |||
1563 | public void llSetObjectDesc(string desc) | 1588 | public void llSetObjectDesc(string desc) |
1564 | { | 1589 | { |
1565 | m_LSL_Functions.llSetObjectDesc(desc); | 1590 | 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 | } |