From 59808c86bf0e4d5cf0b6ab3d6ed1d8bdcd303a37 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 10 May 2018 19:43:45 -0400 Subject: Added TransformableComponent to script engine --- src/systems/automating.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/systems/automating.cpp b/src/systems/automating.cpp index 5233e3e..4a5357d 100644 --- a/src/systems/automating.cpp +++ b/src/systems/automating.cpp @@ -3,6 +3,7 @@ #include "components/automatable.h" #include "components/ponderable.h" #include "components/realizable.h" +#include "components/transformable.h" #include "systems/realizing.h" #include "vector.h" @@ -83,12 +84,21 @@ void AutomatingSystem::initScriptEngine(sol::state& scriptEngine) "entity", sol::constructors(), "id", &script_entity::id, + "transformable", + [&] (script_entity& entity) -> TransformableComponent& { + return game_.getEntityManager(). + getComponent(entity.id); + }, "ponderable", [&] (script_entity& entity) -> PonderableComponent& { return game_.getEntityManager(). getComponent(entity.id); }); + scriptEngine.new_usertype( + "transformable", + "pos", &TransformableComponent::pos); + scriptEngine.new_usertype( "ponderable", "vel", &PonderableComponent::vel, -- cgit 1.4.1