public RexScriptInterface(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID, RexScriptEngine vScriptEngine) { myScriptEngine = vScriptEngine; IScriptModule[] scriptModules = myScriptEngine.World.RequestModuleInterfaces<IScriptModule>(); foreach (IScriptModule sm in scriptModules) { if (sm is IScriptEngine) { IScriptEngine ise = (IScriptEngine)sm; if (ise.ScriptEngineName == "XEngine") { m_ScriptEngine = ise; m_log.Info("[REXSCRIPT]: Found XEngine"); } } } if (m_ScriptEngine == null) { m_log.Error("[REXSCRIPT]: Could not find XEngine"); throw new Exception("Could not find XEngine"); } //this was causing lots of errors. instead of creating a new instance of .Net script engine, check for an existing one and use that //this requires of using .NET scripting engine when using the python engine. //m_ScriptEngine = new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine(); //m_ScriptEngine.World = myScriptEngine.World; try { base.Initialize(m_ScriptEngine, host, localID, itemID); } catch (Exception e) { m_log.Error("[REXSCRIPT]: Initializting rex scriptengine failed: " + e.ToString()); } OpenSim.Region.Framework.Interfaces.IRegionModule module = myScriptEngine.World.Modules["RexObjectsModule"]; if (module != null && module is ModrexObjects) { m_rexObjects = (ModrexObjects)module; } }
public RexEventManager(RexScriptEngine scriptEngine) { m_scriptEngine = scriptEngine; m_log.InfoFormat("[RexScriptEngine]: Hooking up to server events"); OpenSim.Region.Framework.Interfaces.IRegionModule module = m_scriptEngine.World.Modules["RexObjectsModule"]; if (module != null && module is ModrexObjects) { m_rexObjects = (ModrexObjects)module; m_rexObjects.OnPythonClassChange += onPythonClassChange; //myScriptEngine.World.EventManager.OnPythonClassChange += OnPythonClassChange; //this was launched from SceneObjectPart } m_scriptEngine.World.EventManager.OnObjectGrab += touch_start; // myScriptEngine.World.EventManager.OnRezScript += OnRezScript; // myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; // myScriptEngine.World.EventManager.OnFrame += OnFrame; m_scriptEngine.World.EventManager.OnNewClient += OnNewClient; //m_scriptEngine.World.EventManager.OnNewPresence += OnNewPresence; //this ain't triggered in OpenSim no more m_scriptEngine.World.EventManager.OnRemovePresence += OnRemovePresence; m_scriptEngine.World.EventManager.OnShutdown += OnShutDown; ///TODO: ///These events were added to forked version. Some of them can be handled ///other way, some need changes to core and some need changes to physics engine. //myScriptEngine.World.EventManager.OnAddEntity += OnAddEntity; //this was previously launched from Scene or InnerScene //myScriptEngine.World.EventManager.OnRemoveEntity += OnRemoveEntity; //this was previously launched from Scene //myScriptEngine.World.EventManager.OnPrimVolumeCollision += OnPrimVolumeCollision; //this was launched from PhysicActor m_scriptEngine.World.EventManager.OnScriptColliding += HandleScriptColliding; //No rex collision, but the same than in LSL //these are now listened in ScriptListener class //m_scriptEngine.World.EventManager.OnChatFromWorld += OnRexScriptListen; //m_scriptEngine.World.EventManager.OnChatBroadcast += OnRexScriptListen; //m_scriptEngine.World.EventManager.OnChatFromClient += OnRexScriptListen; m_scriptListener = m_scriptEngine.World.RequestModuleInterface<ScriptListener>(); m_scriptListener.OnNewMessage += OnRexScriptListen; m_scriptEngine.World.AddCommand(scriptEngine, "python", "python help", "Gives more help on python commands", PythonScriptCommand); //OpenSim.OpenSim.RegisterCmd("python", PythonScriptCommand, "Rex python commands. Type \"python help\" for more information."); }
public RexPythonScriptAccessImpl(RexScriptEngine vEngine) { myScriptEngine = vEngine; }