Hi! First of all, thank you very much for this plugin. All the recent updates are great.
For context, I'm using NpcSpawn integrated to my plugin to allow players to recruit bots to fight by their side.
The thing is, since the recent changes on NpcSpawn, I'm unable to allow players to damage their own allied bots because of this logic you implemented inside the OnEntityTakeDamage hook
if (victimNpc.CanTargetEntity(attacker))
{
if (info.isHeadshot && victimNpc.Config.InstantDeathIfHitHead && attacker is BasePlayer basePlayer && basePlayer.IsPlayer()) info.damageTypes.ScaleAll(victimNpc.health / info.damageTypes.Total());
else
{
info.damageTypes.ScaleAll(info.boneArea switch
{
HitArea.Head => victimNpc.Config.HeadDamageScale,
HitArea.Chest or HitArea.Stomach or HitArea.Arm or HitArea.Hand => victimNpc.Config.BodyDamageScale,
HitArea.Foot or HitArea.Leg => victimNpc.Config.LegDamageScale,
_ => 1f
});
if (attacker is CustomScientistNpc attackerNpc && IsCustomScientist(attackerNpc)) info.damageTypes.ScaleAll(attackerNpc.Config.NpcDamageScale);
victimNpc.SetKnown(attacker);
victimNpc.TrySendTargetGroup(attacker);
}
return null;
}
else
{
if (attacker is BasePlayer player && player.IsPlayer() && (player.limitNetworking || player.isInvisible)) return null;
return true;
}
The problem is, I want the allied bots to not be able to target their allied players, but the players must be able to damage their own bots even though the bots can't target them back. (so players can kill their own bots if they get stuck somewhere or even accidentaly during fights).
But with this condition if (victimNpc.CanTargetEntity(attacker)) you implemented this seems to be impossible now.
Is there a possibility that you can add another config inside NpcConfig like: bool CanBeDamagedByAnySources false by default but if true, ignore this condition here and allow any damages from any sources (return null in the hook)?