* Applying melanie's Landmark patch. Thanks Melanie!

* To make a landmark, you currently have to enable admin options in the advanced menu first.  We're working on this..   however use the admin options solution in the mean time.
0.6.0-stable
Teravus Ovares 2008-04-16 14:10:54 +00:00
parent 1eb0fedd93
commit 7c1f17b994
8 changed files with 62 additions and 34 deletions

View File

@ -35,6 +35,7 @@ namespace OpenSim.Framework
public int Version; public int Version;
public LLVector3 Position; public LLVector3 Position;
public LLUUID RegionID; public LLUUID RegionID;
public ulong RegionHandle;
public AssetLandmark(AssetBase a) public AssetLandmark(AssetBase a)
{ {
@ -54,6 +55,7 @@ namespace OpenSim.Framework
int.TryParse(parts[0].Substring(17, 1), out Version); int.TryParse(parts[0].Substring(17, 1), out Version);
LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle);
} }
} }
} }

View File

@ -128,6 +128,7 @@ namespace OpenSim.Framework
get { return m_regionFlags; } get { return m_regionFlags; }
set set
{ {
//m_regionFlags = (Simulator.RegionFlags)0x400000;
m_regionFlags = value; m_regionFlags = value;
configMember.forceSetConfigurationOption("region_flags", ((uint)m_regionFlags).ToString()); configMember.forceSetConfigurationOption("region_flags", ((uint)m_regionFlags).ToString());
} }
@ -784,7 +785,7 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty, configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty,
"0", true); "0", true);
configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty, configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty,
"0", true); "4194304", true); //The String value of RegionFlags.RestrictPushObject
configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "21", configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "21",
true); true);
configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0", configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0",

View File

@ -260,6 +260,9 @@ namespace OpenSim.Framework
public delegate void TeleportLocationRequest( public delegate void TeleportLocationRequest(
IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
public delegate void TeleportLandmarkRequest(
IClientAPI remoteClient, ulong regionHandle, LLVector3 position);
public delegate void DisconnectUser(); public delegate void DisconnectUser();
public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
@ -458,6 +461,7 @@ namespace OpenSim.Framework
event DisconnectUser OnDisconnectUser; event DisconnectUser OnDisconnectUser;
event RequestAvatarProperties OnRequestAvatarProperties; event RequestAvatarProperties OnRequestAvatarProperties;
event SetAlwaysRun OnSetAlwaysRun; event SetAlwaysRun OnSetAlwaysRun;
event TeleportLandmarkRequest OnTeleportLandmarkRequest;
event GenericCall4 OnDeRezObject; event GenericCall4 OnDeRezObject;
event Action<IClientAPI> OnRegionHandShakeReply; event Action<IClientAPI> OnRegionHandShakeReply;
event GenericCall2 OnRequestWearables; event GenericCall2 OnRequestWearables;

View File

@ -154,6 +154,7 @@ namespace OpenSim.Region.ClientStack
private FetchInventory handlerAgentDataUpdateRequest = null; //OnAgentDataUpdateRequest; private FetchInventory handlerAgentDataUpdateRequest = null; //OnAgentDataUpdateRequest;
private FetchInventory handlerUserInfoRequest = null; //OnUserInfoRequest; private FetchInventory handlerUserInfoRequest = null; //OnUserInfoRequest;
private TeleportLocationRequest handlerSetStartLocationRequest = null; //OnSetStartLocationRequest; private TeleportLocationRequest handlerSetStartLocationRequest = null; //OnSetStartLocationRequest;
private TeleportLandmarkRequest handlerTeleportLandmarkRequest = null; //OnTeleportLandmarkRequest;
private LinkObjects handlerLinkObjects = null; //OnLinkObjects; private LinkObjects handlerLinkObjects = null; //OnLinkObjects;
private DelinkObjects handlerDelinkObjects = null; //OnDelinkObjects; private DelinkObjects handlerDelinkObjects = null; //OnDelinkObjects;
private AddNewPrim handlerAddPrim = null; //OnAddPrim; private AddNewPrim handlerAddPrim = null; //OnAddPrim;
@ -716,6 +717,7 @@ namespace OpenSim.Region.ClientStack
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun; public event SetAlwaysRun OnSetAlwaysRun;
@ -4185,50 +4187,35 @@ namespace OpenSim.Region.ClientStack
break; break;
case PacketType.TeleportLandmarkRequest: case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
tpStart.Info.TeleportFlags = 8; // tp via lm
OutPacket(tpStart, ThrottleOutPacketType.Task);
TeleportProgressPacket tpProgress = (TeleportProgressPacket)PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
tpProgress.Info.Message = (new UTF8Encoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
OutPacket(tpProgress, ThrottleOutPacketType.Task);
// Fetch landmark
LLUUID lmid = tpReq.Info.LandmarkID; LLUUID lmid = tpReq.Info.LandmarkID;
AssetBase lma = m_assetCache.GetAsset(lmid, false); AssetBase lma = m_assetCache.GetAsset(lmid, false);
if (lma != null)
if(lma == null)
{ {
// Failed to find landmark
TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
tpCancel.Info.SessionID = tpReq.Info.SessionID;
tpCancel.Info.AgentID = tpReq.Info.AgentID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
}
AssetLandmark lm = new AssetLandmark(lma); AssetLandmark lm = new AssetLandmark(lma);
handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
if (lm.RegionID == m_scene.RegionInfo.RegionID) if (handlerTeleportLandmarkRequest != null)
{ {
TeleportLocalPacket tpLocal = (TeleportLocalPacket)PacketPool.Instance.GetPacket(PacketType.TeleportLocal); handlerTeleportLandmarkRequest(this, lm.RegionHandle, lm.Position);
tpLocal.Info.AgentID = tpReq.Info.AgentID;
tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
tpLocal.Info.LocationID = 2;
tpLocal.Info.Position = lm.Position;
OutPacket(tpLocal, ThrottleOutPacketType.Task);
} }
else else
{ {
TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); //no event handler so cancel request
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
}
}
else
{
Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
tpCancel.Info.AgentID = tpReq.Info.AgentID; tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID; tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task); OutPacket(tpCancel, ThrottleOutPacketType.Task);
} }
break; break;
case PacketType.TeleportLocationRequest: case PacketType.TeleportLocationRequest:

View File

@ -545,7 +545,20 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo != null) if (userInfo != null)
{ {
AssetBase asset = CreateAsset(name, description, invType, assetType, null); ScenePresence presence;
TryGetAvatar(remoteClient.AgentId, out presence);
byte[] data = null;
if(invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum
{
LLVector3 pos=presence.AbsolutePosition;
string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle);
data=Encoding.ASCII.GetBytes(strdata);
}
AssetBase asset = CreateAsset(name, description, invType, assetType, data);
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask); CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask);

