Classes:PowerIronFeet

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
  1. This actor is already defined in GZDoom, there's no reason to define it again.
  2. In fact, trying to define an actor with the same name will cause an error (because it already exists).
  3. If you want to make your own version of this actor, use inheritance.
  4. Definitions for existing actors are put on the wiki for reference purpose only.
Environment protection power
Actor type Power Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name PowerIronFeet


Classes: InventoryPowerupPowerIronFeet
 →PowerMask

One of the many powerups, i.e. items based on the Powerup class. While an item of this class is placed in an actor's inventory, the actor will be affected by it. Usually powerups are given through a PowerupGiver, but they can be given directly as well (see here for more details).

PowerIronFeet protects its owner from damage from some type of sector special-based damaging floors, typically represented by radioactive nukage, toxic sludge, or burning lava (but the actual texture is of no consequence).

In addition, this powerup also prevents the player from running out of air by continuously calling ResetAirSupply on the player and preventing damage from the 'Drowning' damage type. Air supply only comes into play in ZDoom/GZDoom maps that have some form of underwater sections, and if the map's AirSupply value is not 0.

The powerup's behavior can be customized with the following Powerup.Mode values:

  • 'Normal'
Default mode. The player is nearly immune to damage from damaging floors. Specifically, it protects against:
  • dLight_Strobe_Hurt
  • dDamage_Hellslime
  • dDamage_Nukage
  • dDamage_SuperHellslime
  • sDamage_Hellslime
  • sDamage_SuperHellslime
  • The generalized Boom damage flags.
There is about 1/40 chance that the protection will fail against Strobe_Hurt and SuperHellslimes during a given second. It does NOT protect at all against dDamage_LavaWimpy, dDamage_LavaHefty and dScroll_EastLavaDamage.
  • 'Full'
Total protection mode. It is similar to 'Normal', but it also protects against the types of damaging floors that the Normal mode does not protect against, whether it is partial protection or not.

If multiple powerups of this type with different modes are in effect, the Full mode takes priority.

The powerup has the additional effect of reducing drowning damage to zero and resetting the player's air supply every tic.

Like all other Powerups, items of this class are never used directly. Instead you have to create a new item that inherits from PowerupGiver to give it to the player.

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 PowerIronFeet : Powerup
{
	Default
	{
		Powerup.Duration -60;
		Powerup.Color "00 ff 00", 0.125;
		Powerup.Mode "Normal";
	}
	
	override void AbsorbDamage (int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags)
	{
		if (damageType == 'Drowning')
		{
			newdamage = 0;
		}
	}

	override void DoEffect ()
	{
		if (Owner.player != NULL)
		{
			Owner.player.mo.ResetAirSupply ();
		}
	}
	
}

DECORATE definition

Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
ACTOR PowerIronFeet : Powerup native
{
  Powerup.Duration -60
  Powerup.Color 0, 255, 0, 0.125
}