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

Can sdktools be used in an extension?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chief149
Member
Join Date: Sep 2010
Old 06-04-2016 , 19:22   Can sdktools be used in an extension?
Reply With Quote #1

I am currently working on an extension, and there are certain things I want to do within the extension in order to make coding the plugin easier. At the moment I want to call the equivalent of AcceptEntityInput from sdktools.

Is there any way to do this? The only interface I could find is extensions/ISDKTools.h and that interface doesn't expose anything I'm looking for.

How would I gain access to functions in sdktools in an extension?


To add to this post, I have tried including ISDKTools.h and then using SM_GET_IFACE to get a pointer to the ISDKTools interface. I have successfully done this, but as stated above this does not give me access to functions such as AcceptEntityInput. Looking at the code I didn't expect it would, but wanted to try it anyways. Still doesn't help my cause in this case however.

Last edited by Chief149; 06-04-2016 at 19:34.
Chief149 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-05-2016 , 15:13   Re: Can sdktools be used in an extension?
Reply With Quote #2

No - the Extension API exists to extend the API available to plugins, so it generally only includes utility and helper functions.

It sounds more like you want to be composing your custom natives with standard SourceMod natives into helper functions in an include file.

If you want to write your business logic in C++, you're on your own with regards to the API.
__________________

Last edited by asherkin; 06-05-2016 at 15:14.
asherkin is offline
Chief149
Member
Join Date: Sep 2010
Old 06-05-2016 , 15:30   Re: Can sdktools be used in an extension?
Reply With Quote #3

Well it's an RP plugin which I wish to enhance with a custom extension.

I am not trying to code a sourcemod plugin in C++ per say. I just want a more object oriented system. For example, with RP, doors have prices, notices, owners, etc. Right now I have a Door class, handle, and methodmad. In the plugin code, when a player locks or unlocks their owned door I must do myDoor.setLocked(true/false); followed by an AcceptEntityInput to actually lock the door. The reason for myDoor.setLocked() is to update the door state in the sql database.

What I want to do is have myDoor.setLocked(t/f):
- Lock/Unlock the door via AcceptEntityinput
- Update the lock/unlocked state in the MySQL database (already does this)

There are similar instances with future planned objects where I want to do something similar.
Chief149 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-05-2016 , 15:36   Re: Can sdktools be used in an extension?
Reply With Quote #4

I think you're going to run into numerous road blocks on that path.

Everything you've described there could have been implemented in a SourcePawn plugin without running into this issue.

If you don't care about cross-game compatibility, AcceptEntityInput isn't a total pain to implement yourself - but you'll quickly get bored of maintain your own gamedata.
__________________
asherkin is offline
Chief149
Member
Join Date: Sep 2010
Old 06-05-2016 , 16:20   Re: Can sdktools be used in an extension?
Reply With Quote #5

Well sure, but I want to have an object oriented feel. Plus right now I have a plugin with many thousands of lines. There's certain areas where code repeats and this makes it difficult to keep the plugin behavior consistent when adding features or updating it.

I could make methodmaps, but those have to be backed by global variables anyways. So I don't understand how this could be done in pure SourcePawn.
Chief149 is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 06-09-2016 , 04:00   Re: Can sdktools be used in an extension?
Reply With Quote #6

Quote:
Originally Posted by Chief149 View Post
What I want to do is have myDoor.setLocked(t/f):
- Lock/Unlock the door via AcceptEntityinput
- Update the lock/unlocked state in the MySQL database (already does this)
make it do that then? procedures can still do multiple things in sourcepawn
Miu 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 16:37.


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