diff options
author | Justin Clark-Casey (justincc) | 2012-06-11 23:27:48 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-11 23:27:48 +0100 |
commit | cbb5ddd9447e2632ce7c73c157bf0a13cca29e25 (patch) | |
tree | ff973ca683a2af424b37ce8d1935094208307cf1 | |
parent | Bind ~ and ! operators in LSL tighter in order to resolve issues in LSL where... (diff) | |
parent | Commitig the Avination implementation of llTeleportAgent and (diff) | |
download | opensim-SC_OLD-cbb5ddd9447e2632ce7c73c157bf0a13cca29e25.zip opensim-SC_OLD-cbb5ddd9447e2632ce7c73c157bf0a13cca29e25.tar.gz opensim-SC_OLD-cbb5ddd9447e2632ce7c73c157bf0a13cca29e25.tar.bz2 opensim-SC_OLD-cbb5ddd9447e2632ce7c73c157bf0a13cca29e25.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
3 files changed, 106 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>(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7f5d1fe..d39b204 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -403,6 +403,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
403 | void llTargetOmega(LSL_Vector axis, double spinrate, double gain); | 403 | void llTargetOmega(LSL_Vector axis, double spinrate, double gain); |
404 | void llTargetRemove(int number); | 404 | void llTargetRemove(int number); |
405 | void llTeleportAgentHome(string agent); | 405 | void llTeleportAgentHome(string agent); |
406 | void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); | ||
407 | void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); | ||
406 | void llTextBox(string avatar, string message, int chat_channel); | 408 | void llTextBox(string avatar, string message, int chat_channel); |
407 | LSL_String llToLower(string source); | 409 | LSL_String llToLower(string source); |
408 | LSL_String llToUpper(string source); | 410 | LSL_String llToUpper(string source); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index c0bf29c..06f5617 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1833,6 +1833,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1833 | m_LSL_Functions.llTargetRemove(number); | 1833 | m_LSL_Functions.llTargetRemove(number); |
1834 | } | 1834 | } |
1835 | 1835 | ||
1836 | public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) | ||
1837 | { | ||
1838 | m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); | ||
1839 | } | ||
1840 | |||
1841 | public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) | ||
1842 | { | ||
1843 | m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt); | ||
1844 | } | ||
1845 | |||
1836 | public void llTeleportAgentHome(string agent) | 1846 | public void llTeleportAgentHome(string agent) |
1837 | { | 1847 | { |
1838 | m_LSL_Functions.llTeleportAgentHome(agent); | 1848 | m_LSL_Functions.llTeleportAgentHome(agent); |