entityTransfer is a nonshared module, so lets use its scene, sp ones should be the same, or something is bad

This commit is contained in:
UbitUmarov
2022-03-16 22:54:26 +00:00
parent 42e37d2087
commit 7b34b23d73
3 changed files with 218 additions and 296 deletions

View File

@@ -84,19 +84,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Wrong user account name format {0}. Specify 'First Last'", name);
return null;
}
UserAccount account = Scene.UserAccountService.GetUserAccount(UUID.Zero, parts[0], parts[1]);
UserAccount account = m_scene.UserAccountService.GetUserAccount(UUID.Zero, parts[0], parts[1]);
if (account == null)
{
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unknown account {0}", m_AccountName);
return null;
}
AvatarAppearance a = Scene.AvatarService.GetAppearance(account.PrincipalID);
AvatarAppearance a = m_scene.AvatarService.GetAppearance(account.PrincipalID);
if (a != null)
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Successfully retrieved appearance for {0}", name);
foreach (AvatarAttachment att in a.GetAttachments())
{
InventoryItemBase item = Scene.InventoryService.GetItem(account.PrincipalID, att.ItemID);
InventoryItemBase item = m_scene.InventoryService.GetItem(account.PrincipalID, att.ItemID);
if (item != null)
a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID);
else
@@ -214,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
{
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_sceneRegionInfo.ScopeID, region.RegionID);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags);
message = null;
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (OutViewRange)
return true;
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_sceneRegionInfo.ScopeID, reg.RegionID);
if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
return true;
@@ -250,9 +250,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (logout)
{
// Log them out of this grid
Scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
string userId = Scene.UserManagementModule.GetUserUUI(sp.UUID);
Scene.GridUserService.LoggedOut(userId, UUID.Zero, Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
string userId = m_scene.UserManagementModule.GetUserUUI(sp.UUID);
m_scene.GridUserService.LoggedOut(userId, UUID.Zero, m_sceneRegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
}
}
@@ -261,12 +261,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
reason = string.Empty;
logout = false;
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
int flags = Scene.GridService.GetRegionFlags(m_sceneRegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{
// this user is going to another grid
// for local users, check if HyperGrid teleport is allowed, based on user level
bool isLocal = Scene.UserManagementModule.IsLocalGridUser(sp.UUID);
bool isLocal = m_scene.UserManagementModule.IsLocalGridUser(sp.UUID);
if (isLocal && sp.GodController.UserLevel < m_levelHGTeleport)
{
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
@@ -284,7 +284,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else
connector = new UserAgentServiceConnector(userAgentDriver);
GridRegion source = new GridRegion(Scene.RegionInfo)
GridRegion source = new GridRegion(m_sceneRegionInfo)
{
RawServerURI = m_thisGridInfo.GateKeeperURL
};
@@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
logout = success; // flag for later logout from this grid; this is an HG TP
if (success)
Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
m_scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
return success;
}
@@ -320,11 +320,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// The rest is only needed for controlling appearance
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_sceneRegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{
// this user is going to another grid
if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID))
if (m_scene.UserManagementModule.IsLocalGridUser(sp.UUID))
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance");
@@ -434,7 +434,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override bool TeleportHome(UUID id, IClientAPI client)
{
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
if (uMan != null && uMan.IsLocalGridUser(id))
{
// local grid user
@@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
(string.IsNullOrEmpty(lm.Gatekeeper)) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null || sp.IsDeleted || sp.IsInTransit || sp.IsChildAgent || sp.IsNPC)
return;
@@ -557,7 +557,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_thisGridInfo.IsLocalGrid(gatekeeperHost) != 0)
{
// Local region?
GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
if (info == null)
{
remoteClient.SendTeleportFailed("Landmark region not found");
@@ -567,11 +567,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
//check if region on same position and fix local offset
if (Util.CompareRegionHandles(lm.RegionHandle, lm.Position, info.RegionLocX, info.RegionLocY, info.RegionSizeX, info.RegionSizeY, out Vector3 offset))
{
Scene.RequestTeleportLocation(remoteClient, info.RegionHandle, offset,
m_scene.RequestTeleportLocation(remoteClient, info.RegionHandle, offset,
lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
}
else //region may had move to other grid slot. assume the lm position is good
Scene.RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
m_scene.RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
return;
}
@@ -593,7 +593,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
RegionFlags = OpenSim.Framework.RegionFlags.Hyperlink
};
string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
string homeURI = m_scene.GetAgentHomeURI(remoteClient.AgentId);
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, lm.RegionID, remoteClient.AgentId, homeURI, out string message);
@@ -648,11 +648,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
{
UUID OwnerID = so.OwnerID;
if (Scene.RegionInfo.EstateSettings.IsBanned(OwnerID))
if (m_sceneRegionInfo.EstateSettings.IsBanned(OwnerID))
{
m_log.DebugFormat(
"[HG TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}",
so.Name, so.UUID, Scene.Name, so.OwnerID);
so.Name, so.UUID, m_sceneName, so.OwnerID);
return false;
}
@@ -662,11 +662,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return base.HandleIncomingSceneObject(so, newPosition);
// Equally, we can't use so.AttachedAvatar here.
if (OwnerID.IsZero() || Scene.UserManagementModule.IsLocalGridUser(OwnerID))
if (OwnerID.IsZero() || m_scene.UserManagementModule.IsLocalGridUser(OwnerID))
return base.HandleIncomingSceneObject(so, newPosition);
// foreign user
AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(OwnerID);
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(OwnerID);
if (aCircuit != null)
{
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) == 0)
@@ -689,7 +689,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// so.Name, so.AttachedAvatar, url);
IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url, ids);
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, url, ids);
uuidGatherer.AddForInspection(defso);
while (!uuidGatherer.Complete)
@@ -783,7 +783,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
// UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId);
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))