fix item subgroup mapping

This commit is contained in:
Adam 2022-09-01 22:57:40 +02:00
parent 5afbbd736d
commit b1cf94a8a8
2 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -65,7 +65,7 @@ function getEntityPrototypes(): PrototypesByType<FactorioPrototype.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,
@ -76,7 +76,6 @@ function getEntityPrototypes(): PrototypesByType<FactorioPrototype.Entity> {
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<FactorioPrototype.Entity> {
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,