Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

iar_mods
Justin Clark-Casey (justincc) 2012-01-24 20:36:16 +00:00
commit a704d444f2
13 changed files with 481 additions and 9 deletions

View File

@ -210,7 +210,6 @@ namespace OpenSim.Data.MySQL
} }
LoadBanList(es); LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");

View File

@ -846,6 +846,8 @@ namespace OpenSim.Data.MySQL
} }
} }
LoadSpawnPoints(rs);
return rs; return rs;
} }
@ -994,7 +996,9 @@ namespace OpenSim.Data.MySQL
"use_estate_sun, fixed_sun, sun_position, " + "use_estate_sun, fixed_sun, sun_position, " +
"covenant, Sandbox, sunvectorx, sunvectory, " + "covenant, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " + "sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + "loaded_creation_id, map_tile_ID, " +
"TelehubObject) " +
"values (?RegionUUID, ?BlockTerraform, " +
"?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
"?AllowLandResell, ?AllowLandJoinDivide, " + "?AllowLandResell, ?AllowLandJoinDivide, " +
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
@ -1009,7 +1013,7 @@ namespace OpenSim.Data.MySQL
"?SunPosition, ?Covenant, ?Sandbox, " + "?SunPosition, ?Covenant, ?Sandbox, " +
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?LoadedCreationDateTime, ?LoadedCreationID, " + "?LoadedCreationDateTime, ?LoadedCreationID, " +
"?TerrainImageID)"; "?TerrainImageID, ?TelehubObject) ";
FillRegionSettingsCommand(cmd, rs); FillRegionSettingsCommand(cmd, rs);
@ -1017,6 +1021,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
SaveSpawnPoints(rs);
} }
public List<LandData> LoadLandObjects(UUID regionUUID) public List<LandData> LoadLandObjects(UUID regionUUID)
@ -1296,6 +1301,7 @@ namespace OpenSim.Data.MySQL
newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]);
newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
return newSettings; return newSettings;
} }
@ -1626,7 +1632,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
} }
/// <summary> /// <summary>
@ -1828,5 +1834,72 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
private void LoadSpawnPoints(RegionSettings rs)
{
rs.ClearSpawnPoints();
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select Yaw, Pitch, Distance from spawn_points where RegionID = ?RegionID";
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
using (IDataReader r = cmd.ExecuteReader())
{
while (r.Read())
{
SpawnPoint sp = new SpawnPoint();
sp.Yaw = (float)r["Yaw"];
sp.Pitch = (float)r["Pitch"];
sp.Distance = (float)r["Distance"];
rs.AddSpawnPoint(sp);
}
}
}
}
}
}
private void SaveSpawnPoints(RegionSettings rs)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "delete from spawn_points where RegionID = ?RegionID";
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into spawn_points (RegionID, Yaw, Pitch, Distance) values ( ?RegionID, ?Yaw, ?Pitch, ?Distance)";
foreach (SpawnPoint p in rs.SpawnPoints())
{
cmd.Parameters.AddWithValue("?RegionID", rs.RegionUUID.ToString());
cmd.Parameters.AddWithValue("?Yaw", p.Yaw);
cmd.Parameters.AddWithValue("?Pitch", p.Pitch);
cmd.Parameters.AddWithValue("?Distance", p.Distance);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
}
}
}
} }
} }

View File

