mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
feat: loading entities (WIP)
This commit is contained in:
parent
08cc78289d
commit
c8666910ce
16 changed files with 129 additions and 38 deletions
|
|
@ -251,10 +251,9 @@ void Player::deserialize(dynamic::Map *src) {
|
|||
src->flag("flight", flight);
|
||||
src->flag("noclip", noclip);
|
||||
setChosenSlot(src->get("chosen-slot", getChosenSlot()));
|
||||
|
||||
auto invmap = src->map("inventory");
|
||||
if (invmap) {
|
||||
getInventory()->deserialize(invmap);
|
||||
|
||||
if (auto invmap = src->map("inventory")) {
|
||||
getInventory()->deserialize(invmap.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -264,16 +263,14 @@ void Player::convert(dynamic::Map* data, const ContentLUT* lut) {
|
|||
if (players) {
|
||||
for (uint i = 0; i < players->size(); i++) {
|
||||
auto playerData = players->map(i);
|
||||
auto inventory = playerData->map("inventory");
|
||||
if (inventory) {
|
||||
Inventory::convert(inventory, lut);
|
||||
if (auto inventory = playerData->map("inventory")) {
|
||||
Inventory::convert(inventory.get(), lut);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
auto inventory = data->map("inventory");
|
||||
if (inventory) {
|
||||
Inventory::convert(inventory, lut);
|
||||
if (auto inventory = data->map("inventory")) {
|
||||
Inventory::convert(inventory.get(), lut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue