diff --git a/plugins/remotefortressreader/item_reader.cpp b/plugins/remotefortressreader/item_reader.cpp index f96397409..59b1f36e7 100644 --- a/plugins/remotefortressreader/item_reader.cpp +++ b/plugins/remotefortressreader/item_reader.cpp @@ -99,6 +99,13 @@ void CopyImage(const df::art_image * image, ArtImage * netImage) it->set_mat_type(item->item_type); it->set_mat_index(item->item_subtype); netElement->set_id(item->item_id); + switch (item->item_type) + { + case item_type::PLANT: + it->set_mat_index(item->mat_index); + default: + break; + } auto mat = netElement->mutable_material(); mat->set_mat_type(item->mat_type); mat->set_mat_index(item->mat_index); @@ -303,6 +310,8 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem) case df::enums::item_type::SEEDS: break; case df::enums::item_type::PLANT: + //For convenience, we encode the plant type into item type, even if it's available in the material. + type->set_mat_index(DfItem->getMaterialIndex()); break; case df::enums::item_type::SKIN_TANNED: break; @@ -521,6 +530,18 @@ DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack:: } break; } + case df::enums::item_type::PLANT: + { + for (int i = 0; i < world->raws.plants.all.size(); i++) + { + auto plantRaw = world->raws.plants.all[i]; + mat_def = out->add_material_list(); + mat_def->mutable_mat_pair()->set_mat_type((int)it); + mat_def->mutable_mat_pair()->set_mat_index(plantRaw->index); + mat_def->set_id(ENUM_KEY_STR(item_type, it) + "/" + plantRaw->id); + } + break; + } case df::enums::item_type::BOX: { mat_def = out->add_material_list(); diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index 5b84bf745..e321bf8d5 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -1511,9 +1511,9 @@ static command_result GetBlockList(color_ostream &stream, const BlockRequest *in auto engraving = world->engravings[i]; if (engraving->pos.x < (min_x * 16) || engraving->pos.x >(max_x * 16)) continue; - if (engraving->pos.y < (min_y * 16) || engraving->pos.x >(max_y * 16)) + if (engraving->pos.y < (min_y * 16) || engraving->pos.y >(max_y * 16)) continue; - if (engraving->pos.z < (min_z * 16) || engraving->pos.x >(max_z * 16)) + if (engraving->pos.z < min_z || engraving->pos.z > max_z) continue; if (!isEngravingNew(i)) continue;