forked from mirror/openmw-tes3mp
Add new functions: GetServerVersion & GetProtocolVersion
This commit is contained in:
parent
a34d46f57e
commit
babc3230b7
2 changed files with 15 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <apps/openmw-mp/Player.hpp>
|
||||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <components/openmw-mp/Version.hpp>
|
||||
|
||||
template<typename... Types>
|
||||
constexpr char TypeString<Types...>::value[];
|
||||
|
@ -119,3 +120,13 @@ void ScriptFunctions::Kick(unsigned short pid) noexcept
|
|||
GET_PLAYER(pid, player,);
|
||||
mwmp::Networking::GetPtr()->KickPlayer(player->guid);
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetServerVersion() noexcept
|
||||
{
|
||||
return TES3MP_VERSION;
|
||||
}
|
||||
|
||||
const char *ScriptFunctions::GetProtocolVersion() noexcept
|
||||
{
|
||||
return to_string((int)TES3MP_PROTO_VERSION).c_str();
|
||||
}
|
|
@ -58,6 +58,8 @@ public:
|
|||
static bool IsTimerElapsed(int timerId) noexcept;
|
||||
|
||||
static void Kick(unsigned short pid) noexcept;
|
||||
static const char *GetServerVersion() noexcept;
|
||||
static const char *GetProtocolVersion() noexcept;
|
||||
|
||||
static constexpr ScriptFunctionData functions[]{
|
||||
{"CreateTimer", ScriptFunctions::CreateTimer},
|
||||
|
@ -77,6 +79,8 @@ public:
|
|||
// {"Cast", ScriptFunctions::Cast},
|
||||
{"SendMessage", ScriptFunctions::SendMessage},
|
||||
{"Kick", ScriptFunctions::Kick},
|
||||
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
||||
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
||||
|
||||
TRANSLOCATIONFUNCTIONS,
|
||||
STATSFUNCTIONS,
|
||||
|
|
Loading…
Reference in a new issue