Getting Started with Region Modules/New

From OpenSimulator

Revision as of 20:05, 3 March 2012 by MakoBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

-- Update --

There's a way to do this without a Resources folder. See New Region Modules

-- Update --

In the new version, this is a basic version of a non shared RegionModule. For a Shared region module, replace INonSharedRegionModule with ISharedRegionModule below.

using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
 
namespace YouNameSpaceHere
 
public class YourModule : INonSharedRegionModule
{
	private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
	public string Name
        {
            get { return "YourModuleName"; }
        }
	public Type ReplaceableInterface
        {
            get { return null; }
        }
 
	public void Initialise(IConfigSource source)
        {
	}
 
	public void Close()
        {
        }
 
        public void AddRegion(Scene scene)
        {
        }
 
        public void RemoveRegion(Scene scene)
        {
        }
 
       	public void RegionLoaded(Scene scene)
        {
	}
	public void PostInitialise()
        {
        }
 
}

In Your Source project folder there should also be a Resources folder with a module.addins.xml like the following: (remember the Type of your module is; namespace.classname)

<Addin id="YourNamespace" version="0.3">
 
    <Runtime>
        <Import assembly="YourDLL.dll"/>
    </Runtime>
 
    <Dependencies>
        <Addin id="OpenSim" version="0.5" />
    </Dependencies>
 
    <Extension path = "/OpenSim/RegionModules">
        <RegionModule id="YourModule" type="TypeOfYourModule" />    \
    </Extension>  
 
</Addin>
Personal tools
General
About This Wiki