Compare commits

...

2 Commits

Author SHA1 Message Date
Beu
652bd5fe1a bump version 2023-11-04 11:33:59 +01:00
Beu
14e21b2e4b find a workaround to have size of some blocks and items 2023-11-04 11:25:33 +01:00
2 changed files with 11 additions and 10 deletions

View File

@ -32,15 +32,18 @@ void RefreshBlocks() {
auto pluginmaptype = cast<CGameEditorPluginMapMapType>(cast<CGameCtnEditorFree>(GetApp().Editor).PluginMapType); auto pluginmaptype = cast<CGameEditorPluginMapMapType>(cast<CGameCtnEditorFree>(GetApp().Editor).PluginMapType);
for(uint i = 0; i < blocks.Length; i++) { for(uint i = 0; i < blocks.Length; i++) {
int idifexist = -1; string blockname = blocks[i].BlockModel.IdName;
string blockname; int fallbacksize = 0;
bool isofficial = true; bool isofficial = true;
blockname = blocks[i].BlockModel.IdName;
if (blockname.ToLower().SubStr(blockname.Length - 22, 22) == ".block.gbx_customblock") { if (blockname.ToLower().SubStr(blockname.Length - 22, 22) == ".block.gbx_customblock") {
isofficial = false; isofficial = false;
blockname = blockname.SubStr(0, blockname.Length - 12); blockname = blockname.SubStr(0, blockname.Length - 12);
auto article = cast<CGameCtnArticle>(blocks[i].BlockInfo.ArticlePtr);
fallbacksize = article.BlockItem_ItemModelArticle.CollectorFid.ByteSize;
} }
if (include_default_objects || blockname.ToLower().SubStr(blockname.Length - 10, 10) == ".block.gbx") { if (include_default_objects || blockname.ToLower().SubStr(blockname.Length - 10, 10) == ".block.gbx") {
vec3 pos; vec3 pos;
if (blocks[i].CoordX != 4294967295 && blocks[i].CoordZ != 4294967295) { // Not placed in free mapping 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); objects[index].positions.InsertLast(pos);
} else { } else {
int trigger = blocks[i].BlockModel.EdWaypointType; int trigger = blocks[i].BlockModel.EdWaypointType;
AddNewObject(blockname, trigger, "Block", pos, 0, isofficial); AddNewObject(blockname, trigger, "Block", pos, fallbacksize, isofficial);
objectsindex.InsertLast(blockname); objectsindex.InsertLast(blockname);
} }
} }
@ -84,7 +87,6 @@ void RefreshItems() {
// Items // Items
auto items = map.AnchoredObjects; auto items = map.AnchoredObjects;
for(uint i = 0; i < items.Length; i++) { for(uint i = 0; i < items.Length; i++) {
int idifexist = -1;
string itemname = items[i].ItemModel.IdName; string itemname = items[i].ItemModel.IdName;
int fallbacksize = 0; int fallbacksize = 0;
bool isofficial = true; bool isofficial = true;
@ -94,10 +96,9 @@ void RefreshItems() {
auto article = cast<CGameCtnArticle>(items[i].ItemModel.ArticlePtr); auto article = cast<CGameCtnArticle>(items[i].ItemModel.ArticlePtr);
if (article !is null) { if (article !is null) {
itemname = string(article.PageName) + string(article.Name) + ".Item.Gbx"; itemname = string(article.PageName) + string(article.Name) + ".Item.Gbx";
} else {
auto fid = cast<CSystemFidFile@>(GetFidFromNod(items[i].ItemModel));
fallbacksize = fid.ByteSize;
} }
auto fid = cast<CSystemFidFile@>(GetFidFromNod(items[i].ItemModel));
fallbacksize = fid.ByteSize;
} }
if (include_default_objects || itemname.ToLower().SubStr(itemname.Length - 9, 9) == ".item.gbx") { if (include_default_objects || itemname.ToLower().SubStr(itemname.Length - 9, 9) == ".item.gbx") {

View File

@ -3,5 +3,5 @@ name = "Blocks & Items Counter"
author = "Beu" author = "Beu"
category = "Map Editor" category = "Map Editor"
siteid = 97 siteid = 97
version = "1.6" version = "1.7"
blocks = [ "Plugin_Blocks&ItemsCounter" ] blocks = [ "Plugin_Blocks&ItemsCounter" ]