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

[Request] Extension to allow plugins to control subplugins of it.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-15-2014 , 11:26   [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #1

Yes, I would like an extension to sourcemod that allows plugins to have control over how plugins are loaded and unloaded that overrides the sourcemod's system of controlling plugins.
I would like natives to register control functions that replace OnPluginStart() and AskPluginToLoad2(), natives to load, unload, pause, reload plugins based on return control handle(from say like a native called CreatePluginControl(const String:controlName[])).
Basically to avoid xyz problem, I want an extension that I can use to control FF2 subplugins(because I'm getting a headstart on FF2 2.0.0 alpha)
Edit: If this is to vague, I apologize, what I want is EXTREMELY hard to describe.
Edit 2: As with my reply #7, I 100% need an extension to control these 2 commands to prevent subplugins from being arguements of(sm plugins load and sm plugins unload)

Last edited by WildCard65; 04-15-2014 at 20:03.
WildCard65 is offline
Zilor
AlliedModders Donor
Join Date: May 2013
Location: Free and Hanseatic City
Old 04-15-2014 , 11:58   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #2

Maybe you can use DarthNinja's [Any] Plugin Enable/Disable and put some natives into it or rewrite it to unload plugins when the FF2 cvar changes.

Edit: I think that's not what you asked for :/... I'm sorry.
__________________

Last edited by Zilor; 04-15-2014 at 12:01.
Zilor is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-15-2014 , 12:01   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #3

Not really what I'm looking for.
Basically I want to be able to control ff2 subplugins loading so that sourcemod itself doesn't autoload them and load them via natives either when round start/map start and unload them when round end/map end
WildCard65 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-15-2014 , 13:30   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #4

Perhaps you could just remove everything from the forwards that Sourcemod calls. For example, rather than this:

PHP Code:
public OnPluginStart() {
    
//stuff

You could do something like this:
PHP Code:
#include <someCustomInclude>

public FF2_OnPluginStart() {
    
//stuff

You would then call that forward in the "main" or "core" or "host" plugin.

PHP Code:
new Handle:hfwd_OnPluginStart

public OnPluginStart() {
    
hfwd_OnPluginStart CreateGlobalForward("FF2_OnPluginStart"ET_Ignore);

PHP Code:
    Call_StartForward(hfwd_OnPluginStart);
    
Call_Finish(); 
You would, of course, need to have a properly configured INC file that tells the sub-plugins how to interact with the core plugin. Take a look at my example of it.
__________________

Last edited by ddhoward; 04-15-2014 at 13:32.
ddhoward is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 04-15-2014 , 13:34   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #5

Re-reading your first post, this doesn't really give you the precise control that you'd like over INDIVIDUAL plugins... This may still be possible in Sourcepawn without extensions, though.
__________________

Last edited by ddhoward; 04-15-2014 at 13:34.
ddhoward is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-15-2014 , 15:28   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #6

I may give your suggestion a try when I feel like coding more.
Edit: Quick glance at the sourcemod source and ddhoward and you seem to be correct with how your doing it.
Edit 2: Nvm, see next reply.

Last edited by WildCard65; 04-15-2014 at 20:02.
WildCard65 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-15-2014 , 20:02   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #7

Ya, ddhoward, I just realized I will still need a plugin that I can call a native to set a plugin to not be loaded/unloaded by sm plugins load and sm plugins unload.
WildCard65 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-16-2014 , 05:31   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #8

The extension API doesn't expose functionality to block loading (or any other control over plugin lifetime).
__________________
asherkin is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 04-16-2014 , 12:20   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #9

Tis makes no sense.
Ff2 plugins require ff2 to be loaded to use the natives.
Ff2 also automatically loads and unloads the subplugins.

The easiest way is to just put them in the disabled directory, then they won't autoload... You can then manually load/unload them by specifying the path. Usually I do that with configs, but you could servercommand it.

Also, it won't autoload non .smx files, but you could name it like .ff2 and it won't autoload, or .abc... Whatever.

Also, loading lots of .ff2 files is dumb. It should be /disabled/freaks/someplugin.smx
However, there is no reason to dynamically load/unload the ff2 subplugins, as they won't work without ff2 enabled anyways.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-16-2014 , 13:51   Re: [Request] Extension to allow plugins to control subplugins of it.
Reply With Quote #10

Quote:
Originally Posted by friagram View Post
Also, it won't autoload non .smx files, but you could name it like .ff2 and it won't autoload, or .abc... Whatever.
Actually fiagram, from what I see in sourcemod's PluginSys.cpp, it loads any plugin it can open no matter the extension:
Code:
CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
{
	char fullpath[PLATFORM_MAX_PATH];
	g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file);
	FILE *fp = fopen(fullpath, "rb");

	CPlugin *pPlugin = new CPlugin(file);

	if (!fp)
	{
		if (error)
		{
			UTIL_Format(error, maxlength, "Unable to open file");
		}
		pPlugin->m_status = Plugin_BadLoad;
		return pPlugin;
	}

	fclose(fp);

	return pPlugin;
}
WildCard65 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 15:41.


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