summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 18:06:35 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 18:06:35 -0500
commitee7077c7ff0c22a4909c15ab34aed777b45b977e (patch)
tree9541d62461579c752afd0c1af4794acb1c23d10c /src
parent2afa279d4c7780e4d43749d73891c9a7d46f4472 (diff)
downloadtanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.gz
tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.tar.bz2
tanetane-ee7077c7ff0c22a4909c15ab34aed777b45b977e.zip
Direction is preserved across map transitions now
Diffstat (limited to 'src')
-rw-r--r--src/script_system.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/script_system.cpp b/src/script_system.cpp index a5e9403..6b35b73 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -10,6 +10,11 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
10 sol::lib::coroutine, 10 sol::lib::coroutine,
11 sol::lib::math); 11 sol::lib::math);
12 12
13 engine_.new_usertype<Sprite>(
14 "sprite",
15 "dir", &Sprite::dir,
16 "followers", &Sprite::followers);
17
13 engine_.new_usertype<MessageSystem>( 18 engine_.new_usertype<MessageSystem>(
14 "message", 19 "message",
15 "displayMessage", &MessageSystem::displayMessage, 20 "displayMessage", &MessageSystem::displayMessage,
@@ -18,7 +23,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
18 23
19 engine_.new_usertype<AnimationSystem>( 24 engine_.new_usertype<AnimationSystem>(
20 "animation", 25 "animation",
21 "setSpriteAnimation", &AnimationSystem::setSpriteAnimation); 26 "setSpriteAnimation", &AnimationSystem::setSpriteAnimation,
27 "setSpriteDirection", &AnimationSystem::setSpriteDirection);
22 28
23 engine_.new_usertype<Mixer>( 29 engine_.new_usertype<Mixer>(
24 "mixer", 30 "mixer",
@@ -51,6 +57,24 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
51 }); 57 });
52 58
53 engine_.set_function( 59 engine_.set_function(
60 "getControllableSprite",
61 [&] () -> int {
62 for (int id : game_.getSprites()) {
63 Sprite& sprite = game_.getSprite(id);
64 if (sprite.controllable) {
65 return id;
66 }
67 }
68 return -1;
69 });
70
71 engine_.set_function(
72 "getSprite",
73 [&] (int id) -> Sprite& {
74 return game_.getSprite(id);
75 });
76
77 engine_.set_function(
54 "loadMap", 78 "loadMap",
55 [&] (std::string filename, std::string warpPoint) { 79 [&] (std::string filename, std::string warpPoint) {
56 game_.loadMap(filename, warpPoint); 80 game_.loadMap(filename, warpPoint);