diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 66 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/EstateStore.migrations | 21 | ||||
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 150 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | 111 |
6 files changed, 341 insertions, 71 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 3d647ca..a357268 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -157,6 +157,7 @@ namespace OpenSim.Data.MySQL | |||
157 | DoCreate(es); | 157 | DoCreate(es); |
158 | 158 | ||
159 | LoadBanList(es); | 159 | LoadBanList(es); |
160 | LoadSpawnPoints(es); | ||
160 | 161 | ||
161 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | 162 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); |
162 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | 163 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); |
@@ -210,7 +211,7 @@ namespace OpenSim.Data.MySQL | |||
210 | } | 211 | } |
211 | 212 | ||
212 | LoadBanList(es); | 213 | LoadBanList(es); |
213 | 214 | LoadSpawnPoints(es); | |
214 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | 215 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); |
215 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | 216 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); |
216 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | 217 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); |
@@ -297,11 +298,74 @@ namespace OpenSim.Data.MySQL | |||
297 | } | 298 | } |
298 | 299 | ||
299 | SaveBanList(es); | 300 | SaveBanList(es); |
301 | SaveSpawnPoints(es); | ||
300 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); | 302 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); |
301 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); | 303 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); |
302 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); | 304 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); |
303 | } | 305 | } |
304 | 306 | ||
307 | private void LoadSpawnPoints(EstateSettings es) | ||
308 | { | ||
309 | es.ClearSpawnPoints(); | ||
310 | |||
311 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
312 | { | ||
313 | dbcon.Open(); | ||
314 | |||
315 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
316 | { | ||
317 | uint EstateID = es.EstateID; | ||
318 | cmd.CommandText = "select PointX, PointY, PointZ from spawn_points where EstateID = ?EstateID"; | ||
319 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID); | ||
320 | |||
321 | using (IDataReader r = cmd.ExecuteReader()) | ||
322 | { | ||
323 | while (r.Read()) | ||
324 | { | ||
325 | Vector3 point = new Vector3(); | ||
326 | |||
327 | point.X = (float)r["PointX"]; | ||
328 | point.Y = (float)r["PointY"]; | ||
329 | point.Z = (float)r["PointZ"]; | ||
330 | |||
331 | es.AddSpawnPoint(point); | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | |||
338 | private void SaveSpawnPoints(EstateSettings es) | ||
339 | { | ||
340 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
341 | { | ||
342 | dbcon.Open(); | ||
343 | |||
344 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
345 | { | ||
346 | cmd.CommandText = "delete from spawn_points where EstateID = ?EstateID"; | ||
347 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | ||
348 | |||
349 | cmd.ExecuteNonQuery(); | ||
350 | |||
351 | cmd.Parameters.Clear(); | ||
352 | |||
353 | cmd.CommandText = "insert into spawn_points (EstateID, PointX, PointY, PointZ) values ( ?EstateID, ?PointX, ?PointY,?PointZ)"; | ||
354 | |||
355 | foreach (Vector3 p in es.SpawnPoints()) | ||
356 | { | ||
357 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | ||
358 | cmd.Parameters.AddWithValue("?PointX", p.X); | ||
359 | cmd.Parameters.AddWithValue("?PointY", p.Y); | ||
360 | cmd.Parameters.AddWithValue("?PointZ", p.Z); | ||
361 | |||
362 | cmd.ExecuteNonQuery(); | ||
363 | cmd.Parameters.Clear(); | ||
364 | } | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
305 | private void LoadBanList(EstateSettings es) | 369 | private void LoadBanList(EstateSettings es) |
306 | { | 370 | { |
307 | es.ClearBans(); | 371 | es.ClearBans(); |
diff --git a/OpenSim/Data/MySQL/Resources/EstateStore.migrations b/OpenSim/Data/MySQL/Resources/EstateStore.migrations index df82a2e..591295b 100644 --- a/OpenSim/Data/MySQL/Resources/EstateStore.migrations +++ b/OpenSim/Data/MySQL/Resources/EstateStore.migrations | |||
@@ -78,4 +78,25 @@ ALTER TABLE estate_settings AUTO_INCREMENT = 100; | |||
78 | COMMIT; | 78 | COMMIT; |
79 | 79 | ||
80 | 80 | ||
81 | :VERSION 33 #--------------------- ( Supporting Telehubs | ||
81 | 82 | ||
83 | BEGIN; | ||
84 | CREATE TABLE IF NOT EXISTS `spawn_points` ( | ||
85 | `EstateID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, | ||
86 | `PointX` float NOT NULL, | ||
87 | `PointY` float NOT NULL, | ||
88 | `PointZ` float NOT NULL, | ||
89 | KEY `EstateID` (`EstateID`) | ||
90 | ) ENGINE=Innodb; | ||
91 | |||
92 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; | ||
93 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubName` varchar(255) NOT NULL; | ||
94 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubEnabled` tinyint(4) NOT NULL; | ||
95 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosX` float NOT NULL; | ||
96 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosY` float NOT NULL; | ||
97 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubPosZ` float NOT NULL; | ||
98 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotX` float NOT NULL; | ||
99 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotY` float NOT NULL; | ||
100 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotZ` float NOT NULL; | ||
101 | ALTER TABLE `estate_settings` ADD COLUMN `TelehubRotW` float NOT NULL; | ||
102 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..9bdeab8 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -373,5 +373,155 @@ namespace OpenSim.Framework | |||
373 | 373 | ||
374 | return l_EstateAccess.Contains(user); | 374 | return l_EstateAccess.Contains(user); |
375 | } | 375 | } |
376 | |||
377 | // Telehub support | ||
378 | private bool m_TelehubEnabled = false; | ||
379 | public bool HasTelehub | ||
380 | { | ||
381 | get { return m_TelehubEnabled; } | ||
382 | set { m_TelehubEnabled = value; } | ||
383 | } | ||
384 | |||
385 | // Connected Telehub object | ||
386 | private UUID m_TelehubObject; | ||
387 | public UUID TelehubObject | ||
388 | { | ||
389 | get | ||
390 | { | ||
391 | if (HasTelehub) | ||
392 | { | ||
393 | return m_TelehubObject; | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | return UUID.Zero; | ||
398 | } | ||
399 | } | ||
400 | set | ||
401 | { | ||
402 | m_TelehubObject = value; | ||
403 | } | ||
404 | } | ||
405 | |||
406 | // Connected Telehub name | ||
407 | private string m_TelehubName; | ||
408 | public string TelehubName | ||
409 | { | ||
410 | get | ||
411 | { | ||
412 | if (HasTelehub) | ||
413 | { | ||
414 | return m_TelehubName; | ||
415 | } | ||
416 | else | ||
417 | { | ||
418 | return String.Empty; | ||
419 | } | ||
420 | } | ||
421 | set | ||
422 | { | ||
423 | m_TelehubName = value; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | // Connected Telehub position | ||
428 | private float m_TelehubPosX; | ||
429 | private float m_TelehubPosY; | ||
430 | private float m_TelehubPosZ; | ||
431 | public Vector3 TelehubPos | ||
432 | { | ||
433 | get | ||
434 | { | ||
435 | if (HasTelehub) | ||
436 | { | ||
437 | Vector3 Pos = new Vector3(m_TelehubPosX, m_TelehubPosY, m_TelehubPosZ); | ||
438 | return Pos; | ||
439 | } | ||
440 | else | ||
441 | { | ||
442 | return Vector3.Zero; | ||
443 | } | ||
444 | } | ||
445 | set | ||
446 | { | ||
447 | |||
448 | m_TelehubPosX = value.X; | ||
449 | m_TelehubPosY = value.Y; | ||
450 | m_TelehubPosZ = value.Z; | ||
451 | } | ||
452 | } | ||
453 | |||
454 | // Connected Telehub rotation | ||
455 | private float m_TelehubRotX; | ||
456 | private float m_TelehubRotY; | ||
457 | private float m_TelehubRotZ; | ||
458 | private float m_TelehubRotW; | ||
459 | public Quaternion TelehubRot | ||
460 | { | ||
461 | get | ||
462 | { | ||
463 | if (HasTelehub) | ||
464 | { | ||
465 | Quaternion quat = new Quaternion(); | ||
466 | |||
467 | quat.X = m_TelehubRotX; | ||
468 | quat.Y = m_TelehubRotY; | ||
469 | quat.Z = m_TelehubRotZ; | ||
470 | quat.W = m_TelehubRotW; | ||
471 | |||
472 | return quat; | ||
473 | } | ||
474 | else | ||
475 | { | ||
476 | // What else to do?? | ||
477 | Quaternion quat = new Quaternion(); | ||
478 | |||
479 | quat.X = m_TelehubRotX; | ||
480 | quat.X = m_TelehubRotY; | ||
481 | quat.X = m_TelehubRotZ; | ||
482 | quat.X = m_TelehubRotW; | ||
483 | |||
484 | return quat; | ||
485 | } | ||
486 | } | ||
487 | set | ||
488 | { | ||
489 | m_TelehubRotX = value.X; | ||
490 | m_TelehubRotY = value.Y; | ||
491 | m_TelehubRotZ = value.Z; | ||
492 | m_TelehubRotW = value.W; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | // Our Connected Telehub's SpawnPoints | ||
497 | public List<Vector3> l_SpawnPoints = new List<Vector3>(); | ||
498 | |||
499 | // Add a SpawnPoint | ||
500 | // ** These are not region coordinates ** | ||
501 | // They are relative to the Telehub coordinates | ||
502 | // | ||
503 | public void AddSpawnPoint(Vector3 point) | ||
504 | { | ||
505 | l_SpawnPoints.Add(point); | ||
506 | } | ||
507 | |||
508 | // Remove a SpawnPoint | ||
509 | public void RemoveSpawnPoint(int point_index) | ||
510 | { | ||
511 | l_SpawnPoints.RemoveAt(point_index); | ||
512 | } | ||
513 | |||
514 | // Return the List of SpawnPoints | ||
515 | public List<Vector3> SpawnPoints() | ||
516 | { | ||
517 | return l_SpawnPoints; | ||
518 | |||
519 | } | ||
520 | |||
521 | // Clear the SpawnPoints List of all entries | ||
522 | public void ClearSpawnPoints() | ||
523 | { | ||
524 | l_SpawnPoints.Clear(); | ||
525 | } | ||
376 | } | 526 | } |
377 | } | 527 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a94fb20..29ad966 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -9242,10 +9242,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9242 | { | 9242 | { |
9243 | UUID invoice = messagePacket.MethodData.Invoice; | 9243 | UUID invoice = messagePacket.MethodData.Invoice; |
9244 | UUID SenderID = messagePacket.AgentData.AgentID; | 9244 | UUID SenderID = messagePacket.AgentData.AgentID; |
9245 | UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | 9245 | UInt32 param1 = 0u; |
9246 | 9246 | ||
9247 | string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); | 9247 | string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); |
9248 | 9248 | ||
9249 | if (command != "info ui") | ||
9250 | { | ||
9251 | try | ||
9252 | { | ||
9253 | param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
9254 | } | ||
9255 | catch (Exception ex) | ||
9256 | { | ||
9257 | |||
9258 | } | ||
9259 | } | ||
9260 | |||
9249 | EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; | 9261 | EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; |
9250 | if (handlerEstateManageTelehub != null) | 9262 | if (handlerEstateManageTelehub != null) |
9251 | { | 9263 | { |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 0d4df6c..6a02ffe 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
53 | protected EstateManagementCommands m_commands; | 53 | protected EstateManagementCommands m_commands; |
54 | 54 | ||
55 | private EstateTerrainXferHandler TerrainUploader; | 55 | private EstateTerrainXferHandler TerrainUploader; |
56 | private TelehubManager m_Telehub; | 56 | public TelehubManager m_Telehub; |
57 | 57 | ||
58 | public event ChangeDelegate OnRegionInfoChange; | 58 | public event ChangeDelegate OnRegionInfoChange; |
59 | public event ChangeDelegate OnEstateInfoChange; | 59 | public event ChangeDelegate OnEstateInfoChange; |
@@ -600,22 +600,20 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
600 | } | 600 | } |
601 | } | 601 | } |
602 | 602 | ||
603 | private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 603 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |
604 | { | 604 | { |
605 | uint ObjectLocalID; | 605 | uint ObjectLocalID; |
606 | SceneObjectPart part; | 606 | SceneObjectPart part; |
607 | // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
608 | TelehubManager.Telehub telehub; | ||
609 | 607 | ||
610 | switch (cmd) | 608 | switch (cmd) |
611 | { | 609 | { |
612 | case "info ui": | 610 | case "info ui": |
613 | // Send info: | 611 | // Send info: |
614 | if (m_Telehub.HasTelehub) | 612 | if (Scene.RegionInfo.EstateSettings.HasTelehub) |
615 | { | 613 | { |
616 | telehub = m_Telehub.TelehubVals(); | 614 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
617 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 615 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, |
618 | telehub.ObjectRotation, telehub.SpawnPoint); | 616 | settings.TelehubRot, settings.SpawnPoints()); |
619 | } | 617 | } |
620 | else | 618 | else |
621 | { | 619 | { |
@@ -626,32 +624,44 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
626 | case "connect": | 624 | case "connect": |
627 | // Add the Telehub | 625 | // Add the Telehub |
628 | part = Scene.GetSceneObjectPart((uint)param1); | 626 | part = Scene.GetSceneObjectPart((uint)param1); |
629 | telehub = m_Telehub.Connect(part); | 627 | if (m_Telehub.Connect(part)) |
630 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 628 | { |
631 | telehub.ObjectRotation, telehub.SpawnPoint); | 629 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
630 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
631 | settings.TelehubRot, settings.SpawnPoints()); | ||
632 | } | ||
632 | break; | 633 | break; |
633 | 634 | ||
634 | case "delete": | 635 | case "delete": |
635 | // Disconnect Telehub | 636 | // Disconnect Telehub |
636 | part = Scene.GetSceneObjectPart((uint)param1); | 637 | part = Scene.GetSceneObjectPart((uint)param1); |
637 | telehub = m_Telehub.DisConnect(part); | 638 | if (m_Telehub.DisConnect(part)) |
638 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 639 | { |
639 | telehub.ObjectRotation, telehub.SpawnPoint); | 640 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
641 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
642 | settings.TelehubRot, settings.SpawnPoints()); | ||
643 | } | ||
640 | break; | 644 | break; |
641 | 645 | ||
642 | case "spawnpoint add": | 646 | case "spawnpoint add": |
643 | // Add SpawnPoint to the Telehub | 647 | // Add SpawnPoint to the Telehub |
644 | part = Scene.GetSceneObjectPart((uint)param1); | 648 | part = Scene.GetSceneObjectPart((uint)param1); |
645 | telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); | 649 | if( m_Telehub.AddSpawnPoint(part.AbsolutePosition)) |
646 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 650 | { |
647 | telehub.ObjectRotation, telehub.SpawnPoint); | 651 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
652 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
653 | settings.TelehubRot, settings.SpawnPoints()); | ||
654 | } | ||
648 | break; | 655 | break; |
649 | 656 | ||
650 | case "spawnpoint remove": | 657 | case "spawnpoint remove": |
651 | // Remove SpawnPoint from Telehub | 658 | // Remove SpawnPoint from Telehub |
652 | telehub = m_Telehub.RemoveSpawnPoint((int)param1); | 659 | if (m_Telehub.RemoveSpawnPoint((int)param1)) |
653 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | 660 | { |
654 | telehub.ObjectRotation, telehub.SpawnPoint); | 661 | EstateSettings settings = this.Scene.RegionInfo.EstateSettings; |
662 | client.SendTelehubInfo(settings.TelehubObject, settings.TelehubName, settings.TelehubPos, | ||
663 | settings.TelehubRot, settings.SpawnPoints()); | ||
664 | } | ||
655 | break; | 665 | break; |
656 | 666 | ||
657 | default: | 667 | default: |
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs index c99c9ba..309ef13 100644 --- a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs +++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs | |||
@@ -35,14 +35,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
35 | { | 35 | { |
36 | public class TelehubManager | 36 | public class TelehubManager |
37 | { | 37 | { |
38 | public struct Telehub | ||
39 | { | ||
40 | public UUID ObjectID; | ||
41 | public string ObjectName; | ||
42 | public Vector3 ObjectPosition; | ||
43 | public Quaternion ObjectRotation; | ||
44 | public List<Vector3> SpawnPoint; | ||
45 | }; | ||
46 | 38 | ||
47 | private UUID ObjectID; | 39 | private UUID ObjectID; |
48 | private string ObjectName; | 40 | private string ObjectName; |
@@ -52,8 +44,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
52 | UUID EstateID; | 44 | UUID EstateID; |
53 | bool m_HasTelehub = false; | 45 | bool m_HasTelehub = false; |
54 | Scene m_Scene; | 46 | Scene m_Scene; |
47 | EstateSettings m_EstateSettings; | ||
55 | // This will get an option... | 48 | // This will get an option... |
56 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); | 49 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,0.0f); |
57 | 50 | ||
58 | public bool HasTelehub | 51 | public bool HasTelehub |
59 | { | 52 | { |
@@ -63,68 +56,88 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
63 | public TelehubManager(Scene scene) | 56 | public TelehubManager(Scene scene) |
64 | { | 57 | { |
65 | m_Scene = scene; | 58 | m_Scene = scene; |
59 | m_EstateSettings = m_Scene.RegionInfo.EstateSettings; | ||
66 | } | 60 | } |
67 | 61 | ||
68 | // Fill our Telehub struct with values | 62 | // Fill our Telehub struct with values |
69 | public Telehub TelehubVals() | 63 | // public Telehub TelehubVals() |
70 | { | 64 | // { |
71 | Telehub telehub = new Telehub(); | 65 | // // Telehub telehub = new Telehub(); |
72 | 66 | // EstateSettings telehub = m_EstateSettings; | |
73 | telehub.ObjectID = ObjectID; | 67 | // |
74 | telehub.ObjectName = ObjectName; | 68 | // telehub.TelehubObject = ObjectID; |
75 | telehub.ObjectPosition = ObjectPosition; | 69 | // telehub.TelehubName = ObjectName; |
76 | telehub.ObjectRotation = ObjectRotation; | 70 | // telehub.TelehubPos = ObjectPosition; |
77 | telehub.SpawnPoint = SpawnPoint; | 71 | // telehub.TelehubRot = ObjectRotation; |
78 | return telehub; | 72 | // telehub. = SpawnPoint; |
79 | } | 73 | // return telehub; |
74 | // } | ||
80 | 75 | ||
81 | // Connect the Telehub | 76 | // Connect the Telehub |
82 | public Telehub Connect(SceneObjectPart part) | 77 | public bool Connect(SceneObjectPart part) |
83 | { | 78 | { |
84 | ObjectID = part.UUID; | 79 | m_EstateSettings.ClearSpawnPoints(); |
85 | ObjectName = part.Name; | ||
86 | ObjectPosition = part.AbsolutePosition; | ||
87 | ObjectRotation = part.GetWorldRotation(); | ||
88 | // Clear this for now | ||
89 | SpawnPoint.Clear(); | ||
90 | SpawnPoint.Add(InitialSpawnPoint); | ||
91 | m_HasTelehub = true; | ||
92 | 80 | ||
93 | return TelehubVals(); | 81 | m_EstateSettings.TelehubObject = part.UUID; |
82 | m_EstateSettings.TelehubName = part.Name; | ||
83 | m_EstateSettings.TelehubPos = part.AbsolutePosition; | ||
84 | m_EstateSettings.TelehubRot = part.GetWorldRotation(); | ||
85 | |||
86 | // Clear this for now | ||
87 | m_EstateSettings.AddSpawnPoint(InitialSpawnPoint); | ||
88 | m_EstateSettings.HasTelehub = true; | ||
89 | m_EstateSettings.Save(); | ||
90 | return true; | ||
94 | } | 91 | } |
95 | 92 | ||
96 | // Disconnect the Telehub | 93 | // Disconnect the Telehub: Clear it out for now, look at just disableing |
97 | public Telehub DisConnect(SceneObjectPart part) | 94 | public bool DisConnect(SceneObjectPart part) |
98 | { | 95 | { |
99 | ObjectID = UUID.Zero; | 96 | bool result = false; |
100 | ObjectName = String.Empty; | 97 | |
101 | ObjectPosition = Vector3.Zero; | 98 | try{ |
102 | ObjectRotation = Quaternion.Identity; | 99 | m_EstateSettings.TelehubObject = UUID.Zero; |
103 | SpawnPoint.Clear(); | 100 | m_EstateSettings.TelehubName = String.Empty; |
104 | m_HasTelehub = false; | 101 | m_EstateSettings.TelehubPos = Vector3.Zero; |
105 | 102 | // This is probably wrong! But, HasTelehub will block access | |
106 | return TelehubVals(); | 103 | m_EstateSettings.TelehubRot = Quaternion.Identity; |
104 | m_EstateSettings.ClearSpawnPoints(); | ||
105 | m_EstateSettings.HasTelehub = false; | ||
106 | m_EstateSettings.Save(); | ||
107 | result = true; | ||
108 | } | ||
109 | catch (Exception ex) | ||
110 | { | ||
111 | result = false; | ||
112 | } | ||
113 | finally | ||
114 | { | ||
115 | |||
116 | } | ||
117 | |||
118 | return result; | ||
107 | } | 119 | } |
108 | 120 | ||
109 | // Add a SpawnPoint to the Telehub | 121 | // Add a SpawnPoint to the Telehub |
110 | public Telehub AddSpawnPoint(Vector3 point) | 122 | public bool AddSpawnPoint(Vector3 point) |
111 | { | 123 | { |
112 | float dist = (float) Util.GetDistanceTo(ObjectPosition, point); | ||
113 | |||
114 | Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); | ||
115 | 124 | ||
125 | float dist = (float) Util.GetDistanceTo(m_EstateSettings.TelehubPos, point); | ||
126 | Vector3 nvec = Util.GetNormalizedVector(point - m_EstateSettings.TelehubPos); | ||
116 | Vector3 spoint = nvec * dist; | 127 | Vector3 spoint = nvec * dist; |
117 | 128 | ||
118 | SpawnPoint.Add(spoint); | 129 | m_EstateSettings.AddSpawnPoint(spoint); |
119 | return TelehubVals(); | 130 | m_EstateSettings.Save(); |
131 | return true; | ||
120 | } | 132 | } |
121 | 133 | ||
122 | // Remove a SpawnPoint from the Telehub | 134 | // Remove a SpawnPoint from the Telehub |
123 | public Telehub RemoveSpawnPoint(int spawnpoint) | 135 | public bool RemoveSpawnPoint(int spawnpoint) |
124 | { | 136 | { |
125 | SpawnPoint.RemoveAt(spawnpoint); | 137 | m_EstateSettings.RemoveSpawnPoint(spawnpoint); |
138 | m_EstateSettings.Save(); | ||
126 | 139 | ||
127 | return TelehubVals(); | 140 | return true; |
128 | } | 141 | } |
129 | } | 142 | } |
130 | } \ No newline at end of file | 143 | } \ No newline at end of file |