@ -842,3 +842,18 @@ alter table regionsettings ENGINE = MyISAM;
alter table terrain ENGINE = MyISAM; alter table terrain ENGINE = MyISAM;
COMMIT; COMMIT;
:VERSION 39 #--------------- Telehub support
BEGIN;
CREATE TABLE IF NOT EXISTS `spawn_points` (
`RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
`Yaw` float NOT NULL,
`Pitch` float NOT NULL,
`Distance` float NOT NULL,
KEY `RegionID` (`RegionID`)
) ENGINE=Innodb;
ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
COMMIT;

View File

@ -358,6 +358,8 @@ namespace OpenSim.Framework
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2); public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1);
public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName); public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
public delegate void BakeTerrain(IClientAPI remoteClient); public delegate void BakeTerrain(IClientAPI remoteClient);
@ -769,6 +771,7 @@ namespace OpenSim.Framework
event ModifyTerrain OnModifyTerrain; event ModifyTerrain OnModifyTerrain;
event BakeTerrain OnBakeTerrain; event BakeTerrain OnBakeTerrain;
event EstateChangeInfo OnEstateChangeInfo; event EstateChangeInfo OnEstateChangeInfo;
event EstateManageTelehub OnEstateManageTelehub;
// [Obsolete("LLClientView Specific.")] // [Obsolete("LLClientView Specific.")]
event SetAppearance OnSetAppearance; event SetAppearance OnSetAppearance;
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
@ -1141,6 +1144,8 @@ namespace OpenSim.Framework
void SendTaskInventory(UUID taskID, short serial, byte[] fileName); void SendTaskInventory(UUID taskID, short serial, byte[] fileName);
void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint);
/// <summary> /// <summary>
/// Used by the server to inform the client of new inventory items and folders. /// Used by the server to inform the client of new inventory items and folders.
/// </summary> /// </summary>

View File

@ -26,11 +26,53 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public struct SpawnPoint
{
public float Yaw;
public float Pitch;
public float Distance;
public void SetLocation(Vector3 pos, Quaternion rot, Vector3 point)
{
// The point is an absolute position, so we need the relative
// location to the spawn point
Vector3 offset = point - pos;
Distance = Vector3.Mag(offset);
// Next we need to rotate this vector into the spawn point's
// coordinate system
rot.W = -rot.W;
offset = offset * rot;
Vector3 dir = Vector3.Normalize(offset);
// Get the bearing (yaw)
Yaw = (float)Math.Atan2(dir.Y, dir.X);
// Get the elevation (pitch)
Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y));
}
public Vector3 GetLocation(Vector3 pos, Quaternion rot)
{
Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw);
Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0);
Vector3 dir = new Vector3(1, 0, 0) * p * y;
Vector3 offset = dir * (float)Distance;
offset *= rot;
return pos + offset;
}
}
public class RegionSettings public class RegionSettings
{ {
public delegate void SaveDelegate(RegionSettings rs); public delegate void SaveDelegate(RegionSettings rs);
@ -397,5 +439,49 @@ namespace OpenSim.Framework
set { m_LoadedCreationID = value; } set { m_LoadedCreationID = value; }
} }
// Connected Telehub object
private UUID m_TelehubObject;
public UUID TelehubObject
{
get
{
return m_TelehubObject;
}
set
{
m_TelehubObject = value;
}
}
// Our Connected Telehub's SpawnPoints
public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
// Add a SpawnPoint
// ** These are not region coordinates **
// They are relative to the Telehub coordinates
//
public void AddSpawnPoint(SpawnPoint point)
{
l_SpawnPoints.Add(point);
}
// Remove a SpawnPoint
public void RemoveSpawnPoint(int point_index)
{
l_SpawnPoints.RemoveAt(point_index);
}
// Return the List of SpawnPoints
public List<SpawnPoint> SpawnPoints()
{
return l_SpawnPoints;
}
// Clear the SpawnPoints List of all entries
public void ClearSpawnPoints()
{
l_SpawnPoints.Clear();
}
} }
} }

View File

@ -219,6 +219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event BakeTerrain OnBakeTerrain; public event BakeTerrain OnBakeTerrain;
public event RequestTerrain OnUploadTerrain; public event RequestTerrain OnUploadTerrain;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event EstateRestartSimRequest OnEstateRestartSimRequest; public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
@ -4482,6 +4483,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo);
packet.TelehubBlock.ObjectID = ObjectID;
packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName);
packet.TelehubBlock.TelehubPos = ObjectPos;
packet.TelehubBlock.TelehubRot = ObjectRot;
packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count];
for (int n = 0; n < SpawnPoint.Count; n++)
{
packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]};
}
OutPacket(packet, ThrottleOutPacketType.Task);
}
#endregion #endregion
#region Land Data Sending Methods #region Land Data Sending Methods
@ -8920,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
{ {
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
//m_log.Debug(messagePacket.ToString()); // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method));
GodLandStatRequest handlerLandStatRequest; GodLandStatRequest handlerLandStatRequest;
#region Packet Session and User Check #region Packet Session and User Check
@ -9219,6 +9237,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
case "telehub":
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
{
UUID invoice = messagePacket.MethodData.Invoice;
UUID SenderID = messagePacket.AgentData.AgentID;
UInt32 param1 = 0u;
string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter);
if (command != "info ui")
{
try
{
param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
}
catch (Exception ex)
{
}
}
EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub;
if (handlerEstateManageTelehub != null)
{
handlerEstateManageTelehub(this, invoice, SenderID, command, param1);
}
}
return true;
default: default:
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
return true; return true;
@ -9230,8 +9277,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
//lsrp.RequestData.RequestFlags; //lsrp.RequestData.RequestFlags;
//lsrp.RequestData.Filter; //lsrp.RequestData.Filter;
// return true;
} }
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)

View File

@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected EstateManagementCommands m_commands; protected EstateManagementCommands m_commands;
private EstateTerrainXferHandler TerrainUploader; private EstateTerrainXferHandler TerrainUploader;
public TelehubManager m_Telehub;
public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnRegionInfoChange;
public event ChangeDelegate OnEstateInfoChange; public event ChangeDelegate OnEstateInfoChange;
@ -599,6 +600,50 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
{
uint ObjectLocalID;
SceneObjectPart part;
switch (cmd)
{
case "info ui":
break;
case "connect":
// Add the Telehub
part = Scene.GetSceneObjectPart((uint)param1);
if (part == null)
return;
SceneObjectGroup grp = part.ParentGroup;
m_Telehub.Connect(grp);
break;
case "delete":
// Disconnect Telehub
m_Telehub.Disconnect();
break;
case "spawnpoint add":
// Add SpawnPoint to the Telehub
part = Scene.GetSceneObjectPart((uint)param1);
if (part == null)
return;
m_Telehub.AddSpawnPoint(part.AbsolutePosition);
break;
case "spawnpoint remove":
// Remove SpawnPoint from Telehub
m_Telehub.RemoveSpawnPoint((int)param1);
break;
default:
break;
}
SendTelehubInfo(client);
}
private void SendSimulatorBlueBoxMessage( private void SendSimulatorBlueBoxMessage(
IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
{ {
@ -1056,6 +1101,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.EventManager.OnNewClient += EventManager_OnNewClient; Scene.EventManager.OnNewClient += EventManager_OnNewClient;
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
m_Telehub = new TelehubManager(scene);
m_commands = new EstateManagementCommands(this); m_commands = new EstateManagementCommands(this);
m_commands.Initialise(); m_commands.Initialise();
} }
@ -1109,6 +1156,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
client.OnEstateChangeInfo += handleEstateChangeInfo; client.OnEstateChangeInfo += handleEstateChangeInfo;
client.OnEstateManageTelehub += handleOnEstateManageTelehub;
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
@ -1243,5 +1291,39 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (onmessage != null) if (onmessage != null)
onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message); onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message);
} }
private void SendTelehubInfo(IClientAPI client)
{
RegionSettings settings =
this.Scene.RegionInfo.RegionSettings;
SceneObjectGroup telehub = null;
if (settings.TelehubObject != UUID.Zero &&
(telehub = Scene.GetSceneObjectGroup(settings.TelehubObject)) != null)
{
List<Vector3> spawnPoints = new List<Vector3>();
foreach (SpawnPoint sp in settings.SpawnPoints())
{
spawnPoints.Add(sp.GetLocation(Vector3.Zero, Quaternion.Identity));
}
client.SendTelehubInfo(settings.TelehubObject,
telehub.Name,
telehub.AbsolutePosition,
telehub.GroupRotation,
spawnPoints);
}
else
{
client.SendTelehubInfo(UUID.Zero,
String.Empty,
Vector3.Zero,
Quaternion.Identity,
new List<Vector3>());
}
}
} }
} }

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using OpenMetaverse;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using log4net;
namespace OpenSim.Region.CoreModules.World.Estate
{
public class TelehubManager
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Scene m_Scene;
public TelehubManager(Scene scene)
{
m_Scene = scene;
}
// Connect the Telehub
public void Connect(SceneObjectGroup grp)
{
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
m_Scene.RegionInfo.RegionSettings.TelehubObject = grp.UUID;
m_Scene.RegionInfo.RegionSettings.Save();
}
// Disconnect the Telehub:
public void Disconnect()
{
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
return;
m_Scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
m_Scene.RegionInfo.RegionSettings.ClearSpawnPoints();
m_Scene.RegionInfo.RegionSettings.Save();
}
// Add a SpawnPoint to the Telehub
public void AddSpawnPoint(Vector3 point)
{
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
return;
SceneObjectGroup grp = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
if (grp == null)
return;
SpawnPoint sp = new SpawnPoint();
sp.SetLocation(grp.AbsolutePosition, grp.GroupRotation, point);
m_Scene.RegionInfo.RegionSettings.AddSpawnPoint(sp);
m_Scene.RegionInfo.RegionSettings.Save();
}
// Remove a SpawnPoint from the Telehub
public void RemoveSpawnPoint(int spawnpoint)
{
if (m_Scene.RegionInfo.RegionSettings.TelehubObject == UUID.Zero)
return;
m_Scene.RegionInfo.RegionSettings.RemoveSpawnPoint(spawnpoint);
m_Scene.RegionInfo.RegionSettings.Save();
}
}
}

View File

@ -3835,8 +3835,61 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos)
{
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
(m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
{
if (GodLevel < 200 &&
((!m_scene.Permissions.IsGod(m_uuid) &&
!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
{
SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
if (spawnPoints.Length == 0)
return;
float distance = 9999;
int closest = -1;
for (int i = 0 ; i < spawnPoints.Length ; i++)
{
Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
Vector3 offset = spawnPosition - pos;
float d = Vector3.Mag(offset);
if (d >= distance)
continue;
ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
if (land == null)
continue;
if (land.IsEitherBannedOrRestricted(UUID))
continue;
distance = d;
closest = i;
}
if (closest == -1)
return;
pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
}
}
}
private void CheckAndAdjustLandingPoint(ref Vector3 pos) private void CheckAndAdjustLandingPoint(ref Vector3 pos)
{ {
SceneObjectGroup telehub = null;
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
{
if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
{
CheckAndAdjustTelehub(telehub, ref pos);
return;
}
}
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
if (land != null) if (land != null)

View File

@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event ModifyTerrain OnModifyTerrain; public event ModifyTerrain OnModifyTerrain;
public event BakeTerrain OnBakeTerrain; public event BakeTerrain OnBakeTerrain;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event SetAppearance OnSetAppearance; public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing; public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@ -1530,6 +1531,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
{ {

View File

@ -32,6 +32,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.World.Estate;
namespace OpenSim.Region.OptionalModules.World.NPC namespace OpenSim.Region.OptionalModules.World.NPC
{ {
@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event ScriptReset OnScriptReset; public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning; public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning; public event SetScriptRunning OnSetScriptRunning;
@ -923,6 +925,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendEstateCovenantInformation(UUID covenant) public void SendEstateCovenantInformation(UUID covenant)
{ {
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
{ {
} }

View File

@ -194,6 +194,7 @@ namespace OpenSim.Tests.Common.Mock
public event RegionInfoRequest OnRegionInfoRequest; public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest; public event EstateCovenantRequest OnEstateCovenantRequest;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
@ -951,6 +952,10 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }

View File

@ -69,3 +69,6 @@ Example
nunit-console2 OpenSim.Framework.Tests.dll (on linux) nunit-console2 OpenSim.Framework.Tests.dll (on linux)
nunit-console OpenSim.Framework.Tests.dll (on windows) nunit-console OpenSim.Framework.Tests.dll (on windows)
See the file OpenSim/Data/Tests/Resources/TestDataConnections.ini
for information to setup testing for data