Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
commit
9d4ed3b018
|
@ -0,0 +1,7 @@
|
|||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
{
|
||||
public interface ISecurityCredential
|
||||
{
|
||||
ISocialEntity owner { get; }
|
||||
}
|
||||
}
|
|
@ -166,8 +166,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
|
||||
public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host)
|
||||
{
|
||||
world = new World(m_scene);
|
||||
host = new Host(new SOPObject(m_scene, localID), m_scene, new ExtensionHandler(m_extensions), m_microthreads);
|
||||
// UUID should be changed to object owner.
|
||||
UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID;
|
||||
SEUser securityUser = new SEUser(owner, "Name Unassigned");
|
||||
SecurityCredential creds = new SecurityCredential(securityUser);
|
||||
|
||||
world = new World(m_scene, creds);
|
||||
host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions),
|
||||
m_microthreads);
|
||||
}
|
||||
|
||||
public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID)
|
||||
|
|
|
@ -40,10 +40,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
private readonly Scene m_scene;
|
||||
private readonly IEnumerator<EntityBase> m_sogEnum;
|
||||
private readonly ISecurityCredential m_security;
|
||||
|
||||
public IObjEnum(Scene scene)
|
||||
public IObjEnum(Scene scene, ISecurityCredential security)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_security = security;
|
||||
m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
|
||||
}
|
||||
|
||||
|
@ -66,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
return new SOPObject(m_scene, m_sogEnum.Current.LocalId);
|
||||
return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,17 +81,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor
|
||||
{
|
||||
private readonly Scene m_scene;
|
||||
private readonly ISecurityCredential m_security;
|
||||
|
||||
public ObjectAccessor(Scene scene)
|
||||
public ObjectAccessor(Scene scene, ISecurityCredential security)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_security = security;
|
||||
}
|
||||
|
||||
public IObject this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId);
|
||||
return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId);
|
||||
return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,20 +121,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
public IObject Create(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
|
||||
SceneObjectGroup sog = m_scene.AddNewPrim(m_scene.RegionInfo.MasterAvatarAssignedUUID,
|
||||
SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID,
|
||||
UUID.Zero,
|
||||
position,
|
||||
rotation,
|
||||
PrimitiveBaseShape.CreateBox());
|
||||
|
||||
IObject ret = new SOPObject(m_scene, sog.LocalId);
|
||||
IObject ret = new SOPObject(m_scene, sog.LocalId, m_security);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public IEnumerator<IObject> GetEnumerator()
|
||||
{
|
||||
return new IObjEnum(m_scene);
|
||||
return new IObjEnum(m_scene, m_security);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
|
|
|
@ -42,13 +42,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
private readonly Scene m_rootScene;
|
||||
private readonly uint m_localID;
|
||||
private readonly ISecurityCredential m_security;
|
||||
|
||||
[Obsolete("Replace with 'credential' constructor [security]")]
|
||||
public SOPObject(Scene rootScene, uint localID)
|
||||
{
|
||||
m_rootScene = rootScene;
|
||||
m_localID = localID;
|
||||
}
|
||||
|
||||
public SOPObject(Scene rootScene, uint localID, ISecurityCredential credential)
|
||||
{
|
||||
m_rootScene = rootScene;
|
||||
m_localID = localID;
|
||||
m_security = credential;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This needs to run very, very quickly.
|
||||
/// It is utilized in nearly every property and method.
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
{
|
||||
class SecurityCredential : ISecurityCredential
|
||||
{
|
||||
private readonly ISocialEntity m_owner;
|
||||
|
||||
public SecurityCredential(ISocialEntity m_owner)
|
||||
{
|
||||
this.m_owner = m_owner;
|
||||
}
|
||||
|
||||
public ISocialEntity owner
|
||||
{
|
||||
get { return m_owner; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,15 +37,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
public class World : System.MarshalByRefObject, IWorld, IWorldAudio
|
||||
{
|
||||
private readonly Scene m_internalScene;
|
||||
private readonly ISecurityCredential m_security;
|
||||
private readonly Heightmap m_heights;
|
||||
|
||||
private readonly ObjectAccessor m_objs;
|
||||
|
||||
public World(Scene internalScene)
|
||||
public World(Scene internalScene, ISecurityCredential securityCredential)
|
||||
{
|
||||
m_security = securityCredential;
|
||||
m_internalScene = internalScene;
|
||||
m_heights = new Heightmap(m_internalScene);
|
||||
m_objs = new ObjectAccessor(m_internalScene);
|
||||
m_objs = new ObjectAccessor(m_internalScene, securityCredential);
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
|
Loading…
Reference in New Issue