Gonna make this quick, got a busy day today.
Here's a test map that you can run with vanilla (via DOSBox) or choco Strife if you wish:
[EDIT] Updated test map to include a friendly red acolyte and a teleport beacon. The beacon rebels will sometimes attack the red acolyte too. Weird.[/EDIT]
[EDIT2]Test map removed.[/EDIT2]
NOTE: Make sure that, if you're gonna use vanilla, to update your strife1.exe to the latest version (1.31)
The green floors are covered with sound blocking lines, meaning you have to get across them to do the following tests.
Go in the right room with the 2 peasants. The red one is marked as friendly (ally in DB2). Punch either one of them and they should punch you back. You
should receive damage from the punch.
Now select the assault gun and fire at a wall, the tan (non-red) peasant should start walking around constantly. Punch them again. Interestingly, the red one will behave like in ZDoom, he won't turn towards you and his punch won't damage you. The tan one will still face and damage you.
Now to see how friendly rebels in vanilla behave.
Restart the map, grab everything and go to the left room. If you shoot your gun at a wall
away from anything, the acolyte will attack, but the rebel usually won't do anything. If you shoot the acolyte, the rebel will attack the acolyte. If you shoot the beggar, the rebel will attack the beggar. if you shoot the peasant, guess what, the rebel will attack the peasant.
Speaking of the beggar, his DECORATE code shows he has the same flags as the peasant sans FRIENDLY and FLOORCLIP. If you were to run these tests in ZDoom, the rebel would attack the acolyte *and* the beggar but ignore the peasant.
EDIT: The point of testing the behavior of "vanilla friendlies" is to show two things: 1) Unless it's an "ally", your allies/friendlies will attack whatever you shoot at, this includes peasants. 2) Based on 1) I think we can safely conclude that peasants were never supposed to be friendlies in the first place.
Of course this presents a problem, if we remove FRIENDLY then the peasants will get attacked automatically (in ZDoom) without the need for you to shoot at their general direction (unlike vanilla Strife).
Adding the NEVERTARGET flag would fix that issue since it doesn't defy Thing_Hate and they'll still get attacked if they damage the player.
Reason why that happens is because the last thing that hurts a player will be stored in the "attacker" pointer and if that player is a friendly's FriendPlayer then the friendly will attack the "attacker" regardless of NEVERTARGET as shown in p_enemy.cpp:
Code: Select all
if (actor->flags & MF_FRIENDLY && actor->target == NULL) //L2236
{
....
....
if (player->attacker && player->attacker->health > 0 && player->attacker->flags & MF_SHOOTABLE && pr_newchasedir() < 80) //L2256
{
if (!(player->attacker->flags & MF_FRIENDLY) ||
(deathmatch && actor->FriendPlayer != 0 && player->attacker->FriendPlayer != 0 &&
actor->FriendPlayer != player->attacker->FriendPlayer))
{
actor->target = player->attacker;
}
}
}
This is fine, though, since it's closer to vanilla (where your allies attack whatever non-ally you shoot at,
this includes peasants).
If removing FRIENDLY still seems like an issue then I would like to suggest a small (and IMO hacky) adjustment to OkayToSwitchTarget() and CheckMeleeRange():
Code: Select all
if (IsFriend(x) && !(GetDefault()->flags & MF_JUSTHIT)) //Peasants have this flag by default; allow them to retaliate against abusive players
Where x is "pl" for CheckMeleeRange() and "other" for OkayToSwitchTarget()
I know I'm putting way too much effort into this "non-issue" as some might call it, but hey, a bug is a bug, right.
Sorry if I seem to be repeating myself, I just want to be as clear as possible.