30 using System.Reflection;
32 using System.Collections.Generic;
33 using System.Threading;
36 using OpenMetaverse.StructuredData;
39 using OpenSim.Region.Framework;
40 using OpenSim.Region.Framework.Scenes;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Framework;
44 using OpenSim.Framework.Servers;
45 using OpenSim.Framework.Servers.HttpServer;
54 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"CameraOnlyMode")]
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 private Scene m_scene;
61 private bool m_Enabled;
62 private int m_UserLevel;
66 get {
return "CameraOnlyModeModule"; }
69 public Type ReplaceableInterface
76 IConfig moduleConfig = config.Configs[
"CameraOnlyModeModule"];
77 if (moduleConfig != null)
79 m_Enabled = moduleConfig.GetBoolean(
"enabled",
false);
82 m_UserLevel = moduleConfig.GetInt(
"UserLevel", 0);
83 m_log.Info(
"[CAMERA-ONLY MODE]: CameraOnlyModeModule enabled");
115 if (featuresModule != null)
116 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
124 private void OnSimulatorFeaturesRequest(UUID agentID, ref
OSDMap features)
126 m_log.DebugFormat(
"[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
127 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
130 if (features.ContainsKey(
"OpenSimExtras"))
132 extrasMap = (
OSDMap)features[
"OpenSimExtras"];
137 features[
"OpenSimExtras"] = extrasMap;
139 extrasMap[
"camera-only-mode"] = OSDMap.FromString(
"true");
140 m_log.DebugFormat(
"[CAMERA-ONLY MODE]: Sent in {0}", m_scene.RegionInfo.RegionName);
147 m_log.DebugFormat(
"[CAMERA-ONLY MODE]: NOT Sending camera-only-mode in {0}", m_scene.RegionInfo.RegionName);
150 private void DetachAttachments(UUID agentID)
158 if (sp != null && m_scene.AttachmentsModule != null)
160 List<SceneObjectGroup> attachs = sp.GetAttachments();
161 if (attachs != null && attachs.Count > 0)
165 m_log.DebugFormat(
"[CAMERA-ONLY MODE]: Forcibly detaching attach {0} from {1} in {2}",
166 sog.Name, sp.Name, m_scene.RegionInfo.RegionName);
168 m_scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, sog);
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
OpenMetaverse.StructuredData.OSDMap OSDMap
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures ca...
OpenMetaverse.StructuredData.OSDMap OSDMap
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
Interactive OpenSim region server
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
TeleportFlags TeleportFlags
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...