remove MRM module (minimodule). Its outdated and we have no maintainers. Thanks to all that worked on it. You should either use scripts or a full region module. Or revert this commit and update its code ;)

0.9.1.0-post-fixes
UbitUmarov 2019-01-31 12:14:29 +00:00
parent 44e6f45ed6
commit 76b777b1fb
47 changed files with 0 additions and 4622 deletions

View File

@ -1,66 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class ExtensionHandler : IExtension
{
private readonly Dictionary<Type, object> m_instances;
public ExtensionHandler(Dictionary<Type, object> instances)
{
m_instances = instances;
}
public T Get<T>()
{
return (T) m_instances[typeof (T)];
}
public bool TryGet<T>(out T extension)
{
if (!m_instances.ContainsKey(typeof(T)))
{
extension = default(T);
return false;
}
extension = Get<T>();
return true;
}
public bool Has<T>()
{
return m_instances.ContainsKey(typeof (T));
}
}
}

View File

@ -1,72 +0,0 @@
/*
* 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.Drawing;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class Graphics : System.MarshalByRefObject, IGraphics
{
private readonly Scene m_scene;
public Graphics(Scene m_scene)
{
this.m_scene = m_scene;
}
public UUID SaveBitmap(Bitmap data)
{
return SaveBitmap(data, false, true);
}
public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
{
AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID.ToString());
asset.Data = OpenJPEG.EncodeFromImage(data, lossless);
asset.Description = "MRM Image";
asset.Local = false;
asset.Temporary = temporary;
m_scene.AssetService.Store(asset);
return asset.FullID;
}
public Bitmap LoadBitmap(UUID assetID)
{
AssetBase bmp = m_scene.AssetService.Get(assetID.ToString());
ManagedImage outimg;
Image img;
OpenJPEG.DecodeToImage(bmp.Data, out outimg, out img);
return new Bitmap(img);
}
}
}

View File

@ -1,67 +0,0 @@
/*
* 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 OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class Heightmap : System.MarshalByRefObject, IHeightmap
{
private readonly Scene m_scene;
public Heightmap(Scene scene)
{
m_scene = scene;
}
public double this[int x, int y]
{
get { return Get(x, y); }
set { Set(x, y, value); }
}
public int Length
{
get { return m_scene.Heightmap.Height; }
}
public int Width
{
get { return m_scene.Heightmap.Width; }
}
protected double Get(int x, int y)
{
return m_scene.Heightmap[x, y];
}
protected void Set(int x, int y, double val)
{
m_scene.Heightmap[x, y] = val;
}
}
}

View File

@ -1,79 +0,0 @@
/*
* 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.Reflection;
using log4net;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class Host : System.MarshalByRefObject, IHost
{
private readonly IObject m_obj;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IGraphics m_graphics;
private readonly IExtension m_extend;
private readonly IMicrothreader m_threader;
//private Scene m_scene;
public Host(IObject m_obj, Scene m_scene, IExtension m_extend, IMicrothreader m_threader)
{
this.m_obj = m_obj;
this.m_threader = m_threader;
this.m_extend = m_extend;
//this.m_scene = m_scene;
m_graphics = new Graphics(m_scene);
}
public IObject Object
{
get { return m_obj; }
}
public ILog Console
{
get { return m_log; }
}
public IGraphics Graphics
{
get { return m_graphics; }
}
public IExtension Extensions
{
get { return m_extend; }
}
public IMicrothreader Microthreads
{
get { return m_threader; }
}
}
}

View File

@ -1,38 +0,0 @@
/*
* 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;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IMRMModule
{
void RegisterExtension<T>(T instance);
void InitializeMRM(MRMBase mmb, uint localID, UUID itemID);
void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host);
}
}

View File

@ -1,36 +0,0 @@
/*
* 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.
*/
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface ISecurityCredential
{
ISocialEntity owner { get; }
bool CanEditObject(IObject target);
bool CanEditTerrain(int x, int y);
}
}

View File

@ -1,51 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IAvatar : IEntity
{
bool IsChildAgent { get; }
//// <value>
/// Array of worn attachments, empty but not null, if no attachments are worn
/// </value>
IAvatarAttachment[] Attachments { get; }
/// <summary>
/// Request to open an url clientside
/// </summary>
void LoadUrl(IObject sender, string message, string url);
}
}

View File

@ -1,42 +0,0 @@
/*
* 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.
*/
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IAvatarAttachment
{
//// <value>
/// Describes where on the avatar the attachment is located
/// </value>
int Location { get ; }
//// <value>
/// Accessor to the rez'ed asset, representing the attachment
/// </value>
IObject Asset { get; }
}
}

View File

@ -1,41 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IEntity
{
string Name { get; set; }
UUID GlobalID { get; }
Vector3 WorldPosition { get; set; }
}
}

View File

