useless cosmetics

master
UbitUmarov 2020-07-15 01:40:53 +01:00
parent f32c0ead05
commit 6c5bf4ed25
4 changed files with 149 additions and 166 deletions

View File

@ -108,10 +108,10 @@ namespace OpenSim.Region.CoreModules.Asset
private IAssetService m_AssetService; private IAssetService m_AssetService;
private List<Scene> m_Scenes = new List<Scene>(); private List<Scene> m_Scenes = new List<Scene>();
private object timerLock = new object(); private readonly object timerLock = new object();
private Dictionary<string,WeakReference> weakAssetReferences = new Dictionary<string, WeakReference>(); private Dictionary<string,WeakReference> weakAssetReferences = new Dictionary<string, WeakReference>();
private object weakAssetReferencesLock = new object(); private readonly object weakAssetReferencesLock = new object();
private bool m_updateFileTimeOnCacheHit = false; private bool m_updateFileTimeOnCacheHit = false;
public FlotsamAssetCache() public FlotsamAssetCache()
@ -282,8 +282,10 @@ namespace OpenSim.Region.CoreModules.Asset
{ {
if (m_FileCacheEnabled && (m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) if (m_FileCacheEnabled && (m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero))
{ {
m_CacheCleanTimer = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds); m_CacheCleanTimer = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds)
m_CacheCleanTimer.AutoReset = false; {
AutoReset = false
};
m_CacheCleanTimer.Elapsed += CleanupExpiredFiles; m_CacheCleanTimer.Elapsed += CleanupExpiredFiles;
m_CacheCleanTimer.Start(); m_CacheCleanTimer.Start();
m_timerRunning = true; m_timerRunning = true;
@ -294,13 +296,13 @@ namespace OpenSim.Region.CoreModules.Asset
{ {
m_assetFileWriteQueue = new BlockingCollection<WriteAssetInfo>(); m_assetFileWriteQueue = new BlockingCollection<WriteAssetInfo>();
m_cancelSource = new CancellationTokenSource(); m_cancelSource = new CancellationTokenSource();
WorkManager.RunInThreadPool(processWrites, null, "FloatsamCacheWriter", false); WorkManager.RunInThreadPool(ProcessWrites, null, "FloatsamCacheWriter", false);
} }
} }
} }
} }
private void processWrites(object o) private void ProcessWrites(object o)
{ {
try try
{ {
@ -309,6 +311,7 @@ namespace OpenSim.Region.CoreModules.Asset
if(m_assetFileWriteQueue.TryTake(out WriteAssetInfo wai,-1, m_cancelSource.Token)) if(m_assetFileWriteQueue.TryTake(out WriteAssetInfo wai,-1, m_cancelSource.Token))
{ {
WriteFileCache(wai.filename,wai.asset,false); WriteFileCache(wai.filename,wai.asset,false);
wai.asset = null;
} }
} }
} }
@ -320,10 +323,9 @@ namespace OpenSim.Region.CoreModules.Asset
// //
private void UpdateWeakReference(string key, AssetBase asset) private void UpdateWeakReference(string key, AssetBase asset)
{ {
WeakReference aref;
lock(weakAssetReferencesLock) lock(weakAssetReferencesLock)
{ {
if(weakAssetReferences.TryGetValue(key , out aref)) if(weakAssetReferences.TryGetValue(key , out WeakReference aref))
aref.Target = asset; aref.Target = asset;
else else
weakAssetReferences[key] = new WeakReference(asset); weakAssetReferences[key] = new WeakReference(asset);
@ -362,9 +364,12 @@ namespace OpenSim.Region.CoreModules.Asset
m_CurrentlyWriting.Add(filename); m_CurrentlyWriting.Add(filename);
} }
WriteAssetInfo wai = new WriteAssetInfo(); WriteAssetInfo wai = new WriteAssetInfo()
wai.filename = filename; {
wai.asset = asset; filename = filename,
asset = asset
};
if (m_assetFileWriteQueue != null) if (m_assetFileWriteQueue != null)
m_assetFileWriteQueue.Add(wai); m_assetFileWriteQueue.Add(wai);
} }
@ -450,13 +455,13 @@ namespace OpenSim.Region.CoreModules.Asset
/// <returns></returns> /// <returns></returns>
private AssetBase GetFromMemoryCache(string id) private AssetBase GetFromMemoryCache(string id)
{ {
AssetBase asset = null; if (m_MemoryCache.TryGetValue(id, out AssetBase asset))
{
if (m_MemoryCache.TryGetValue(id, out asset))
m_MemoryHits++; m_MemoryHits++;
return asset; return asset;
} }
return null;
}
private bool CheckFromMemoryCache(string id) private bool CheckFromMemoryCache(string id)
{ {
@ -550,8 +555,7 @@ namespace OpenSim.Region.CoreModules.Asset
// For IAssetService // For IAssetService
public AssetBase Get(string id) public AssetBase Get(string id)
{ {
AssetBase asset; Get(id, out AssetBase asset);
Get(id, out asset);
return asset; return asset;
} }
@ -561,8 +565,7 @@ namespace OpenSim.Region.CoreModules.Asset
m_Requests++; m_Requests++;
object dummy; if (m_negativeCache.TryGetValue(id, out object dummy))
if (m_negativeCache.TryGetValue(id, out dummy))
{ {
return false; return false;
} }
@ -620,8 +623,7 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetBase GetCached(string id) public AssetBase GetCached(string id)
{ {
AssetBase asset; Get(id, out AssetBase asset);
Get(id, out asset);
return asset; return asset;
} }
@ -1295,8 +1297,7 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetMetadata GetMetadata(string id) public AssetMetadata GetMetadata(string id)
{ {
AssetBase asset; Get(id, out AssetBase asset);
Get(id, out asset);
if (asset == null) if (asset == null)
return null; return null;
return asset.Metadata; return asset.Metadata;
@ -1304,8 +1305,7 @@ namespace OpenSim.Region.CoreModules.Asset
public byte[] GetData(string id) public byte[] GetData(string id)
{ {
AssetBase asset; Get(id, out AssetBase asset);
Get(id, out asset);
if (asset == null) if (asset == null)
return null; return null;
return asset.Data; return asset.Data;
@ -1313,8 +1313,7 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Get(string id, object sender, AssetRetrieved handler) public bool Get(string id, object sender, AssetRetrieved handler)
{ {
AssetBase asset; if (!Get(id, out AssetBase asset))
if (!Get(id, out asset))
return false; return false;
handler(id, sender, asset); handler(id, sender, asset);
return true; return true;
@ -1346,8 +1345,7 @@ namespace OpenSim.Region.CoreModules.Asset
public bool UpdateContent(string id, byte[] data) public bool UpdateContent(string id, byte[] data)
{ {
AssetBase asset; if (!Get(id, out AssetBase asset))
if (!Get(id, out asset))
return false; return false;
asset.Data = data; asset.Data = data;
Cache(asset, true); Cache(asset, true);

View File

@ -150,8 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (options.ContainsKey("noassets") && (bool)options["noassets"]) if (options.ContainsKey("noassets") && (bool)options["noassets"])
SaveAssets = false; SaveAssets = false;
Object temp; if (options.TryGetValue("checkPermissions", out Object temp))
if (options.TryGetValue("checkPermissions", out temp))
FilterContent = (string)temp; FilterContent = (string)temp;
@ -243,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
if (entity is SceneObjectGroup) if (entity is SceneObjectGroup)
{ {
SceneObjectGroup sceneObject = (SceneObjectGroup)entity; SceneObjectGroup sceneObject = entity as SceneObjectGroup;
if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit) if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit)
{ {
@ -528,15 +527,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
for (uint y = (uint)scenesGroup.Rect.Top; y < scenesGroup.Rect.Bottom; ++y) for (uint y = (uint)scenesGroup.Rect.Top; y < scenesGroup.Rect.Bottom; ++y)
{ {
SortedDictionary<uint, Scene> row; if (scenesGroup.Regions.TryGetValue(y, out SortedDictionary<uint, Scene> row))
if (scenesGroup.Regions.TryGetValue(y, out row))
{ {
xtw.WriteStartElement("row"); xtw.WriteStartElement("row");
for (uint x = (uint)scenesGroup.Rect.Left; x < scenesGroup.Rect.Right; ++x) for (uint x = (uint)scenesGroup.Rect.Left; x < scenesGroup.Rect.Right; ++x)
{ {
Scene scene; if (row.TryGetValue(x, out Scene scene))
if (row.TryGetValue(x, out scene))
{ {
xtw.WriteStartElement("region"); xtw.WriteStartElement("region");
xtw.WriteElementString("id", scene.RegionInfo.RegionID.ToString()); xtw.WriteElementString("id", scene.RegionInfo.RegionID.ToString());

View File

@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene = scene; Scene = scene;
Scene.RegisterModuleInterface<IEstateModule>(this); Scene.RegisterModuleInterface<IEstateModule>(this);
Scene.EventManager.OnNewClient += EventManager_OnNewClient; Scene.EventManager.OnNewClient += EventManager_OnNewClient;
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; Scene.EventManager.OnRequestChangeWaterHeight += ChangeWaterHeight;
m_Telehub = new TelehubManager(scene); m_Telehub = new TelehubManager(scene);
@ -206,23 +206,17 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void sendRegionHandshakeToAll() public void sendRegionHandshakeToAll()
{ {
Scene.ForEachClient(sendRegionHandshake); Scene.ForEachClient(SendRegionHandshake);
} }
public void TriggerEstateInfoChange() public void TriggerEstateInfoChange()
{ {
ChangeDelegate change = OnEstateInfoChange; OnEstateInfoChange?.Invoke(Scene.RegionInfo.RegionID);
if (change != null)
change(Scene.RegionInfo.RegionID);
} }
protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
{ {
ChangeDelegate change = OnRegionInfoChange; OnRegionInfoChange?.Invoke(Scene.RegionInfo.RegionID);
if (change != null)
change(Scene.RegionInfo.RegionID);
} }
public void TriggerRegionInfoChange() public void TriggerRegionInfoChange()
@ -230,21 +224,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_regionChangeTimer.Stop(); m_regionChangeTimer.Stop();
m_regionChangeTimer.Start(); m_regionChangeTimer.Start();
ChangeDelegate change = OnRegionInfoChange; OnRegionInfoChange?.Invoke(Scene.RegionInfo.RegionID);
if (change != null)
change(Scene.RegionInfo.RegionID);
} }
public void setEstateTerrainBaseTexture(int level, UUID texture) public void setEstateTerrainBaseTexture(int level, UUID texture)
{ {
setEstateTerrainBaseTexture(null, level, texture); SetEstateTerrainBaseTexture(null, level, texture);
sendRegionHandshakeToAll(); sendRegionHandshakeToAll();
} }
public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
{ {
setEstateTerrainTextureHeights(null, corner, lowValue, highValue); SetEstateTerrainTextureHeights(null, corner, lowValue, highValue);
} }
public bool IsTerrainXfer(ulong xferID) public bool IsTerrainXfer(ulong xferID)
@ -287,10 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero; UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero;
if (regionId != UUID.Zero) if (regionId != UUID.Zero)
{ {
ChangeDelegate change = OnEstateInfoChange; OnEstateInfoChange?.Invoke(regionId);
if (change != null)
change(regionId);
} }
} }
@ -334,10 +322,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero; UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero;
if (regionId != UUID.Zero) if (regionId != UUID.Zero)
{ {
ChangeDelegate change = OnEstateInfoChange; OnEstateInfoChange?.Invoke(regionId);
if (change != null)
change(regionId);
} }
} }
} }
@ -366,10 +351,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName); m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName);
// propagate the change // propagate the change
ChangeDelegate change = OnEstateInfoChange; OnEstateInfoChange?.Invoke(regionInfo.RegionID);
if (change != null)
change(regionInfo.RegionID);
response = String.Empty; response = String.Empty;
} }
@ -416,13 +398,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
#region Packet Data Responders #region Packet Data Responders
private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) private void ClientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
{ {
sendDetailedEstateData(remote_client, invoice); SendDetailedEstateData(remote_client, invoice);
sendEstateLists(remote_client, invoice); SendEstateLists(remote_client, invoice);
} }
private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) private void SendDetailedEstateData(IClientAPI remote_client, UUID invoice)
{ {
UUID estateOwner; UUID estateOwner;
estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner; estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
@ -442,7 +424,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
estateOwner); estateOwner);
} }
private void sendEstateLists(IClientAPI remote_client, UUID invoice) private void SendEstateLists(IClientAPI remote_client, UUID invoice)
{ {
remote_client.SendEstateList(invoice, remote_client.SendEstateList(invoice,
(int)Constants.EstateAccessCodex.EstateManagers, (int)Constants.EstateAccessCodex.EstateManagers,
@ -464,7 +446,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.EstateSettings.EstateID); Scene.RegionInfo.EstateSettings.EstateID);
} }
private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, private void EstateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
int matureLevel, bool restrictPushObject, bool allowParcelChanges) int matureLevel, bool restrictPushObject, bool allowParcelChanges)
{ {
if (blockTerraform) if (blockTerraform)
@ -514,10 +496,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.RegionSettings.Save(); Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange(); TriggerRegionInfoChange();
sendRegionInfoPacketToAll(); SendRegionInfoPacketToAll();
} }
public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) public void SetEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture)
{ {
if (texture == UUID.Zero) if (texture == UUID.Zero)
return; return;
@ -540,10 +522,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.RegionSettings.Save(); Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange(); TriggerRegionInfoChange();
sendRegionInfoPacketToAll(); SendRegionInfoPacketToAll();
} }
public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) public void SetEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
{ {
switch (corner) switch (corner)
{ {
@ -571,12 +553,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
// sendRegionInfoPacketToAll(); // sendRegionInfoPacketToAll();
} }
private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) private void HandleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
{ {
// sendRegionHandshakeToAll(); // sendRegionHandshakeToAll();
} }
public void setRegionTerrainSettings(float WaterHeight, public void SetRegionTerrainSettings(float WaterHeight,
float TerrainRaiseLimit, float TerrainLowerLimit, float TerrainRaiseLimit, float TerrainLowerLimit,
bool UseEstateSun, bool UseFixedSun, float SunHour, bool UseEstateSun, bool UseFixedSun, float SunHour,
bool UseGlobal, bool EstateFixedSun, float EstateSunHour) bool UseGlobal, bool EstateFixedSun, float EstateSunHour)
@ -600,12 +582,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
//m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
//m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString());
sendRegionInfoPacketToAll(); SendRegionInfoPacketToAll();
Scene.RegionInfo.RegionSettings.Save(); Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange(); TriggerRegionInfoChange();
} }
private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) private void HandleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
{ {
if (!AllowRegionRestartFromClient) if (!AllowRegionRestartFromClient)
{ {
@ -646,7 +628,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) private void HandleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}", // "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}",
@ -658,7 +640,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
TriggerRegionInfoChange(); TriggerRegionInfoChange();
} }
private object deltareqLock = new object(); private readonly object deltareqLock = new object();
private bool runnigDeltaExec = false; private bool runnigDeltaExec = false;
private class EstateAccessDeltaRequest private class EstateAccessDeltaRequest
@ -671,18 +653,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
private BlockingCollection<EstateAccessDeltaRequest> deltaRequests = new BlockingCollection<EstateAccessDeltaRequest>(); private BlockingCollection<EstateAccessDeltaRequest> deltaRequests = new BlockingCollection<EstateAccessDeltaRequest>();
private void handleEstateAccessDeltaRequest(IClientAPI _remote_client, UUID _invoice, int _estateAccessType, UUID _user) private void HandleEstateAccessDeltaRequest(IClientAPI _remote_client, UUID _invoice, int _estateAccessType, UUID _user)
{ {
// EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
if (_user == Scene.RegionInfo.EstateSettings.EstateOwner) if (_user == Scene.RegionInfo.EstateSettings.EstateOwner)
return; // never process EO return; // never process EO
EstateAccessDeltaRequest newreq = new EstateAccessDeltaRequest(); EstateAccessDeltaRequest newreq = new EstateAccessDeltaRequest()
newreq.remote_client = _remote_client; {
newreq.invoice = _invoice; remote_client = _remote_client,
newreq.estateAccessType = _estateAccessType; invoice = _invoice,
newreq.user = _user; estateAccessType = _estateAccessType,
user = _user
};
deltaRequests.Add(newreq); deltaRequests.Add(newreq);
@ -691,12 +675,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
if(!runnigDeltaExec) if(!runnigDeltaExec)
{ {
runnigDeltaExec = true; runnigDeltaExec = true;
WorkManager.RunInThreadPool(execDeltaRequests,null,"execDeltaRequests"); WorkManager.RunInThreadPool(ExecDeltaRequests,null,"execDeltaRequests");
} }
} }
} }
private void execDeltaRequests(object o) private void ExecDeltaRequests(object o)
{ {
IClientAPI remote_client; IClientAPI remote_client;
UUID invoice; UUID invoice;
@ -960,13 +944,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
if(estateSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans) if(estateSettings.EstateBansCount() >= (int)Constants.EstateAccessLimits.EstateBans)
continue; continue;
EstateBan bitem = new EstateBan(); EstateBan bitem = new EstateBan()
bitem.BannedUserID = user; {
bitem.EstateID = estateSettings.EstateID; BannedUserID = user,
bitem.BannedHostAddress = "0.0.0.0"; EstateID = estateSettings.EstateID,
bitem.BannedHostIPMask = "0.0.0.0"; BannedHostAddress = "0.0.0.0",
bitem.BanningUserID = remote_client.AgentId; BannedHostIPMask = "0.0.0.0",
bitem.BanTime = Util.UnixTimeSinceEpoch(); BanningUserID = remote_client.AgentId,
BanTime = Util.UnixTimeSinceEpoch()
};
estateSettings.AddBan(bitem); estateSettings.AddBan(bitem);
estateSettings.RemoveEstateUser(user); estateSettings.RemoveEstateUser(user);
@ -974,13 +960,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
EstateBan item = new EstateBan(); EstateBan item = new EstateBan()
item.BannedUserID = user; {
item.EstateID = Scene.RegionInfo.EstateSettings.EstateID; BannedUserID = user,
item.BannedHostAddress = "0.0.0.0"; EstateID = Scene.RegionInfo.EstateSettings.EstateID,
item.BannedHostIPMask = "0.0.0.0"; BannedHostAddress = "0.0.0.0",
item.BanningUserID = remote_client.AgentId; BannedHostIPMask = "0.0.0.0",
item.BanTime = Util.UnixTimeSinceEpoch(); BanningUserID = remote_client.AgentId,
BanTime = Util.UnixTimeSinceEpoch()
};
thisSettings.AddBan(item); thisSettings.AddBan(item);
thisSettings.RemoveEstateUser(user); thisSettings.RemoveEstateUser(user);
@ -1174,7 +1162,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
TriggerEstateMessage(senderID, senderName, message); TriggerEstateMessage(senderID, senderName, message);
} }
private void handleEstateDebugRegionRequest( private void HandleEstateDebugRegionRequest(
IClientAPI remote_client, UUID invoice, UUID senderID, IClientAPI remote_client, UUID invoice, UUID senderID,
bool disableScripts, bool disableCollisions, bool disablePhysics) bool disableScripts, bool disableCollisions, bool disablePhysics)
{ {
@ -1198,7 +1186,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey, bool kick) private void HandleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey, bool kick)
{ {
if (prey == UUID.Zero) if (prey == UUID.Zero)
return; return;
@ -1229,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) private void HandleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
{ {
EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest; EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest;
if(evOverride != null) if(evOverride != null)
@ -1247,8 +1235,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
// make sure they are still there, we could be working down a long list // make sure they are still there, we could be working down a long list
// Also make sure they are actually in the region // Also make sure they are actually in the region
ScenePresence p; if(Scene.TryGetScenePresence(client.AgentId, out ScenePresence p))
if(Scene.TryGetScenePresence(client.AgentId, out p))
{ {
if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient))
{ {
@ -1335,7 +1322,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) private void HandleUploadTerrain(IClientAPI remote_client, string clientFileName)
{ {
lock (this) lock (this)
{ {
@ -1358,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) private void HandleTerrainRequest(IClientAPI remote_client, string clientFileName)
{ {
// Save terrain here // Save terrain here
ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>(); ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>();
@ -1395,26 +1382,28 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void HandleRegionInfoRequest(IClientAPI remote_client) public void HandleRegionInfoRequest(IClientAPI remote_client)
{ {
RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs()
args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor; {
args.estateID = Scene.RegionInfo.EstateSettings.EstateID; billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor,
args.maxAgents = Scene.RegionInfo.RegionSettings.AgentLimit; estateID = Scene.RegionInfo.EstateSettings.EstateID,
args.objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus; maxAgents = Scene.RegionInfo.RegionSettings.AgentLimit,
args.parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID; objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus,
args.pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter; parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID,
args.redirectGridX = Scene.RegionInfo.EstateSettings.RedirectGridX; pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter,
args.redirectGridY = Scene.RegionInfo.EstateSettings.RedirectGridY; redirectGridX = Scene.RegionInfo.EstateSettings.RedirectGridX,
args.regionFlags = GetRegionFlags(); redirectGridY = Scene.RegionInfo.EstateSettings.RedirectGridY,
args.simAccess = Scene.RegionInfo.AccessLevel; regionFlags = GetRegionFlags(),
args.sunHour = 0; simAccess = Scene.RegionInfo.AccessLevel,
args.terrainLowerLimit = (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit; sunHour = 0,
args.terrainRaiseLimit = (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit; terrainLowerLimit = (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit,
args.useEstateSun = false; terrainRaiseLimit = (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit,
args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight; useEstateSun = false,
args.simName = Scene.RegionInfo.RegionName; waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight,
args.regionType = Scene.RegionInfo.RegionType; simName = Scene.RegionInfo.RegionName,
args.AgentCapacity = Scene.RegionInfo.AgentCapacity; regionType = Scene.RegionInfo.RegionType,
args.ObjectsCapacity = Scene.RegionInfo.ObjectCapacity; AgentCapacity = Scene.RegionInfo.AgentCapacity,
ObjectsCapacity = Scene.RegionInfo.ObjectCapacity,
};
remote_client.SendRegionInfoToEstateMenu(args); remote_client.SendRegionInfoToEstateMenu(args);
} }
@ -1468,15 +1457,17 @@ namespace OpenSim.Region.CoreModules.World.Estate
items++; items++;
SceneObjectGroup so = entry.Part.ParentGroup; SceneObjectGroup so = entry.Part.ParentGroup;
LandStatReportItem lsri = new LandStatReportItem(); LandStatReportItem lsri = new LandStatReportItem()
lsri.LocationX = so.AbsolutePosition.X; {
lsri.LocationY = so.AbsolutePosition.Y; LocationX = so.AbsolutePosition.X,
lsri.LocationZ = so.AbsolutePosition.Z; LocationY = so.AbsolutePosition.Y,
lsri.Score = entry.Measurement; LocationZ = so.AbsolutePosition.Z,
lsri.TaskID = so.UUID; Score = entry.Measurement,
lsri.TaskLocalID = so.LocalId; TaskID = so.UUID,
lsri.TaskName = entry.Part.Name; TaskLocalID = so.LocalId,
lsri.OwnerName = UserManager.GetUserName(so.OwnerID); TaskName = entry.Part.Name,
OwnerName = UserManager.GetUserName(so.OwnerID)
};
if (filter.Length != 0) if (filter.Length != 0)
{ {
@ -1503,7 +1494,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
#region Outgoing Packets #region Outgoing Packets
public void sendRegionInfoPacketToAll() public void SendRegionInfoPacketToAll()
{ {
// Scene.ForEachRootClient(delegate(IClientAPI client) // Scene.ForEachRootClient(delegate(IClientAPI client)
Scene.ForEachClient(delegate(IClientAPI client) Scene.ForEachClient(delegate(IClientAPI client)
@ -1512,12 +1503,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
}); });
} }
public void sendRegionHandshake(IClientAPI remoteClient) public void SendRegionHandshake(IClientAPI remoteClient)
{ {
remoteClient.SendRegionHandshake(); remoteClient.SendRegionHandshake();
} }
public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) public void HandleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2)
{ {
bool lastallowEnvOvr = Scene.RegionInfo.EstateSettings.AllowEnvironmentOverride; bool lastallowEnvOvr = Scene.RegionInfo.EstateSettings.AllowEnvironmentOverride;
@ -1578,7 +1569,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
TriggerEstateInfoChange(); TriggerEstateInfoChange();
sendDetailedEstateData(remoteClient, invoice); SendDetailedEstateData(remoteClient, invoice);
} }
public bool handleEstateChangeInfoCap(string estateName, UUID invoice, public bool handleEstateChangeInfoCap(string estateName, UUID invoice,
@ -1614,9 +1605,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
#region Other Functions #region Other Functions
public void changeWaterHeight(float height) public void ChangeWaterHeight(float height)
{ {
setRegionTerrainSettings(height, SetRegionTerrainSettings(height,
(float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit, (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit,
(float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit, (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit,
Scene.RegionInfo.RegionSettings.UseEstateSun, Scene.RegionInfo.RegionSettings.UseEstateSun,
@ -1636,25 +1627,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void EventManager_OnNewClient(IClientAPI client) private void EventManager_OnNewClient(IClientAPI client)
{ {
client.OnDetailedEstateDataRequest += clientSendDetailedEstateData; client.OnDetailedEstateDataRequest += ClientSendDetailedEstateData;
client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; client.OnSetEstateFlagsRequest += EstateSetRegionInfoHandler;
// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; client.OnSetEstateTerrainDetailTexture += SetEstateTerrainBaseTexture;
client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights; client.OnSetEstateTerrainTextureHeights += SetEstateTerrainTextureHeights;
client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest; client.OnCommitEstateTerrainTextureRequest += HandleCommitEstateTerrainTextureRequest;
client.OnSetRegionTerrainSettings += setRegionTerrainSettings; client.OnSetRegionTerrainSettings += SetRegionTerrainSettings;
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; client.OnEstateRestartSimRequest += HandleEstateRestartSimRequest;
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; client.OnEstateChangeCovenantRequest += HandleChangeEstateCovenantRequest;
client.OnEstateChangeInfo += handleEstateChangeInfo; client.OnEstateChangeInfo += HandleEstateChangeInfo;
client.OnEstateManageTelehub += HandleOnEstateManageTelehub; client.OnEstateManageTelehub += HandleOnEstateManageTelehub;
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; client.OnUpdateEstateAccessDeltaRequest += HandleEstateAccessDeltaRequest;
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; client.OnEstateDebugRegionRequest += HandleEstateDebugRegionRequest;
client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; client.OnEstateTeleportOneUserHomeRequest += HandleEstateTeleportOneUserHomeRequest;
client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest; client.OnEstateTeleportAllUsersHomeRequest += HandleEstateTeleportAllUsersHomeRequest;
client.OnRequestTerrain += handleTerrainRequest; client.OnRequestTerrain += HandleTerrainRequest;
client.OnUploadTerrain += handleUploadTerrain; client.OnUploadTerrain += HandleUploadTerrain;
client.OnRegionInfoRequest += HandleRegionInfoRequest; client.OnRegionInfoRequest += HandleRegionInfoRequest;
client.OnEstateCovenantRequest += HandleEstateCovenantRequest; client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
@ -1710,10 +1701,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void TriggerEstateMessage(UUID fromID, string fromName, string message) public void TriggerEstateMessage(UUID fromID, string fromName, string message)
{ {
MessageDelegate onmessage = OnEstateMessage; OnEstateMessage?.Invoke(Scene.RegionInfo.RegionID, fromID, fromName, message);
if (onmessage != null)
onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message);
} }

View File

@ -770,7 +770,7 @@
Cap_DispatchRegionInfo = "" Cap_DispatchRegionInfo = ""
Cap_EstateAccess = "localhost" Cap_EstateAccess = "localhost"
//Cap_EstateChangeInfo = "localhost" broken on viewers //Cap_EstateChangeInfo = "localhost" broken on viewers
Cap_EnvironmentSettings = "localhost" // this also controls ExtEnviroment cap Cap_EnvironmentSettings = "localhost" // this also controls ExtEnvironment cap
Cap_EventQueueGet = "localhost" Cap_EventQueueGet = "localhost"
Cap_FetchInventory = "" Cap_FetchInventory = ""
Cap_ObjectMedia = "localhost" Cap_ObjectMedia = "localhost"