aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-25 17:26:32 +0000
committerMelanie Thielker2008-09-25 17:26:32 +0000
commitf11107821e259d544dc42648f4cdba2b123cd71e (patch)
tree5d288d96a2eb07788ae40130736215599eb9bcec /OpenSim/Region/ScriptEngine/Shared/Instance
parentMantis#2017. Thank you kindly, Tyre, for a patch that solves: (diff)
downloadopensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.zip
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.gz
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.bz2
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.xz
Add an extension to allow registering multiple interfaces of a type with
Scene. Make the script engines check that the engine name in the //Engine:language comment is a valid engine and treat it as a normal comment if it's not. //DotNetEngine: needs to be written as //ScriptEngine.DotNetEngine: now, since that is it's real internal name. //XEngine: still works
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs126
1 files changed, 65 insertions, 61 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 28a3b11..6e6d169 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -567,86 +567,90 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
567 } 567 }
568 else 568 else
569 { 569 {
570 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 570 if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
571 m_LocalID); 571 data.EventName == "control") // Don't freeze avies!
572 // m_Engine.Log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
573 // m_PrimName, m_ScriptName, data.EventName, m_State);
574
575 try
576 { 572 {
577 m_CurrentEvent = data.EventName; 573 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
578 m_EventStart = DateTime.Now; 574 m_LocalID);
579 m_InEvent = true; 575 // m_Engine.Log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
576 // m_PrimName, m_ScriptName, data.EventName, m_State);
580 577
581 m_Script.ExecuteEvent(State, data.EventName, data.Params); 578 try
579 {
580 m_CurrentEvent = data.EventName;
581 m_EventStart = DateTime.Now;
582 m_InEvent = true;
582 583
583 m_InEvent = false; 584 m_Script.ExecuteEvent(State, data.EventName, data.Params);
584 m_CurrentEvent = String.Empty;
585 585
586 if (m_SaveState) 586 m_InEvent = false;
587 { 587 m_CurrentEvent = String.Empty;
588 // This will be the very first event we deliver
589 // (state_entry) in defualt state
590 //
591 588
592 SaveState(m_Assembly); 589 if (m_SaveState)
590 {
591 // This will be the very first event we deliver
592 // (state_entry) in defualt state
593 //
593 594
594 m_SaveState = false; 595 SaveState(m_Assembly);
595 }
596 }
597 catch (Exception e)
598 {
599 m_InEvent = false;
600 m_CurrentEvent = String.Empty;
601 596
602 if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException)))) 597 m_SaveState = false;
598 }
599 }
600 catch (Exception e)
603 { 601 {
604 if (e is System.Threading.ThreadAbortException) 602 m_InEvent = false;
603 m_CurrentEvent = String.Empty;
604
605 if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException))))
605 { 606 {
606 lock (m_EventQueue) 607 if (e is System.Threading.ThreadAbortException)
607 { 608 {
608 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 609 lock (m_EventQueue)
609 { 610 {
610 m_CurrentResult=m_Engine.QueueEventHandler(this); 611 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
612 {
613 m_CurrentResult=m_Engine.QueueEventHandler(this);
614 }
615 else
616 {
617 m_CurrentResult = null;
618 }
611 } 619 }
612 else
613 {
614 m_CurrentResult = null;
615 }
616 }
617 620
618 m_DetectParams = null; 621 m_DetectParams = null;
619 622
620 return 0; 623 return 0;
621 } 624 }
622 625
623 try 626 try
624 { 627 {
625 // DISPLAY ERROR INWORLD 628 // DISPLAY ERROR INWORLD
626 string text = "Runtime error:\n" + e.InnerException.ToString(); 629 string text = "Runtime error:\n" + e.InnerException.ToString();
627 if (text.Length > 1000) 630 if (text.Length > 1000)
628 text = text.Substring(0, 1000); 631 text = text.Substring(0, 1000);
629 m_Engine.World.SimChat(Utils.StringToBytes(text), 632 m_Engine.World.SimChat(Utils.StringToBytes(text),
630 ChatTypeEnum.DebugChannel, 2147483647, 633 ChatTypeEnum.DebugChannel, 2147483647,
631 part.AbsolutePosition, 634 part.AbsolutePosition,
632 part.Name, part.UUID, false); 635 part.Name, part.UUID, false);
636 }
637 catch (Exception e2) // LEGIT: User Scripting
638 {
639 m_Engine.Log.Error("[Script]: "+
640 "Error displaying error in-world: " +
641 e2.ToString());
642 m_Engine.Log.Error("[Script]: " +
643 "Errormessage: Error compiling script:\r\n" +
644 e.ToString());
645 }
633 } 646 }
634 catch (Exception e2) // LEGIT: User Scripting 647 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
635 { 648 {
636 m_Engine.Log.Error("[Script]: "+ 649 m_InSelfDelete = true;
637 "Error displaying error in-world: " + 650 if (part != null && part.ParentGroup != null)
638 e2.ToString()); 651 m_Engine.World.DeleteSceneObject(part.ParentGroup);
639 m_Engine.Log.Error("[Script]: " +
640 "Errormessage: Error compiling script:\r\n" +
641 e.ToString());
642 } 652 }
643 } 653 }
644 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
645 {
646 m_InSelfDelete = true;
647 if (part != null && part.ParentGroup != null)
648 m_Engine.World.DeleteSceneObject(part.ParentGroup);
649 }
650 } 654 }
651 } 655 }
652 656