sguest / factorio-types

Typescript declarations for the factorio mod API
MIT License
7 stars 3 forks source link

Make a small example to learn how to use factorio-types #7

Closed SirMishaa closed 3 years ago

SirMishaa commented 3 years ago

Hello, your work seem to be amazing !

But can you make a short example to see how to make a mod using your types ? I guess, I've to use Typescirpt to lua ?

SirMishaa commented 3 years ago

And are the types up to date for version 1.0 of Factorio?

sguest commented 3 years ago

I'll be honest this project hasn't been a huge priority for me lately. I was going to try making some actual mods based on this typing information but then lost inspiration as far as what actual mod to make, so while the types in this repo are correct in theory, they haven't really been tested by actual use.

If you want to see a sample usage, I have this repository where I took the basic "fire armor" sample mod from the Factorio wiki and wrote it using typescript. There's not much there, but it does have the toolchain set up and functional (you're correct it uses Typescript to lua).

As far as versions go, yes it is up to date for Factorio 1.0, however there have been some post-1.0 changes that aren't included. I'll go take a look and see how much effort it's going to be to add those.

sguest commented 3 years ago

Oh, the exception to being up to date with 1.0 is the prototypes file. As mentioned in the comment at the top of the file that is only up-to-date as of version 0.17.x because the prototypes overview page on the wiki which is where that data is being scraped from hasn't been updated since.

sguest commented 3 years ago

I've gone through the changelog and incorporated everything up to 1.1.6, the latest version at this time (with the exception of the prototypes as mentioned above). I've also linked to the sample fire armor repo as an example for setting up the toolchain.