]> git.localhorst.tv Git - blank.git/blobdiff - src/app/ServerState.cpp
split chunk stuff
[blank.git] / src / app / ServerState.cpp
index 88e817d81f1a70d61f5011cead6f7e741619e034..e83984106ed06c100c04c6d6f656fff8c0f9a89e 100644 (file)
@@ -11,17 +11,23 @@ namespace blank {
 
 ServerState::ServerState(
        HeadlessEnvironment &env,
+       const Generator::Config &gc,
        const World::Config &wc,
        const WorldSave &ws,
        const Server::Config &sc
 )
 : env(env)
 , block_types()
-, world(block_types, wc, ws)
+, world(block_types, wc)
+, generator(gc)
+, chunk_loader(world.Chunks(), generator, ws)
+, skeletons()
+, spawner(world, skeletons, gc.seed)
 , server(sc, world)
 , push_timer(16) {
        TextureIndex tex_index;
        env.loader.LoadBlockTypes("default", block_types, tex_index);
+       skeletons.LoadHeadless();
 
        push_timer.Start();
 
@@ -38,8 +44,11 @@ void ServerState::Handle(const SDL_Event &event) {
 
 void ServerState::Update(int dt) {
        push_timer.Update(dt);
-
        server.Handle();
+       spawner.Update(dt);
+       if (!world.Players().empty()) {
+               world.Update(dt);
+       }
        if (push_timer.Hit()) {
                server.Update(dt);
        }