add player.is_loading_chunks, .set_loading_chunks

This commit is contained in:
MihailRis
2024-12-24 10:35:09 +03:00
parent 0940e899cf
commit e153e1fbd7
6 changed files with 54 additions and 2 deletions
+11 -1
View File
@@ -251,6 +251,14 @@ void Player::setInstantDestruction(bool flag) {
instantDestruction = flag;
}
bool Player::isLoadingChunks() const {
return loadingChunks;
}
void Player::setLoadingChunks(bool flag) {
loadingChunks = flag;
}
entityid_t Player::getEntity() const {
return eid;
}
@@ -297,6 +305,7 @@ dv::value Player::serialize() const {
root["noclip"] = noclip;
root["infinite-items"] = infiniteItems;
root["instant-destruction"] = instantDestruction;
root["loading-chunks"] = loadingChunks;
root["chosen-slot"] = chosenSlot;
root["entity"] = eid;
root["inventory"] = inventory->serialize();
@@ -329,7 +338,8 @@ void Player::deserialize(const dv::value& src) {
noclip = src["noclip"].asBoolean();
src.at("infinite-items").get(infiniteItems);
src.at("instant-destruction").get(instantDestruction);
src.at("loading-chunks").get(loadingChunks);
setChosenSlot(src["chosen-slot"].asInteger());
eid = src["entity"].asNumber();
+4
View File
@@ -51,6 +51,7 @@ class Player : public Serializable {
bool noclip = false;
bool infiniteItems = true;
bool instantDestruction = true;
bool loadingChunks = true;
entityid_t eid;
entityid_t selectedEid = 0;
public:
@@ -97,6 +98,9 @@ public:
bool isInstantDestruction() const;
void setInstantDestruction(bool flag);
bool isLoadingChunks() const;
void setLoadingChunks(bool flag);
entityid_t getEntity() const;
void setEntity(entityid_t eid);