aboutsummaryrefslogtreecommitdiffstats
path: root/code/weapon/Knife.cs
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-07-27 22:11:31 +0100
committerLeonardo Bishop <me@leonardobishop.com>2023-07-27 22:11:31 +0100
commit71db52c5443a7bf82d9a23a770994a42b043be04 (patch)
treef75f2605bb1bdc53842cd85c90d105dcc77e1c10 /code/weapon/Knife.cs
Initial commit
Diffstat (limited to 'code/weapon/Knife.cs')
-rw-r--r--code/weapon/Knife.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/code/weapon/Knife.cs b/code/weapon/Knife.cs
new file mode 100644
index 0000000..1bc74ed
--- /dev/null
+++ b/code/weapon/Knife.cs
@@ -0,0 +1,37 @@
+using Sandbox;
+
+namespace MurderGame;
+
+public partial class Knife : Weapon
+{
+ 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 => 1f;
+
+ public Knife()
+ {
+ Ammo = -1;
+ MaxAmmo = -1;
+ }
+
+ [ClientRpc]
+ protected virtual void ShootEffects(bool hit)
+ {
+ Game.AssertClient();
+
+ Pawn.SetAnimParameter( "b_attack", true );
+ ViewModelEntity?.SetAnimParameter( hit ? "swing" : "swing_miss" , true );
+ }
+
+ public override void PrimaryAttack()
+ {
+ Pawn.PlaySound( "bayonet.slash" );
+ ShootEffects( Melee( 100, 100 ) );
+ }
+
+ protected override void Animate()
+ {
+ Pawn.SetAnimParameter( "holdtype", (int)CitizenAnimationHelper.HoldTypes.Swing );
+ }
+}