Messing with TwitchyDoom recently and i noticed the Friendly enemies can't damage enemies of the same "Species" as them, even though they are friendly.
The enemies of same species can still damage them.
Is this a GZDoom bug or a TwitchyDoom bug?

Moderator: GZDoom Developers
Code: Select all
// Spawn a friendly monster
Class TCommand_SpawnFriendlyMonster : Twitchy_Command
{
Class<Actor> monster;
override void Command()
{
monster = GetParamString("actor");
if(!monster)
{
Twitchy_Handler h = Twitchy_Handler(StaticEventHandler.Find("Twitchy_Handler"));
monster = h.PickRandomMonster();
}
if(!monster)
{
Destroy();
return;
}
Actor player = Twitchy_Handler.RandomPlayer();
Actor a = Actor.Spawn(monster, player.pos);
if(a.bSHOOTABLE)
{
a.bSHOOTABLE = false;
a.GiveInventory("Twitchy_FriendlySpawnProtection", 1);
a.GiveInventory("Twitchy_FriendlyFireProtection", 1);
}
if(a.bCOUNTKILL)
{
a.A_ChangeCountFlags(0);
a.bCOUNTKILL = false;
}
a.bFRIENDLY = true;
a.bNOBLOCKMONST = true;
a.bSOLID = false;
a.target = player;
a.lastheard = player;
a.A_SpawnItemEx("TeleportFog");
if(!GetParamString("nofollow"))
{
a.GiveInventory("Twitchy_FriendlyFollower", 1);
}
if(GetParamString("showmap"))
{
Twitchy_Actor_MapMarker.Show(a);
}
Twitchy_Username.Show(a, username .. " (ALLY)");
}
override void Notification()
{
Console.Printf("\cf" .. username .. " \c-joined the game.");
S_Sound("misc/chat", CHAN_VOICE | CHAN_UI);
Console.Printf("\cf" .. username .. "\c-: \c*" .. messageRaw);
}
}
class Twitchy_FriendlyFireProtection : Inventory
{
override void Tick()
{
if(owner)
{
owner.bFRIENDLY = true;
}
Super.Tick();
}
override void ModifyDamage (int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags)
{
if((source && (source.player || source.bFRIENDLY)) || inflictor && (inflictor.player || inflictor.bFRIENDLY))
{
newdamage = 0;
}
}
}