typed-factorio 1.4.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ // This is an auto-generated file. Do not edit directly!
2
+
3
+ /** @noSelfInFile */
4
+
5
+ /**
6
+ * `log()` can print {@link LocalisedString LocalisedStrings} to the Factorio {@linkplain https://wiki.factorio.com/Log_file log file}. This, in combination with the serpent library, makes debugging in the data stage easier because it allows the inspection of entire prototype tables. For example, printing all properties of the sulfur item prototype can be done like so: `log(serpent.block(data.raw["item"]["sulfur"]))`
7
+ * @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
8
+ */
9
+ declare function log(string: LocalisedString): void
10
+
11
+ /**
12
+ * `localised_print()` allows printing {@link LocalisedString} to stdout without polluting the Factorio {@linkplain https://wiki.factorio.com/Log_file log file}. This is primarily useful when communicating with external tools that launch Factorio as a child process.
13
+ * @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
14
+ */
15
+ declare function localised_print(string: LocalisedString): void
16
+
17
+ /**
18
+ * Factorio provides the `table_size()` function as a simple way to determine the size of tables with non-continuous keys, as the standard `#` operator does not work correctly for these. The function is a C++ implementation of the following Lua code, which is faster than doing the same in Lua:
19
+ *
20
+ * ```
21
+ * local function size(t)
22
+ * local count = 0
23
+ * for k,v in pairs(t) do
24
+ * count = count + 1
25
+ * end
26
+ * return count
27
+ * end
28
+ * ```
29
+ *
30
+ * Note that `table_size()` does not work correctly for {@link LuaCustomTable}, their size has to be determined with {@link LuaCustomTable#length LuaCustomTable::length} instead.
31
+ * @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
32
+ */
33
+ declare function table_size(table: table): uint
@@ -4,49 +4,42 @@
4
4
 
5
5
  /**
6
6
  * This is the main object, through which most of the API is accessed. It is, however, not available inside handlers registered with {@link LuaBootstrap#on_load LuaBootstrap::on_load}.
7
- *
8
- * {@link https://lua-api.factorio.com/latest/ View documentation}
7
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
9
8
  */
10
9
  declare const game: LuaGameScript
11
10
 
12
11
  /**
13
12
  * Provides an interface for registering event handlers.
14
- *
15
- * {@link https://lua-api.factorio.com/latest/ View documentation}
13
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
16
14
  */
17
15
  declare const script: LuaBootstrap
18
16
 
19
17
  /**
20
18
  * Allows inter-mod communication by way of providing a repository of interfaces that is shared by all mods.
21
- *
22
- * {@link https://lua-api.factorio.com/latest/ View documentation}
19
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
23
20
  */
24
21
  declare const remote: LuaRemote
25
22
 
26
23
  /**
27
24
  * Allows registering custom commands for the in-game console accessible via the grave key.
28
- *
29
- * {@link https://lua-api.factorio.com/latest/ View documentation}
25
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
30
26
  */
31
27
  declare const commands: LuaCommandProcessor
32
28
 
33
29
  /**
34
30
  * Allows reading the current mod settings.
35
- *
36
- * {@link https://lua-api.factorio.com/latest/ View documentation}
31
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
37
32
  */
38
33
  declare const settings: LuaSettings
39
34
 
40
35
  /**
41
36
  * Allows printing messages to the calling RCON instance if any.
42
- *
43
- * {@link https://lua-api.factorio.com/latest/ View documentation}
37
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
44
38
  */
45
39
  declare const rcon: LuaRCON
46
40
 
47
41
  /**
48
42
  * Allows rendering of geometric shapes, text and sprites in the game world.
49
- *
50
- * {@link https://lua-api.factorio.com/latest/ View documentation}
43
+ * @see {@link https://lua-api.factorio.com/latest/ Online documentation}
51
44
  */
52
45
  declare const rendering: LuaRendering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Featureful typescript definitions for the the Factorio modding lua api.",
