summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/character_system.cpp3
-rw-r--r--src/script_system.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/character_system.cpp b/src/character_system.cpp index d18c592..a24bdcc 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp
@@ -46,10 +46,12 @@ void CharacterSystem::addSpriteToParty(int leaderId, int followerId) {
46void CharacterSystem::transplantParty(int leaderId, vec2i pos, Direction dir) { 46void CharacterSystem::transplantParty(int leaderId, vec2i pos, Direction dir) {
47 Sprite& leader = game_.getSprite(leaderId); 47 Sprite& leader = game_.getSprite(leaderId);
48 CharacterState oldState = leader.characterState; 48 CharacterState oldState = leader.characterState;
49 CharacterMedium newMedium = game_.getSystem<TransformSystem>().getMediumAtPosition(leaderId, pos);
49 50
50 std::vector<int> followers = leader.followers; 51 std::vector<int> followers = leader.followers;
51 leader.followers.clear(); 52 leader.followers.clear();
52 leader.trailsAreHalved = false; 53 leader.trailsAreHalved = false;
54 leader.characterMedium = newMedium;
53 55
54 game_.getSystem<TransformSystem>().moveSprite(leaderId, pos); 56 game_.getSystem<TransformSystem>().moveSprite(leaderId, pos);
55 game_.getSystem<AnimationSystem>().setSpriteDirection(leaderId, dir); 57 game_.getSystem<AnimationSystem>().setSpriteDirection(leaderId, dir);
@@ -60,6 +62,7 @@ void CharacterSystem::transplantParty(int leaderId, vec2i pos, Direction dir) {
60 62
61 game_.getSystem<TransformSystem>().moveSprite(followerId, pos); 63 game_.getSystem<TransformSystem>().moveSprite(followerId, pos);
62 game_.getSystem<AnimationSystem>().setSpriteDirection(followerId, dir); 64 game_.getSystem<AnimationSystem>().setSpriteDirection(followerId, dir);
65 follower.characterMedium = newMedium;
63 addSpriteToParty(leaderId, followerId); 66 addSpriteToParty(leaderId, followerId);
64 } 67 }
65 68
diff --git a/src/script_system.cpp b/src/script_system.cpp index 0d82436..31b8bee 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -17,6 +17,7 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
17 17
18 engine_.new_usertype<vec2i>( 18 engine_.new_usertype<vec2i>(
19 "vec2i", 19 "vec2i",
20 sol::constructors<vec2i(int, int)>(),
20 "x", [] (const vec2i& v) { return v.x(); }, 21 "x", [] (const vec2i& v) { return v.x(); },
21 "y", [] (const vec2i& v) { return v.y(); }); 22 "y", [] (const vec2i& v) { return v.y(); });
22 23
@@ -70,7 +71,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) {
70 "initSprite", [] (TransformSystem& transform, int spriteId, int x, int y, SpriteLayer layer) { 71 "initSprite", [] (TransformSystem& transform, int spriteId, int x, int y, SpriteLayer layer) {
71 transform.initSprite(spriteId, vec2i{x, y}, layer); 72 transform.initSprite(spriteId, vec2i{x, y}, layer);
72 }, 73 },
73 "undoCollision", &TransformSystem::undoCollision); 74 "undoCollision", &TransformSystem::undoCollision,
75 "moveSprite", &TransformSystem::moveSprite);
74 76
75 engine_.new_usertype<EffectSystem>( 77 engine_.new_usertype<EffectSystem>(
76 "effect", 78 "effect",