TERRAIN
The TERRAIN lump is used to add sounds, liquid splashes and damaging effects to certain flats. The most common use is to create splashing sounds (such as water, mud, and lava in Heretic and Hexen), but it can also be used to give the player a custom landing sound when dropping onto a particular flat. For instance, if the player lands on a wood flat one may want to hear a heavy 'clunk' sound, and on a metal flat it will instead be a metallic 'clang' sort of sound. Note that those are only landing sounds, not footsteps.
Entries in the TERRAIN lump are created with the Splash and Terrain blocks. The effects of these blocks are then applied to certain flats using the Floor command.
Splash blocks
Splash blocks are defined as follows:
splash <unique name> { smallclass <small class> smallclip <clipping of small chunks?> smallsound <sound (as defined in SNDINFO)> baseclass <base class> chunkclass <chunk class> chunkxvelshift <x velocity of chunks> chunkyvelshift <y velocity of chunks> chunkzvelshift <z velocity of chunks> chunkbasezvel <z velocity of base> sound <sound (defined in SNDINFO)> noalert <does not alert monsters of the player's presence> }
The first set of definitions is for small splashes (created by actors with a Mass less than 10) and the second set (starting with 'baseclass') is for normal splashes.
A number of predefined splash classes exist, though one may of course create new splashes to use as well.
- WaterSplash - small water splashes
- WaterSplashBase - normal water splashes
- BloodSplash - small blood splashes
- BloodSplashBase - normal blood splash
- SlimeChunk - small green slime or nukage chunks
- SlimeSplash - normal green slime or nukage splash
- LavaSmoke - smoke (for lava or 'hot' rocks)
- LavaSplash - splash of lava (normal sized)
- SludgeChunk - small sludge (brown slime) chunks
- SludgeSplash - normal sized sludge splash
Terrain blocks
Terrain blocks are defined as follows:
terrain <unique name> { splash <splash block name> footclip <pixels> liquid friction <float value> damagetype <type> damageamount <value> damagetimemask <value> damageonland <boolean> allowprotection <boolean> }
- The <unique name> must be unique to all the other terrain blocks, however you may have a splash block with the same name (so splash water and terrain water can co-exist just fine). The names None and Null should not be used as they are reserved for engine use.
- splash defines the splash type to take place for this terrain definition, which was previously defined in a splash block.
- footclip is a integer value which shows the number of pixels (relative to the height of the player, so scaled sprites need not worry) that will be clipped off things that are placed (or walk onto) the flat which is linked to this terrain definition. See floorclip for more information. The nofloorclipping DeHackEd flag allows you to prevent a thing from being clipped regardless of the terrain it stands on. (Verification needed)
- liquid determines whether certain projectiles bounce, explode, or vanish upon contact. See bouncing actor flags.
- friction is an optional float value with 1.0 being default, larger values are more slippery (ice), and lesser values have more friction, resulting in a "muddy" effect.
The damage* lines are also optional, and have the effect of applying automatic damage to any sector with the specified flat placed on the floor.
- DamageType is the type of damage to apply. This correlates directly to damage types defined in DECORATE.
- DamageAmount specifies how much the player is damaged each time damage is applied.
- DamageTimeMask determines how often damage is applied, based on the current gametic. If none of the current gametic value's bits match the mask, then damage is inflicted. In practice, it is simpler to just assume that using for value a power of two, minus one, will result in damage inflicted every power of two tics. For example, using a damage time mask of 31 results in damage being inflicted every 32 tics. See this forum link for more information.
- Starting with GZDoom 4.4.0, the damage interval is calculated by using a modulo operation, instead of a bitwise AND operation. This removes the restriction of only using power of two values minus one as the mask value. To retain the same results from the original way of calculating the interval, the engine adds 1 to the specified mask value before the calculations are performed. This needs to be taken into account for when setting the mask value by subtracting 1 from it. For instance, if a two-second interval (2 * 35 = 70) is desired, then the mask value should be 69, not 70.
- DamageOnLand determines whether or not damage is applied upon hitting the floor, in addition to the periodic damage.
- AllowProtection is a boolean, which allows items granting the IronFeet power or a derivative, such as for example Doom's RadSuit, to protect against the damage.
Note that DamageType Ice will cause IceChunk and IceChunkHead actors to melt and disappear more slowly on this terrain. DamageType Lava or Fire will cause them to melt faster. Furthermore, Lava and Fire are identical: the engine will remap any DamageType Lava to DamageType Fire.
DefaultTerrain block
A defaultterrain block can be defined as a normal terrain block. All floors that are not explicitly tied to a terrain type by the floor command will use the default terrain.
Floor command
Finally we use the floor command to define the actual flats that get the terrain treatment. This is simply:
floor [optional] <flatname> <terrain name>
Where <flatname> is the name of the flat (if a flat is animated it is best to define each frame here) and <terrain name> is the name of the terrain block (defined above) which you want to correspond to <flatname>. The presence of optional tells the engine that the flat is not to be error-logged if it does not exist or is invalid.
Setting <terrain name> to "None" allows to remove an association between a texture and a terrain type.
Examples
This reduces the friction on all floors.
terrain lowfriction { friction 2.0 } defaultterrain lowfriction