From 302d65569f721e19ee4400e3a73aa0530dd8e7e7 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 11 Nov 2008 01:47:40 +0000 Subject: [PATCH] Allow gods to terraform without limits. Respect the Allow Others To Terraform flag in land. --- OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../Modules/World/Terrain/ITerrainModule.cs | 3 ++- .../Modules/World/Terrain/TerrainModule.cs | 13 +++++++------ .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2be647f376..508fefb3f0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -65,7 +65,7 @@ namespace OpenSim.Framework public delegate void ObjectAttach( IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); - public delegate void ModifyTerrain( + public delegate void ModifyTerrain(UUID user, float height, float seconds, byte size, byte action, float north, float west, float south, float east, UUID agentId); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a835e43eac..f9d73d5406 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4156,7 +4156,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerModifyTerrain != null) { modify.ModifyBlock.Height = -1; // Hack, i don't know why the value is wrong - handlerModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, + handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, modify.ModifyBlock.Action, modify.ParcelData[i].North, modify.ParcelData[i].West, modify.ParcelData[i].South, diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs index bc5dc72279..91bc31f543 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs @@ -28,6 +28,7 @@ using System.IO; using OpenMetaverse; +using OpenSim.Framework; namespace OpenSim.Region.Environment.Modules.World.Terrain { @@ -35,7 +36,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain { void LoadFromFile(string filename); void SaveToFile(string filename); - void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId); + void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId); /// /// Load a terrain from a stream. diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index c49b0b9ebe..3170724d01 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -279,9 +279,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain /// The size of the brush (0=small, 1=medium, 2=large) /// 0=LAND_LEVEL, 1=LAND_RAISE, 2=LAND_LOWER, 3=LAND_SMOOTH, 4=LAND_NOISE, 5=LAND_REVERT /// UUID of script-owner - public void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId) + public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId) { - client_OnModifyTerrain((float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); + client_OnModifyTerrain(user, (float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); } /// @@ -613,9 +613,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain ); } - private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, + private void client_OnModifyTerrain(UUID user, float height, float seconds, byte size, byte action, float north, float west, float south, float east, UUID agentId) { + bool god = m_scene.ExternalChecks.ExternalChecksCanBeGodLike(user); bool allowed = false; if (north == south && east == west) { @@ -653,7 +654,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain m_painteffects[(StandardTerrainEffects) action].PaintEffect( m_channel, allowMask, west, south, height, size, seconds); - CheckForTerrainUpdates(true); //revert changes outside estate limits + CheckForTerrainUpdates(!god); //revert changes outside estate limits } } else @@ -693,7 +694,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain m_floodeffects[(StandardTerrainEffects) action].FloodEffect( m_channel, fillArea, size); - CheckForTerrainUpdates(true); //revert changes outside estate limits + CheckForTerrainUpdates(!god); //revert changes outside estate limits } } else @@ -708,7 +709,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain // Not a good permissions check (see client_OnModifyTerrain above), need to check the entire area. // for now check a point in the centre of the region - if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new Vector3(127, 127, 0))) + if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remoteClient.AgentId, true)) { InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d141ffe766..09d3d79bd3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3470,7 +3470,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface(); if (tm != null) { - tm.ModifyTerrain(m_host.AbsolutePosition, (byte) brush, (byte) action, m_host.OwnerID); + tm.ModifyTerrain(m_host.OwnerID, m_host.AbsolutePosition, (byte) brush, (byte) action, m_host.OwnerID); } }