diff options
author | LaG1924 <lag1924@gmail.com> | 2021-06-22 00:38:08 +0200 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2021-06-22 00:46:59 +0200 |
commit | 14939a87010ab17425d73b53829aa22c17c96d79 (patch) | |
tree | 1b388f1121040f862d4f9aee7845b2705d09df4a /src/Plugin.cpp | |
parent | Added game menus (diff) | |
download | AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.gz AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.bz2 AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.lz AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.xz AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.zst AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.zip |
Diffstat (limited to 'src/Plugin.cpp')
-rw-r--r-- | src/Plugin.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Plugin.cpp b/src/Plugin.cpp index f518957..e3188e6 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -10,6 +10,7 @@ #include "Game.hpp" #include "Event.hpp" #include "AssetManager.hpp" +#include "Settings.hpp" struct Plugin { @@ -103,6 +104,10 @@ namespace PluginApi { void SetStatePlaying() { SetState(State::Playing); } + + void SettingsUpdate() { + PUSH_EVENT("SettingsUpdate", 0); + } } int LoadFileRequire(lua_State* L) { @@ -233,6 +238,7 @@ void PluginSystem::Init() { "skylight", &Dimension::skylight); sol::table apiTable = lua["AC"].get_or_create<sol::table>(); + sol::table apiSettings = lua["AC"]["Settings"].get_or_create<sol::table>(); apiTable["RegisterPlugin"] = PluginApi::RegisterPlugin; apiTable["LogWarning"] = PluginApi::LogWarning; @@ -245,6 +251,17 @@ void PluginSystem::Init() { apiTable["Exit"] = PluginApi::Exit; apiTable["Disconnect"] = PluginApi::Disconnect; apiTable["SetStatePlaying"] = PluginApi::SetStatePlaying; + apiSettings["Load"] = Settings::Load; + apiSettings["Save"] = Settings::Save; + apiSettings["Read"] = Settings::Read; + apiSettings["Write"] = Settings::Write; + apiSettings["ReadBool"] = Settings::ReadBool; + apiSettings["WriteBool"] = Settings::WriteBool; + apiSettings["ReaIntd"] = Settings::ReadInt; + apiSettings["WriteInt"] = Settings::WriteInt; + apiSettings["ReadDouble"] = Settings::ReadDouble; + apiSettings["WriteDouble"] = Settings::WriteDouble; + apiTable["SettingsUpdate"] = PluginApi::SettingsUpdate; } lua_State* PluginSystem::GetLuaState() { |