patch SetRegionInfo to allow adult sims

This commit is contained in:
Madpeter 2025-07-07 20:15:03 +01:00
parent c5a83c986c
commit 15f501dc72
2 changed files with 31 additions and 5 deletions

View file

@ -560,8 +560,16 @@ namespace OpenMetaverse
}
/// <summary>Estate panel "Region" tab settings</summary>
/// @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);
}
/// <summary>Estate panel "Region" tab settings</summary>
public void SetRegionInfo(bool blockTerraform, bool blockFly, bool allowDamage, bool allowLandResell, bool restrictPushing, bool allowParcelJoinDivide, float agentLimit, float objectBonus, bool mature, bool adult)
{
List<string> listParams = new List<string>();
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;

View file

@ -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")]