Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Releases: nosoop/tf2attributes

1.7.1.1

31 Jan 15:31
Compare
Choose a tag to compare

Fixed

  • Skips additional questionable empty CUtlVector dereferences in TF2Attrib_ListDefIndices and TF2Attrib_GetStaticAttribs.

1.7.1

31 Jan 11:09
Compare
Choose a tag to compare

69 commits… nice…

Changed

  • Further improvements to overall system stability, system security and other minor adjustments have been made to enhance the user's experience.

Fixed

  • Resolves an issue where TF2Attrib_GetSOCAttribs was unnecessarily dereferencing to access the contents of a zero-length CUtlVector. It looks like this was causing crashes under certain circumstances. probably not but 🤷

Detailed view of changes since last release.

String attributes preview

14 Feb 12:31
Compare
Choose a tag to compare
Pre-release

This prerelease adds support for string attributes! This one was a doozy.

⚠️ WARNING: This is an experimental release. I've tested the new code paths and they seem to work without issue, but let me know if you discover something in the new functionality that isn't working like it should. Any questions / comments / issues with this prerelease should be posted in the pull request or in the thread on AlliedModders (not in the issues section of this repository! this isn't a proper release yet). Accelerator logs are a big plus.

Nobody mentioned any crashes on it, so consider this a stable release.

Added

  • Native TF2Attrib_SetFromStringValue lets you provide an attribute name and value as a string, then the game just Does The Right Thing™ and parses it into a runtime attribute with the proper type. This uses the same functionality that the game uses when reading attribute key / value pairs from the schema, so it should work with most attributes you throw at it.
    • Of course, you still can't network custom strings to the client (and they are likely to crash if you use an attribute they attempt to read), so this is only useful for attributes accessed on the server (but! you can inject custom attribute classes into the server's in-memory schema now, so you can use strings for those, too).
  • Native TF2Attrib_HookValueString, which behaves similar to the other TF2Attrib_HookValue* natives — it takes advantage of the game's caching system and takes an attribute class instead of a specific attribute name. You can get the value of an attribute string this way.
  • Native TF2Attrib_UnsafeGetStringValue, which takes a raw attribute value for a string attribute (specifically, an address to a CAttribute_String instance) and reads out the containing string.
  • An internal heap-tracking system that manages heap-allocated runtime attributes. The game doesn't manage such things itself (it only does this for GC and static attributes).
  • A caching layer for the name / attribute mapping. The precedent was set with the heap-tracking functionality. I was going to commit this separately, but I already pushed more code on top and it's a pain to rebase.

Better accessors, pt. 1

06 Oct 06:37
Compare
Choose a tag to compare

Couple of new convenience functions to use. Huzzah.

Added

  • Natives TF2Attrib_HookValueFloat and TF2Attrib_HookValueInt, which transforms an input value based on attributes matching the specified attribute class on a given entity (player or weapon).
    • If you're familiar with the third-party TF2 projects, this implements the CALL_ATTRIB_HOOK_FLOAT and CALL_ATTRIB_HOOK_INT macros, or CAttributeManager::AttribHookValue<> functions.
    • If you're not familiar with it, this means you don't have to collect all the attributes from runtime or item server that share the same functionality (e.g., "damage penalty", "damage bonus", "CARD: damage bonus", etc.) and determine how they stack — the game handles all of that for you.

Changed

  • Error messages have been reworded to match SourceMod's style.
  • Native functions now use const char[] instead of unconsted char[]. This allows the use of passed-in const char[] arguments from functions up the call chain.

Experiment, B-Side

17 Feb 05:46
Compare
Choose a tag to compare
Experiment, B-Side Pre-release
Pre-release

I haven't heard of any major bugs, so this is just a "completeness" update.

Added

  • New native TF2Attrib_RemoveCustomPlayerAttribute, which removes an attribute previously added via TF2Attrib_AddCustomPlayerAttribute.

Fixed

  • Fixed incorrect key amc, which is supposed to be mac. Whoops.

Experiment Part A

05 Feb 00:03
Compare
Choose a tag to compare
Experiment Part A Pre-release
Pre-release

Experimental branch for new functionality. Requires bundled gamedata.

Added

  • New native TF2Attrib_IsValidAttributeName, which returns a boolean value indicating if the game has an attribute with that name.
  • New native TF2Attrib_AddCustomPlayerAttribute, which adds an attribute to a player for a possibly limited duration. Internally, it's used on the Dalokohs bite effect, the trigger_add_or_remove_tf_player_attributes brush entity, and as an animation event (though I'm not sure when the game uses the latter — for anyone that understands what that means, see if you can find a reference to AE_TAUNT_ADD_ATTRIBUTE apparently this is only used for the all-class Yeti taunt to force invisibility or something. go figure).

Changed

  • Relative to the upstream branch, the IsValidAddress check has been changed to a runtime AssertValidAddress that will throw an exception if given a specific form of invalid value. The plugin's previous behavior was to silently handle the error in some way. The goal is to discover cases that previously silently failed so they can be appropriately handled.
  • Native TF2Attrib_IsIntegerValue now pulls the information from the game's attribute definition (the stored_as_integer key in items_game.txt). Not quite sure if there was some specific reason why a lookup table was used; I'll probably get DM'd by senpai Sarge with a reason if he notices me sees this release note.

Massive code refactor

24 Jan 16:01
Compare
Choose a tag to compare
Massive code refactor Pre-release
Pre-release

Rewrote the plugin to be slightly more understandable and DRY. (And formatted to my liking.)

Needs regression testing.