From 2ad84bb40c35dced0bdf45cb62fb08ec10eba66d Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Fri, 4 Apr 2008 19:54:43 +0000 Subject: [PATCH] moved shoot out of core libe and put in libsecondlife.Utilities Realism class. git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1703 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife/AgentManager.cs | 45 ------------------- libsecondlife/AgentManagerMovement.cs | 4 +- .../libsecondlife.Utilities/Utilities.cs | 45 +++++++++++++++++++ 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/libsecondlife/AgentManager.cs b/libsecondlife/AgentManager.cs index 18b65068..4dbe7c79 100644 --- a/libsecondlife/AgentManager.cs +++ b/libsecondlife/AgentManager.cs @@ -1648,51 +1648,6 @@ namespace libsecondlife } } - /// - /// Aims at the specified position, enters mouselook, presses and - /// releases the left mouse button, and leaves mouselook - /// - /// Target to shoot at - /// - public bool Shoot(LLVector3 target) - { - if (Movement.TurnToward(target)) - return Shoot(); - else - return false; - } - - /// - /// Enters mouselook, presses and releases the left mouse button, and leaves mouselook - /// - /// - public bool Shoot() - { - if (Client.Settings.SEND_AGENT_UPDATES) - { - Movement.Mouselook = true; - Movement.MLButtonDown = true; - Movement.SendUpdate(); - - Movement.MLButtonUp = true; - Movement.MLButtonDown = false; - Movement.FinishAnim = true; - Movement.SendUpdate(); - - Movement.Mouselook = false; - Movement.MLButtonUp = false; - Movement.FinishAnim = false; - Movement.SendUpdate(); - - return true; - } - else - { - Client.Log("Attempted Shoot but agent updates are disabled", Helpers.LogLevel.Warning); - return false; - } - } - #endregion Movement actions #region Touch and grab diff --git a/libsecondlife/AgentManagerMovement.cs b/libsecondlife/AgentManagerMovement.cs index cbc9837b..12c8d85a 100644 --- a/libsecondlife/AgentManagerMovement.cs +++ b/libsecondlife/AgentManagerMovement.cs @@ -520,7 +520,7 @@ namespace libsecondlife /// /// Target to shoot at /// - [Obsolete("Use Self.Shoot()")] + [Obsolete("Moved to libsecondlife.Utilities")] public bool Shoot(LLVector3 target) { if (TurnToward(target)) @@ -533,7 +533,7 @@ namespace libsecondlife /// Enters mouselook, presses and releases the left mouse button, and leaves mouselook /// /// - [Obsolete("Use Self.Shoot()")] + [Obsolete("Moved to libsecondlife.Utilities")] public bool Shoot() { if (Client.Settings.SEND_AGENT_UPDATES) diff --git a/libsecondlife/libsecondlife.Utilities/Utilities.cs b/libsecondlife/libsecondlife.Utilities/Utilities.cs index 1cc172e6..764ff4dc 100644 --- a/libsecondlife/libsecondlife.Utilities/Utilities.cs +++ b/libsecondlife/libsecondlife.Utilities/Utilities.cs @@ -24,6 +24,51 @@ namespace libsecondlife.Utilities public static class Realism { + /// + /// Aims at the specified position, enters mouselook, presses and + /// releases the left mouse button, and leaves mouselook + /// + /// Target to shoot at + /// + public static bool Shoot(SecondLife client, LLVector3 target) + { + if (client.Self.Movement.TurnToward(target)) + return Shoot(client); + else + return false; + } + + /// + /// Enters mouselook, presses and releases the left mouse button, and leaves mouselook + /// + /// + public static bool Shoot(SecondLife client) + { + if (client.Settings.SEND_AGENT_UPDATES) + { + client.Self.Movement.Mouselook = true; + client.Self.Movement.MLButtonDown = true; + client.Self.Movement.SendUpdate(); + + client.Self.Movement.MLButtonUp = true; + client.Self.Movement.MLButtonDown = false; + client.Self.Movement.FinishAnim = true; + client.Self.Movement.SendUpdate(); + + client.Self.Movement.Mouselook = false; + client.Self.Movement.MLButtonUp = false; + client.Self.Movement.FinishAnim = false; + client.Self.Movement.SendUpdate(); + + return true; + } + else + { + client.Log("Attempted Shoot but agent updates are disabled", Helpers.LogLevel.Warning); + return false; + } + } + /// /// A psuedo-realistic chat function that uses the typing sound and /// animation, types at three characters per second, and randomly