alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
970 stars 423 forks source link

Add GetPluginAutoConfig() #1493

Open dragokas opened 3 years ago

dragokas commented 3 years ago

Could you, please, add such function:

void GetPluginAutoConfig(Handle plugin, char[] name, int maxlength)

which will indicate the name applied in AutoExecConfig()?

Example of use case: [ANY] ConVars Anomaly Fixer to differentiate config files in cfg/sourcemod folder, to know which one belongs to plugins (such a way requires a fix with anomaly fixer), and which one are custom files (like per-MapConfigs) / or belongs to already disabled plugins.

Thank you!

asherkin commented 3 years ago

Plugins can register multiple config files, so the proposed design won't work - but that is easily changed.

I'm not convinced this is a great idea, there doesn't seem to be a strong use case outside of the specific one given, which is just a workaround for a bug (albeit an engine bug). I think it makes more sense to try and workaround the issue with the exec buffer internally to SM when it is executing plugin configs (e.g. delay them across multiple frames), but there are probably some other indirect indicators you can use in your plugin that would let you solve much of the same problem. In particular, I think you should be able to use a command listener for exec combined with the OnMapStart and OnAutoConfigsBuffered forwards to build a list of config files that were intended to be executed.