diff options
author | Dan Lake | 2013-07-16 17:43:36 -0700 |
---|---|---|
committer | Dan Lake | 2013-07-16 17:43:36 -0700 |
commit | 9f129938c9c75bb4513b0b93248985100fe0e921 (patch) | |
tree | 14bcfffa6291b945dfdb3542568b385b5a8f4046 /OpenSim/Region | |
parent | Deleted a couple of verbose messages (diff) | |
download | opensim-SC_OLD-9f129938c9c75bb4513b0b93248985100fe0e921.zip opensim-SC_OLD-9f129938c9c75bb4513b0b93248985100fe0e921.tar.gz opensim-SC_OLD-9f129938c9c75bb4513b0b93248985100fe0e921.tar.bz2 opensim-SC_OLD-9f129938c9c75bb4513b0b93248985100fe0e921.tar.xz |
Attachments module only registers when enabled. This enables alternative attachments module implementations. All calls to Scene.AttachmentsModule are checking for null. Ideally, if we support disabling attachments then we need a null attachments module to register with the scene.
Diffstat (limited to 'OpenSim/Region')
3 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f69ec21..2f5a76f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -74,10 +74,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
74 | public void AddRegion(Scene scene) | 74 | public void AddRegion(Scene scene) |
75 | { | 75 | { |
76 | m_scene = scene; | 76 | m_scene = scene; |
77 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | ||
78 | |||
79 | if (Enabled) | 77 | if (Enabled) |
80 | { | 78 | { |
79 | // Only register module with scene if it is enabled. All callers check for a null attachments module. | ||
80 | // Ideally, there should be a null attachments module for when this core attachments module has been | ||
81 | // disabled. Registering only when enabled allows for other attachments module implementations. | ||
82 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | ||
81 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 83 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
82 | m_scene.EventManager.OnStartScript += (localID, itemID) => HandleScriptStateChange(localID, true); | 84 | m_scene.EventManager.OnStartScript += (localID, itemID) => HandleScriptStateChange(localID, true); |
83 | m_scene.EventManager.OnStopScript += (localID, itemID) => HandleScriptStateChange(localID, false); | 85 | m_scene.EventManager.OnStopScript += (localID, itemID) => HandleScriptStateChange(localID, false); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 7d46d92..69189b3 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -116,7 +116,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
116 | return false; | 116 | return false; |
117 | 117 | ||
118 | // Delete existing npc attachments | 118 | // Delete existing npc attachments |
119 | scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); | 119 | if(scene.AttachmentsModule != null) |
120 | scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); | ||
120 | 121 | ||
121 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet | 122 | // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet |
122 | // since it doesn't transfer attachments | 123 | // since it doesn't transfer attachments |
@@ -125,7 +126,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
125 | npc.Appearance = npcAppearance; | 126 | npc.Appearance = npcAppearance; |
126 | 127 | ||
127 | // Rez needed npc attachments | 128 | // Rez needed npc attachments |
128 | scene.AttachmentsModule.RezAttachments(npc); | 129 | if (scene.AttachmentsModule != null) |
130 | scene.AttachmentsModule.RezAttachments(npc); | ||
129 | 131 | ||
130 | IAvatarFactoryModule module = | 132 | IAvatarFactoryModule module = |
131 | scene.RequestModuleInterface<IAvatarFactoryModule>(); | 133 | scene.RequestModuleInterface<IAvatarFactoryModule>(); |
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs index f424e7f..83732e2 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs | |||
@@ -51,7 +51,8 @@ namespace OpenSim.Region.RegionCombinerModule | |||
51 | m_virtScene.UnSubscribeToClientPrimEvents(client); | 51 | m_virtScene.UnSubscribeToClientPrimEvents(client); |
52 | m_virtScene.UnSubscribeToClientPrimRezEvents(client); | 52 | m_virtScene.UnSubscribeToClientPrimRezEvents(client); |
53 | m_virtScene.UnSubscribeToClientInventoryEvents(client); | 53 | m_virtScene.UnSubscribeToClientInventoryEvents(client); |
54 | ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); | 54 | if(m_virtScene.AttachmentsModule != null) |
55 | ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); | ||
55 | //m_virtScene.UnSubscribeToClientTeleportEvents(client); | 56 | //m_virtScene.UnSubscribeToClientTeleportEvents(client); |
56 | m_virtScene.UnSubscribeToClientScriptEvents(client); | 57 | m_virtScene.UnSubscribeToClientScriptEvents(client); |
57 | 58 | ||
@@ -66,7 +67,8 @@ namespace OpenSim.Region.RegionCombinerModule | |||
66 | client.OnRezObject += LocalRezObject; | 67 | client.OnRezObject += LocalRezObject; |
67 | 68 | ||
68 | m_rootScene.SubscribeToClientInventoryEvents(client); | 69 | m_rootScene.SubscribeToClientInventoryEvents(client); |
69 | ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); | 70 | if (m_rootScene.AttachmentsModule != null) |
71 | ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); | ||
70 | //m_rootScene.SubscribeToClientTeleportEvents(client); | 72 | //m_rootScene.SubscribeToClientTeleportEvents(client); |
71 | m_rootScene.SubscribeToClientScriptEvents(client); | 73 | m_rootScene.SubscribeToClientScriptEvents(client); |
72 | 74 | ||