data.raw - I dumped it to text file

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

data.raw - I dumped it to text file

Post by aubergine18 »

I've dumped data.raw to a text file which is now on github - thought I'd share in case it's of use to anyone.

I wanted to know what the full structure of data.raw looked like, and being able to quickly search for something (using browsers' text search feature) helps save time.

Anyway, here's the link: https://raw.githubusercontent.com/auber ... r/data.raw
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: data.raw - I dumped it to text file

Post by Nexela »

Might look prettier if you disable comments serpent.block(data.raw, {comment=false})
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

Nexela wrote:Might look prettier if you disable comments serpent.block(data.raw, {comment=false})
Yup, was thinking that myself. Will get an updated version posted at same URL some time later today.

EDIT: Done :)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
hoho
Filter Inserter
Filter Inserter
Posts: 684
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Re: data.raw - I dumped it to text file

Post by hoho »

Would be nice if you'd make it into a downloadable mod. Having data.raw dump for vanilla game is useful but it would be even more useful if people could create it for their modded environment.

for example, I try to add stuff to Science Cost Tweaker and I have to look up names of items. Instead of having to do a search from both mods folder and the game data folder I could just search in a single text file if I could dump it all.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: data.raw - I dumped it to text file

Post by Nexela »

You can use this. https://mods.factorio.com/mods/sparr/expose-data-raw

Or just create a data.final.fixes file in any mod that contains this

Code: Select all

log(serpent.block(data.raw, {comment=false, sparse=true}))
the output will be inside your factorio_current log
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

hoho wrote:Would be nice if you'd make it into a downloadable mod. Having data.raw dump for vanilla game is useful but it would be even more useful if people could create it for their modded environment.

for example, I try to add stuff to Science Cost Tweaker and I have to look up names of items. Instead of having to do a search from both mods folder and the game data folder I could just search in a single text file if I could dump it all.
The problem with putting a data.raw in to a mod is that it will just be a snapshot of what data.raw looks like for me, at a specific time with specific game version and mods, and it won't contain any of the stuff from mods active in the current game for the current player/server. You'll still need to do what you're currently doing, because the data can change from game to game depending on multiple factors.

The reason I dumped it to file and put it on github was to just have a quickly searchable (via browser page search feature) file with all the vanilla stuff in. It saves me having to hunt through different lua files in base and core mods.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3733
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: data.raw - I dumped it to text file

Post by DaveMcW »

Can you round the numbers to 10 decimal places? It kind of hard to read with .99999 and .00001 everywhere.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

Serpent accepts custom formatters so yes, probably. I'll take a look and see what I can do.

EDIT: So I tried writing a `custom` formatter for Serpent only to realise it's not called per property but instead seems to be called once for the entire dump. *sigh*
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: data.raw - I dumped it to text file

Post by Nexela »

serpent does have this:
numformat (string; "%.17g") -- specify format for numeric values (shortest possible round-trippable double)
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

Nexela wrote:serpent does have this:
numformat (string; "%.17g") -- specify format for numeric values (shortest possible round-trippable double)
Doh! How did I miss that?! Trying it now and will upload the results if better.

EDIT: It worked! File is much easier to read now! New version uploaded to github :)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3733
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: data.raw - I dumped it to text file

Post by DaveMcW »

Now it has a bunch of 1e+02 and similar.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

DaveMcW wrote:Now it has a bunch of 1e+02 and similar.
Fixed :)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3733
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: data.raw - I dumped it to text file

Post by DaveMcW »

Search for "e+", not everything is fixed. ;)
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: data.raw - I dumped it to text file

Post by aubergine18 »

DaveMcW wrote:Search for "e+", not everything is fixed. ;)
Gah! Ok, new version uploaded which as far as I can tell has all numbers formatted reasonably :)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3733
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: data.raw - I dumped it to text file

Post by DaveMcW »

Looks great, thanks! :D
Post Reply

Return to “Modding discussion”