alliedmodders / sourcemod

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

Add SDKHook_AcceptInput hook type #1666

Open Alexeyt89 opened 2 years ago

Alexeyt89 commented 2 years ago

AcceptInput function is called when a light entity is swithced on/off, a door is opened/closed and in hundreds of other situations. AcceptInput offset is available in gamedata and is regulary updated, It would be nice to have the possibility to hook entity inputs with SDKHooks. variant_t can be translated as 3 variables in sp: char[], int, float. Another way is to add a GetVariant function for each SetVariant: https://sm.alliedmods.net/new-api/sdktools_entinput

Kenzzer commented 2 years ago

Any reason not to use dhooks instead ?

Alexeyt89 commented 2 years ago

AcceptInput is like entity outputs - one of the fundamental functions for interracting with entities and as there is a maintaned offset in gamedata, why don't have this hook part of SDKHooks? That would be widely used, I believe and it would not require Dhooks extension, which is not as handy in use as SDKHooks. If look at the situation from the other side, SDKHooks can be removed from sourcemod as technically any function can be hooked with using DHooks and SDKHooks is excessive.