Closed hamilton5 closed 1 year ago
Thanks for the contribution!
Instead of exiting early in OnEntitySpawned
, I suggest we just unsubscribe from the hook.
private void Init()
{
_pluginConfig.Init(this);
Unsubscribe(nameof(OnEntitySpawned));
}
private void OnServerInitialized()
{
...
if (_eligiblePatrolPoints.Count > 0)
{
Subscribe(nameof(OnEntitySpawned));
}
}
This will provide a marginal performance boost when there are no patrol points, since Oxide incurs some overhead for subscribed hooks even if they are never called, since it has to check if the signature matches the object the hook was called for.
sorry I don't know a whole lot, I didn't even know that was possible. Definitely makes sense.
in the rare event this ever happens:
[Better Chinook Patrol] 0 monuments on this map may be visited by Chinooks. 0 have drop zones.