/// <summary> /// Handler for touch events from the world /// </summary> /// <param name="sender">The object which sent the touch event</param> /// <param name="args">Any arguments attached to the touch event</param> public void touchListener(IObject sender, TouchEventArgs args) { if (listening.Contains(sender.GlobalID)) { touchQ.qItem(new Pair <UUID, TouchEventArgs>(sender.GlobalID, args)); DB.Print("Entry Point received touch event", Levels.SCRIPTS); } }
/// <summary> /// Handler for chat events /// </summary> /// <param name="world">The world object which is the key to the in world scenegraph</param> /// <param name="args">Any arguments related to the chat event</param> public void chatListener(IWorld world, ChatEventArgs args) { try { this.world = world; if (proxy != null) { proxy.updateWorld(world); } if (listening.Contains(args.Sender.GlobalID) || !(args.Sender is IAvatar)) { return; } } catch (Exception e) { DB.Exception(e, "Problem updating proxy with world", Levels.SCRIPTS); } try { if (world.Objects[hostID] == null || !world.Objects[hostID].Exists) { DB.Print("Controller object removed, closing down script completely", Levels.ALWAYS); shutdown(); return; } } catch (Exception e) { DB.Exception(e, "Unable to perform checks on host object", Levels.SCRIPTS); DB.Print("Controller object removed, closing down script completely", Levels.ALWAYS); shutdown(); return; } if (!isRestart(args.Text) && !isStart(args.Text) && !isShutdown(world, args.Text, args.Sender.Name) && !isClear(args.Text, args.Sender)) { if (chatQ != null && chatQ.IsRunning) { chatQ.qItem(new Pair <IEntity, string>(args.Sender, args.Text)); DB.Print("Entry Point passed down chat event: " + args.Text, Levels.SCRIPTS); } } }
/// <summary> /// Thread that consumes events which are queued when opensim triggers chat or touch events /// </summary> private void checkThread() { DB.ThreadStarted(); cont = true; while (cont) { UUID target = proxy.getListenerTarget(); while (!proxy.Shutdown && !target.Equals(UUID.Zero)) { touchAddQ.qItem(target); target = proxy.getListenerTarget(); } if (proxy == null || proxy.Shutdown) { shutdownProxy(); } else { Util.Wait(50, proxy != null && !proxy.Shutdown); } } DB.ThreadStopped(); }