diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2020-07-27 23:12:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 23:12:53 +0200 |
commit | f1e6ccd798b643308c2b468fc081bd2ad552c840 (patch) | |
tree | bfa380e1b81ab848766becff8322e783e4dcde1a /src/Plugin.cpp | |
parent | Merge pull request #40 from LaG1924/lua-scripting (diff) | |
parent | Support for non-overworld dimensions (diff) | |
download | AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar.gz AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar.bz2 AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar.lz AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar.xz AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.tar.zst AltCraft-f1e6ccd798b643308c2b468fc081bd2ad552c840.zip |
Diffstat (limited to 'src/Plugin.cpp')
-rw-r--r-- | src/Plugin.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Plugin.cpp b/src/Plugin.cpp index 8d2de94..618ea9d 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -70,6 +70,10 @@ namespace PluginApi { variant }); } + + void RegisterDimension(int dimId, Dimension dim) { + RegisterNewDimension(dimId, dim); + } } int LoadFileRequire(lua_State* L) { @@ -193,6 +197,12 @@ void PluginSystem::Init() { "blockstate", &BlockInfo::blockstate, "variant", &BlockInfo::variant); + lua.new_usertype<Dimension>("Dimension", + "new", sol::factories([]() {return Dimension{ 0,0 }; }, + [](std::string dimName, bool skylight) {return Dimension{ dimName, skylight }; }), + "name", &Dimension::name, + "skylight", &Dimension::skylight); + sol::table apiTable = lua["AC"].get_or_create<sol::table>(); apiTable["RegisterPlugin"] = PluginApi::RegisterPlugin; @@ -201,6 +211,7 @@ void PluginSystem::Init() { apiTable["LogError"] = PluginApi::LogError; apiTable["GetGameState"] = PluginApi::GetGameState; apiTable["RegisterBlock"] = PluginApi::RegisterBlock; + apiTable["RegisterDimension"] = PluginApi::RegisterDimension; } void PluginSystem::Execute(const std::string &luaCode, bool except) { |