Data being created for NPCsNot An Issue
Hi @Wulf,

I noticed recently that my data file for this plugin was huge, and after looking inside I noticed that a lot of the Player ID's weren't normal players but NPCs (ie. player ID was 9906380 instead of 17 digits and starting with 7561).

I think this is related to the IsFriend check commonly used by a lot of plugins, which creates a new player entry when used.

Could you possibly update the plugin so that it won't create unless it's a normal player? Thanks in advance!
The plugin has no concept of what an NPC is, that is specific to Rust in your case. Anything passed to it will be handled as if it is a player. By itself, the plugin doesn't create anything without other plugins telling it to; so whatever you have that is passing to the IsFriend check is what is telling to create the NPC data.
I know what you're saying, but dissapontingly a lot of plugins don't have any NPC checks to stop the call to Friends. Is it possibly to put in a check inside the plugin to stop it writing to the data file or is that going to add too much overhead?

My Friends data file is currently sitting at 1mb after being reset last month and the majority of that is just NPC IDs. So just trying to solve it if I can ;)

Merged post

I had an idea how to do this considering all that's passed to the API is a ulong, can you check if the number starts with 7561 or if the number is 17 digits long? At least before creating a data file entry. That will solve it without needing a lookup!
This is a universal plugin, it has no concept if a player is an NPC or not, it doesn't even use player objects. It also is not the role of this plugin to determine who or what can be a friend, which some plugins may want an NPC as a "friend".

There aren't many hooks in Rust that would trigger for NPCs as players, but there are a couple that trigger for the newer BasePlayer ones; those hooks would ideally need to be fixed in there to avoid this issue altogether.
Wulf would it be okay to publish a rust version that avoids adding npc?   I added the simple check of not processing any "player" with an id < 70000000000000000.
Also did the same above. That seems to work well.
5b5c36c6b9361.png mspeedie
Wulf would it be okay to publish a rust version that avoids adding npc?   I added the simple check of not processing any "player" with an id < 70000000000000000.

No, that would be pointless. The plugin calling this plugin should be the one checking before sending the data if they do not want to make an NPC a friend. Not all player IDs across all games will be in that format either, but regardless... NPCs can be friends for players, so once again something that the plugin should be checking if they are handling NPCs.

Completely understand Wulf, I agree this should be the case but a lot of plugins use this hook casually and aren't doing this check. What do you think about adding a config option to set this at a global level? I understand if not, completely get where you're coming from. 

Currently the NPC Spam necessitates a wipe of the friends file on a regular basis.
5b6d791123a85.jpg Kinesis
Completely understand Wulf, I agree this should be the case but a lot of plugins use this hook casually and aren't doing this check. What do you think about adding a config option to set this at a global level? I understand if not, completely get where you're coming from. 

Currently the NPC Spam necessitates a wipe of the friends file on a regular basis.
Have you asked the other plugins to add a check? I'd start there before adding an unnecessary option to this. I can't imagine it being that many plugins using hooks that NPCs actually trigger that are calling out to Friends.
There is a rust plugin that uses this and provide an end user interface?
5b5c36c6b9361.png mspeedie
There is a rust plugin that uses this and provide an end user interface?

What is the plugin?

That was a question, not a statement note the ? at the end.  Or are you being sacrastic?

Making a generic universal bit of code is nice.   It is an efficient engine for processing friends data without any constraints or check.   And there in lies the problem.  It replaced a user facing bit of code that had checks and constraints.  You repurposed the exact UI but do not deliver the same user experience as the one you replaced.  By using those commands you preclude other plugins using those commands to make an appropriate front end for rust, thus  requiring retraining users (which is next to impossible).  It appears you are so focused on techincal excellence that sometimes do not seem understand the impact your actions at the community level.
I don't know what UI you are referring to, but that is not this plugin and never has been. Perhaps you are thinking of Rust:IO Friends? This plugin has always been an API for plugins to utilize, it has not provided a UI. The only Rust-specific code that existed in it before was for friendly fire and damage handling, which other plugins can handle and do.

You are asking for a fix to something this plugin should not have to fix, and won't be. Plugins sending the data are ultimately the ones responsible for what it wants to have as a "friend", not this plugin. I'm sorry that you do not seem to understand that, but it isn't an issue with this plugin.

So Im using Friends by Wulf and it appears that its saving ALL NPC and players as friends data file causing it to be huge... It took me a good 20min to clean out this file on 1 server... I was talking to a dev and he said to look into the addons by searcing "friend" in the addons themself... I did that and other then an addon that cant be mentioned here only Vehicle Licence's, Item Puller, Ignore, Hit Icon and Home Recycler popped anything up... but as far as I can tell none of these would check if NPC's were friends.

I seen that this was mentioned in Wulf's Friend addon and was asked to make a check but was basically told no that addon devs should make a check as his version is for universal use: https://umod.org/community/friends/18068-data-being-created-for-npcs

Any help for sorting off non actual players out of the data file?

Razor14150

So Im using Friends by Wulf and it appears that its saving ALL NPC and players as friends data file causing it to be huge... It took me a good 20min to clean out this file on 1 server... I was talking to a dev and he said to look into the addons by searcing "friend" in the addons themself... I did that and other then an addon that cant be mentioned here only Vehicle Licence's, Item Puller, Ignore, Hit Icon and Home Recycler popped anything up... but as far as I can tell none of these would check if NPC's were friends.

I seen that this was mentioned in Wulf's Friend addon and was asked to make a check but was basically told no that addon devs should make a check as his version is for universal use: https://umod.org/community/friends/18068-data-being-created-for-npcs

Any help for sorting off non actual players out of the data file?

I'd start by having those plugins only pass information they intend to have as friends. If they do not have an active developer, just let me know and I'll fix them. Aside from that, you'd have to either start fresh else remove any data without a Steam ID (what Rust uses for player IDs).
Locked automatically