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 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 30bacc6..253d193 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -100,6 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
100 | protected float m_ScriptDelayFactor = 1.0f; | 100 | protected float m_ScriptDelayFactor = 1.0f; |
101 | protected float m_ScriptDistanceFactor = 1.0f; | 101 | protected float m_ScriptDistanceFactor = 1.0f; |
102 | protected float m_MinTimerInterval = 0.5f; | 102 | protected float m_MinTimerInterval = 0.5f; |
103 | protected float m_recoilScaleFactor = 0.0f; | ||
103 | 104 | ||
104 | protected DateTime m_timer = DateTime.Now; | 105 | protected DateTime m_timer = DateTime.Now; |
105 | protected bool m_waitingForScriptAnswer = false; | 106 | protected bool m_waitingForScriptAnswer = false; |
@@ -187,6 +188,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
187 | // there's an smtp config, so load in the snooze time. | 188 | // there's an smtp config, so load in the snooze time. |
188 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 189 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
189 | } | 190 | } |
191 | // Rezzing an object with a velocity can create recoil. This feature seems to have been | ||
192 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales | ||
193 | // it by this factor. May be zero to turn off recoil all together. | ||
194 | m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor); | ||
190 | } | 195 | } |
191 | 196 | ||
192 | public override Object InitializeLifetimeService() | 197 | public override Object InitializeLifetimeService() |
@@ -3108,11 +3113,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3108 | 3113 | ||
3109 | PhysicsActor pa = new_group.RootPart.PhysActor; | 3114 | PhysicsActor pa = new_group.RootPart.PhysActor; |
3110 | 3115 | ||
3116 | //Recoil. | ||
3111 | if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) | 3117 | if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero) |
3112 | { | 3118 | { |
3113 | float groupmass = new_group.GetMass(); | 3119 | float groupmass = new_group.GetMass(); |
3114 | vel *= -groupmass; | 3120 | Vector3 recoil = -vel * groupmass * m_recoilScaleFactor; |
3115 | llApplyImpulse(vel, 0); | 3121 | if (recoil != Vector3.Zero) |
3122 | { | ||
3123 | llApplyImpulse(recoil, 0); | ||
3124 | } | ||
3116 | } | 3125 | } |
3117 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) | 3126 | // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) |
3118 | return; | 3127 | return; |