From cb9cf36c58656cb185e9d9f8818d9709e3a89001 Mon Sep 17 00:00:00 2001 From: opti1337 Date: Wed, 30 Oct 2024 13:33:29 +0300 Subject: [PATCH] ssss --- Code/AnimationHelper.cs | 2 +- Code/KPTLConnect.cs | 2 +- Code/Kal.cs | 16 +++++++--------- Code/RagdollController.cs | 33 +++++++++++++-------------------- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/Code/AnimationHelper.cs b/Code/AnimationHelper.cs index 76d0cde..770e66b 100644 --- a/Code/AnimationHelper.cs +++ b/Code/AnimationHelper.cs @@ -4,7 +4,7 @@ using System; /// Used to control the Citizen animation state. You don't have to use this to animate your citizen avatar, but our /// aim is to put everything you need in this class, so you can easily see what variables are available. /// -[Title( "Animation Helper" )] +[Title( "[KPTL] Animation Helper" )] [Category( "KPTL" )] [Icon( "directions_run" )] public sealed class AnimationHelper : Component, Component.ExecuteInEditor diff --git a/Code/KPTLConnect.cs b/Code/KPTLConnect.cs index 5cf74c0..fd94acc 100644 --- a/Code/KPTLConnect.cs +++ b/Code/KPTLConnect.cs @@ -4,7 +4,7 @@ using Sandbox.Utility; namespace Sandbox; -[Title( "Connect" )] +[Title( "[KPTL] Connect" )] [Category( "KPTL" )] [Icon( "electrical_services" )] public sealed class KPTLConnect : Component, Component.INetworkListener diff --git a/Code/Kal.cs b/Code/Kal.cs index 4ae97bb..12e186b 100644 --- a/Code/Kal.cs +++ b/Code/Kal.cs @@ -20,8 +20,6 @@ public sealed class Kal : Component [Property] [Range(200f, 500f, 20f)] public float JumpStrength { get; set; } = 350f; [Sync] public Angles EyeAngles { get; set; } - // [Sync] public bool IsDucking { get; set; } - // [Sync] public bool IsRunning { get; set; } protected override void OnStart() { @@ -47,10 +45,10 @@ public sealed class Kal : Component if ( Network.IsOwner ) { var wishDirection = Input.AnalogMove.Normal * Rotation.FromYaw( EyeAngles.yaw ); - var IsDucking = Input.Down( "Duck" ); - var IsRunning = Input.Down( "Run" ); - var wishSpeed = IsDucking ? DuckSpeed : - IsRunning ? RunSpeed : WalkSpeed; + var isDucking = Input.Down( "Duck" ); + var isRunning = Input.Down( "Run" ); + var wishSpeed = isDucking ? DuckSpeed : + isRunning ? RunSpeed : WalkSpeed; Controller.WishVelocity = wishDirection * wishSpeed; @@ -63,10 +61,10 @@ public sealed class Kal : Component } if ( !AnimationHelper.IsValid() ) return; - - AnimationHelper.DuckLevel = IsDucking ? 1f : 0f; + + AnimationHelper.DuckLevel = isDucking ? 1f : 0f; } - + AnimationHelper.WithWishVelocity(Controller.WishVelocity); AnimationHelper.WithVelocity(Controller.Velocity); AnimationHelper.IsGrounded = Controller.IsOnGround; diff --git a/Code/RagdollController.cs b/Code/RagdollController.cs index 7262449..a648fad 100644 --- a/Code/RagdollController.cs +++ b/Code/RagdollController.cs @@ -10,26 +10,18 @@ public sealed class RagdollController : Component // Sensible Indexes // 3 - HEad - - public void Toggle() - { - bool enable = !bodyPhysics.Enabled; - bodyPhysics.Enabled = enable; - bodyPhysics.MotionEnabled = enable; - bodyRenderer.UseAnimGraph = !enable; - } - public void EnableRagdoll() + [Sync] + private bool Enabled { - bool enable = true; - bodyPhysics.Enabled = enable; - bodyPhysics.MotionEnabled = enable; - bodyRenderer.UseAnimGraph = !enable; - } - - public void DisableRagdoll() - { - bool enable = false; + get => bodyPhysics.Enabled; + set + { + Log.Info(value); + bodyPhysics.Enabled = value; + bodyPhysics.MotionEnabled = value; + bodyRenderer.UseAnimGraph = !value; + } } void UpdateBody() @@ -114,9 +106,10 @@ public sealed class RagdollController : Component { if ( Network.IsOwner ) { - if(Input.Pressed( "Ragdoll" )) + if (Input.Pressed( "Ragdoll" )) { - Toggle(); + Log.Info(123123); + Enabled = !Enabled; } }