Class: LibSL::AgentManager
- Inherits:
-
Object
- Object
- LibSL::AgentManager
- Defined in:
- lib/agent.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#look_at ⇒ Object
readonly
Returns the value of attribute look_at.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#region_handle ⇒ Object
readonly
Returns the value of attribute region_handle.
-
#region_name ⇒ Object
readonly
Returns the value of attribute region_name.
Instance Method Summary collapse
-
#chat(message, type = :normal, channel = 0) ⇒ Object
Send a chat message to the simulator or >0 (for scripts listening on that channel).
-
#im(message, to) ⇒ Object
Send an instant message to another agent.
-
#initialize(client) ⇒ AgentManager
constructor
New AgentManager.
-
#move_to_sim(simulator) ⇒ Object
Complete a transfer to a sim (e.g. after login or teleport).
-
#send_money(amount, to) ⇒ Object
Send Linden$ to another agent.
Constructor Details
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/agent.rb', line 5 def client @client end |
#look_at ⇒ Object (readonly)
Returns the value of attribute look_at.
6 7 8 |
# File 'lib/agent.rb', line 6 def look_at @look_at end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
6 7 8 |
# File 'lib/agent.rb', line 6 def position @position end |
#region_handle ⇒ Object (readonly)
Returns the value of attribute region_handle.
6 7 8 |
# File 'lib/agent.rb', line 6 def region_handle @region_handle end |
#region_name ⇒ Object (readonly)
Returns the value of attribute region_name.
6 7 8 |
# File 'lib/agent.rb', line 6 def region_name @region_name end |
Instance Method Details
#chat(message, type = :normal, channel = 0) ⇒ Object
Send a chat message to the simulator or >0 (for scripts listening on that channel)
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/agent.rb', line 60 def chat(, type=:normal, channel=0) type = case type when :whisper then 0 when :shout then 2 else 1 end throw "Channel has to be >=0, #{channel} given!" if channel < 0 packet = ChatFromViewerPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id }, :ChatData => { :Message => , :Type => type, :Channel => channel } }) @client.network_manager.send_packet packet end |
#im(message, to) ⇒ Object
Send an instant message to another agent
84 85 |
# File 'lib/agent.rb', line 84 def im(, to) end |
#move_to_sim(simulator) ⇒ Object
Complete a transfer to a sim (e.g. after login or teleport)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/agent.rb', line 22 def move_to_sim(simulator) # EventManager.register_handler(EventHandler.new(Proc.new do |type| # EventMachine::add_periodic_timer(2) do # packet = AgentUpdatePacket.new({ # :AgentData => { # :AgentID => @client.network_manager.agent_id, # :SessionID => @client.network_manager.session_id, # :BodyRotation => LLQuaternion.new(1, 1, 1), # :HeadRotation => LLQuaternion.new(1, 1, 1), # :State => LLU8.new(0), # :CameraCenter => @position, # :CameraAtAxis => LLVector3.new(), # :CameraLeftAxis => LLVector3.new(), # :CameraUpAxis => LLVector3.new(), # :Far => LLF32.new(64), # :ControlFlags => LLU32.new(0), # :Flags => LLU8.new(0) # } # }) # @client.network_manager.send_packet packet, true # end # end, :movement_complete)) packet = CompleteAgentMovementPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id, :CircuitCode => @client.network_manager.circuit_code } }) simulator.send_packet(packet) end |
#send_money(amount, to) ⇒ Object
Send Linden$ to another agent
90 91 |
# File 'lib/agent.rb', line 90 def send_money(amount, to) end |