diff options
Diffstat (limited to 'Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs')
-rw-r--r-- | Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs deleted file mode 100644 index 893038a..0000000 --- a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs +++ /dev/null @@ -1,66 +0,0 @@ -using UnityEngine; - -public class RopeAttachment : MonoBehaviour, Interactable, Hoverable -{ - public string m_name = "Rope"; - - public string m_hoverText = "Pull"; - - public float m_pullDistance = 5f; - - public float m_pullForce = 1f; - - public float m_maxPullVel = 1f; - - private Rigidbody m_boatBody; - - private Character m_puller; - - private void Awake() - { - m_boatBody = GetComponentInParent<Rigidbody>(); - } - - public bool Interact(Humanoid character, bool hold) - { - if (hold) - { - return false; - } - if ((bool)m_puller) - { - m_puller = null; - ZLog.Log("Detached rope"); - } - else - { - m_puller = character; - ZLog.Log("Attached rope"); - } - return true; - } - - public bool UseItem(Humanoid user, ItemDrop.ItemData item) - { - return false; - } - - public string GetHoverText() - { - return m_hoverText; - } - - public string GetHoverName() - { - return m_name; - } - - private void FixedUpdate() - { - if ((bool)m_puller && Vector3.Distance(m_puller.transform.position, base.transform.position) > m_pullDistance) - { - Vector3 position = ((m_puller.transform.position - base.transform.position).normalized * m_maxPullVel - m_boatBody.GetPointVelocity(base.transform.position)) * m_pullForce; - m_boatBody.AddForceAtPosition(base.transform.position, position); - } - } -} |