From a5d945e199a82985f709aea1beaeeda67787ebde Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 19 Oct 2008 21:11:13 +0000 Subject: Thank you kindly, Idb for a patch that solves: llWind always returns a zero vector. In the attached patch the WindModule has been changed slightly to make wind data available for llWind --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 956a500..d410a59 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -953,7 +953,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llWind(LSL_Vector offset) { m_host.AddScriptLPS(1); - return new LSL_Vector(); + LSL_Vector wind = new LSL_Vector(0, 0, 0); + IWindModule module = World.RequestModuleInterface(); + if (module != null && module.WindSpeeds != null) + { + Vector3 pos = m_host.GetWorldPosition(); + int x = (int)((pos.X + offset.x)/ 16); + int y = (int)((pos.Y + offset.y)/ 16); + if (x < 0) x = 0; + if (x > 15) x = 15; + if (y < 0) y = 0; + if (y > 15) y = 15; + wind.x = module.WindSpeeds[y * 16 + x].X; + wind.y = module.WindSpeeds[y * 16 + x].Y; + } + return wind; } public void llSetStatus(int status, int value) -- cgit v1.1