Raised This Month: $51 Target: $400
 12% 

[TF2] Hidden dev attributes


Post New Thread Reply   
 
Thread Tools Display Modes
nosoop
Veteran Member
Join Date: Aug 2014
Old 08-20-2020 , 20:59   Re: [TF2] Hidden dev attributes
Reply With Quote #11

Quote:
Originally Posted by rafradek View Post
Any plugin should recognize the attributes added by this plugin. Custom attributes can be defined in configs/tf2hiddenattribs.txt, but that will do nothing unless you develop a plugin using them.
To add to this, to develop a plugin using "native" attributes, you can use HookValue-based natives with a completely new attribute class (currently in my fork of TF2Attributes as TF2Attrib_HookValueFloat and TF2Attrib_HookValueInt, though I've requested a merge into upstream), then define an attribute using that attribute class using the config mentioned earlier.

An extremely quick-and-dirty sample plugin that modifies player gravity is attached below, and you could then add the below attribute KeyValues entry to use it.

Code:
"10001"
{
	"name"			"gravity decreased"
	"attribute_class"	"mult_gravity"
	"description_format"	"value_is_percentage" // this determines how overlapping attributes interact
}
Attached Files
File Type: sp Get Plugin or Get Source (mult_gravity.sp - 144 views - 607 Bytes)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
rafradek
Junior Member
Join Date: Aug 2012
Old 08-21-2020 , 02:06   Re: [TF2] Hidden dev attributes
Reply With Quote #12

Quote:
Originally Posted by nosoop View Post
To add to this, to develop a plugin using "native" attributes, you can use HookValue-based natives with a completely new attribute class (currently in my fork of TF2Attributes as TF2Attrib_HookValueFloat and TF2Attrib_HookValueInt, though I've requested a merge into upstream), then define an attribute using that attribute class using the config mentioned earlier.

An extremely quick-and-dirty sample plugin that modifies player gravity is attached below, and you could then add the below attribute KeyValues entry to use it.

Code:
"10001"
{
	"name"			"gravity decreased"
	"attribute_class"	"mult_gravity"
	"description_format"	"value_is_percentage" // this determines how overlapping attributes interact
}
I think of adding a native for additional attributes files, maybe also attribhooks and string attribute setter/getter (if possible)
rafradek is offline
crafting
Senior Member
Join Date: May 2014
Location: Somewhere on Earth
Old 08-21-2020 , 03:41   Re: [TF2] Hidden dev attributes
Reply With Quote #13

Are there anymore dev attributes that have been found or enabled? I am VERY impressed on what has been done so far!

Also, so far, one attribute seems to crash the server..... "melee cleave attack" ( #4328 ). I haven't tested this since 1.1 was added.

Last edited by crafting; 08-21-2020 at 03:44. Reason: added note about "melee cleave attack"
crafting is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 08-21-2020 , 04:15   Re: [TF2] Hidden dev attributes
Reply With Quote #14

Quote:
Originally Posted by rafradek View Post
I think of adding a native for additional attributes files, maybe also attribhooks and string attribute setter/getter (if possible)
Having a config directory is probably enough; feel free to refer to the implementation in Source Scramble.
You may want to do some more robust error checking as well; the KeyValues* may be NULL if the file doesn't exist. I neglected to mention that being an issue I stumbled on with my particular setup.

I'd leave attribute hooks and strings to tf2attributes's domain. It's possible to read strings, but IIRC writing strings is beyond the scope of the runtime attribute setters that are currently available (+difficult to ensure memory safety since they're heap-allocated and normally only init'd as static attributes).
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
rafradek
Junior Member
Join Date: Aug 2012
Old 08-21-2020 , 06:42   Re: [TF2] Hidden dev attributes
Reply With Quote #15

Quote:
Originally Posted by nosoop View Post
Having a config directory is probably enough; feel free to refer to the implementation in Source Scramble.
You may want to do some more robust error checking as well; the KeyValues* may be NULL if the file doesn't exist. I neglected to mention that being an issue I stumbled on with my particular setup.

I'd leave attribute hooks and strings to tf2attributes's domain. It's possible to read strings, but IIRC writing strings is beyond the scope of the runtime attribute setters that are currently available (+difficult to ensure memory safety since they're heap-allocated and normally only init'd as static attributes).
I added null check in an update, about tf2 attributes, if you can make an updated version with those hooks in main thread post I agree with you. String setter is definitely doable in extension (look sigsegv, even if it is memory leaky) , but i will check if it could be ported

Last edited by rafradek; 08-21-2020 at 06:57.
rafradek is offline
rafradek
Junior Member
Join Date: Aug 2012
Old 08-21-2020 , 07:28   Re: [TF2] Hidden dev attributes
Reply With Quote #16

Quote:
Originally Posted by crafting View Post
Are there anymore dev attributes that have been found or enabled? I am VERY impressed on what has been done so far!

Also, so far, one attribute seems to crash the server..... "melee cleave attack" ( #4328 ). I haven't tested this since 1.1 was added.
Melee cleave attack is bugged. No this is all hidden attributes, actually tf2 devs stopped adding those long time ago (without staging_only)
rafradek is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 08-22-2020 , 17:04   Re: [TF2] Hidden dev attributes
Reply With Quote #17

Is there a way to get the dev attributes recognized by TF2 Items Info, or is that beyond the scope of this plugin?

I was trying to get some of these to work with the Uber Upgrades mod without success. It led me to do some testing of attributes with TF2II where I learned they aren't recognized.

PHP Code:
#include <sourcemod>
#include <tf2itemsinfo>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

public Plugin myinfo 
{
    
name "[TF2] Check Attributes",
    
author "PC Gamer",
    
description "Check Attribute to see it can be read with TF2ItemsInfo",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/"
}

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_checkattribute"Command_CheckAttADMFLAG_SLAY"Test an Attribute");
}

public 
Action Command_CheckAtt(int clientint args)
{
    
char arg1[32];
    if (
args 1)
    {
        
ReplyToCommand(client"checkattribute <attribute id>");
        
ReplyToCommand(client"new dev attribute ids: 4324-4378");
        return 
Plugin_Handled;
    }
    
GetCmdArg(1arg1sizeof(arg1));
    
int AttribID StringToInt(arg1);    

    if (
TF2II_IsValidAttribID(AttribID))
    {    
        
char AttribName[96];
        
TF2II_GetAttributeNameByID(AttribIDAttribName96);
        
PrintToServer("Attribute ID: %i, Name: %s"AttribIDAttribName);

        
char AttribClass[96];
        
TF2II_GetAttribClass(AttribIDAttribClass96);
        
PrintToServer("Attribute ID: %i, Class: %s"AttribIDAttribClass);

        
char AttribFormat[96];
        
TF2II_GetAttribDescrFormat(AttribIDAttribFormat96);
        
PrintToServer("Attribute ID: %i, Format: %s"AttribIDAttribFormat);

        
char AttribDescr[96];
        
TF2II_GetAttribDescrString(AttribIDAttribDescr96);
        
PrintToServer("Attribute ID: %i, Description String: %s"AttribIDAttribDescr);

        
int AttribEffect;
        
AttribEffect TF2II_GetAttribEffectType(AttribID);
        if(
AttribEffect == 1)
        {
            
PrintToServer("Attribute ID: %i, Effect Type: Positive"AttribID);
        }
        if(
AttribEffect == -1)
        {
            
PrintToServer("Attribute ID: %i, Effect Type: Negative"AttribID);
        }
        if(
AttribEffect == 0)
        {
            
PrintToServer("Attribute ID: %i, Effect Type: Not Listed"AttribID);
        }        
    }
    else
    {
        
PrintToServer("Attribute ID %d is not valid"AttribID);
    }
    return 
Plugin_Handled;
}
/*
    ---Available TF2II Attribute Natives---
    CreateNative( "TF2II_IsValidAttribID", Native_IsValidAttribID );
    CreateNative( "TF2II_GetAttribName", Native_GetAttribName );
    CreateNative( "TF2II_GetAttribClass", Native_GetAttribClass );
    CreateNative( "TF2II_GetAttribDispName", Native_GetAttribDispName );
    CreateNative( "TF2II_GetAttribMinValue", Native_GetAttribMinValue );
    CreateNative( "TF2II_GetAttribMaxValue", Native_GetAttribMaxValue );
    CreateNative( "TF2II_GetAttribGroup", Native_GetAttribGroup );
    CreateNative( "TF2II_GetAttribDescrString", Native_GetAttribDescrString );
    CreateNative( "TF2II_GetAttribDescrFormat", Native_GetAttribDescrFormat );
    CreateNative( "TF2II_HiddenAttrib", Native_HiddenAttrib );
    CreateNative( "TF2II_GetAttribEffectType", Native_GetAttribEffectType );
    CreateNative( "TF2II_AttribStoredAsInteger", Native_AttribStoredAsInteger );
    CreateNative( "TF2II_AttribHasProperty", Native_AttribHasProperty );
*/ 
PC Gamer is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 08-22-2020 , 17:34   Re: [TF2] Hidden dev attributes
Reply With Quote #18

TF2II parses the schema file independently, so that's outside the scope here. You can either patch TF2II to also read your custom attribute KV, or use Econ Data (with its TF2II adapter). The latter reads from the in-memory schema, so it has no problems recognizing the newly injected attributes.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 08-22-2020 at 17:39.
nosoop is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 08-22-2020 , 18:33   Re: [TF2] Hidden dev attributes
Reply With Quote #19

Thanks for the answer nosoop! That makes sense.
PC Gamer is offline
rafradek
Junior Member
Join Date: Aug 2012
Old 08-23-2020 , 14:27   Re: [TF2] Hidden dev attributes
Reply With Quote #20

1.2

The plugin now loads all attribute files in configs/tf2nativeattribs directory
Added sm_hiddenattribs_reload command to reload attribute files
rafradek is offline
Reply



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 06:38.


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