aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-16 14:10:54 +0000
committerTeravus Ovares2008-04-16 14:10:54 +0000
commit7c1f17b994ca987df2167101054f523cc33d7fb9 (patch)
tree19c74ddb0973e84fb6c2b31493efa4847a7b4f44 /OpenSim/Region
parentAfter reading Timer.cs in the mono source, I'm not (diff)
downloadopensim-SC_OLD-7c1f17b994ca987df2167101054f523cc33d7fb9.zip
opensim-SC_OLD-7c1f17b994ca987df2167101054f523cc33d7fb9.tar.gz
opensim-SC_OLD-7c1f17b994ca987df2167101054f523cc33d7fb9.tar.bz2
opensim-SC_OLD-7c1f17b994ca987df2167101054f523cc33d7fb9.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs51
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs1
5 files changed, 54 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index dba5b38..9c56c52 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -154,6 +154,7 @@ namespace OpenSim.Region.ClientStack
154 private FetchInventory handlerAgentDataUpdateRequest = null; //OnAgentDataUpdateRequest; 154 private FetchInventory handlerAgentDataUpdateRequest = null; //OnAgentDataUpdateRequest;
155 private FetchInventory handlerUserInfoRequest = null; //OnUserInfoRequest; 155 private FetchInventory handlerUserInfoRequest = null; //OnUserInfoRequest;
156 private TeleportLocationRequest handlerSetStartLocationRequest = null; //OnSetStartLocationRequest; 156 private TeleportLocationRequest handlerSetStartLocationRequest = null; //OnSetStartLocationRequest;
157 private TeleportLandmarkRequest handlerTeleportLandmarkRequest = null; //OnTeleportLandmarkRequest;
157 private LinkObjects handlerLinkObjects = null; //OnLinkObjects; 158 private LinkObjects handlerLinkObjects = null; //OnLinkObjects;
158 private DelinkObjects handlerDelinkObjects = null; //OnDelinkObjects; 159 private DelinkObjects handlerDelinkObjects = null; //OnDelinkObjects;
159 private AddNewPrim handlerAddPrim = null; //OnAddPrim; 160 private AddNewPrim handlerAddPrim = null; //OnAddPrim;
@@ -716,6 +717,7 @@ namespace OpenSim.Region.ClientStack
716 public event RequestMapBlocks OnRequestMapBlocks; 717 public event RequestMapBlocks OnRequestMapBlocks;
717 public event RequestMapName OnMapNameRequest; 718 public event RequestMapName OnMapNameRequest;
718 public event TeleportLocationRequest OnTeleportLocationRequest; 719 public event TeleportLocationRequest OnTeleportLocationRequest;
720 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
719 public event DisconnectUser OnDisconnectUser; 721 public event DisconnectUser OnDisconnectUser;
720 public event RequestAvatarProperties OnRequestAvatarProperties; 722 public event RequestAvatarProperties OnRequestAvatarProperties;
721 public event SetAlwaysRun OnSetAlwaysRun; 723 public event SetAlwaysRun OnSetAlwaysRun;
@@ -4185,50 +4187,35 @@ namespace OpenSim.Region.ClientStack
4185 break; 4187 break;
4186 case PacketType.TeleportLandmarkRequest: 4188 case PacketType.TeleportLandmarkRequest:
4187 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 4189 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
4188
4189 TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
4190 tpStart.Info.TeleportFlags = 8; // tp via lm
4191 OutPacket(tpStart, ThrottleOutPacketType.Task);
4192
4193 TeleportProgressPacket tpProgress = (TeleportProgressPacket)PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
4194 tpProgress.Info.Message = (new UTF8Encoding()).GetBytes("sending_landmark");
4195 tpProgress.Info.TeleportFlags = 8;
4196 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
4197 OutPacket(tpProgress, ThrottleOutPacketType.Task);
4198
4199 // Fetch landmark
4200 LLUUID lmid = tpReq.Info.LandmarkID; 4190 LLUUID lmid = tpReq.Info.LandmarkID;
4201 AssetBase lma = m_assetCache.GetAsset(lmid, false); 4191 AssetBase lma = m_assetCache.GetAsset(lmid, false);
4202 if (lma != null) 4192
4193 if(lma == null)
4203 { 4194 {
4204 AssetLandmark lm = new AssetLandmark(lma); 4195 // Failed to find landmark
4205 4196
4206 if (lm.RegionID == m_scene.RegionInfo.RegionID) 4197 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
4207 { 4198 tpCancel.Info.SessionID = tpReq.Info.SessionID;
4208 TeleportLocalPacket tpLocal = (TeleportLocalPacket)PacketPool.Instance.GetPacket(PacketType.TeleportLocal); 4199 tpCancel.Info.AgentID = tpReq.Info.AgentID;
4200 OutPacket(tpCancel, ThrottleOutPacketType.Task);
4201 }
4209 4202
4210 tpLocal.Info.AgentID = tpReq.Info.AgentID; 4203 AssetLandmark lm = new AssetLandmark(lma);
4211 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 4204 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
4212 tpLocal.Info.LocationID = 2; 4205 if (handlerTeleportLandmarkRequest != null)
4213 tpLocal.Info.Position = lm.Position; 4206 {
4214 OutPacket(tpLocal, ThrottleOutPacketType.Task); 4207 handlerTeleportLandmarkRequest(this, lm.RegionHandle, lm.Position);
4215 }
4216 else
4217 {
4218 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
4219 tpCancel.Info.AgentID = tpReq.Info.AgentID;
4220 tpCancel.Info.SessionID = tpReq.Info.SessionID;
4221 OutPacket(tpCancel, ThrottleOutPacketType.Task);
4222 }
4223 } 4208 }
4224 else 4209 else
4225 { 4210 {
4226 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); 4211 //no event handler so cancel request
4212
4227 4213
4228 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 4214 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
4229 tpCancel.Info.AgentID = tpReq.Info.AgentID; 4215 tpCancel.Info.AgentID = tpReq.Info.AgentID;
4230 tpCancel.Info.SessionID = tpReq.Info.SessionID; 4216 tpCancel.Info.SessionID = tpReq.Info.SessionID;
4231 OutPacket(tpCancel, ThrottleOutPacketType.Task); 4217 OutPacket(tpCancel, ThrottleOutPacketType.Task);
4218
4232 } 4219 }
4233 break; 4220 break;
4234 case PacketType.TeleportLocationRequest: 4221 case PacketType.TeleportLocationRequest:
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 97d09aa..ff0f3a7 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -545,7 +545,20 @@ namespace OpenSim.Region.Environment.Scenes
545 545
546 if (userInfo != null) 546 if (userInfo != null)
547 { 547 {
548 AssetBase asset = CreateAsset(name, description, invType, assetType, null); 548 ScenePresence presence;
549 TryGetAvatar(remoteClient.AgentId, out presence);
550 byte[] data = null;
551 if(invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum
552 {
553 LLVector3 pos=presence.AbsolutePosition;
554 string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
555 presence.Scene.RegionInfo.RegionID,
556 pos.X, pos.Y, pos.Z,
557 presence.RegionHandle);
558 data=Encoding.ASCII.GetBytes(strdata);
559 }
560
561 AssetBase asset = CreateAsset(name, description, invType, assetType, data);
549 AssetCache.AddAsset(asset); 562 AssetCache.AddAsset(asset);
550 563
551 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask); 564 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 464926d..08cf3d8 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1518,6 +1518,7 @@ namespace OpenSim.Region.Environment.Scenes
1518 client.OnRequestMapBlocks += RequestMapBlocks; 1518 client.OnRequestMapBlocks += RequestMapBlocks;
1519 client.OnUpdatePrimTexture += m_innerScene.UpdatePrimTexture; 1519 client.OnUpdatePrimTexture += m_innerScene.UpdatePrimTexture;
1520 client.OnTeleportLocationRequest += RequestTeleportLocation; 1520 client.OnTeleportLocationRequest += RequestTeleportLocation;
1521 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
1521 client.OnObjectSelect += SelectPrim; 1522 client.OnObjectSelect += SelectPrim;
1522 client.OnObjectDeselect += DeselectPrim; 1523 client.OnObjectDeselect += DeselectPrim;
1523 client.OnGrabUpdate += m_innerScene.MoveObject; 1524 client.OnGrabUpdate += m_innerScene.MoveObject;
@@ -2082,6 +2083,21 @@ namespace OpenSim.Region.Environment.Scenes
2082 } 2083 }
2083 2084
2084 /// <summary> 2085 /// <summary>
2086 /// Tries to teleport agent to landmark.
2087 /// </summary>
2088 /// <param name="remoteClient"></param>
2089 /// <param name="regionHandle"></param>
2090 /// <param name="position"></param>
2091 public void RequestTeleportLandmark(IClientAPI remoteClient, ulong regionHandle, LLVector3 position)
2092 {
2093 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
2094 {
2095 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
2096 position, LLVector3.Zero, 0);
2097 }
2098 }
2099
2100 /// <summary>
2085 /// Agent is crossing the border into a neighbouring region. Tell the neighbour about it! 2101 /// Agent is crossing the border into a neighbouring region. Tell the neighbour about it!
2086 /// </summary> 2102 /// </summary>
2087 /// <param name="regionHandle"></param> 2103 /// <param name="regionHandle"></param>
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 795224e..8b8373d 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -270,6 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
270 } 270 }
271 271
272 m_pos = value; 272 m_pos = value;
273 m_parentPosition=new LLVector3(0, 0, 0);
273 } 274 }
274 } 275 }
275 276
@@ -602,7 +603,10 @@ namespace OpenSim.Region.Environment.Scenes
602 /// <param name="pos"></param> 603 /// <param name="pos"></param>
603 public void Teleport(LLVector3 pos) 604 public void Teleport(LLVector3 pos)
604 { 605 {
606 RemoveFromPhysicalScene();
607 Velocity = new LLVector3(0, 0, 0);
605 AbsolutePosition = pos; 608 AbsolutePosition = pos;
609 AddToPhysicalScene();
606 SendTerseUpdateToAllClients(); 610 SendTerseUpdateToAllClients();
607 } 611 }
608 612
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index d5dc937..426ab7e 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -68,6 +68,7 @@ namespace OpenSim.Region.Examples.SimpleModule
68 public event RequestMapBlocks OnRequestMapBlocks; 68 public event RequestMapBlocks OnRequestMapBlocks;
69 public event RequestMapName OnMapNameRequest; 69 public event RequestMapName OnMapNameRequest;
70 public event TeleportLocationRequest OnTeleportLocationRequest; 70 public event TeleportLocationRequest OnTeleportLocationRequest;
71 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
71 public event DisconnectUser OnDisconnectUser; 72 public event DisconnectUser OnDisconnectUser;
72 public event RequestAvatarProperties OnRequestAvatarProperties; 73 public event RequestAvatarProperties OnRequestAvatarProperties;
73 public event SetAlwaysRun OnSetAlwaysRun; 74 public event SetAlwaysRun OnSetAlwaysRun;