From 15f501dc72210b5eedbcd1a0fcd6e394a035db07 Mon Sep 17 00:00:00 2001
From: Madpeter <57852827+Madpeterz@users.noreply.github.com>
Date: Mon, 7 Jul 2025 20:15:03 +0100
Subject: [PATCH] patch SetRegionInfo to allow adult sims
---
LibreMetaverse/EstateTools.cs | 24 ++++++++++++++++++++++--
SecondBotEvents/Commands/Estate.cs | 12 +++++++++---
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/LibreMetaverse/EstateTools.cs b/LibreMetaverse/EstateTools.cs
index 7d0ceaf..1f03e62 100644
--- a/LibreMetaverse/EstateTools.cs
+++ b/LibreMetaverse/EstateTools.cs
@@ -560,8 +560,16 @@ namespace OpenMetaverse
}
/// Estate panel "Region" tab settings
+ /// @deprecated Use the version with the adult flag instead
public void SetRegionInfo(bool blockTerraform, bool blockFly, bool allowDamage, bool allowLandResell, bool restrictPushing, bool allowParcelJoinDivide, float agentLimit, float objectBonus, bool mature)
{
+ SetRegionInfo(blockTerraform, blockFly, allowDamage, allowLandResell, restrictPushing, allowParcelJoinDivide, agentLimit, objectBonus, mature, false);
+ }
+
+ /// Estate panel "Region" tab settings
+ public void SetRegionInfo(bool blockTerraform, bool blockFly, bool allowDamage, bool allowLandResell, bool restrictPushing, bool allowParcelJoinDivide, float agentLimit, float objectBonus, bool mature, bool adult)
+ {
+
List listParams = new List();
listParams.Add(blockTerraform ? "Y" : "N");
listParams.Add(blockFly ? "Y" : "N");
@@ -569,7 +577,14 @@ namespace OpenMetaverse
listParams.Add(allowLandResell ? "Y" : "N");
listParams.Add(agentLimit.ToString(CultureInfo.InvariantCulture));
listParams.Add(objectBonus.ToString(CultureInfo.InvariantCulture));
- listParams.Add(mature ? "21" : "13"); //FIXME - enumerate these settings
+ if (adult)
+ {
+ listParams.Add(((int)RegionMaturity.Adult).ToString());
+ }
+ else
+ {
+ listParams.Add(((int)(mature ? RegionMaturity.Mature : RegionMaturity.PG)).ToString());
+ }
listParams.Add(restrictPushing ? "Y" : "N");
listParams.Add(allowParcelJoinDivide ? "Y" : "N");
EstateOwnerMessage("setregioninfo", listParams);
@@ -940,7 +955,12 @@ namespace OpenMetaverse
}
}
-
+ public enum RegionMaturity
+ {
+ PG = 13,
+ Mature = 21,
+ Adult = 42
+ }
private void LandStatCapsReplyHandler(string capsKey, IMessage message, Simulator simulator)
{
LandStatReplyMessage m = (LandStatReplyMessage)message;
diff --git a/SecondBotEvents/Commands/Estate.cs b/SecondBotEvents/Commands/Estate.cs
index 6122c1e..8c70224 100644
--- a/SecondBotEvents/Commands/Estate.cs
+++ b/SecondBotEvents/Commands/Estate.cs
@@ -25,6 +25,7 @@ namespace SecondBotEvents.Commands
[ReturnHintsFailure("Unable to process agent limit value please use a number")]
[ReturnHintsFailure("Unable to process object bonus value please use a number")]
[ReturnHintsFailure("Unable to process mature value please use true or false")]
+ [ReturnHintsFailure("Unable to process adult value please use true or false")]
[ArgHints("setBlockTerraform", "true to block terraform, false to allow it", "BOOL", "false")]
[ArgHints("setBlockFly", "true to block flying, false to allow it", "BOOL", "false")]
[ArgHints("setAllowDamage", "true to allow damage, false to block it", "BOOL", "false")]
@@ -34,8 +35,9 @@ namespace SecondBotEvents.Commands
[ArgHints("setAgentLimit", "the maximum number of agents allowed in the sim", "Number", "100")]
[ArgHints("setObjectBonus", "the object bonus for the sim", "Number", "1.0")]
[ArgHints("setMature", "true to set the sim as mature, false to set it as general", "BOOL", "false")]
+ [ArgHints("setAdult", "true to set the sim as adult, false use the setMature setting", "BOOL", "false")]
[CmdTypeSet()]
- public object SetRegionFlags(string setBlockTerraform, string setBlockFly, string setAllowDamage, string setAllowLandResell, string setBlockPushing, string setAllowParcelJoinDivide, string setAgentLimit, string setObjectBonus, string setMature)
+ public object SetRegionFlags(string setBlockTerraform, string setBlockFly, string setAllowDamage, string setAllowLandResell, string setBlockPushing, string setAllowParcelJoinDivide, string setAgentLimit, string setObjectBonus, string setMature, string setAdult)
{
if(GetClient().Network.CurrentSim.IsEstateManager == false)
{
@@ -77,8 +79,12 @@ namespace SecondBotEvents.Commands
{
return Failure("Unable to process mature value please use true or false", [setBlockTerraform, setBlockFly, setAllowDamage, setAllowLandResell, setBlockPushing, setAllowParcelJoinDivide, setAgentLimit, setObjectBonus, setMature]);
}
- GetClient().Estate.SetRegionInfo(blockTerraform, blockFly, allowDamage, allowLandResell, blockPushing, allowParcelJoinDivide, agentLimit, objectBonus, mature);
- return BasicReply("ok", [setBlockTerraform, setBlockFly, setAllowDamage, setAllowLandResell, setBlockPushing, setAllowParcelJoinDivide, setAgentLimit, setObjectBonus, setMature]);
+ if (bool.TryParse(setAdult, out bool adult) == false)
+ {
+ return Failure("Unable to process adult value please use true or false", [setBlockTerraform, setBlockFly, setAllowDamage, setAllowLandResell, setBlockPushing, setAllowParcelJoinDivide, setAgentLimit, setObjectBonus, setMature, setAdult]);
+ }
+ GetClient().Estate.SetRegionInfo(blockTerraform, blockFly, allowDamage, allowLandResell, blockPushing, allowParcelJoinDivide, agentLimit, objectBonus, mature, adult);
+ return BasicReply("ok", [setBlockTerraform, setBlockFly, setAllowDamage, setAllowLandResell, setBlockPushing, setAllowParcelJoinDivide, setAgentLimit, setObjectBonus, setMature, setAdult]);
}
[About("Adds an estate manager to the current sim or all estates you control")]