The preferred design for A_JumpIfTargetInLOS depends on A_CheckFlag or something near that being accepted. (http://forum.zdoom.org/viewtopic.php?f= ... 0&p=557775)
Headsup: Three patches are provided. 1 with only the core suggestion, 1 also implementing a related suggestion, and 1 for testing the complete demonstration backstabber dagger.
Improvement on sight checks with target in LOS: Choosing actor to check FOV and SIGHT.
Previously existing possibilities:
A_JumpIfTargetInLOS: Check caller LOS, check caller FOV
A_JumpIfInTargetLOS: Check target LOS, check caller FOV
Missing possibility: Check target LOS, check target FOV
Second possibility: Check caller LOS, check target FOV
Proposed solution: Extend A_JumpIfTargetInLOS to provide all these options with the addition of two flags.
JLOSF_TARGETLOS: Check target's line of sight
JLOSF_FLIPFOV: Check FOV for the actor that does not make a sight check
Using neither flag corresponds to A_JumpIfTargetInLOS (unmodified)
Using both flags corresponds to A_JumpIfInTargetLOS (the original A_JumpIfInTargetLOS has some dubious traits that this function does not share)
Using only JLOSF_TARGETLOS corresponds to the missing possibility: Check target FOV and sight.
Using only JLOSF_FLIPFOV provides the extra option: Check caller sight and target FOV.
Target can be substituted for MASTER/TRACER wherever A_JumpIfTargetInLOS would normally make that substitution.
Spoiler: Dubious traits in A_JumpIfInTargetLOS
Spoiler: Patch 2: Extending A_JumpIfTargetInLOS
Spoiler: Patch 3: EverythingDemonstration 1: A strife mod with a punch dagger that has backstab as altfire. It checks that the target is facing away, and you remain locked on target for sufficiently long. The demonstration requires the third patch, as it uses extended A_JumpIfInventory and improved A_JumpIfTargetInLOS.
Demonstration 2: Flags JLOSF_NOTEAMNOJUMP | JLOSF_ALLYNOJUMP. When hurt, the DoomImpLord spawns a helper actor that makes all enemies of the hurting actor change target; they attack the hurting actor. When hurt by a friend, the DoomImpLord must not do this (JLOSF_ALLYNOJUMP). When DoomImpLord is an enemy (and has no friends), it must not react in this way to damage from other friendless monsters (JLOSF_NOTEAMNOJUMP).
Guide for demo 1: Find some peasants or still acolytes. Get behind them. Hold altfire. Try turning away while holding altfire to note that it cancels the attack.
Guide for demo 2: ZombieMan has been boosted to endure prolonged infighting. Get two of them and some room around you. Activate godmode and provoke an infight. Summon a hostile DoomImpLord and shoot it. After its painstate, they should all be after you again.
EDIT: Attachments removed; they have served their purpose.