blob: 567eb3e6a4a78ca0dba94d61ebf251793f7587d0 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
using Sandbox;
namespace MurderGame;
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";
public Pistol()
{
MaxAmmo = 1;
}
[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()
{
if (Ammo > 0)
{
--Ammo;
ShootEffects();
Pawn?.PlaySound( "rust_pistol.shoot" );
ShootBullet( 100, 100, 1 );
}
}
public override void Reload()
{
ReloadEffects();
}
[ClientRpc]
protected virtual void ReloadEffects()
{
ViewModelEntity?.SetAnimParameter( "reload", true );
}
protected override void Animate()
{
Pawn?.SetAnimParameter( "holdtype", (int)CitizenAnimationHelper.HoldTypes.Pistol );
}
}
|