public void RegisterScriptController(ScriptControllers SC)
 {
     lock (scriptedcontrols)
     {
         scriptedcontrols[SC.itemID] = SC;
     }
     m_sp.ControllingClient.SendTakeControls((int) SC.eventControls, true, true);
 }
            public void RegisterControlEventsToScript(int controls, int accept, int pass_on, ISceneChildEntity part,
                UUID Script_item_UUID)
            {
                ScriptControllers obj = new ScriptControllers
                                            {
                                                ignoreControls = ScriptControlled.CONTROL_ZERO,
                                                eventControls = ScriptControlled.CONTROL_ZERO,
                                                itemID = Script_item_UUID,
                                                part = part
                                            };

                if (pass_on == 0 && accept == 0)
                {
                    IgnoredControls |= (ScriptControlled) controls;
                    obj.ignoreControls = (ScriptControlled) controls;
                }

                if (pass_on == 0 && accept == 1)
                {
                    IgnoredControls |= (ScriptControlled) controls;
                    obj.ignoreControls = (ScriptControlled) controls;
                    obj.eventControls = (ScriptControlled) controls;
                }
                if (pass_on == 1 && accept == 1)
                {
                    IgnoredControls = ScriptControlled.CONTROL_ZERO;
                    obj.eventControls = (ScriptControlled) controls;
                    obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
                }

                lock (scriptedcontrols)
                {
                    if (pass_on == 1 && accept == 0)
                    {
                        IgnoredControls &= ~(ScriptControlled) controls;
                        if (scriptedcontrols.ContainsKey(Script_item_UUID))
                            scriptedcontrols.Remove(Script_item_UUID);
                    }
                    else
                    {
                        scriptedcontrols[Script_item_UUID] = obj;
                    }
                }
                m_sp.ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
            }