Game variable support

This commit is contained in:
Federico Cecchetto 2021-05-03 01:50:55 +02:00
parent 0c2596db3d
commit 2ae89359ce

View File

@ -11,6 +11,8 @@
#include <utils/string.hpp>
namespace _game = game;
namespace scripting::lua
{
namespace
@ -259,6 +261,19 @@ namespace scripting::lua
{
logfile::add_player_killed_callback(callback);
};
game_type["getgamevar"] = [](const sol::this_state s)
{
const auto id = *reinterpret_cast<unsigned int*>(0x14815DEB4);
const auto value = _game::scr_VarGlob->childVariableValue[id];
_game::VariableValue variable{};
variable.type = value.type;
variable.u.uintValue = value.u.u.uintValue;
return convert(s, variable);
};
}
}