Jump to content

OnSamSiteTarget conflict with SimplePVE (console spam)

Closed 1.7.0 1.7.1

Notz
Notz

Posted (edited)

Hi,

Thanks for maintaining TCAuth.

I'm running TCAuth together with SimplePVE, and my console gets flooded with this warning every time a SAM site evaluates a target:

image.png.6195733f87d554425de8c83f72d9b52e.png

 

Cause

In OnSamSiteTarget, any non-null return value cancels the SAM site's targeting, so true and false have the same effect. TCAuth returns false to block targeting (empty helicopter, or driver authorized on the SAM's TC with the turret permission), while SimplePVE returns true for the same purpose. Both plugins agree on the outcome, but Oxide treats the two different values as a conflict and logs a warning on every call. Since the hook runs constantly, the console becomes unusable.

Suggested fix

Return true instead of false in the two blocking cases, so the return value is consistent with other plugins using this hook:

    private object OnSamSiteTarget(SamSite samSite, PlayerHelicopter target)
    {
        if (target == null || samSite == null)
            return null;

        if (!target.HasDriver())
            return true;

        BasePlayer driver = target.GetDriver();
        BuildingPrivlidge privilege = samSite.GetBuildingPrivilege();
        if (privilege != null && privilege.IsAuthed(driver) && PlayerHasPermission(driver.UserIDString, Permissions.TURRET))
            return true;

        return null;
    }

Since both values cancel targeting, the behavior of TCAuth stays exactly the same, and the conflict warning disappears. I've applied this locally and the SAM sites still ignore authorized players' helicopters as expected.

Let me know if you need any more info or logs. Thanks!

Edited by Notz
tofurahie

Posted

13 minutes ago, Notz said:

Hi,

Thanks for maintaining TCAuth.

I'm running TCAuth together with SimplePVE, and my console gets flooded with this warning every time a SAM site evaluates a target:

image.png.6195733f87d554425de8c83f72d9b52e.png

 

Cause

In OnSamSiteTarget, any non-null return value cancels the SAM site's targeting, so true and false have the same effect. TCAuth returns false to block targeting (empty helicopter, or driver authorized on the SAM's TC with the turret permission), while SimplePVE returns true for the same purpose. Both plugins agree on the outcome, but Oxide treats the two different values as a conflict and logs a warning on every call. Since the hook runs constantly, the console becomes unusable.

Suggested fix

Return true instead of false in the two blocking cases, so the return value is consistent with other plugins using this hook:

    private object OnSamSiteTarget(SamSite samSite, PlayerHelicopter target)
    {
        if (target == null || samSite == null)
            return null;

        if (!target.HasDriver())
            return true;

        BasePlayer driver = target.GetDriver();
        BuildingPrivlidge privilege = samSite.GetBuildingPrivilege();
        if (privilege != null && privilege.IsAuthed(driver) && PlayerHasPermission(driver.UserIDString, Permissions.TURRET))
            return true;

        return null;
    }

Since both values cancel targeting, the behavior of TCAuth stays exactly the same, and the conflict warning disappears. I've applied this locally and the SAM sites still ignore authorized players' helicopters as expected.

Let me know if you need any more info or logs. Thanks!

I’ve patched TCAuth to return true in both OnSamSiteTarget cases that block targeting

  • Love 1
tofurahie

Posted

Changed Status from Pending to Closed
Changed Fixed In from Not set to 1.7.1

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
3.3m
Total downloads
Customers
12.5k
Customers served
Files Sold
176.8k
Total sales
Payments
3.9m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.