add test.reconfig_packs & fix world.get_total_time() & enable level controller
This commit is contained in:
parent
9e18dccbbb
commit
3c2eb30a29
@ -1,4 +1,8 @@
|
||||
test.reconfig_packs({"base"}, {})
|
||||
test.new_world("demo", "2019", "core:default")
|
||||
assert(world.get_generator() == "core:default")
|
||||
coroutine.yield()
|
||||
assert(world.get_total_time() > 0.0)
|
||||
print(world.get_total_time())
|
||||
test.close_world(true)
|
||||
assert(not world.is_open())
|
||||
|
||||
@ -14,6 +14,7 @@ if test then
|
||||
test.name = __VC_TEST_NAME
|
||||
test.new_world = core.new_world
|
||||
test.close_world = core.close_world
|
||||
test.reconfig_packs = core.reconfig_packs
|
||||
end
|
||||
|
||||
------------------------------------------------
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "interfaces/Process.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include "engine.hpp"
|
||||
|
||||
static debug::Logger logger("mainloop");
|
||||
@ -33,6 +34,11 @@ void TestMainloop::run() {
|
||||
while (process->isActive()) {
|
||||
time.step(1.0f / static_cast<float>(TPS));
|
||||
process->update();
|
||||
if (controller) {
|
||||
float delta = time.getDelta();
|
||||
controller->getLevel()->getWorld()->updateTimers(delta);
|
||||
controller->update(glm::min(delta, 0.2f), false, false);
|
||||
}
|
||||
}
|
||||
logger.info() << "test finished";
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ public:
|
||||
void step(double delta) {
|
||||
frame++;
|
||||
lastTime += delta;
|
||||
this->delta = delta;
|
||||
}
|
||||
|
||||
void set(double currentTime) {
|
||||
|
||||
@ -115,8 +115,8 @@ static int l_reconfig_packs(lua::State* L) {
|
||||
remPacks.emplace_back(lua::tostring(L, -1));
|
||||
lua::pop(L);
|
||||
}
|
||||
auto engine_controller = engine->getController();
|
||||
engine_controller->reconfigPacks(controller, addPacks, remPacks);
|
||||
auto engineController = engine->getController();
|
||||
engineController->reconfigPacks(controller, addPacks, remPacks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user