Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement API for reading extended data by plugins #36

Closed
nosoop opened this issue Dec 23, 2021 · 1 comment
Closed

Implement API for reading extended data by plugins #36

nosoop opened this issue Dec 23, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@nosoop
Copy link
Owner

nosoop commented Dec 23, 2021

In the future I'd like to implement the following native functionality:

/**
 * Returns a subsection within an items "extended data" section.  This handle should be freed by the calling plugin.
 * If the section doesn't exist, this returns `null`.
 */
native KeyValues CWX_GetItemExtData(const char[] uid, const char[] name);

// TODO some item UID iterator (??)

One of the intended functions of this setup is to allow custom-defined sections, such as for precaching resources on map startup, and just things that other plugins can hook on:

"my item"
{
	"name"		"My custom bat that I didn't steal from Smash or anything"
	"inherits"	"TF_WEAPON_BAT"
	"extdata"
	{
		"resources"
		{
			"model"		"models/path/to/a/custom_bat.mdl"
			"texture"	"materials/stuff.vmt"
			"texture"	"materials/more_stuff.vmt"
			"sound"		"sound/satisfying_bat_impact_sound.wav"
		}
	}
}

I believe this is something that would be relevant for #7.

(The reason we do it this way is to isolate plugin-specific data and provide a convenient interface without having to traverse deep into the entire item KeyValues struct. Also, we may not necessarily require items to be defined in their entirety using KeyValues.)

@nosoop nosoop added the enhancement New feature or request label Dec 23, 2021
@nosoop
Copy link
Owner Author

nosoop commented Dec 24, 2021

Closed with 72aadbf for the most part.

@nosoop nosoop closed this as completed Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant