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