Raised This Month: $32 Target: $400
 8% 

[TF2] RegenThink Hook


Post New Thread Reply   
 
Thread Tools Display Modes
Author
reBane
Senior Member
Join Date: May 2020
Plugin ID:
8271
Plugin Version:
23w04a
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Allows hooks into the clients RegenThink method by reimplementing it in SourcePawn
    Old 11-03-2022 , 12:50   [TF2] RegenThink Hook
    Reply With Quote #1

    TF2 RegenThink Hook

    The topic of hooking medics health regenration came up recently and I was kinda surprised nobody did a proper hook for this yet. I think nosoop brought up RegenThink in relation to that on the SM Discord, so thank you nosoop.

    As I didn't want this to be a "stupid" OnRegenThink hook, I dug into the decompile and reversed the function to give the most control possible. Since this plugin superceds the original function, I'm currently not sure how well this works with other RegenThink hooks, if at all.

    Forward Summary

    The forwards are documented in the include.

    PHP Code:
    Action TF2_OnRegenThinkPre(int client);
    Action TF2_OnRegenThinkHealth(int clientfloatregenHealthClassfloatregenHealthAttribs);
    Action TF2_OnRegenThinkAmmo(int clientfloatregenAmmoPercentintregenMetal);
    void TF2_OnRegenThinkPost(int clientint regenHealthfloat regenAmmoint regenMetal); 
    Dependencies

    Requires TF2 Attributes

    Credits

    I want to thank nosoop for always having some insights or helpful reference code withing TF2 in their plugins. Also thanks to who ever asked for this in the SM Discord, I actually needed this for a personal project, but was too lazy to properly do this until now. Please open an issue if I forgot anyone

    __________________
    Plugins & LibrariesListingGitHubDosMikeTools ▶ ToDo

    Last edited by reBane; 01-29-2023 at 08:29.
    reBane is offline
    reBane
    Senior Member
    Join Date: May 2020
    Old 12-02-2022 , 11:57   Re: [TF2] RegenThink Hook
    Reply With Quote #2

    Update to 22w48a
    * Updated gamedata and logic to TF2-2022-12-02
    __________________
    Plugins & LibrariesListingGitHubDosMikeTools ▶ ToDo
    reBane is offline
    reBane
    Senior Member
    Join Date: May 2020
    Old 01-29-2023 , 08:29   Re: [TF2] RegenThink Hook
    Reply With Quote #3

    Update to 23w04a
    * Switched from rescheduling RegenThink to using an SP Timer as calling ThinkSet crashed on Linux
    __________________
    Plugins & LibrariesListingGitHubDosMikeTools ▶ ToDo
    reBane is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 10:24.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode