aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2007-12-01 14:20:37 +0000
committerMW2007-12-01 14:20:37 +0000
commit27f182ac54ffee16da730b2053480944f9ca5412 (patch)
tree86b7188f3d05afd3753d833a2000827a623e0b55 /OpenSim/Region/Environment
parentset svn:eol-style (diff)
downloadopensim-SC-27f182ac54ffee16da730b2053480944f9ca5412.zip
opensim-SC-27f182ac54ffee16da730b2053480944f9ca5412.tar.gz
opensim-SC-27f182ac54ffee16da730b2053480944f9ca5412.tar.bz2
opensim-SC-27f182ac54ffee16da730b2053480944f9ca5412.tar.xz
Part 1 of a commit. This revision will not compile, part 2 will be added in a couple of minutes that should fix that.
Some work towards persisting Avatar Appearance (what is being worn). Added OnAvatarNowWearing event to IClientAPI that is triggered by AgentIsNowWearing packets. stub code to subscribe to this event in AvatarFactoryModule. Todo: code needs to be added to AvatarFactoryModule to save the uuids to a database and then read them back when that modules TryGetIntialAvatarAppearance() method is called. Done some changes to Scene to make it easier to subclass it: including changed some private fields to protected and made some methods virtual.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs46
3 files changed, 58 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 4bb0638..d8a90c5 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -1,3 +1,4 @@
1using System;
1using libsecondlife; 2using libsecondlife;
2using Nini.Config; 3using Nini.Config;
3using OpenSim.Framework; 4using OpenSim.Framework;
@@ -8,6 +9,8 @@ namespace OpenSim.Region.Environment.Modules
8{ 9{
9 public class AvatarFactoryModule : IAvatarFactory 10 public class AvatarFactoryModule : IAvatarFactory
10 { 11 {
12 private Scene m_scene = null;
13
11 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, 14 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
12 out byte[] visualParams) 15 out byte[] visualParams)
13 { 16 {
@@ -18,6 +21,12 @@ namespace OpenSim.Region.Environment.Modules
18 public void Initialise(Scene scene, IConfigSource source) 21 public void Initialise(Scene scene, IConfigSource source)
19 { 22 {
20 scene.RegisterModuleInterface<IAvatarFactory>(this); 23 scene.RegisterModuleInterface<IAvatarFactory>(this);
24 // scene.EventManager.OnNewClient += NewClient;
25
26 if (m_scene == null)
27 {
28 m_scene = scene;
29 }
21 } 30 }
22 31
23 public void PostInitialise() 32 public void PostInitialise()
@@ -38,6 +47,27 @@ namespace OpenSim.Region.Environment.Modules
38 get { return true; } 47 get { return true; }
39 } 48 }
40 49
50 public void NewClient(IClientAPI client)
51 {
52 // client.OnAvatarNowWearing += AvatarIsWearing;
53 }
54
55 public void RemoveClient(IClientAPI client)
56 {
57 // client.OnAvatarNowWearing -= AvatarIsWearing;
58 }
59
60 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
61 {
62 IClientAPI clientView = (IClientAPI) sender;
63 //Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
64 // then store assetid and itemId and wearable type in a database
65 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
66 {
67 LLUUID assetID = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId).RootFolder.HasItem(wear.ItemID).assetID;
68 }
69 }
70
41 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 71 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
42 { 72 {
43 visualParams = new byte[218]; 73 visualParams = new byte[218];
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 877bfe5..5b6b9cb 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -362,7 +362,7 @@ namespace OpenSim.Region.Environment.Scenes
362 /// </summary> 362 /// </summary>
363 /// <param name="packet"></param> 363 /// <param name="packet"></param>
364 /// <param name="simClient"></param> 364 /// <param name="simClient"></param>
365 public void DeRezObject(Packet packet, IClientAPI remoteClient) 365 public virtual void DeRezObject(Packet packet, IClientAPI remoteClient)
366 { 366 {
367 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; 367 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
368 368
@@ -443,7 +443,7 @@ namespace OpenSim.Region.Environment.Scenes
443 group.DeleteParts(); 443 group.DeleteParts();
444 } 444 }
445 445
446 public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) 446 public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
447 { 447 {
448 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); 448 CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
449 if (userInfo != null) 449 if (userInfo != null)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f2eb486..39f1620 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -96,11 +96,11 @@ namespace OpenSim.Region.Environment.Scenes
96 96
97 public IXfer XferManager; 97 public IXfer XferManager;
98 98
99 private IHttpRequests m_httpRequestModule; 99 protected IHttpRequests m_httpRequestModule;
100 private ISimChat m_simChatModule; 100 protected ISimChat m_simChatModule;
101 private IXMLRPC m_xmlrpcModule; 101 protected IXMLRPC m_xmlrpcModule;
102 private IWorldComm m_worldCommModule; 102 protected IWorldComm m_worldCommModule;
103 private IAvatarFactory m_AvatarFactory; 103 protected IAvatarFactory m_AvatarFactory;
104 104
105 // Central Update Loop 105 // Central Update Loop
106 106
@@ -128,14 +128,14 @@ namespace OpenSim.Region.Environment.Scenes
128 get { return m_authenticateHandler; } 128 get { return m_authenticateHandler; }
129 } 129 }
130 130
131 private readonly LandManager m_LandManager; 131 protected readonly LandManager m_LandManager;
132 132
133 public LandManager LandManager 133 public LandManager LandManager
134 { 134 {
135 get { return m_LandManager; } 135 get { return m_LandManager; }
136 } 136 }
137 137
138 private readonly EstateManager m_estateManager; 138 protected readonly EstateManager m_estateManager;
139 139
140 public PhysicsScene PhysicsScene 140 public PhysicsScene PhysicsScene
141 { 141 {
@@ -158,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
158 get { return m_timedilation; } 158 get { return m_timedilation; }
159 } 159 }
160 160
161 private readonly PermissionManager m_permissionManager; 161 protected readonly PermissionManager m_permissionManager;
162 162
163 public PermissionManager PermissionsMngr 163 public PermissionManager PermissionsMngr
164 { 164 {
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes
267 267
268 public override bool OtherRegionUp(RegionInfo otherRegion) 268 public override bool OtherRegionUp(RegionInfo otherRegion)
269 { 269 {
270 // Another region is up. We have to tell all our ScenePresences about it 270 /* // Another region is up. We have to tell all our ScenePresences about it
271 // This fails to get the desired effect and needs further work. 271 // This fails to get the desired effect and needs further work.
272 272
273 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 273 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
@@ -289,7 +289,7 @@ namespace OpenSim.Region.Environment.Scenes
289 MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client"); 289 MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client");
290 } 290 }
291 291
292 } 292 }*/
293 return true; 293 return true;
294 } 294 }
295 295
@@ -366,7 +366,7 @@ namespace OpenSim.Region.Environment.Scenes
366 } 366 }
367 } 367 }
368 // Reset list to nothing. 368 // Reset list to nothing.
369 m_regionRestartNotifyList = new List<RegionInfo>(); 369 m_regionRestartNotifyList.Clear();
370 } 370 }
371 371
372 public override void Close() 372 public override void Close()
@@ -397,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
397 m_innerScene.Close(); 397 m_innerScene.Close();
398 UnRegisterReginWithComms(); 398 UnRegisterReginWithComms();
399 399
400 foreach (IRegionModule module in this.Modules.Values) 400 foreach (IRegionModule module in Modules.Values)
401 { 401 {
402 if (!module.IsSharedModule) 402 if (!module.IsSharedModule)
403 { 403 {
@@ -427,6 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
427 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); 427 m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
428 m_worldCommModule = RequestModuleInterface<IWorldComm>(); 428 m_worldCommModule = RequestModuleInterface<IWorldComm>();
429 XferManager = RequestModuleInterface<IXfer>(); 429 XferManager = RequestModuleInterface<IXfer>();
430 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
430 } 431 }
431 432
432 #endregion 433 #endregion
@@ -792,7 +793,7 @@ namespace OpenSim.Region.Environment.Scenes
792 /// </summary> 793 /// </summary>
793 /// <param name="addPacket"></param> 794 /// <param name="addPacket"></param>
794 /// <param name="ownerID"></param> 795 /// <param name="ownerID"></param>
795 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) 796 public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
796 { 797 {
797 798
798 // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision 799 // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
@@ -1015,18 +1016,13 @@ namespace OpenSim.Region.Environment.Scenes
1015 EventManager.TriggerOnNewClient(client); 1016 EventManager.TriggerOnNewClient(client);
1016 } 1017 }
1017 1018
1018 protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 1019 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
1019 { 1020 {
1020 ScenePresence avatar = null; 1021 ScenePresence avatar = null;
1021 1022
1022 byte[] visualParams; 1023 byte[] visualParams;
1023 AvatarWearable[] wearables; 1024 AvatarWearable[] wearables;
1024 1025 LoadAvatarAppearance(client, out visualParams, out wearables);
1025 if (m_AvatarFactory == null ||
1026 !m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
1027 {
1028 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
1029 }
1030 1026
1031 avatar = m_innerScene.CreateAndAddScenePresence(client, child, wearables, visualParams); 1027 avatar = m_innerScene.CreateAndAddScenePresence(client, child, wearables, visualParams);
1032 1028
@@ -1038,6 +1034,15 @@ namespace OpenSim.Region.Environment.Scenes
1038 return avatar; 1034 return avatar;
1039 } 1035 }
1040 1036
1037 protected void LoadAvatarAppearance(IClientAPI client, out byte[] visualParams, out AvatarWearable[] wearables)
1038 {
1039 if (m_AvatarFactory == null ||
1040 !m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
1041 {
1042 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
1043 }
1044 }
1045
1041 1046
1042 /// <summary> 1047 /// <summary>
1043 /// 1048 ///
@@ -1145,6 +1150,7 @@ namespace OpenSim.Region.Environment.Scenes
1145 m_sceneGridService.KillObject = SendKillObject; 1150 m_sceneGridService.KillObject = SendKillObject;
1146 } 1151 }
1147 1152
1153
1148 public void UnRegisterReginWithComms() 1154 public void UnRegisterReginWithComms()
1149 { 1155 {
1150 m_sceneGridService.OnRegionUp -= OtherRegionUp; 1156 m_sceneGridService.OnRegionUp -= OtherRegionUp;