typed-factorio 3.0.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -28,7 +28,7 @@ Example:
28
28
  ```
29
29
 
30
30
  The stages used will select the global variables defined.
31
- You can include multiple stages, but there are some caveats. See [Using multiple stages in the same project](#using-multiple-stages-in-the-same-project) for more info.
31
+ You can include multiple stages, but there are some caveats. See [Using multiple stages in the same project](#using-multiple-loading-stages-in-the-same-project) for more info.
32
32
 
33
33
  ## Usage notes
34
34
 
@@ -124,17 +124,19 @@ To add types for multiple Factorio stages, you have a few options:
124
124
  2. Add _only_ the runtime stage, then manually declare other global variables in files that use them. There are types in `"factorio:common"` to allow this:
125
125
  ```ts
126
126
  // -- For the prototype stage --
127
- import { PrototypeData, ActiveMods } from "factorio:common"
127
+ import { PrototypeData, ActiveMods, FeatureFlags } from "factorio:common"
128
128
  declare const data: PrototypeData
129
129
  declare const mods: ActiveMods
130
+ declare const feature_flags: FeatureFlags
130
131
  // The `settings` global variable is already declared in the runtime stage.
131
132
  // However, in the prototype stage _only_ `settings.startup` are available.
132
133
  ```
133
134
  ```ts
134
135
  // -- For the settings stage --
135
- import { SettingsData, ActiveMods } from "factorio:common"
136
+ import { SettingsData, ActiveMods, FeatureFlags } from "factorio:common"
136
137
  declare const data: SettingsData
137
138
  declare const mods: ActiveMods
139
+ declare const feature_flags: FeatureFlags
138
140
  ```
139
141
  3. Use a separate `tsconfig.json` for each stage. In each `tsconfig.json`, add only files in that stage to the `"include"` field, e.g. `include: ["src/control.ts"]` for the runtime stage. However, this means you need to run `tstl` separately for each stage, and files shared by multiple stages will be compiled multiple times.
140
142
 
@@ -13,3 +13,11 @@ declare const data: import("factorio:common").DataGlobal
13
13
  * In the runtime stage, use `script.active_mods`.
14
14
  */
15
15
  declare const mods: import("factorio:common").ActiveMods
16
+
17
+ /**
18
+ * A dict of feature flags and their status.
19
+ *
20
+ * This global is only available in the settings or prototype stage.
21
+ * In the runtime stage, use `script.feature_flags`.
22
+ */
23
+ declare const feature_flags: import("factorio:common").FeatureFlags
package/common/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @noResolution */
2
2
  declare module "factorio:common" {
3
- import { ModSetting } from "factorio:runtime"
3
+ import { ModSetting, LuaBootstrap } from "factorio:runtime"
4
4
  import { Data } from "factorio:prototype"
5
5
  import { SettingsPrototypeMap } from "factorio:settings"
6
6
  /**
@@ -48,6 +48,8 @@ declare module "factorio:common" {
48
48
  readonly [modName: string]: VersionString | undefined
49
49
  }
50
50
 
51
+ export type FeatureFlags = LuaBootstrap["feature_flags"]
52
+
51
53
  /**
52
54
  * Represents the `data` global variable for the prototype stage.
53
55
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Featureful typescript definitions for the Factorio modding api.",
5
5
  "keywords": [
6
6
  "factorio",