diff options
author | Melanie | 2012-01-06 22:59:08 +0000 |
---|---|---|
committer | Melanie | 2012-01-06 22:59:50 +0000 |
commit | 966899249327f4055c6f1492447d665eb42d09d9 (patch) | |
tree | ed78eb003b48fff183e447581d10c9f0c8af57de | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-966899249327f4055c6f1492447d665eb42d09d9.zip opensim-SC-966899249327f4055c6f1492447d665eb42d09d9.tar.gz opensim-SC-966899249327f4055c6f1492447d665eb42d09d9.tar.bz2 opensim-SC-966899249327f4055c6f1492447d665eb42d09d9.tar.xz |
Add osNpcPlayAnimation and osNpcStopAnimation which respect ownership as well
3 files changed, 56 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 c1a700a..efb77ae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -888,6 +888,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
888 | { | 888 | { |
889 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); | 889 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); |
890 | 890 | ||
891 | AvatarPlayAnimation(avatar, animation); | ||
892 | } | ||
893 | |||
894 | private void AvatarPlayAnimation(string avatar, string animation) | ||
895 | { | ||
891 | UUID avatarID = (UUID)avatar; | 896 | UUID avatarID = (UUID)avatar; |
892 | 897 | ||
893 | m_host.AddScriptLPS(1); | 898 | m_host.AddScriptLPS(1); |
@@ -921,6 +926,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
921 | { | 926 | { |
922 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); | 927 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); |
923 | 928 | ||
929 | AvatarStopAnimation(avatar, animation); | ||
930 | } | ||
931 | |||
932 | private void AvatarStopAnimation(string avatar, string animation) | ||
933 | { | ||
924 | UUID avatarID = (UUID)avatar; | 934 | UUID avatarID = (UUID)avatar; |
925 | 935 | ||
926 | m_host.AddScriptLPS(1); | 936 | m_host.AddScriptLPS(1); |
@@ -2332,6 +2342,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2332 | } | 2342 | } |
2333 | } | 2343 | } |
2334 | 2344 | ||
2345 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | ||
2346 | { | ||
2347 | CheckThreatLevel(ThreatLevel.High, "osPlayAnimation"); | ||
2348 | |||
2349 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2350 | if (module != null) | ||
2351 | { | ||
2352 | UUID npcID = new UUID(npc.m_string); | ||
2353 | if (module.IsNPC(npcID)) | ||
2354 | { | ||
2355 | UUID ownerID = module.GetOwner(npcID); | ||
2356 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2357 | AvatarPlayAnimation(npcID.ToString(), animation); | ||
2358 | } | ||
2359 | } | ||
2360 | } | ||
2361 | |||
2362 | public void osNpcStopAnimation(LSL_Key npc, string animation) | ||
2363 | { | ||
2364 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); | ||
2365 | |||
2366 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2367 | if (module != null) | ||
2368 | { | ||
2369 | UUID npcID = new UUID(npc.m_string); | ||
2370 | if (module.IsNPC(npcID)) | ||
2371 | { | ||
2372 | UUID ownerID = module.GetOwner(npcID); | ||
2373 | if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) | ||
2374 | AvatarStopAnimation(npcID.ToString(), animation); | ||
2375 | } | ||
2376 | } | ||
2377 | } | ||
2378 | |||
2335 | /// <summary> | 2379 | /// <summary> |
2336 | /// Save the current appearance of the script owner permanently to the named notecard. | 2380 | /// Save the current appearance of the script owner permanently to the named notecard. |
2337 | /// </summary> | 2381 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1380ed4..d5e085d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -185,6 +185,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
185 | void osNpcSit(key npc, key target, int options); | 185 | void osNpcSit(key npc, key target, int options); |
186 | void osNpcStand(LSL_Key npc); | 186 | void osNpcStand(LSL_Key npc); |
187 | void osNpcRemove(key npc); | 187 | void osNpcRemove(key npc); |
188 | public void osNpcPlayAnimation(LSL_Key npc, string animation); | ||
189 | public void osNpcStopAnimation(LSL_Key npc, string animation); | ||
188 | 190 | ||
189 | LSL_Key osOwnerSaveAppearance(string notecard); | 191 | LSL_Key osOwnerSaveAppearance(string notecard); |
190 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 192 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 6572def..a94392a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -553,6 +553,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
553 | m_OSSL_Functions.osNpcRemove(npc); | 553 | m_OSSL_Functions.osNpcRemove(npc); |
554 | } | 554 | } |
555 | 555 | ||
556 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | ||
557 | { | ||
558 | m_OSSL_Functions.osNpcPlayAnimation(npc, animation); | ||
559 | } | ||
560 | |||
561 | public void osNpcStopAnimation(LSL_Key npc, string animation) | ||
562 | { | ||
563 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); | ||
564 | } | ||
565 | |||
556 | public LSL_Key osOwnerSaveAppearance(string notecard) | 566 | public LSL_Key osOwnerSaveAppearance(string notecard) |
557 | { | 567 | { |
558 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 568 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |