diff options
-rw-r--r-- | indra/newview/llagentlistener.cpp | 8 | ||||
-rw-r--r-- | indra/newview/scripts/lua/require/LLListener.lua | 18 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_LLChatListener.lua | 4 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_autopilot.lua | 4 |
4 files changed, 17 insertions, 17 deletions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index 10f56c4eb3..14e443ec4e 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -87,7 +87,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) add("startAutoPilot", "Start the autopilot system using the following parameters:\n" "[\"target_global\"]: array of target global {x, y, z} position\n" - "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]\n" + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]\n" "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n" "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]\n" @@ -100,7 +100,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n" "[\"target_global\"]: array of target global {x, y, z} position\n" "[\"leader_id\"]: uuid of target autopilot is following\n" - "[\"stop_distance\"]: target maximum distance from target\n" + "[\"stop_distance\"]: maximum stop distance from target\n" "[\"target_distance\"]: last known distance from target\n" "[\"use_rotation\"]: boolean indicating if autopilot has a target facing rotation\n" "[\"target_facing\"]: array of {x, y} target direction to face\n" @@ -112,7 +112,7 @@ LLAgentListener::LLAgentListener(LLAgent &agent) "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n" "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n" "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" - "[\"stop_distance\"]: target maximum distance from target [default: autopilot guess]", + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]", &LLAgentListener::startFollowPilot, llsd::map("reply", LLSD())); add("setAutoPilotTarget", @@ -496,7 +496,7 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) if (!gObjectList.findObject(target_id)) { - std::string target_info = event_data.has("leader_id") ? event_data["target_id"] : event_data["avatar_name"]; + std::string target_info = event_data.has("leader_id") ? event_data["leader_id"] : event_data["avatar_name"]; return response.error(stringize("Target ", std::quoted(target_info), " was not found")); } diff --git a/indra/newview/scripts/lua/require/LLListener.lua b/indra/newview/scripts/lua/require/LLListener.lua index e3bfb6b358..b05f966097 100644 --- a/indra/newview/scripts/lua/require/LLListener.lua +++ b/indra/newview/scripts/lua/require/LLListener.lua @@ -6,12 +6,12 @@ local util = require 'util' local LLListener = {} local waitfor = {} local listener_name = {} -local pump = {} -function LLListener:new() +function LLListener:new(pump_name) local obj = setmetatable({}, self) self.__index = self - obj.name = 'Listener' + obj.name = 'Listener:' .. pump_name + obj._pump = pump_name return obj end @@ -23,11 +23,11 @@ function LLListener:handleMessages(event_data) return true end -function LLListener:start(pump_name) - pump = pump_name +function LLListener:start() + _pump = self._pump waitfor = leap.WaitFor(-1, self.name) - function waitfor:filter(pump_, data) - if pump == pump_ then + function waitfor:filter(pump, data) + if _pump == pump then return data end end @@ -39,11 +39,11 @@ function LLListener:start(pump_name) end end) - listener_name = leap.request(leap.cmdpump(), {op='listen', source=pump, listener="LLListener", tweak=true}).listener + listener_name = leap.request(leap.cmdpump(), {op='listen', source=_pump, listener="LLListener", tweak=true}).listener end function LLListener:stop() - leap.send(leap.cmdpump(), {op='stoplistening', source=pump, listener=listener_name}) + leap.send(leap.cmdpump(), {op='stoplistening', source=self._pump, listener=listener_name}) waitfor:close() end diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua index 1df2880f3d..0f269b54e6 100644 --- a/indra/newview/scripts/lua/test_LLChatListener.lua +++ b/indra/newview/scripts/lua/test_LLChatListener.lua @@ -22,7 +22,7 @@ function openOrEcho(message) end end -local listener = LLListener() +local listener = LLListener(LLChat.nearbyChatPump) function listener:handleMessages(event_data) if string.find(event_data.message, '[LUA]') then @@ -36,4 +36,4 @@ function listener:handleMessages(event_data) return true end -listener:start(LLChat.nearbyChatPump) +listener:start() diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua index 0560477d38..09c85c140a 100644 --- a/indra/newview/scripts/lua/test_autopilot.lua +++ b/indra/newview/scripts/lua/test_autopilot.lua @@ -7,7 +7,7 @@ pos[2]+=5 -- delta y LLAgent.requestStand() LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1} -local listener = LLListener() +local listener = LLListener(LLAgent.autoPilotPump) function listener:handleMessages(event_data) if event_data.success then @@ -19,4 +19,4 @@ function listener:handleMessages(event_data) return false end -listener:start(LLAgent.autoPilotPump) +listener:start() |