diff options
author | cat_or_not <41955154+catornot@users.noreply.github.com> | 2023-11-05 20:21:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 02:21:50 +0100 |
commit | bb822b7638d5ae9bc4499ff76edc74f3741e6518 (patch) | |
tree | 558886bd28dc53d1004e235be1c1543c5ec2fd9f /NorthstarDLL/squirrel/squirrel.cpp | |
parent | 583bae6e1a7e35eec2c5cb4383bc0089f6ee6781 (diff) | |
download | NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.tar.gz NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.zip |
Plugins v3 (#472)v1.20.1-rc2v1.20.1-rc1v1.20.0-rc3v1.20.0
- nuked presence logic ( moved to the discord rpc plugin )
- more exposed sq functions
- exposed dll addresses
- `g_pCVar` is exposed
- added "userdata" to plugin's async call
- added runframe to plugins
Diffstat (limited to 'NorthstarDLL/squirrel/squirrel.cpp')
-rw-r--r-- | NorthstarDLL/squirrel/squirrel.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 429ef8b0..e43686d7 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -164,6 +164,7 @@ template <ScriptContext context> void SquirrelManager<context>::GenerateSquirrel s->__sq_compilebuffer = __sq_compilebuffer; s->__sq_call = __sq_call; s->__sq_raiseerror = __sq_raiseerror; + s->__sq_compilefile = __sq_compilefile; s->__sq_newarray = __sq_newarray; s->__sq_arrayappend = __sq_arrayappend; @@ -179,12 +180,8 @@ template <ScriptContext context> void SquirrelManager<context>::GenerateSquirrel s->__sq_pushasset = __sq_pushasset; s->__sq_pushvector = __sq_pushvector; s->__sq_pushobject = __sq_pushobject; - s->__sq_getstring = __sq_getstring; - s->__sq_getthisentity = __sq_getthisentity; - s->__sq_getobject = __sq_getobject; - - s->__sq_stackinfos = __sq_stackinfos; + s->__sq_getstring = __sq_getstring; s->__sq_getinteger = __sq_getinteger; s->__sq_getfloat = __sq_getfloat; s->__sq_getbool = __sq_getbool; @@ -192,24 +189,32 @@ template <ScriptContext context> void SquirrelManager<context>::GenerateSquirrel s->__sq_getasset = __sq_getasset; s->__sq_getuserdata = __sq_getuserdata; s->__sq_getvector = __sq_getvector; + s->__sq_getthisentity = __sq_getthisentity; + s->__sq_getobject = __sq_getobject; + + s->__sq_stackinfos = __sq_stackinfos; + s->__sq_createuserdata = __sq_createuserdata; s->__sq_setuserdatatypeid = __sq_setuserdatatypeid; s->__sq_getfunction = __sq_getfunction; + s->__sq_schedule_call_external = AsyncCall_External; + s->__sq_getentityfrominstance = __sq_getentityfrominstance; s->__sq_GetEntityConstant_CBaseEntity = __sq_GetEntityConstant_CBaseEntity; - s->__sq_schedule_call_external = AsyncCall_External; + s->__sq_pushnewstructinstance = __sq_pushnewstructinstance; + s->__sq_sealstructslot = __sq_sealstructslot; } // Allows for generating squirrelmessages from plugins. -// Not used in this version, but will be used later -void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function) +void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function, void* userdata) { SquirrelMessage message {}; message.functionName = func_name; message.isExternal = true; message.externalFunc = function; + message.userdata = userdata; switch (context) { case ScriptContext::CLIENT: @@ -651,9 +656,11 @@ template <ScriptContext context> void SquirrelManager<context>::ProcessMessageBu pushobject(m_pSQVM->sqvm, &functionobj); // Push the function object pushroottable(m_pSQVM->sqvm); - if (message.isExternal) + int argsAmount = message.args.size(); + + if (message.isExternal && message.externalFunc != NULL) { - message.externalFunc(m_pSQVM->sqvm); + argsAmount = message.externalFunc(m_pSQVM->sqvm, message.userdata); } else { @@ -664,7 +671,7 @@ template <ScriptContext context> void SquirrelManager<context>::ProcessMessageBu } } - _call(m_pSQVM->sqvm, message.args.size()); + _call(m_pSQVM->sqvm, argsAmount); } } |