FlaminSarge / tf2attributes

TF2Attributes SourceMod plugin
48 stars 41 forks source link

Add HookValue natives #37

Closed nosoop closed 1 year ago

nosoop commented 4 years ago

Backported from my upstream fork; it's been in production use for a while.

These allow SourceMod plugins to transform values based on attribute classes in the same way the game does it; plugin authors don't have to implement rules based on calling GetValue for multiple names and multiple entities.

Example usage to determine airblast cost:

int iAmmoUse = TF2Attrib_HookValueInt(FindConVar("tf_flamethrower_burstammo").IntValue, "mult_airblast_cost", weapon);
FlaminSarge commented 4 years ago

oh no

Will take a look when I'm not mobile.

Anything else need to be pulled from upstream?

nosoop commented 4 years ago

I also have TF2Attrib_AddCustomPlayerAttribute and TF2Attrib_RemoveCustomPlayerAttribute (blatantly stolen from Pelipoika), will PR that separately if you want to take that as well.

There's also TF2Attrib_IsValidAttributeName, but that's kind of redundant now that Econ Data exists.

(oops, forgot to add mac gamedata, lemme pull down the server bins for that) oh no they're only available in the client depot

nosoop commented 1 year ago

Resolved with 69dba726f455f6a15015505256e2690080ad924f.