lua: world.get_total_time + set_block_user_bits fix

This commit is contained in:
MihailRis
2024-01-22 09:52:26 +03:00
parent ff7f18fa7b
commit 31eda1abb2
6 changed files with 147 additions and 112 deletions
+44 -36
View File
@@ -18,53 +18,61 @@ class Level;
class Player;
class ContentLUT;
namespace fs = std::filesystem;
class world_load_error : public std::runtime_error {
public:
world_load_error(std::string message);
world_load_error(std::string message);
};
class World {
EngineSettings& settings;
const Content* const content;
std::vector<ContentPack> packs;
std::string name;
uint64_t seed;
EngineSettings& settings;
const Content* const content;
std::vector<ContentPack> packs;
public:
std::string name;
WorldFiles* wfile;
uint64_t seed;
WorldFiles* wfile;
/* Day/night loop timer in range 0..1
0.0 - is midnight
0.5 - is noon
*/
float daytime = timeutil::time_value(10, 00, 00);
float daytimeSpeed = 1.0f/60.0f/24.0f;
/* Day/night loop timer in range 0..1
0.0 - is midnight
0.5 - is noon
*/
float daytime = timeutil::time_value(10, 00, 00);
float daytimeSpeed = 1.0f/60.0f/24.0f;
double totalTime = 0.0;
World(std::string name,
std::filesystem::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
std::vector<ContentPack> packs);
~World();
World(std::string name,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
std::vector<ContentPack> packs);
~World();
void updateTimers(float delta);
void write(Level* level);
void updateTimers(float delta);
void write(Level* level);
static ContentLUT* checkIndices(const std::filesystem::path& directory,
const Content* content);
static ContentLUT* checkIndices(const fs::path& directory,
const Content* content);
static Level* create(std::string name,
std::filesystem::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack>& packs);
static Level* load(std::filesystem::path directory,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack>& packs);
const std::vector<ContentPack>& getPacks() const;
static Level* create(std::string name,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack>& packs);
static Level* load(fs::path directory,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack>& packs);
void setName(const std::string& name);
void setSeed(uint64_t seed);
std::string getName() const;
uint64_t getSeed() const;
const std::vector<ContentPack>& getPacks() const;
};
#endif /* WORLD_WORLD_H_ */