Merge branch 'master' from git://opensimulator.org/git/opensim into dev
Conflicts: OpenSim/Region/Framework/Scenes/Scene.csdsg
commit
a23ffa2262
|
@ -427,17 +427,28 @@ namespace OpenSim.Framework
|
|||
/// 0x80 bit set then we assume this is an append
|
||||
/// operation otherwise we replace whatever is
|
||||
/// currently attached at the attachpoint
|
||||
/// return true if something actually changed
|
||||
/// </summary>
|
||||
public void SetAttachment(int attachpoint, UUID item, UUID asset)
|
||||
public bool SetAttachment(int attachpoint, UUID item, UUID asset)
|
||||
{
|
||||
if (attachpoint == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (item == UUID.Zero)
|
||||
{
|
||||
if (m_attachments.ContainsKey(attachpoint))
|
||||
{
|
||||
m_attachments.Remove(attachpoint);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the item is already attached at this point
|
||||
if (GetAttachpoint(item) == (attachpoint & 0x7F))
|
||||
{
|
||||
// m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if this is an append or a replace, 0x80 marks it as an append
|
||||
|
@ -451,6 +462,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int GetAttachpoint(UUID itemID)
|
||||
|
@ -465,7 +477,7 @@ namespace OpenSim.Framework
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void DetachAttachment(UUID itemID)
|
||||
public bool DetachAttachment(UUID itemID)
|
||||
{
|
||||
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
|
||||
{
|
||||
|
@ -478,9 +490,10 @@ namespace OpenSim.Framework
|
|||
// And remove the list if there are no more attachments here
|
||||
if (m_attachments[kvp.Key].Count == 0)
|
||||
m_attachments.Remove(kvp.Key);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAttachments()
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Framework.Console
|
|||
System.Console.WriteLine(text);
|
||||
}
|
||||
|
||||
public virtual void OutputFormat(string format, params string[] components)
|
||||
public virtual void OutputFormat(string format, params object[] components)
|
||||
{
|
||||
Output(string.Format(format, components));
|
||||
}
|
||||
|
|
|
@ -697,6 +697,8 @@ namespace OpenSim.Framework
|
|||
landData._mediaLoop = _mediaLoop;
|
||||
landData._obscureMusic = _obscureMusic;
|
||||
landData._obscureMedia = _obscureMedia;
|
||||
landData._simwideArea = _simwideArea;
|
||||
landData._simwidePrims = _simwidePrims;
|
||||
|
||||
landData._parcelAccessList.Clear();
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
|
||||
|
|
|
@ -179,9 +179,11 @@ namespace OpenSim
|
|||
for (int i = 0 ; i < sources.Count ; i++)
|
||||
{
|
||||
if (ReadConfig(sources[i]))
|
||||
{
|
||||
iniFileExists = true;
|
||||
AddIncludes(sources);
|
||||
}
|
||||
}
|
||||
|
||||
if (!iniFileExists)
|
||||
{
|
||||
|
@ -235,6 +237,14 @@ namespace OpenSim
|
|||
string path = Path.Combine(basepath, chunkWithoutWildcards);
|
||||
path = Path.GetFullPath(path) + chunkWithWildcards;
|
||||
string[] paths = Util.Glob(path);
|
||||
|
||||
// If the include path contains no wildcards, then warn the user that it wasn't found.
|
||||
if (wildcardIndex == -1 && paths.Length == 0)
|
||||
{
|
||||
m_log.WarnFormat("[CONFIG]: Could not find include file {0}", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string p in paths)
|
||||
{
|
||||
if (!sources.Contains(p))
|
||||
|
@ -245,6 +255,7 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Check if we can convert the string to a URI
|
||||
/// </summary>
|
||||
|
|
|
@ -4341,7 +4341,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
updateMessage.SequenceID = sequence_id;
|
||||
if (landData.SimwideArea > 0)
|
||||
{
|
||||
updateMessage.SimWideMaxPrims = parcelObjectCapacity;
|
||||
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
updateMessage.SimWideMaxPrims = simulatorCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
// private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
// m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,8 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
if (m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -336,7 +334,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
||||
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
|
||||
return att.UUID;
|
||||
|
@ -380,9 +380,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// XXYY!!
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = m_scene.InventoryService.GetItem(item);
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
|
||||
|
||||
if (m_scene.AvatarFactory != null)
|
||||
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
@ -402,11 +401,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
presence.Appearance.DetachAttachment(itemID);
|
||||
|
||||
// Save avatar attachment information
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||
if (m_scene.AvatarFactory != null)
|
||||
|
||||
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
}
|
||||
|
||||
|
@ -431,9 +430,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
||||
return;
|
||||
|
||||
presence.Appearance.DetachAttachment(itemID);
|
||||
|
||||
if (m_scene.AvatarFactory != null)
|
||||
bool changed = presence.Appearance.DetachAttachment(itemID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||
|
||||
part.ParentGroup.DetachToGround();
|
||||
|
|
|
@ -217,6 +217,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
// update transaction. In theory, we should be able to do an immediate
|
||||
// appearance send and save here.
|
||||
|
||||
// save only if there were changes, send no matter what (doesn't hurt to send twice)
|
||||
if (changed)
|
||||
QueueAppearanceSave(client.AgentId);
|
||||
QueueAppearanceSend(client.AgentId);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected bool m_Enabled = false;
|
||||
protected Scene m_aScene;
|
||||
protected List<UUID> m_agentsInTransit;
|
||||
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
||||
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
||||
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
|
@ -281,6 +284,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
}
|
||||
|
||||
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("The destination region has refused access");
|
||||
return;
|
||||
}
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
||||
|
@ -575,7 +584,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
#region Agent Crossings
|
||||
|
||||
public void Cross(ScenePresence agent, bool isFlying)
|
||||
public bool Cross(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
Scene scene = agent.Scene;
|
||||
Vector3 pos = agent.AbsolutePosition;
|
||||
|
@ -611,6 +620,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
else
|
||||
{
|
||||
agent.InTransit();
|
||||
|
||||
neighboury = b.TriggerRegionY;
|
||||
neighbourx = b.TriggerRegionX;
|
||||
|
||||
|
@ -620,7 +631,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,6 +643,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
else
|
||||
{
|
||||
agent.InTransit();
|
||||
|
||||
neighboury = ba.TriggerRegionY;
|
||||
neighbourx = ba.TriggerRegionX;
|
||||
|
||||
|
@ -644,7 +657,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -664,6 +677,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
else
|
||||
{
|
||||
agent.InTransit();
|
||||
|
||||
neighboury = ba.TriggerRegionY;
|
||||
neighbourx = ba.TriggerRegionX;
|
||||
Vector3 newposition = pos;
|
||||
|
@ -672,7 +687,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
|
||||
|
@ -694,6 +709,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
else
|
||||
{
|
||||
agent.InTransit();
|
||||
|
||||
neighboury = b.TriggerRegionY;
|
||||
neighbourx = b.TriggerRegionX;
|
||||
Vector3 newposition = pos;
|
||||
|
@ -702,7 +719,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.ControllingClient.SendAgentAlertMessage(
|
||||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
|
||||
|
@ -738,9 +755,52 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
*/
|
||||
|
||||
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
|
||||
|
||||
ExpiringCache<ulong, DateTime> r;
|
||||
DateTime banUntil;
|
||||
|
||||
if (m_bannedRegions.TryGetValue(agent.ControllingClient.AgentId, out r))
|
||||
{
|
||||
if (r.TryGetValue(neighbourHandle, out banUntil))
|
||||
{
|
||||
if (DateTime.Now < banUntil)
|
||||
return false;
|
||||
r.Remove(neighbourHandle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
r = null;
|
||||
}
|
||||
|
||||
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos))
|
||||
{
|
||||
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
|
||||
if (r == null)
|
||||
{
|
||||
r = new ExpiringCache<ulong, DateTime>();
|
||||
r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
|
||||
|
||||
m_bannedRegions.Add(agent.ControllingClient.AgentId, r, TimeSpan.FromSeconds(45));
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
agent.InTransit();
|
||||
|
||||
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
|
||||
d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -751,7 +811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
private void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
|
||||
{
|
||||
|
||||
// This assumes that we know what our neighbors are.
|
||||
// This assumes that we know what our neighbours are.
|
||||
|
||||
InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
|
||||
d.BeginInvoke(agent, regionX, regionY, position, initiatingScene,
|
||||
|
@ -795,21 +855,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying);
|
||||
public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying);
|
||||
|
||||
/// <summary>
|
||||
/// This Closes child agents on neighboring regions
|
||||
/// This Closes child agents on neighbouring regions
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying)
|
||||
protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying)
|
||||
{
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
|
||||
|
||||
Scene m_scene = agent.Scene;
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
|
||||
int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
|
||||
GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (neighbourRegion != null && agent.ValidateAttachments())
|
||||
{
|
||||
|
@ -920,7 +978,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
#region Enable Child Agent
|
||||
/// <summary>
|
||||
/// This informs a single neighboring region about agent "avatar".
|
||||
/// This informs a single neighbouring region about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
public void EnableChildAgent(ScenePresence sp, GridRegion region)
|
||||
|
@ -977,7 +1035,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent);
|
||||
|
||||
/// <summary>
|
||||
/// This informs all neighboring regions about agent "avatar".
|
||||
/// This informs all neighbouring regions about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
public void EnableChildAgents(ScenePresence sp)
|
||||
|
@ -1108,7 +1166,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
|
||||
"[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
|
||||
neighbour.ExternalHostName,
|
||||
neighbour.RegionHandle,
|
||||
neighbour.RegionLocX,
|
||||
|
@ -1188,7 +1246,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
#endregion
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbor region {2} @ {3} " +
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " +
|
||||
"and EstablishAgentCommunication with seed cap {4}",
|
||||
m_scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" />
|
||||
<RegionModule id="HGInventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.HGInventoryAccessModule" />
|
||||
<RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" />
|
||||
<RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" />
|
||||
<RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" />
|
||||
<RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
|
||||
<RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
|
||||
|
|
|
@ -257,18 +257,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
|
||||
{
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
foreach (Scene s in m_sceneList)
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
||||
{
|
||||
//m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
|
||||
return s.QueryAccess(id);
|
||||
}
|
||||
if (s.RegionInfo.RegionID == destination.RegionID)
|
||||
return s.QueryAccess(id, position);
|
||||
}
|
||||
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||
return false;
|
||||
|
|
|
@ -240,18 +240,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID id)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
|
||||
{
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.QueryAccess(destination, id))
|
||||
if (m_localBackend.QueryAccess(destination, id, position))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
return m_remoteConnector.QueryAccess(destination, id);
|
||||
return m_remoteConnector.QueryAccess(destination, id, position);
|
||||
|
||||
return false;
|
||||
|
||||
|
|
|
@ -38,9 +38,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
|||
{
|
||||
private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
|
||||
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(
|
||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private ExpiringCache<UUID, UserAccount> m_UUIDCache;
|
||||
private ExpiringCache<string, UUID> m_NameCache;
|
||||
|
||||
|
|
|
@ -217,22 +217,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
m_scene.DeleteAllSceneObjects();
|
||||
}
|
||||
|
||||
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
|
||||
// otherwise, use the master avatar uuid instead
|
||||
LoadParcels(serialisedParcels);
|
||||
LoadObjects(serialisedSceneObjects);
|
||||
|
||||
// Reload serialized parcels
|
||||
m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
|
||||
List<LandData> landData = new List<LandData>();
|
||||
foreach (string serialisedParcel in serialisedParcels)
|
||||
{
|
||||
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
|
||||
if (!ResolveUserUuid(parcel.OwnerID))
|
||||
parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
landData.Add(parcel);
|
||||
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
|
||||
|
||||
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
|
||||
}
|
||||
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
|
||||
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
|
||||
|
||||
/// <summary>
|
||||
/// Load serialized scene objects.
|
||||
/// </summary>
|
||||
/// <param name="serialisedSceneObjects"></param>
|
||||
protected void LoadObjects(List<string> serialisedSceneObjects)
|
||||
{
|
||||
// Reload serialized prims
|
||||
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
|
||||
|
||||
|
@ -262,6 +260,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
// to the same scene (when this is possible).
|
||||
sceneObject.ResetIDs();
|
||||
|
||||
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
|
||||
// or creator data is present. Otherwise, use the estate owner instead.
|
||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||
{
|
||||
if (part.CreatorData == null || part.CreatorData == string.Empty)
|
||||
|
@ -319,10 +319,35 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
|
||||
if (ignoredObjects > 0)
|
||||
m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
|
||||
/// <summary>
|
||||
/// Load serialized parcels.
|
||||
/// </summary>
|
||||
/// <param name="serialisedParcels"></param>
|
||||
protected void LoadParcels(List<string> serialisedParcels)
|
||||
{
|
||||
// Reload serialized parcels
|
||||
m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
|
||||
List<LandData> landData = new List<LandData>();
|
||||
foreach (string serialisedParcel in serialisedParcels)
|
||||
{
|
||||
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
|
||||
if (!ResolveUserUuid(parcel.OwnerID))
|
||||
parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
|
||||
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
|
||||
// m_log.DebugFormat(
|
||||
// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
|
||||
// parcel.Name, parcel.LocalID, parcel.Area);
|
||||
|
||||
landData.Add(parcel);
|
||||
}
|
||||
|
||||
if (!m_merge)
|
||||
m_scene.LandChannel.Clear(false);
|
||||
|
||||
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
|
||||
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -555,37 +555,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
try
|
||||
{
|
||||
MemoryStream terrainStream = new MemoryStream(terrainData);
|
||||
terr.LoadFromStream(filename, terrainStream);
|
||||
terrainStream.Close();
|
||||
|
||||
string localfilename = "terrain.raw";
|
||||
|
||||
if (terrainData.Length == 851968)
|
||||
{
|
||||
localfilename = Path.Combine(Util.dataDir(),"terrain.raw"); // It's a .LLRAW
|
||||
}
|
||||
|
||||
if (terrainData.Length == 196662) // 24-bit 256x256 Bitmap
|
||||
localfilename = Path.Combine(Util.dataDir(), "terrain.bmp");
|
||||
|
||||
if (terrainData.Length == 256 * 256 * 4) // It's a .R32
|
||||
localfilename = Path.Combine(Util.dataDir(), "terrain.r32");
|
||||
|
||||
if (terrainData.Length == 256 * 256 * 8) // It's a .R64
|
||||
localfilename = Path.Combine(Util.dataDir(), "terrain.r64");
|
||||
|
||||
if (File.Exists(localfilename))
|
||||
{
|
||||
File.Delete(localfilename);
|
||||
}
|
||||
|
||||
FileStream input = new FileStream(localfilename, FileMode.CreateNew);
|
||||
input.Write(terrainData, 0, terrainData.Length);
|
||||
input.Close();
|
||||
|
||||
FileInfo x = new FileInfo(localfilename);
|
||||
|
||||
terr.LoadFromFile(localfilename);
|
||||
remoteClient.SendAlertMessage("Your terrain was loaded as a ." + x.Extension + " file. It may take a few moments to appear.");
|
||||
|
||||
FileInfo x = new FileInfo(filename);
|
||||
remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
|
@ -117,6 +117,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
return new List<ILandObject>();
|
||||
}
|
||||
|
||||
public void Clear(bool setupDefaultParcel)
|
||||
{
|
||||
if (m_landManagementModule != null)
|
||||
m_landManagementModule.Clear(setupDefaultParcel);
|
||||
}
|
||||
|
||||
public List<ILandObject> ParcelsNearPoint(Vector3 position)
|
||||
{
|
||||
if (m_landManagementModule != null)
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
|
@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData;
|
|||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
// used for caching
|
||||
internal class ExtendedLandData {
|
||||
internal class ExtendedLandData
|
||||
{
|
||||
public LandData LandData;
|
||||
public ulong RegionHandle;
|
||||
public uint X, Y;
|
||||
|
@ -65,6 +69,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
private LandChannel landChannel;
|
||||
private Scene m_scene;
|
||||
protected Commander m_commander = new Commander("land");
|
||||
|
||||
protected IUserManagement m_userManager;
|
||||
|
||||
// Minimum for parcels to work is 64m even if we don't actually use them.
|
||||
#pragma warning disable 0429
|
||||
|
@ -127,19 +134,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
||||
m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
|
||||
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
||||
m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
||||
|
||||
lock (m_scene)
|
||||
{
|
||||
m_scene.LandChannel = (ILandChannel)landChannel;
|
||||
}
|
||||
|
||||
InstallInterfaces();
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// TODO: Also release other event manager listeners here
|
||||
|
||||
m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
|
||||
m_scene.UnregisterModuleCommander(m_commander.Name);
|
||||
}
|
||||
|
||||
// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
||||
|
@ -149,6 +164,29 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
// return nearestParcel != null;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Processes commandline input. Do not call directly.
|
||||
/// </summary>
|
||||
/// <param name="args">Commandline arguments</param>
|
||||
protected void EventManagerOnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "land")
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
tmpArgs[i - 2] = args[i];
|
||||
|
||||
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
}
|
||||
}
|
||||
|
||||
void EventManagerOnNewClient(IClientAPI client)
|
||||
{
|
||||
//Register some client events
|
||||
|
@ -209,11 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
@ -223,11 +256,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
get { return "LandManagementModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parcel Add/Remove/Get/Create
|
||||
|
@ -270,13 +298,19 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
||||
m_landIDList.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a default parcel that spans the entire region and is owned by the estate owner.
|
||||
/// </summary>
|
||||
/// <returns>The parcel created.</returns>
|
||||
protected ILandObject CreateDefaultParcel()
|
||||
{
|
||||
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
|
||||
|
||||
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
|
||||
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
||||
AddLandObject(fullSimParcel);
|
||||
return AddLandObject(fullSimParcel);
|
||||
}
|
||||
|
||||
public List<ILandObject> AllParcels()
|
||||
|
@ -549,15 +583,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a basic Parcel object without an owner (a zeroed key)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ILandObject CreateBaseLand()
|
||||
{
|
||||
return new LandObject(UUID.Zero, false, m_scene);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a land object to the stored list and adds them to the landIDList to what they own
|
||||
/// </summary>
|
||||
|
@ -618,6 +643,28 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the scene of all parcels
|
||||
/// </summary>
|
||||
public void Clear(bool setupDefaultParcel)
|
||||
{
|
||||
lock (m_landList)
|
||||
{
|
||||
foreach (ILandObject lo in m_landList.Values)
|
||||
{
|
||||
//m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
|
||||
m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
|
||||
}
|
||||
|
||||
m_landList.Clear();
|
||||
}
|
||||
|
||||
ResetSimLandObjects();
|
||||
|
||||
if (setupDefaultParcel)
|
||||
CreateDefaultParcel();
|
||||
}
|
||||
|
||||
private void performFinalLandJoin(ILandObject master, ILandObject slave)
|
||||
{
|
||||
bool[,] landBitmapSlave = slave.GetLandBitmap();
|
||||
|
@ -662,7 +709,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
int x;
|
||||
int y;
|
||||
|
||||
if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0)
|
||||
if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0)
|
||||
return null;
|
||||
|
||||
try
|
||||
|
@ -704,10 +751,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
{
|
||||
try
|
||||
{
|
||||
if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
|
||||
//if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
|
||||
return m_landList[m_landIDList[x / 4, y / 4]];
|
||||
else
|
||||
return null;
|
||||
//else
|
||||
// return null;
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
|
@ -1283,7 +1330,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client)
|
||||
{
|
||||
ILandObject land;
|
||||
|
@ -1299,10 +1345,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
{
|
||||
land.DeedToGroup(groupID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region Land Object From Storage Functions
|
||||
|
||||
public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
|
||||
|
@ -1337,6 +1381,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
public void EventManagerOnNoLandDataFromStorage()
|
||||
{
|
||||
ResetSimLandObjects();
|
||||
CreateDefaultParcel();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1591,5 +1636,67 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
UpdateLandObject(localID, land.LandData);
|
||||
}
|
||||
|
||||
protected void InstallInterfaces()
|
||||
{
|
||||
Command clearCommand
|
||||
= new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region.");
|
||||
Command showCommand
|
||||
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region.");
|
||||
|
||||
m_commander.RegisterCommand("clear", clearCommand);
|
||||
m_commander.RegisterCommand("show", showCommand);
|
||||
|
||||
// Add this to our scene so scripts can call these functions
|
||||
m_scene.RegisterModuleCommander(m_commander);
|
||||
}
|
||||
|
||||
protected void ClearCommand(Object[] args)
|
||||
{
|
||||
string response = MainConsole.Instance.CmdPrompt(
|
||||
string.Format(
|
||||
"Are you sure that you want to clear all land parcels from {0} (y or n)",
|
||||
m_scene.RegionInfo.RegionName),
|
||||
"n");
|
||||
|
||||
if (response.ToLower() == "y")
|
||||
{
|
||||
Clear(true);
|
||||
MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowParcelsCommand(Object[] args)
|
||||
{
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
|
||||
report.AppendFormat(
|
||||
"{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
|
||||
"Parcel Name",
|
||||
"Local ID",
|
||||
"Area",
|
||||
"Starts",
|
||||
"Ends",
|
||||
"Owner");
|
||||
|
||||
lock (m_landList)
|
||||
{
|
||||
foreach (ILandObject lo in m_landList.Values)
|
||||
{
|
||||
LandData ld = lo.LandData;
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
|
||||
ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID));
|
||||
}
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(report.ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -66,6 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
#region ILandObject Members
|
||||
|
||||
public int GetPrimsFree()
|
||||
{
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims;
|
||||
return free;
|
||||
}
|
||||
|
||||
public LandData LandData
|
||||
{
|
||||
get { return m_landData; }
|
||||
|
@ -78,6 +85,42 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
get { return m_scene.RegionInfo.RegionID; }
|
||||
}
|
||||
|
||||
public Vector3 StartPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int y = 0; y < landArrayMax; y++)
|
||||
{
|
||||
for (int x = 0; x < landArrayMax; x++)
|
||||
{
|
||||
if (LandBitmap[x, y])
|
||||
return new Vector3(x * 4, y * 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return new Vector3(-1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 EndPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int y = landArrayMax - 1; y >= 0; y--)
|
||||
{
|
||||
for (int x = landArrayMax - 1; x >= 0; x--)
|
||||
{
|
||||
if (LandBitmap[x, y])
|
||||
{
|
||||
return new Vector3(x * 4, y * 4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Vector3(-1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
|
||||
|
@ -105,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
/// <returns>Returns true if the piece of land contains the specified point</returns>
|
||||
public bool ContainsPoint(int x, int y)
|
||||
{
|
||||
if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize)
|
||||
if (x >= 0 && y >= 0 && x < Constants.RegionSize && y < Constants.RegionSize)
|
||||
{
|
||||
return (LandBitmap[x / 4, y / 4] == true);
|
||||
}
|
||||
|
@ -147,7 +190,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
// Normal Calculations
|
||||
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
int parcelMax = (int)(((float)LandData.Area / 65536.0f)
|
||||
* (float)m_scene.RegionInfo.ObjectCapacity
|
||||
* (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
// TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
|
||||
return parcelMax;
|
||||
}
|
||||
}
|
||||
public int GetSimulatorMaxPrimCount(ILandObject thisObject)
|
||||
|
@ -159,7 +206,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
//Normal Calculations
|
||||
return m_scene.RegionInfo.ObjectCapacity;
|
||||
int simMax = (int)(((float)LandData.SimwideArea / 65536.0f)
|
||||
* (float)m_scene.RegionInfo.ObjectCapacity);
|
||||
return simMax;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -333,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
newData.AuthBuyerID = UUID.Zero;
|
||||
newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
|
||||
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
|
||||
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
SendLandUpdateToAvatarsOverMe(true);
|
||||
}
|
||||
|
||||
|
@ -348,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
|
||||
|
||||
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
|
||||
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
SendLandUpdateToAvatarsOverMe(true);
|
||||
}
|
||||
|
||||
|
@ -414,6 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client)
|
||||
{
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
SendLandProperties(0, snap_selection, 0, remote_client);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,406 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
public class ParcelCounts
|
||||
{
|
||||
public int Owner = 0;
|
||||
public int Group = 0;
|
||||
public int Others = 0;
|
||||
public Dictionary <UUID, int> Users =
|
||||
new Dictionary <UUID, int>();
|
||||
}
|
||||
|
||||
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
private Dictionary<UUID, PrimCounts> m_PrimCounts =
|
||||
new Dictionary<UUID, PrimCounts>();
|
||||
private Dictionary<UUID, UUID> m_OwnerMap =
|
||||
new Dictionary<UUID, UUID>();
|
||||
private Dictionary<UUID, int> m_SimwideCounts =
|
||||
new Dictionary<UUID, int>();
|
||||
private Dictionary<UUID, ParcelCounts> m_ParcelCounts =
|
||||
new Dictionary<UUID, ParcelCounts>();
|
||||
|
||||
// For now, a simple simwide taint to get this up. Later parcel based
|
||||
// taint to allow recounting a parcel if only ownership has changed
|
||||
// without recounting the whole sim.
|
||||
private bool m_Tainted = true;
|
||||
private Object m_TaintLock = new Object();
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
|
||||
m_Scene.EventManager.OnParcelPrimCountAdd +=
|
||||
OnParcelPrimCountAdd;
|
||||
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
|
||||
OnObjectBeingRemovedFromScene;
|
||||
m_Scene.EventManager.OnParcelPrimCountTainted +=
|
||||
OnParcelPrimCountTainted;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "PrimCountModule"; }
|
||||
}
|
||||
|
||||
private void OnParcelPrimCountAdd(SceneObjectGroup obj)
|
||||
{
|
||||
// If we're tainted already, don't bother to add. The next
|
||||
// access will cause a recount anyway
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (!m_Tainted)
|
||||
AddObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnObjectBeingRemovedFromScene(SceneObjectGroup obj)
|
||||
{
|
||||
// Don't bother to update tainted counts
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (!m_Tainted)
|
||||
RemoveObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnParcelPrimCountTainted()
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
m_Tainted = true;
|
||||
}
|
||||
|
||||
public void TaintPrimCount(ILandObject land)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
m_Tainted = true;
|
||||
}
|
||||
|
||||
public void TaintPrimCount(int x, int y)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
m_Tainted = true;
|
||||
}
|
||||
|
||||
public void TaintPrimCount()
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
m_Tainted = true;
|
||||
}
|
||||
|
||||
// NOTE: Call under Taint Lock
|
||||
private void AddObject(SceneObjectGroup obj)
|
||||
{
|
||||
if (obj.IsAttachment)
|
||||
return;
|
||||
if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
|
||||
return;
|
||||
|
||||
Vector3 pos = obj.AbsolutePosition;
|
||||
ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||
LandData landData = landObject.LandData;
|
||||
|
||||
ParcelCounts parcelCounts;
|
||||
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
|
||||
{
|
||||
UUID landOwner = landData.OwnerID;
|
||||
int partCount = obj.Parts.Length;
|
||||
|
||||
m_SimwideCounts[landOwner] += partCount;
|
||||
if (parcelCounts.Users.ContainsKey(obj.OwnerID))
|
||||
parcelCounts.Users[obj.OwnerID] += partCount;
|
||||
else
|
||||
parcelCounts.Users[obj.OwnerID] = partCount;
|
||||
|
||||
if (landData.IsGroupOwned)
|
||||
{
|
||||
if (obj.OwnerID == landData.GroupID)
|
||||
parcelCounts.Owner += partCount;
|
||||
else if (obj.GroupID == landData.GroupID)
|
||||
parcelCounts.Group += partCount;
|
||||
else
|
||||
parcelCounts.Others += partCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj.OwnerID == landData.OwnerID)
|
||||
parcelCounts.Owner += partCount;
|
||||
else if (obj.GroupID == landData.GroupID)
|
||||
parcelCounts.Group += partCount;
|
||||
else
|
||||
parcelCounts.Others += partCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Call under Taint Lock
|
||||
private void RemoveObject(SceneObjectGroup obj)
|
||||
{
|
||||
}
|
||||
|
||||
public IPrimCounts GetPrimCounts(UUID parcelID)
|
||||
{
|
||||
PrimCounts primCounts;
|
||||
|
||||
lock (m_PrimCounts)
|
||||
{
|
||||
if (m_PrimCounts.TryGetValue(parcelID, out primCounts))
|
||||
return primCounts;
|
||||
|
||||
primCounts = new PrimCounts(parcelID, this);
|
||||
m_PrimCounts[parcelID] = primCounts;
|
||||
}
|
||||
return primCounts;
|
||||
}
|
||||
|
||||
public int GetOwnerCount(UUID parcelID)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (m_Tainted)
|
||||
Recount();
|
||||
|
||||
ParcelCounts counts;
|
||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||
return counts.Owner;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetGroupCount(UUID parcelID)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (m_Tainted)
|
||||
Recount();
|
||||
|
||||
ParcelCounts counts;
|
||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||
return counts.Group;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetOthersCount(UUID parcelID)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (m_Tainted)
|
||||
Recount();
|
||||
|
||||
ParcelCounts counts;
|
||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||
return counts.Others;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetSimulatorCount(UUID parcelID)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (m_Tainted)
|
||||
Recount();
|
||||
|
||||
UUID owner;
|
||||
if (m_OwnerMap.TryGetValue(parcelID, out owner))
|
||||
{
|
||||
int val;
|
||||
if (m_SimwideCounts.TryGetValue(owner, out val))
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetUserCount(UUID parcelID, UUID userID)
|
||||
{
|
||||
lock (m_TaintLock)
|
||||
{
|
||||
if (m_Tainted)
|
||||
Recount();
|
||||
|
||||
ParcelCounts counts;
|
||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||
{
|
||||
int val;
|
||||
if (counts.Users.TryGetValue(userID, out val))
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: This method MUST be called while holding the taint lock!
|
||||
private void Recount()
|
||||
{
|
||||
m_OwnerMap.Clear();
|
||||
m_SimwideCounts.Clear();
|
||||
m_ParcelCounts.Clear();
|
||||
|
||||
List<ILandObject> land = m_Scene.LandChannel.AllParcels();
|
||||
|
||||
foreach (ILandObject l in land)
|
||||
{
|
||||
LandData landData = l.LandData;
|
||||
|
||||
m_OwnerMap[landData.GlobalID] = landData.OwnerID;
|
||||
m_SimwideCounts[landData.OwnerID] = 0;
|
||||
m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
|
||||
}
|
||||
|
||||
m_Scene.ForEachSOG(AddObject);
|
||||
|
||||
List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
|
||||
foreach (UUID k in primcountKeys)
|
||||
{
|
||||
if (!m_OwnerMap.ContainsKey(k))
|
||||
m_PrimCounts.Remove(k);
|
||||
}
|
||||
m_Tainted = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class PrimCounts : IPrimCounts
|
||||
{
|
||||
private PrimCountModule m_Parent;
|
||||
private UUID m_ParcelID;
|
||||
private UserPrimCounts m_UserPrimCounts;
|
||||
|
||||
public PrimCounts (UUID parcelID, PrimCountModule parent)
|
||||
{
|
||||
m_ParcelID = parcelID;
|
||||
m_Parent = parent;
|
||||
|
||||
m_UserPrimCounts = new UserPrimCounts(this);
|
||||
}
|
||||
|
||||
public int Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent.GetOwnerCount(m_ParcelID);
|
||||
}
|
||||
}
|
||||
|
||||
public int Group
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent.GetGroupCount(m_ParcelID);
|
||||
}
|
||||
}
|
||||
|
||||
public int Others
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent.GetOthersCount(m_ParcelID);
|
||||
}
|
||||
}
|
||||
|
||||
public int Simulator
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent.GetSimulatorCount(m_ParcelID);
|
||||
}
|
||||
}
|
||||
|
||||
public IUserPrimCounts Users
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UserPrimCounts;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetUserCount(UUID userID)
|
||||
{
|
||||
return m_Parent.GetUserCount(m_ParcelID, userID);
|
||||
}
|
||||
}
|
||||
|
||||
public class UserPrimCounts : IUserPrimCounts
|
||||
{
|
||||
private PrimCounts m_Parent;
|
||||
|
||||
public UserPrimCounts(PrimCounts parent)
|
||||
{
|
||||
m_Parent = parent;
|
||||
}
|
||||
|
||||
public int this[UUID userID]
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent.GetUserCount(userID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,8 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Region
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RestartModule")]
|
||||
public class RestartModule : INonSharedRegionModule, IRestartModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Scene m_Scene;
|
||||
protected Timer m_CountdownTimer = null;
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
{
|
||||
|
@ -53,17 +54,120 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
return retval;
|
||||
}
|
||||
|
||||
public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
|
||||
{
|
||||
TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
|
||||
|
||||
FileInfo file = new FileInfo(filename);
|
||||
FileStream s = file.Open(FileMode.Open, FileAccess.Read);
|
||||
BinaryReader bs = new BinaryReader(s);
|
||||
|
||||
bool eof = false;
|
||||
|
||||
int fileXPoints = 0;
|
||||
int fileYPoints = 0;
|
||||
|
||||
// Terragen file
|
||||
while (eof == false)
|
||||
{
|
||||
string tmp = Encoding.ASCII.GetString(bs.ReadBytes(4));
|
||||
switch (tmp)
|
||||
{
|
||||
case "SIZE":
|
||||
fileXPoints = bs.ReadInt16() + 1;
|
||||
fileYPoints = fileXPoints;
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "XPTS":
|
||||
fileXPoints = bs.ReadInt16();
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "YPTS":
|
||||
fileYPoints = bs.ReadInt16();
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "ALTW":
|
||||
eof = true;
|
||||
Int16 heightScale = bs.ReadInt16();
|
||||
Int16 baseHeight = bs.ReadInt16();
|
||||
|
||||
int currFileYOffset = 0;
|
||||
|
||||
// if our region isn't on the first X section of the areas to be landscaped, then
|
||||
// advance to our section of the file
|
||||
while (currFileYOffset < offsetY)
|
||||
{
|
||||
// read a whole strip of regions
|
||||
int heightsToRead = sectionHeight * fileXPoints;
|
||||
bs.ReadBytes(heightsToRead * 2); // because the shorts are 2 bytes in the file
|
||||
currFileYOffset++;
|
||||
}
|
||||
|
||||
for (int y = 0; y < sectionHeight; y++)
|
||||
{
|
||||
int currFileXOffset = 0;
|
||||
|
||||
// if our region isn't the first X section of the areas to be landscaped, then
|
||||
// advance the stream to the X start pos of our section in the file
|
||||
// i.e. eat X upto where we start
|
||||
while (currFileXOffset < offsetX)
|
||||
{
|
||||
bs.ReadBytes(sectionWidth * 2); // 2 bytes = short
|
||||
currFileXOffset++;
|
||||
}
|
||||
|
||||
// got to our X offset, so write our regions X line
|
||||
for (int x = 0; x < sectionWidth; x++)
|
||||
{
|
||||
// Read a strip and continue
|
||||
retval[x, y] = baseHeight + bs.ReadInt16() * (double)heightScale / 65536.0;
|
||||
}
|
||||
// record that we wrote it
|
||||
currFileXOffset++;
|
||||
|
||||
// if our region isn't the last X section of the areas to be landscaped, then
|
||||
// advance the stream to the end of this Y column
|
||||
while (currFileXOffset < fileWidth)
|
||||
{
|
||||
// eat the next regions x line
|
||||
bs.ReadBytes(sectionWidth * 2); // 2 bytes = short
|
||||
currFileXOffset++;
|
||||
}
|
||||
//eat the last additional point
|
||||
bs.ReadInt16();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
bs.ReadInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bs.Close();
|
||||
s.Close();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public ITerrainChannel LoadStream(Stream s)
|
||||
{
|
||||
TerrainChannel retval = new TerrainChannel();
|
||||
|
||||
int w = (int)Constants.RegionSize;
|
||||
int h = (int)Constants.RegionSize;
|
||||
|
||||
TerrainChannel retval = new TerrainChannel(w, h);
|
||||
|
||||
BinaryReader bs = new BinaryReader(s);
|
||||
|
||||
bool eof = false;
|
||||
if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
|
||||
{
|
||||
int w = 256;
|
||||
int h = 256;
|
||||
|
||||
int fileWidth = w;
|
||||
int fileHeight = h;
|
||||
|
||||
|
||||
// Terragen file
|
||||
while (eof == false)
|
||||
|
@ -73,30 +177,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
{
|
||||
case "SIZE":
|
||||
int sztmp = bs.ReadInt16() + 1;
|
||||
w = sztmp;
|
||||
h = sztmp;
|
||||
fileWidth = sztmp;
|
||||
fileHeight = sztmp;
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "XPTS":
|
||||
w = bs.ReadInt16();
|
||||
fileWidth = bs.ReadInt16();
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "YPTS":
|
||||
h = bs.ReadInt16();
|
||||
fileHeight = bs.ReadInt16();
|
||||
bs.ReadInt16();
|
||||
break;
|
||||
case "ALTW":
|
||||
eof = true;
|
||||
Int16 heightScale = bs.ReadInt16();
|
||||
Int16 baseHeight = bs.ReadInt16();
|
||||
retval = new TerrainChannel(w, h);
|
||||
int x;
|
||||
for (x = 0; x < w; x++)
|
||||
for (int y = 0; y < h; y++)
|
||||
{
|
||||
int y;
|
||||
for (y = 0; y < h; y++)
|
||||
for (int x = 0; x < w; x++)
|
||||
{
|
||||
retval[x, y] = baseHeight + bs.ReadInt16() * (double) heightScale / 65536.0;
|
||||
retval[x, y] = baseHeight + bs.ReadInt16() * (double)heightScale / 65536.0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -114,12 +215,92 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
|
||||
public void SaveFile(string filename, ITerrainChannel map)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
FileInfo file = new FileInfo(filename);
|
||||
FileStream s = file.Open(FileMode.Create, FileAccess.Write);
|
||||
SaveStream(s, map);
|
||||
|
||||
s.Close();
|
||||
}
|
||||
|
||||
public void SaveStream(Stream stream, ITerrainChannel map)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
BinaryWriter bs = new BinaryWriter(stream);
|
||||
|
||||
//find the max and min heights on the map
|
||||
double heightMax = map[0,0];
|
||||
double heightMin = map[0,0];
|
||||
|
||||
for (int y = 0; y < map.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < map.Width; x++)
|
||||
{
|
||||
double current = map[x,y];
|
||||
if (heightMax < current)
|
||||
heightMax = current;
|
||||
if (heightMin > current)
|
||||
heightMin = current;
|
||||
}
|
||||
}
|
||||
|
||||
double baseHeight = Math.Floor( (heightMax + heightMin) / 2d );
|
||||
|
||||
double horizontalScale = Math.Ceiling((heightMax - heightMin));
|
||||
|
||||
// if we are completely flat add 1cm range to avoid NaN divisions
|
||||
if (horizontalScale < 0.01d)
|
||||
horizontalScale = 0.01d;
|
||||
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
|
||||
bs.Write(enc.GetBytes("TERRAGENTERRAIN "));
|
||||
|
||||
bs.Write(enc.GetBytes("SIZE"));
|
||||
bs.Write(Convert.ToInt16(Constants.RegionSize));
|
||||
bs.Write(Convert.ToInt16(0)); // necessary padding
|
||||
|
||||
//The XPTS and YPTS chunks are not needed for square regions
|
||||
//but L3DT won't load the terrain file properly without them.
|
||||
bs.Write(enc.GetBytes("XPTS"));
|
||||
bs.Write(Convert.ToInt16(Constants.RegionSize));
|
||||
bs.Write(Convert.ToInt16(0)); // necessary padding
|
||||
|
||||
bs.Write(enc.GetBytes("YPTS"));
|
||||
bs.Write(Convert.ToInt16(Constants.RegionSize));
|
||||
bs.Write(Convert.ToInt16(0)); // necessary padding
|
||||
|
||||
bs.Write(enc.GetBytes("SCAL"));
|
||||
bs.Write(ToLittleEndian(1f)); //we're going to say that 1 terrain unit is 1 metre
|
||||
bs.Write(ToLittleEndian(1f));
|
||||
bs.Write(ToLittleEndian(1f));
|
||||
|
||||
// as we are square and not projected on a sphere then the other
|
||||
// header blocks are not required
|
||||
|
||||
// now write the elevation data
|
||||
bs.Write(enc.GetBytes("ALTW"));
|
||||
bs.Write(Convert.ToInt16(horizontalScale)); // range between max and min
|
||||
bs.Write(Convert.ToInt16(baseHeight)); // base height or mid point
|
||||
|
||||
for (int y = 0; y < map.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < map.Width; x++)
|
||||
{
|
||||
float elevation = (float)((map[x,y] - baseHeight) * 65536 ) / (float)horizontalScale; // see LoadStream for inverse
|
||||
|
||||
// clamp rounding issues
|
||||
if (elevation > Int16.MaxValue)
|
||||
elevation = Int16.MaxValue;
|
||||
else if (elevation < Int16.MinValue)
|
||||
elevation = Int16.MinValue;
|
||||
|
||||
bs.Write(Convert.ToInt16(elevation));
|
||||
}
|
||||
}
|
||||
|
||||
//This is only necessary for older versions of Terragen.
|
||||
bs.Write(enc.GetBytes("EOF "));
|
||||
|
||||
bs.Close();
|
||||
}
|
||||
|
||||
public string FileExtension
|
||||
|
@ -127,16 +308,34 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
get { return ".ter"; }
|
||||
}
|
||||
|
||||
public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Terragen";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// terragen SCAL floats need to be written intel ordered regardless of
|
||||
/// big or little endian system
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] ToLittleEndian( float number)
|
||||
{
|
||||
byte[] retVal = BitConverter.GetBytes(number);
|
||||
if (BitConverter.IsLittleEndian == false)
|
||||
{
|
||||
byte[] tmp = new byte[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
tmp[i] = retVal[3 - i];
|
||||
}
|
||||
retVal = tmp;
|
||||
|
||||
}
|
||||
return retVal ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
|
||||
InstallInterfaces();
|
||||
}
|
||||
|
||||
InstallDefaultEffects();
|
||||
|
@ -140,6 +139,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
//Do this here to give file loaders time to initialize and
|
||||
//register their supported file extensions and file formats.
|
||||
InstallInterfaces();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
@ -1154,8 +1156,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
{
|
||||
// Load / Save
|
||||
string supportedFileExtensions = "";
|
||||
string supportedFilesSeparator = "";
|
||||
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
|
||||
supportedFileExtensions += " " + loader.Key + " (" + loader.Value + ")";
|
||||
{
|
||||
supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
|
||||
supportedFilesSeparator = ", ";
|
||||
}
|
||||
|
||||
Command loadFromFileCommand =
|
||||
new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file.");
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
void TeleportHome(UUID id, IClientAPI client);
|
||||
|
||||
void Cross(ScenePresence agent, bool isFlying);
|
||||
bool Cross(ScenePresence agent, bool isFlying);
|
||||
|
||||
void AgentArrivedAtDestination(UUID agent);
|
||||
|
||||
|
|
|
@ -69,6 +69,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <returns></returns>
|
||||
ILandObject GetLandObject(int localID);
|
||||
|
||||
/// <summary>
|
||||
/// Clear the land channel of all parcels.
|
||||
/// </summary>
|
||||
/// <param name="setupDefaultParcel">
|
||||
/// If true, set up a default parcel covering the whole region owned by the estate owner.
|
||||
/// </param>
|
||||
void Clear(bool setupDefaultParcel);
|
||||
|
||||
bool IsLandPrimCountTainted();
|
||||
bool IsForcefulBansAllowed();
|
||||
void UpdateLandObject(int localID, LandData data);
|
||||
|
|
|
@ -39,11 +39,26 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
int GetParcelMaxPrimCount(ILandObject thisObject);
|
||||
int GetSimulatorMaxPrimCount(ILandObject thisObject);
|
||||
int GetPrimsFree();
|
||||
|
||||
LandData LandData { get; set; }
|
||||
bool[,] LandBitmap { get; set; }
|
||||
UUID RegionUUID { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The start point for the land object. This is the western-most point as one scans land working from
|
||||
/// north to south.
|
||||
/// </summary>
|
||||
Vector3 StartPoint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The end point for the land object. This is the eastern-most point as one scans land working from
|
||||
/// south to north.
|
||||
/// </summary>
|
||||
Vector3 EndPoint { get; }
|
||||
|
||||
bool ContainsPoint(int x, int y);
|
||||
|
||||
ILandObject Copy();
|
||||
|
||||
void SendLandUpdateToAvatarsOverMe();
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IPrimCountModule
|
||||
{
|
||||
void TaintPrimCount(ILandObject land);
|
||||
void TaintPrimCount(int x, int y);
|
||||
void TaintPrimCount();
|
||||
|
||||
IPrimCounts GetPrimCounts(UUID parcelID);
|
||||
}
|
||||
|
||||
public interface IPrimCounts
|
||||
{
|
||||
int Owner { get; }
|
||||
int Group { get; }
|
||||
int Others { get; }
|
||||
int Simulator { get; }
|
||||
IUserPrimCounts Users { get; }
|
||||
}
|
||||
|
||||
public interface IUserPrimCounts
|
||||
{
|
||||
int this[UUID agentID] { get; }
|
||||
}
|
||||
}
|
|
@ -904,12 +904,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return m_sceneGraph.Entities; }
|
||||
}
|
||||
|
||||
public Dictionary<UUID, ScenePresence> m_restorePresences
|
||||
{
|
||||
get { return m_sceneGraph.RestorePresences; }
|
||||
set { m_sceneGraph.RestorePresences = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Constructors
|
||||
|
@ -3034,25 +3028,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
CheckHeartbeat();
|
||||
ScenePresence presence;
|
||||
|
||||
if (m_restorePresences.ContainsKey(client.AgentId))
|
||||
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
||||
{
|
||||
m_log.DebugFormat("[SCENE ({0})]: Restoring agent {1} ({2})", m_regionName, client.Name, client.AgentId);
|
||||
|
||||
m_clientManager.Add(client);
|
||||
SubscribeToClientEvents(client);
|
||||
|
||||
presence = m_restorePresences[client.AgentId];
|
||||
m_restorePresences.Remove(client.AgentId);
|
||||
|
||||
// This is one of two paths to create avatars that are
|
||||
// used. This tends to get called more in standalone
|
||||
// than grid, not really sure why, but as such needs
|
||||
// an explicity appearance lookup here.
|
||||
AvatarAppearance appearance = null;
|
||||
GetAvatarAppearance(client, out appearance);
|
||||
presence.Appearance = appearance;
|
||||
ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
|
||||
m_eventManager.TriggerOnNewPresence(sp);
|
||||
|
||||
// REGION SYNC
|
||||
// The owner is not being set properly when there is no circuit. Hmmm
|
||||
|
@ -3060,10 +3045,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// presence.Appearance.Owner = presence.UUID;
|
||||
|
||||
presence.initializeScenePresence(client, RegionInfo, this);
|
||||
sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
|
||||
|
||||
m_sceneGraph.AddScenePresence(presence);
|
||||
|
||||
lock (m_restorePresences)
|
||||
// HERE!!! Do the initial attachments right here
|
||||
// first agent upon login is a root agent by design.
|
||||
// All other AddNewClient calls find aCircuit.child to be true
|
||||
if (aCircuit.child == false)
|
||||
{
|
||||
Monitor.PulseAll(m_restorePresences);
|
||||
}
|
||||
|
@ -3556,25 +3543,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a child agent scene presence and add it to this scene.
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <returns></returns>
|
||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
||||
{
|
||||
CheckHeartbeat();
|
||||
AvatarAppearance appearance = null;
|
||||
GetAvatarAppearance(client, out appearance);
|
||||
|
||||
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
|
||||
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
|
||||
|
||||
m_eventManager.TriggerOnNewPresence(avatar);
|
||||
|
||||
return avatar;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the avatar apperance for the given client.
|
||||
/// </summary>
|
||||
|
@ -3910,6 +3878,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
// Let the SP know how we got here. This has a lot of interesting
|
||||
// uses down the line.
|
||||
sp.TeleportFlags = (TeleportFlags)teleportFlags;
|
||||
|
||||
if (sp.IsChildAgent)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
|
@ -4498,14 +4470,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark));
|
||||
}
|
||||
|
||||
public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
||||
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
if (m_teleportModule != null)
|
||||
m_teleportModule.Cross(agent, isFlying);
|
||||
return m_teleportModule.Cross(agent, isFlying);
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
|
||||
|
@ -5563,7 +5537,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// from logging into the region, teleporting into the region
|
||||
// or corssing the broder walking, but will NOT prevent
|
||||
// child agent creation, thereby emulating the SL behavior.
|
||||
public bool QueryAccess(UUID agentID)
|
||||
public bool QueryAccess(UUID agentID, Vector3 position)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
|
||||
|
||||
protected internal EntityManager Entities = new EntityManager();
|
||||
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
|
||||
|
||||
protected RegionInfo m_regInfo;
|
||||
protected Scene m_parentScene;
|
||||
|
@ -585,8 +584,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
ScenePresence newAvatar = null;
|
||||
|
||||
// ScenePresence always defaults to child agent
|
||||
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
|
||||
newAvatar.IsChildAgent = true;
|
||||
|
||||
AddScenePresence(newAvatar);
|
||||
|
||||
|
@ -599,6 +598,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="presence"></param>
|
||||
protected internal void AddScenePresence(ScenePresence presence)
|
||||
{
|
||||
// Always a child when added to the scene
|
||||
bool child = presence.IsChildAgent;
|
||||
|
||||
if (child)
|
||||
|
|
|
@ -133,6 +133,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private bool m_updateflag;
|
||||
private byte m_movementflag;
|
||||
private Vector3? m_forceToApply;
|
||||
private TeleportFlags m_teleportFlags;
|
||||
public TeleportFlags TeleportFlags
|
||||
{
|
||||
get { return m_teleportFlags; }
|
||||
set { m_teleportFlags = value; }
|
||||
}
|
||||
|
||||
private uint m_requestedSitTargetID;
|
||||
private UUID m_requestedSitTargetUUID;
|
||||
public bool SitGround = false;
|
||||
|
@ -990,6 +997,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void MakeChildAgent()
|
||||
{
|
||||
// Reset these so that teleporting in and walking out isn't seen
|
||||
// as teleporting back
|
||||
m_teleportFlags = TeleportFlags.Default;
|
||||
|
||||
// It looks like m_animator is set to null somewhere, and MakeChild
|
||||
// is called after that. Probably in aborted teleports.
|
||||
if (m_animator == null)
|
||||
|
@ -2819,29 +2830,57 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Makes sure avatar does not end up outside region
|
||||
if (neighbor <= 0)
|
||||
{
|
||||
if (!needsTransit)
|
||||
if (needsTransit)
|
||||
{
|
||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||
{
|
||||
bool isFlying = m_physicsActor.Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
|
||||
Vector3 pos = AbsolutePosition;
|
||||
if (AbsolutePosition.X < 0)
|
||||
pos.X += Velocity.X;
|
||||
pos.X += Velocity.X * 2;
|
||||
else if (AbsolutePosition.X > Constants.RegionSize)
|
||||
pos.X -= Velocity.X;
|
||||
pos.X -= Velocity.X * 2;
|
||||
if (AbsolutePosition.Y < 0)
|
||||
pos.Y += Velocity.Y;
|
||||
pos.Y += Velocity.Y * 2;
|
||||
else if (AbsolutePosition.Y > Constants.RegionSize)
|
||||
pos.Y -= Velocity.Y;
|
||||
pos.Y -= Velocity.Y * 2;
|
||||
Velocity = Vector3.Zero;
|
||||
AbsolutePosition = pos;
|
||||
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (neighbor > 0)
|
||||
CrossToNewRegion();
|
||||
{
|
||||
if (!CrossToNewRegion())
|
||||
{
|
||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||
{
|
||||
bool isFlying = m_physicsActor.Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
|
||||
Vector3 pos = AbsolutePosition;
|
||||
if (AbsolutePosition.X < 0)
|
||||
pos.X += Velocity.X * 2;
|
||||
else if (AbsolutePosition.X > Constants.RegionSize)
|
||||
pos.X -= Velocity.X * 2;
|
||||
if (AbsolutePosition.Y < 0)
|
||||
pos.Y += Velocity.Y * 2;
|
||||
else if (AbsolutePosition.Y > Constants.RegionSize)
|
||||
pos.Y -= Velocity.Y * 2;
|
||||
Velocity = Vector3.Zero;
|
||||
AbsolutePosition = pos;
|
||||
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveFromPhysicalScene();
|
||||
// This constant has been inferred from experimentation
|
||||
// I'm not sure what this value should be, so I tried a few values.
|
||||
timeStep = 0.04f;
|
||||
|
@ -2890,16 +2929,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// If the neighbor accepts, remove the agent's viewable avatar from this scene
|
||||
/// set them to a child agent.
|
||||
/// </summary>
|
||||
protected void CrossToNewRegion()
|
||||
protected bool CrossToNewRegion()
|
||||
{
|
||||
InTransit();
|
||||
try
|
||||
{
|
||||
m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
|
||||
return m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_scene.CrossAgentToNewRegion(this, false);
|
||||
return m_scene.CrossAgentToNewRegion(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,11 @@ public class RegionCombinerLargeLandChannel : ILandChannel
|
|||
return RootRegionLandChannel.AllParcels();
|
||||
}
|
||||
|
||||
public void Clear(bool setupDefaultParcel)
|
||||
{
|
||||
RootRegionLandChannel.Clear(setupDefaultParcel);
|
||||
}
|
||||
|
||||
public ILandObject GetLandObject(int x, int y)
|
||||
{
|
||||
//m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
|
||||
|
|
|
@ -702,7 +702,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
// and convert the regionName to the target region
|
||||
if (regionName.Contains(".") && regionName.Contains(":"))
|
||||
{
|
||||
List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
|
||||
// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
|
||||
string[] parts = regionName.Split(new char[] { ':' });
|
||||
if (parts.Length > 2)
|
||||
regionName = parts[0] + ':' + parts[1] + "/ " + parts[2];
|
||||
|
|
|
@ -326,10 +326,17 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
|
||||
OSDMap args = Utils.GetOSDMap((string)request["body"]);
|
||||
|
||||
Vector3 position = Vector3.Zero;
|
||||
if (args.ContainsKey("position"))
|
||||
position = Vector3.Parse(args["position"].AsString());
|
||||
|
||||
GridRegion destination = new GridRegion();
|
||||
destination.RegionID = regionID;
|
||||
|
||||
bool result = m_SimulationService.QueryAccess(destination, id);
|
||||
bool result = m_SimulationService.QueryAccess(destination, id, position);
|
||||
|
||||
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||
responsedata["str_response_string"] = result.ToString();
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -205,9 +206,9 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public bool QueryAccess(GridRegion destination, UUID id)
|
||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
|
||||
{
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start");
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
|
||||
|
||||
IPEndPoint ext = destination.ExternalEndPoint;
|
||||
if (ext == null) return false;
|
||||
|
@ -215,10 +216,26 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||
|
||||
OSDMap request = new OSDMap();
|
||||
request.Add("position", OSD.FromString(position.ToString()));
|
||||
|
||||
try
|
||||
{
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"QUERYACCESS",10000);
|
||||
return result["Success"].AsBoolean();
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
|
||||
bool success = result["Success"].AsBoolean();
|
||||
if (!success)
|
||||
{
|
||||
if (result.ContainsKey("Message"))
|
||||
{
|
||||
string message = result["Message"].AsString();
|
||||
if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
|
||||
{
|
||||
m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
||||
|
||||
bool QueryAccess(GridRegion destination, UUID id);
|
||||
bool QueryAccess(GridRegion destination, UUID id, Vector3 position);
|
||||
|
||||
/// <summary>
|
||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||
|
|
|
@ -320,7 +320,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
Vector3 position = Vector3.Zero;
|
||||
Vector3 lookAt = Vector3.Zero;
|
||||
GridRegion gatekeeper = null;
|
||||
GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt);
|
||||
TeleportFlags flags;
|
||||
GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt, out flags);
|
||||
if (destination == null)
|
||||
{
|
||||
m_PresenceService.LogoutAgent(session);
|
||||
|
@ -328,6 +329,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
return LLFailedLoginResponse.GridProblem;
|
||||
}
|
||||
|
||||
if (account.UserLevel >= 200)
|
||||
flags |= TeleportFlags.Godlike;
|
||||
//
|
||||
// Get the avatar
|
||||
//
|
||||
|
@ -343,7 +346,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
string reason = string.Empty;
|
||||
GridRegion dest;
|
||||
AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where,
|
||||
clientVersion, channel, mac, id0, clientIP, out where, out reason, out dest);
|
||||
clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest);
|
||||
destination = dest;
|
||||
if (aCircuit == null)
|
||||
{
|
||||
|
@ -378,8 +381,10 @@ namespace OpenSim.Services.LLLoginService
|
|||
}
|
||||
}
|
||||
|
||||
protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt)
|
||||
protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
|
||||
{
|
||||
flags = TeleportFlags.ViaLogin;
|
||||
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation);
|
||||
|
||||
gatekeeper = null;
|
||||
|
@ -473,6 +478,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
}
|
||||
else
|
||||
{
|
||||
flags |= TeleportFlags.ViaRegionID;
|
||||
|
||||
// free uri form
|
||||
// e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34
|
||||
where = "url";
|
||||
|
@ -624,7 +631,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar,
|
||||
UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0,
|
||||
IPEndPoint clientIP, out string where, out string reason, out GridRegion dest)
|
||||
IPEndPoint clientIP, TeleportFlags flags, out string where, out string reason, out GridRegion dest)
|
||||
{
|
||||
where = currentWhere;
|
||||
ISimulationService simConnector = null;
|
||||
|
@ -663,7 +670,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
{
|
||||
circuitCode = (uint)Util.RandomClass.Next(); ;
|
||||
aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
|
||||
success = LaunchAgentDirectly(simConnector, destination, aCircuit, out reason);
|
||||
success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason);
|
||||
if (!success && m_GridService != null)
|
||||
{
|
||||
// Try the fallback regions
|
||||
|
@ -672,7 +679,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
{
|
||||
foreach (GridRegion r in fallbacks)
|
||||
{
|
||||
success = LaunchAgentDirectly(simConnector, r, aCircuit, out reason);
|
||||
success = LaunchAgentDirectly(simConnector, r, aCircuit, flags | TeleportFlags.ViaRegionID, out reason);
|
||||
if (success)
|
||||
{
|
||||
where = "safe";
|
||||
|
@ -795,9 +802,9 @@ namespace OpenSim.Services.LLLoginService
|
|||
|
||||
}
|
||||
|
||||
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason)
|
||||
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
|
||||
{
|
||||
return simConnector.CreateAgent(region, aCircuit, (int)Constants.TeleportFlags.ViaLogin, out reason);
|
||||
return simConnector.CreateAgent(region, aCircuit, (uint)flags, out reason);
|
||||
}
|
||||
|
||||
private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace OpenSim.Tests.Common.Mock
|
|||
return new List<ILandObject>();
|
||||
}
|
||||
|
||||
public void Clear(bool setupDefaultParcel)
|
||||
{
|
||||
// Intentionally blank since we don't save any parcel data in the test channel
|
||||
}
|
||||
|
||||
protected ILandObject GetNoLand()
|
||||
{
|
||||
ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
|
||||
|
|
|
@ -1186,6 +1186,11 @@
|
|||
; This makes the Groups modules very chatty on the console.
|
||||
DebugEnabled = false
|
||||
|
||||
; Groups data is cached for this number of seconds before another request is made to the groups service
|
||||
; Set to 0 to disable the cache.
|
||||
; Default is 30 seconds
|
||||
GroupsCacheTimeout = 30
|
||||
|
||||
; Specify which messaging module to use for groups messaging and if it's enabled
|
||||
;MessagingModule = GroupsMessagingModule
|
||||
;MessagingEnabled = true
|
||||
|
|
Loading…
Reference in New Issue