How can i make the turrets inside of a zone not raget the npc as if they were auth on them. I dont want thew no damage noc flag. i need actually to not target them.
Prevent turrets targeting NPCs?
Did read the file it self and the turret ignore scientist is there but dont work
Merged post
@nivex ok so tell me what its differetn or wrong
Merged post
@nivex ok so tell me what its differetn or wrong
{
"name": "NPCBase",
"enabled": true,
"defaultAllowDamage": true,
"flags": "SelfDamage, TurretsIgnoreScientist",
"rules": [
"anything can hurt dispensers",
"anything can hurt players",
"players cannot hurt players",
"anything can hurt traps",
"traps cannot hurt players",
"players can hurt barricades",
"barricades cannot hurt players",
"highwalls cannot hurt players",
"anything can hurt heli",
"anything can hurt npcs",
"fire cannot hurt players",
"anything can hurt resources"
]
}
]tthe turret ignore scientis dont work.
i made an ugly fix and this works. any idea what can be that im making wrong?
object CanBeTargeted(BasePlayer target, MonoBehaviour turret)
{
//Puts(target.userID.ToString(), 2);
if (!serverInitialized || target == null || turret == null) return null;
if (turret as HelicopterTurret)
{
//if (target.InSafeZone() && !target.IsHostile()) return false;
return null;
}
object extCanEntityBeTargeted = Interface.CallHook("CanEntityBeTargeted", new object[] { target, turret as BaseEntity });
if (extCanEntityBeTargeted != null && extCanEntityBeTargeted is bool && (bool)extCanEntityBeTargeted)
{
return null;
}
RuleSet ruleSet = GetRuleSet(target, turret as BaseCombatEntity);
if (target.userID < 70000000)
{
Puts($"CanBeTargeted called for {target.name}", 2);
return false;
}
if (!target.IsNpc && ruleSet.HasFlag(RuleFlags.TurretsIgnorePlayers))
{
var weapon = (turret as AutoTurret)?.GetAttachedWeapon()?.GetItem();
if (weapon != null && weapon.info.shortname.StartsWith("fun.")) return null;
var entityLocations = GetLocationKeys(target);
var initiatorLocations = GetLocationKeys(turret as BaseEntity);
// check for exclusion zones (zones with no rules mapped)
if (CheckExclusion(entityLocations, initiatorLocations)) return null;
return false;
}
return null;
}
forgot to add that if i check if the rulset is ruleSet.HasFlag(RuleFlags.TurretsIgnoreScientist)) doesnt work. the config has it. plz let me know