33 lines
767 B
C#
33 lines
767 B
C#
using Sandbox;
|
|
|
|
namespace MyGame;
|
|
|
|
public partial class Pistol : Weapon
|
|
{
|
|
public override string ModelPath => "weapons/rust_pistol/rust_pistol.vmdl";
|
|
public override string ViewModelPath => "weapons/rust_pistol/v_rust_pistol.vmdl";
|
|
|
|
[ClientRpc]
|
|
protected virtual void ShootEffects()
|
|
{
|
|
Game.AssertClient();
|
|
|
|
Particles.Create( "particles/pistol_muzzleflash.vpcf", EffectEntity, "muzzle" );
|
|
|
|
Pawn.SetAnimParameter( "b_attack", true );
|
|
ViewModelEntity?.SetAnimParameter( "fire", true );
|
|
}
|
|
|
|
public override void PrimaryAttack()
|
|
{
|
|
ShootEffects();
|
|
Pawn.PlaySound( "rust_pistol.shoot" );
|
|
ShootBullet( 0.1f, 100, 20, 1 );
|
|
}
|
|
|
|
protected override void Animate()
|
|
{
|
|
Pawn.SetAnimParameter( "holdtype", (int)CitizenAnimationHelper.HoldTypes.Pistol );
|
|
}
|
|
}
|