Classes:Shotgun
Classes: Inventory→Weapon→DoomWeapon→Shotgun
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
|
Shotgun | |||
---|---|---|---|
Actor type | Weapon | Game | ![]() |
DoomEd Number | 2001 | Class Name | Shotgun |
Spawn ID | 27 | Identifier | T_SHOTGUN |
The shotgun. A hitscan weapon which has a large spread. Uses shells for ammo.
ZScript definition
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub. |
class Shotgun : DoomWeapon
{
Default
{
Weapon.SelectionOrder 1300;
Weapon.AmmoUse 1;
Weapon.AmmoGive 8;
Weapon.AmmoType "Shell";
Inventory.PickupMessage "$GOTSHOTGUN";
Obituary "$OB_MPSHOTGUN";
Tag "$TAG_SHOTGUN";
}
States
{
Ready:
SHTG A 1 A_WeaponReady;
Loop;
Deselect:
SHTG A 1 A_Lower;
Loop;
Select:
SHTG A 1 A_Raise;
Loop;
Fire:
SHTG A 3;
SHTG A 7 A_FireShotgun;
SHTG BC 5;
SHTG D 4;
SHTG CB 5;
SHTG A 3;
SHTG A 7 A_ReFire;
Goto Ready;
Flash:
SHTF A 4 Bright A_Light1;
SHTF B 3 Bright A_Light2;
Goto LightDone;
Spawn:
SHOT A -1;
Stop;
}
}
extend class StateProvider
{
action void A_FireShotgun()
{
if (player == null)
{
return;
}
A_StartSound ("weapons/shotgf", CHAN_WEAPON);
Weapon weap = player.ReadyWeapon;
if (weap != null && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{
if (!weap.DepleteAmmo (weap.bAltFire, true, 1))
return;
player.SetPsprite(PSP_FLASH, weap.FindState('Flash'), true);
}
player.mo.PlayAttacking2 ();
double pitch = BulletSlope ();
for (int i = 0; i < 7; i++)
{
GunShot (false, "BulletPuff", pitch);
}
}
}
DECORATE definition
Note: This is legacy code, kept here for reference only. DECORATE is still supported but no longer used by GZDoom. GZDoom internally uses the ZScript definition above. |
ACTOR Shotgun : DoomWeapon { Weapon.SelectionOrder 1300 Weapon.AmmoUse 1 Weapon.AmmoGive 8 Weapon.AmmoType "Shell" Inventory.PickupMessage "$GOTSHOTGUN" Obituary "$OB_MPSHOTGUN" Tag "$TAG_SHOTGUN" States { Ready: SHTG A 1 A_WeaponReady Loop Deselect: SHTG A 1 A_Lower Loop Select: SHTG A 1 A_Raise Loop Fire: SHTG A 3 SHTG A 7 A_FireShotgun SHTG BC 5 SHTG D 4 SHTG CB 5 SHTG A 3 SHTG A 7 A_ReFire Goto Ready Flash: SHTF A 4 Bright A_Light1 SHTF B 3 Bright A_Light2 Goto LightDone Spawn: SHOT A -1 Stop } }
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.