summaryrefslogtreecommitdiffstats
path: root/src/Plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugin.cpp')
-rw-r--r--src/Plugin.cpp17
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() {