diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/ConfigurationMember.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | 81 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 1 |
7 files changed, 104 insertions, 11 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index cb434f0..c363ec0 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs | |||
@@ -420,7 +420,7 @@ namespace OpenSim.Framework | |||
420 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: | 420 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: |
421 | float floatResult; | 421 | float floatResult; |
422 | if ( | 422 | if ( |
423 | float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | 423 | float.TryParse(console_result, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, Culture.NumberFormatInfo, |
424 | out floatResult)) | 424 | out floatResult)) |
425 | { | 425 | { |
426 | convertSuccess = true; | 426 | convertSuccess = true; |
@@ -431,7 +431,7 @@ namespace OpenSim.Framework | |||
431 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: | 431 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: |
432 | double doubleResult; | 432 | double doubleResult; |
433 | if ( | 433 | if ( |
434 | Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, | 434 | Double.TryParse(console_result, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, Culture.NumberFormatInfo, |
435 | out doubleResult)) | 435 | out doubleResult)) |
436 | { | 436 | { |
437 | convertSuccess = true; | 437 | convertSuccess = true; |
@@ -519,4 +519,4 @@ namespace OpenSim.Framework | |||
519 | configurationPlugin.Close(); | 519 | configurationPlugin.Close(); |
520 | } | 520 | } |
521 | } | 521 | } |
522 | } \ No newline at end of file | 522 | } |
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index d0e56ab..997caad 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -773,9 +773,9 @@ namespace OpenSim.Framework | |||
773 | configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0", | 773 | configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0", |
774 | true); | 774 | true); |
775 | configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, | 775 | configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, |
776 | String.Empty, "0", true); | 776 | String.Empty, "4.0", true); //4 is the LL default |
777 | configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, | 777 | configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, |
778 | String.Empty, "0", true); | 778 | String.Empty, "-4.0", true); //-4.0 is the LL default |
779 | configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty, | 779 | configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty, |
780 | "false", true); | 780 | "false", true); |
781 | configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | 781 | configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, |
@@ -1013,4 +1013,4 @@ namespace OpenSim.Framework | |||
1013 | return true; | 1013 | return true; |
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | } \ No newline at end of file | 1016 | } |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index fafd31d..e4fac1f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -410,7 +410,7 @@ namespace OpenSim.Framework | |||
410 | public delegate void ModifyTerrain( | 410 | public delegate void ModifyTerrain( |
411 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, | 411 | float height, float seconds, byte size, byte action, float north, float west, float south, float east, |
412 | IClientAPI remoteClient); | 412 | IClientAPI remoteClient); |
413 | 413 | ||
414 | public delegate void SetAppearance(byte[] texture, List<byte> visualParamList); | 414 | public delegate void SetAppearance(byte[] texture, List<byte> visualParamList); |
415 | 415 | ||
416 | public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID); | 416 | public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID); |
@@ -633,6 +633,7 @@ namespace OpenSim.Framework | |||
633 | public delegate void SetEstateTerrainTextureHeights(IClientAPI remoteClient, int corner, float lowVal, float highVal); | 633 | public delegate void SetEstateTerrainTextureHeights(IClientAPI remoteClient, int corner, float lowVal, float highVal); |
634 | public delegate void CommitEstateTerrainTextureRequest(IClientAPI remoteClient); | 634 | public delegate void CommitEstateTerrainTextureRequest(IClientAPI remoteClient); |
635 | public delegate void SetRegionTerrainSettings(float waterHeight, float terrainRaiseLimit, float terrainLowerLimit, bool fixedSun, float sunHour); | 635 | public delegate void SetRegionTerrainSettings(float waterHeight, float terrainRaiseLimit, float terrainLowerLimit, bool fixedSun, float sunHour); |
636 | public delegate void BakeTerrain(IClientAPI remoteClient ); | ||
636 | public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot); | 637 | public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot); |
637 | public delegate void EstateChangeCovenantRequest(IClientAPI remoteClient, LLUUID newCovenantID); | 638 | public delegate void EstateChangeCovenantRequest(IClientAPI remoteClient, LLUUID newCovenantID); |
638 | public delegate void UpdateEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user); | 639 | public delegate void UpdateEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user); |
@@ -693,6 +694,7 @@ namespace OpenSim.Framework | |||
693 | event RezObject OnRezObject; | 694 | event RezObject OnRezObject; |
694 | [Obsolete("LLClientView Specific - Replace with more suitable arguments.")] | 695 | [Obsolete("LLClientView Specific - Replace with more suitable arguments.")] |
695 | event ModifyTerrain OnModifyTerrain; | 696 | event ModifyTerrain OnModifyTerrain; |
697 | event BakeTerrain OnBakeTerrain; | ||
696 | [Obsolete("LLClientView Specific.")] | 698 | [Obsolete("LLClientView Specific.")] |
697 | event SetAppearance OnSetAppearance; | 699 | event SetAppearance OnSetAppearance; |
698 | [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] | 700 | [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b298578..3dddbfb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -159,6 +159,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
159 | private RezObject handlerRezObject = null; //OnRezObject; | 159 | private RezObject handlerRezObject = null; //OnRezObject; |
160 | private GenericCall4 handlerDeRezObject = null; //OnDeRezObject; | 160 | private GenericCall4 handlerDeRezObject = null; //OnDeRezObject; |
161 | private ModifyTerrain handlerModifyTerrain = null; | 161 | private ModifyTerrain handlerModifyTerrain = null; |
162 | private BakeTerrain handlerBakeTerrain = null; | ||
162 | private Action<IClientAPI> handlerRegionHandShakeReply = null; //OnRegionHandShakeReply; | 163 | private Action<IClientAPI> handlerRegionHandShakeReply = null; //OnRegionHandShakeReply; |
163 | private GenericCall2 handlerRequestWearables = null; //OnRequestWearables; | 164 | private GenericCall2 handlerRequestWearables = null; //OnRequestWearables; |
164 | private Action<IClientAPI> handlerRequestAvatarsData = null; //OnRequestAvatarsData; | 165 | private Action<IClientAPI> handlerRequestAvatarsData = null; //OnRequestAvatarsData; |
@@ -893,6 +894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
893 | public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; | 894 | public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; |
894 | public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; | 895 | public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; |
895 | public event SetRegionTerrainSettings OnSetRegionTerrainSettings; | 896 | public event SetRegionTerrainSettings OnSetRegionTerrainSettings; |
897 | public event BakeTerrain OnBakeTerrain; | ||
896 | public event EstateRestartSimRequest OnEstateRestartSimRequest; | 898 | public event EstateRestartSimRequest OnEstateRestartSimRequest; |
897 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; | 899 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; |
898 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; | 900 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; |
@@ -5846,6 +5848,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5846 | handlerLandStatRequest(0, 0, 0, "", this); | 5848 | handlerLandStatRequest(0, 0, 0, "", this); |
5847 | } | 5849 | } |
5848 | break; | 5850 | break; |
5851 | case "terrain": | ||
5852 | if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) | ||
5853 | { | ||
5854 | handlerBakeTerrain = OnBakeTerrain; | ||
5855 | if (handlerBakeTerrain != null) | ||
5856 | { | ||
5857 | handlerBakeTerrain(this); | ||
5858 | } | ||
5859 | } | ||
5860 | break; | ||
5861 | |||
5849 | default: | 5862 | default: |
5850 | m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString()); | 5863 | m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString()); |
5851 | break; | 5864 | break; |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 4935672..a242ebe 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -281,6 +281,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
281 | public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; | 281 | public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; |
282 | public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; | 282 | public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; |
283 | public event SetRegionTerrainSettings OnSetRegionTerrainSettings; | 283 | public event SetRegionTerrainSettings OnSetRegionTerrainSettings; |
284 | public event BakeTerrain OnBakeTerrain; | ||
284 | public event EstateRestartSimRequest OnEstateRestartSimRequest; | 285 | public event EstateRestartSimRequest OnEstateRestartSimRequest; |
285 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; | 286 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; |
286 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; | 287 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; |
@@ -776,5 +777,6 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
776 | { | 777 | { |
777 | } | 778 | } |
778 | #endregion | 779 | #endregion |
779 | } | 780 | |
781 | } | ||
780 | } | 782 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 9d8bbfc..49347b2 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | |||
@@ -419,13 +419,28 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
419 | private void EventManager_OnNewClient(IClientAPI client) | 419 | private void EventManager_OnNewClient(IClientAPI client) |
420 | { | 420 | { |
421 | client.OnModifyTerrain += client_OnModifyTerrain; | 421 | client.OnModifyTerrain += client_OnModifyTerrain; |
422 | client.OnBakeTerrain += client_OnBakeTerrain; | ||
422 | } | 423 | } |
423 | 424 | ||
424 | /// <summary> | 425 | /// <summary> |
425 | /// Checks to see if the terrain has been modified since last check | 426 | /// Checks to see if the terrain has been modified since last check |
427 | /// but won't attempt to limit those changes to the limits specified in the estate settings | ||
428 | /// currently invoked by the command line operations in the region server only | ||
426 | /// </summary> | 429 | /// </summary> |
427 | private void CheckForTerrainUpdates() | 430 | private void CheckForTerrainUpdates() |
428 | { | 431 | { |
432 | CheckForTerrainUpdates(false); | ||
433 | } | ||
434 | |||
435 | /// <summary> | ||
436 | /// Checks to see if the terrain has been modified since last check | ||
437 | /// if the call is asked to respect the estate settings for terrain_raise_limit and | ||
438 | /// terrain_lower_limit, it will clamp terrain updates between these values | ||
439 | /// currently invoked by client_OnModifyTerrain only and not the Commander interfaces | ||
440 | /// <param name="respectEstateSettings">should height map deltas be limited to the estate settings limits</param> | ||
441 | /// </summary> | ||
442 | private void CheckForTerrainUpdates(bool respectEstateSettings) | ||
443 | { | ||
429 | bool shouldTaint = false; | 444 | bool shouldTaint = false; |
430 | float[] serialised = m_channel.GetFloatsSerialised(); | 445 | float[] serialised = m_channel.GetFloatsSerialised(); |
431 | int x; | 446 | int x; |
@@ -436,6 +451,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
436 | { | 451 | { |
437 | if (m_channel.Tainted(x, y)) | 452 | if (m_channel.Tainted(x, y)) |
438 | { | 453 | { |
454 | // if we should respect the estate settings then | ||
455 | // fixup and height deltas that don't respect them | ||
456 | if (respectEstateSettings && LimitChannelChanges(x, y)) | ||
457 | { | ||
458 | // this has been vetoed, so update | ||
459 | // what we are going to send to the client | ||
460 | serialised = m_channel.GetFloatsSerialised(); | ||
461 | } | ||
439 | SendToClients(serialised, x, y); | 462 | SendToClients(serialised, x, y); |
440 | shouldTaint = true; | 463 | shouldTaint = true; |
441 | } | 464 | } |
@@ -447,6 +470,46 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
447 | } | 470 | } |
448 | } | 471 | } |
449 | 472 | ||
473 | |||
474 | /// <summary> | ||
475 | /// Checks to see height deltas in the tainted terrain patch at xStart ,yStart | ||
476 | /// are all within the current estate limits | ||
477 | /// <returns>true if changes were limited, false otherwise</returns> | ||
478 | /// </summary> | ||
479 | private bool LimitChannelChanges(int xStart, int yStart) | ||
480 | { | ||
481 | bool changesLimited = false; | ||
482 | double minDelta = m_scene.RegionInfo.EstateSettings.terrainLowerLimit; | ||
483 | double maxDelta = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit; | ||
484 | |||
485 | // loop through the height map for this patch and compare it against | ||
486 | // the revert map | ||
487 | for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) | ||
488 | { | ||
489 | for (int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) | ||
490 | { | ||
491 | |||
492 | double requestedHeight = m_channel[x, y]; | ||
493 | double bakedHeight = m_revert[x, y]; | ||
494 | double requestedDelta = requestedHeight - bakedHeight; | ||
495 | |||
496 | if (requestedDelta > maxDelta ) | ||
497 | { | ||
498 | m_channel[x, y] = bakedHeight + maxDelta; | ||
499 | changesLimited = true; | ||
500 | } | ||
501 | else if (requestedDelta < minDelta) | ||
502 | { | ||
503 | m_channel[x, y] = bakedHeight + minDelta; //as lower is a -ve delta | ||
504 | changesLimited = true; | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | |||
509 | return changesLimited; | ||
510 | } | ||
511 | |||
512 | |||
450 | /// <summary> | 513 | /// <summary> |
451 | /// Sends a copy of the current terrain to the scenes clients | 514 | /// Sends a copy of the current terrain to the scenes clients |
452 | /// </summary> | 515 | /// </summary> |
@@ -472,7 +535,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
472 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( | 535 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( |
473 | m_channel, west, south, size, seconds); | 536 | m_channel, west, south, size, seconds); |
474 | 537 | ||
475 | CheckForTerrainUpdates(); | 538 | CheckForTerrainUpdates(true); //revert changes outside estate limits |
476 | } | 539 | } |
477 | else | 540 | else |
478 | { | 541 | { |
@@ -505,7 +568,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
505 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( | 568 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( |
506 | m_channel, fillArea, size); | 569 | m_channel, fillArea, size); |
507 | 570 | ||
508 | CheckForTerrainUpdates(); | 571 | CheckForTerrainUpdates(true); //revert changes outside estate limits |
509 | } | 572 | } |
510 | else | 573 | else |
511 | { | 574 | { |
@@ -515,6 +578,18 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
515 | } | 578 | } |
516 | } | 579 | } |
517 | 580 | ||
581 | private void client_OnBakeTerrain(IClientAPI remoteClient) | ||
582 | { | ||
583 | // Not a good permissions check (see client_OnModifyTerrain above), need to check the entire area. | ||
584 | // for now check a point in the centre of the region | ||
585 | |||
586 | if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new LLVector3(127, 127, 0))) | ||
587 | { | ||
588 | InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter | ||
589 | } | ||
590 | } | ||
591 | |||
592 | |||
518 | #region Console Commands | 593 | #region Console Commands |
519 | 594 | ||
520 | private void InterfaceLoadFile(Object[] args) | 595 | private void InterfaceLoadFile(Object[] args) |
@@ -745,4 +820,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
745 | 820 | ||
746 | #endregion | 821 | #endregion |
747 | } | 822 | } |
748 | } \ No newline at end of file | 823 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 6ff600f..0f7a057 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
57 | public event TextureRequest OnRequestTexture; | 57 | public event TextureRequest OnRequestTexture; |
58 | public event RezObject OnRezObject; | 58 | public event RezObject OnRezObject; |
59 | public event ModifyTerrain OnModifyTerrain; | 59 | public event ModifyTerrain OnModifyTerrain; |
60 | public event BakeTerrain OnBakeTerrain; | ||
60 | public event SetAppearance OnSetAppearance; | 61 | public event SetAppearance OnSetAppearance; |
61 | public event AvatarNowWearing OnAvatarNowWearing; | 62 | public event AvatarNowWearing OnAvatarNowWearing; |
62 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 63 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |