diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 129 |
1 files changed, 81 insertions, 48 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 |