From b1cf94a8a8d478e8352a609ea5cbdc811faca5df Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 1 Sep 2022 22:57:40 +0200 Subject: [PATCH] fix item subgroup mapping --- .../generated/lua/main/events/prototypeUpdates.lua | 7 +++++-- .../main/typescript/main/events/prototypeUpdates.ts | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/events-mod/src/generated/lua/main/events/prototypeUpdates.lua b/modules/events-mod/src/generated/lua/main/events/prototypeUpdates.lua index 5cc2334..d856e92 100644 --- a/modules/events-mod/src/generated/lua/main/events/prototypeUpdates.lua +++ b/modules/events-mod/src/generated/lua/main/events/prototypeUpdates.lua @@ -1,5 +1,5 @@ local ____exports = {} -local emit, getMapTilePrototypes, getEntityPrototypes, convertItemGroup +local emit, getMapTilePrototypes, getEntityPrototypes, convertItemGroup, convertItemSubgroup local ____kafkatorio_2Dschema = require("generated.kafkatorio-schema") local FactorioPrototype = ____kafkatorio_2Dschema.FactorioPrototype local KafkatorioPacketData = ____kafkatorio_2Dschema.KafkatorioPacketData @@ -38,7 +38,7 @@ function getEntityPrototypes() type = FactorioPrototype.Type.Entity, protoId = Converters.prototypeId(entity.type, entity.name), group = convertItemGroup(entity.group), - subgroup = convertItemGroup(entity.subgroup), + subgroup = convertItemSubgroup(entity.subgroup), isBuilding = entity.is_building, isEntityWithOwner = entity.is_entity_with_owner, isMilitaryTarget = entity.is_military_target, @@ -64,6 +64,9 @@ function getEntityPrototypes() return protos end function convertItemGroup(itemGroup) + return {name = itemGroup.name, type = itemGroup.type, parentName = nil} +end +function convertItemSubgroup(itemGroup) local ____itemGroup_name_3 = itemGroup.name local ____itemGroup_type_4 = itemGroup.type local ____itemGroup_group_name_1 = itemGroup.group diff --git a/modules/events-mod/src/main/typescript/main/events/prototypeUpdates.ts b/modules/events-mod/src/main/typescript/main/events/prototypeUpdates.ts index 4ae6ce0..b5f785d 100644 --- a/modules/events-mod/src/main/typescript/main/events/prototypeUpdates.ts +++ b/modules/events-mod/src/main/typescript/main/events/prototypeUpdates.ts @@ -65,7 +65,7 @@ function getEntityPrototypes(): PrototypesByType { protoId: Converters.prototypeId(entity.type, entity.name), group: convertItemGroup(entity.group), - subgroup: convertItemGroup(entity.subgroup), + subgroup: convertItemSubgroup(entity.subgroup), isBuilding: entity.is_building, isEntityWithOwner: entity.is_entity_with_owner, @@ -76,7 +76,6 @@ function getEntityPrototypes(): PrototypesByType { tileWidth: entity.tile_width, tileHeight: entity.tile_height, } - entity.infinite_resource if (entity.map_color != undefined) { entityProto.mapColour = Converters.mapColour(entity.map_color) @@ -96,6 +95,15 @@ function getEntityPrototypes(): PrototypesByType { function convertItemGroup(itemGroup: LuaGroup): EntityItemGroup { + return { + name: itemGroup.name, + type: itemGroup.type, + parentName: null, + } +} + + +function convertItemSubgroup(itemGroup: LuaGroup): EntityItemGroup { return { name: itemGroup.name, type: itemGroup.type,