summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--scripts/checkpoint.lua2
-rw-r--r--src/game.cpp6
-rw-r--r--src/systems/scripting.cpp5
3 files changed, 6 insertions, 7 deletions
diff --git a/scripts/checkpoint.lua b/scripts/checkpoint.lua index a5c8c54..04cf357 100644 --- a/scripts/checkpoint.lua +++ b/scripts/checkpoint.lua
@@ -13,5 +13,7 @@ function checkpoint.OnTouch(id, player)
13 player:playable().checkpointMapObjectIndex = 13 player:playable().checkpointMapObjectIndex =
14 id:prototypable().mapObjectIndex 14 id:prototypable().mapObjectIndex
15 player:playable().checkpointPos = player:transformable().pos 15 player:playable().checkpointPos = player:transformable().pos
16
17 playSound("res/Pickup_Coin23.wav", 0.25)
16 end 18 end
17end 19end
diff --git a/src/game.cpp b/src/game.cpp index c76349f..eb57bc6 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -1,9 +1,4 @@
1#include "game.h" 1#include "game.h"
2#include "components/animatable.h"
3#include "components/transformable.h"
4#include "components/controllable.h"
5#include "components/ponderable.h"
6#include "components/orientable.h"
7#include "systems/controlling.h" 2#include "systems/controlling.h"
8#include "systems/pondering.h" 3#include "systems/pondering.h"
9#include "systems/animating.h" 4#include "systems/animating.h"
@@ -13,7 +8,6 @@
13#include "systems/scheduling.h" 8#include "systems/scheduling.h"
14#include "systems/realizing.h" 9#include "systems/realizing.h"
15#include "systems/scripting.h" 10#include "systems/scripting.h"
16#include "animation.h"
17#include "consts.h" 11#include "consts.h"
18 12
19void key_callback(GLFWwindow* window, int key, int, int action, int) 13void key_callback(GLFWwindow* window, int key, int, int action, int)
diff --git a/src/systems/scripting.cpp b/src/systems/scripting.cpp index c423558..504224c 100644 --- a/src/systems/scripting.cpp +++ b/src/systems/scripting.cpp
@@ -9,6 +9,7 @@
9#include "components/automatable.h" 9#include "components/automatable.h"
10#include "systems/realizing.h" 10#include "systems/realizing.h"
11#include "vector.h" 11#include "vector.h"
12#include "muxer.h"
12 13
13struct script_entity { 14struct script_entity {
14 using id_type = EntityManager::id_type; 15 using id_type = EntityManager::id_type;
@@ -103,10 +104,12 @@ ScriptingSystem::ScriptingSystem(Game& game) : System(game)
103 104
104 engine_.set_function( 105 engine_.set_function(
105 "realizing", 106 "realizing",
106 [&] () { 107 [&] () -> RealizingSystem& {
107 return game_.getSystemManager().getSystem<RealizingSystem>(); 108 return game_.getSystemManager().getSystem<RealizingSystem>();
108 }); 109 });
109 110
111 engine_.set_function("playSound", playSound);
112
110 engine_.script_file("scripts/common.lua"); 113 engine_.script_file("scripts/common.lua");
111 engine_.script_file("scripts/movplat.lua"); 114 engine_.script_file("scripts/movplat.lua");
112 engine_.script_file("scripts/checkpoint.lua"); 115 engine_.script_file("scripts/checkpoint.lua");