Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2011-07-05 03:13:39 +02:00
commit 719e0702be
27 changed files with 558 additions and 172 deletions

View File

@ -1,10 +1,39 @@
using System; /*
* 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Text;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Nini.Config; using Nini.Config;
using log4net; using log4net;
@ -12,11 +41,14 @@ using OpenSim.Framework;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps; using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
namespace OpenSim.Region.ClientStack.Linden namespace OpenSim.Region.ClientStack.Linden
{ {
@ -79,7 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden
private bool m_persistBakedTextures = false; private bool m_persistBakedTextures = false;
private IAssetService m_assetService; private IAssetService m_assetService;
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile = false;
private string m_regionName; private string m_regionName;
public BunchOfCaps(Scene scene, Caps caps) public BunchOfCaps(Scene scene, Caps caps)
@ -439,7 +471,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
/// <summary> /// <summary>
/// /// Convert raw uploaded data into the appropriate asset and item.
/// </summary> /// </summary>
/// <param name="assetID"></param> /// <param name="assetID"></param>
/// <param name="inventoryItem"></param> /// <param name="inventoryItem"></param>
@ -448,6 +480,10 @@ namespace OpenSim.Region.ClientStack.Linden
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
string assetType) string assetType)
{ {
m_log.DebugFormat(
"Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
assetID, inventoryItem, inventoryType, assetType);
sbyte assType = 0; sbyte assType = 0;
sbyte inType = 0; sbyte inType = 0;
@ -474,6 +510,156 @@ namespace OpenSim.Region.ClientStack.Linden
break; break;
} }
} }
else if (inventoryType == "object")
{
inType = (sbyte)InventoryType.Object;
assType = (sbyte)AssetType.Object;
List<Vector3> positions = new List<Vector3>();
List<Quaternion> rotations = new List<Quaternion>();
OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
OSDArray instance_list = (OSDArray)request["instance_list"];
OSDArray mesh_list = (OSDArray)request["mesh_list"];
OSDArray texture_list = (OSDArray)request["texture_list"];
SceneObjectGroup grp = null;
List<UUID> textures = new List<UUID>();
for (int i = 0; i < texture_list.Count; i++)
{
AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, "");
textureAsset.Data = texture_list[i].AsBinary();
m_assetService.Store(textureAsset);
textures.Add(textureAsset.FullID);
}
for (int i = 0; i < mesh_list.Count; i++)
{
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
Primitive.TextureEntry textureEntry
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
OSDMap inner_instance_list = (OSDMap)instance_list[i];
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
for (uint face = 0; face < face_list.Count; face++)
{
OSDMap faceMap = (OSDMap)face_list[(int)face];
Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
if(faceMap.ContainsKey("fullbright"))
f.Fullbright = faceMap["fullbright"].AsBoolean();
if (faceMap.ContainsKey ("diffuse_color"))
f.RGBA = faceMap["diffuse_color"].AsColor4();
int textureNum = faceMap["image"].AsInteger();
float imagerot = faceMap["imagerot"].AsInteger();
float offsets = (float)faceMap["offsets"].AsReal();
float offsett = (float)faceMap["offsett"].AsReal();
float scales = (float)faceMap["scales"].AsReal();
float scalet = (float)faceMap["scalet"].AsReal();
if(imagerot != 0)
f.Rotation = imagerot;
if(offsets != 0)
f.OffsetU = offsets;
if (offsett != 0)
f.OffsetV = offsett;
if (scales != 0)
f.RepeatU = scales;
if (scalet != 0)
f.RepeatV = scalet;
if (textures.Count > textureNum)
f.TextureID = textures[textureNum];
else
f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
textureEntry.FaceTextures[face] = f;
}
pbs.TextureEntry = textureEntry.GetBytes();
AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, "");
meshAsset.Data = mesh_list[i].AsBinary();
m_assetService.Store(meshAsset);
pbs.SculptEntry = true;
pbs.SculptTexture = meshAsset.FullID;
pbs.SculptType = (byte)SculptType.Mesh;
pbs.SculptData = meshAsset.Data;
Vector3 position = inner_instance_list["position"].AsVector3();
Vector3 scale = inner_instance_list["scale"].AsVector3();
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
// int material = inner_instance_list["material"].AsInteger();
// int mesh = inner_instance_list["mesh"].AsInteger();
OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
int base_mask = permissions["base_mask"].AsInteger();
int everyone_mask = permissions["everyone_mask"].AsInteger();
UUID creator_id = permissions["creator_id"].AsUUID();
UUID group_id = permissions["group_id"].AsUUID();
int group_mask = permissions["group_mask"].AsInteger();
// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
int next_owner_mask = permissions["next_owner_mask"].AsInteger();
UUID owner_id = permissions["owner_id"].AsUUID();
int owner_mask = permissions["owner_mask"].AsInteger();
SceneObjectPart prim
= new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
prim.Scale = scale;
prim.OffsetPosition = position;
rotations.Add(rotation);
positions.Add(position);
prim.UUID = UUID.Random();
prim.CreatorID = creator_id;
prim.OwnerID = owner_id;
prim.GroupID = group_id;
prim.LastOwnerID = prim.OwnerID;
prim.CreationDate = Util.UnixTimeSinceEpoch();
prim.Name = assetName;
prim.Description = "";
prim.BaseMask = (uint)base_mask;
prim.EveryoneMask = (uint)everyone_mask;
prim.GroupMask = (uint)group_mask;
prim.NextOwnerMask = (uint)next_owner_mask;
prim.OwnerMask = (uint)owner_mask;
if (grp == null)
grp = new SceneObjectGroup(prim);
else
grp.AddPart(prim);
}
// Fix first link number
if (grp.Parts.Length > 1)
grp.RootPart.LinkNum++;
Vector3 rootPos = positions[0];
grp.AbsolutePosition = rootPos;
for (int i = 0; i < positions.Count; i++)
{
Vector3 offset = positions[i] - rootPos;
grp.Parts[i].OffsetPosition = offset;
}
for (int i = 0; i < rotations.Count; i++)
{
if (i != 0)
grp.Parts[i].RotationOffset = rotations[i];
}
grp.UpdateGroupRotationR(rotations[0]);
data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
}
AssetBase asset; AssetBase asset;
asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString());
@ -506,8 +692,6 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -632,7 +816,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
/// <summary> /// <summary>
/// /// Handle raw asset upload data via the capability.
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -670,6 +854,7 @@ namespace OpenSim.Region.ClientStack.Linden
return res; return res;
} }
///Left this in and commented in case there are unforseen issues ///Left this in and commented in case there are unforseen issues
//private void SaveAssetToFile(string filename, byte[] data) //private void SaveAssetToFile(string filename, byte[] data)
//{ //{
@ -679,6 +864,7 @@ namespace OpenSim.Region.ClientStack.Linden
// bw.Close(); // bw.Close();
// fs.Close(); // fs.Close();
//} //}
private static void SaveAssetToFile(string filename, byte[] data) private static void SaveAssetToFile(string filename, byte[] data)
{ {
string assetPath = "UserAssets"; string assetPath = "UserAssets";
@ -719,7 +905,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
/// <summary> /// <summary>
/// /// Handle raw uploaded asset data.
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -752,6 +938,7 @@ namespace OpenSim.Region.ClientStack.Linden
return res; return res;
} }
///Left this in and commented in case there are unforseen issues ///Left this in and commented in case there are unforseen issues
//private void SaveAssetToFile(string filename, byte[] data) //private void SaveAssetToFile(string filename, byte[] data)
//{ //{
@ -761,6 +948,7 @@ namespace OpenSim.Region.ClientStack.Linden
// bw.Close(); // bw.Close();
// fs.Close(); // fs.Close();
//} //}
private static void SaveAssetToFile(string filename, byte[] data) private static void SaveAssetToFile(string filename, byte[] data)
{ {
string assetPath = "UserAssets"; string assetPath = "UserAssets";
@ -839,7 +1027,7 @@ namespace OpenSim.Region.ClientStack.Linden
uploadComplete.new_asset = inventoryItemID; uploadComplete.new_asset = inventoryItemID;
uploadComplete.compiled = errors.Count > 0 ? false : true; uploadComplete.compiled = errors.Count > 0 ? false : true;
uploadComplete.state = "complete"; uploadComplete.state = "complete";
uploadComplete.errors = new OSDArray(); uploadComplete.errors = new OpenSim.Framework.Capabilities.OSDArray();
uploadComplete.errors.Array = errors; uploadComplete.errors.Array = errors;
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
@ -905,7 +1093,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
/// <summary> /// <summary>
/// /// Handle raw uploaded baked texture data.
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>

View File

@ -162,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// one and we're done otherwise, ask for a rebake // one and we're done otherwise, ask for a rebake
if (checkonly) return false; if (checkonly) return false;
m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
client.SendRebakeAvatarTextures(face.TextureID); client.SendRebakeAvatarTextures(face.TextureID);
} }
} }
m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId);
// If we only found default textures, then the appearance is not cached // If we only found default textures, then the appearance is not cached
return (defonly ? false : true); return (defonly ? false : true);

View File

@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
/// </summary>
public int MaxTransferDistance { get; set; }
protected bool m_Enabled = false; protected bool m_Enabled = false;
protected Scene m_aScene; protected Scene m_aScene;
protected List<Scene> m_Scenes = new List<Scene>(); protected List<Scene> m_Scenes = new List<Scene>();
@ -78,11 +83,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string name = moduleConfig.GetString("EntityTransferModule", ""); string name = moduleConfig.GetString("EntityTransferModule", "");
if (name == Name) if (name == Name)
{ {
InitialiseCommon(source);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
}
}
}
/// <summary>
/// Initialize config common for this module and any descendents.
/// </summary>
/// <param name="source"></param>
protected virtual void InitialiseCommon(IConfigSource source)
{
IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null)
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
m_agentsInTransit = new List<UUID>(); m_agentsInTransit = new List<UUID>();
m_Enabled = true; m_Enabled = true;
m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
}
}
} }
public virtual void PostInitialise() public virtual void PostInitialise()
@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
public virtual void RemoveRegion(Scene scene) public virtual void RemoveRegion(Scene scene)
{ {
if (!m_Enabled) if (!m_Enabled)
@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
} }
#endregion #endregion
@ -205,8 +221,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.ControllingClient.SendTeleportFailed("Problem at destination"); sp.ControllingClient.SendTeleportFailed("Problem at destination");
return; return;
} }
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); uint curX = 0, curY = 0;
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
int curCellX = (int)(curX / Constants.RegionSize);
int curCellY = (int)(curY / Constants.RegionSize);
int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize);
int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize);
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
//
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
// Check that these are not the same coordinates // Check that these are not the same coordinates
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@ -217,6 +243,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance)
{
sp.ControllingClient.SendTeleportFailed(
string.Format(
"Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
finalDestination.RegionName, destCellX, destCellY,
sp.Scene.RegionInfo.RegionName, curCellX, curCellY,
MaxTransferDistance));
return;
}
// //
// This is it // This is it
// //

View File

@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string name = moduleConfig.GetString("EntityTransferModule", ""); string name = moduleConfig.GetString("EntityTransferModule", "");
if (name == Name) if (name == Name)
{ {
m_agentsInTransit = new List<UUID>(); InitialiseCommon(source);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
m_Enabled = true;
m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
} }
} }
} }

View File

@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (m_UserCache.ContainsKey(id)) if (m_UserCache.ContainsKey(id))
return; return;
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
UserData user = new UserData(); UserData user = new UserData();
user.Id = id; user.Id = id;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
if (account != null) if (account != null)

View File

@ -92,6 +92,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return; return;
} }
m_log.DebugFormat("MAP NAME=({0})", mapName);
// try to fetch from GridServer // try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
if (regionInfos == null) if (regionInfos == null)
@ -103,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (info != null) if (info != null)
regionInfos.Add(info); regionInfos.Add(info);
} }
else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) else if (regionInfos.Count == 0)
remoteClient.SendAlertMessage("Hyperlink could not be established."); remoteClient.SendAlertMessage("Hyperlink could not be established.");
//m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);

View File

@ -1347,7 +1347,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
if (containingFolder != null && containingFolder != null) if (containingFolder != null)
{ {
// If the folder requested contains links, then we need to send those folders first, otherwise the links // If the folder requested contains links, then we need to send those folders first, otherwise the links
// will be broken in the viewer. // will be broken in the viewer.
@ -1359,15 +1359,25 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
// Take care of genuinely broken links where the target doesn't exist // Take care of genuinely broken links where the target doesn't exist
if (linkedItem != null) // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
// rather than having to keep track of every folder requested in the recursion.
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
{
// We don't need to send the folder if source and destination of the link are in the same
// folder.
if (linkedItem.Folder != containingFolder.ID)
linkedItemFolderIdsToSend.Add(linkedItem.Folder); linkedItemFolderIdsToSend.Add(linkedItem.Folder);
} }
} }
}
foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); client.SendInventoryFolderDetails(
client.AgentId, folder.ID, contents.Items, contents.Folders,
containingFolder.Version, fetchFolders, fetchItems);
} }
} }

View File

@ -2706,8 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes
{ {
string homeURL = string.Empty; string homeURL = string.Empty;
string first = aCircuit.firstname, last = aCircuit.lastname; string first = aCircuit.firstname, last = aCircuit.lastname;
if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
if (aCircuit.lastname.StartsWith("@")) if (aCircuit.lastname.StartsWith("@"))
{ {
string[] parts = aCircuit.firstname.Split('.'); string[] parts = aCircuit.firstname.Split('.');
@ -2717,6 +2719,7 @@ namespace OpenSim.Region.Framework.Scenes
last = parts[1]; last = parts[1];
} }
} }
uMan.AddUser(aCircuit.AgentID, first, last, homeURL); uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
} }
} }
@ -3530,7 +3533,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// In all cases, add or update the circuit data with the new agent circuit data and teleport flags // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
agent.teleportFlags = teleportFlags; agent.teleportFlags = teleportFlags;
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);

View File

@ -806,6 +806,7 @@ namespace OpenSim.Region.Framework.Scenes
actor.Orientation = GetWorldRotation(); actor.Orientation = GetWorldRotation();
// Tell the physics engines that this prim changed. // Tell the physics engines that this prim changed.
if (m_parentGroup.Scene != null)
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
@ -1117,6 +1118,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
if (IsAttachment)
return GroupPosition;
return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
} }
} }

View File

@ -2251,10 +2251,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
} }
SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
} }
/* /*
public void SitRayCastAvatarPosition(SceneObjectPart part) public void SitRayCastAvatarPosition(SceneObjectPart part)
{ {
@ -2797,7 +2796,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
public void SendTerseUpdateToClient(IClientAPI remoteClient) public void SendTerseUpdateToClient(IClientAPI remoteClient)
{ {
// If the client is inactive, it's getting its updates from another // If the client is inactive, it's getting its updates from another
// server. // server.
if (remoteClient.IsActive) if (remoteClient.IsActive)
@ -2912,7 +2910,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// If we aren't using a cached appearance, then clear out the baked textures // If we aren't using a cached appearance, then clear out the baked textures
if (! cachedappearance) if (!cachedappearance)
{ {
m_appearance.ResetAppearance(); m_appearance.ResetAppearance();
if (m_scene.AvatarFactory != null) if (m_scene.AvatarFactory != null)

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
{ {
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client); bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client);
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); "{0} baked appearance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt");
} }
}); });
} }

View File

@ -417,9 +417,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
UUID agentID, Caps caps) UUID agentID, Caps caps)
{ {
// m_log.DebugFormat( m_log.DebugFormat(
// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
// scene.RegionInfo.RegionName, agentID); scene.RegionInfo.RegionName, agentID);
ScenePresence avatar = scene.GetScenePresence(agentID); ScenePresence avatar = scene.GetScenePresence(agentID);
string avatarName = avatar.Name; string avatarName = avatar.Name;

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// if groups aren't enabled, we're not needed. // if groups aren't enabled, we're not needed.
// if we're not specified as the connector to use, then we're not wanted // if we're not specified as the connector to use, then we're not wanted
if ((groupsConfig.GetBoolean("Enabled", false) == false) if ((groupsConfig.GetBoolean("Enabled", false) == false)
|| (groupsConfig.GetString("MessagingModule", "Default") != Name)) || (groupsConfig.GetString("MessagingModule", "GroupsMessagingModule") != Name))
{ {
m_groupMessagingEnabled = false; m_groupMessagingEnabled = false;
return; return;

View File

@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// if groups aren't enabled, we're not needed. // if groups aren't enabled, we're not needed.
// if we're not specified as the connector to use, then we're not wanted // if we're not specified as the connector to use, then we're not wanted
if ((groupsConfig.GetBoolean("Enabled", false) == false) if ((groupsConfig.GetBoolean("Enabled", false) == false)
|| (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
{ {
m_connectorEnabled = false; m_connectorEnabled = false;
return; return;

View File

@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// if groups aren't enabled, we're not needed. // if groups aren't enabled, we're not needed.
// if we're not specified as the connector to use, then we're not wanted // if we're not specified as the connector to use, then we're not wanted
if ((groupsConfig.GetBoolean("Enabled", false) == false) if ((groupsConfig.GetBoolean("Enabled", false) == false)
|| (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
{ {
m_connectorEnabled = false; m_connectorEnabled = false;
return; return;

View File

@ -36,6 +36,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -175,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.TriggerOnChatBroadcast(this, c); m_scene.EventManager.TriggerOnChatBroadcast(this, c);
m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName);
m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
} }
} }

View File

@ -25,10 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using System.Threading; using System.Threading;
using OpenMetaverse; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.Avatar.NPC; using OpenSim.Region.CoreModules.Avatar.NPC;
@ -40,6 +43,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
public class NPCModule : IRegionModule, INPCModule public class NPCModule : IRegionModule, INPCModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private const bool m_enabled = false; // private const bool m_enabled = false;
private Mutex m_createMutex; private Mutex m_createMutex;
@ -59,6 +64,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
private UUID p_cloneAppearanceFrom; private UUID p_cloneAppearanceFrom;
private UUID p_returnUuid; private UUID p_returnUuid;
public void Initialise(Scene scene, IConfigSource source)
{
m_createMutex = new Mutex(false);
m_timer = new Timer(500);
m_timer.Elapsed += m_timer_Elapsed;
m_timer.Start();
scene.RegisterModuleInterface<INPCModule>(this);
}
private AvatarAppearance GetAppearance(UUID target, Scene scene) private AvatarAppearance GetAppearance(UUID target, Scene scene)
{ {
if (m_appearanceCache.ContainsKey(target)) if (m_appearanceCache.ContainsKey(target))
@ -76,6 +92,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
{ {
m_log.DebugFormat(
"[NPC MODULE]: Queueing request to create NPC {0} {1} at {2} in {3} cloning appearance of {4}",
firstname, lastname, position, scene.RegionInfo.RegionName, cloneAppearanceFrom);
// Block. // Block.
m_createMutex.WaitOne(); m_createMutex.WaitOne();
@ -137,19 +157,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
} }
} }
public void Initialise(Scene scene, IConfigSource source)
{
m_createMutex = new Mutex(false);
m_timer = new Timer(500);
m_timer.Elapsed += m_timer_Elapsed;
m_timer.Start();
scene.RegisterModuleInterface<INPCModule>(this);
}
void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{ {
lock (p_lock) lock (p_lock)
{ {
@ -160,24 +170,55 @@ namespace OpenSim.Region.OptionalModules.World.NPC
NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene); NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue); npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
m_log.DebugFormat(
"[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
p_firstname, p_lastname, npcAvatar.AgentId, p_position, p_scene.RegionInfo.RegionName);
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = npcAvatar.AgentId;
acd.firstname = p_firstname;
acd.lastname = p_lastname;
acd.ServiceURLs = new Dictionary<string, object>();
AvatarAppearance originalAppearance = GetAppearance(p_cloneAppearanceFrom, p_scene);
AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
acd.Appearance = npcAppearance;
p_scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
p_scene.AddNewClient(npcAvatar); p_scene.AddNewClient(npcAvatar);
ScenePresence sp; ScenePresence sp;
if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{ {
AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); m_log.DebugFormat(
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
sp.Appearance.SetTextureEntries(x.Texture); // Shouldn't call this - temporary.
sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone()); sp.CompleteMovement(npcAvatar);
sp.SendAppearanceToAllOtherAgents();
// sp.SendAppearanceToAllOtherAgents();
//
// // Send animations back to the avatar as well
// sp.Animator.SendAnimPack();
}
else
{
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
} }
m_avatars.Add(npcAvatar.AgentId, npcAvatar); m_avatars.Add(npcAvatar.AgentId, npcAvatar);
p_returnUuid = npcAvatar.AgentId; p_returnUuid = npcAvatar.AgentId;
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", p_returnUuid);
} }
} }
} }
catch (Exception ex)
{
m_log.ErrorFormat("[NPC MODULE]: NPC creation failed with exception {0} {1}", ex.Message, ex.StackTrace);
}
}
public void PostInitialise() public void PostInitialise()
{ {

View File

@ -977,7 +977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) public string osDrawPolygon(string drawList, LSL_List x, LSL_List y)
{ {
CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon"); CheckThreatLevel(ThreatLevel.None, "osDrawPolygon");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return String.Empty; return String.Empty;
} }
public void osSetWindParam(string plugin, string param, float value) public void osSetWindParam(string plugin, string param, LSL_Float value)
{ {
CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -1258,13 +1258,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
try try
{ {
module.WindParamSet(plugin, param, value); module.WindParamSet(plugin, param, (float)value);
} }
catch (Exception) { } catch (Exception) { }
} }
} }
public float osGetWindParam(string plugin, string param) public LSL_Float osGetWindParam(string plugin, string param)
{ {
CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -1416,7 +1416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
// What actually is the difference to the LL function? // What actually is the difference to the LL function?
// //
CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -2222,12 +2222,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (int)pws; return (int)pws;
} }
public void osSetSpeed(string UUID, float SpeedModifier) public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
avatar.SpeedModifier = SpeedModifier; avatar.SpeedModifier = (float)SpeedModifier;
} }
public void osKickAvatar(string FirstName,string SurName,string alert) public void osKickAvatar(string FirstName,string SurName,string alert)
@ -2308,14 +2308,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
InitLSL();
return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules);
} }
public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
{ {
CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
InitLSL();
m_LSL_Api.SetPrimitiveParamsEx(prim, rules); m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
} }

View File

@ -129,8 +129,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Wind Module Functions // Wind Module Functions
string osWindActiveModelPluginName(); string osWindActiveModelPluginName();
void osSetWindParam(string plugin, string param, float value); void osSetWindParam(string plugin, string param, LSL_Float value);
float osGetWindParam(string plugin, string param); LSL_Float osGetWindParam(string plugin, string param);
// Parcel commands // Parcel commands
void osParcelJoin(vector pos1, vector pos2); void osParcelJoin(vector pos1, vector pos2);
@ -180,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
int osGetSimulatorMemory(); int osGetSimulatorMemory();
void osKickAvatar(string FirstName,string SurName,string alert); void osKickAvatar(string FirstName,string SurName,string alert);
void osSetSpeed(string UUID, float SpeedModifier); void osSetSpeed(string UUID, LSL_Float SpeedModifier);
void osCauseHealing(string avatar, double healing); void osCauseHealing(string avatar, double healing);
void osCauseDamage(string avatar, double damage); void osCauseDamage(string avatar, double damage);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);

View File

@ -106,16 +106,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osWindActiveModelPluginName(); return m_OSSL_Functions.osWindActiveModelPluginName();
} }
// Not yet plugged in as available OSSL functions, so commented out public void osSetWindParam(string plugin, string param, LSL_Float value)
// void osSetWindParam(string plugin, string param, float value) {
// { m_OSSL_Functions.osSetWindParam(plugin, param, value);
// m_OSSL_Functions.osSetWindParam(plugin, param, value); }
// }
// public LSL_Float osGetWindParam(string plugin, string param)
// float osGetWindParam(string plugin, string param) {
// { return m_OSSL_Functions.osGetWindParam(plugin, param);
// return m_OSSL_Functions.osGetWindParam(plugin, param); }
// }
public void osParcelJoin(vector pos1, vector pos2) public void osParcelJoin(vector pos1, vector pos2)
{ {
@ -714,7 +713,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
} }
public void osSetSpeed(string UUID, float SpeedModifier) public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
{ {
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
} }

View File

@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// Get some config // Get some config
WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false);
CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true);
bool DeleteScriptsOnStartup = m_scriptEngine.Config.GetBoolean("DeleteScriptsOnStartup", true);
// Get file prefix from scriptengine name and make it file system safe: // Get file prefix from scriptengine name and make it file system safe:
FilePrefix = "CommonCompiler"; FilePrefix = "CommonCompiler";
@ -114,10 +115,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
FilePrefix = FilePrefix.Replace(c, '_'); FilePrefix = FilePrefix.Replace(c, '_');
} }
// First time we start? Delete old files
if (in_startup) if (in_startup)
{ {
in_startup = false; in_startup = false;
CreateScriptsDirectory();
// First time we start? Delete old files
if (DeleteScriptsOnStartup)
DeleteOldFiles(); DeleteOldFiles();
} }
@ -187,11 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
} }
/// <summary> /// <summary>
/// Delete old script files /// Create the directory where compiled scripts are stored.
/// </summary> /// </summary>
private void DeleteOldFiles() private void CreateScriptsDirectory()
{ {
// CREATE FOLDER IF IT DOESNT EXIST
if (!Directory.Exists(ScriptEnginesPath)) if (!Directory.Exists(ScriptEnginesPath))
{ {
try try
@ -218,7 +221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString());
} }
} }
}
/// <summary>
/// Delete old script files
/// </summary>
private void DeleteOldFiles()
{
foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*"))
{ {

View File

@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
protected GatekeeperServiceConnector m_GatekeeperConnector; protected GatekeeperServiceConnector m_GatekeeperConnector;
protected UUID m_ScopeID = UUID.Zero; protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true; // protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty; protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty; protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null; protected Uri m_ThisGatekeeperURI = null;
@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
if (scope != string.Empty) if (scope != string.Empty)
UUID.TryParse(scope, out m_ScopeID); UUID.TryParse(scope, out m_ScopeID);
m_Check4096 = gridConfig.GetBoolean("Check4096", true); // m_Check4096 = gridConfig.GetBoolean("Check4096", true);
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
@ -311,14 +311,18 @@ namespace OpenSim.Services.GridService
return true; return true;
} }
uint x, y; // We are now performing this check for each individual teleport in the EntityTransferModule instead. This
if (m_Check4096 && !Check4096(handle, out x, out y)) // allows us to give better feedback when teleports fail because of the distance reason (which can't be
{ // done here) and it also hypergrid teleports that are within range (possibly because the source grid
RemoveHyperlinkRegion(regInfo.RegionID); // itself has regions that are very far apart).
reason = "Region is too far (" + x + ", " + y + ")"; // uint x, y;
m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); // if (m_Check4096 && !Check4096(handle, out x, out y))
return false; // {
} // //RemoveHyperlinkRegion(regInfo.RegionID);
// reason = "Region is too far (" + x + ", " + y + ")";
// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
// //return false;
// }
regInfo.RegionID = regionID; regInfo.RegionID = regionID;
@ -369,60 +373,59 @@ namespace OpenSim.Services.GridService
} }
} }
/// <summary> // Not currently used
/// Cope with this viewer limitation. // /// <summary>
/// </summary> // /// Cope with this viewer limitation.
/// <param name="regInfo"></param> // /// </summary>
/// <returns></returns> // /// <param name="regInfo"></param>
public bool Check4096(ulong realHandle, out uint x, out uint y) // /// <returns></returns>
{ // public bool Check4096(ulong realHandle, out uint x, out uint y)
uint ux = 0, uy = 0; // {
Utils.LongToUInts(realHandle, out ux, out uy); // uint ux = 0, uy = 0;
x = ux / Constants.RegionSize; // Utils.LongToUInts(realHandle, out ux, out uy);
y = uy / Constants.RegionSize; // x = ux / Constants.RegionSize;
// y = uy / Constants.RegionSize;
const uint limit = (4096 - 1) * Constants.RegionSize; //
uint xmin = ux - limit; // const uint limit = (4096 - 1) * Constants.RegionSize;
uint xmax = ux + limit; // uint xmin = ux - limit;
uint ymin = uy - limit; // uint xmax = ux + limit;
uint ymax = uy + limit; // uint ymin = uy - limit;
// World map boundary checks // uint ymax = uy + limit;
if (xmin < 0 || xmin > ux) // // World map boundary checks
xmin = 0; // if (xmin < 0 || xmin > ux)
if (xmax > int.MaxValue || xmax < ux) // xmin = 0;
xmax = int.MaxValue; // if (xmax > int.MaxValue || xmax < ux)
if (ymin < 0 || ymin > uy) // xmax = int.MaxValue;
ymin = 0; // if (ymin < 0 || ymin > uy)
if (ymax > int.MaxValue || ymax < uy) // ymin = 0;
ymax = int.MaxValue; // if (ymax > int.MaxValue || ymax < uy)
// ymax = int.MaxValue;
// Check for any regions that are within the possible teleport range to the linked region //
List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); // // Check for any regions that are within the possible teleport range to the linked region
if (regions.Count == 0) // List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
{ // if (regions.Count == 0)
return false; // {
} // return false;
else // }
{ // else
// Check for regions which are not linked regions // {
List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); // // Check for regions which are not linked regions
IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); // List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
if (availableRegions.Count() == 0) // IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
return false; // if (availableRegions.Count() == 0)
} // return false;
// }
return true; //
} // return true;
// }
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
{ {
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
rdata.Data["flags"] = flags.ToString(); rdata.Data["flags"] = flags.ToString();
m_Database.Store(rdata); m_Database.Store(rdata);
} }
private void RemoveHyperlinkRegion(UUID regionID) private void RemoveHyperlinkRegion(UUID regionID)

View File

@ -83,9 +83,24 @@ namespace OpenSim.Services.UserAccountService
"create user", "create user",
"create user [<first> [<last> [<pass> [<email>]]]]", "create user [<first> [<last> [<pass> [<email>]]]]",
"Create a new user", HandleCreateUser); "Create a new user", HandleCreateUser);
MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
MainConsole.Instance.Commands.AddCommand("UserService", false,
"reset user password",
"reset user password [<first> [<last> [<password>]]]", "reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword); "Reset a user password", HandleResetUserPassword);
MainConsole.Instance.Commands.AddCommand("UserService", false,
"set user level",
"set user level [<first> [<last> [<level>]]]",
"Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
+ "this account will be treated as god-moded. "
+ "It will also affect the 'login level' command. ",
HandleSetUserLevel);
MainConsole.Instance.Commands.AddCommand("UserService", false,
"show account",
"show account <first> <last>",
"Show account details for the given user", HandleShowAccount);
} }
} }
@ -337,6 +352,36 @@ namespace OpenSim.Services.UserAccountService
CreateUser(firstName, lastName, password, email); CreateUser(firstName, lastName, password, email);
} }
protected void HandleShowAccount(string module, string[] cmdparams)
{
if (cmdparams.Length != 4)
{
MainConsole.Instance.Output("Usage: show account <first-name> <last-name>");
return;
}
string firstName = cmdparams[2];
string lastName = cmdparams[3];
UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName);
if (ua == null)
{
MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName);
return;
}
MainConsole.Instance.OutputFormat("Name: {0}", ua.Name);
MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID);
MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle);
MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email);
MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created));
MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel);
MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags);
foreach (KeyValuePair<string, Object> kvp in ua.ServiceURLs)
MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value);
}
protected void HandleResetUserPassword(string module, string[] cmdparams) protected void HandleResetUserPassword(string module, string[] cmdparams)
{ {
string firstName; string firstName;
@ -357,16 +402,58 @@ namespace OpenSim.Services.UserAccountService
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (account == null) if (account == null)
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user"); {
MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
return;
}
bool success = false; bool success = false;
if (m_AuthenticationService != null) if (m_AuthenticationService != null)
success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
if (!success) if (!success)
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.", MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName);
firstName, lastName);
else else
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName);
}
protected void HandleSetUserLevel(string module, string[] cmdparams)
{
string firstName;
string lastName;
string rawLevel;
int level;
if (cmdparams.Length < 4)
firstName = MainConsole.Instance.CmdPrompt("First name");
else firstName = cmdparams[3];
if (cmdparams.Length < 5)
lastName = MainConsole.Instance.CmdPrompt("Last name");
else lastName = cmdparams[4];
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (account == null) {
MainConsole.Instance.OutputFormat("No such user");
return;
}
if (cmdparams.Length < 6)
rawLevel = MainConsole.Instance.CmdPrompt("User level");
else rawLevel = cmdparams[5];
if(int.TryParse(rawLevel, out level) == false) {
MainConsole.Instance.OutputFormat("Invalid user level");
return;
}
account.UserLevel = level;
bool success = StoreUserAccount(account);
if (!success)
MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName);
else
MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level);
} }
#endregion #endregion

View File

@ -443,8 +443,8 @@
;; to ConfigurableWind and uncomment the following. ;; to ConfigurableWind and uncomment the following.
; avg_strength = 5.0 ; avg_strength = 5.0
; avg_direction = 0.0 ; avg_direction = 0.0
; var_strength = 0.0 ; var_strength = 5.0
; var_direction = 0.0 ; var_direction = 30.0
; rate_change = 1.0 ; rate_change = 1.0
;# {strength} {enabled:true wind_plugin:SimpleRandomWind} {Wind strength?} {} 1.0 ;# {strength} {enabled:true wind_plugin:SimpleRandomWind} {Wind strength?} {} 1.0

View File

@ -504,6 +504,10 @@
; Distance in meters that shouts should travel. Default is 100m ; Distance in meters that shouts should travel. Default is 100m
shout_distance = 100 shout_distance = 100
[EntityTransfer]
; The maximum distance in regions that an agent is allowed to teleport along the x or y axis
; This is set to 4095 because current viewers can't handle teleports that are greater than this distance
max_distance = 4095
[Messaging] [Messaging]
; Control which region module is used for instant messaging. ; Control which region module is used for instant messaging.
@ -855,11 +859,6 @@
;exclude_list=User 1,User 2,User 3 ;exclude_list=User 1,User 2,User 3
[CMS]
enabled = false
;channel = 345
; The following settings control the progression of daytime ; The following settings control the progression of daytime
; in the Sim. The defaults are the same as the commented out settings ; in the Sim. The defaults are the same as the commented out settings
[Sun] [Sun]
@ -1120,6 +1119,12 @@
;; Path to script assemblies ;; Path to script assemblies
; ScriptEnginesPath = "ScriptEngines" ; ScriptEnginesPath = "ScriptEngines"
; Whether to delete previously compiled scripts when the sim starts. If you disable this
; then startup will be faster. However, then it becomes your responsibility to delete the
; compiled scripts if OpenSim has changed enough that previously compiled scripts are no
; longer compatible.
DeleteScriptsOnStartup = true
[OpenGridProtocol] [OpenGridProtocol]
;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know..

View File

@ -63,9 +63,6 @@
;;--- For MySql region storage (alternative) ;;--- For MySql region storage (alternative)
;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" ;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
;; With hypergrid, perform distance check for the creation of a linked region
; Check4096 = true
;; Directory for map tile images of remote regions ;; Directory for map tile images of remote regions
; MapTileDirectory = "./maptiles" ; MapTileDirectory = "./maptiles"