greeny / SatisfactoryTools

Satisfactory Tools for planning and building the perfect base.
https://www.satisfactorytools.com/
MIT License
287 stars 58 forks source link

Consistency issue #6

Closed BayDragon42 closed 4 years ago

BayDragon42 commented 4 years ago

Hello, I noticed an inconsistency in the name of craftable items in your "data.json" file, don't know if it is intended, but it makes fetching recipes more complicated than it would have been by just accessing the values by key.

I quikcly wrote a script to get those keys that are not consistent with the recipes ones, since it was quickly, some in the list are non-craftable (fruits, raw meterials, ...) and do not need to be taken into account.

<class 'list'>: ['Desc_FoundryMk1_C', 'Desc_PowerPoleWallDouble_Mk2_C', 'Desc_PowerPoleWall_Mk2_C', 'Desc_PipelineSupportWall_C', 'Desc_PipelineSupportWallHole_C', 'Desc_PowerPoleWallDouble_Mk3_C', 'Desc_PowerPoleWall_Mk3_C', 'Desc_PipelineSupport_C', 'Desc_LandingPad_C', 'Desc_WalkwayCross_C', 'Desc_WalkwayRamp_C', 'Desc_WalkwayStraight_C', 'Desc_WalkwayT_C', 'Desc_WalkwayTurn_C', 'Desc_Cement_C', 'Desc_CrystalShard_C', 'Desc_HazmatFilter_C', 'Desc_CartridgeStandard_C', 'Desc_HUBParts_C', 'Desc_Filter_C', 'Desc_CopperIngot_C', 'Desc_IronScrew_C', 'Desc_IronIngot_C', 'Desc_AluminumPlate_C', 'Desc_SteelPlateReinforced_C', 'Desc_PolymerResin_C', 'Desc_HeavyOilResidue_C', 'Desc_SteelIngot_C', 'Desc_CircuitBoardHighSpeed_C', 'Desc_AluminumIngot_C', 'Desc_HighSpeedWire_C', 'Desc_SteelPlate_C', 'Desc_GoldIngot_C', 'Desc_LiquidTurboFuel_C', 'Desc_TurboFuel_C', 'Desc_AluminumPlateReinforced_C', 'Desc_MotorLightweight_C', 'Desc_ModularFrameLightweight_C', 'Desc_NobeliskExplosive_C', 'Desc_Crystal_C', 'Desc_Crystal_mk2_C', 'Desc_Crystal_mk3_C', 'Desc_GenericBiomass_C', 'Desc_Leaves_C', 'Desc_Wood_C', 'Desc_Mycelia_C', 'Desc_HogParts_C', 'Desc_SpitterParts_C', 'Desc_FlowerPetals_C', 'Desc_GolfCart_C', 'BP_EquipmentDescriptorHazmatSuit_C', 'BP_EquipmentDescriptorJetPack_C', 'BP_EquipmentDescriptorJumpingStilts_C', 'Desc_RebarGunProjectile_C', 'BP_EquipmentDescriptorRifle_C', 'BP_EquipmentDescriptorShockShank_C', 'BP_EquipmentDescriptorStunSpear_C', 'BP_ItemDescriptorPortableMiner_C', 'BP_EquipmentDescriptorObjectScanner_C', 'BP_EquipmentDescriptorGasmask_C', 'BP_EquipmentDescriptorColorGun_C', 'BP_EquipmentDescriptorNobeliskDetonator_C', 'Desc_Water_C', 'Desc_OreIron_C', 'Desc_OreCopper_C', 'Desc_Stone_C', 'Desc_Coal_C', 'Desc_LiquidOil_C', 'Desc_OreBauxite_C', 'Desc_OreGold_C', 'Desc_OreUranium_C', 'Desc_RawQuartz_C', 'Desc_Sulfur_C', 'Desc_CompactedCoal_C', 'Desc_PackagedOil_C', 'BP_EquipmentDescriptorBeacon_C', 'Desc_Berry_C', 'Desc_Shroom_C', 'Desc_Nut_C', 'Desc_Medkit_C', 'Desc_NuclearWaste_C']

greeny commented 4 years ago

Hey, the data.json file is autogenerated using a script (bin/parseDocs), so if you want to make changes, then it should be there. Also, these "names" are class names from the original file, so I'm not sure what inconsistency you are looking at, I'm using them just fine. Maybe an examle what would you like to change?

BayDragon42 commented 4 years ago

Ah well, if that's how they named it in the original file.. I can think of one thing to do but that would be a pain for you to make the changes on your tools and I don't want that.

The script I am writing is based solely on the constructions related recipes, so I needed to juggle between the recipes, building and items dictionary and as an example the iron ingots key in "items" was named "Desc_IronIngot_C", in recipes "Recipe_IngotIron_C" and the ingredients contained in each recipes were named after items keys.

So instead of fetching the values by key, I'd have to iterate through the dictionary and compare with the "slug" value to find it.

What is that original file ? Could I see it ?

greeny commented 4 years ago

Original file should be in your game installation, it's called Docs.json and it is in CommunityResources folder.

Desc are for items and Recipe are for recipes. If you want e.g. a recipe for Iron Ingot, you need to iterate through all recipes anyway, since there are alternate recipes, so it doesn't make sense to index the recipe dictionary by item keys. It is indexed by recipe keys because in the future I may be able to list which recipe is unlocked by what.

BayDragon42 commented 4 years ago

Oh it was just there ^^

Well data format depends mostly on the needs, you have my thanks.

I'm closing the issue, I have a data file to parse now :)