From 7f66a924156e6baa9110e2e023e3a24c31ce95d3 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Mon, 2 Sep 2019 00:08:38 -0400 Subject: Added LIGHTING --- src/script.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/script.cpp') diff --git a/src/script.cpp b/src/script.cpp index 80ac538..30328ab 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -80,6 +80,7 @@ void ScriptSystem::doFile(void) #include #include #include +#include void ScriptSystem::scriptExport(void) { @@ -108,6 +109,13 @@ void ScriptSystem::scriptExport(void) lua.new_usertype("Player", sol::constructors()); + lua.new_usertype("Light", + sol::constructors(), + "r", &Light::r, + "g", &Light::g, + "b", &Light::b, + "strength", &Light::strength); + auto gamespace = lua["game"].get_or_create(); gamespace.set_function("spawn", func); } @@ -162,6 +170,11 @@ sol::table ScriptSystem::spawn(sol::object param) (*toRet)["Player"] = e.assign().get(); } + if (tab["Light"] != nullptr) { + (*toRet)["Light"] = + e.assign(Light().FromLua(tab["Light"])).get(); + } + } else { // TODO better logging std::cerr << "Parameter to spawn() must be a table!" << std::endl; -- cgit v1.2.3