Type `SamSite' does not contain a definition for `scanRadius' and no extension method `scanRadius'Fixed

Last Update Rust!

SAMSiteRange - Failed to compile: SAMSiteRange.cs(34,26): error CS1061: Type `SamSite' does not contain a definition for `scanRadius' and no extension method `scanRadius' of type `SamSite' could be found. Are you missing an assembly reference?

Same here

Fixed

Note that while you fixed the compile issue, the properties of the sam site that the plugin now edits are not actually used. The TargetScan method reads from static fields. I've been discussing with Wulf how we can solve this. The current options are (a) to update the TargetScan method to read from those two fields, or (b) update the OnSamSiteTargetScan hook to be a pre hook so you can override the logic for finding targets.

Thanks, I hadn't noticed that, maybe make them non-static variables?๐Ÿคจ

Thank you @Arainrr !

ruIwson9GtxeqdU.jpg Arainrr

Thanks, I hadn't noticed that, maybe make them non-static variables?๐Ÿคจ

Making this plugin work with multiple ranges isn't going to be straight forward.

I've submitted an Oxide PR to allow the OnSamSiteTargetScan(SamSite samSite, List<SamSite.ISamSiteTarget> targetList) hook to be cancelable. My recommendation is that the Sam Site Range plugin cancel that hook and implement custom logic to find nearby targets. You can start by copying the vanilla code and just changing the range.

However, there are two gotchas:

  • After the hook runs, the vanilla logic will loop the targetList and call target.IsVisible(eyePoint.transform.position, item2.SAMTargetType.scanRadius * 2f). Depending on the range that the plugin is configured with, that check might cause entities to not be targeted.
  • After selecting a target, the SamSite.FixedUpdate() method will constantly check that the target is still within range, based on currentTarget.SAMTargetType.scanRadius.

Depending on the range configured in the plugin, those gotchas could cause the following issues.

  • An entity that is within the confiured Sam Site range might not be targeted.
  • An entity could remain a target outside of the configured Sam Site range.

To solve, you would probably have to create a separate ISamSiteTarget instance per combination of Sam Site and eligible target. A naiive way of achieving that would be to create instances of a custom class on the fly, but that would likely result in significant unnecessary garbage collection. However, you could implement a pool to avoid the GC overhead. Let me know if you have any better ideas.

Locked automatically