Classes:BulletPuff

From ZDoom Wiki
(Redirected from Puff)
Jump to: navigation, search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do not need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it's actually harmful as it can cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
  5. There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
Bullet puff
Actor type Explosive Game MiniDoomLogoIcon.png
DoomEd Number None Class Name BulletPuff
Spawn ID 131 Identifier T_PUFF


Classes: BulletPuff

The puff actor is spawned when a hitscan attack (i.e. bullet) impacts a wall in Doom and its derivatives. New puffs, incorporating custom sound effects, damagetypes and other behaviour, can be created in DECORATE by inheriting from this class.

Puff usage and behavior

Actors inheriting from this class:

  • automatically move up 1 mappixel per tic (because of the vspeed property)
  • may be replaced by particles when spawned if the ALLOWPARTICLES flag is set (and the player has the appropriate option enabled in their configuration settings)
  • define the damage type of a hitscan attack if spawned using A_BulletAttack, A_CustomBulletAttack, A_FireBullets or A_CustomPunch
  • obey the following rules regarding sounds and state jumps:
Attack result¹ Missed Hit wall Hit actor
Attack type All Hitscan Melee
Puff sound played² Active Attack See
Puff state entered³ Crash Spawn Melee
Notes
1 - by default, puffs are only spawned as a result of a hitscan attack hitting a wall, or an actor with one or more of NOBLOOD, INVULNERABLE and DORMANT flags set. In order for puffs to appear in other circumstances, certain flags must be in effect on either the puff actor or the target actor. The ALWAYSPUFF flag applied to the puff actor makes it spawn even for missed attacks. The PUFFONACTORS flag applied to the puff actor will make it spawn (instead of Blood) even if the hit actor does not have any of the aforementioned flags.
2 - if no SeeSound is defined, the AttackSound is played instead. To have a silent SeeSound, you need to use SNDINFO to give a name to the internal sound lump DSEMPTY, and assign that sound to the SeeSound property.
3 - if no Crash or Melee state sequence is defined, the puff's Spawn state is entered by default.
If a puff has an XDeath state defined, it will enter it upon hitting a bleeding actor, provided it also has the PUFFONACTORS flag.

Further customization with the puff can be achieved if using the PUFFONACTORS flag to respect the three flags by using HITTRACER for example, and performing A_CheckFlag for the flags. Currently, tracer is not used with puffs by default and would be the best choice of pointer to perform the flag checking.

If the puff has the THRUGHOST flag, it will not affect enemies with the GHOST flag.

Puffs are spawned so as to face the originator of the attack.

DECORATE definition

ACTOR BulletPuff
{
  +NOBLOCKMAP
  +NOGRAVITY
  +ALLOWPARTICLES
  +RANDOMIZE
  RenderStyle Translucent
  Alpha 0.5
  VSpeed 1
  Mass 5
  States
  {
  Spawn:
    PUFF A 4 Bright
    PUFF B 4
    // Intentional fall-through
  Melee:
    PUFF CD 4
    Stop
  }
}