@ -1,40 +0,0 @@
/*
* 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.Generic;
using System.Text;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces
{
public interface IExtension
{
T Get<T>();
bool TryGet<T>(out T extension);
bool Has<T>();
}
}

View File

@ -1,39 +0,0 @@
/*
* 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.Drawing;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IGraphics
{
UUID SaveBitmap(Bitmap data);
UUID SaveBitmap(Bitmap data, bool lossless, bool temporary);
Bitmap LoadBitmap(UUID assetID);
}
}

View File

@ -1,69 +0,0 @@
/*
* 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.Generic;
using System.Text;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IHeightmap
{
/// <summary>
/// Returns [or sets] the heightmap value at specified coordinates.
/// </summary>
/// <param name="x">X Coordinate</param>
/// <param name="y">Y Coordinate</param>
/// <returns>A value in meters representing height. Can be negative. Value correlates with Z parameter in world coordinates</returns>
/// <example>
/// double heightVal = World.Heightmap[128,128];
/// World.Heightmap[128,128] *= 5.0;
/// World.Heightmap[128,128] = 25;
/// </example>
double this[int x, int y]
{
get;
set;
}
/// <summary>
/// The maximum length of the region (Y axis), exclusive. (eg Height = 256, max Y = 255). Minimum is always 0 inclusive.
/// </summary>
/// <example>
/// Host.Console.Info("The terrain length of this region is " + World.Heightmap.Length);
/// </example>
int Length { get; }
/// <summary>
/// The maximum width of the region (X axis), exclusive. (eg Width = 256, max X = 255). Minimum is always 0 inclusive.
/// </summary>
/// <example>
/// Host.Console.Info("The terrain width of this region is " + World.Heightmap.Width);
/// </example>
int Width { get; }
}
}

View File

@ -1,44 +0,0 @@
/*
* 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.Generic;
using System.Text;
using log4net;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IHost
{
IObject Object { get; }
ILog Console { get; }
IGraphics Graphics { get; }
IExtension Extensions { get; }
IMicrothreader Microthreads { get; }
}
}

View File

@ -1,43 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenMetaverse.Assets;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
/// <summary>
/// This implements the methods needed to operate on individual inventory items.
/// </summary>
public interface IInventoryItem
{
int Type { get; }
UUID AssetID { get; }
T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new();
}
}

View File

@ -1,39 +0,0 @@
/*
* 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.Text;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces
{
public interface IMicrothreader
{
void Run(IEnumerable microthread);
}
}

View File

@ -1,245 +0,0 @@
/*
* 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.Drawing;
using OpenMetaverse;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
[Serializable]
public class TouchEventArgs : EventArgs
{
public IAvatar Avatar;
public Vector3 TouchBiNormal;
public Vector3 TouchNormal;
public Vector3 TouchPosition;
public Vector2 TouchUV;
public Vector2 TouchST;
public int TouchMaterialIndex;
}
public delegate void OnTouchDelegate(IObject sender, TouchEventArgs e);
public interface IObject : IEntity
{
#region Events
event OnTouchDelegate OnTouch;
#endregion
/// <summary>
/// Returns whether or not this object is still in the world.
/// Eg, if you store an IObject reference, however the object
/// is deleted before you use it, it will throw a NullReference
/// exception. 'Exists' allows you to check the object is still
/// in play before utilizing it.
/// </summary>
/// <example>
/// IObject deleteMe = World.Objects[0];
///
/// if (deleteMe.Exists) {
/// deleteMe.Say("Hello, I still exist!");
/// }
///
/// World.Objects.Remove(deleteMe);
///
/// if (!deleteMe.Exists) {
/// Host.Console.Info("I was deleted");
/// }
/// </example>
/// <remarks>
/// Objects should be near-guarunteed to exist for any event which
/// passes them as an argument. Storing an object for a longer period
/// of time however will limit their reliability.
///
/// It is a good practice to use Try/Catch blocks handling for
/// NullReferenceException, when accessing remote objects.
/// </remarks>
bool Exists { get; }
/// <summary>
/// The local region-unique ID for this object.
/// </summary>
uint LocalID { get; }
/// <summary>
/// The description assigned to this object.
/// </summary>
String Description { get; set; }
/// <summary>
/// Returns the UUID of the Owner of the Object.
/// </summary>
UUID OwnerId { get; }
/// <summary>
/// Returns the UUID of the Creator of the Object.
/// </summary>
UUID CreatorId { get; }
/// <summary>
/// Returns the root object of a linkset. If this object is the root, it will return itself.
/// </summary>
IObject Root { get; }
/// <summary>
/// Returns a collection of objects which are linked to the current object. Does not include the root object.
/// </summary>
IObject[] Children { get; }
/// <summary>
/// Returns a list of materials attached to this object. Each may contain unique texture
/// and other visual information. For primitive based objects, this correlates with
/// Object Faces. For mesh based objects, this correlates with Materials.
/// </summary>
IObjectMaterial[] Materials { get; }
/// <summary>
/// The bounding box of the object. Primitive and Mesh objects alike are scaled to fit within these bounds.
/// </summary>
Vector3 Scale { get; set; }
/// <summary>
/// The rotation of the object relative to the Scene
/// </summary>
Quaternion WorldRotation { get; set; }
/// <summary>
/// The rotation of the object relative to a parent object
/// If root, works the same as WorldRotation
/// </summary>
Quaternion OffsetRotation { get; set; }
/// <summary>
/// The position of the object relative to a parent object
/// If root, works the same as WorldPosition
/// </summary>
Vector3 OffsetPosition { get; set; }
Vector3 SitTarget { get; set; }
String SitTargetText { get; set; }
String TouchText { get; set; }
/// <summary>
/// Text to be associated with this object, in the
/// Second Life(r) viewer, this is shown above the
/// object.
/// </summary>
String Text { get; set; }
bool IsRotationLockedX { get; set; } // SetStatus(!ROTATE_X)
bool IsRotationLockedY { get; set; } // SetStatus(!ROTATE_Y)
bool IsRotationLockedZ { get; set; } // SetStatus(!ROTATE_Z)
bool IsSandboxed { get; set; } // SetStatus(SANDBOX)
bool IsImmotile { get; set; } // SetStatus(BLOCK_GRAB)
bool IsAlwaysReturned { get; set; } // SetStatus(!DIE_AT_EDGE)
bool IsTemporary { get; set; } // TEMP_ON_REZ
bool IsFlexible { get; set; }
IObjectShape Shape { get; }
// TODO:
// PrimHole
// Repeats, Offsets, Cut/Dimple/ProfileCut
// Hollow, Twist, HoleSize,
// Taper[A+B], Shear[A+B], Revolutions,
// RadiusOffset, Skew
PhysicsMaterial PhysicsMaterial { get; set; }
IObjectPhysics Physics { get; }
IObjectSound Sound { get; }
/// <summary>
/// Causes the object to speak to its surroundings,
/// equivilent to LSL/OSSL llSay
/// </summary>
/// <param name="msg">The message to send to the user</param>
void Say(string msg);
/// <summary>
/// Causes the object to speak to on a specific channel,
/// equivilent to LSL/OSSL llSay
/// </summary>
/// <param name="msg">The message to send to the user</param>
/// <param name="channel">The channel on which to send the message</param>
void Say(string msg,int channel);
/// <summary>
/// Opens a Dialog Panel in the Users Viewer,
/// equivilent to LSL/OSSL llDialog
/// </summary>
/// <param name="avatar">The UUID of the Avatar to which the Dialog should be send</param>
/// <param name="message">The Message to display at the top of the Dialog</param>
/// <param name="buttons">The Strings that act as label/value of the Bottons in the Dialog</param>
/// <param name="chat_channel">The channel on which to send the response</param>
void Dialog(UUID avatar, string message, string[] buttons, int chat_channel);
//// <value>
/// Grants access to the objects inventory
/// </value>
IObjectInventory Inventory { get; }
}
public enum PhysicsMaterial
{
Default,
Glass,
Metal,
Plastic,
Wood,
Rubber,
Stone,
Flesh
}
public enum TextureMapping
{
Default,
Planar
}
public interface IObjectMaterial
{
Color Color { get; set; }
UUID Texture { get; set; }
TextureMapping Mapping { get; set; } // SetPrimParms(PRIM_TEXGEN)
bool Bright { get; set; } // SetPrimParms(FULLBRIGHT)
double Bloom { get; set; } // SetPrimParms(GLOW)
bool Shiny { get; set; } // SetPrimParms(SHINY)
bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECATE IN FAVOUR OF UUID?]
}
}

View File

@ -1,41 +0,0 @@
/*
* 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.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IObjectAccessor : ICollection<IObject>
{
IObject this[int index] { get; }
IObject this[uint index] { get; }
IObject this[UUID index] { get; }
IObject Create(Vector3 position);
IObject Create(Vector3 position, Quaternion rotation);
}
}

View File

@ -1,42 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IParcel
{
string Name { get; set; }
string Description { get; set; }
ISocialEntity Owner { get; set; }
bool[,] Bitmap { get; }
}
}

View File

@ -1,56 +0,0 @@
/*
* 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.Generic;
using System.Text;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
interface IPersistence
{
T Get<T>(Guid storageID);
T Get<T>();
/// <summary>
/// Stores 'data' into the persistence system
/// associated with this object, however saved
/// under the ID 'storageID'. This data may
/// be accessed by other scripts however.
/// </summary>
/// <param name="storageID"></param>
/// <param name="data"></param>
void Put<T>(Guid storageID, T data);
/// <summary>
/// Stores 'data' into the persistence system
/// using the default ID for this script.
/// </summary>
/// <param name="data"></param>
void Put<T>(T data);
}
}

View File

@ -1,79 +0,0 @@
/*
* 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;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
interface IScheduler
{
/// <summary>
/// Schedule an event callback to occur
/// when 'time' is elapsed.
/// </summary>
/// <param name="time">The period to wait before executing</param>
void RunIn(TimeSpan time);
/// <summary>
/// Schedule an event callback to fire
/// every "time". Equivilent to a repeating
/// timer.
/// </summary>
/// <param name="time">The period to wait between executions</param>
void RunAndRepeat(TimeSpan time);
/// <summary>
/// Fire this scheduler only when the region has
/// a user in it.
/// </summary>
bool IfOccupied { get; set; }
/// <summary>
/// Fire this only when simulator performance
/// is reasonable. (eg sysload <= 1.0)
/// </summary>
bool IfHealthy { get; set; }
/// <summary>
/// Fire this event only when the region is visible
/// to a child agent, or there is a full agent
/// in this region.
/// </summary>
bool IfVisible { get; set; }
/// <summary>
/// Determines whether this runs in the master scheduler thread, or a new thread
/// is spawned to handle your request. Running in scheduler may mean that your
/// code does not execute perfectly on time, however will result in better
/// region performance.
/// </summary>
/// <remarks>
/// Default: true
/// </remarks>
bool Schedule { get; set; }
}
}

View File

@ -1,41 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface ISocialEntity
{
UUID GlobalID { get; }
string Name { get; }
bool IsUser { get; }
}
}

View File

@ -1,61 +0,0 @@
/*
* 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 OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class NewUserEventArgs : EventArgs
{
public IAvatar Avatar;
}
public delegate void OnNewUserDelegate(IWorld sender, NewUserEventArgs e);
public class ChatEventArgs : EventArgs
{
public string Text;
public IEntity Sender;
public int Channel;
}
public delegate void OnChatDelegate(IWorld sender, ChatEventArgs e);
public interface IWorld
{
IObjectAccessor Objects { get; }
IAvatar[] Avatars { get; }
IParcel[] Parcels { get; }
IHeightmap Terrain { get; }
IWorldAudio Audio { get; }
event OnChatDelegate OnChat;
event OnNewUserDelegate OnNewUser;
}
}

View File

@ -1,98 +0,0 @@
/*
* 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.Text;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
//using OpenSim.Services.AssetService;
using OpenMetaverse;
using OpenMetaverse.Assets;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class InventoryItem : IInventoryItem
{
TaskInventoryItem m_privateItem;
Scene m_rootScene;
public InventoryItem(Scene rootScene, TaskInventoryItem internalItem)
{
m_rootScene = rootScene;
m_privateItem = internalItem;
}
// Marked internal, to prevent scripts from accessing the internal type
internal TaskInventoryItem ToTaskInventoryItem()
{
return m_privateItem;
}
/// <summary>
/// This will attempt to convert from an IInventoryItem to an InventoryItem object
/// </summary>
/// <description>
/// In order for this to work the object which implements IInventoryItem must inherit from InventoryItem, otherwise
/// an exception is thrown.
/// </description>
/// <param name="i">
/// The interface to upcast <see cref="IInventoryItem"/>
/// </param>
/// <returns>
/// The object backing the interface implementation <see cref="InventoryItem"/>
/// </returns>
internal static InventoryItem FromInterface(IInventoryItem i)
{
if (typeof(InventoryItem).IsAssignableFrom(i.GetType()))
{
return (InventoryItem)i;
}
else
{
throw new ApplicationException("[MRM] There is no legal conversion from IInventoryItem to InventoryItem");
}
}
public int Type { get { return m_privateItem.Type; } }
public UUID AssetID { get { return m_privateItem.AssetID; } }
// This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM.
public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new()
{
AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString());
T result = new T();
if ((sbyte)result.AssetType != a.Type)
throw new ApplicationException("[MRM] The supplied asset class does not match the found asset");
result.AssetData = a.Data;
result.Decode();
return result;
}
}
}

View File

@ -1,73 +0,0 @@
/*
* 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 OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class LOParcel : System.MarshalByRefObject, IParcel
{
private readonly Scene m_scene;
private readonly int m_parcelID;
public LOParcel(Scene m_scene, int m_parcelID)
{
this.m_scene = m_scene;
this.m_parcelID = m_parcelID;
}
private ILandObject GetLO()
{
return m_scene.LandChannel.GetLandObject(m_parcelID);
}
public string Name
{
get { return GetLO().LandData.Name; }
set { GetLO().LandData.Name = value; }
}
public string Description
{
get { return GetLO().LandData.Description; }
set { GetLO().LandData.Description = value; }
}
public ISocialEntity Owner
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool[,] Bitmap
{
get { return GetLO().LandBitmap; }
}
}
}

View File

@ -1,63 +0,0 @@
/*
* 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;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public abstract class MRMBase : System.MarshalByRefObject
{
private IWorld m_world;
private IHost m_host;
private UUID m_id;
public void InitMiniModule(IWorld world, IHost host, UUID uniqueID)
{
m_world = world;
m_host = host;
m_id = uniqueID;
}
protected IWorld World
{
get { return m_world; }
}
protected IHost Host
{
get { return m_host; }
}
public UUID ID
{
get { return m_id; }
}
public abstract void Start();
public abstract void Stop();
}
}

View File

@ -1,521 +0,0 @@
/*
* 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.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Text;
using log4net;
using Microsoft.CSharp;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")]
public class MRMModule : INonSharedRegionModule, IMRMModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
private bool m_Enabled;
private bool m_Hidden;
private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>();
private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
private readonly MicroScheduler m_microthreads = new MicroScheduler();
private IConfig m_config;
public void RegisterExtension<T>(T instance)
{
m_extensions[typeof (T)] = instance;
}
#region INonSharedRegionModule
public void Initialise(IConfigSource source)
{
if (source.Configs["MRM"] != null)
{
m_config = source.Configs["MRM"];
if (source.Configs["MRM"].GetBoolean("Enabled", false))
{
m_log.Info("[MRM]: Enabling MRM Module");
m_Enabled = true;
m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false);
}
}
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
m_scene = scene;
// when hidden, we don't listen for client initiated script events
// only making the MRM engine available for region modules
if (!m_Hidden)
{
scene.EventManager.OnRezScript += EventManager_OnRezScript;
scene.EventManager.OnStopScript += EventManager_OnStopScript;
}
scene.EventManager.OnFrame += EventManager_OnFrame;
scene.RegisterModuleInterface<IMRMModule>(this);
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
}
public void Close()
{
foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
{
pair.Value.Stop();
}
}
public string Name
{
get { return "MiniRegionModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
void EventManager_OnStopScript(uint localID, UUID itemID)
{
if (m_scripts.ContainsKey(itemID))
{
m_scripts[itemID].Stop();
}
}
void EventManager_OnFrame()
{
m_microthreads.Tick(1000);
}
static string ConvertMRMKeywords(string script)
{
script = script.Replace("microthreaded void", "IEnumerable");
script = script.Replace("relax;", "yield return null;");
return script;
}
/// <summary>
/// Create an AppDomain that contains policy restricting code to execute
/// with only the permissions granted by a named permission set
/// </summary>
/// <param name="permissionSetName">name of the permission set to restrict to</param>
/// <param name="appDomainName">'friendly' name of the appdomain to be created</param>
/// <exception cref="ArgumentNullException">
/// if <paramref name="permissionSetName"/> is null
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// if <paramref name="permissionSetName"/> is empty
/// </exception>
/// <returns>AppDomain with a restricted security policy</returns>
/// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx
/// Valid permissionSetName values are:
/// * FullTrust
/// * SkipVerification
/// * Execution
/// * Nothing
/// * LocalIntranet
/// * Internet
/// * Everything
/// </remarks>
#pragma warning disable 0618
public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName)
{
if (permissionSetName == null)
throw new ArgumentNullException("permissionSetName");
if (permissionSetName.Length == 0)
throw new ArgumentOutOfRangeException("permissionSetName", permissionSetName,
"Cannot have an empty permission set name");
// Default to all code getting nothing
PolicyStatement emptyPolicy = new PolicyStatement(new PermissionSet(PermissionState.None));
UnionCodeGroup policyRoot = new UnionCodeGroup(new AllMembershipCondition(), emptyPolicy);
bool foundName = false;
PermissionSet setIntersection = new PermissionSet(PermissionState.Unrestricted);
// iterate over each policy level
IEnumerator levelEnumerator = SecurityManager.PolicyHierarchy();
while (levelEnumerator.MoveNext())
{
PolicyLevel level = levelEnumerator.Current as PolicyLevel;
// if this level has defined a named permission set with the
// given name, then intersect it with what we've retrieved
// from all the previous levels
if (level != null)
{
PermissionSet levelSet = level.GetNamedPermissionSet(permissionSetName);
if (levelSet != null)
{
foundName = true;
if (setIntersection != null)
setIntersection = setIntersection.Intersect(levelSet);
}
}
}
// Intersect() can return null for an empty set, so convert that
// to an empty set object. Also return an empty set if we didn't find
// the named permission set we were looking for
if (setIntersection == null || !foundName)
setIntersection = new PermissionSet(PermissionState.None);
else
setIntersection = new NamedPermissionSet(permissionSetName, setIntersection);
// if no named permission sets were found, return an empty set,
// otherwise return the set that was found
PolicyStatement permissions = new PolicyStatement(setIntersection);
policyRoot.AddChild(new UnionCodeGroup(new AllMembershipCondition(), permissions));
// create an AppDomain policy level for the policy tree
PolicyLevel appDomainLevel = PolicyLevel.CreateAppDomainLevel();
appDomainLevel.RootCodeGroup = policyRoot;
// create an AppDomain where this policy will be in effect
string domainName = appDomainName;
AppDomain restrictedDomain = AppDomain.CreateDomain(domainName);
restrictedDomain.SetAppDomainPolicy(appDomainLevel);
return restrictedDomain;
}
#pragma warning restore 0618
void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
{
if (script.StartsWith("//MRM:C#"))
{
if (m_config.GetBoolean("OwnerOnly", true))
if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.EstateSettings.EstateOwner
|| m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.EstateSettings.EstateOwner)
return;
script = ConvertMRMKeywords(script);
try
{
AppDomain target;
if (m_config.GetBoolean("Sandboxed", true))
{
m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " +
m_config.GetString("SandboxLevel", "Internet") + "-level security.");
string domainName = UUID.Random().ToString();
target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"),
domainName);
}
else
{
m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain");
m_log.Warn(
"[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments.");
target = AppDomain.CurrentDomain;
}
m_log.Info("[MRM] Unwrapping into target AppDomain");
MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap(
CompileFromDotNetText(script, itemID.ToString()),
"OpenSim.MiniModule");
m_log.Info("[MRM] Initialising MRM Globals");
InitializeMRM(mmb, localID, itemID);
m_scripts[itemID] = mmb;
m_log.Info("[MRM] Starting MRM");
mmb.Start();
}
catch (UnauthorizedAccessException e)
{
m_log.Error("[MRM] UAE " + e.Message);
m_log.Error("[MRM] " + e.StackTrace);
if (e.InnerException != null)
m_log.Error("[MRM] " + e.InnerException);
m_scene.ForEachClient(delegate(IClientAPI user)
{
user.SendAlertMessage(
"MRM UnAuthorizedAccess: " + e);
});
}
catch (Exception e)
{
m_log.Info("[MRM] Error: " + e);
m_scene.ForEachClient(delegate(IClientAPI user)
{
user.SendAlertMessage(
"Compile error while building MRM script, check OpenSim console for more information.");
});
}
}
}
public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host)
{
// UUID should be changed to object owner.
UUID owner = m_scene.RegionInfo.EstateSettings.EstateOwner;
SEUser securityUser = new SEUser(owner, "Name Unassigned");
SecurityCredential creds = new SecurityCredential(securityUser, m_scene);
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)
{
m_log.Info("[MRM] Created MRM Instance");
IWorld world;
IHost host;
GetGlobalEnvironment(localID, out world, out host);
mmb.InitMiniModule(world, host, itemID);
}
/// <summary>
/// Stolen from ScriptEngine Common
/// </summary>
/// <param name="Script"></param>
/// <param name="uuid">Unique ID for this module</param>
/// <returns></returns>
internal string CompileFromDotNetText(string Script, string uuid)
{
m_log.Info("MRM 1");
const string ext = ".cs";
const string FilePrefix = "MiniModule";
// Output assembly name
string OutFile = Path.Combine("MiniModules", Path.Combine(
m_scene.RegionInfo.RegionID.ToString(),
FilePrefix + "_compiled_" + uuid + "_" +
Util.RandomClass.Next(9000) + ".dll"));
// Create Directories for Assemblies
if (!Directory.Exists("MiniModules"))
Directory.CreateDirectory("MiniModules");
string tmp = Path.Combine("MiniModules", m_scene.RegionInfo.RegionID.ToString());
if (!Directory.Exists(tmp))
Directory.CreateDirectory(tmp);
m_log.Info("MRM 2");
try
{
File.Delete(OutFile);
}
catch (UnauthorizedAccessException e)
{
throw new Exception("Unable to delete old existing " +
"script-file before writing new. Compile aborted: " +
e);
}
catch (IOException e)
{
throw new Exception("Unable to delete old existing " +
"script-file before writing new. Compile aborted: " +
e);
}
m_log.Info("MRM 3");
// DEBUG - write source to disk
string srcFileName = FilePrefix + "_source_" +
Path.GetFileNameWithoutExtension(OutFile) + ext;
try
{
File.WriteAllText(Path.Combine(Path.Combine(
"MiniModules",
m_scene.RegionInfo.RegionID.ToString()),
srcFileName), Script);
}
catch (Exception ex) //NOTLEGIT - Should be just FileIOException
{
m_log.Error("[Compiler]: Exception while " +
"trying to write script source to file \"" +
srcFileName + "\": " + ex);
}
m_log.Info("MRM 4");
// Do actual compile
CompilerParameters parameters = new CompilerParameters();
parameters.IncludeDebugInformation = true;
string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
List<string> libraries = new List<string>();
string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in lines)
{
if (s.StartsWith("//@DEPENDS:"))
{
libraries.Add(s.Replace("//@DEPENDS:", ""));
}
}
libraries.Add("OpenSim.Region.OptionalModules.dll");
libraries.Add("OpenMetaverseTypes.dll");
libraries.Add("log4net.dll");
foreach (string library in libraries)
{
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, library));
}
parameters.GenerateExecutable = false;
parameters.OutputAssembly = OutFile;
parameters.IncludeDebugInformation = true;
parameters.TreatWarningsAsErrors = false;
m_log.Info("MRM 5");
CompilerResults results = CScodeProvider.CompileAssemblyFromSource(
parameters, Script);
m_log.Info("MRM 6");
int display = 5;
if (results.Errors.Count > 0)
{
string errtext = String.Empty;
foreach (CompilerError CompErr in results.Errors)
{
// Show 5 errors max
//
if (display <= 0)
break;
display--;
string severity = "Error";
if (CompErr.IsWarning)
{
severity = "Warning";
}
string text = CompErr.ErrorText;
// The Second Life viewer's script editor begins
// countingn lines and columns at 0, so we subtract 1.
errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
CompErr.Line - 1, CompErr.Column - 1,
CompErr.ErrorNumber, text, severity);
}
if (!File.Exists(OutFile))
{
throw new Exception(errtext);
}
}
m_log.Info("MRM 7");
if (!File.Exists(OutFile))
{
string errtext = String.Empty;
errtext += "No compile error. But not able to locate compiled file.";
throw new Exception(errtext);
}
FileInfo fi = new FileInfo(OutFile);
Byte[] data = new Byte[fi.Length];
try
{
FileStream fs = File.Open(OutFile, FileMode.Open, FileAccess.Read);
fs.Read(data, 0, data.Length);
fs.Close();
}
catch (IOException)
{
string errtext = String.Empty;
errtext += "No compile error. But not able to open file.";
throw new Exception(errtext);
}
m_log.Info("MRM 8");
// Convert to base64
//
string filetext = Convert.ToBase64String(data);
Byte[] buf = Encoding.ASCII.GetBytes(filetext);
m_log.Info("MRM 9");
FileStream sfs = File.Create(OutFile + ".cil.b64");
sfs.Write(buf, 0, buf.Length);
sfs.Close();
m_log.Info("MRM 10");
return OutFile;
}
}
}

View File

@ -1,69 +0,0 @@
/*
* 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.Reflection;
using System.Text;
using log4net;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class MicroScheduler : System.MarshalByRefObject, IMicrothreader
{
private readonly List<IEnumerator> m_threads = new List<IEnumerator>();
public void Run(IEnumerable microthread)
{
lock (m_threads)
m_threads.Add(microthread.GetEnumerator());
}
public void Tick(int count)
{
lock (m_threads)
{
if (m_threads.Count == 0)
return;
int i = 0;
while (m_threads.Count > 0 && i < count)
{
i++;
bool running = m_threads[i%m_threads.Count].MoveNext();
if (!running)
m_threads.Remove(m_threads[i%m_threads.Count]);
}
}
}
}
}

View File

@ -1,42 +0,0 @@
/*
* 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.Generic;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object
{
/// <summary>
/// This implements the methods neccesary to operate on the inventory of an object
/// </summary>
public interface IObjectInventory : IDictionary<UUID, IInventoryItem>
{
IInventoryItem this[string name] { get; }
}
}

View File

@ -1,66 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object
{
/// <summary>
/// This implements an interface similar to that provided by physics engines to OpenSim internally.
/// Eg, PhysicsActor. It is capable of setting and getting properties related to the current
/// physics scene representation of this object.
/// </summary>
public interface IObjectPhysics
{
bool Enabled { get; set; }
bool Phantom { get; set; }
bool PhantomCollisions { get; set; }
double Density { get; set; }
double Mass { get; set; }
double Buoyancy { get; set; }
Vector3 GeometricCenter { get; }
Vector3 CenterOfMass { get; }
Vector3 RotationalVelocity { get; set; }
Vector3 Velocity { get; set; }
Vector3 Torque { get; set; }
Vector3 Acceleration { get; }
Vector3 Force { get; set; }
bool FloatOnWater { set; }
void AddForce(Vector3 force, bool pushforce);
void AddAngularForce(Vector3 force, bool pushforce);
void SetMomentum(Vector3 momentum);
}
}

View File

@ -1,75 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object
{
public enum SculptType
{
Default = 1,
Sphere = 1,
Torus = 2,
Plane = 3,
Cylinder = 4
}
public enum HoleShape
{
Default = 0x00,
Circle = 0x10,
Square = 0x20,
Triangle = 0x30
}
public enum PrimType
{
NotPrimitive = 255,
Box = 0,
Cylinder = 1,
Prism = 2,
Sphere = 3,
Torus = 4,
Tube = 5,
Ring = 6,
Sculpt = 7
}
public interface IObjectShape
{
UUID SculptMap { get; set; }
SculptType SculptType { get; set; }
HoleShape HoleType { get; set; }
Double HoleSize { get; set; }
PrimType PrimType { get; set; }
}
}

View File

@ -1,39 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object
{
public interface IObjectSound
{
void Play(UUID soundAsset, double volume);
}
}

View File

@ -1,185 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using IEnumerable=System.Collections.IEnumerable;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
internal class IObjEnum : System.MarshalByRefObject, IEnumerator<IObject>
{
private readonly Scene m_scene;
private readonly IEnumerator<EntityBase> m_sogEnum;
private readonly ISecurityCredential m_security;
private readonly List<EntityBase> m_entities;
public IObjEnum(Scene scene, ISecurityCredential security)
{
m_scene = scene;
m_security = security;
m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
m_sogEnum = m_entities.GetEnumerator();
}
public void Dispose()
{
m_sogEnum.Dispose();
}
public bool MoveNext()
{
return m_sogEnum.MoveNext();
}
public void Reset()
{
m_sogEnum.Reset();
}
public IObject Current
{
get
{
return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security);
}
}
object IEnumerator.Current
{
get { return Current; }
}
}
public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor
{
private readonly Scene m_scene;
private readonly ISecurityCredential m_security;
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, m_security);
}
}
public IObject this[uint index]
{
get
{
return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
}
}
public IObject this[UUID index]
{
get
{
return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
}
}
public IObject Create(Vector3 position)
{
return Create(position, Quaternion.Identity);
}
public IObject Create(Vector3 position, Quaternion rotation)
{
SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID,
UUID.Zero,
position,
rotation,
PrimitiveBaseShape.CreateBox());
IObject ret = new SOPObject(m_scene, sog.LocalId, m_security);
return ret;
}
public IEnumerator<IObject> GetEnumerator()
{
return new IObjEnum(m_scene, m_security);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Add(IObject item)
{
throw new NotSupportedException("Collection is read-only. This is an API TODO FIX, creation of objects is presently impossible.");
}
public void Clear()
{
throw new NotSupportedException("Collection is read-only. TODO FIX.");
}
public bool Contains(IObject item)
{
return m_scene.Entities.ContainsKey(item.LocalID);
}
public void CopyTo(IObject[] array, int arrayIndex)
{
for (int i = arrayIndex; i < Count + arrayIndex; i++)
{
array[i] = this[i - arrayIndex];
}
}
public bool Remove(IObject item)
{
throw new NotSupportedException("Collection is read-only. TODO FIX.");
}
public int Count
{
get { return m_scene.Entities.Count; }
}
public bool IsReadOnly
{
get { return true; }
}
}
}

View File

@ -1,61 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SEUser : System.MarshalByRefObject, ISocialEntity
{
private readonly UUID m_uuid;
private readonly string m_name;
public SEUser(UUID uuid, string name)
{
m_uuid = uuid;
m_name = name;
}
public UUID GlobalID
{
get { return m_uuid; }
}
public string Name
{
get { return m_name; }
}
public bool IsUser
{
get { return true; }
}
}
}

View File

@ -1,833 +0,0 @@
/*
* 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.Generic;
using System.Security;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object;
using OpenSim.Region.PhysicsModules.SharedBase;
using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType;
using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SOPObject : MarshalByRefObject, IObject, IObjectPhysics, IObjectShape, IObjectSound
{
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.
/// </summary>
/// <returns></returns>
private SceneObjectPart GetSOP()
{
return m_rootScene.GetSceneObjectPart(m_localID);
}
private bool CanEdit()
{
if (!m_security.CanEditObject(this))
{
throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]");
}
return true;
}
#region OnTouch
private event OnTouchDelegate _OnTouch;
private bool _OnTouchActive = false;
public event OnTouchDelegate OnTouch
{
add
{
if (CanEdit())
{
if (!_OnTouchActive)
{
GetSOP().Flags |= PrimFlags.Touch;
_OnTouchActive = true;
m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab;
}
_OnTouch += value;
}
}
remove
{
_OnTouch -= value;
if (_OnTouch == null)
{
GetSOP().Flags &= ~PrimFlags.Touch;
_OnTouchActive = false;
m_rootScene.EventManager.OnObjectGrab -= EventManager_OnObjectGrab;
}
}
}
void EventManager_OnObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
if (_OnTouchActive && m_localID == localID)
{
TouchEventArgs e = new TouchEventArgs();
e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security);
e.TouchBiNormal = surfaceArgs.Binormal;
e.TouchMaterialIndex = surfaceArgs.FaceIndex;
e.TouchNormal = surfaceArgs.Normal;
e.TouchPosition = surfaceArgs.Position;
e.TouchST = new Vector2(surfaceArgs.STCoord.X, surfaceArgs.STCoord.Y);
e.TouchUV = new Vector2(surfaceArgs.UVCoord.X, surfaceArgs.UVCoord.Y);
IObject sender = this;
if (_OnTouch != null)
_OnTouch(sender, e);
}
}
#endregion
public bool Exists
{
get { return GetSOP() != null; }
}
public uint LocalID
{
get { return m_localID; }
}
public UUID GlobalID
{
get { return GetSOP().UUID; }
}
public string Name
{
get { return GetSOP().Name; }
set
{
if (CanEdit())
GetSOP().Name = value;
}
}
public string Description
{
get { return GetSOP().Description; }
set
{
if (CanEdit())
GetSOP().Description = value;
}
}
public UUID OwnerId
{
get { return GetSOP().OwnerID;}
}
public UUID CreatorId
{
get { return GetSOP().CreatorID;}
}
public IObject[] Children
{
get
{
SceneObjectPart my = GetSOP();
IObject[] rets = null;
int total = my.ParentGroup.PrimCount;
rets = new IObject[total];
int i = 0;
foreach (SceneObjectPart part in my.ParentGroup.Parts)
{
rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security);
}
return rets;
}
}
public IObject Root
{
get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); }
}
public IObjectMaterial[] Materials
{
get
{
SceneObjectPart sop = GetSOP();
IObjectMaterial[] rets = new IObjectMaterial[getNumberOfSides(sop)];
for (int i = 0; i < rets.Length; i++)
{
rets[i] = new SOPObjectMaterial(i, sop);
}
return rets;
}
}
public Vector3 Scale
{
get { return GetSOP().Scale; }
set
{
if (CanEdit())
GetSOP().Scale = value;
}
}
public Quaternion WorldRotation
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public Quaternion OffsetRotation
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public Vector3 WorldPosition
{
get { return GetSOP().AbsolutePosition; }
set
{
if (CanEdit())
{
SceneObjectPart pos = GetSOP();
pos.UpdateOffSet(value - pos.AbsolutePosition);
}
}
}
public Vector3 OffsetPosition
{
get { return GetSOP().OffsetPosition; }
set
{
if (CanEdit())
{
GetSOP().OffsetPosition = value;
}
}
}
public Vector3 SitTarget
{
get { return GetSOP().SitTargetPosition; }
set
{
if (CanEdit())
{
GetSOP().SitTargetPosition = value;
}
}
}
public string SitTargetText
{
get { return GetSOP().SitName; }
set
{
if (CanEdit())
{
GetSOP().SitName = value;
}
}
}
public string TouchText
{
get { return GetSOP().TouchName; }
set
{
if (CanEdit())
{
GetSOP().TouchName = value;
}
}
}
public string Text
{
get { return GetSOP().Text; }
set
{
if (CanEdit())
{
GetSOP().SetText(value,new Vector3(1.0f,1.0f,1.0f),1.0f);
}
}
}
public bool IsRotationLockedX
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsRotationLockedY
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsRotationLockedZ
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsSandboxed
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsImmotile
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsAlwaysReturned
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsTemporary
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool IsFlexible
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public PhysicsMaterial PhysicsMaterial
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public IObjectPhysics Physics
{
get { return this; }
}
public IObjectShape Shape
{
get { return this; }
}
public IObjectInventory Inventory
{
get { return new SOPObjectInventory(m_rootScene, GetSOP().TaskInventory); }
}
#region Public Functions
public void Say(string msg)
{
if (!CanEdit())
return;
SceneObjectPart sop = GetSOP();
m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false);
}
public void Say(string msg,int channel)
{
if (!CanEdit())
return;
SceneObjectPart sop = GetSOP();
m_rootScene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,channel, sop.AbsolutePosition, sop.Name, sop.UUID, false);
}
public void Dialog(UUID avatar, string message, string[] buttons, int chat_channel)
{
if (!CanEdit())
return;
IDialogModule dm = m_rootScene.RequestModuleInterface<IDialogModule>();
if (dm == null)
return;
if (buttons.Length < 1)
{
Say("ERROR: No less than 1 button can be shown",2147483647);
return;
}
if (buttons.Length > 12)
{
Say("ERROR: No more than 12 buttons can be shown",2147483647);
return;
}
foreach (string button in buttons)
{
if (button == String.Empty)
{
Say("ERROR: button label cannot be blank",2147483647);
return;
}
if (button.Length > 24)
{
Say("ERROR: button label cannot be longer than 24 characters",2147483647);
return;
}
}
dm.SendDialogToUser(
avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID,
message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons);
}
#endregion
#region Supporting Functions
// Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
private static void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
out bool hasDimple, out bool hasProfileCut)
{
if (primType == (int)PrimType.Box
||
primType == (int)PrimType.Cylinder
||
primType == (int)PrimType.Prism)
hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
else
hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
hasHollow = shape.ProfileHollow > 0;
hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
hasProfileCut = hasDimple; // is it the same thing?
}
private static int getScriptPrimType(PrimitiveBaseShape primShape)
{
if (primShape.SculptEntry)
return (int) PrimType.Sculpt;
if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Square)
{
if (primShape.PathCurve == (byte) Extrusion.Straight)
return (int) PrimType.Box;
if (primShape.PathCurve == (byte) Extrusion.Curve1)
return (int) PrimType.Tube;
}
else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.Circle)
{
if (primShape.PathCurve == (byte) Extrusion.Straight)
return (int) PrimType.Cylinder;
if (primShape.PathCurve == (byte) Extrusion.Curve1)
return (int) PrimType.Torus;
}
else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.HalfCircle)
{
if (primShape.PathCurve == (byte) Extrusion.Curve1 || primShape.PathCurve == (byte) Extrusion.Curve2)
return (int) PrimType.Sphere;
}
else if ((primShape.ProfileCurve & 0x07) == (byte) ProfileShape.EquilateralTriangle)
{
if (primShape.PathCurve == (byte) Extrusion.Straight)
return (int) PrimType.Prism;
if (primShape.PathCurve == (byte) Extrusion.Curve1)
return (int) PrimType.Ring;
}
return (int) PrimType.NotPrimitive;
}
private static int getNumberOfSides(SceneObjectPart part)
{
int ret;
bool hasCut;
bool hasHollow;
bool hasDimple;
bool hasProfileCut;
int primType = getScriptPrimType(part.Shape);
hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
switch (primType)
{
default:
case (int) PrimType.Box:
ret = 6;
if (hasCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Cylinder:
ret = 3;
if (hasCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Prism:
ret = 5;
if (hasCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Sphere:
ret = 1;
if (hasCut) ret += 2;
if (hasDimple) ret += 2;
if (hasHollow)
ret += 1; // GOTCHA: LSL shows 2 additional sides here.
// This has been fixed, but may cause porting issues.
break;
case (int) PrimType.Torus:
ret = 1;
if (hasCut) ret += 2;
if (hasProfileCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Tube:
ret = 4;
if (hasCut) ret += 2;
if (hasProfileCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Ring:
ret = 3;
if (hasCut) ret += 2;
if (hasProfileCut) ret += 2;
if (hasHollow) ret += 1;
break;
case (int) PrimType.Sculpt:
ret = 1;
break;
}
return ret;
}
#endregion
#region IObjectPhysics
public bool Enabled
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool Phantom
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool PhantomCollisions
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public double Density
{
get { return (GetSOP().PhysActor.Mass/Scale.X*Scale.Y/Scale.Z); }
set { throw new NotImplementedException(); }
}
public double Mass
{
get { return GetSOP().PhysActor.Mass; }
set { throw new NotImplementedException(); }
}
public double Buoyancy
{
get { return GetSOP().PhysActor.Buoyancy; }
set { GetSOP().PhysActor.Buoyancy = (float)value; }
}
public Vector3 GeometricCenter
{
get
{
Vector3 tmp = GetSOP().PhysActor.GeometricCenter;
return tmp;
}
}
public Vector3 CenterOfMass
{
get
{
Vector3 tmp = GetSOP().PhysActor.CenterOfMass;
return tmp;
}
}
public Vector3 RotationalVelocity
{
get
{
Vector3 tmp = GetSOP().PhysActor.RotationalVelocity;
return tmp;
}
set
{
if (!CanEdit())
return;
GetSOP().PhysActor.RotationalVelocity = value;
}
}
public Vector3 Velocity
{
get
{
Vector3 tmp = GetSOP().PhysActor.Velocity;
return tmp;
}
set
{
if (!CanEdit())
return;
GetSOP().PhysActor.Velocity = value;
}
}
public Vector3 Torque
{
get
{
Vector3 tmp = GetSOP().PhysActor.Torque;
return tmp;
}
set
{
if (!CanEdit())
return;
GetSOP().PhysActor.Torque = value;
}
}
public Vector3 Acceleration
{
get
{
Vector3 tmp = GetSOP().PhysActor.Acceleration;
return tmp;
}
}
public Vector3 Force
{
get
{
Vector3 tmp = GetSOP().PhysActor.Force;
return tmp;
}
set
{
if (!CanEdit())
return;
GetSOP().PhysActor.Force = value;
}
}
public bool FloatOnWater
{
set
{
if (!CanEdit())
return;
GetSOP().PhysActor.FloatOnWater = value;
}
}
public void AddForce(Vector3 force, bool pushforce)
{
if (!CanEdit())
return;
GetSOP().PhysActor.AddForce(force, pushforce);
}
public void AddAngularForce(Vector3 force, bool pushforce)
{
if (!CanEdit())
return;
GetSOP().PhysActor.AddAngularForce(force, pushforce);
}
public void SetMomentum(Vector3 momentum)
{
if (!CanEdit())
return;
GetSOP().PhysActor.SetMomentum(momentum);
}
#endregion
#region Implementation of IObjectShape
private UUID m_sculptMap = UUID.Zero;
public UUID SculptMap
{
get { return m_sculptMap; }
set
{
if (!CanEdit())
return;
m_sculptMap = value;
SetPrimitiveSculpted(SculptMap, (byte) SculptType);
}
}
private SculptType m_sculptType = Object.SculptType.Default;
public SculptType SculptType
{
get { return m_sculptType; }
set
{
if (!CanEdit())
return;
m_sculptType = value;
SetPrimitiveSculpted(SculptMap, (byte) SculptType);
}
}
public HoleShape HoleType
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public double HoleSize
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public PrimType PrimType
{
get { return (PrimType)getScriptPrimType(GetSOP().Shape); }
set { throw new System.NotImplementedException(); }
}
private void SetPrimitiveSculpted(UUID map, byte type)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
SceneObjectPart part = GetSOP();
UUID sculptId = map;
shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock);
}
#endregion
#region Implementation of IObjectSound
public IObjectSound Sound
{
get { return this; }
}
public void Play(UUID asset, double volume)
{
if (!CanEdit())
return;
ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>();
if (module != null)
{
module.SendSound(GetSOP().UUID, asset, volume, true, 0, false, false);
}
}
#endregion
}
}

View File

@ -1,215 +0,0 @@
/*
* 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 OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object
{
public class SOPObjectInventory : IObjectInventory
{
TaskInventoryDictionary m_privateInventory; /// OpenSim's task inventory
Dictionary<UUID, IInventoryItem> m_publicInventory; /// MRM's inventory
Scene m_rootScene;
public SOPObjectInventory(Scene rootScene, TaskInventoryDictionary taskInventory)
{
m_rootScene = rootScene;
m_privateInventory = taskInventory;
m_publicInventory = new Dictionary<UUID, IInventoryItem>();
}
/// <summary>
/// Fully populate the public dictionary with the contents of the private dictionary
/// </summary>
/// <description>
/// This will only convert those items which hasn't already been converted. ensuring that
/// no items are converted twice, and that any references already in use are maintained.
/// </description>
private void SynchronizeDictionaries()
{
foreach (TaskInventoryItem privateItem in m_privateInventory.Values)
if (!m_publicInventory.ContainsKey(privateItem.ItemID))
m_publicInventory.Add(privateItem.ItemID, new InventoryItem(m_rootScene, privateItem));
}
#region IDictionary<UUID, IInventoryItem> implementation
public void Add (UUID key, IInventoryItem value)
{
m_publicInventory.Add(key, value);
m_privateInventory.Add(key, InventoryItem.FromInterface(value).ToTaskInventoryItem());
}
public bool ContainsKey (UUID key)
{
return m_privateInventory.ContainsKey(key);
}
public bool Remove (UUID key)
{
m_publicInventory.Remove(key);
return m_privateInventory.Remove(key);
}
public bool TryGetValue (UUID key, out IInventoryItem value)
{
value = null;
bool result = false;
if (!m_publicInventory.TryGetValue(key, out value))
{
// wasn't found in the public inventory
TaskInventoryItem privateItem;
result = m_privateInventory.TryGetValue(key, out privateItem);
if (result)
{
value = new InventoryItem(m_rootScene, privateItem);
m_publicInventory.Add(key, value); // add item, so we don't convert again
}
} else
return true;
return result;
}
public ICollection<UUID> Keys {
get {
return m_privateInventory.Keys;
}
}
public ICollection<IInventoryItem> Values {
get {
SynchronizeDictionaries();
return m_publicInventory.Values;
}
}
#endregion
#region IEnumerable<KeyValuePair<UUID, IInventoryItem>> implementation
public IEnumerator<KeyValuePair<UUID, IInventoryItem>> GetEnumerator ()
{
SynchronizeDictionaries();
return m_publicInventory.GetEnumerator();
}
#endregion
#region IEnumerable implementation
IEnumerator IEnumerable.GetEnumerator ()
{
SynchronizeDictionaries();
return m_publicInventory.GetEnumerator();
}
#endregion
#region ICollection<KeyValuePair<UUID, IInventoryItem>> implementation
public void Add (KeyValuePair<UUID, IInventoryItem> item)
{
Add(item.Key, item.Value);
}
public void Clear ()
{
m_publicInventory.Clear();
m_privateInventory.Clear();
}
public bool Contains (KeyValuePair<UUID, IInventoryItem> item)
{
return m_privateInventory.ContainsKey(item.Key);
}
public void CopyTo (KeyValuePair<UUID, IInventoryItem>[] array, int arrayIndex)
{
throw new NotImplementedException();
}
public bool Remove (KeyValuePair<UUID, IInventoryItem> item)
{
return Remove(item.Key);
}
public int Count {
get {
return m_privateInventory.Count;
}
}
public bool IsReadOnly {
get {
return false;
}
}
#endregion
#region Explicit implementations
IInventoryItem System.Collections.Generic.IDictionary<UUID, IInventoryItem>.this[UUID key]
{
get {
IInventoryItem result;
if (TryGetValue(key, out result))
return result;
else
throw new KeyNotFoundException("[MRM] The requrested item ID could not be found");
}
set {
m_publicInventory[key] = value;
m_privateInventory[key] = InventoryItem.FromInterface(value).ToTaskInventoryItem();
}
}
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<UUID, IInventoryItem>>.CopyTo(System.Collections.Generic.KeyValuePair<UUID,IInventoryItem>[] array, int offset)
{
throw new NotImplementedException();
}
#endregion
public IInventoryItem this[string name]
{
get {
foreach (TaskInventoryItem i in m_privateInventory.Values)
if (i.Name == name)
{
if (!m_publicInventory.ContainsKey(i.ItemID))
m_publicInventory.Add(i.ItemID, new InventoryItem(m_rootScene, i));
return m_publicInventory[i.ItemID];
}
throw new KeyNotFoundException();
}
}
}
}

View File

@ -1,136 +0,0 @@
/*
* 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.Drawing;
using OpenMetaverse;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SOPObjectMaterial : System.MarshalByRefObject, IObjectMaterial
{
private readonly int m_face;
private readonly SceneObjectPart m_parent;
public SOPObjectMaterial(int m_face, SceneObjectPart m_parent)
{
this.m_face = m_face;
this.m_parent = m_parent;
}
public Color Color
{
get
{
Color4 res = GetTexface().RGBA;
return Color.FromArgb((int) (res.A*255), (int) (res.R*255), (int) (res.G*255), (int) (res.B*255));
}
set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.RGBA = new Color4(value.R,value.G,value.B,value.A);
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTextureEntry(tex);
}
}
public UUID Texture
{
get
{
Primitive.TextureEntryFace texface = GetTexface();
return texface.TextureID;
}
set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.TextureID = value;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTextureEntry(tex);
}
}
private Primitive.TextureEntryFace GetTexface()
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
return tex.GetFace((uint)m_face);
}
public TextureMapping Mapping
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
public bool Bright
{
get { return GetTexface().Fullbright; }
set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Fullbright = value;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTextureEntry(tex);
}
}
public double Bloom
{
get { return GetTexface().Glow; }
set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Glow = (float) value;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTextureEntry(tex);
}
}
public bool Shiny
{
get { return GetTexface().Shiny != Shininess.None; }
set
{
Primitive.TextureEntry tex = m_parent.Shape.Textures;
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
texface.Shiny = value ? Shininess.High : Shininess.None;
tex.FaceTextures[m_face] = texface;
m_parent.UpdateTextureEntry(tex);
}
}
public bool BumpMap
{
get { return GetTexface().Bump == Bumpiness.None; }
set { throw new System.NotImplementedException(); }
}
}
}

View File

@ -1,105 +0,0 @@
/*
* 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.Collections;
using System.Collections.Generic;
using System.Security;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SPAvatar : System.MarshalByRefObject, IAvatar
{
private readonly Scene m_rootScene;
private readonly UUID m_ID;
private readonly ISecurityCredential m_security;
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public SPAvatar(Scene scene, UUID ID, ISecurityCredential security)
{
m_rootScene = scene;
m_security = security;
m_ID = ID;
}
private ScenePresence GetSP()
{
return m_rootScene.GetScenePresence(m_ID);
}
public string Name
{
get { return GetSP().Name; }
set { throw new SecurityException("Avatar Names are a read-only property."); }
}
public UUID GlobalID
{
get { return m_ID; }
}
public Vector3 WorldPosition
{
get { return GetSP().AbsolutePosition; }
set { GetSP().Teleport(value); }
}
public bool IsChildAgent
{
get { return GetSP().IsChildAgent; }
}
#region IAvatar implementation
public IAvatarAttachment[] Attachments
{
get {
List<IAvatarAttachment> attachments = new List<IAvatarAttachment>();
List<AvatarAttachment> internalAttachments = GetSP().Appearance.GetAttachments();
foreach (AvatarAttachment attach in internalAttachments)
{
attachments.Add(new SPAvatarAttachment(m_rootScene, this, attach.AttachPoint,
new UUID(attach.ItemID),
new UUID(attach.AssetID), m_security));
}
return attachments.ToArray();
}
}
public void LoadUrl(IObject sender, string message, string url)
{
IDialogModule dm = m_rootScene.RequestModuleInterface<IDialogModule>();
if (dm != null)
dm.SendUrlToUser(GetSP().UUID, sender.Name, sender.GlobalID, GetSP().UUID, false, message, url);
}
#endregion
}
}

View File

@ -1,65 +0,0 @@
/*
* 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 OpenMetaverse;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class SPAvatarAttachment : IAvatarAttachment
{
private readonly Scene m_rootScene;
//private readonly IAvatar m_parent;
private readonly int m_location;
//private readonly UUID m_itemId;
private readonly UUID m_assetId;
private readonly ISecurityCredential m_security;
public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId, ISecurityCredential security)
{
m_rootScene = rootScene;
m_security = security;
//m_parent = self;
m_location = location;
//m_itemId = itemId;
m_assetId = assetId;
}
public int Location { get { return m_location; } }
public IObject Asset
{
get
{
return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId, m_security);
}
}
}
}

View File

@ -1,62 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
class SecurityCredential : ISecurityCredential
{
private readonly ISocialEntity m_owner;
private readonly Scene m_scene;
public SecurityCredential(ISocialEntity m_owner, Scene m_scene)
{
this.m_owner = m_owner;
this.m_scene = m_scene;
}
public ISocialEntity owner
{
get { return m_owner; }
}
public bool CanEditObject(IObject target)
{
return m_scene.Permissions.CanEditObject(target.GlobalID, m_owner.GlobalID);
}
public bool CanEditTerrain(int x, int y)
{
return m_scene.Permissions.CanTerraformLand(m_owner.GlobalID, new Vector3(x, y, 0));
}
}
}

View File

@ -1,64 +0,0 @@
/*
* 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 OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim
{
class DrunkenTextAppreciationModule : MRMBase
{
public override void Start()
{
World.OnChat += World_OnChat;
}
void World_OnChat(IWorld sender, ChatEventArgs e)
{
if (e.Sender is IAvatar)
{
if (!e.Text.Contains("hic!"))
{
e.Text = e.Text.Replace("s", "sh");
e.Text = e.Text.Replace("S", "Sh");
e.Text += " ...hic!";
Host.Object.Say(e.Text);
}
}
if (e.Sender is IObject)
{
// Ignore
}
}
public override void Stop()
{
}
}
}

View File

@ -1,40 +0,0 @@
//MRM:C#
using System.Collections;
using System.Collections.Generic;
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim
{
class MiniModule : MRMBase
{
public microthreaded void MicroThreadFunction(string testparam)
{
Host.Object.Say("Hello " + testparam);
relax; // the 'relax' keyword gives up processing time.
// and should be inserted before, after or in
// any computationally "heavy" zones.
int c = 500;
while(c-- < 0) {
Host.Object.Say("C=" + c);
relax; // Putting 'relax' in microthreaded loops
// is an easy way to lower the CPU tax
// on your script.
}
}
public override void Start()
{
Host.Microthreads.Run(
MicroThreadFunction("World!")
);
}
public override void Stop()
{
}
}
}

View File

@ -1,98 +0,0 @@
/*
* 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.Collections;
using System.Collections.Generic;
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
namespace OpenSim
{
class MiniModule : MRMBase
{
// private microthreaded Function(params...)
private IEnumerable TestMicrothread(string param)
{
Host.Console.Info("Microthreaded " + param);
// relax;
yield return null;
Host.Console.Info("Microthreaded 2" + param);
yield return null;
int c = 100;
while (c-- < 0)
{
Host.Console.Info("Microthreaded Looped " + c + " " + param);
yield return null;
}
}
public void Microthread(IEnumerable thread)
{
}
public void RunMicrothread()
{
List<IEnumerator> threads = new List<IEnumerator>();
threads.Add(TestMicrothread("A").GetEnumerator());
threads.Add(TestMicrothread("B").GetEnumerator());
threads.Add(TestMicrothread("C").GetEnumerator());
Microthread(TestMicrothread("Ohai"));
int i = 0;
while (threads.Count > 0)
{
i++;
bool running = threads[i%threads.Count].MoveNext();
if (!running)
threads.Remove(threads[i%threads.Count]);
}
}
public override void Start()
{
// Say Hello
Host.Object.Say("Hello, Avatar!");
// Register ourselves to listen
// for touch events.
Host.Object.OnTouch += OnTouched;
}
// This is our touch event handler
void OnTouched(IObject sender, TouchEventArgs e)
{
Host.Object.Say("Touched.");
}
public override void Stop()
{
}
}
}

View File

@ -1,250 +0,0 @@
/*
* 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.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX;
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, ISecurityCredential securityCredential)
{
m_security = securityCredential;
m_internalScene = internalScene;
m_heights = new Heightmap(m_internalScene);
m_objs = new ObjectAccessor(m_internalScene, securityCredential);
}
#region Events
#region OnNewUser
private event OnNewUserDelegate _OnNewUser;
private bool _OnNewUserActive;
public event OnNewUserDelegate OnNewUser
{
add
{
if (!_OnNewUserActive)
{
_OnNewUserActive = true;
m_internalScene.EventManager.OnNewPresence += EventManager_OnNewPresence;
}
_OnNewUser += value;
}
remove
{
_OnNewUser -= value;
if (_OnNewUser == null)
{
_OnNewUserActive = false;
m_internalScene.EventManager.OnNewPresence -= EventManager_OnNewPresence;
}
}
}
void EventManager_OnNewPresence(ScenePresence presence)
{
if (_OnNewUser != null)
{
NewUserEventArgs e = new NewUserEventArgs();
e.Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security);
_OnNewUser(this, e);
}
}
#endregion
#region OnChat
private event OnChatDelegate _OnChat;
private bool _OnChatActive;
public IWorldAudio Audio
{
get { return this; }
}
public event OnChatDelegate OnChat
{
add
{
if (!_OnChatActive)
{
_OnChatActive = true;
m_internalScene.EventManager.OnChatFromClient += EventManager_OnChatFromClient;
m_internalScene.EventManager.OnChatFromWorld += EventManager_OnChatFromWorld;
}
_OnChat += value;
}
remove
{
_OnChat -= value;
if (_OnChat == null)
{
_OnChatActive = false;
m_internalScene.EventManager.OnChatFromClient -= EventManager_OnChatFromClient;
m_internalScene.EventManager.OnChatFromWorld -= EventManager_OnChatFromWorld;
}
}
}
void EventManager_OnChatFromWorld(object sender, OSChatMessage chat)
{
if (_OnChat != null)
{
HandleChatPacket(chat);
return;
}
}
private void HandleChatPacket(OSChatMessage chat)
{
if (string.IsNullOrEmpty(chat.Message))
return;
// Object?
if (chat.Sender == null && chat.SenderObject != null)
{
ChatEventArgs e = new ChatEventArgs();
e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId, m_security);
e.Text = chat.Message;
e.Channel = chat.Channel;
_OnChat(this, e);
return;
}
// Avatar?
if (chat.Sender != null && chat.SenderObject == null)
{
ChatEventArgs e = new ChatEventArgs();
e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID, m_security);
e.Text = chat.Message;
e.Channel = chat.Channel;
_OnChat(this, e);
return;
}
// Skip if other
}
void EventManager_OnChatFromClient(object sender, OSChatMessage chat)
{
if (_OnChat != null)
{
HandleChatPacket(chat);
return;
}
}
#endregion
#endregion
public IObjectAccessor Objects
{
get { return m_objs; }
}
public IParcel[] Parcels
{
get
{
List<ILandObject> m_los = m_internalScene.LandChannel.AllParcels();
List<IParcel> m_parcels = new List<IParcel>(m_los.Count);
foreach (ILandObject landObject in m_los)
{
m_parcels.Add(new LOParcel(m_internalScene, landObject.LandData.LocalID));
}
return m_parcels.ToArray();
}
}
public IAvatar[] Avatars
{
get
{
EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Length];
for (int i = 0; i < ents.Length; i++)
{
EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);
}
return rets;
}
}
public IHeightmap Terrain
{
get { return m_heights; }
}
#region Implementation of IWorldAudio
public void PlaySound(UUID audio, Vector3 position, double volume)
{
ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
if (soundModule != null)
{
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position,
m_internalScene.RegionInfo.RegionHandle);
}
}
public void PlaySound(UUID audio, Vector3 position)
{
ISoundModule soundModule = m_internalScene.RequestModuleInterface<ISoundModule>();
if (soundModule != null)
{
soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position,
m_internalScene.RegionInfo.RegionHandle);
}
}
#endregion
}
}

View File

@ -1,40 +0,0 @@
/*
* 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.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.WorldX
{
public interface IWorldAudio
{
void PlaySound(UUID audio, Vector3 position, double volume);
void PlaySound(UUID audio, Vector3 position);
}
}

View File

@ -1,42 +0,0 @@
/*
* 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 OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.ObjectModules
{
interface IObjectModule
{
void Add(EntityBase entity, Scene scene);
void Start();
void Stop();
void Tick();
string ClassName { get; }
bool IsShared { get; }
}
}

View File

@ -1054,30 +1054,6 @@
Include-osslEnable = "config-include/osslEnable.ini"
[MRM]
;; Enables the Mini Region Modules Script Engine.
; Enabled = false
;; Runs MRM in a Security Sandbox
;; WARNING: DISABLING IS A SECURITY RISK.
; Sandboxed = true
;; The level sandbox to use, adjust at your OWN RISK.
;; Valid values are:
;; * FullTrust
;; * SkipVerification
;; * Execution
;; * Nothing
;; * LocalIntranet
;; * Internet
;; * Everything
; SandboxLevel = "Internet"
;; Only allow Region Owners to run MRMs
;; May represent a security risk if you disable this.
; OwnerOnly = true
[FreeSwitchVoice]
;; In order for this to work you need a functioning FreeSWITCH PBX set up.
;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module

View File

@ -1952,31 +1952,6 @@
;broker = "http://broker.place.com/{1}"
[MRM]
; Enables the Mini Region Modules Script Engine.
; default is false
Enabled = false
; Runs MRM in a Security Sandbox
; WARNING: DISABLING IS A SECURITY RISK.
Sandboxed = true
; The level sandbox to use, adjust at your OWN RISK.
; Valid values are:
; * FullTrust
; * SkipVerification
; * Execution
; * Nothing
; * LocalIntranet
; * Internet
; * Everything
SandboxLevel = "Internet"
; Only allow Region Owners to run MRMs
; May represent a security risk if you disable this.
OwnerOnly = true
[Hypergrid]
; Keep it false for now. Making it true requires the use of a special client in order to access inventory
safemode = false