blob: 279c470271c4d9b91de5f6ad8f66b624df19f895 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#pragma once
#include "SquirrelBindings.h"
#include "../cPlugin_Squirrel.h"
#include "../cPluginManager.h"
#include "../cRoot.h"
#include "../cSquirrelCommandBinder.h"
//The baseclass for squirrel plugins
class cSquirrelBaseClass
{
public:
cSquirrelBaseClass()
: m_Instance(0)
{
}
void setInstance(cPlugin_Squirrel *a_Instance)
{
m_Instance = a_Instance;
}
void AddHook(short a_Hook)
{
if(m_Instance)
cRoot::Get()->GetPluginManager()->AddHook(m_Instance, (cPluginManager::PluginHook) a_Hook);
}
void AddCommand( std::string a_Command, std::string a_Description, std::string a_Permission )
{
if(m_Instance) m_Instance->AddCommand(a_Command, a_Description, a_Permission);
}
bool BindCommand( const std::string a_Command, const std::string a_Permission, Sqrat::Function a_Callback)
{
if(!m_Instance) return false;
return cRoot::Get()->GetPluginManager()->GetSquirrelCommandBinder()->BindCommand(a_Command, a_Permission, m_Instance, a_Callback);
}
protected:
cPlugin_Squirrel *m_Instance;
};
|