1: 2010-01-11 (月) 22:53:24 iseki |
現: 2010-01-21 (木) 02:31:13 iseki |
- | *** llSetTerrain(int x, int y, double height) [#ndfa0172] | + | *** llGroundSet(int x, int y, double height), llGroundUpdate() [#ndfa0172] |
| + | **** OS Function に同じような osTerrainSetHeight(), osTerrainFlush() があった. [#fe17e745] |
| + | |
| + | - llGroundSet(): 座標 (x, y) の標高を height にする関数. |
| + | - llGroundUpdate(): 変更した標高を適用させる. |
| - OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | | - OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs |
- | public void llSetTerrain(int x, int y, double height) | + | // Fumi.Iseki |
| + | public void llGroundSet(int x, int y, double height) |
| { | | { |
| m_host.AddScriptLPS(1); | | m_host.AddScriptLPS(1); |
- | | + | |
- | World.Heightmap[x, y] = height; | + | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x,y,0))) |
| + | { |
| + | if (x>=World.Heightmap.Width) x = World.Heightmap.Width - 1; |
| + | else if (x<0) x = 0; |
| + | if (y>=World.Heightmap.Height) y = World.Heightmap.Height - 1; |
| + | else if (y<0) y = 0; |
| + | World.Heightmap[x, y] = height; |
| + | } |
| + | } |
| + | |
| + | // Fumi.Iseki |
| + | public void llGroundUpdate() |
| + | { |
| + | m_host.AddScriptLPS(1); |
| + | |
| ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface<ITerrainModule>(); | | ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface<ITerrainModule>(); |
| if (tm != null) | | if (tm != null) |
| { | | { |
- | //tm.SetHeightMap(x, y, height); | |
| tm.TaintTerrain(); | | tm.TaintTerrain(); |
| } | | } |
| } | | } |
| + | - OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs |
| + | // Fumi.Iseki |
| + | public void llGroundSet(int x, int y, double height) |
| + | { |
| + | m_LSL_Functions.llGroundSet(x, y, height); |
| + | } |
| + | |
| + | // Fumi.Iseki |
| + | public void llGroundUpdate() |
| + | { |
| + | m_LSL_Functions.llGroundUpdate(); |
| + | } |
| + | - OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs |
| + | void llGroundSet(int x, int y, double height); |
| + | void llGroundUpdate(); |
| + | |
| + | *** 別解:TerrainModule.cs に SetHeightMap() 関数を追加する場合 [#pc196495] |
| + | - OpenSim/Region/ScriptEngine編集/Shared/Api/Implementation/LSL_Api.cs |
| + | // Fumi.Iseki |
| + | public void llGroundSet(int x, int y, double height) |
| + | { |
| + | m_host.AddScriptLPS(1); |
| + | |
| + | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x,y,0))) |
| + | { |
| + | ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface<ITerrainModule>(); |
| + | if (tm != null) |
| + | { |
| + | if (x>=World.Heightmap.Width) x = World.Heightmap.Width - 1; |
| + | else if (x<0) x = 0; |
| + | if (y>=World.Heightmap.Height) y = World.Heightmap.Height - 1; |
| + | else if (y<0) y = 0; |
| + | tm.SetHeightMap(x, y, height, m_host.OwnerID); |
| + | } |
| + | } |
| + | } |
| + | - OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs |
| + | public void SetHeightMap(int x, int y, double height, UUID agentId) |
| + | { |
| + | if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x,y,0))) |
| + | { |
| + | m_channel[x, y] = height; |
| + | } |
| + | } |
| + | -- チェックが2重だな |
| + | |
| + | - OpenSim/Region/Framework/Interfaces/ITerrainModule.cs (インターフェイス) |
| + | void SetHeightMap(int x, int y, double height, UUID agentId) |