mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -642,7 +642,7 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
{
|
||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||
|
||||
Dictionary<UUID, int> assets = new Dictionary<UUID, int>();
|
||||
Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>();
|
||||
foreach (Scene s in m_Scenes)
|
||||
{
|
||||
StampRegionStatusFile(s.RegionInfo.RegionID);
|
||||
|
||||
@@ -89,60 +89,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar)
|
||||
private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar)
|
||||
{
|
||||
string deadAvatarMessage;
|
||||
ScenePresence killingAvatar = null;
|
||||
string killingAvatarMessage;
|
||||
|
||||
if (killerObjectLocalID == 0)
|
||||
DeadAvatar.ControllingClient.SendAgentAlertMessage("You committed suicide!", true);
|
||||
deadAvatarMessage = "You committed suicide!";
|
||||
else
|
||||
{
|
||||
bool foundResult = false;
|
||||
string resultstring = String.Empty;
|
||||
ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
|
||||
try
|
||||
// Try to get the avatar responsible for the killing
|
||||
killingAvatar = deadAvatar.Scene.GetScenePresence(killerObjectLocalID);
|
||||
if (killingAvatar == null)
|
||||
{
|
||||
for (int i = 0; i < allav.Length; i++)
|
||||
// Try to get the object which was responsible for the killing
|
||||
SceneObjectPart part = deadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID);
|
||||
if (part == null)
|
||||
{
|
||||
ScenePresence av = allav[i];
|
||||
|
||||
if (av.LocalId == killerObjectLocalID)
|
||||
{
|
||||
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
||||
resultstring = av.Firstname + " " + av.Lastname;
|
||||
foundResult = true;
|
||||
}
|
||||
}
|
||||
} catch (InvalidOperationException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (!foundResult)
|
||||
{
|
||||
SceneObjectPart part = DeadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID);
|
||||
if (part != null)
|
||||
{
|
||||
ScenePresence av = DeadAvatar.Scene.GetScenePresence(part.OwnerID);
|
||||
if (av != null)
|
||||
{
|
||||
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
||||
resultstring = av.Firstname + " " + av.Lastname;
|
||||
DeadAvatar.ControllingClient.SendAgentAlertMessage("You got killed by " + resultstring + "!", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string killer = DeadAvatar.Scene.GetUserName(part.OwnerID);
|
||||
DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true);
|
||||
}
|
||||
//DeadAvatar.Scene. part.ObjectOwner
|
||||
// Cause of death: Unknown
|
||||
deadAvatarMessage = "You died!";
|
||||
}
|
||||
else
|
||||
{
|
||||
DeadAvatar.ControllingClient.SendAgentAlertMessage("You died!", true);
|
||||
// Try to find the avatar wielding the killing object
|
||||
killingAvatar = deadAvatar.Scene.GetScenePresence(part.OwnerID);
|
||||
if (killingAvatar == null)
|
||||
deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID));
|
||||
else
|
||||
{
|
||||
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
|
||||
}
|
||||
}
|
||||
DeadAvatar.Health = 100;
|
||||
DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient);
|
||||
try
|
||||
{
|
||||
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
|
||||
if(killingAvatar != null)
|
||||
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{ }
|
||||
|
||||
deadAvatar.Health = 100;
|
||||
deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
|
||||
}
|
||||
|
||||
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
|
||||
|
||||
@@ -87,31 +87,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
|
||||
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
||||
{
|
||||
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < presenceList.Length; i++)
|
||||
{
|
||||
ScenePresence presence = presenceList[i];
|
||||
|
||||
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
||||
{
|
||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
|
||||
if(presence != null)
|
||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
public void SendGeneralAlert(string message)
|
||||
{
|
||||
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < presenceList.Length; i++)
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
ScenePresence presence = presenceList[i];
|
||||
|
||||
if (!presence.IsChildAgent)
|
||||
presence.ControllingClient.SendAlertMessage(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SendDialogToUser(
|
||||
@@ -179,14 +166,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
public void SendNotificationToUsersInRegion(
|
||||
UUID fromAvatarID, string fromAvatarName, string message)
|
||||
{
|
||||
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < presences.Length; i++)
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
ScenePresence presence = presences[i];
|
||||
if (!presence.IsChildAgent)
|
||||
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// <value>
|
||||
/// Used to collect the uuids of the assets that we need to save into the archive
|
||||
/// </value>
|
||||
protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>();
|
||||
protected Dictionary<UUID, AssetType> m_assetUuids = new Dictionary<UUID, AssetType>();
|
||||
|
||||
/// <value>
|
||||
/// Used to collect the uuids of the users that we need to save into the archive
|
||||
@@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
}
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids,
|
||||
m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (asset != null)
|
||||
{
|
||||
// OK, now fetch the inside.
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||
if (asset != null)
|
||||
{
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
|
||||
@@ -285,24 +285,22 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] assetData;
|
||||
byte[] assetData = null;
|
||||
AssetBase oldAsset = null;
|
||||
|
||||
if (BlendWithOldTexture)
|
||||
{
|
||||
UUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID;
|
||||
oldAsset = scene.AssetService.Get(lastTextureID.ToString());
|
||||
if (oldAsset != null)
|
||||
Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
|
||||
if (defaultFace != null)
|
||||
{
|
||||
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
assetData = new byte[data.Length];
|
||||
Array.Copy(data, assetData, data.Length);
|
||||
oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());
|
||||
|
||||
if (oldAsset != null)
|
||||
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (assetData == null)
|
||||
{
|
||||
assetData = new byte[data.Length];
|
||||
Array.Copy(data, assetData, data.Length);
|
||||
|
||||
@@ -166,6 +166,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
return m_sceneList[0];
|
||||
}
|
||||
|
||||
public ISimulationService GetInnerService()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agent-related communications
|
||||
*/
|
||||
|
||||
@@ -156,6 +156,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
return m_localBackend.GetScene(handle);
|
||||
}
|
||||
|
||||
public ISimulationService GetInnerService()
|
||||
{
|
||||
return m_localBackend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agent-related communications
|
||||
*/
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
/// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
|
||||
public void ArchiveRegion()
|
||||
{
|
||||
Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>();
|
||||
Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
|
||||
|
||||
List<EntityBase> entities = m_scene.GetEntities();
|
||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||
@@ -142,18 +142,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
// Make sure that we also request terrain texture assets
|
||||
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
|
||||
|
||||
|
||||
if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
|
||||
assetUuids[regionSettings.TerrainTexture1] = 1;
|
||||
assetUuids[regionSettings.TerrainTexture1] = AssetType.Texture;
|
||||
|
||||
if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
|
||||
assetUuids[regionSettings.TerrainTexture2] = 1;
|
||||
assetUuids[regionSettings.TerrainTexture2] = AssetType.Texture;
|
||||
|
||||
if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
|
||||
assetUuids[regionSettings.TerrainTexture3] = 1;
|
||||
assetUuids[regionSettings.TerrainTexture3] = AssetType.Texture;
|
||||
|
||||
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
|
||||
assetUuids[regionSettings.TerrainTexture4] = 1;
|
||||
assetUuids[regionSettings.TerrainTexture4] = AssetType.Texture;
|
||||
|
||||
TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
m_requestId);
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(archiveWriter), assetUuids.Keys,
|
||||
new AssetsArchiver(archiveWriter), assetUuids,
|
||||
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
/// <value>
|
||||
/// uuids to request
|
||||
/// </value>
|
||||
protected ICollection<UUID> m_uuids;
|
||||
protected IDictionary<UUID, AssetType> m_uuids;
|
||||
|
||||
/// <value>
|
||||
/// Callback used when all the assets requested have been received.
|
||||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
protected AssetsArchiver m_assetsArchiver;
|
||||
|
||||
protected internal AssetsRequest(
|
||||
AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
|
||||
AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
|
||||
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
|
||||
{
|
||||
m_assetsArchiver = assetsArchiver;
|
||||
@@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (UUID uuid in m_uuids)
|
||||
foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids)
|
||||
{
|
||||
m_assetService.Get(uuid.ToString(), this, AssetRequestCallback);
|
||||
m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
|
||||
}
|
||||
|
||||
m_requestCallbackTimer.Enabled = true;
|
||||
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
// Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
|
||||
// case anyway.
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
foreach (UUID uuid in m_uuids)
|
||||
foreach (UUID uuid in m_uuids.Keys)
|
||||
{
|
||||
uuids.Add(uuid);
|
||||
}
|
||||
@@ -200,6 +200,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
}
|
||||
}
|
||||
|
||||
protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset)
|
||||
{
|
||||
// Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
|
||||
if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
|
||||
{
|
||||
AssetType type = (AssetType)assetType;
|
||||
m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type);
|
||||
fetchedAsset.Type = (sbyte)type;
|
||||
}
|
||||
|
||||
AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called back by the asset cache when it has the asset
|
||||
/// </summary>
|
||||
|
||||
@@ -469,12 +469,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
||||
{
|
||||
// Get a fresh list that will not change as people get teleported away
|
||||
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||
List<ScenePresence> presences = m_scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < presences.Length; i++)
|
||||
foreach(ScenePresence p in presences)
|
||||
{
|
||||
ScenePresence p = presences[i];
|
||||
|
||||
if (p.UUID != senderID)
|
||||
{
|
||||
// make sure they are still there, we could be working down a long list
|
||||
|
||||
@@ -1276,13 +1276,104 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
|
||||
private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
|
||||
{
|
||||
if (objects.Count == 0)
|
||||
return false;
|
||||
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return GenericObjectPermission(user, objects[0].UUID, false);
|
||||
GroupPowers powers;
|
||||
ILandObject l;
|
||||
|
||||
ScenePresence sp = scene.GetScenePresence(user);
|
||||
if (sp == null)
|
||||
return false;
|
||||
|
||||
IClientAPI client = sp.ControllingClient;
|
||||
|
||||
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
|
||||
{
|
||||
// Any user can return their own objects at any time
|
||||
//
|
||||
if (GenericObjectPermission(user, g.UUID, false))
|
||||
continue;
|
||||
|
||||
// This is a short cut for efficiency. If land is non-null,
|
||||
// then all objects are on that parcel and we can save
|
||||
// ourselves the checking for each prim. Much faster.
|
||||
//
|
||||
if (land != null)
|
||||
{
|
||||
l = land;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 pos = g.AbsolutePosition;
|
||||
|
||||
l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||
}
|
||||
|
||||
// If it's not over any land, then we can't do a thing
|
||||
if (l == null)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we own the land outright, then allow
|
||||
//
|
||||
if (l.LandData.OwnerID == user)
|
||||
continue;
|
||||
|
||||
// Group voodoo
|
||||
//
|
||||
if (land.LandData.IsGroupOwned)
|
||||
{
|
||||
powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID);
|
||||
// Not a group member, or no rights at all
|
||||
//
|
||||
if (powers == (GroupPowers)0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Group deeded object?
|
||||
//
|
||||
if (g.OwnerID == l.LandData.GroupID &&
|
||||
(powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Group set object?
|
||||
//
|
||||
if (g.GroupID == l.LandData.GroupID &&
|
||||
(powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
|
||||
{
|
||||
objects.Remove(g);
|
||||
continue;
|
||||
}
|
||||
|
||||
// So we can remove all objects from this group land.
|
||||
// Fine.
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
// By default, we can't remove
|
||||
//
|
||||
objects.Remove(g);
|
||||
}
|
||||
|
||||
if (objects.Count == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
|
||||
|
||||
@@ -251,13 +251,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
// if you want tree blocks on the map comment the above line and uncomment the below line
|
||||
//mapdotspot = Color.PaleGreen;
|
||||
|
||||
if (part.Shape.Textures == null)
|
||||
Primitive.TextureEntry textureEntry = part.Shape.Textures;
|
||||
|
||||
if (textureEntry == null || textureEntry.DefaultTexture == null)
|
||||
continue;
|
||||
|
||||
if (part.Shape.Textures.DefaultTexture == null)
|
||||
continue;
|
||||
|
||||
Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
|
||||
Color4 texcolor = textureEntry.DefaultTexture.RGBA;
|
||||
|
||||
// Not sure why some of these are null, oh well.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user