5
5
  "keywords": [
6
6
  "factorio",
@@ -22,34 +22,36 @@
22
22
  "lint": "eslint .",
23
23
  "check": "yarn run lint && yarn run test",
24
24
  "prepublishOnly": "yarn run check",
25
- "download-latest-runtime-api": "ts-node ./scripts/downloadLatest.ts",
26
- "next-version": "yarn run download-latest-runtime-api && yarn run clean && yarn test && yarn version --minor"
25
+ "download-latest-runtime-api": "ts-node ./scripts/download-latest.ts",
26
+ "new-version-changelog": "ts-node ./scripts/new-version-changelog.ts",
27
+ "next-version": "yarn run download-latest-runtime-api && yarn run clean && yarn run check && yarn run new-version-changelog && git add . && yarn version --minor"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "lua-types": "^2.11.0",
30
- "typescript-to-lua": "^1.3.1"
31
+ "typescript-to-lua": "^1.6.1"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/jest": "^27.0.3",
34
- "@types/node": "^16.11.12",
35
- "@types/prettier": "^2.4.2",
36
- "@typescript-eslint/eslint-plugin": "^5.6.0",
37
- "@typescript-eslint/parser": "^5.6.0",
38
- "chalk": "^3.0.0",
39
- "eslint": "^8.4.1",
40
- "eslint-config-prettier": "^8.3.0",
41
- "eslint-config-standard": "^16.0.3",
42
- "eslint-import-resolver-typescript": "^2.5.0",
43
- "eslint-plugin-import": "^2.25.3",
34
+ "@types/jest": "^28.1.6",
35
+ "@types/node": "^18.6.2",
36
+ "@types/prettier": "^2.6.4",
37
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
38
+ "@typescript-eslint/parser": "^5.31.0",
39
+ "chalk": "^4.1.2",
40
+ "eslint": "^8.20.0",
41
+ "eslint-config-prettier": "^8.5.0",
42
+ "eslint-config-standard": "^17.0.0",
43
+ "eslint-import-resolver-typescript": "^3.3.0",
44
+ "eslint-plugin-import": "^2.26.0",
45
+ "eslint-plugin-n": "^15.2.4",
44
46
  "eslint-plugin-node": "^11.1.0",
45
- "eslint-plugin-prettier": "^4.0.0",
46
- "eslint-plugin-promise": "^5.2.0",
47
- "jest": "^27.4.3",
47
+ "eslint-plugin-prettier": "^4.2.1",
48
+ "eslint-plugin-promise": "^6.0.0",
49
+ "jest": "^28.1.3",
48
50
  "lua-types": "^2.11.0",
49
- "prettier": "^2.5.1",
50
- "ts-jest": "^27.1.0",
51
- "ts-node": "^10.4.0",
52
- "typescript": "4.5.2",
53
- "typescript-to-lua": "^1.3.1"
51
+ "prettier": "^2.7.1",
52
+ "ts-jest": "^28.0.7",
53
+ "ts-node": "^10.9.1",
54
+ "typescript": "^4.7.4",
55
+ "typescript-to-lua": "^1.7.1"
54
56
  }
55
57
  }
@@ -3,6 +3,7 @@
3
3
  // generated
4
4
  /// <reference path="../generated/builtin-types.d.ts" />
5
5
  /// <reference path="../generated/global-objects.d.ts" />
6
+ /// <reference path="../generated/global-functions.d.ts" />
6
7
  /// <reference path="../generated/defines.d.ts" />
7
8
  /// <reference path="../generated/events.d.ts" />
8
9
  /// <reference path="../generated/classes.d.ts" />
@@ -89,35 +89,3 @@ declare namespace serpent {
89
89
  */
90
90
  function load<T>(str: string, options?: { safe?: boolean }): LuaMultiReturn<[true, T] | [false, string]>
91
91
  }
92
-
93
- /**
94
- * This function allows to log {@link LocalisedString} to the Factorio
95
- * {@link https://wiki.factorio.com/Log_file log file}. This, in combination with serpent, makes debugging in the data
96
- * stage easier, because it allows to simply inspect entire prototype tables. For example, this allows to see all
97
- * properties of the sulfur item prototype: `log(serpent.block(data.raw["item"]["sulfur"]))`
98
- */
99
- declare function log(ls: LocalisedString): void
100
-
101
- /**
102
- * This function allows printing {@link LocalisedString}s to stdout without polluting the logfile. This is primarily
103
- * useful for communicating with external tools that launch Factorio as a child process.
104
- */
105
- declare function localised_print(ls: LocalisedString): void
106
-
107
- /**
108
- * Factorio provides the function `table_size()` as a simple way to find the size of tables with non-continuous keys,
109
- * because the standard `#` does not work correctly for these. The function is a C++-side implementation of the
110
- * following Lua code, thus it is faster than using this code in Lua:
111
- *
112
- * local function size(t)
113
- * local count = 0
114
- * for k,v in pairs(t) do
115
- * count = count + 1
116
- * end
117
- * return count
118
- * end
119
- *
120
- * Note that `table_size()` does not work correctly for {@link LuaCustomTable}s, their size has to be determined with
121
- * {@link LuaCustomTable.length LuaCustomTable::operator #} instead.
122
- */
123
- declare function table_size(tbl: table): number