As part of my ePDA development, I've written this.. It is still unsure wether or not it will play a role in it or not, but I thought I'd share it anyway In short, it'll import the (weird) format of .ecf, which seems to be a strange mix of json, yaml and csv And output it in json format, so that you can easier interact with it (r/w) Here's the rules it imports from Read file If blank line: ignore If line starts with # (or ' #'), interpretate as __comment If line is {, nest down If line is }, nest up If already nested down, and encounter another {, call it additionaldata#:{}, where # is incremented for each extra occurance. If line contains commas, nest down, and have the first be the index, and after :, be 'value: ', then nest up again Have the first line determine what it is. 'block id: 122' would be block_id_122:{}, 'template_name : somename', would be template_name_somename:{}, etc (from looking at the format, this seems to be how it works) I havn't written any json => ecf converter tho. So if you are going to write an ecf editor, you'll still have to do that Also note, that it is written in Javascript. It should be fairly easy to translate to another language tho (Assigning types will be a bitch tho .. Sorry! <3) Download it here: https://www.dropbox.com/sh/vut8hkqfdyrimt2/AAAoniiVz0QEempeWXkEGkn9a?dl=0 (In case you care, it's written with Jquery.. but that is 99% unneccesary.. Aswell as the visual output is unneccesary..) In case it's not obvious: This is mostly usefull for other tool-devs, to import data for all the entities, blocks, items, devices, tools & weapons, aswell as crafting recipies (in other words, all the data that the .ecf format provides), directly from the game's folders (ie. always up-to-date)* *I have not yet gotten a confirmation, if the Config_example.ecf is being actively maintained, or only there as a dummy example. -Exa
Updated the script to have more options for outputting. You can now in total -Suppress/add comments (not include them in output) -Suppress/add original line (not have it append the original line to output.. less space used) -Suppress/add the type (not have it append the type ('block_id') to output.. less space used) -Decide between having one large chunk with all block_id_#, item_id_#, or have it neatly sorted into each block_id[256], item_id[256] (see output files for examples) If you just want the basic, v1 is still availible Spoiler: Output : block_id_#, item_id_# Code: block_id_256: { belongtoline: 7 block_id: 256 name: CapacitorMS material: metal showblockname: true isaccessible: { belongtoline: 10 isaccessible: false type: bool } info: { belongtoline: 11 info: bkiGenNoFunction display: true } stacksize: 5 templateroot: DecoBlocks2 mass: { belongtoline: 14 mass: 200 type: int display: true formatter: Kilogram } energyin: { belongtoline: 15 energyin: 1 type: int display: true formatter: Watt } category: Deco Blocks blastradius: 3 blastdamage: 100 } block_id_257: { belongtoline: 20 block_id: 257 name: CockpitMS01 group: cpgCockpit showblockname: true material: metal islockable: true info: { belongtoline: 25 info: bkiCockpit display: true } stacksize: 1 category: Devices mass: { belongtoline: 28 mass: 500 type: int display: true formatter: Kilogram } energyin: { belongtoline: 29 energyin: 2 type: int display: true formatter: Watt } blastradius: 2 blastdamage: 80 } item_id_2050: { belongtoline: 4664 item_id: 2050 name: Flashlight stacksize: 1 category: Weapons/Items mass: { belongtoline: 4667 mass: 1 type: int display: false formatter: Kilogram } unlocklevel: 1 techtreenames: Tools } item_id_2051: { belongtoline: 4671 item_id: 2051 name: Pistol pickuptotoolbar: true stacksize: 1 category: Weapons/Items mass: { belongtoline: 4675 mass: 2 type: int display: false formatter: Kilogram } durability: { belongtoline: 4676 durability: 500 display: false } degradationprob: { belongtoline: 4677 degradationprob: 0.31 type: float display: false } additionaldata_0: { belongtoline: 4678 allowremote: false rof: { belongtoline: 4680 rof: 0.2 type: float display: true formatter: ROF } range: { belongtoline: 4681 range: 90 display: false } automatic: false bulletspread: { belongtoline: 4683 bulletspread: 0.2 display: false } damage: { belongtoline: 4684 damage: 42 display: true } ammocapacity: { belongtoline: 4685 ammocapacity: 10 display: true } ammotype: { belongtoline: 4686 ammotype: 50Caliber display: true } reloaddelay: { belongtoline: 4687 reloaddelay: 2.1 display: true } tracer: Weapons/Projectiles/TracerOrange1 tracerperbullet: 1 damagemultiplier_1: { belongtoline: 4690 damagemultiplier_1: 3 data: head display: DmgMultiplierHead } damagemultiplier_2: { belongtoline: 4691 damagemultiplier_2: 0.001 data: wood } damagemultiplier_3: { belongtoline: 4692 damagemultiplier_3: 0.01 data: stone } damagemultiplier_4: { belongtoline: 4693 damagemultiplier_4: 0.01 data: rock } damagemultiplier_5: { belongtoline: 4694 damagemultiplier_5: 0.01 data: dirt } damagemultiplier_6: { belongtoline: 4695 damagemultiplier_6: 0.001 data: hullarmored } damagemultiplier_7: { belongtoline: 4696 damagemultiplier_7: 0.001 data: hullcombat } } unlocklevel: 1 techtreenames: Weapons } Spoiler: Output : block_id, item_id Code: block_id: { 256: { block_id: 256 name: CapacitorMS material: metal showblockname: true isaccessible: { isaccessible: false type: bool } info: { info: bkiGenNoFunction display: true } stacksize: 5 templateroot: DecoBlocks2 mass: { mass: 200 type: int display: true formatter: Kilogram } energyin: { energyin: 1 type: int display: true formatter: Watt } category: Deco Blocks blastradius: 3 blastdamage: 100 } 257: { block_id: 257 name: CockpitMS01 group: cpgCockpit showblockname: true material: metal islockable: true info: { info: bkiCockpit display: true } stacksize: 1 category: Devices mass: { mass: 500 type: int display: true formatter: Kilogram } energyin: { energyin: 2 type: int display: true formatter: Watt } blastradius: 2 blastdamage: 80 } } item_id: { 2050: { item_id: 2050 name: Flashlight stacksize: 1 category: Weapons/Items mass: { mass: 1 type: int display: false formatter: Kilogram } unlocklevel: 1 techtreenames: Tools } 2051: { item_id: 2051 name: Pistol pickuptotoolbar: true stacksize: 1 category: Weapons/Items mass: { mass: 2 type: int display: false formatter: Kilogram } durability: { durability: 500 display: false } degradationprob: { degradationprob: 0.31 type: float display: false } additionaldata_0: { allowremote: false rof: { rof: 0.2 type: float display: true formatter: ROF } range: { range: 90 display: false } automatic: false bulletspread: { bulletspread: 0.2 display: false } damage: { damage: 42 display: true } ammocapacity: { ammocapacity: 10 display: true } ammotype: { ammotype: 50Caliber display: true } reloaddelay: { reloaddelay: 2.1 display: true } tracer: Weapons/Projectiles/TracerOrange1 tracerperbullet: 1 damagemultiplier_1: { damagemultiplier_1: 3 data: head display: DmgMultiplierHead } damagemultiplier_2: { damagemultiplier_2: 0.001 data: wood } damagemultiplier_3: { damagemultiplier_3: 0.01 data: stone } damagemultiplier_4: { damagemultiplier_4: 0.01 data: rock } damagemultiplier_5: { damagemultiplier_5: 0.01 data: dirt } damagemultiplier_6: { damagemultiplier_6: 0.001 data: hullarmored } damagemultiplier_7: { damagemultiplier_7: 0.001 data: hullcombat } } unlocklevel: 1 techtreenames: Weapons } }
In the name of performance, I introduced a little bug.. All extra text on the same line as { was not being outputted. Both v1, and v2 have been updated to include this. (So now name: xxx is properly read for instance)
In case this is relevant to anyone else using .ecf files: I've had the use-case, where I need to sort the entries into different categories (for instance, wether it's an inventory, crafter, can be unlocked, etc..). So I've made this approach to reading the file. if ref is specified, Also 'nest up', and look at these data, and treat them as if they were 'this ones' data aswell .modifier <> what triggers the appending of this (for instance, if it have %debug% in 'name', add .debug to items (items.debug)) Run through all data of config set. Try to find the corresponding key on CSV, otherwise create it. Alter the key as follows: For items -debug <> name %debug% -usuable <> if it have an additionaldata w. ROF >0 -offensive <> Category: Weapons/Items (Not really ideal.. also grabs drills, and such.. but I can't find a reliable approach, that's more specific) -stacksize <> StackSize -unlockable <> TechTreeNames (!= blank) -food <> If it have an additionaldata w. AddFood -consumable <> If it have an additionaldata w. AddHealth | AddStamina | AddFood | AddOxygen -material (used for crafting) <> from template -equippable <> PickupToToolbar: true For blocks -inventory <> Category: Devices (really bad approach.. but it seems best 'that can be done' atm) -oxygen <> info: bkiOxygen% || Group: %O2% -unlockable <> TechTreeNames (!= blank) -enterable <> Group: cpgCockpit || group: cpgPassengerSeat -spawner <> Info: bkiEntitySpawner -movement <> ThrusterForce -fuel <> Info: bkiFuel% -gravity <> Group: cpgGravity% -light <> Info: %Light% || Group: cpgFlare -stacksize <> StackSize -conservefood <> Group: cpgFridge -offensive <> WeaponItem -portal <> Group: cpgTransportation -alien <> Group: cpgAlien || Info: bkiAlien% -core <> Group: cpgCore -usuable <> IsLockable: true -crafter <> Group: cpgConstructor || Group: cpgFoodProcessor -plant <> TemplateRoot: IndoorPlants || Material: Plants || name: IndoorPlants -trigger <> Group: cpgSignal For entities -hostile <> No way to tell. Just mark them all as hostile for now <.< -interactable <> No way to tell. Name: %Trader% For templates -If exist, find created item and make .craftable -Find components and make .maaterial It is not flawless. Especially the 'enterable' and 'inventory' tags are among the less accurate, but even still, it might be helpfull. If you want to see how I've implemented it, you can refer to my ePDA tool's files (look in folder emp_assets/js/locecfhelper.js) If you have suggestions as to improve the 'targeting', please do let me know. This was the best I could come up with, that's somewhat efficient, and reliable.