aboutsummaryrefslogtreecommitdiffstats
path: root/code/weapon/Knife.cs
blob: b3bf7f8da88b86de9081f57b95b01afc46a8c572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Sandbox;

namespace MurderGame;

public partial class Knife : Weapon
{
	public Knife()
	{
		Ammo = -1;
		MaxAmmo = -1;
	}

	public override string ModelPath => "weapons/swb/melee/bayonet/w_bayonet.vmdl";
	public override string ViewModelPath => "weapons/swb/melee/bayonet/v_bayonet.vmdl";
	public override string HandsModelPath => "weapons/swb/hands/rebel/v_hands_rebel.vmdl";
	public override float PrimaryRate => 1.5f;

	[ClientRpc]
	protected virtual void ShootEffects( bool hit )
	{
		Game.AssertClient();

		ViewModelEntity?.SetAnimParameter( hit ? "swing" : "swing_miss", true );
	}

	public override void PrimaryAttack()
	{
		Pawn?.SetAnimParameter( "b_attack", true );
		Pawn?.PlaySound( "bayonet.slash" );
		ShootEffects( Melee( 100, 100 ) );
	}

	protected override void Animate()
	{
		Pawn?.SetAnimParameter( "holdtype", (int)CitizenAnimationHelper.HoldTypes.Swing );
	}
}