diff --git a/BlocksItemsCounter/Source/Libs/Objects.as b/BlocksItemsCounter/Source/Libs/Objects.as index 7f7f1b4..800fb5f 100644 --- a/BlocksItemsCounter/Source/Libs/Objects.as +++ b/BlocksItemsCounter/Source/Libs/Objects.as @@ -32,15 +32,18 @@ void RefreshBlocks() { auto pluginmaptype = cast(cast(GetApp().Editor).PluginMapType); for(uint i = 0; i < blocks.Length; i++) { - int idifexist = -1; - string blockname; + string blockname = blocks[i].BlockModel.IdName; + int fallbacksize = 0; bool isofficial = true; - blockname = blocks[i].BlockModel.IdName; if (blockname.ToLower().SubStr(blockname.Length - 22, 22) == ".block.gbx_customblock") { isofficial = false; blockname = blockname.SubStr(0, blockname.Length - 12); + + auto article = cast(blocks[i].BlockInfo.ArticlePtr); + fallbacksize = article.BlockItem_ItemModelArticle.CollectorFid.ByteSize; } + if (include_default_objects || blockname.ToLower().SubStr(blockname.Length - 10, 10) == ".block.gbx") { vec3 pos; if (blocks[i].CoordX != 4294967295 && blocks[i].CoordZ != 4294967295) { // Not placed in free mapping @@ -67,7 +70,7 @@ void RefreshBlocks() { objects[index].positions.InsertLast(pos); } else { int trigger = blocks[i].BlockModel.EdWaypointType; - AddNewObject(blockname, trigger, "Block", pos, 0, isofficial); + AddNewObject(blockname, trigger, "Block", pos, fallbacksize, isofficial); objectsindex.InsertLast(blockname); } } @@ -84,7 +87,6 @@ void RefreshItems() { // Items auto items = map.AnchoredObjects; for(uint i = 0; i < items.Length; i++) { - int idifexist = -1; string itemname = items[i].ItemModel.IdName; int fallbacksize = 0; bool isofficial = true; @@ -94,10 +96,9 @@ void RefreshItems() { auto article = cast(items[i].ItemModel.ArticlePtr); if (article !is null) { itemname = string(article.PageName) + string(article.Name) + ".Item.Gbx"; - } else { - auto fid = cast(GetFidFromNod(items[i].ItemModel)); - fallbacksize = fid.ByteSize; } + auto fid = cast(GetFidFromNod(items[i].ItemModel)); + fallbacksize = fid.ByteSize; } if (include_default_objects || itemname.ToLower().SubStr(itemname.Length - 9, 9) == ".item.gbx") { @@ -194,4 +195,4 @@ bool FocusCam(const string &in objectname) { return true; } return false; -} +} \ No newline at end of file