29 using System.Collections.Generic;
30 using System.Reflection;
35 using OpenMetaverse.StructuredData;
36 using OpenSim.Framework;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Region.Framework.Scenes;
40 namespace OpenSim.
Region.OptionalModules.ViewerSupport
42 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"GodNamesModule")]
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 private static bool m_enabled =
false;
50 private static List<String> m_lastNames =
new List<String>();
51 private static List<String> m_fullNames =
new List<String>();
55 IConfig moduleConfig = config.Configs[
"GodNames"];
57 if (moduleConfig == null) {
61 if (!moduleConfig.GetBoolean(
"Enabled",
false)) {
62 m_log.Info(
"[GODNAMES]: Addon is disabled");
66 m_log.Info(
"[GODNAMES]: Enabled");
68 string conf_str = moduleConfig.GetString(
"FullNames", String.Empty);
69 foreach (
string strl
in conf_str.Split(
',')) {
70 string strlan = strl.Trim(
" \t".ToCharArray());
71 m_log.DebugFormat(
"[GODNAMES]: Adding {0} as a God name", strlan);
72 m_fullNames.Add(strlan);
75 conf_str = moduleConfig.GetString(
"Surnames", String.Empty);
76 foreach (
string strl
in conf_str.Split(
',')) {
77 string strlan = strl.Trim(
" \t".ToCharArray());
78 m_log.DebugFormat(
"[GODNAMES]: Adding {0} as a God last name", strlan);
79 m_lastNames.Add(strlan);
99 public Type ReplaceableInterface {
104 get {
return "Godnames"; }
107 public bool IsSharedModule {
118 if (featuresModule != null)
119 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
123 private void OnSimulatorFeaturesRequest(UUID agentID, ref
OSDMap features)
126 if (features.ContainsKey(
"god_names"))
127 namesmap = features[
"god_names"];
129 features[
"god_names"] = namesmap;
132 foreach (
string name
in m_fullNames) {
135 ((
OSDMap)namesmap)[
"full_names"] = fnames;
138 foreach (
string name
in m_lastNames) {
141 ((
OSDMap)namesmap)[
"last_names"] = lnames;
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
OpenMetaverse.StructuredData.OSDArray OSDArray
OpenMetaverse.StructuredData.OSDMap OSDMap
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures ca...
virtual void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
OpenMetaverse.StructuredData.OSD OSD
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...