I don't know what I'm doing. Nothing works. I want to make the
VPhysics extension optional since the plugin is only using "Phys_ApplyTorqueCenter" native.
Trying to make the plugin compile with or without the vphysics.inc (so it can be downloaded from the forum without extra requirements) and have the plugin run with or without the VPhysics extension being installed.
Am I blind? I don't see how to detect if the extension is running, something like RegPluginLibrary. Since theres no way to determine if the extension is running I'm blindly calling Phys_ApplyTorqueCenter, which then throws "Native is not bound" error when the extension is not installed.
This makes the plugin compile with or without include and still run with or without the extension, except with the above error when ext missing:
PHP Code:
#undef REQUIRE_EXTENSIONS
// Putting this in the plugin stops it from being required and plugin not running if the include and extension are missing.
public Extension:__ext_vphysics =
{
name = "VPhysics",
file = "vphysics.ext",
autoload = 1,
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
}
#tryinclude <vphysics>
// Using both defines since version on limetech is older and uses first define, the one on github with new syntax uses second define.
#if !defined _sdktools_phys_included
#if !defined _vphysics_included
native void Phys_ApplyTorqueCenter(int iEntity, const float[3] torque);
#endif
#endif
#define REQUIRE_EXTENSIONS
Also have set:
PHP Code:
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
MarkNativeAsOptional("Phys_ApplyTorqueCenter");
}
Btw asherkin: if you see this, the link to vphysics on https://limetech.io/projects/ points to TF2Items:
__________________