Attempt to get World Map working in Grid mode, will need to be using the grid asset server for it to work correctly and has only been quickly tested in a three region grid.

Moved PermissionManager creation out of the Scene constructor and instead a PermissionManager is passed to the constructor as a param. So that we could create and use custom permissionsManagers.
Added AllowMovement property to ScenePresence which can be used to stop movement of avatars (for example in a custom region that wanted avatars always in one place).
Added PermissionManager call when copying objects, although currently the call will always return true so that it allows copying in places like Wright Plaza. 
A few other changes/fixes.
afrisby
MW 2007-11-18 11:11:44 +00:00
parent 2cd00f46b9
commit 7f99644864
8 changed files with 105 additions and 70 deletions

View File

@ -366,9 +366,10 @@ namespace OpenSim
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
{
PermissionManager permissionManager = new PermissionManager();
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return
new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim);
}

View File

@ -36,7 +36,7 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
//this is first attempt to start breaking the mess thats called the assetcache up.
//this is a first attempt, to start breaking the mess thats called the assetcache up.
// basically this should be the texture sending (to clients) code moved out of assetcache
//and some small clean up
// but on first tests it didn't seem to work very well so is currently not in use.

View File

@ -48,12 +48,20 @@ namespace OpenSim.Region.Environment
set { m_bypassPermissions = value; }
}
public PermissionManager()
{
}
public PermissionManager(Scene scene)
{
m_scene = scene;
}
public void Initialise(Scene scene)
{
m_scene = scene;
}
protected virtual void SendPermissionError(LLUUID user, string reason)
{
m_scene.EventManager.TriggerPermissionError(user, reason);
@ -188,6 +196,12 @@ namespace OpenSim.Region.Environment
return GenericObjectPermission(user, obj);
}
public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
{
return true;
// return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions

View File

@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (((SceneObjectGroup)obj).LocalId == localID)
{
m_parentScene.RemoveEntity((SceneObjectGroup)obj);
m_parentScene.RemoveEntity((SceneObjectGroup)obj);
return;
}
}
@ -553,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
parenPrim.LinkToGroup(sceneObj);
}
}
/// <summary>
/// Delink a linkset
/// </summary>
@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Scenes
// XXX I'm anticipating that building this dictionary once is more efficient than
// repeated scanning of the Entity.Values for a large number of primIds. However, it might
// be more efficient yet to keep this dictionary permanently on hand.
Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>();
Dictionary<uint, SceneObjectGroup> sceneObjects = new Dictionary<uint, SceneObjectGroup>();
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
@ -576,17 +576,17 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup obj = (SceneObjectGroup)ent;
sceneObjects.Add(obj.LocalId, obj);
}
}
}
// Find the root prim among the prim ids we've been given
for (int i = 0; i < primIds.Count; i++)
{
{
if (sceneObjects.ContainsKey(primIds[i]))
{
parenPrim = sceneObjects[primIds[i]];
primIds.RemoveAt(i);
break;
}
}
}
if (parenPrim != null)
@ -594,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (uint childPrimId in primIds)
{
parenPrim.DelinkFromGroup(childPrimId);
}
}
}
else
{
@ -627,19 +627,21 @@ namespace OpenSim.Region.Environment.Scenes
if (originPrim != null)
{
SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
copy.AbsolutePosition = copy.AbsolutePosition + offset;
Entities.Add(copy.UUID, copy);
copy.ScheduleGroupForFullUpdate();
if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID))
{
SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
copy.AbsolutePosition = copy.AbsolutePosition + offset;
Entities.Add(copy.UUID, copy);
copy.ScheduleGroupForFullUpdate();
}
}
else
{
MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
}
}
}
#endregion
}

View File

@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim)
{
@ -217,15 +217,14 @@ namespace OpenSim.Region.Environment.Scenes
m_LandManager = new LandManager(this, m_regInfo);
m_estateManager = new EstateManager(this, m_regInfo);
m_eventManager = new EventManager();
m_permissionManager = new PermissionManager(this);
m_permissionManager = permissionManager;
m_permissionManager.Initialise(this);
m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
m_eventManager.OnParcelPrimCountAdd +=
m_LandManager.addPrimToLandPrimCounts;
m_eventManager.OnPermissionError += SendPermissionAlert;
RegisterDefaultSceneEvents();
MainLog.Instance.Verbose("Creating new entitities instance");
Entities = new Dictionary<LLUUID, EntityBase>();
@ -244,6 +243,13 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Startup / Close Methods
protected virtual void RegisterDefaultSceneEvents()
{
m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
m_eventManager.OnPermissionError += SendPermissionAlert;
}
public override void Close()
{
ForEachScenePresence(delegate(ScenePresence avatar)
@ -504,6 +510,7 @@ namespace OpenSim.Region.Environment.Scenes
}
CreateTerrainTexture();
CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
}
catch (Exception e)
{

View File

@ -147,6 +147,13 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_lastname; }
}
protected bool m_allowMovement = true;
public bool AllowMovement
{
get { return m_allowMovement; }
set { m_allowMovement = value; }
}
private readonly IClientAPI m_controllingClient;
protected PhysicsActor m_physicsActor;
@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes
// Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
return;
}
int i = 0;
bool update_movementflag = false;
bool update_rotation = false;
bool DCFlagKeyPressed = false;
Vector3 agent_control_v3 = new Vector3(0, 0, 0);
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
bool oldflying = PhysicsActor.Flying;
PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (PhysicsActor.Flying != oldflying)
if (m_allowMovement)
{
update_movementflag = true;
}
int i = 0;
bool update_movementflag = false;
bool update_rotation = false;
bool DCFlagKeyPressed = false;
Vector3 agent_control_v3 = new Vector3(0, 0, 0);
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
bool oldflying = PhysicsActor.Flying;
if (q != m_bodyRot)
{
m_bodyRot = q;
update_rotation = true;
}
if (m_parentID == 0)
{
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (PhysicsActor.Flying != oldflying)
{
if ((flags & (uint) DCF) != 0)
{
DCFlagKeyPressed = true;
agent_control_v3 += Dir_Vectors[i];
if ((m_movementflag & (uint) DCF) == 0)
{
m_movementflag += (byte) (uint) DCF;
update_movementflag = true;
}
}
else
{
if ((m_movementflag & (uint) DCF) != 0)
{
m_movementflag -= (byte) (uint) DCF;
update_movementflag = true;
}
}
i++;
update_movementflag = true;
}
}
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
{
AddNewMovement(agent_control_v3, q);
UpdateMovementAnimations(update_movementflag);
if (q != m_bodyRot)
{
m_bodyRot = q;
update_rotation = true;
}
if (m_parentID == 0)
{
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
{
if ((flags & (uint)DCF) != 0)
{
DCFlagKeyPressed = true;
agent_control_v3 += Dir_Vectors[i];
if ((m_movementflag & (uint)DCF) == 0)
{
m_movementflag += (byte)(uint)DCF;
update_movementflag = true;
}
}
else
{
if ((m_movementflag & (uint)DCF) != 0)
{
m_movementflag -= (byte)(uint)DCF;
update_movementflag = true;
}
}
i++;
}
}
if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
{
AddNewMovement(agent_control_v3, q);
UpdateMovementAnimations(update_movementflag);
}
}
}

View File

@ -42,10 +42,10 @@ namespace SimpleApp
{
private List<ScenePresence> m_avatars;
public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool physicalPrim)
: base(regionInfo, authen, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true)
: base(regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true)
{
m_avatars = new List<Avatar>();
}

View File

@ -169,9 +169,10 @@ namespace SimpleApp
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
{
PermissionManager permissionManager = new PermissionManager();
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return
new MyWorld(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer,
new ModuleLoader(m_log, m_config), true);
}