diff options
4 files changed, 126 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index c50e734..b428c40 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -134,4 +134,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
134 | /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns> | 134 | /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns> |
135 | UUID GetOwner(UUID agentID); | 135 | UUID GetOwner(UUID agentID); |
136 | } | 136 | } |
137 | } | 137 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4831377..d059bcb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -425,6 +425,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
425 | public LSL_Integer osSetTerrainHeight(int x, int y, double val) | 425 | public LSL_Integer osSetTerrainHeight(int x, int y, double val) |
426 | { | 426 | { |
427 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); | 427 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); |
428 | |||
428 | return SetTerrainHeight(x, y, val); | 429 | return SetTerrainHeight(x, y, val); |
429 | } | 430 | } |
430 | 431 | ||
@@ -432,12 +433,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
432 | { | 433 | { |
433 | CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); | 434 | CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); |
434 | OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); | 435 | OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); |
436 | |||
435 | return SetTerrainHeight(x, y, val); | 437 | return SetTerrainHeight(x, y, val); |
436 | } | 438 | } |
437 | 439 | ||
438 | private LSL_Integer SetTerrainHeight(int x, int y, double val) | 440 | private LSL_Integer SetTerrainHeight(int x, int y, double val) |
439 | { | 441 | { |
440 | m_host.AddScriptLPS(1); | 442 | m_host.AddScriptLPS(1); |
443 | |||
441 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 444 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) |
442 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); | 445 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); |
443 | 446 | ||
@@ -477,6 +480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
477 | public void osTerrainFlush() | 480 | public void osTerrainFlush() |
478 | { | 481 | { |
479 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); | 482 | CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush"); |
483 | m_host.AddScriptLPS(1); | ||
480 | 484 | ||
481 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); | 485 | ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>(); |
482 | if (terrainModule != null) terrainModule.TaintTerrain(); | 486 | if (terrainModule != null) terrainModule.TaintTerrain(); |
@@ -893,6 +897,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
893 | // threat level is None as we could get this information with an | 897 | // threat level is None as we could get this information with an |
894 | // in-world script as well, just not as efficient | 898 | // in-world script as well, just not as efficient |
895 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); | 899 | CheckThreatLevel(ThreatLevel.None, "osGetAgents"); |
900 | m_host.AddScriptLPS(1); | ||
896 | 901 | ||
897 | LSL_List result = new LSL_List(); | 902 | LSL_List result = new LSL_List(); |
898 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 903 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
@@ -1171,6 +1176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1171 | // should be removed | 1176 | // should be removed |
1172 | // | 1177 | // |
1173 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); | 1178 | CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); |
1179 | m_host.AddScriptLPS(1); | ||
1174 | 1180 | ||
1175 | m_host.SetScriptEvents(m_itemID, events); | 1181 | m_host.SetScriptEvents(m_itemID, events); |
1176 | } | 1182 | } |
@@ -1518,7 +1524,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1518 | 1524 | ||
1519 | m_host.AddScriptLPS(1); | 1525 | m_host.AddScriptLPS(1); |
1520 | 1526 | ||
1521 | |||
1522 | ILandObject land | 1527 | ILandObject land |
1523 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 1528 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
1524 | 1529 | ||
@@ -1579,6 +1584,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1579 | // | 1584 | // |
1580 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); | 1585 | CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion"); |
1581 | m_host.AddScriptLPS(1); | 1586 | m_host.AddScriptLPS(1); |
1587 | |||
1582 | return m_ScriptEngine.World.GetSimulatorVersion(); | 1588 | return m_ScriptEngine.World.GetSimulatorVersion(); |
1583 | } | 1589 | } |
1584 | 1590 | ||
@@ -1918,6 +1924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1918 | public string osAvatarName2Key(string firstname, string lastname) | 1924 | public string osAvatarName2Key(string firstname, string lastname) |
1919 | { | 1925 | { |
1920 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); | 1926 | CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); |
1927 | m_host.AddScriptLPS(1); | ||
1921 | 1928 | ||
1922 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); | 1929 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); |
1923 | if (null == account) | 1930 | if (null == account) |
@@ -1933,6 +1940,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1933 | public string osKey2Name(string id) | 1940 | public string osKey2Name(string id) |
1934 | { | 1941 | { |
1935 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); | 1942 | CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); |
1943 | m_host.AddScriptLPS(1); | ||
1944 | |||
1936 | UUID key = new UUID(); | 1945 | UUID key = new UUID(); |
1937 | 1946 | ||
1938 | if (UUID.TryParse(id, out key)) | 1947 | if (UUID.TryParse(id, out key)) |
@@ -2211,15 +2220,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2211 | return retVal; | 2220 | return retVal; |
2212 | } | 2221 | } |
2213 | 2222 | ||
2223 | public LSL_Integer osIsNpc(LSL_Key npc) | ||
2224 | { | ||
2225 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); | ||
2226 | m_host.AddScriptLPS(1); | ||
2227 | |||
2228 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2229 | if (module != null) | ||
2230 | { | ||
2231 | UUID npcId; | ||
2232 | if (UUID.TryParse(npc.m_string, out npcId)) | ||
2233 | if (module.IsNPC(npcId, World)) | ||
2234 | return ScriptBaseClass.TRUE; | ||
2235 | } | ||
2236 | |||
2237 | return ScriptBaseClass.FALSE; | ||
2238 | } | ||
2239 | |||
2214 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2240 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2215 | { | 2241 | { |
2216 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2242 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2243 | m_host.AddScriptLPS(1); | ||
2244 | |||
2217 | return NpcCreate(firstname, lastname, position, notecard, true); | 2245 | return NpcCreate(firstname, lastname, position, notecard, true); |
2218 | } | 2246 | } |
2219 | 2247 | ||
2220 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) | 2248 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) |
2221 | { | 2249 | { |
2222 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2250 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
2251 | m_host.AddScriptLPS(1); | ||
2252 | |||
2223 | return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); | 2253 | return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); |
2224 | } | 2254 | } |
2225 | 2255 | ||
@@ -2294,6 +2324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2294 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) | 2324 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) |
2295 | { | 2325 | { |
2296 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); | 2326 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); |
2327 | m_host.AddScriptLPS(1); | ||
2297 | 2328 | ||
2298 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2329 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2299 | 2330 | ||
@@ -2315,6 +2346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2315 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) | 2346 | public void osNpcLoadAppearance(LSL_Key npc, string notecard) |
2316 | { | 2347 | { |
2317 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); | 2348 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); |
2349 | m_host.AddScriptLPS(1); | ||
2318 | 2350 | ||
2319 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2351 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2320 | 2352 | ||
@@ -2339,9 +2371,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2339 | } | 2371 | } |
2340 | } | 2372 | } |
2341 | 2373 | ||
2374 | public LSL_Key osNpcGetOwner(LSL_Key npc) | ||
2375 | { | ||
2376 | CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner"); | ||
2377 | m_host.AddScriptLPS(1); | ||
2378 | |||
2379 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | ||
2380 | if (npcModule != null) | ||
2381 | { | ||
2382 | UUID npcId; | ||
2383 | if (UUID.TryParse(npc.m_string, out npcId)) | ||
2384 | { | ||
2385 | UUID owner = npcModule.GetOwner(npcId); | ||
2386 | if (owner != UUID.Zero) | ||
2387 | return new LSL_Key(owner.ToString()); | ||
2388 | else | ||
2389 | return npc; | ||
2390 | } | ||
2391 | } | ||
2392 | |||
2393 | return new LSL_Key(UUID.Zero.ToString()); | ||
2394 | } | ||
2395 | |||
2342 | public LSL_Vector osNpcGetPos(LSL_Key npc) | 2396 | public LSL_Vector osNpcGetPos(LSL_Key npc) |
2343 | { | 2397 | { |
2344 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); | 2398 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); |
2399 | m_host.AddScriptLPS(1); | ||
2345 | 2400 | ||
2346 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2401 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2347 | if (npcModule != null) | 2402 | if (npcModule != null) |
@@ -2363,6 +2418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2363 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) | 2418 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) |
2364 | { | 2419 | { |
2365 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); | 2420 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); |
2421 | m_host.AddScriptLPS(1); | ||
2366 | 2422 | ||
2367 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2423 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2368 | if (module != null) | 2424 | if (module != null) |
@@ -2382,6 +2438,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2382 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) | 2438 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) |
2383 | { | 2439 | { |
2384 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); | 2440 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); |
2441 | m_host.AddScriptLPS(1); | ||
2385 | 2442 | ||
2386 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2443 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2387 | if (module != null) | 2444 | if (module != null) |
@@ -2406,6 +2463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2406 | public LSL_Rotation osNpcGetRot(LSL_Key npc) | 2463 | public LSL_Rotation osNpcGetRot(LSL_Key npc) |
2407 | { | 2464 | { |
2408 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); | 2465 | CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); |
2466 | m_host.AddScriptLPS(1); | ||
2409 | 2467 | ||
2410 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2468 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2411 | if (npcModule != null) | 2469 | if (npcModule != null) |
@@ -2429,6 +2487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2429 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 2487 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
2430 | { | 2488 | { |
2431 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); | 2489 | CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); |
2490 | m_host.AddScriptLPS(1); | ||
2432 | 2491 | ||
2433 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | 2492 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); |
2434 | if (npcModule != null) | 2493 | if (npcModule != null) |
@@ -2448,6 +2507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2448 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2507 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2449 | { | 2508 | { |
2450 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2509 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); |
2510 | m_host.AddScriptLPS(1); | ||
2451 | 2511 | ||
2452 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2512 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2453 | if (module != null) | 2513 | if (module != null) |
@@ -2464,6 +2524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2464 | public void osNpcSay(LSL_Key npc, string message) | 2524 | public void osNpcSay(LSL_Key npc, string message) |
2465 | { | 2525 | { |
2466 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2526 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2527 | m_host.AddScriptLPS(1); | ||
2467 | 2528 | ||
2468 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2529 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2469 | if (module != null) | 2530 | if (module != null) |
@@ -2480,6 +2541,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2480 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 2541 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
2481 | { | 2542 | { |
2482 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); | 2543 | CheckThreatLevel(ThreatLevel.High, "osNpcSit"); |
2544 | m_host.AddScriptLPS(1); | ||
2483 | 2545 | ||
2484 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2546 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2485 | if (module != null) | 2547 | if (module != null) |
@@ -2496,6 +2558,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2496 | public void osNpcStand(LSL_Key npc) | 2558 | public void osNpcStand(LSL_Key npc) |
2497 | { | 2559 | { |
2498 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); | 2560 | CheckThreatLevel(ThreatLevel.High, "osNpcStand"); |
2561 | m_host.AddScriptLPS(1); | ||
2499 | 2562 | ||
2500 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2563 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2501 | if (module != null) | 2564 | if (module != null) |
@@ -2512,6 +2575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2512 | public void osNpcRemove(LSL_Key npc) | 2575 | public void osNpcRemove(LSL_Key npc) |
2513 | { | 2576 | { |
2514 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); | 2577 | CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); |
2578 | m_host.AddScriptLPS(1); | ||
2515 | 2579 | ||
2516 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2580 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2517 | if (module != null) | 2581 | if (module != null) |
@@ -2530,6 +2594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2530 | public void osNpcPlayAnimation(LSL_Key npc, string animation) | 2594 | public void osNpcPlayAnimation(LSL_Key npc, string animation) |
2531 | { | 2595 | { |
2532 | CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); | 2596 | CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); |
2597 | m_host.AddScriptLPS(1); | ||
2533 | 2598 | ||
2534 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2599 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2535 | if (module != null) | 2600 | if (module != null) |
@@ -2544,6 +2609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2544 | public void osNpcStopAnimation(LSL_Key npc, string animation) | 2609 | public void osNpcStopAnimation(LSL_Key npc, string animation) |
2545 | { | 2610 | { |
2546 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); | 2611 | CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); |
2612 | m_host.AddScriptLPS(1); | ||
2547 | 2613 | ||
2548 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2614 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2549 | if (module != null) | 2615 | if (module != null) |
@@ -2563,6 +2629,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2563 | public LSL_Key osOwnerSaveAppearance(string notecard) | 2629 | public LSL_Key osOwnerSaveAppearance(string notecard) |
2564 | { | 2630 | { |
2565 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); | 2631 | CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); |
2632 | m_host.AddScriptLPS(1); | ||
2566 | 2633 | ||
2567 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); | 2634 | return SaveAppearanceToNotecard(m_host.OwnerID, notecard); |
2568 | } | 2635 | } |
@@ -2570,6 +2637,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2570 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) | 2637 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) |
2571 | { | 2638 | { |
2572 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); | 2639 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); |
2640 | m_host.AddScriptLPS(1); | ||
2573 | 2641 | ||
2574 | return SaveAppearanceToNotecard(avatarId, notecard); | 2642 | return SaveAppearanceToNotecard(avatarId, notecard); |
2575 | } | 2643 | } |
@@ -2620,6 +2688,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2620 | public LSL_Key osGetMapTexture() | 2688 | public LSL_Key osGetMapTexture() |
2621 | { | 2689 | { |
2622 | CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); | 2690 | CheckThreatLevel(ThreatLevel.None, "osGetMapTexture"); |
2691 | m_host.AddScriptLPS(1); | ||
2692 | |||
2623 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); | 2693 | return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString(); |
2624 | } | 2694 | } |
2625 | 2695 | ||
@@ -2631,6 +2701,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2631 | public LSL_Key osGetRegionMapTexture(string regionName) | 2701 | public LSL_Key osGetRegionMapTexture(string regionName) |
2632 | { | 2702 | { |
2633 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); | 2703 | CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture"); |
2704 | m_host.AddScriptLPS(1); | ||
2705 | |||
2634 | Scene scene = m_ScriptEngine.World; | 2706 | Scene scene = m_ScriptEngine.World; |
2635 | UUID key = UUID.Zero; | 2707 | UUID key = UUID.Zero; |
2636 | GridRegion region; | 2708 | GridRegion region; |
@@ -2696,6 +2768,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2696 | public void osKickAvatar(string FirstName,string SurName,string alert) | 2768 | public void osKickAvatar(string FirstName,string SurName,string alert) |
2697 | { | 2769 | { |
2698 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2770 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2771 | m_host.AddScriptLPS(1); | ||
2772 | |||
2699 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2773 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
2700 | { | 2774 | { |
2701 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2775 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
@@ -2830,6 +2904,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2830 | public LSL_List osGetAvatarList() | 2904 | public LSL_List osGetAvatarList() |
2831 | { | 2905 | { |
2832 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); | 2906 | CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); |
2907 | m_host.AddScriptLPS(1); | ||
2833 | 2908 | ||
2834 | LSL_List result = new LSL_List(); | 2909 | LSL_List result = new LSL_List(); |
2835 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) | 2910 | World.ForEachRootScenePresence(delegate (ScenePresence avatar) |
@@ -2854,6 +2929,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2854 | public LSL_String osUnixTimeToTimestamp(long time) | 2929 | public LSL_String osUnixTimeToTimestamp(long time) |
2855 | { | 2930 | { |
2856 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); | 2931 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); |
2932 | m_host.AddScriptLPS(1); | ||
2933 | |||
2857 | long baseTicks = 621355968000000000; | 2934 | long baseTicks = 621355968000000000; |
2858 | long tickResolution = 10000000; | 2935 | long tickResolution = 10000000; |
2859 | long epochTicks = (time * tickResolution) + baseTicks; | 2936 | long epochTicks = (time * tickResolution) + baseTicks; |
@@ -2862,4 +2939,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2862 | return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); | 2939 | return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); |
2863 | } | 2940 | } |
2864 | } | 2941 | } |
2865 | } | 2942 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 6388704..ca24051 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -173,25 +173,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
173 | 173 | ||
174 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); | 174 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); |
175 | 175 | ||
176 | key osNpcCreate(string user, string name, vector position, string notecard); | 176 | /// <summary> |
177 | key osNpcCreate(string user, string name, vector position, string notecard, int options); | 177 | /// Check if the given key is an npc |
178 | LSL_Key osNpcSaveAppearance(key npc, string notecard); | 178 | /// </summary> |
179 | void osNpcLoadAppearance(key npc, string notecard); | 179 | /// <param name="npc"></param> |
180 | vector osNpcGetPos(key npc); | 180 | /// <returns>TRUE if the key belongs to an npc in the scene. FALSE otherwise.</returns> |
181 | void osNpcMoveTo(key npc, vector position); | 181 | LSL_Integer osIsNpc(LSL_Key npc); |
182 | void osNpcMoveToTarget(key npc, vector target, int options); | 182 | |
183 | rotation osNpcGetRot(key npc); | 183 | key osNpcCreate(string user, string name, vector position, string notecard); |
184 | void osNpcSetRot(LSL_Key npc, rotation rot); | 184 | key osNpcCreate(string user, string name, vector position, string notecard, int options); |
185 | void osNpcStopMoveToTarget(LSL_Key npc); | 185 | LSL_Key osNpcSaveAppearance(key npc, string notecard); |
186 | void osNpcSay(key npc, string message); | 186 | void osNpcLoadAppearance(key npc, string notecard); |
187 | void osNpcSit(key npc, key target, int options); | 187 | vector osNpcGetPos(key npc); |
188 | void osNpcStand(LSL_Key npc); | 188 | void osNpcMoveTo(key npc, vector position); |
189 | void osNpcRemove(key npc); | 189 | void osNpcMoveToTarget(key npc, vector target, int options); |
190 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 190 | |
191 | void osNpcStopAnimation(LSL_Key npc, string animation); | 191 | /// <summary> |
192 | 192 | /// Get the owner of the NPC | |
193 | LSL_Key osOwnerSaveAppearance(string notecard); | 193 | /// </summary> |
194 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 194 | /// <param name="npc"></param> |
195 | /// <returns> | ||
196 | /// The owner of the NPC for an owned NPC. The NPC's agent id for an unowned NPC. UUID.Zero if the key is not an npc. | ||
197 | /// </returns> | ||
198 | LSL_Key osNpcGetOwner(key npc); | ||
199 | |||
200 | rotation osNpcGetRot(key npc); | ||
201 | void osNpcSetRot(LSL_Key npc, rotation rot); | ||
202 | void osNpcStopMoveToTarget(LSL_Key npc); | ||
203 | void osNpcSay(key npc, string message); | ||
204 | void osNpcSit(key npc, key target, int options); | ||
205 | void osNpcStand(LSL_Key npc); | ||
206 | void osNpcRemove(key npc); | ||
207 | void osNpcPlayAnimation(LSL_Key npc, string animation); | ||
208 | void osNpcStopAnimation(LSL_Key npc, string animation); | ||
209 | |||
210 | LSL_Key osOwnerSaveAppearance(string notecard); | ||
211 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | ||
195 | 212 | ||
196 | key osGetMapTexture(); | 213 | key osGetMapTexture(); |
197 | key osGetRegionMapTexture(string regionName); | 214 | key osGetRegionMapTexture(string regionName); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 02efecf..cc8d417 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
493 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); | 493 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); |
494 | } | 494 | } |
495 | 495 | ||
496 | public LSL_Integer osIsNpc(LSL_Key npc) | ||
497 | { | ||
498 | return m_OSSL_Functions.osIsNpc(npc); | ||
499 | } | ||
500 | |||
496 | public key osNpcCreate(string user, string name, vector position, key cloneFrom) | 501 | public key osNpcCreate(string user, string name, vector position, key cloneFrom) |
497 | { | 502 | { |
498 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); | 503 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); |
@@ -513,6 +518,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
513 | m_OSSL_Functions.osNpcLoadAppearance(npc, notecard); | 518 | m_OSSL_Functions.osNpcLoadAppearance(npc, notecard); |
514 | } | 519 | } |
515 | 520 | ||
521 | public LSL_Key osNpcGetOwner(LSL_Key npc) | ||
522 | { | ||
523 | return m_OSSL_Functions.osNpcGetOwner(npc); | ||
524 | } | ||
525 | |||
516 | public vector osNpcGetPos(LSL_Key npc) | 526 | public vector osNpcGetPos(LSL_Key npc) |
517 | { | 527 | { |
518 | return m_OSSL_Functions.osNpcGetPos(npc); | 528 | return m_OSSL_Functions.osNpcGetPos(npc); |