mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Fixes Mantis #3255. Thank you kindly, MCortez, for a patch that:
Changes to IWindModule interface: Change from assuming a single array of 256 Vector2 values to a lookup function that takes region x, y, z and returns a Vector3 * Changed llWind() to use new lookup method of IWindModule * Moved logic for determining the wind at a given point in the data array from llWind() to the Wind Module itself.
This commit is contained in:
@@ -1031,17 +1031,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
LSL_Vector wind = new LSL_Vector(0, 0, 0);
|
||||
IWindModule module = World.RequestModuleInterface<IWindModule>();
|
||||
if (module != null && module.WindSpeeds != null)
|
||||
if (module != 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;
|
||||
int x = (int)(pos.X + offset.x);
|
||||
int y = (int)(pos.Y + offset.y);
|
||||
|
||||
Vector3 windSpeed = module.WindSpeed(x, y, 0);
|
||||
|
||||
wind.x = windSpeed.X;
|
||||
wind.y = windSpeed.Y;
|
||||
}
|
||||
return wind;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user