aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorlbsa712007-09-21 05:23:17 +0000
committerlbsa712007-09-21 05:23:17 +0000
commit5fab795bf0fd3fe794e4635fc28b295963cfbb9e (patch)
treef2e344108680b593b53d00b5e183f1641e20c1ed /OpenSim/Region
parent* Removed unused RegenerateTerrain functions (diff)
downloadopensim-SC-5fab795bf0fd3fe794e4635fc28b295963cfbb9e.zip
opensim-SC-5fab795bf0fd3fe794e4635fc28b295963cfbb9e.tar.gz
opensim-SC-5fab795bf0fd3fe794e4635fc28b295963cfbb9e.tar.bz2
opensim-SC-5fab795bf0fd3fe794e4635fc28b295963cfbb9e.tar.xz
* Continued work on Region layer
* Added Close() to ScenePresence to remove and destroy PhysicsActor
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs29
-rw-r--r--OpenSim/Region/Environment/Regions/Region.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs26
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs4
5 files changed, 59 insertions, 45 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index ac710ad..97e25d5 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -216,14 +216,14 @@ namespace OpenSim.Region.Environment
216 216
217 int tempMaxAgents = 217 int tempMaxAgents =
218 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); 218 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
219 m_regInfo.estateSettings.maxAgents = (byte) tempMaxAgents; 219 m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
220 220
221 float tempObjectBonusFactor = 221 float tempObjectBonusFactor =
222 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 222 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
223 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; 223 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
224 224
225 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); 225 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
226 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel; 226 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
227 227
228 228
229 if (convertParamStringToBool(packet.ParamList[7].Parameter)) 229 if (convertParamStringToBool(packet.ParamList[7].Parameter))
@@ -250,13 +250,13 @@ namespace OpenSim.Region.Environment
250 } 250 }
251 else 251 else
252 { 252 {
253 float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 253 float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
254 float TerrainRaiseLimit = 254 float TerrainRaiseLimit =
255 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 255 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
256 float TerrainLowerLimit = 256 float TerrainLowerLimit =
257 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 257 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
258 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); 258 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
259 float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 259 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
260 260
261 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); 261 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
262 262
@@ -273,8 +273,8 @@ namespace OpenSim.Region.Environment
273 if (splitField.Length == 3) 273 if (splitField.Length == 3)
274 { 274 {
275 Int16 corner = Convert.ToInt16(splitField[0]); 275 Int16 corner = Convert.ToInt16(splitField[0]);
276 float lowValue = (float) Convert.ToDecimal(splitField[1]); 276 float lowValue = (float)Convert.ToDecimal(splitField[1]);
277 float highValue = (float) Convert.ToDecimal(splitField[2]); 277 float highValue = (float)Convert.ToDecimal(splitField[2]);
278 278
279 setEstateTextureRange(corner, lowValue, highValue); 279 setEstateTextureRange(corner, lowValue, highValue);
280 } 280 }
@@ -341,10 +341,9 @@ namespace OpenSim.Region.Environment
341 341
342 public void sendRegionHandshakeToAll() 342 public void sendRegionHandshakeToAll()
343 { 343 {
344 m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence ) 344 m_scene.Broadcast(
345 { 345 sendRegionHandshake
346 sendRegionHandshake(scenePresence.ControllingClient); 346 );
347 });
348 } 347 }
349 348
350 public void sendRegionInfoPacket(IClientAPI remote_client) 349 public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -364,8 +363,8 @@ namespace OpenSim.Region.Environment
364 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; 363 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
365 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; 364 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
366 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; 365 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
367 regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags; 366 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
368 regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess; 367 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
369 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); 368 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
370 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; 369 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
371 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; 370 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
diff --git a/OpenSim/Region/Environment/Regions/Region.cs b/OpenSim/Region/Environment/Regions/Region.cs
index e95d9dc..536fed7 100644
--- a/OpenSim/Region/Environment/Regions/Region.cs
+++ b/OpenSim/Region/Environment/Regions/Region.cs
@@ -40,5 +40,10 @@ namespace OpenSim.Region.Environment.Regions
40 whatToDo(subscription.Client); 40 whatToDo(subscription.Client);
41 } 41 }
42 } 42 }
43
44 internal void Remove(LLUUID agentID)
45 {
46 // TODO : Well, remove it!
47 }
43 } 48 }
44} 49}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 1e19c30..ab52ebf 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.Environment.Scenes
307 307
308 float[] terData = Terrain.GetHeights1D(); 308 float[] terData = Terrain.GetHeights1D();
309 309
310 Broadcast( delegate( IClientAPI client ) 310 Broadcast(delegate(IClientAPI client)
311 { 311 {
312 for (int x = 0; x < 16; x++) 312 for (int x = 0; x < 16; x++)
313 { 313 {
@@ -321,7 +321,7 @@ namespace OpenSim.Region.Environment.Scenes
321 } 321 }
322 }); 322 });
323 323
324 324
325 325
326 Terrain.ResetTaint(); 326 Terrain.ResetTaint();
327 } 327 }
@@ -369,7 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
369 369
370 internal void Broadcast(Action<IClientAPI> whatToDo) 370 internal void Broadcast(Action<IClientAPI> whatToDo)
371 { 371 {
372 m_region.Broadcast( whatToDo ); 372 m_region.Broadcast(whatToDo);
373 } 373 }
374 /// <summary> 374 /// <summary>
375 /// 375 ///
@@ -641,6 +641,7 @@ namespace OpenSim.Region.Environment.Scenes
641 public override void AddNewClient(IClientAPI client, bool child) 641 public override void AddNewClient(IClientAPI client, bool child)
642 { 642 {
643 SubscribeToClientEvents(client); 643 SubscribeToClientEvents(client);
644
644 m_estateManager.sendRegionHandshake(client); 645 m_estateManager.sendRegionHandshake(client);
645 646
646 CreateAndAddScenePresence(client, child); 647 CreateAndAddScenePresence(client, child);
@@ -769,33 +770,34 @@ namespace OpenSim.Region.Environment.Scenes
769 770
770 ScenePresence avatar = GetScenePresence(agentID); 771 ScenePresence avatar = GetScenePresence(agentID);
771 772
773 Broadcast(delegate(IClientAPI client)
774 {
775 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
776 });
777
778
772 ForEachScenePresence( 779 ForEachScenePresence(
773 delegate(ScenePresence presence) 780 delegate(ScenePresence presence)
774 { 781 {
775 presence.CoarseLocationChange(avatar); 782 presence.CoarseLocationChange();
776 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
777 if (presence.PhysicsActor != null)
778 {
779 phyScene.RemoveAvatar(presence.PhysicsActor);
780 presence.PhysicsActor = null;
781 }
782 }); 783 });
783 784
784 lock (m_scenePresences) 785 lock (m_scenePresences)
785 { 786 {
786 if (m_scenePresences.ContainsKey(agentID)) 787 m_scenePresences.Remove(agentID);
787 { 788 }
788 m_scenePresences.Remove(agentID); 789
789 } 790 lock (m_region)
791 {
792 m_region.Remove(agentID);
790 } 793 }
794
791 lock (Entities) 795 lock (Entities)
792 { 796 {
793 if (Entities.ContainsKey(agentID)) 797 Entities.Remove(agentID);
794 {
795 Entities.Remove(agentID);
796 }
797 } 798 }
798 // TODO: Add the removal from physics ? 799
800 avatar.Close();
799 801
800 // Remove client agent from profile, so new logins will work 802 // Remove client agent from profile, so new logins will work
801 commsManager.UserServer.clearUserAgent(agentID); 803 commsManager.UserServer.clearUserAgent(agentID);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index e8f29c8..168a60e 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -45,20 +45,19 @@ namespace OpenSim.Region.Environment.Scenes
45 public void LoadAnims() 45 public void LoadAnims()
46 { 46 {
47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); 47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
48 XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); 48 using( XmlTextReader reader = new XmlTextReader("data/avataranimations.xml") )
49
50 XmlDocument doc = new XmlDocument();
51 doc.Load(reader);
52 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
53 { 49 {
54 if (nod.Attributes["name"] != null) 50 XmlDocument doc = new XmlDocument();
51 doc.Load(reader);
52 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
55 { 53 {
56 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); 54 if (nod.Attributes["name"] != null)
55 {
56 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
57 }
57 } 58 }
58 } 59 }
59 60
60 reader.Close();
61
62 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); 61 // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
63 62
64 foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID) 63 foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID)
@@ -67,5 +66,14 @@ namespace OpenSim.Region.Environment.Scenes
67 } 66 }
68 } 67 }
69 } 68 }
69
70 internal void Close()
71 {
72 if (m_physicsActor != null)
73 {
74 m_scene.PhysScene.RemoveAvatar( PhysicsActor );
75 m_physicsActor = null;
76 }
77 }
70 } 78 }
71} \ No newline at end of file 79} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 9b5aa99..cee93b2 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -627,7 +627,7 @@ namespace OpenSim.Region.Environment.Scenes
627 m_controllingClient.SendCoarseLocationUpdate(CoarseLocations); 627 m_controllingClient.SendCoarseLocationUpdate(CoarseLocations);
628 } 628 }
629 629
630 public void CoarseLocationChange(ScenePresence avatar) 630 public void CoarseLocationChange()
631 { 631 {
632 newCoarseLocations = true; 632 newCoarseLocations = true;
633 } 633 }
@@ -638,7 +638,7 @@ namespace OpenSim.Region.Environment.Scenes
638 { 638 {
639 if (presence != this) 639 if (presence != this)
640 { 640 {
641 presence.CoarseLocationChange(this); 641 presence.CoarseLocationChange();
642 } 642 }
643 }); 643 });
644 } 644 }