Warned of monster type

If you wield the artifact weapon named Sting, then you are warned of orcs. You can detect the locations and types of all orcs on the current dungeon level, as if you could see them. This applies to any monster of orcish race, including any 'o' monsters and also orc mummy and orc zombie.

In SLASH'EM, certain roles are warned of undead. This is an innate property of an Undead Slayer from experience level 1, or a Necromancer from level 3. It detects the locations of all undead monsters on the current level.

Messages
These messages can appear during enlightenment:
 * "You are aware of the presence of orcs."
 * "You are aware of the presence of undead." (SLASH'EM)

There is no way to be warned of demons, but the source code in vanilla NetHack would say, "You are aware of the presence of demons." For warnings of other monster types, "You are aware of the presence of something".

Strategy
Orcs are a small fraction of the monsters you encounter, and typically not much of a threat, so the warning of orcs has little value.

In SLASH'EM, a Necromancer begins the game with a pet ghoul. This ghoul is slow, so you might abandon it. If you are trying to keep your ghoul, the task becomes easier if you reach experience level 3 and become warned of undead, so that you may always track the location of your ghoul. When it is time for your ghoul to follow you through staircase, then you might use your pick-axe to dig a shortcut from the ghoul's location to the staircase.

Source code
To enable detection of a monster type, the hero must have the WARNED_OF_MON property (as an intrinsic or extrinsic), and flags.warntypes must contain the M2 flag for that monster type.

If an artifact provides SPFX_WARN (either when carried or when worn), and that artifact has any M2 flags, then the artifact will provide warning of those M2 types. An SPFX_WARN artifact without M2 flags will instead provide warning like a ring of warning. Sting is a SPFX_WARN artifact with the M2_ORC flag.

Caveat for carried artifacts that warn of monster type
Multiple artifacts that provide SPFX_WARN when carried, and have M2 flags, might not interact correctly. This is not currently a problem, because the only such artifacts are the Master Key of Thievery or the Orb of Fate, and both have no M2 flags.

Suppose that there is a new artifact pick-axe named Dwarfwatcher that provides SPFX_WARN of M2_DWARF when carried, but artifact.c is unchanged. Then the following sequence of events might happen:


 * 1) The hero picks up the Master Key of Thievery, and receives warning.
 * 2) The hero picks up Dwarfwatcher, and becomes warned about dwarves.
 * 3) The hero drops Dwarfwatcher. NetHack notices that there is another SPFX_WARN artifact in the W_ART (carried artifact) slot, and declines to disable SPFX_WARN.
 * 4) The hero remains warned about dwarves, despite dropping Dwarfwatcher. (I have not tested this, because Dwarfwatcher does not exist.)

Sting does not cause a problem, because Sting uses a different slot (W_WEP) than carried artifacts.

Caveat for two artifacts that warn of same type
Two artifacts that simultaneously provide SPFX_WARN, of the same M2 flag, might not interact correctly. This is not currently a problem, because Sting is the only such artifact in the game.

Suppose that there is a new artifact amulet named Orcfinder that provides SPFX_WARN of M2_ORC when worn, but artifact.c is unchanged. (Orcfinder seems a bad idea, with Sting already in the game.) Then the following sequence of events might happen:


 * 1) The hero puts on Orcfinder, and becomes warned of orcs.
 * 2) The hero wields Sting, and remains warned of orcs.
 * 3) The hero removes Orcfinder. NetHack decides to disable SPFX_WARN on the W_AMUL (worn amulet) slot.
 * 4) The hero loses the WARN_OF_MON property in the W_AMUL slot. The hero retains the WARN_OF_MON property in the W_WEP slot.
 * 5) The hero loses the M2_ORC flag from flags.warntype.
 * 6) The hero becomes not warned of orcs, despite wielding Sting. (I have not tested this, because Orcfinder does not exist.)

WARN_UNDEAD
WARN_UNDEAD is a separate property from WARN_OF_MON, so that SLASH'EM may include warning of undead in the list of innate properties. When the player changes experience level and gains (or loses) WARN_UNDEAD, then the game also sets (or clears) intrinsic WARN_OF_MON and adds (or removes) M2_UNDEAD to the warned monster types.

Vanilla NetHack also defines a WARN_UNDEAD property and allocates space for its struct prop structure. However, vanilla does not implement warning of undead.