aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2018-11-26 16:45:04 +0000
committerUbitUmarov2018-11-26 16:45:04 +0000
commit87acd20d9546e23c9431c5473bcfdb9fab8e4ca2 (patch)
treeb5927bc3f27816f723cf782b6b2209bb0cb26cc1 /OpenSim/Region
parenta fix to contributors list (diff)
downloadopensim-SC-87acd20d9546e23c9431c5473bcfdb9fab8e4ca2.zip
opensim-SC-87acd20d9546e23c9431c5473bcfdb9fab8e4ca2.tar.gz
opensim-SC-87acd20d9546e23c9431c5473bcfdb9fab8e4ca2.tar.bz2
opensim-SC-87acd20d9546e23c9431c5473bcfdb9fab8e4ca2.tar.xz
add script constant OS_APIVERSION, we should inc this on any change on any api. a few changes to os npc and avatar animation functions
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs124
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs4
4 files changed, 83 insertions, 52 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 91a57b0..90352fa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1128,15 +1128,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1128 } 1128 }
1129 1129
1130 // Adam's super super custom animation functions 1130 // Adam's super super custom animation functions
1131 public void osAvatarPlayAnimation(string avatar, string animation) 1131 public void osAvatarPlayAnimation(LSL_Key avatar, string animation)
1132 { 1132 {
1133 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); 1133 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation");
1134 1134
1135 AvatarPlayAnimation(avatar, animation);
1136 }
1137
1138 private void AvatarPlayAnimation(string avatar, string animation)
1139 {
1140 UUID avatarID; 1135 UUID avatarID;
1141 if(!UUID.TryParse(avatar, out avatarID)) 1136 if(!UUID.TryParse(avatar, out avatarID))
1142 return; 1137 return;
@@ -1166,44 +1161,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1166 target.Animator.AddAnimation(animID, m_host.UUID); 1161 target.Animator.AddAnimation(animID, m_host.UUID);
1167 } 1162 }
1168 1163
1169 public void osAvatarStopAnimation(string avatar, string animation) 1164 public void osAvatarStopAnimation(LSL_Key avatar, string animation)
1170 { 1165 {
1171 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); 1166 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation");
1172 1167
1173 AvatarStopAnimation(avatar, animation); 1168 UUID avatarID;
1174 } 1169 if(!UUID.TryParse(avatar, out avatarID))
1170 return;
1175 1171
1176 private void AvatarStopAnimation(string avatar, string animation) 1172 ScenePresence target = World.GetScenePresence(avatarID);
1177 { 1173 if (target == null)
1178 UUID avatarID = (UUID)avatar; 1174 return;
1179 1175
1180 // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common 1176 UUID animID;
1181 // method (though see that doesn't do the is animation check, which is probably a bug) and have both 1177 if (!UUID.TryParse(animation, out animID))
1182 // these functions call that common code. However, this does mean navigating the brain-dead requirement
1183 // of calling InitLSL()
1184 if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence)
1185 { 1178 {
1186 ScenePresence target = (ScenePresence)World.Entities[avatarID]; 1179 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
1187 if (target != null) 1180 if (item != null && item.Type == (int)AssetType.Animation)
1188 { 1181 animID = item.AssetID;
1189 UUID animID; 1182 else
1190 1183 animID = UUID.Zero;
1191 if (!UUID.TryParse(animation, out animID))
1192 {
1193 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
1194 if (item != null && item.Type == (int)AssetType.Animation)
1195 animID = item.AssetID;
1196 else
1197 animID = UUID.Zero;
1198 }
1199
1200
1201 if (animID == UUID.Zero)
1202 target.Animator.RemoveAnimation(animation);
1203 else
1204 target.Animator.RemoveAnimation(animID, true);
1205 }
1206 } 1184 }
1185
1186 if (animID == UUID.Zero)
1187 target.Animator.RemoveAnimation(animation);
1188 else
1189 target.Animator.RemoveAnimation(animID, true);
1207 } 1190 }
1208 1191
1209 //Texture draw functions 1192 //Texture draw functions
@@ -3340,13 +3323,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3340 CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); 3323 CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation");
3341 3324
3342 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3325 INPCModule module = World.RequestModuleInterface<INPCModule>();
3343 if (module != null) 3326 if (module == null)
3344 { 3327 return;
3345 UUID npcID = new UUID(npc.m_string); 3328
3329 UUID npcID;
3330 if(!UUID.TryParse(npc.m_string, out npcID))
3331 return;
3332
3333 ScenePresence target = World.GetScenePresence(npcID);
3334 if (target == null || !target.IsNPC)
3335 return;
3346 3336
3347 if (module.CheckPermissions(npcID, m_host.OwnerID)) 3337 if (!module.CheckPermissions(npcID, m_host.OwnerID))
3348 AvatarPlayAnimation(npcID.ToString(), animation); 3338 return;
3339
3340 UUID animID = UUID.Zero;
3341 m_host.TaskInventory.LockItemsForRead(true);
3342 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3343 {
3344 if (inv.Value.Type == (int)AssetType.Animation)
3345 {
3346 if (inv.Value.Name == animation)
3347 {
3348 animID = inv.Value.AssetID;
3349 break;
3350 }
3351 }
3349 } 3352 }
3353 m_host.TaskInventory.LockItemsForRead(false);
3354
3355 if (animID == UUID.Zero)
3356 target.Animator.AddAnimation(animation, m_host.UUID);
3357 else
3358 target.Animator.AddAnimation(animID, m_host.UUID);
3350 } 3359 }
3351 3360
3352 public void osNpcStopAnimation(LSL_Key npc, string animation) 3361 public void osNpcStopAnimation(LSL_Key npc, string animation)
@@ -3354,13 +3363,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3354 CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); 3363 CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation");
3355 3364
3356 INPCModule module = World.RequestModuleInterface<INPCModule>(); 3365 INPCModule module = World.RequestModuleInterface<INPCModule>();
3357 if (module != null) 3366 if (module == null)
3358 { 3367 return;
3359 UUID npcID = new UUID(npc.m_string); 3368
3369 UUID npcID;
3370 if (!UUID.TryParse(npc.m_string, out npcID))
3371 return;
3372
3373 ScenePresence target = World.GetScenePresence(npcID);
3374 if (target == null || !target.IsNPC)
3375 return;
3360 3376
3361 if (module.CheckPermissions(npcID, m_host.OwnerID)) 3377 if (!module.CheckPermissions(npcID, m_host.OwnerID))
3362 AvatarStopAnimation(npcID.ToString(), animation); 3378 return;
3379
3380 UUID animID;
3381 if (!UUID.TryParse(animation, out animID))
3382 {
3383 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
3384 if (item != null && item.Type == (int)AssetType.Animation)
3385 animID = item.AssetID;
3386 else
3387 animID = UUID.Zero;
3363 } 3388 }
3389
3390 if (animID == UUID.Zero)
3391 target.Animator.RemoveAnimation(animation);
3392 else
3393 target.Animator.RemoveAnimation(animID, true);
3364 } 3394 }
3365 3395
3366 public void osNpcWhisper(LSL_Key npc, int channel, string message) 3396 public void osNpcWhisper(LSL_Key npc, int channel, string message)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 5bb7670..ebbfd2e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -158,8 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
158 void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 158 void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
159 159
160 // Animation commands 160 // Animation commands
161 void osAvatarPlayAnimation(string avatar, string animation); 161 void osAvatarPlayAnimation(LSL_Key avatarId, string animation);
162 void osAvatarStopAnimation(string avatar, string animation); 162 void osAvatarStopAnimation(LSL_Key avatarId, string animation);
163 163
164 #region Attachment commands 164 #region Attachment commands
165 165
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 169a0f2..0dbc6c6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -29,13 +29,14 @@ using System;
29using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 29using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
30using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 30using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
31using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 31using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
32using LSLString = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
33 32
34namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase 33namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
35{ 34{
36 public partial class ScriptBaseClass 35 public partial class ScriptBaseClass
37 { 36 {
38 // SCRIPTS CONSTANTS 37 // SCRIPTS CONSTANTS
38 public static readonly LSLInteger OS_APIVERSION = 1;
39
39 public static readonly LSLInteger TRUE = 1; 40 public static readonly LSLInteger TRUE = 1;
40 public static readonly LSLInteger FALSE = 0; 41 public static readonly LSLInteger FALSE = 0;
41 42
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 29ada83..ed83894 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,12 +289,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
289 289
290 // Animation Functions 290 // Animation Functions
291 291
292 public void osAvatarPlayAnimation(string avatar, string animation) 292 public void osAvatarPlayAnimation(LSL_Key avatar, string animation)
293 { 293 {
294 m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation); 294 m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation);
295 } 295 }
296 296
297 public void osAvatarStopAnimation(string avatar, string animation) 297 public void osAvatarStopAnimation(LSL_Key avatar, string animation)
298 { 298 {
299 m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); 299 m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
300 } 300 }