aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordahlia2015-05-29 23:02:12 -0700
committerdahlia2015-05-29 23:02:12 -0700
commit5d3c327e939be9e134c1ca8853f653d9b7d080e2 (patch)
treea4f6b1344b95dae48b5640b90e7e6e67e596f868
parentllListRandomize() wasn't very random (diff)
downloadopensim-SC_OLD-5d3c327e939be9e134c1ca8853f653d9b7d080e2.zip
opensim-SC_OLD-5d3c327e939be9e134c1ca8853f653d9b7d080e2.tar.gz
opensim-SC_OLD-5d3c327e939be9e134c1ca8853f653d9b7d080e2.tar.bz2
opensim-SC_OLD-5d3c327e939be9e134c1ca8853f653d9b7d080e2.tar.xz
Add a new os function "osGetGender()"
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs45
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
3 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b0b0baa..517a9d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2978,6 +2978,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2978 2978
2979 return SaveAppearanceToNotecard(avatarId, notecard); 2979 return SaveAppearanceToNotecard(avatarId, notecard);
2980 } 2980 }
2981
2982 /// <summary>
2983 /// Get the gender as specified in avatar appearance for a given avatar key
2984 /// </summary>
2985 /// <param name="rawAvatarId"></param>
2986 /// <returns>"male" or "female" or "unknown"</returns>
2987 public LSL_String osGetGender(LSL_Key rawAvatarId)
2988 {
2989 CheckThreatLevel(ThreatLevel.None, "osGetGender");
2990 m_host.AddScriptLPS(1);
2991
2992 UUID avatarId;
2993 if (!UUID.TryParse(rawAvatarId, out avatarId))
2994 return new LSL_String("unknown");
2995
2996 ScenePresence sp = World.GetScenePresence(avatarId);
2997
2998 if (sp == null || sp.IsChildAgent || sp.Appearance == null || sp.Appearance.VisualParams == null)
2999 return new LSL_String("unknown");
3000
3001 // find the index of "shape" parameter "male"
3002 int vpShapeMaleIndex = 0;
3003 bool indexFound = false;
3004 VisualParam param = new VisualParam();
3005 foreach(var vpEntry in VisualParams.Params)
3006 {
3007 param = vpEntry.Value;
3008 if (param.Name == "male" && param.Wearable == "shape")
3009 {
3010 indexFound = true;
3011 break;
3012 }
3013
3014 if (param.Group == 0)
3015 vpShapeMaleIndex++;
3016 }
3017
3018 if (!indexFound)
3019 return new LSL_String("unknown");
3020
3021 float vpShapeMale = Utils.ByteToFloat(sp.Appearance.VisualParams[vpShapeMaleIndex], param.MinValue, param.MaxValue);
3022
3023 bool isMale = vpShapeMale > 0.5f;
3024 return new LSL_String(isMale ? "male" : "female");
3025 }
2981 3026
2982 /// <summary> 3027 /// <summary>
2983 /// Get current region's map texture UUID 3028 /// Get current region's map texture UUID
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index b903667..d072528 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -353,6 +353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
353 LSL_Key osOwnerSaveAppearance(string notecard); 353 LSL_Key osOwnerSaveAppearance(string notecard);
354 LSL_Key osAgentSaveAppearance(key agentId, string notecard); 354 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
355 355
356 key osGetGender(LSL_Key rawAvatarId);
356 key osGetMapTexture(); 357 key osGetMapTexture();
357 key osGetRegionMapTexture(string regionName); 358 key osGetRegionMapTexture(string regionName);
358 LSL_List osGetRegionStats(); 359 LSL_List osGetRegionStats();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 6030325..c5c55d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -870,6 +870,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
870 } 870 }
871 } 871 }
872 872
873 public string osGetGender(LSL_Key rawAvatarId)
874 {
875 return m_OSSL_Functions.osGetGender(rawAvatarId);
876 }
877
873 public key osGetMapTexture() 878 public key osGetMapTexture()
874 { 879 {
875 return m_OSSL_Functions.osGetMapTexture(); 880 return m_OSSL_Functions.osGetMapTexture();