summaryrefslogtreecommitdiffstats
path: root/src/Plugin.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2020-07-27 06:05:53 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2020-07-27 06:05:53 +0200
commitd899b21504c02cae99eb3688e561cf9bad4120c4 (patch)
treebfa380e1b81ab848766becff8322e783e4dcde1a /src/Plugin.cpp
parentMerge pull request #40 from LaG1924/lua-scripting (diff)
downloadAltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.gz
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.bz2
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.lz
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.xz
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.zst
AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.zip
Diffstat (limited to 'src/Plugin.cpp')
-rw-r--r--src/Plugin.cpp11
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) {