Definition at line 54 of file ServerScriptEngine.h.
|
| | ServerScriptEngine (ServerScriptSequencer *sequencer) |
| |
| | ~ServerScriptEngine () |
| |
| int | loadScript (std::string scriptName) |
| |
| void | unloadScript () |
| |
| AngelScript::asIScriptEngine * | getEngine () |
| |
| void | setException (const std::string &message) |
| |
| void | addCallback (const std::string &type, AngelScript::asIScriptFunction *func, AngelScript::asIScriptObject *obj) |
| |
| void | addCallbackScript (const std::string &type, const std::string &func, AngelScript::asIScriptObject *obj) |
| |
| void | deleteCallback (const std::string &type, AngelScript::asIScriptFunction *func, AngelScript::asIScriptObject *obj) |
| |
| void | deleteCallbackScript (const std::string &type, const std::string &_func, AngelScript::asIScriptObject *obj) |
| |
| void | deleteAllCallbacks () |
| |
| bool | callbackExists (const std::string &type, AngelScript::asIScriptFunction *func, AngelScript::asIScriptObject *obj) |
| |
| void | EnsureTimerThreadRunning () |
| |
| void | StopTimerThread () |
| |
| ThreadState | GetTimerThreadState () |
| |
|
| void | playerDeleted (int uid, int crash=0) |
| |
| void | playerAdded (RoRnet::UserInfo &user) |
| |
| int | streamAdded (int uid, RoRnet::StreamRegister *reg) |
| |
| int | playerChat (int uid, std::string msg) |
| |
| void | gameCmd (int uid, const std::string &cmd) |
| |
| void | curlStatus (ServerScriptCurlStatusType type, int n1, int n2, std::string displayname, std::string message) |
| |
| int | frameStep (float dt) |
| |
◆ ThreadState
◆ ServerScriptEngine()
◆ ~ServerScriptEngine()
| ServerScriptEngine::~ServerScriptEngine |
( |
| ) |
|
◆ addCallback()
| void ServerScriptEngine::addCallback |
( |
const std::string & |
type, |
|
|
AngelScript::asIScriptFunction * |
func, |
|
|
AngelScript::asIScriptObject * |
obj |
|
) |
| |
Adds a script callback.
- Parameters
-
| type | The type of the callback. This can be one of the following: 'frameStep', 'playerChat', 'gameCmd', 'playerAdded', 'playerDeleted'. |
| func | A pointer to a script function. |
| obj | A pointer to the object of the method or NULL if func is a global function. |
Definition at line 959 of file ServerScriptEngine.cpp.
◆ addCallbackScript()
| void ServerScriptEngine::addCallbackScript |
( |
const std::string & |
type, |
|
|
const std::string & |
func, |
|
|
AngelScript::asIScriptObject * |
obj |
|
) |
| |
This method checks and converts the parameters and then adds a script callback.
- Parameters
-
| type | The type of the callback. |
- See also
- addCallback
- Parameters
-
| func | The name of a script function. |
| obj | A pointer to the object of the method or NULL if func is a global function. |
Definition at line 896 of file ServerScriptEngine.cpp.
◆ callbackExists()
| bool ServerScriptEngine::callbackExists |
( |
const std::string & |
type, |
|
|
AngelScript::asIScriptFunction * |
func, |
|
|
AngelScript::asIScriptObject * |
obj |
|
) |
| |
This checks if a script callback exists.
- Parameters
-
| type | The type of the callback. |
- See also
- addCallback
- Parameters
-
| func | A pointer to a script function. |
| obj | A pointer to the object of the method or NULL if func is a global function. |
- Returns
- true if the callback exists
Definition at line 1062 of file ServerScriptEngine.cpp.
◆ curlStatus()
| void ServerScriptEngine::curlStatus |
( |
ServerScriptCurlStatusType |
type, |
|
|
int |
n1, |
|
|
int |
n2, |
|
|
std::string |
displayname, |
|
|
std::string |
message |
|
) |
| |
Params n1, n2 and message depend on status type :
- CURL_STATUS_PROGRESS: n1 = bytes downloaded, n2 = total bytes, message = empty
- CURL_STATUS_SUCCESS: n1 = CURL return code, n2 = HTTP result code, message = payload as string
- CURL_STATUS_FAILURE: n1 = CURL return code, n2 = HTTP result code, message = CURL error string
Definition at line 802 of file ServerScriptEngine.cpp.
◆ deleteAllCallbacks()
| void ServerScriptEngine::deleteAllCallbacks |
( |
| ) |
|
◆ deleteCallback()
| void ServerScriptEngine::deleteCallback |
( |
const std::string & |
type, |
|
|
AngelScript::asIScriptFunction * |
func, |
|
|
AngelScript::asIScriptObject * |
obj |
|
) |
| |
Deletes a script callback.
- Parameters
-
| type | The type of the callback. |
- See also
- addCallback
- Parameters
-
| func | A pointer to a script function. |
| obj | A pointer to the object of the method or NULL if func is a global function. |
Definition at line 1046 of file ServerScriptEngine.cpp.
◆ deleteCallbackScript()
| void ServerScriptEngine::deleteCallbackScript |
( |
const std::string & |
type, |
|
|
const std::string & |
_func, |
|
|
AngelScript::asIScriptObject * |
obj |
|
) |
| |
This method checks and converts the parameters and then deletes a script callback.
- Parameters
-
| type | The type of the callback. |
- See also
- addCallback
- Parameters
-
| func | The name of a script function. |
| obj | A pointer to the object of the method or NULL if func is a global function. |
Definition at line 985 of file ServerScriptEngine.cpp.
◆ EnsureTimerThreadRunning()
| void ServerScriptEngine::EnsureTimerThreadRunning |
( |
| ) |
|
◆ ExceptionCallback()
| void ServerScriptEngine::ExceptionCallback |
( |
AngelScript::asIScriptContext * |
ctx, |
|
|
void * |
param |
|
) |
| |
|
protected |
This callback gets called when an exception occurs in the script.
It logs the exception message together with the place in the script where the error occurs.
- Parameters
-
| ctx | The context in which the exception ocurred. |
| param | An unused parameter. |
Definition at line 229 of file ServerScriptEngine.cpp.
◆ frameStep()
| int ServerScriptEngine::frameStep |
( |
float |
dt | ) |
|
◆ gameCmd()
| void ServerScriptEngine::gameCmd |
( |
int |
uid, |
|
|
const std::string & |
cmd |
|
) |
| |
◆ getEngine()
| AngelScript::asIScriptEngine * RoR::ServerScriptEngine::getEngine |
( |
| ) |
|
|
inline |
Gets the currently used AngelScript script engine.
- Returns
- a pointer to the currently used AngelScript script engine
Definition at line 100 of file ServerScriptEngine.h.
◆ GetTimerThreadState()
◆ init()
| void ServerScriptEngine::init |
( |
| ) |
|
|
protected |
◆ LineCallback()
| void ServerScriptEngine::LineCallback |
( |
AngelScript::asIScriptContext * |
ctx, |
|
|
void * |
param |
|
) |
| |
|
protected |
◆ loadScript()
| int ServerScriptEngine::loadScript |
( |
std::string |
scriptName | ) |
|
◆ msgCallback()
| void ServerScriptEngine::msgCallback |
( |
const AngelScript::asSMessageInfo * |
msg | ) |
|
|
protected |
This is the callback function that gets called when script error occur.
When the script crashes, this function will provide you with more detail
- Parameters
-
| msg | arguments that contain details about the crash |
| param | unkown? |
Definition at line 579 of file ServerScriptEngine.cpp.
◆ playerAdded()
◆ playerChat()
| int ServerScriptEngine::playerChat |
( |
int |
uid, |
|
|
std::string |
msg |
|
) |
| |
◆ playerDeleted()
| void ServerScriptEngine::playerDeleted |
( |
int |
uid, |
|
|
int |
crash = 0 |
|
) |
| |
◆ PrintVariables()
| void ServerScriptEngine::PrintVariables |
( |
AngelScript::asIScriptContext * |
ctx, |
|
|
int |
stackLevel |
|
) |
| |
|
protected |
This logs all variables and their values at the specified stack level.
- Parameters
-
| ctx | The context that should be used. |
| stackLevel | A number representing the level in the stack that should be logged. |
Definition at line 277 of file ServerScriptEngine.cpp.
◆ setException()
| void ServerScriptEngine::setException |
( |
const std::string & |
message | ) |
|
Sets an exception that aborts the currently running script and shows the exception in the log file.
- Parameters
-
| message | A descriptive error message. |
Definition at line 886 of file ServerScriptEngine.cpp.
◆ StopTimerThread()
| void ServerScriptEngine::StopTimerThread |
( |
| ) |
|
◆ streamAdded()
◆ TimerThreadMain()
| void ServerScriptEngine::TimerThreadMain |
( |
| ) |
|
|
protected |
◆ unloadScript()
| void ServerScriptEngine::unloadScript |
( |
| ) |
|
◆ callbacks
| std::map<std::string, callbackList> RoR::ServerScriptEngine::callbacks |
|
protected |
◆ context
| AngelScript::asIScriptContext* RoR::ServerScriptEngine::context |
|
protected |
◆ engine
| AngelScript::asIScriptEngine* RoR::ServerScriptEngine::engine |
|
protected |
◆ m_timer_thread
| std::thread RoR::ServerScriptEngine::m_timer_thread |
|
protected |
◆ m_timer_thread_mutex
| std::mutex RoR::ServerScriptEngine::m_timer_thread_mutex |
|
protected |
◆ m_timer_thread_state
◆ seq
The documentation for this class was generated from the following files: