diff options
author | Melanie | 2010-03-03 02:07:03 +0000 |
---|---|---|
committer | Melanie | 2010-03-03 02:07:03 +0000 |
commit | 028a87fe37002e7a0611f66babf1deee46c83804 (patch) | |
tree | 387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Revert "test" (diff) | |
parent | Fixes Region.Framework tests. Although these tests don't fail, they need to b... (diff) | |
download | opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.zip opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2 opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz |
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
4 files changed, 224 insertions, 93 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7a6739b..3f9c026 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
40 | using OpenSim; | 40 | using OpenSim; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Communications.Cache; | 42 | |
43 | using OpenSim.Region.CoreModules; | 43 | using OpenSim.Region.CoreModules; |
44 | using OpenSim.Region.CoreModules.World.Land; | 44 | using OpenSim.Region.CoreModules.World.Land; |
45 | using OpenSim.Region.CoreModules.World.Terrain; | 45 | using OpenSim.Region.CoreModules.World.Terrain; |
@@ -53,9 +53,10 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | |||
53 | using OpenSim.Region.ScriptEngine.Interfaces; | 53 | using OpenSim.Region.ScriptEngine.Interfaces; |
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 54 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
55 | using OpenSim.Services.Interfaces; | 55 | using OpenSim.Services.Interfaces; |
56 | 56 | using OpenSim.Services.Interfaces; | |
57 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | ||
58 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 57 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
58 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
59 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | ||
59 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 60 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
60 | 61 | ||
61 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 62 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
@@ -917,10 +918,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
917 | public string resolveName(UUID objecUUID) | 918 | public string resolveName(UUID objecUUID) |
918 | { | 919 | { |
919 | // try avatar username surname | 920 | // try avatar username surname |
920 | CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID); | 921 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, objecUUID); |
921 | if (profile != null && profile.UserProfile != null) | 922 | if (account != null) |
922 | { | 923 | { |
923 | string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName; | 924 | string avatarname = account.Name; |
924 | return avatarname; | 925 | return avatarname; |
925 | } | 926 | } |
926 | // try an scene object | 927 | // try an scene object |
@@ -1252,7 +1253,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1252 | 1253 | ||
1253 | if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) | 1254 | if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) |
1254 | { | 1255 | { |
1255 | NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); | 1256 | if (value != 0) |
1257 | m_host.SetBlockGrab(true); | ||
1258 | else | ||
1259 | m_host.SetBlockGrab(false); | ||
1256 | } | 1260 | } |
1257 | 1261 | ||
1258 | if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) | 1262 | if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) |
@@ -1265,12 +1269,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1265 | 1269 | ||
1266 | if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) | 1270 | if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) |
1267 | { | 1271 | { |
1268 | NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); | 1272 | if (value != 0) |
1273 | m_host.SetReturnAtEdge(true); | ||
1274 | else | ||
1275 | m_host.SetReturnAtEdge(false); | ||
1269 | } | 1276 | } |
1270 | 1277 | ||
1271 | if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) | 1278 | if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) |
1272 | { | 1279 | { |
1273 | NotImplemented("llSetStatus - STATUS_SANDBOX"); | 1280 | if (value != 0) |
1281 | m_host.SetStatusSandbox(true); | ||
1282 | else | ||
1283 | m_host.SetStatusSandbox(false); | ||
1274 | } | 1284 | } |
1275 | 1285 | ||
1276 | if (statusrotationaxis != 0) | 1286 | if (statusrotationaxis != 0) |
@@ -1307,8 +1317,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1307 | return 0; | 1317 | return 0; |
1308 | 1318 | ||
1309 | case ScriptBaseClass.STATUS_BLOCK_GRAB: | 1319 | case ScriptBaseClass.STATUS_BLOCK_GRAB: |
1310 | NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); | 1320 | if (m_host.GetBlockGrab()) |
1311 | return 0; | 1321 | return 1; |
1322 | else | ||
1323 | return 0; | ||
1312 | 1324 | ||
1313 | case ScriptBaseClass.STATUS_DIE_AT_EDGE: | 1325 | case ScriptBaseClass.STATUS_DIE_AT_EDGE: |
1314 | if (m_host.GetDieAtEdge()) | 1326 | if (m_host.GetDieAtEdge()) |
@@ -1317,24 +1329,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1317 | return 0; | 1329 | return 0; |
1318 | 1330 | ||
1319 | case ScriptBaseClass.STATUS_RETURN_AT_EDGE: | 1331 | case ScriptBaseClass.STATUS_RETURN_AT_EDGE: |
1320 | NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); | 1332 | if (m_host.GetReturnAtEdge()) |
1321 | return 0; | 1333 | return 1; |
1334 | else | ||
1335 | return 0; | ||
1322 | 1336 | ||
1323 | case ScriptBaseClass.STATUS_ROTATE_X: | 1337 | case ScriptBaseClass.STATUS_ROTATE_X: |
1324 | NotImplemented("llGetStatus - STATUS_ROTATE_X"); | 1338 | if (m_host.GetAxisRotation(2) == 2) |
1325 | return 0; | 1339 | return 1; |
1340 | else | ||
1341 | return 0; | ||
1326 | 1342 | ||
1327 | case ScriptBaseClass.STATUS_ROTATE_Y: | 1343 | case ScriptBaseClass.STATUS_ROTATE_Y: |
1328 | NotImplemented("llGetStatus - STATUS_ROTATE_Y"); | 1344 | if (m_host.GetAxisRotation(4) == 4) |
1329 | return 0; | 1345 | return 1; |
1346 | else | ||
1347 | return 0; | ||
1330 | 1348 | ||
1331 | case ScriptBaseClass.STATUS_ROTATE_Z: | 1349 | case ScriptBaseClass.STATUS_ROTATE_Z: |
1332 | NotImplemented("llGetStatus - STATUS_ROTATE_Z"); | 1350 | if (m_host.GetAxisRotation(8) == 8) |
1333 | return 0; | 1351 | return 1; |
1352 | else | ||
1353 | return 0; | ||
1334 | 1354 | ||
1335 | case ScriptBaseClass.STATUS_SANDBOX: | 1355 | case ScriptBaseClass.STATUS_SANDBOX: |
1336 | NotImplemented("llGetStatus - STATUS_SANDBOX"); | 1356 | if (m_host.GetStatusSandbox()) |
1337 | return 0; | 1357 | return 1; |
1358 | else | ||
1359 | return 0; | ||
1338 | } | 1360 | } |
1339 | return 0; | 1361 | return 0; |
1340 | } | 1362 | } |
@@ -2346,7 +2368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2346 | m_host.AddScriptLPS(1); | 2368 | m_host.AddScriptLPS(1); |
2347 | 2369 | ||
2348 | // send the sound, once, to all clients in range | 2370 | // send the sound, once, to all clients in range |
2349 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); | 2371 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); |
2350 | } | 2372 | } |
2351 | 2373 | ||
2352 | // Xantor 20080528 we should do this differently. | 2374 | // Xantor 20080528 we should do this differently. |
@@ -2376,42 +2398,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2376 | public void llLoopSoundMaster(string sound, double volume) | 2398 | public void llLoopSoundMaster(string sound, double volume) |
2377 | { | 2399 | { |
2378 | m_host.AddScriptLPS(1); | 2400 | m_host.AddScriptLPS(1); |
2379 | NotImplemented("llLoopSoundMaster"); | 2401 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; |
2402 | lock (m_host.ParentGroup.LoopSoundSlavePrims) | ||
2403 | { | ||
2404 | foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) | ||
2405 | { | ||
2406 | if (prim.Sound != UUID.Zero) | ||
2407 | llStopSound(); | ||
2408 | |||
2409 | prim.Sound = KeyOrName(sound); | ||
2410 | prim.SoundGain = volume; | ||
2411 | prim.SoundFlags = 1; // looping | ||
2412 | prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2413 | |||
2414 | prim.ScheduleFullUpdate(); | ||
2415 | prim.SendFullUpdateToAllClients(); | ||
2416 | } | ||
2417 | } | ||
2418 | if (m_host.Sound != UUID.Zero) | ||
2419 | llStopSound(); | ||
2420 | |||
2421 | m_host.Sound = KeyOrName(sound); | ||
2422 | m_host.SoundGain = volume; | ||
2423 | m_host.SoundFlags = 1; // looping | ||
2424 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
2425 | |||
2426 | m_host.ScheduleFullUpdate(); | ||
2427 | m_host.SendFullUpdateToAllClients(); | ||
2380 | } | 2428 | } |
2381 | 2429 | ||
2382 | public void llLoopSoundSlave(string sound, double volume) | 2430 | public void llLoopSoundSlave(string sound, double volume) |
2383 | { | 2431 | { |
2384 | m_host.AddScriptLPS(1); | 2432 | m_host.AddScriptLPS(1); |
2385 | NotImplemented("llLoopSoundSlave"); | 2433 | lock (m_host.ParentGroup.LoopSoundSlavePrims) |
2434 | { | ||
2435 | m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host); | ||
2436 | } | ||
2386 | } | 2437 | } |
2387 | 2438 | ||
2388 | public void llPlaySoundSlave(string sound, double volume) | 2439 | public void llPlaySoundSlave(string sound, double volume) |
2389 | { | 2440 | { |
2390 | m_host.AddScriptLPS(1); | 2441 | m_host.AddScriptLPS(1); |
2391 | NotImplemented("llPlaySoundSlave"); | 2442 | |
2443 | // send the sound, once, to all clients in range | ||
2444 | m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); | ||
2392 | } | 2445 | } |
2393 | 2446 | ||
2394 | public void llTriggerSound(string sound, double volume) | 2447 | public void llTriggerSound(string sound, double volume) |
2395 | { | 2448 | { |
2396 | m_host.AddScriptLPS(1); | 2449 | m_host.AddScriptLPS(1); |
2397 | // send the sound, once, to all clients in range | 2450 | // send the sound, once, to all clients in range |
2398 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0); | 2451 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); |
2399 | } | 2452 | } |
2400 | 2453 | ||
2401 | // Xantor 20080528: Clear prim data of sound instead | 2454 | // Xantor 20080528: Clear prim data of sound instead |
2402 | public void llStopSound() | 2455 | public void llStopSound() |
2403 | { | 2456 | { |
2404 | m_host.AddScriptLPS(1); | 2457 | m_host.AddScriptLPS(1); |
2405 | 2458 | if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) | |
2406 | m_host.Sound = UUID.Zero; | 2459 | { |
2407 | m_host.SoundGain = 0; | 2460 | if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) |
2408 | m_host.SoundFlags = 0; | 2461 | { |
2409 | m_host.SoundRadius = 0; | 2462 | foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) |
2410 | 2463 | { | |
2411 | m_host.ScheduleFullUpdate(); | 2464 | part.Sound = UUID.Zero; |
2412 | m_host.SendFullUpdateToAllClients(); | 2465 | part.SoundGain = 0; |
2413 | 2466 | part.SoundFlags = 0; | |
2414 | // m_host.SendSound(UUID.Zero.ToString(), 1.0, false, 2); | 2467 | part.SoundRadius = 0; |
2468 | part.ScheduleFullUpdate(); | ||
2469 | part.SendFullUpdateToAllClients(); | ||
2470 | } | ||
2471 | m_host.ParentGroup.LoopSoundMasterPrim = null; | ||
2472 | m_host.ParentGroup.LoopSoundSlavePrims.Clear(); | ||
2473 | } | ||
2474 | else | ||
2475 | { | ||
2476 | m_host.Sound = UUID.Zero; | ||
2477 | m_host.SoundGain = 0; | ||
2478 | m_host.SoundFlags = 0; | ||
2479 | m_host.SoundRadius = 0; | ||
2480 | m_host.ScheduleFullUpdate(); | ||
2481 | m_host.SendFullUpdateToAllClients(); | ||
2482 | } | ||
2483 | } | ||
2484 | else | ||
2485 | { | ||
2486 | m_host.Sound = UUID.Zero; | ||
2487 | m_host.SoundGain = 0; | ||
2488 | m_host.SoundFlags = 0; | ||
2489 | m_host.SoundRadius = 0; | ||
2490 | m_host.ScheduleFullUpdate(); | ||
2491 | m_host.SendFullUpdateToAllClients(); | ||
2492 | } | ||
2415 | } | 2493 | } |
2416 | 2494 | ||
2417 | public void llPreloadSound(string sound) | 2495 | public void llPreloadSound(string sound) |
@@ -2803,8 +2881,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2803 | 2881 | ||
2804 | public void llLookAt(LSL_Vector target, double strength, double damping) | 2882 | public void llLookAt(LSL_Vector target, double strength, double damping) |
2805 | { | 2883 | { |
2806 | // partial implementation, rotates objects correctly but does not apply strength or damping attributes | ||
2807 | |||
2808 | m_host.AddScriptLPS(1); | 2884 | m_host.AddScriptLPS(1); |
2809 | // Determine where we are looking from | 2885 | // Determine where we are looking from |
2810 | LSL_Vector from = llGetPos(); | 2886 | LSL_Vector from = llGetPos(); |
@@ -2824,9 +2900,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2824 | // the angles of rotation in radians into rotation value | 2900 | // the angles of rotation in radians into rotation value |
2825 | 2901 | ||
2826 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 2902 | LSL_Types.Quaternion rot = llEuler2Rot(angle); |
2827 | 2903 | Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); | |
2904 | m_host.startLookAt(rotation, (float)damping, (float)strength); | ||
2828 | // Orient the object to the angle calculated | 2905 | // Orient the object to the angle calculated |
2829 | llSetRot(rot); | 2906 | //llSetRot(rot); |
2830 | } | 2907 | } |
2831 | 2908 | ||
2832 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | 2909 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) |
@@ -3329,13 +3406,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3329 | public void llPointAt(LSL_Vector pos) | 3406 | public void llPointAt(LSL_Vector pos) |
3330 | { | 3407 | { |
3331 | m_host.AddScriptLPS(1); | 3408 | m_host.AddScriptLPS(1); |
3332 | NotImplemented("llPointAt"); | 3409 | ScenePresence Owner = World.GetScenePresence(m_host.UUID); |
3410 | LSL_Rotation rot = llEuler2Rot(pos); | ||
3411 | Owner.PreviousRotation = Owner.Rotation; | ||
3412 | Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s)); | ||
3333 | } | 3413 | } |
3334 | 3414 | ||
3335 | public void llStopPointAt() | 3415 | public void llStopPointAt() |
3336 | { | 3416 | { |
3337 | m_host.AddScriptLPS(1); | 3417 | m_host.AddScriptLPS(1); |
3338 | NotImplemented("llStopPointAt"); | 3418 | ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); |
3419 | Owner.Rotation = Owner.PreviousRotation; | ||
3339 | } | 3420 | } |
3340 | 3421 | ||
3341 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) | 3422 | public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) |
@@ -3998,13 +4079,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3998 | 4079 | ||
3999 | UUID uuid = (UUID)id; | 4080 | UUID uuid = (UUID)id; |
4000 | 4081 | ||
4001 | UserProfileData userProfile = | 4082 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); |
4002 | World.CommsManager.UserService.GetUserProfile(uuid); | ||
4003 | 4083 | ||
4004 | UserAgentData userAgent = | 4084 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); |
4005 | World.CommsManager.UserService.GetAgentByUUID(uuid); | 4085 | PresenceInfo pinfo = PresenceInfo.GetOnlinePresence(pinfos); |
4006 | 4086 | ||
4007 | if (userProfile == null || userAgent == null) | 4087 | if (pinfo == null) |
4008 | return UUID.Zero.ToString(); | 4088 | return UUID.Zero.ToString(); |
4009 | 4089 | ||
4010 | string reply = String.Empty; | 4090 | string reply = String.Empty; |
@@ -4013,17 +4093,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4013 | { | 4093 | { |
4014 | case 1: // DATA_ONLINE (0|1) | 4094 | case 1: // DATA_ONLINE (0|1) |
4015 | // TODO: implement fetching of this information | 4095 | // TODO: implement fetching of this information |
4016 | if (userProfile.CurrentAgent!=null && userProfile.CurrentAgent.AgentOnline) | 4096 | if (pinfo != null) |
4017 | reply = "1"; | 4097 | reply = "1"; |
4018 | else | 4098 | else |
4019 | reply = "0"; | 4099 | reply = "0"; |
4020 | break; | 4100 | break; |
4021 | case 2: // DATA_NAME (First Last) | 4101 | case 2: // DATA_NAME (First Last) |
4022 | reply = userProfile.FirstName + " " + userProfile.SurName; | 4102 | reply = account.FirstName + " " + account.LastName; |
4023 | break; | 4103 | break; |
4024 | case 3: // DATA_BORN (YYYY-MM-DD) | 4104 | case 3: // DATA_BORN (YYYY-MM-DD) |
4025 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); | 4105 | DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); |
4026 | born = born.AddSeconds(userProfile.Created); | 4106 | born = born.AddSeconds(account.Created); |
4027 | reply = born.ToString("yyyy-MM-dd"); | 4107 | reply = born.ToString("yyyy-MM-dd"); |
4028 | break; | 4108 | break; |
4029 | case 4: // DATA_RATING (0,0,0,0,0,0) | 4109 | case 4: // DATA_RATING (0,0,0,0,0,0) |
@@ -4138,8 +4218,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4138 | public void llCollisionSound(string impact_sound, double impact_volume) | 4218 | public void llCollisionSound(string impact_sound, double impact_volume) |
4139 | { | 4219 | { |
4140 | m_host.AddScriptLPS(1); | 4220 | m_host.AddScriptLPS(1); |
4141 | //NotImplemented("llCollisionSound"); | ||
4142 | |||
4143 | // TODO: Parameter check logic required. | 4221 | // TODO: Parameter check logic required. |
4144 | UUID soundId = UUID.Zero; | 4222 | UUID soundId = UUID.Zero; |
4145 | if (!UUID.TryParse(impact_sound, out soundId)) | 4223 | if (!UUID.TryParse(impact_sound, out soundId)) |
@@ -4727,8 +4805,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4727 | public LSL_Vector llGetCenterOfMass() | 4805 | public LSL_Vector llGetCenterOfMass() |
4728 | { | 4806 | { |
4729 | m_host.AddScriptLPS(1); | 4807 | m_host.AddScriptLPS(1); |
4730 | NotImplemented("llGetCenterOfMass"); | 4808 | Vector3 center = m_host.GetGeometricCenter(); |
4731 | return new LSL_Vector(); | 4809 | return new LSL_Vector(center.X,center.Y,center.Z); |
4732 | } | 4810 | } |
4733 | 4811 | ||
4734 | public LSL_List llListSort(LSL_List src, int stride, int ascending) | 4812 | public LSL_List llListSort(LSL_List src, int stride, int ascending) |
@@ -5461,8 +5539,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5461 | flags |= ScriptBaseClass.AGENT_SITTING; | 5539 | flags |= ScriptBaseClass.AGENT_SITTING; |
5462 | } | 5540 | } |
5463 | 5541 | ||
5464 | //NotImplemented("llGetAgentInfo"); | ||
5465 | |||
5466 | return flags; | 5542 | return flags; |
5467 | } | 5543 | } |
5468 | 5544 | ||
@@ -5545,7 +5621,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5545 | LSL_Vector bottom_south_west) | 5621 | LSL_Vector bottom_south_west) |
5546 | { | 5622 | { |
5547 | m_host.AddScriptLPS(1); | 5623 | m_host.AddScriptLPS(1); |
5548 | NotImplemented("llTriggerSoundLimited"); | 5624 | float radius1 = (float)llVecDist(llGetPos(), top_north_east); |
5625 | float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); | ||
5626 | float radius = Math.Abs(radius1 - radius2); | ||
5627 | m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); | ||
5549 | } | 5628 | } |
5550 | 5629 | ||
5551 | public void llEjectFromLand(string pest) | 5630 | public void llEjectFromLand(string pest) |
@@ -6084,7 +6163,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6084 | public void llGroundRepel(double height, int water, double tau) | 6163 | public void llGroundRepel(double height, int water, double tau) |
6085 | { | 6164 | { |
6086 | m_host.AddScriptLPS(1); | 6165 | m_host.AddScriptLPS(1); |
6087 | NotImplemented("llGroundRepel"); | 6166 | if (m_host.PhysActor != null) |
6167 | { | ||
6168 | float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); | ||
6169 | float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); | ||
6170 | PIDHoverType hoverType = PIDHoverType.Ground; | ||
6171 | if (water != 0) | ||
6172 | { | ||
6173 | hoverType = PIDHoverType.GroundAndWater; | ||
6174 | if (ground < waterLevel) | ||
6175 | height += waterLevel; | ||
6176 | else | ||
6177 | height += ground; | ||
6178 | } | ||
6179 | else | ||
6180 | { | ||
6181 | height += ground; | ||
6182 | } | ||
6183 | |||
6184 | m_host.SetHoverHeight((float)height, hoverType, (float)tau); | ||
6185 | } | ||
6088 | } | 6186 | } |
6089 | 6187 | ||
6090 | protected UUID GetTaskInventoryItem(string name) | 6188 | protected UUID GetTaskInventoryItem(string name) |
@@ -6219,7 +6317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6219 | { | 6317 | { |
6220 | if (!m_host.ParentGroup.IsDeleted) | 6318 | if (!m_host.ParentGroup.IsDeleted) |
6221 | { | 6319 | { |
6222 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags); | 6320 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false); |
6223 | } | 6321 | } |
6224 | } | 6322 | } |
6225 | } | 6323 | } |
@@ -6231,7 +6329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6231 | { | 6329 | { |
6232 | if (!m_host.ParentGroup.IsDeleted) | 6330 | if (!m_host.ParentGroup.IsDeleted) |
6233 | { | 6331 | { |
6234 | m_host.ParentGroup.RootPart.RemoveVehicleFlags(flags); | 6332 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true); |
6235 | } | 6333 | } |
6236 | } | 6334 | } |
6237 | } | 6335 | } |
@@ -7271,7 +7369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7271 | public void llRemoteDataSetRegion() | 7369 | public void llRemoteDataSetRegion() |
7272 | { | 7370 | { |
7273 | m_host.AddScriptLPS(1); | 7371 | m_host.AddScriptLPS(1); |
7274 | NotImplemented("llRemoteDataSetRegion"); | 7372 | Deprecated("llRemoteDataSetRegion"); |
7275 | } | 7373 | } |
7276 | 7374 | ||
7277 | public LSL_Float llLog10(double val) | 7375 | public LSL_Float llLog10(double val) |
@@ -8409,7 +8507,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8409 | public void llSetInventoryPermMask(string item, int mask, int value) | 8507 | public void llSetInventoryPermMask(string item, int mask, int value) |
8410 | { | 8508 | { |
8411 | m_host.AddScriptLPS(1); | 8509 | m_host.AddScriptLPS(1); |
8412 | NotImplemented("llSetInventoryPermMask"); | 8510 | if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) |
8511 | { | ||
8512 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | ||
8513 | { | ||
8514 | lock (m_host.TaskInventory) | ||
8515 | { | ||
8516 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
8517 | { | ||
8518 | if (inv.Value.Name == item) | ||
8519 | { | ||
8520 | switch (mask) | ||
8521 | { | ||
8522 | case 0: | ||
8523 | inv.Value.BasePermissions = (uint)value; | ||
8524 | break; | ||
8525 | case 1: | ||
8526 | inv.Value.CurrentPermissions = (uint)value; | ||
8527 | break; | ||
8528 | case 2: | ||
8529 | inv.Value.GroupPermissions = (uint)value; | ||
8530 | break; | ||
8531 | case 3: | ||
8532 | inv.Value.EveryonePermissions = (uint)value; | ||
8533 | break; | ||
8534 | case 4: | ||
8535 | inv.Value.NextPermissions = (uint)value; | ||
8536 | break; | ||
8537 | } | ||
8538 | } | ||
8539 | } | ||
8540 | } | ||
8541 | } | ||
8542 | } | ||
8413 | } | 8543 | } |
8414 | 8544 | ||
8415 | public LSL_String llGetInventoryCreator(string item) | 8545 | public LSL_String llGetInventoryCreator(string item) |
@@ -8843,6 +8973,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8843 | // we send to all | 8973 | // we send to all |
8844 | landData.MediaID = new UUID(texture); | 8974 | landData.MediaID = new UUID(texture); |
8845 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; | 8975 | landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; |
8976 | landData.MediaSize[0] = width; | ||
8977 | landData.MediaSize[1] = height; | ||
8978 | landData.MediaType = mediaType; | ||
8846 | 8979 | ||
8847 | // do that one last, it will cause a ParcelPropertiesUpdate | 8980 | // do that one last, it will cause a ParcelPropertiesUpdate |
8848 | landObject.SetMediaUrl(url); | 8981 | landObject.SetMediaUrl(url); |
@@ -8902,11 +9035,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8902 | m_host.AddScriptLPS(1); | 9035 | m_host.AddScriptLPS(1); |
8903 | LSL_List list = new LSL_List(); | 9036 | LSL_List list = new LSL_List(); |
8904 | //TO DO: make the implementation for the missing commands | 9037 | //TO DO: make the implementation for the missing commands |
8905 | //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. | ||
8906 | //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. | ||
8907 | //PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later) | ||
8908 | //PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later) | ||
8909 | //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later) | ||
8910 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) | 9038 | //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) |
8911 | for (int i = 0; i < aList.Data.Length; i++) | 9039 | for (int i = 0; i < aList.Data.Length; i++) |
8912 | { | 9040 | { |
@@ -8924,6 +9052,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8924 | case ParcelMediaCommandEnum.Texture: | 9052 | case ParcelMediaCommandEnum.Texture: |
8925 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); | 9053 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); |
8926 | break; | 9054 | break; |
9055 | case ParcelMediaCommandEnum.Type: | ||
9056 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); | ||
9057 | break; | ||
9058 | case ParcelMediaCommandEnum.Size: | ||
9059 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); | ||
9060 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); | ||
9061 | break; | ||
8927 | default: | 9062 | default: |
8928 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; | 9063 | ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; |
8929 | NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); | 9064 | NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1ddba1e..845834e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -36,12 +36,11 @@ using OpenMetaverse; | |||
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim; | 37 | using OpenSim; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Region.CoreModules.Avatar.NPC; | 41 | using OpenSim.Region.CoreModules.Avatar.NPC; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
45 | using OpenSim.Region.ScriptEngine.Shared; | 44 | using OpenSim.Region.ScriptEngine.Shared; |
46 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 45 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
47 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 46 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -607,21 +606,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
607 | // and convert the regionName to the target region | 606 | // and convert the regionName to the target region |
608 | if (regionName.Contains(".") && regionName.Contains(":")) | 607 | if (regionName.Contains(".") && regionName.Contains(":")) |
609 | { | 608 | { |
609 | List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
610 | // Try to link the region | 610 | // Try to link the region |
611 | IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>(); | 611 | if (regions != null && regions.Count > 0) |
612 | if (hyperService != null) | ||
613 | { | 612 | { |
614 | GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient, | 613 | GridRegion regInfo = regions[0]; |
615 | regionName); | 614 | regionName = regInfo.RegionName; |
616 | // Get the region name | ||
617 | if (regInfo != null) | ||
618 | { | ||
619 | regionName = regInfo.RegionName; | ||
620 | } | ||
621 | else | ||
622 | { | ||
623 | // Might need to ping the client here in case of failure?? | ||
624 | } | ||
625 | } | 615 | } |
626 | } | 616 | } |
627 | presence.ControllingClient.SendTeleportLocationStart(); | 617 | presence.ControllingClient.SendTeleportLocationStart(); |
@@ -1482,7 +1472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1482 | m_host.AddScriptLPS(1); | 1472 | m_host.AddScriptLPS(1); |
1483 | 1473 | ||
1484 | // Create new asset | 1474 | // Create new asset |
1485 | AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard); | 1475 | AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); |
1486 | asset.Description = "Script Generated Notecard"; | 1476 | asset.Description = "Script Generated Notecard"; |
1487 | string notecardData = String.Empty; | 1477 | string notecardData = String.Empty; |
1488 | 1478 | ||
@@ -1695,15 +1685,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1695 | { | 1685 | { |
1696 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); | 1686 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); |
1697 | 1687 | ||
1698 | CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | 1688 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); |
1699 | 1689 | if (null == account) | |
1700 | if (null == userInfo) | ||
1701 | { | 1690 | { |
1702 | return UUID.Zero.ToString(); | 1691 | return UUID.Zero.ToString(); |
1703 | } | 1692 | } |
1704 | else | 1693 | else |
1705 | { | 1694 | { |
1706 | return userInfo.UserProfile.ID.ToString(); | 1695 | return account.PrincipalID.ToString(); |
1707 | } | 1696 | } |
1708 | } | 1697 | } |
1709 | 1698 | ||
@@ -1714,15 +1703,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1714 | 1703 | ||
1715 | if (UUID.TryParse(id, out key)) | 1704 | if (UUID.TryParse(id, out key)) |
1716 | { | 1705 | { |
1717 | CachedUserInfo userInfo = World.CommsManager.UserProfileCacheService.GetUserDetails(key); | 1706 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); |
1718 | 1707 | if (null == account) | |
1719 | if (null == userInfo) | ||
1720 | { | 1708 | { |
1721 | return ""; | 1709 | return ""; |
1722 | } | 1710 | } |
1723 | else | 1711 | else |
1724 | { | 1712 | { |
1725 | return userInfo.UserProfile.Name; | 1713 | return account.Name; |
1726 | } | 1714 | } |
1727 | } | 1715 | } |
1728 | else | 1716 | else |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index b75a2e4..829fbb7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Communications.Cache; | 32 | |
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Shared; | 34 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 13b855f..7cf82b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -160,6 +160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
160 | public const int VEHICLE_BANKING_MIX = 39; | 160 | public const int VEHICLE_BANKING_MIX = 39; |
161 | public const int VEHICLE_BANKING_TIMESCALE = 40; | 161 | public const int VEHICLE_BANKING_TIMESCALE = 40; |
162 | public const int VEHICLE_REFERENCE_FRAME = 44; | 162 | public const int VEHICLE_REFERENCE_FRAME = 44; |
163 | public const int VEHICLE_RANGE_BLOCK = 45; | ||
164 | public const int VEHICLE_ROLL_FRAME = 46; | ||
163 | public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; | 165 | public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; |
164 | public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; | 166 | public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; |
165 | public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; | 167 | public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; |
@@ -170,6 +172,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
170 | public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; | 172 | public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; |
171 | public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; | 173 | public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; |
172 | public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; | 174 | public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; |
175 | public const int VEHICLE_FLAG_NO_X = 1024; | ||
176 | public const int VEHICLE_FLAG_NO_Y = 2048; | ||
177 | public const int VEHICLE_FLAG_NO_Z = 4096; | ||
178 | public const int VEHICLE_FLAG_LOCK_HOVER_HEIGHT = 8192; | ||
179 | public const int VEHICLE_FLAG_NO_DEFLECTION = 16392; | ||
180 | public const int VEHICLE_FLAG_LOCK_ROTATION = 32784; | ||
173 | 181 | ||
174 | public const int INVENTORY_ALL = -1; | 182 | public const int INVENTORY_ALL = -1; |
175 | public const int INVENTORY_NONE = -1; | 183 | public const int INVENTORY_NONE = -1; |