View File

@ -1518,6 +1518,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnRequestMapBlocks += RequestMapBlocks; client.OnRequestMapBlocks += RequestMapBlocks;
client.OnUpdatePrimTexture += m_innerScene.UpdatePrimTexture; client.OnUpdatePrimTexture += m_innerScene.UpdatePrimTexture;
client.OnTeleportLocationRequest += RequestTeleportLocation; client.OnTeleportLocationRequest += RequestTeleportLocation;
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
client.OnObjectSelect += SelectPrim; client.OnObjectSelect += SelectPrim;
client.OnObjectDeselect += DeselectPrim; client.OnObjectDeselect += DeselectPrim;
client.OnGrabUpdate += m_innerScene.MoveObject; client.OnGrabUpdate += m_innerScene.MoveObject;
@ -2081,6 +2082,21 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
/// <summary>
/// Tries to teleport agent to landmark.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
public void RequestTeleportLandmark(IClientAPI remoteClient, ulong regionHandle, LLVector3 position)
{
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{
m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
position, LLVector3.Zero, 0);
}
}
/// <summary> /// <summary>
/// Agent is crossing the border into a neighbouring region. Tell the neighbour about it! /// Agent is crossing the border into a neighbouring region. Tell the neighbour about it!
/// </summary> /// </summary>

View File

@ -270,6 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_pos = value; m_pos = value;
m_parentPosition=new LLVector3(0, 0, 0);
} }
} }
@ -602,7 +603,10 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
public void Teleport(LLVector3 pos) public void Teleport(LLVector3 pos)
{ {
RemoveFromPhysicalScene();
Velocity = new LLVector3(0, 0, 0);
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene();
SendTerseUpdateToAllClients(); SendTerseUpdateToAllClients();
} }

View File

@ -68,6 +68,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun; public event SetAlwaysRun OnSetAlwaysRun;