factorio-types 0.0.49 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,50 @@
1
1
  # factorio-types
2
2
 
3
- Typescript declarations for the factorio mod API. Note this library is not particularly "battle-hardened" by real use, but is here for anyone that may get value from it.
3
+ Typescript declarations for the factorio mod API.
4
4
 
5
- Install `factorio-types` from [npm](https://www.npmjs.com/package/factorio-types), but note the warning above about minimal testing.
5
+ ## Installation
6
6
 
7
- Intended to be used with [Typescript to Lua](https://github.com/TypeScriptToLua/TypeScriptToLua). This library uses some language extensions from the TSTL library, such as the `LuaMultiReturn` type to handle functions that return multiple values. Enable these extensions in your project's tsconfig as per [the docs](https://typescripttolua.github.io/docs/advanced/language-extensions/)
7
+ Install `factorio-types` from [npm](https://www.npmjs.com/package/factorio-types)
8
+
9
+ Intended to be used with [Typescript to Lua](https://github.com/TypeScriptToLua/TypeScriptToLua) (which is a peer dependency)
10
+
11
+ ## Configuration
12
+
13
+ This library includes [tsconfig.base.json](./tsconfig.base.json) in the root of the package with recommended configuration. This can be used as follows
14
+
15
+ `tsconfig.json`:
16
+
17
+ ```json
18
+ {
19
+ "extends": "factorio-types/tsconfig.base.json",
20
+ // other config like included files and output paths
21
+ }
22
+ ```
23
+
24
+ ## Examples
8
25
 
9
26
  A very minimal proof-of-concept showing basic toolchain setup can be found [Here](https://github.com/sguest/factorio-fire-armor-typescript)
27
+
28
+ ## Noise library
29
+
30
+ A note on using the `noise` library from within Factorio: Several mods (typically those that deal with terrain generation) will `require('noise')`. While this seems to work, this is not an officially documented part of the Factorio modding API and is not expressed in these types. If you want to use it, you'll want to add the following to your configuration
31
+
32
+ `tsconfig.json`:
33
+
34
+ ```json
35
+ {
36
+ "tstl": {
37
+ "noResolvePaths": ["noise"]
38
+ }
39
+ }
40
+ ```
41
+
42
+ Then, include a definition file at the root of your project
43
+
44
+ `noise.d.ts`:
45
+
46
+ ```typescript
47
+ declare module 'noise' {
48
+ // declare any functions from the noise library that you are using
49
+ }
50
+ ```