diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
5 files changed, 135 insertions, 52 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 72ee495..aa28fa0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
81 | /// </summary> | 81 | /// </summary> |
82 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 82 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
83 | { | 83 | { |
84 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 84 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
85 | protected IScriptEngine m_ScriptEngine; | 85 | protected IScriptEngine m_ScriptEngine; |
86 | protected SceneObjectPart m_host; | 86 | protected SceneObjectPart m_host; |
87 | protected uint m_localID; | 87 | protected uint m_localID; |
@@ -9835,63 +9835,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9835 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) | 9835 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) |
9836 | { | 9836 | { |
9837 | m_host.AddScriptLPS(1); | 9837 | m_host.AddScriptLPS(1); |
9838 | |||
9839 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); | ||
9838 | 9840 | ||
9839 | LandData land = World.GetLandData((float)pos.x, (float)pos.y); | 9841 | if (lo == null) |
9840 | |||
9841 | if (land == null) | ||
9842 | { | ||
9843 | return 0; | 9842 | return 0; |
9844 | } | 9843 | |
9844 | IPrimCounts pc = lo.PrimCounts; | ||
9845 | 9845 | ||
9846 | else | 9846 | if (sim_wide != ScriptBaseClass.FALSE) |
9847 | { | 9847 | { |
9848 | if (sim_wide != 0) | 9848 | if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) |
9849 | { | 9849 | { |
9850 | if (category == 0) | 9850 | return pc.Simulator; |
9851 | { | ||
9852 | return land.SimwidePrims; | ||
9853 | } | ||
9854 | |||
9855 | else | ||
9856 | { | ||
9857 | //public int simwideArea = 0; | ||
9858 | return 0; | ||
9859 | } | ||
9860 | } | 9851 | } |
9861 | |||
9862 | else | 9852 | else |
9863 | { | 9853 | { |
9864 | if (category == 0)//Total Prims | 9854 | // counts not implemented yet |
9865 | { | 9855 | return 0; |
9866 | return 0;//land. | ||
9867 | } | ||
9868 | |||
9869 | else if (category == 1)//Owner Prims | ||
9870 | { | ||
9871 | return land.OwnerPrims; | ||
9872 | } | ||
9873 | |||
9874 | else if (category == 2)//Group Prims | ||
9875 | { | ||
9876 | return land.GroupPrims; | ||
9877 | } | ||
9878 | |||
9879 | else if (category == 3)//Other Prims | ||
9880 | { | ||
9881 | return land.OtherPrims; | ||
9882 | } | ||
9883 | |||
9884 | else if (category == 4)//Selected | ||
9885 | { | ||
9886 | return land.SelectedPrims; | ||
9887 | } | ||
9888 | |||
9889 | else if (category == 5)//Temp | ||
9890 | { | ||
9891 | return 0;//land. | ||
9892 | } | ||
9893 | } | 9856 | } |
9894 | } | 9857 | } |
9858 | else | ||
9859 | { | ||
9860 | if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) | ||
9861 | return pc.Total; | ||
9862 | else if (category == ScriptBaseClass.PARCEL_COUNT_OWNER) | ||
9863 | return pc.Owner; | ||
9864 | else if (category == ScriptBaseClass.PARCEL_COUNT_GROUP) | ||
9865 | return pc.Group; | ||
9866 | else if (category == ScriptBaseClass.PARCEL_COUNT_OTHER) | ||
9867 | return pc.Others; | ||
9868 | else if (category == ScriptBaseClass.PARCEL_COUNT_SELECTED) | ||
9869 | return pc.Selected; | ||
9870 | else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) | ||
9871 | return 0; // counts not implemented yet | ||
9872 | } | ||
9873 | |||
9895 | return 0; | 9874 | return 0; |
9896 | } | 9875 | } |
9897 | 9876 | ||
@@ -10278,6 +10257,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10278 | 10257 | ||
10279 | return GetLinkPrimitiveParams(obj, rules); | 10258 | return GetLinkPrimitiveParams(obj, rules); |
10280 | } | 10259 | } |
10260 | |||
10261 | public void print(string str) | ||
10262 | { | ||
10263 | // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print | ||
10264 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); | ||
10265 | if (ossl != null) | ||
10266 | { | ||
10267 | ossl.CheckThreatLevel(ThreatLevel.High, "print"); | ||
10268 | m_log.Info("LSL print():" + str); | ||
10269 | } | ||
10270 | } | ||
10271 | |||
10272 | private string Name2Username(string name) | ||
10273 | { | ||
10274 | string[] parts = name.Split(new char[] {' '}); | ||
10275 | if (parts.Length < 2) | ||
10276 | return name.ToLower(); | ||
10277 | if (parts[1] == "Resident") | ||
10278 | return parts[0].ToLower(); | ||
10279 | |||
10280 | return name.Replace(" ", ".").ToLower(); | ||
10281 | } | ||
10282 | |||
10283 | public LSL_String llGetUsername(string id) | ||
10284 | { | ||
10285 | return Name2Username(llKey2Name(id)); | ||
10286 | } | ||
10287 | |||
10288 | public LSL_String llRequestUsername(string id) | ||
10289 | { | ||
10290 | UUID rq = UUID.Random(); | ||
10291 | |||
10292 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | ||
10293 | |||
10294 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | ||
10295 | |||
10296 | return rq.ToString(); | ||
10297 | } | ||
10298 | |||
10299 | public LSL_String llGetDisplayName(string id) | ||
10300 | { | ||
10301 | return llKey2Name(id); | ||
10302 | } | ||
10303 | |||
10304 | public LSL_String llRequestDisplayName(string id) | ||
10305 | { | ||
10306 | UUID rq = UUID.Random(); | ||
10307 | |||
10308 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | ||
10309 | |||
10310 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | ||
10311 | |||
10312 | return rq.ToString(); | ||
10313 | } | ||
10281 | } | 10314 | } |
10282 | 10315 | ||
10283 | public class NotecardCache | 10316 | public class NotecardCache |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fefbb35..47c7915 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
50 | private Object SenseLock = new Object(); | 50 | private Object SenseLock = new Object(); |
51 | 51 | ||
52 | private const int AGENT = 1; | 52 | private const int AGENT = 1; |
53 | private const int AGENT_BY_USERNAME = 0x10; | ||
53 | private const int ACTIVE = 2; | 54 | private const int ACTIVE = 2; |
54 | private const int PASSIVE = 4; | 55 | private const int PASSIVE = 4; |
55 | private const int SCRIPTED = 8; | 56 | private const int SCRIPTED = 8; |
@@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
202 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 203 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
203 | 204 | ||
204 | // Is the sensor type is AGENT and not SCRIPTED then include agents | 205 | // Is the sensor type is AGENT and not SCRIPTED then include agents |
205 | if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0) | 206 | if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0) |
206 | { | 207 | { |
207 | sensedEntities.AddRange(doAgentSensor(ts)); | 208 | sensedEntities.AddRange(doAgentSensor(ts)); |
208 | } | 209 | } |
@@ -493,9 +494,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
493 | { | 494 | { |
494 | ScenePresence sp; | 495 | ScenePresence sp; |
495 | // Try lookup by name will return if/when found | 496 | // Try lookup by name will return if/when found |
496 | if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) | 497 | if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) |
497 | return sensedEntities; | 498 | senseEntity(sp); |
498 | senseEntity(sp); | 499 | if ((ts.type & AGENT_BY_USERNAME) != 0) |
500 | { | ||
501 | m_CmdManager.m_ScriptEngine.World.ForEachScenePresence( | ||
502 | delegate (ScenePresence ssp) | ||
503 | { | ||
504 | if (ssp.Lastname == "Resident") | ||
505 | { | ||
506 | if (ssp.Firstname.ToLower() == ts.name) | ||
507 | senseEntity(ssp); | ||
508 | return; | ||
509 | } | ||
510 | if (ssp.Name.Replace(" ", ".").ToLower() == ts.name) | ||
511 | senseEntity(ssp); | ||
512 | } | ||
513 | ); | ||
514 | } | ||
515 | |||
516 | return sensedEntities; | ||
499 | } | 517 | } |
500 | else | 518 | else |
501 | { | 519 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 561e3b3..654ea81 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
209 | void llInstantMessage(string user, string message); | 209 | void llInstantMessage(string user, string message); |
210 | LSL_String llIntegerToBase64(int number); | 210 | LSL_String llIntegerToBase64(int number); |
211 | LSL_String llKey2Name(string id); | 211 | LSL_String llKey2Name(string id); |
212 | LSL_String llGetUsername(string id); | ||
213 | LSL_String llRequestUsername(string id); | ||
214 | LSL_String llGetDisplayName(string id); | ||
215 | LSL_String llRequestDisplayName(string id); | ||
212 | void llLinkParticleSystem(int linknum, LSL_List rules); | 216 | void llLinkParticleSystem(int linknum, LSL_List rules); |
213 | LSL_String llList2CSV(LSL_List src); | 217 | LSL_String llList2CSV(LSL_List src); |
214 | LSL_Float llList2Float(LSL_List src, int index); | 218 | LSL_Float llList2Float(LSL_List src, int index); |
@@ -398,6 +402,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
398 | LSL_Vector llWind(LSL_Vector offset); | 402 | LSL_Vector llWind(LSL_Vector offset); |
399 | LSL_String llXorBase64Strings(string str1, string str2); | 403 | LSL_String llXorBase64Strings(string str1, string str2); |
400 | LSL_String llXorBase64StringsCorrect(string str1, string str2); | 404 | LSL_String llXorBase64StringsCorrect(string str1, string str2); |
405 | void print(string str); | ||
401 | 406 | ||
402 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 407 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
403 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 408 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index b3c4d95..9377cda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
50 | public const int STATUS_CAST_SHADOWS = 512; | 50 | public const int STATUS_CAST_SHADOWS = 512; |
51 | 51 | ||
52 | public const int AGENT = 1; | 52 | public const int AGENT = 1; |
53 | public const int AGENT_BY_LEGACY_NAME = 1; | ||
54 | public const int AGENT_BY_USERNAME = 0x10; | ||
53 | public const int ACTIVE = 2; | 55 | public const int ACTIVE = 2; |
54 | public const int PASSIVE = 4; | 56 | public const int PASSIVE = 4; |
55 | public const int SCRIPTED = 8; | 57 | public const int SCRIPTED = 8; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 451163f..303d75e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -894,6 +894,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
894 | return m_LSL_Functions.llKey2Name(id); | 894 | return m_LSL_Functions.llKey2Name(id); |
895 | } | 895 | } |
896 | 896 | ||
897 | public LSL_String llGetUsername(string id) | ||
898 | { | ||
899 | return m_LSL_Functions.llGetUsername(id); | ||
900 | } | ||
901 | |||
902 | public LSL_String llRequestUsername(string id) | ||
903 | { | ||
904 | return m_LSL_Functions.llRequestUsername(id); | ||
905 | } | ||
906 | |||
907 | public LSL_String llGetDisplayName(string id) | ||
908 | { | ||
909 | return m_LSL_Functions.llGetDisplayName(id); | ||
910 | } | ||
911 | |||
912 | public LSL_String llRequestDisplayName(string id) | ||
913 | { | ||
914 | return m_LSL_Functions.llRequestDisplayName(id); | ||
915 | } | ||
916 | |||
897 | public void llLinkParticleSystem(int linknum, LSL_List rules) | 917 | public void llLinkParticleSystem(int linknum, LSL_List rules) |
898 | { | 918 | { |
899 | m_LSL_Functions.llLinkParticleSystem(linknum, rules); | 919 | m_LSL_Functions.llLinkParticleSystem(linknum, rules); |
@@ -1847,5 +1867,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1847 | { | 1867 | { |
1848 | return m_LSL_Functions.llClearPrimMedia(face); | 1868 | return m_LSL_Functions.llClearPrimMedia(face); |
1849 | } | 1869 | } |
1870 | |||
1871 | public void print(string str) | ||
1872 | { | ||
1873 | m_LSL_Functions.print(str); | ||
1874 | } | ||
1850 | } | 1875 | } |
1851 | } | 1876 | } |