aboutsummaryrefslogtreecommitdiffstats
path: root/src/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script.cpp b/src/script.cpp
index 4fda543..b1d82e9 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -75,6 +75,7 @@ void ScriptSystem::doFile(void)
/********************
* SCRIPT PARSING *
********************/
+#include <components/Audio.hpp>
#include <components/EventListener.hpp>
#include <components/Position.hpp>
#include <components/Player.hpp>
@@ -123,6 +124,10 @@ void ScriptSystem::scriptExport(void)
"standing", &Physics::standing,
"gravity", &Physics::gravity);
+ lua.new_usertype<Audio>("Audio",
+ sol::constructors<Audio(std::string)>(),
+ "file", &Audio::fileName);
+
lua.new_usertype<World>("World",
sol::constructors<World(sol::object), World(void)>(),
"Generate", &World::generate,
@@ -172,6 +177,11 @@ sol::table ScriptSystem::spawn(sol::object param)
e.assign<Name>(Name().FromLua(tab["Name"])).get();
}
+ if (tab["Audio"] != nullptr) {
+ (*toRet)["Audio"] =
+ e.assign<Audio>(Audio().FromLua(tab["Audio"])).get();
+ }
+
if (tab["Render"] != nullptr) {
if (!e.has_component<Position>()) // Position must exist for render
(*toRet)["Position"] = e.assign<Position>().get();