Bots-United / metamod-p

Metamod is a plugin/DLL manager that sits between the Half-Life Engine and an HL Game mod, allowing the dynamic loading/unloading of mod-like DLL plugins to add functionality to the HL server or game mod. Metamod-P is enhanced version of Metamod. It has dynamic link-entities and automatic detection of Mod DLL and other improvement to allow it work with future Half-Life Engine updates and new Mods and updates.
http://metamod-p.sourceforge.net/
102 stars 34 forks source link

Add one more option to handle order without reordering plugin lists #18

Open afwn90cj93201nixr2e1re opened 4 years ago

afwn90cj93201nixr2e1re commented 4 years ago

Right now we can't handle which one hooked function value gonna be returned or overrided. https://github.com/Bots-United/metamod-p/blob/cd4f10b5311cb1372214ad1ebb1df0b7c276dd39/metamod/api_hook.cpp#L383

As you can see there's only check against MRES ret stuff.

For example: Plugin 1 hooking CmdStart_Post or something like that and returning 0 with override/supercede

Plugin 2 hooking CmdStart_Post or something like that and returning 0 with override/supercede, and this one plugins should override values without depending on order. It's main plugin which should controll all exclusive stuff.

Plugin 3 hooking CmdStart_Post or something like that and returning 0 with override/supercede

afwn90cj93201nixr2e1re commented 4 years ago

e.g. SET_META_PRIORITY(99) and then plugins which are settting priority to 0 or 10 or 98 or 97 and etc gonna be skipped at reassigning state.

Also if you can add more MRES_ types, for example MRES_BREAK_POST, for breaking post calling, MRES_BREAK_ORIG_POST for breaking original call and post call, MRES_BREAK_NEXT_ORIG_POST for breaking next pre, origin, post calls MRES_BREAK_NEXT_POST for breaking next pre and post call's.

Btw i suggest to add another one value instead filling up MRES_ stuff.

But they must be very well designed so that we can flex them the way we want, for example, we can use bitsums to prevent the next pre call, next post call, call POST at all, call POST and origin at all. (im not talking about prevent calling origin due mres_supercede already exists)

afwn90cj93201nixr2e1re commented 4 years ago

@jkivilin can u take look?