diff options
author | Melanie | 2011-12-12 11:42:22 +0000 |
---|---|---|
committer | Melanie | 2011-12-12 11:42:22 +0000 |
commit | 52a4dbccbec7f3c3139f49c29fdc20b8332f50f0 (patch) | |
tree | c1c76545b90c9a9df67886eb01d10e8388785c00 /OpenSim | |
parent | Fix a regression that causes data from the attachments module to fail loading (diff) | |
parent | Cleaned up ScenePresence parameters for Flying, WasFlying, FlyingOld and IsCo... (diff) | |
download | opensim-SC-52a4dbccbec7f3c3139f49c29fdc20b8332f50f0.zip opensim-SC-52a4dbccbec7f3c3139f49c29fdc20b8332f50f0.tar.gz opensim-SC-52a4dbccbec7f3c3139f49c29fdc20b8332f50f0.tar.bz2 opensim-SC-52a4dbccbec7f3c3139f49c29fdc20b8332f50f0.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/RegionInfo.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim')
10 files changed, 184 insertions, 266 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index db6c26f..96f3049 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -143,6 +143,8 @@ namespace OpenSim.Framework | |||
143 | public string RemotingAddress; | 143 | public string RemotingAddress; |
144 | public UUID ScopeID = UUID.Zero; | 144 | public UUID ScopeID = UUID.Zero; |
145 | 145 | ||
146 | private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); | ||
147 | |||
146 | 148 | ||
147 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 149 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
148 | 150 | ||
@@ -445,6 +447,18 @@ namespace OpenSim.Framework | |||
445 | m_internalEndPoint = tmpEPE; | 447 | m_internalEndPoint = tmpEPE; |
446 | } | 448 | } |
447 | 449 | ||
450 | public string GetOtherSetting(string key) | ||
451 | { | ||
452 | string val; | ||
453 | m_otherSettings.TryGetValue(key, out val); | ||
454 | return val; | ||
455 | } | ||
456 | |||
457 | public void SetOtherSetting(string key, string value) | ||
458 | { | ||
459 | m_otherSettings[key] = value; | ||
460 | } | ||
461 | |||
448 | private void ReadNiniConfig(IConfigSource source, string name) | 462 | private void ReadNiniConfig(IConfigSource source, string name) |
449 | { | 463 | { |
450 | // bool creatingNew = false; | 464 | // bool creatingNew = false; |
@@ -473,30 +487,39 @@ namespace OpenSim.Framework | |||
473 | if (source.Configs[name] == null) | 487 | if (source.Configs[name] == null) |
474 | { | 488 | { |
475 | source.AddConfig(name); | 489 | source.AddConfig(name); |
476 | |||
477 | // creatingNew = true; | ||
478 | } | 490 | } |
479 | 491 | ||
492 | RegionName = name; | ||
480 | IConfig config = source.Configs[name]; | 493 | IConfig config = source.Configs[name]; |
481 | 494 | ||
482 | // UUID | 495 | // Track all of the keys in this config and remove as they are processed |
496 | // The remaining keys will be added to generic key-value storage for | ||
497 | // whoever might need it | ||
498 | HashSet<String> allKeys = new HashSet<String>(); | ||
499 | foreach (string s in config.GetKeys()) | ||
500 | { | ||
501 | allKeys.Add(s.ToLower()); | ||
502 | } | ||
503 | |||
504 | // RegionUUID | ||
483 | // | 505 | // |
506 | allKeys.Remove(("RegionUUID").ToLower()); | ||
484 | string regionUUID = config.GetString("RegionUUID", string.Empty); | 507 | string regionUUID = config.GetString("RegionUUID", string.Empty); |
485 | |||
486 | if (regionUUID == String.Empty) | 508 | if (regionUUID == String.Empty) |
487 | { | 509 | { |
488 | UUID newID = UUID.Random(); | 510 | UUID newID = UUID.Random(); |
489 | 511 | ||
490 | regionUUID = MainConsole.Instance.CmdPrompt("Region UUID", newID.ToString()); | 512 | regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); |
491 | config.Set("RegionUUID", regionUUID); | 513 | config.Set("RegionUUID", regionUUID); |
492 | } | 514 | } |
493 | 515 | ||
494 | RegionID = new UUID(regionUUID); | 516 | RegionID = new UUID(regionUUID); |
495 | originRegionID = RegionID; // What IS this?! | 517 | originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) |
496 | 518 | ||
497 | RegionName = name; | 519 | // Location |
520 | // | ||
521 | allKeys.Remove(("Location").ToLower()); | ||
498 | string location = config.GetString("Location", String.Empty); | 522 | string location = config.GetString("Location", String.Empty); |
499 | |||
500 | if (location == String.Empty) | 523 | if (location == String.Empty) |
501 | { | 524 | { |
502 | location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000"); | 525 | location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000"); |
@@ -508,13 +531,10 @@ namespace OpenSim.Framework | |||
508 | m_regionLocX = Convert.ToUInt32(locationElements[0]); | 531 | m_regionLocX = Convert.ToUInt32(locationElements[0]); |
509 | m_regionLocY = Convert.ToUInt32(locationElements[1]); | 532 | m_regionLocY = Convert.ToUInt32(locationElements[1]); |
510 | 533 | ||
511 | 534 | // InternalAddress | |
512 | // Datastore (is this implemented? Omitted from example!) | 535 | // |
513 | DataStore = config.GetString("Datastore", String.Empty); | ||
514 | |||
515 | // Internal IP | ||
516 | IPAddress address; | 536 | IPAddress address; |
517 | 537 | allKeys.Remove(("InternalAddress").ToLower()); | |
518 | if (config.Contains("InternalAddress")) | 538 | if (config.Contains("InternalAddress")) |
519 | { | 539 | { |
520 | address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); | 540 | address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); |
@@ -525,8 +545,10 @@ namespace OpenSim.Framework | |||
525 | config.Set("InternalAddress", address.ToString()); | 545 | config.Set("InternalAddress", address.ToString()); |
526 | } | 546 | } |
527 | 547 | ||
548 | // InternalPort | ||
549 | // | ||
528 | int port; | 550 | int port; |
529 | 551 | allKeys.Remove(("InternalPort").ToLower()); | |
530 | if (config.Contains("InternalPort")) | 552 | if (config.Contains("InternalPort")) |
531 | { | 553 | { |
532 | port = config.GetInt("InternalPort", 9000); | 554 | port = config.GetInt("InternalPort", 9000); |
@@ -536,9 +558,11 @@ namespace OpenSim.Framework | |||
536 | port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000")); | 558 | port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000")); |
537 | config.Set("InternalPort", port); | 559 | config.Set("InternalPort", port); |
538 | } | 560 | } |
539 | |||
540 | m_internalEndPoint = new IPEndPoint(address, port); | 561 | m_internalEndPoint = new IPEndPoint(address, port); |
541 | 562 | ||
563 | // AllowAlternatePorts | ||
564 | // | ||
565 | allKeys.Remove(("AllowAlternatePorts").ToLower()); | ||
542 | if (config.Contains("AllowAlternatePorts")) | 566 | if (config.Contains("AllowAlternatePorts")) |
543 | { | 567 | { |
544 | m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); | 568 | m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); |
@@ -550,10 +574,10 @@ namespace OpenSim.Framework | |||
550 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); | 574 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); |
551 | } | 575 | } |
552 | 576 | ||
553 | // External IP | 577 | // ExternalHostName |
554 | // | 578 | // |
579 | allKeys.Remove(("ExternalHostName").ToLower()); | ||
555 | string externalName; | 580 | string externalName; |
556 | |||
557 | if (config.Contains("ExternalHostName")) | 581 | if (config.Contains("ExternalHostName")) |
558 | { | 582 | { |
559 | externalName = config.GetString("ExternalHostName", "SYSTEMIP"); | 583 | externalName = config.GetString("ExternalHostName", "SYSTEMIP"); |
@@ -563,7 +587,6 @@ namespace OpenSim.Framework | |||
563 | externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP"); | 587 | externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP"); |
564 | config.Set("ExternalHostName", externalName); | 588 | config.Set("ExternalHostName", externalName); |
565 | } | 589 | } |
566 | |||
567 | if (externalName == "SYSTEMIP") | 590 | if (externalName == "SYSTEMIP") |
568 | { | 591 | { |
569 | m_externalHostName = Util.GetLocalHost().ToString(); | 592 | m_externalHostName = Util.GetLocalHost().ToString(); |
@@ -576,24 +599,32 @@ namespace OpenSim.Framework | |||
576 | m_externalHostName = externalName; | 599 | m_externalHostName = externalName; |
577 | } | 600 | } |
578 | 601 | ||
602 | // RegionType | ||
579 | m_regionType = config.GetString("RegionType", String.Empty); | 603 | m_regionType = config.GetString("RegionType", String.Empty); |
604 | allKeys.Remove(("RegionType").ToLower()); | ||
580 | 605 | ||
581 | // Prim stuff | 606 | // Prim stuff |
582 | // | 607 | // |
583 | m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); | 608 | m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); |
584 | 609 | allKeys.Remove(("NonphysicalPrimMax").ToLower()); | |
585 | m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); | 610 | m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); |
586 | 611 | allKeys.Remove(("PhysicalPrimMax").ToLower()); | |
587 | m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); | 612 | m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); |
588 | 613 | allKeys.Remove(("ClampPrimSize").ToLower()); | |
589 | m_objectCapacity = config.GetInt("MaxPrims", 15000); | 614 | m_objectCapacity = config.GetInt("MaxPrims", 15000); |
590 | 615 | allKeys.Remove(("MaxPrims").ToLower()); | |
591 | m_agentCapacity = config.GetInt("MaxAgents", 100); | 616 | m_agentCapacity = config.GetInt("MaxAgents", 100); |
592 | 617 | allKeys.Remove(("MaxAgents").ToLower()); | |
593 | 618 | ||
594 | // Multi-tenancy | 619 | // Multi-tenancy |
595 | // | 620 | // |
596 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); | 621 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); |
622 | allKeys.Remove(("ScopeID").ToLower()); | ||
623 | |||
624 | foreach (String s in allKeys) | ||
625 | { | ||
626 | m_otherSettings.Add(s, config.GetString(s)); | ||
627 | } | ||
597 | } | 628 | } |
598 | 629 | ||
599 | private void WriteNiniConfig(IConfigSource source) | 630 | private void WriteNiniConfig(IConfigSource source) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a81ee79..ad2192d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5417,7 +5417,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5417 | presence.AbsolutePosition = presence.MoveToPositionTarget; | 5417 | presence.AbsolutePosition = presence.MoveToPositionTarget; |
5418 | presence.ResetMoveToTarget(); | 5418 | presence.ResetMoveToTarget(); |
5419 | 5419 | ||
5420 | if (presence.PhysicsActor.Flying) | 5420 | if (presence.Flying) |
5421 | { | 5421 | { |
5422 | // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot | 5422 | // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot |
5423 | // the target if flying. | 5423 | // the target if flying. |
@@ -5425,16 +5425,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5425 | // least be able to set collision status once, rather than 5 times to give it enough | 5425 | // least be able to set collision status once, rather than 5 times to give it enough |
5426 | // weighting so that that PhysicsActor thinks it really is colliding. | 5426 | // weighting so that that PhysicsActor thinks it really is colliding. |
5427 | for (int i = 0; i < 5; i++) | 5427 | for (int i = 0; i < 5; i++) |
5428 | presence.PhysicsActor.IsColliding = true; | 5428 | presence.IsColliding = true; |
5429 | 5429 | ||
5430 | if (presence.LandAtTarget) | 5430 | if (presence.LandAtTarget) |
5431 | presence.PhysicsActor.Flying = false; | 5431 | presence.Flying = false; |
5432 | 5432 | ||
5433 | // Vector3 targetPos = presence.MoveToPositionTarget; | 5433 | // Vector3 targetPos = presence.MoveToPositionTarget; |
5434 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | 5434 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; |
5435 | // if (targetPos.Z - terrainHeight < 0.2) | 5435 | // if (targetPos.Z - terrainHeight < 0.2) |
5436 | // { | 5436 | // { |
5437 | // presence.PhysicsActor.Flying = false; | 5437 | // presence.Flying = false; |
5438 | // } | 5438 | // } |
5439 | } | 5439 | } |
5440 | 5440 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4034621..5177273 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -142,12 +142,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
142 | { | 142 | { |
143 | get { return m_userFlags; } | 143 | get { return m_userFlags; } |
144 | } | 144 | } |
145 | private bool m_flyingOld; // add for fly velocity control | 145 | |
146 | // Flying | ||
147 | public bool Flying | ||
148 | { | ||
149 | get { return PhysicsActor != null && PhysicsActor.Flying; } | ||
150 | set { PhysicsActor.Flying = value; } | ||
151 | } | ||
152 | |||
153 | // add for fly velocity control | ||
154 | private bool FlyingOld {get; set;} | ||
146 | public bool WasFlying | 155 | public bool WasFlying |
147 | { | 156 | { |
148 | get { return m_wasFlying; } | 157 | get; private set; |
158 | } | ||
159 | |||
160 | public bool IsColliding | ||
161 | { | ||
162 | get { return PhysicsActor != null && PhysicsActor.IsColliding; } | ||
163 | // We would expect setting IsColliding to be private but it's used by a hack in Scene | ||
164 | set { PhysicsActor.IsColliding = value; } | ||
149 | } | 165 | } |
150 | private bool m_wasFlying; // add for fly velocity control | ||
151 | 166 | ||
152 | // private int m_lastColCount = -1; //KF: Look for Collision chnages | 167 | // private int m_lastColCount = -1; //KF: Look for Collision chnages |
153 | // private int m_updateCount = 0; //KF: Update Anims for a while | 168 | // private int m_updateCount = 0; //KF: Update Anims for a while |
@@ -697,9 +712,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
697 | set { | 712 | set { |
698 | if(value) | 713 | if(value) |
699 | { | 714 | { |
700 | if ((PhysicsActor != null) && PhysicsActor.Flying) | 715 | if (Flying) |
701 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 716 | m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
702 | else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) | 717 | else |
703 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 718 | m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
704 | } | 719 | } |
705 | m_inTransit = value; | 720 | m_inTransit = value; |
@@ -925,11 +940,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
925 | 940 | ||
926 | if (ForceFly) | 941 | if (ForceFly) |
927 | { | 942 | { |
928 | PhysicsActor.Flying = true; | 943 | Flying = true; |
929 | } | 944 | } |
930 | else if (FlyDisabled) | 945 | else if (FlyDisabled) |
931 | { | 946 | { |
932 | PhysicsActor.Flying = false; | 947 | Flying = false; |
933 | } | 948 | } |
934 | 949 | ||
935 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 950 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
@@ -1054,11 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1054 | /// <param name="pos"></param> | 1069 | /// <param name="pos"></param> |
1055 | public void Teleport(Vector3 pos) | 1070 | public void Teleport(Vector3 pos) |
1056 | { | 1071 | { |
1057 | bool isFlying = false; | 1072 | bool isFlying = Flying; |
1058 | if (PhysicsActor != null) | ||
1059 | isFlying = PhysicsActor.Flying; | ||
1060 | |||
1061 | m_log.DebugFormat("[SCENE PRESENCCE]: Local teleport, flying = {0}", isFlying); | ||
1062 | RemoveFromPhysicalScene(); | 1073 | RemoveFromPhysicalScene(); |
1063 | Velocity = Vector3.Zero; | 1074 | Velocity = Vector3.Zero; |
1064 | CheckLandingPoint(ref pos); | 1075 | CheckLandingPoint(ref pos); |
@@ -1070,10 +1081,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1070 | 1081 | ||
1071 | public void TeleportWithMomentum(Vector3 pos) | 1082 | public void TeleportWithMomentum(Vector3 pos) |
1072 | { | 1083 | { |
1073 | bool isFlying = false; | 1084 | bool isFlying = Flying; |
1074 | if (PhysicsActor != null) | ||
1075 | isFlying = PhysicsActor.Flying; | ||
1076 | |||
1077 | RemoveFromPhysicalScene(); | 1085 | RemoveFromPhysicalScene(); |
1078 | CheckLandingPoint(ref pos); | 1086 | CheckLandingPoint(ref pos); |
1079 | AbsolutePosition = pos; | 1087 | AbsolutePosition = pos; |
@@ -1208,8 +1216,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1208 | AbsolutePosition = pos; | 1216 | AbsolutePosition = pos; |
1209 | } | 1217 | } |
1210 | 1218 | ||
1211 | bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1219 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1212 | MakeRootAgent(AbsolutePosition, m_flying); | 1220 | MakeRootAgent(AbsolutePosition, flying); |
1213 | 1221 | ||
1214 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1222 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1215 | { | 1223 | { |
@@ -1434,7 +1442,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1434 | bool DCFlagKeyPressed = false; | 1442 | bool DCFlagKeyPressed = false; |
1435 | Vector3 agent_control_v3 = Vector3.Zero; | 1443 | Vector3 agent_control_v3 = Vector3.Zero; |
1436 | 1444 | ||
1437 | bool oldflying = PhysicsActor.Flying; | 1445 | bool oldflying = Flying; |
1438 | 1446 | ||
1439 | if (ForceFly) | 1447 | if (ForceFly) |
1440 | actor.Flying = true; | 1448 | actor.Flying = true; |
@@ -1454,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1454 | 1462 | ||
1455 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | 1463 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying |
1456 | // this prevents 'jumping' in inappropriate situations. | 1464 | // this prevents 'jumping' in inappropriate situations. |
1457 | if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying)) | 1465 | if (!Flying && (m_mouseLook || m_leftButtonDown)) |
1458 | dirVectors = GetWalkDirectionVectors(); | 1466 | dirVectors = GetWalkDirectionVectors(); |
1459 | else | 1467 | else |
1460 | dirVectors = Dir_Vectors; | 1468 | dirVectors = Dir_Vectors; |
@@ -1541,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1541 | // with something with the down arrow pressed. | 1549 | // with something with the down arrow pressed. |
1542 | 1550 | ||
1543 | // Only do this if we're flying | 1551 | // Only do this if we're flying |
1544 | if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly) | 1552 | if (Flying && !ForceFly) |
1545 | { | 1553 | { |
1546 | // Landing detection code | 1554 | // Landing detection code |
1547 | 1555 | ||
@@ -1549,7 +1557,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1549 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1557 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1550 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1558 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1551 | 1559 | ||
1552 | if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) | 1560 | if (Flying && IsColliding && controlland) |
1553 | { | 1561 | { |
1554 | // nesting this check because LengthSquared() is expensive and we don't | 1562 | // nesting this check because LengthSquared() is expensive and we don't |
1555 | // want to do it every step when flying. | 1563 | // want to do it every step when flying. |
@@ -1762,9 +1770,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1762 | Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | 1770 | Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); |
1763 | 1771 | ||
1764 | if (noFly) | 1772 | if (noFly) |
1765 | PhysicsActor.Flying = false; | 1773 | Flying = false; |
1766 | else if (pos.Z > terrainHeight) | 1774 | else if (pos.Z > terrainHeight) |
1767 | PhysicsActor.Flying = true; | 1775 | Flying = true; |
1768 | 1776 | ||
1769 | LandAtTarget = landAtTarget; | 1777 | LandAtTarget = landAtTarget; |
1770 | MovingToTarget = true; | 1778 | MovingToTarget = true; |
@@ -2330,42 +2338,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
2330 | Vector3 direc = vec * Rotation; | 2338 | Vector3 direc = vec * Rotation; |
2331 | direc.Normalize(); | 2339 | direc.Normalize(); |
2332 | 2340 | ||
2333 | if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control | 2341 | if (Flying != FlyingOld) // add for fly velocity control |
2334 | { | 2342 | { |
2335 | m_flyingOld = PhysicsActor.Flying; // add for fly velocity control | 2343 | FlyingOld = Flying; // add for fly velocity control |
2336 | if (!PhysicsActor.Flying) | 2344 | if (!Flying) |
2337 | m_wasFlying = true; // add for fly velocity control | 2345 | WasFlying = true; // add for fly velocity control |
2338 | } | 2346 | } |
2339 | 2347 | ||
2340 | if (PhysicsActor.IsColliding == true) | 2348 | if (IsColliding) |
2341 | m_wasFlying = false; // add for fly velocity control | 2349 | WasFlying = false; // add for fly velocity control |
2342 | 2350 | ||
2343 | if ((vec.Z == 0f) && !PhysicsActor.Flying) | 2351 | if ((vec.Z == 0f) && !Flying) |
2344 | direc.Z = 0f; // Prevent camera WASD up. | 2352 | direc.Z = 0f; // Prevent camera WASD up. |
2345 | 2353 | ||
2346 | direc *= 0.03f * 128f * SpeedModifier; | 2354 | direc *= 0.03f * 128f * SpeedModifier; |
2347 | 2355 | ||
2348 | if (PhysicsActor != null) | 2356 | if (PhysicsActor != null) |
2349 | { | 2357 | { |
2350 | if (PhysicsActor.Flying) | 2358 | if (Flying) |
2351 | { | 2359 | { |
2352 | direc *= 4.0f; | 2360 | direc *= 4.0f; |
2353 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 2361 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
2354 | //if (controlland) | 2362 | //if (controlland) |
2355 | // m_log.Info("[AGENT]: landCommand"); | 2363 | // m_log.Info("[AGENT]: landCommand"); |
2356 | //if (PhysicsActor.IsColliding) | 2364 | //if (IsColliding) |
2357 | // m_log.Info("[AGENT]: colliding"); | 2365 | // m_log.Info("[AGENT]: colliding"); |
2358 | //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) | 2366 | //if (Flying && IsColliding && controlland) |
2359 | //{ | 2367 | //{ |
2360 | // StopFlying(); | 2368 | // StopFlying(); |
2361 | // m_log.Info("[AGENT]: Stop Flying"); | 2369 | // m_log.Info("[AGENT]: Stop Flying"); |
2362 | //} | 2370 | //} |
2363 | } | 2371 | } |
2364 | if (Animator.Falling && m_wasFlying) // if falling from flying, disable motion add | 2372 | if (Animator.Falling && WasFlying) // if falling from flying, disable motion add |
2365 | { | 2373 | { |
2366 | direc *= 0.0f; | 2374 | direc *= 0.0f; |
2367 | } | 2375 | } |
2368 | else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) | 2376 | else if (!Flying && IsColliding) |
2369 | { | 2377 | { |
2370 | if (direc.Z > 2.0f) | 2378 | if (direc.Z > 2.0f) |
2371 | { | 2379 | { |
@@ -2835,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2835 | { | 2843 | { |
2836 | if (m_requestedSitTargetUUID == UUID.Zero) | 2844 | if (m_requestedSitTargetUUID == UUID.Zero) |
2837 | { | 2845 | { |
2838 | bool isFlying = PhysicsActor.Flying; | 2846 | bool isFlying = Flying; |
2839 | RemoveFromPhysicalScene(); | 2847 | RemoveFromPhysicalScene(); |
2840 | 2848 | ||
2841 | Vector3 pos = AbsolutePosition; | 2849 | Vector3 pos = AbsolutePosition; |
@@ -2862,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2862 | { | 2870 | { |
2863 | if (m_requestedSitTargetUUID == UUID.Zero) | 2871 | if (m_requestedSitTargetUUID == UUID.Zero) |
2864 | { | 2872 | { |
2865 | bool isFlying = PhysicsActor.Flying; | 2873 | bool isFlying = Flying; |
2866 | RemoveFromPhysicalScene(); | 2874 | RemoveFromPhysicalScene(); |
2867 | 2875 | ||
2868 | Vector3 pos = AbsolutePosition; | 2876 | Vector3 pos = AbsolutePosition; |
@@ -2912,7 +2920,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2912 | { | 2920 | { |
2913 | try | 2921 | try |
2914 | { | 2922 | { |
2915 | return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); | 2923 | return m_scene.CrossAgentToNewRegion(this, Flying); |
2916 | } | 2924 | } |
2917 | catch | 2925 | catch |
2918 | { | 2926 | { |
@@ -3188,7 +3196,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3188 | Appearance = new AvatarAppearance(cAgent.Appearance); | 3196 | Appearance = new AvatarAppearance(cAgent.Appearance); |
3189 | if (PhysicsActor != null) | 3197 | if (PhysicsActor != null) |
3190 | { | 3198 | { |
3191 | bool isFlying = PhysicsActor.Flying; | 3199 | bool isFlying = Flying; |
3192 | RemoveFromPhysicalScene(); | 3200 | RemoveFromPhysicalScene(); |
3193 | AddToPhysicalScene(isFlying); | 3201 | AddToPhysicalScene(isFlying); |
3194 | } | 3202 | } |
@@ -3291,7 +3299,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3291 | 3299 | ||
3292 | private void OutOfBoundsCall(Vector3 pos) | 3300 | private void OutOfBoundsCall(Vector3 pos) |
3293 | { | 3301 | { |
3294 | //bool flying = PhysicsActor.Flying; | 3302 | //bool flying = Flying; |
3295 | //RemoveFromPhysicalScene(); | 3303 | //RemoveFromPhysicalScene(); |
3296 | 3304 | ||
3297 | //AddToPhysicalScene(flying); | 3305 | //AddToPhysicalScene(flying); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 4a0533c..89f8007 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
61 | 61 | ||
62 | TestScene scene = SceneHelpers.SetupScene(); | 62 | TestScene scene = SceneHelpers.SetupScene(); |
63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
64 | sp.PhysicsActor.Flying = true; | 64 | sp.Flying = true; |
65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); | 65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); |
66 | 66 | ||
67 | Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); | 67 | Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index 64c36ff..442cb8b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
79 | // Vector3 startPos = new Vector3(128, 128, 30); | 79 | // Vector3 startPos = new Vector3(128, 128, 30); |
80 | 80 | ||
81 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. | 81 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. |
82 | sp.PhysicsActor.Flying = true; | 82 | sp.Flying = true; |
83 | 83 | ||
84 | m_scene.Update(); | 84 | m_scene.Update(); |
85 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); | 85 | Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index dce0ec8..9c66b25 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -175,7 +175,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
175 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 175 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
176 | 176 | ||
177 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. | 177 | // For now, we'll make the scene presence fly to simplify this test, but this needs to change. |
178 | npc.PhysicsActor.Flying = true; | 178 | npc.Flying = true; |
179 | 179 | ||
180 | scene.Update(); | 180 | scene.Update(); |
181 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 181 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fcb1278..5f5d3cb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5984,9 +5984,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5984 | // note: this may need some tweaking when walking downhill. you "fall down" for a brief instant | 5984 | // note: this may need some tweaking when walking downhill. you "fall down" for a brief instant |
5985 | // and don't collide when walking downhill, which instantly registers as in-air, briefly. should | 5985 | // and don't collide when walking downhill, which instantly registers as in-air, briefly. should |
5986 | // there be some minimum non-collision threshold time before claiming the avatar is in-air? | 5986 | // there be some minimum non-collision threshold time before claiming the avatar is in-air? |
5987 | if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 && | 5987 | if ((flags & ScriptBaseClass.AGENT_WALKING) == 0 && !agent.IsColliding ) |
5988 | agent.PhysicsActor != null && | ||
5989 | !agent.PhysicsActor.IsColliding) | ||
5990 | { | 5988 | { |
5991 | flags |= ScriptBaseClass.AGENT_IN_AIR; | 5989 | flags |= ScriptBaseClass.AGENT_IN_AIR; |
5992 | } | 5990 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c0d2f38..c57684b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1559,209 +1559,83 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1559 | return m_ScriptEngine.World.GetSimulatorVersion(); | 1559 | return m_ScriptEngine.World.GetSimulatorVersion(); |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | public Hashtable osParseJSON(string JSON) | 1562 | private Hashtable osdToHashtable(OSDMap map) |
1563 | { | ||
1564 | Hashtable result = new Hashtable(); | ||
1565 | foreach (KeyValuePair<string, OSD> item in map) { | ||
1566 | result.Add(item.Key, osdToObject(item.Value)); | ||
1567 | } | ||
1568 | return result; | ||
1569 | } | ||
1570 | |||
1571 | private ArrayList osdToArray(OSDArray list) | ||
1572 | { | ||
1573 | ArrayList result = new ArrayList(); | ||
1574 | foreach ( OSD item in list ) { | ||
1575 | result.Add(osdToObject(item)); | ||
1576 | } | ||
1577 | return result; | ||
1578 | } | ||
1579 | |||
1580 | private Object osdToObject(OSD decoded) | ||
1581 | { | ||
1582 | if ( decoded is OSDString ) { | ||
1583 | return (string) decoded.AsString(); | ||
1584 | } else if ( decoded is OSDInteger ) { | ||
1585 | return (int) decoded.AsInteger(); | ||
1586 | } else if ( decoded is OSDReal ) { | ||
1587 | return (float) decoded.AsReal(); | ||
1588 | } else if ( decoded is OSDBoolean ) { | ||
1589 | return (bool) decoded.AsBoolean(); | ||
1590 | } else if ( decoded is OSDMap ) { | ||
1591 | return osdToHashtable((OSDMap) decoded); | ||
1592 | } else if ( decoded is OSDArray ) { | ||
1593 | return osdToArray((OSDArray) decoded); | ||
1594 | } else { | ||
1595 | return null; | ||
1596 | } | ||
1597 | } | ||
1598 | |||
1599 | public Object osParseJSONNew(string JSON) | ||
1563 | { | 1600 | { |
1564 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); | 1601 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); |
1565 | 1602 | ||
1566 | m_host.AddScriptLPS(1); | 1603 | m_host.AddScriptLPS(1); |
1567 | 1604 | ||
1568 | // see http://www.json.org/ for more details on JSON | ||
1569 | |||
1570 | string currentKey = null; | ||
1571 | Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this | ||
1572 | Hashtable jsondata = new Hashtable(); // the hashtable to be returned | ||
1573 | int i = 0; | ||
1574 | try | 1605 | try |
1575 | { | 1606 | { |
1607 | OSD decoded = OSDParser.DeserializeJson(JSON); | ||
1608 | return osdToObject(decoded); | ||
1609 | } | ||
1610 | catch(Exception e) | ||
1611 | { | ||
1612 | OSSLError("osParseJSONNew: Problems decoding JSON string " + JSON + " : " + e.Message) ; | ||
1613 | return null; | ||
1614 | } | ||
1615 | } | ||
1576 | 1616 | ||
1577 | // iterate through the serialised stream of tokens and store at the right depth in the hashtable | 1617 | public Hashtable osParseJSON(string JSON) |
1578 | // the top level hashtable may contain more nested hashtables within it each containing an objects representation | 1618 | { |
1579 | for (i = 0; i < JSON.Length; i++) | 1619 | CheckThreatLevel(ThreatLevel.None, "osParseJSON"); |
1580 | { | ||
1581 | |||
1582 | // m_log.Debug(""+JSON[i]); | ||
1583 | switch (JSON[i]) | ||
1584 | { | ||
1585 | case '{': | ||
1586 | // create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON | ||
1587 | |||
1588 | Hashtable currentObject = new Hashtable(); | ||
1589 | if (objectStack.Count == 0) // the stack should only be empty for the first outer object | ||
1590 | { | ||
1591 | |||
1592 | objectStack.Push(jsondata); | ||
1593 | } | ||
1594 | else if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1595 | { | ||
1596 | // add it to the parent array | ||
1597 | ((ArrayList)objectStack.Peek()).Add(currentObject); | ||
1598 | objectStack.Push(currentObject); | ||
1599 | } | ||
1600 | else | ||
1601 | { | ||
1602 | // add it to the parent hashtable | ||
1603 | ((Hashtable)objectStack.Peek()).Add(currentKey,currentObject); | ||
1604 | objectStack.Push(currentObject); | ||
1605 | } | ||
1606 | |||
1607 | // clear the key | ||
1608 | currentKey = null; | ||
1609 | break; | ||
1610 | |||
1611 | case '}': | ||
1612 | // pop the hashtable off the stack | ||
1613 | objectStack.Pop(); | ||
1614 | break; | ||
1615 | |||
1616 | case '"':// string boundary | ||
1617 | |||
1618 | string tokenValue = ""; | ||
1619 | i++; // move to next char | ||
1620 | |||
1621 | // just loop through until the next quote mark storing the string, ignore quotes with pre-ceding \ | ||
1622 | while (JSON[i] != '"') | ||
1623 | { | ||
1624 | tokenValue += JSON[i]; | ||
1625 | |||
1626 | // handle escaped double quotes \" | ||
1627 | if (JSON[i] == '\\' && JSON[i+1] == '"') | ||
1628 | { | ||
1629 | tokenValue += JSON[i+1]; | ||
1630 | i++; | ||
1631 | } | ||
1632 | i++; | ||
1633 | |||
1634 | } | ||
1635 | |||
1636 | // ok we've got a string, if we've got an array on the top of the stack then we store it | ||
1637 | if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1638 | { | ||
1639 | ((ArrayList)objectStack.Peek()).Add(tokenValue); | ||
1640 | } | ||
1641 | else if (currentKey == null) // no key stored and its not an array this must be a key so store it | ||
1642 | { | ||
1643 | currentKey = tokenValue; | ||
1644 | } | ||
1645 | else | ||
1646 | { | ||
1647 | // we have a key so lets store this value | ||
1648 | ((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue); | ||
1649 | // now lets clear the key, we're done with it and moving on | ||
1650 | currentKey = null; | ||
1651 | } | ||
1652 | |||
1653 | break; | ||
1654 | |||
1655 | case ':':// key : value separator | ||
1656 | // just ignore | ||
1657 | break; | ||
1658 | |||
1659 | case ' ':// spaces | ||
1660 | // just ignore | ||
1661 | break; | ||
1662 | |||
1663 | case '[': // array start | ||
1664 | ArrayList currentArray = new ArrayList(); | ||
1665 | |||
1666 | if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1667 | { | ||
1668 | ((ArrayList)objectStack.Peek()).Add(currentArray); | ||
1669 | } | ||
1670 | else | ||
1671 | { | ||
1672 | ((Hashtable)objectStack.Peek()).Add(currentKey,currentArray); | ||
1673 | // clear the key | ||
1674 | currentKey = null; | ||
1675 | } | ||
1676 | objectStack.Push(currentArray); | ||
1677 | |||
1678 | break; | ||
1679 | |||
1680 | case ',':// seperator | ||
1681 | // just ignore | ||
1682 | break; | ||
1683 | |||
1684 | case ']'://Array end | ||
1685 | // pop the array off the stack | ||
1686 | objectStack.Pop(); | ||
1687 | break; | ||
1688 | |||
1689 | case 't': // we've found a character start not in quotes, it must be a boolean true | ||
1690 | |||
1691 | if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1692 | { | ||
1693 | ((ArrayList)objectStack.Peek()).Add(true); | ||
1694 | } | ||
1695 | else | ||
1696 | { | ||
1697 | ((Hashtable)objectStack.Peek()).Add(currentKey,true); | ||
1698 | currentKey = null; | ||
1699 | } | ||
1700 | |||
1701 | //advance the counter to the letter 'e' | ||
1702 | i = i + 3; | ||
1703 | break; | ||
1704 | |||
1705 | case 'f': // we've found a character start not in quotes, it must be a boolean false | ||
1706 | |||
1707 | if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1708 | { | ||
1709 | ((ArrayList)objectStack.Peek()).Add(false); | ||
1710 | } | ||
1711 | else | ||
1712 | { | ||
1713 | ((Hashtable)objectStack.Peek()).Add(currentKey,false); | ||
1714 | currentKey = null; | ||
1715 | } | ||
1716 | //advance the counter to the letter 'e' | ||
1717 | i = i + 4; | ||
1718 | break; | ||
1719 | |||
1720 | case '\n':// carriage return | ||
1721 | // just ignore | ||
1722 | break; | ||
1723 | |||
1724 | case '\r':// carriage return | ||
1725 | // just ignore | ||
1726 | break; | ||
1727 | |||
1728 | default: | ||
1729 | // ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately | ||
1730 | // but for now we'll just do them as strings | ||
1731 | |||
1732 | string numberValue = ""; | ||
1733 | |||
1734 | // just loop through until the next known marker quote mark storing the string | ||
1735 | while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ') | ||
1736 | { | ||
1737 | numberValue += "" + JSON[i++]; | ||
1738 | } | ||
1739 | |||
1740 | i--; // we want to process this caracter that marked the end of this string in the main loop | ||
1741 | 1620 | ||
1742 | // ok we've got a string, if we've got an array on the top of the stack then we store it | 1621 | m_host.AddScriptLPS(1); |
1743 | if (objectStack.Peek().ToString() == "System.Collections.ArrayList") | ||
1744 | { | ||
1745 | ((ArrayList)objectStack.Peek()).Add(numberValue); | ||
1746 | } | ||
1747 | else | ||
1748 | { | ||
1749 | // we have a key so lets store this value | ||
1750 | ((Hashtable)objectStack.Peek()).Add(currentKey,numberValue); | ||
1751 | // now lets clear the key, we're done with it and moving on | ||
1752 | currentKey = null; | ||
1753 | } | ||
1754 | 1622 | ||
1755 | break; | 1623 | Object decoded = osParseJSONNew(JSON); |
1756 | } | 1624 | |
1625 | if ( decoded is Hashtable ) { | ||
1626 | return (Hashtable) decoded; | ||
1627 | } else if ( decoded is ArrayList ) { | ||
1628 | ArrayList decoded_list = (ArrayList) decoded; | ||
1629 | Hashtable fakearray = new Hashtable(); | ||
1630 | int i = 0; | ||
1631 | for ( i = 0; i < decoded_list.Count ; i++ ) { | ||
1632 | fakearray.Add(i, decoded_list[i]); | ||
1757 | } | 1633 | } |
1634 | return fakearray; | ||
1635 | } else { | ||
1636 | OSSLError("osParseJSON: unable to parse JSON string " + JSON); | ||
1637 | return null; | ||
1758 | } | 1638 | } |
1759 | catch(Exception) | ||
1760 | { | ||
1761 | OSSLError("osParseJSON: The JSON string is not valid " + JSON) ; | ||
1762 | } | ||
1763 | |||
1764 | return jsondata; | ||
1765 | } | 1639 | } |
1766 | 1640 | ||
1767 | /// <summary> | 1641 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index a61d553..221a513 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections; | 29 | using System.Collections; |
29 | using OpenSim.Region.ScriptEngine.Interfaces; | 30 | using OpenSim.Region.ScriptEngine.Interfaces; |
30 | 31 | ||
@@ -140,6 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
140 | 141 | ||
141 | string osGetScriptEngineName(); | 142 | string osGetScriptEngineName(); |
142 | string osGetSimulatorVersion(); | 143 | string osGetSimulatorVersion(); |
144 | Object osParseJSONNew(string JSON); | ||
143 | Hashtable osParseJSON(string JSON); | 145 | Hashtable osParseJSON(string JSON); |
144 | 146 | ||
145 | void osMessageObject(key objectUUID,string message); | 147 | void osMessageObject(key objectUUID,string message); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9e7c8da..0d7d5ea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -396,6 +396,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
396 | { | 396 | { |
397 | return m_OSSL_Functions.osParseJSON(JSON); | 397 | return m_OSSL_Functions.osParseJSON(JSON); |
398 | } | 398 | } |
399 | |||
400 | public Object osParseJSONNew(string JSON) | ||
401 | { | ||
402 | return m_OSSL_Functions.osParseJSONNew(JSON); | ||
403 | } | ||
399 | 404 | ||
400 | public void osMessageObject(key objectUUID,string message) | 405 | public void osMessageObject(key objectUUID,string message) |
401 | { | 406 | { |