aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorMelanie2012-06-11 16:45:52 +0100
committerMelanie2012-06-11 16:45:52 +0100
commit71ba85137f6b85db7c617bd6ee8ef2081b9fab61 (patch)
treeae03d370ddc94d4a0b5bdf25af457ce4f8467f1a /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentCreate avatar entries necessary to stop new v3 avatars being clouds (pants, s... (diff)
downloadopensim-SC_OLD-71ba85137f6b85db7c617bd6ee8ef2081b9fab61.zip
opensim-SC_OLD-71ba85137f6b85db7c617bd6ee8ef2081b9fab61.tar.gz
opensim-SC_OLD-71ba85137f6b85db7c617bd6ee8ef2081b9fab61.tar.bz2
opensim-SC_OLD-71ba85137f6b85db7c617bd6ee8ef2081b9fab61.tar.xz
Commitig the Avination implementation of llTeleportAgent and
llTeleportAgentGlobalCoords. These do NOT use PERMISSION_TELEPORT like their SL counterparts because that permission is not yet understood by TPVs based on v1.x.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs94
1 files changed, 94 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fb0fdc9..89f2068 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4169,6 +4169,100 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4169 ScriptSleep(5000); 4169 ScriptSleep(5000);
4170 } 4170 }
4171 4171
4172 public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt)
4173 {
4174 m_host.AddScriptLPS(1);
4175 UUID agentId = new UUID();
4176
4177 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4178 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4179
4180 if (UUID.TryParse(agent, out agentId))
4181 {
4182 ScenePresence presence = World.GetScenePresence(agentId);
4183 if (presence != null && presence.PresenceType != PresenceType.Npc)
4184 {
4185 // agent must not be a god
4186 if (presence.GodLevel >= 200) return;
4187
4188 if (destination == String.Empty)
4189 destination = World.RegionInfo.RegionName;
4190
4191 // agent must be over the owners land
4192 if (m_host.OwnerID == World.LandChannel.GetLandObject(
4193 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4194 {
4195 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4196 }
4197 else // or must be wearing the prim
4198 {
4199 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
4200 {
4201 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4202 }
4203 }
4204 }
4205 }
4206 }
4207
4208 public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt)
4209 {
4210 m_host.AddScriptLPS(1);
4211 UUID agentId = new UUID();
4212
4213 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
4214
4215 Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
4216 Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
4217 if (UUID.TryParse(agent, out agentId))
4218 {
4219 ScenePresence presence = World.GetScenePresence(agentId);
4220 if (presence != null && presence.PresenceType != PresenceType.Npc)
4221 {
4222 // agent must not be a god
4223 if (presence.GodLevel >= 200) return;
4224
4225 // agent must be over the owners land
4226 if (m_host.OwnerID == World.LandChannel.GetLandObject(
4227 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4228 {
4229 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4230 }
4231 else // or must be wearing the prim
4232 {
4233 if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
4234 {
4235 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4236 }
4237 }
4238 }
4239 }
4240 }
4241
4242 private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt)
4243 {
4244 UUID assetID = KeyOrName(destination);
4245
4246 // The destinaion is not an asset ID and also doesn't name a landmark.
4247 // Use it as a sim name
4248 if (assetID == UUID.Zero)
4249 {
4250 World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4251 return;
4252 }
4253
4254 AssetBase lma = World.AssetService.Get(assetID.ToString());
4255 if (lma == null)
4256 return;
4257
4258 if (lma.Type != (sbyte)AssetType.Landmark)
4259 return;
4260
4261 AssetLandmark lm = new AssetLandmark(lma);
4262
4263 World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4264 }
4265
4172 public void llTextBox(string agent, string message, int chatChannel) 4266 public void llTextBox(string agent, string message, int chatChannel)
4173 { 4267 {
4174 IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); 4268 IDialogModule dm = World.RequestModuleInterface<IDialogModule>();