diff options
author | UbitUmarov | 2016-09-03 07:51:53 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-03 07:51:53 +0100 |
commit | 9aec227767cf726216514d0494f11b5d8bf5b807 (patch) | |
tree | 8f308f4c1eefa19954fc30a560ac780f8a8e916a /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | merge issue (diff) | |
parent | tests making sure evering thing is coerently wrong.. (diff) | |
download | opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.zip opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.gz opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.bz2 opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
4 files changed, 98 insertions, 42 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ce0e59c..66cb30c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4323,6 +4323,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4323 | return; | 4323 | return; |
4324 | 4324 | ||
4325 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); | 4325 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); |
4326 | if (targetPart == null) | ||
4327 | return; | ||
4326 | 4328 | ||
4327 | if (targetPart.ParentGroup.AttachmentPoint != 0) | 4329 | if (targetPart.ParentGroup.AttachmentPoint != 0) |
4328 | return; // Fail silently if attached | 4330 | return; // Fail silently if attached |
@@ -4332,24 +4334,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4332 | 4334 | ||
4333 | SceneObjectGroup parentPrim = null, childPrim = null; | 4335 | SceneObjectGroup parentPrim = null, childPrim = null; |
4334 | 4336 | ||
4335 | if (targetPart != null) | 4337 | if (parent != 0) |
4336 | { | 4338 | { |
4337 | if (parent != 0) | 4339 | parentPrim = m_host.ParentGroup; |
4338 | { | 4340 | childPrim = targetPart.ParentGroup; |
4339 | parentPrim = m_host.ParentGroup; | 4341 | } |
4340 | childPrim = targetPart.ParentGroup; | 4342 | else |
4341 | } | 4343 | { |
4342 | else | 4344 | parentPrim = targetPart.ParentGroup; |
4343 | { | 4345 | childPrim = m_host.ParentGroup; |
4344 | parentPrim = targetPart.ParentGroup; | ||
4345 | childPrim = m_host.ParentGroup; | ||
4346 | } | ||
4347 | |||
4348 | // Required for linking | ||
4349 | childPrim.RootPart.ClearUpdateSchedule(); | ||
4350 | parentPrim.LinkToGroup(childPrim, true); | ||
4351 | } | 4346 | } |
4352 | 4347 | ||
4348 | // Required for linking | ||
4349 | childPrim.RootPart.ClearUpdateSchedule(); | ||
4350 | parentPrim.LinkToGroup(childPrim, true); | ||
4351 | |||
4352 | |||
4353 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 4353 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
4354 | parentPrim.RootPart.CreateSelected = true; | 4354 | parentPrim.RootPart.CreateSelected = true; |
4355 | parentPrim.HasGroupChanged = true; | 4355 | parentPrim.HasGroupChanged = true; |
@@ -4741,20 +4741,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4741 | { | 4741 | { |
4742 | m_host.AddScriptLPS(1); | 4742 | m_host.AddScriptLPS(1); |
4743 | Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); | 4743 | Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); |
4744 | if (text.Length > 254) | ||
4745 | text = text.Remove(254); | ||
4746 | |||
4747 | byte[] data; | 4744 | byte[] data; |
4748 | do | 4745 | data = Util.StringToBytes256(text); |
4749 | { | 4746 | text = Util.UTF8.GetString(data); |
4750 | data = Util.UTF8.GetBytes(text); | ||
4751 | if (data.Length > 254) | ||
4752 | text = text.Substring(0, text.Length - 1); | ||
4753 | } while (data.Length > 254); | ||
4754 | |||
4755 | m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); | 4747 | m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); |
4756 | //m_host.ParentGroup.HasGroupChanged = true; | ||
4757 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); | ||
4758 | } | 4748 | } |
4759 | 4749 | ||
4760 | public LSL_Float llWater(LSL_Vector offset) | 4750 | public LSL_Float llWater(LSL_Vector offset) |
@@ -5118,13 +5108,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5118 | { | 5108 | { |
5119 | m_host.CollisionSoundVolume = (float)impact_volume; | 5109 | m_host.CollisionSoundVolume = (float)impact_volume; |
5120 | m_host.CollisionSound = m_host.invalidCollisionSoundUUID; | 5110 | m_host.CollisionSound = m_host.invalidCollisionSoundUUID; |
5121 | m_host.CollisionSoundType = 0; | 5111 | m_host.CollisionSoundType = -1; // disable all sounds |
5112 | m_host.aggregateScriptEvents(); | ||
5122 | return; | 5113 | return; |
5123 | } | 5114 | } |
5115 | |||
5124 | // TODO: Parameter check logic required. | 5116 | // TODO: Parameter check logic required. |
5125 | m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); | 5117 | UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); |
5126 | m_host.CollisionSoundVolume = (float)impact_volume; | 5118 | if(soundId != UUID.Zero) |
5127 | m_host.CollisionSoundType = 1; | 5119 | { |
5120 | m_host.CollisionSound = soundId; | ||
5121 | m_host.CollisionSoundVolume = (float)impact_volume; | ||
5122 | m_host.CollisionSoundType = 1; | ||
5123 | } | ||
5124 | else | ||
5125 | m_host.CollisionSoundType = -1; | ||
5126 | |||
5127 | m_host.aggregateScriptEvents(); | ||
5128 | } | 5128 | } |
5129 | 5129 | ||
5130 | public LSL_String llGetAnimation(string id) | 5130 | public LSL_String llGetAnimation(string id) |
@@ -14679,13 +14679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14679 | msAvailable -= m_castRayCalls[i].UsedMs; | 14679 | msAvailable -= m_castRayCalls[i].UsedMs; |
14680 | } | 14680 | } |
14681 | } | 14681 | } |
14682 | } | ||
14683 | 14682 | ||
14684 | // Return failure if not enough available time | 14683 | // Return failure if not enough available time |
14685 | if (msAvailable < m_msMinInCastRay) | 14684 | if (msAvailable < m_msMinInCastRay) |
14686 | { | 14685 | { |
14687 | result.Add(new LSL_Integer(ScriptBaseClass.RCERR_CAST_TIME_EXCEEDED)); | 14686 | result.Add(new LSL_Integer(ScriptBaseClass.RCERR_CAST_TIME_EXCEEDED)); |
14688 | return result; | 14687 | return result; |
14688 | } | ||
14689 | } | 14689 | } |
14690 | 14690 | ||
14691 | // Initialize | 14691 | // Initialize |
@@ -15073,13 +15073,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
15073 | 15073 | ||
15074 | // Add to throttle data | 15074 | // Add to throttle data |
15075 | stopWatch.Stop(); | 15075 | stopWatch.Stop(); |
15076 | CastRayCall castRayCall = new CastRayCall(); | ||
15077 | castRayCall.RegionId = regionId; | ||
15078 | castRayCall.UserId = userId; | ||
15079 | castRayCall.CalledMs = calledMs; | ||
15080 | castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds; | ||
15081 | lock (m_castRayCalls) | 15076 | lock (m_castRayCalls) |
15082 | { | 15077 | { |
15078 | CastRayCall castRayCall = new CastRayCall(); | ||
15079 | castRayCall.RegionId = regionId; | ||
15080 | castRayCall.UserId = userId; | ||
15081 | castRayCall.CalledMs = calledMs; | ||
15082 | castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds; | ||
15083 | m_castRayCalls.Add(castRayCall); | 15083 | m_castRayCalls.Add(castRayCall); |
15084 | } | 15084 | } |
15085 | 15085 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e525a2e..4af4339 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -45,6 +45,7 @@ using OpenSim.Framework; | |||
45 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
46 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
47 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
48 | using OpenSim.Region.Framework.Scenes.Scripting; | ||
48 | using OpenSim.Region.ScriptEngine.Shared; | 49 | using OpenSim.Region.ScriptEngine.Shared; |
49 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 50 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 51 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -4250,5 +4251,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4250 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString(); | 4251 | return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString(); |
4251 | return UUID.Zero.ToString(); | 4252 | return UUID.Zero.ToString(); |
4252 | } | 4253 | } |
4254 | |||
4255 | public void osCollisionSound(string impact_sound, double impact_volume) | ||
4256 | { | ||
4257 | m_host.AddScriptLPS(1); | ||
4258 | |||
4259 | if(impact_sound == "") | ||
4260 | { | ||
4261 | m_host.CollisionSoundVolume = (float)impact_volume; | ||
4262 | m_host.CollisionSound = m_host.invalidCollisionSoundUUID; | ||
4263 | if(impact_volume == 0.0) | ||
4264 | m_host.CollisionSoundType = -1; // disable all sounds | ||
4265 | else if(impact_volume == 1.0f) | ||
4266 | m_host.CollisionSoundType = 0; // full return to default sounds | ||
4267 | else | ||
4268 | m_host.CollisionSoundType = 2; // default sounds with volume | ||
4269 | m_host.aggregateScriptEvents(); | ||
4270 | return; | ||
4271 | } | ||
4272 | // TODO: Parameter check logic required. | ||
4273 | UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); | ||
4274 | if(soundId != UUID.Zero) | ||
4275 | { | ||
4276 | m_host.CollisionSound = soundId; | ||
4277 | m_host.CollisionSoundVolume = (float)impact_volume; | ||
4278 | m_host.CollisionSoundType = 1; | ||
4279 | } | ||
4280 | else | ||
4281 | m_host.CollisionSoundType = -1; | ||
4282 | |||
4283 | m_host.aggregateScriptEvents(); | ||
4284 | } | ||
4285 | |||
4286 | // still not very usefull, detector is lost on rez, restarts, etc | ||
4287 | public void osVolumeDetect(int detect) | ||
4288 | { | ||
4289 | m_host.AddScriptLPS(1); | ||
4290 | |||
4291 | if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) | ||
4292 | return; | ||
4293 | |||
4294 | m_host.ScriptSetVolumeDetect(detect != 0); | ||
4295 | } | ||
4296 | |||
4253 | } | 4297 | } |
4254 | } | 4298 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c99679e..5ce859e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -476,5 +476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
476 | 476 | ||
477 | LSL_String osRequestURL(LSL_List options); | 477 | LSL_String osRequestURL(LSL_List options); |
478 | LSL_String osRequestSecureURL(LSL_List options); | 478 | LSL_String osRequestSecureURL(LSL_List options); |
479 | void osCollisionSound(string impact_sound, double impact_volume); | ||
480 | void osVolumeDetect(int detect); | ||
479 | } | 481 | } |
480 | } | 482 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 35eee59..c5cb88e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1089,5 +1089,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1089 | { | 1089 | { |
1090 | return m_OSSL_Functions.osRequestSecureURL(options); | 1090 | return m_OSSL_Functions.osRequestSecureURL(options); |
1091 | } | 1091 | } |
1092 | |||
1093 | public void osCollisionSound(string impact_sound, double impact_volume) | ||
1094 | { | ||
1095 | m_OSSL_Functions.osCollisionSound(impact_sound, impact_volume); | ||
1096 | } | ||
1097 | |||
1098 | public void osVolumeDetect(int detect) | ||
1099 | { | ||
1100 | m_OSSL_Functions.osVolumeDetect(detect); | ||
1101 | } | ||
1092 | } | 1102 | } |
1093 | } | 1103 | } |