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

Solved Optional VPhysics extension


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-22-2020 , 14:54   Optional VPhysics extension
Reply With Quote #1

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[3torque);
    
#endif
#endif

#define REQUIRE_EXTENSIONS 
Also have set:
PHP Code:
public APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
MarkNativeAsOptional("Phys_ApplyTorqueCenter");

Btw asherkin: if you see this, the link to vphysics on https://limetech.io/projects/ points to TF2Items:
Spoiler
__________________

Last edited by Silvers; 01-26-2020 at 16:18.
Silvers is offline
 



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:26.


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