diff --git a/Assets/prefabs/player.prefab b/Assets/prefabs/player.prefab index c3b9806..2ca5ada 100644 --- a/Assets/prefabs/player.prefab +++ b/Assets/prefabs/player.prefab @@ -58,7 +58,7 @@ { "__type": "AnimationHelper", "__guid": "536068a6-fe5d-4f45-af74-9522ebf7e663", - "BodyWeight": 0, + "BodyWeight": 1, "EyesWeight": 0, "HeadWeight": 1, "LookAtEnabled": true, @@ -68,6 +68,16 @@ "go": "b99ceffc-a173-4a6e-a239-6d3c1612c09f", "component_type": "SkinnedModelRenderer" } + }, + { + "__type": "PlayerDresser", + "__guid": "9e0e0634-d503-4286-ace6-a8b6f1303e94", + "BodyRenderer": { + "_type": "component", + "component_id": "4fd8c36d-180b-41af-8439-6b975ca1c7b3", + "go": "b99ceffc-a173-4a6e-a239-6d3c1612c09f", + "component_type": "SkinnedModelRenderer" + } } ], "Children": [ diff --git a/Code/AnimationHelper.cs b/Code/AnimationHelper.cs index 9745a39..76d0cde 100644 --- a/Code/AnimationHelper.cs +++ b/Code/AnimationHelper.cs @@ -59,10 +59,6 @@ public sealed class AnimationHelper : Component, Component.ExecuteInEditor { if ( !Target.IsValid() ) return; - - AimBodyWeight = 0f; - AimEyesWeight = 0f; - AimHeadWeight = 1f; if ( LookAtEnabled ) @@ -126,9 +122,9 @@ public sealed class AnimationHelper : Component, Component.ExecuteInEditor /// public void WithLook( Vector3 lookDirection, float eyesWeight = 1.0f, float headWeight = 1.0f, float bodyWeight = 1.0f ) { - // Target.SetLookDirection( "aim_eyes", lookDirection, eyesWeight ); + Target.SetLookDirection( "aim_eyes", lookDirection, eyesWeight ); Target.SetLookDirection( "aim_head", lookDirection, headWeight ); - // Target.SetLookDirection( "aim_body", lookDirection, bodyWeight ); + Target.SetLookDirection( "aim_body", lookDirection, bodyWeight ); } /// diff --git a/Code/Kal.cs b/Code/Kal.cs index d2ce0d8..da55389 100644 --- a/Code/Kal.cs +++ b/Code/Kal.cs @@ -56,7 +56,7 @@ public sealed class Kal : Component if ( Input.Pressed( "Jump" ) && Controller.IsOnGround ) { - Controller.Punch( Vector3.Up * JumpStrength * 2f ); + Controller.Punch( Vector3.Up * JumpStrength ); AnimationHelper.TriggerJump(); } @@ -79,7 +79,7 @@ public sealed class Kal : Component if ( Network.IsOwner ) { EyeAngles += Input.AnalogLook; - EyeAngles = EyeAngles.WithPitch(MathX.Clamp(EyeAngles.pitch, -10f, 40f)); + EyeAngles = EyeAngles.WithPitch(MathX.Clamp(EyeAngles.pitch, -90f, 70f)); // Renderer.WorldRotation = Rotation.Slerp(Renderer.WorldRotation, Rotation.FromYaw(EyeAngles.yaw), Time.Delta * 5f); var cameraOffset = Vector3.Up * CamOffsetZ + Vector3.Backward * CamOffsetX; diff --git a/Code/PlayerDresser.cs b/Code/PlayerDresser.cs new file mode 100644 index 0000000..6bd288a --- /dev/null +++ b/Code/PlayerDresser.cs @@ -0,0 +1,14 @@ +using Sandbox; + +public class PlayerDresser : Component, Component.INetworkSpawn +{ + [Property] + public SkinnedModelRenderer BodyRenderer { get; set; } + + public void OnNetworkSpawn( Connection owner ) + { + var clothing = new ClothingContainer(); + clothing.Deserialize( owner.GetUserData( "avatar" ) ); + clothing.Apply( BodyRenderer ); + } +} diff --git a/kakozuzo_2.sbproj b/kakozuzo_2.sbproj index 8cbc917..4ccb791 100644 --- a/kakozuzo_2.sbproj +++ b/kakozuzo_2.sbproj @@ -24,6 +24,7 @@ "CsProjName": "", "StartupScene": "scenes/minimal.scene", "MapStartupScene": "scenes/minimal.scene", - "LaunchMode": "Normal" + "LaunchMode": "Normal", + "DedicatedServerStartupScene": "scenes/minimal.scene" } } \ No newline at end of file