summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-10 19:43:45 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-05-17 15:39:39 -0400
commit59808c86bf0e4d5cf0b6ab3d6ed1d8bdcd303a37 (patch)
tree64b00bf3fee0afedfcd191bad6bf21e52000adf6 /src
parentc7ab69c9716e8cd7d1bb69b9afdc63f2f0d82776 (diff)
downloadtherapy-59808c86bf0e4d5cf0b6ab3d6ed1d8bdcd303a37.tar.gz
therapy-59808c86bf0e4d5cf0b6ab3d6ed1d8bdcd303a37.tar.bz2
therapy-59808c86bf0e4d5cf0b6ab3d6ed1d8bdcd303a37.zip
Added TransformableComponent to script engine
Diffstat (limited to 'src')
-rw-r--r--src/systems/automating.cpp10
1 files changed, 10 insertions, 0 deletions
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 @@
3#include "components/automatable.h" 3#include "components/automatable.h"
4#include "components/ponderable.h" 4#include "components/ponderable.h"
5#include "components/realizable.h" 5#include "components/realizable.h"
6#include "components/transformable.h"
6#include "systems/realizing.h" 7#include "systems/realizing.h"
7#include "vector.h" 8#include "vector.h"
8 9
@@ -83,12 +84,21 @@ void AutomatingSystem::initScriptEngine(sol::state& scriptEngine)
83 "entity", 84 "entity",
84 sol::constructors<script_entity(id_type)>(), 85 sol::constructors<script_entity(id_type)>(),
85 "id", &script_entity::id, 86 "id", &script_entity::id,
87 "transformable",
88 [&] (script_entity& entity) -> TransformableComponent& {
89 return game_.getEntityManager().
90 getComponent<TransformableComponent>(entity.id);
91 },
86 "ponderable", 92 "ponderable",
87 [&] (script_entity& entity) -> PonderableComponent& { 93 [&] (script_entity& entity) -> PonderableComponent& {
88 return game_.getEntityManager(). 94 return game_.getEntityManager().
89 getComponent<PonderableComponent>(entity.id); 95 getComponent<PonderableComponent>(entity.id);
90 }); 96 });
91 97
98 scriptEngine.new_usertype<TransformableComponent>(
99 "transformable",
100 "pos", &TransformableComponent::pos);
101
92 scriptEngine.new_usertype<PonderableComponent>( 102 scriptEngine.new_usertype<PonderableComponent>(
93 "ponderable", 103 "ponderable",
94 "vel", &PonderableComponent::vel, 104 "vel", &PonderableComponent::vel,