factorio-types 1.2.54 → 1.2.56

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.
@@ -0,0 +1,167 @@
1
+ // https://github.com/wube/factorio-data/blob/master/core/lualib/util.lua
2
+ declare module "util" {
3
+ export const table: {
4
+ deepcopy<T>(this: void, value: T): T;
5
+ compare(this: void, table1: object | [], table2: object | []): boolean;
6
+ }
7
+
8
+ export function copy<T>(this: void, value: T): T;
9
+
10
+ export function distance(this: void, position1: runtime.MapPosition, position2: runtime.MapPosition): number;
11
+
12
+ export function positiontostr(this: void, pos: runtime.MapPosition): string;
13
+
14
+ export function formattime(this: void, ticks: number): string;
15
+
16
+ /** supports 'rrggbb', 'rgb', 'rrggbbaa', 'rgba', 'ww', 'w' */
17
+ export function color(this: void, hex: string): runtime.Color;
18
+
19
+ export function premul_color(this: void, color: runtime.Color): runtime.Color;
20
+
21
+ export function mix_color(this: void, c1: runtime.Color, c2: runtime.Color): runtime.Color;
22
+
23
+ export function multiply_color(this: void, c1: runtime.Color, n?: number): runtime.Color;
24
+
25
+ export function get_color_with_alpha(this: void, color: runtime.Color, alpha: number, normalized_alpha: number): runtime.Color;
26
+
27
+ export const direction_vectors: Record<defines.direction, runtime.MapPosition>;
28
+
29
+ export function moveposition(this: void, position: runtime.MapPosition, direction: defines.direction, distance: number): runtime.MapPosition;
30
+
31
+ /** orientation of 1 = 360 degrees */
32
+ export function rotate_position(this: void, position: runtime.MapPosition, orientation: number): runtime.MapPosition;
33
+
34
+ export function oppositedirection(this: void, direction: defines.direction): defines.direction;
35
+
36
+ export function multiplystripes<T>(this: void, count: number, stripes: T[]): T[];
37
+
38
+ export function by_pixel(this: void, x: number, y: number): { x: number, y: number }
39
+
40
+ export function by_pixel_hr(this: void, x: number, y: number): { x: number, y: number }
41
+
42
+ export function foreach_sprite_definition<T>(this: void, table_: T, fun_: (table: T) => void): T
43
+
44
+ export function add_shift<T>(this: void, a: [T, T], b: [T, T]): [T, T];
45
+
46
+ export function add_shift_offset<T>(this: void, offset_: [T, T], table_: [T, T]): [T, T];
47
+
48
+ export function mul_shift(this: void, shift: runtime.MapPosition, scale: number): runtime.MapPosition;
49
+
50
+ export function format_number(this: void, amount: number, append_suffix: boolean): string;
51
+
52
+ export function increment(this: void, t: number[], k: number, v: number): void;
53
+
54
+ export function conditional_return<T>(this: void, value: bool, data: T): T | false;
55
+
56
+ /**
57
+ * Recursively merges and/or deep-copies tables.
58
+ * Entries in later tables override entries in earlier ones, unless
59
+ * both entries are themselves tables, in which case they are recursively merged.
60
+ * Non-merged tables are deep-copies, so that the result is brand new.
61
+ */
62
+ export function merge(this: void, tables: object[]): object;
63
+
64
+ export function insert_safe(this: void, entity: runtime.LuaEntity, item_dict: Record<string, number>): void;
65
+
66
+ export function remove_safe(this: void, entity: runtime.LuaEntity, item_dict: Record<string, number>): void;
67
+
68
+ export function split_whitespace(this: void, string: string): string[];
69
+
70
+ export function split(this: void, inputstr: string, sep: string): string[];
71
+
72
+ export function string_starts_with(this: void, str: string, start: string): boolean;
73
+
74
+ export function string_replace(this: void, str: string, what: string, _with: string): string;
75
+
76
+ export function clamp(this: void, x: number, lower: number, upper: number): number;
77
+
78
+ export function get_walkable_tile(this: void): string;
79
+
80
+ /**
81
+ * This function takes 2 icons tables, and adds the second to the first, but applies scale, shift and tint to the entire second set.
82
+ * This allows you to manulipate the entire second icons table in the same way as you would manipulate a single icon when adding to the icons table.
83
+ */
84
+ export function combine_icons(
85
+ this: void,
86
+ icons1: prototype.IconData[],
87
+ icons2: prototype.IconData[],
88
+ inputs: {
89
+ scale?: number,
90
+ shift?: number,
91
+ tint?: runtime.Color,
92
+ },
93
+ default_icon_size?: prototype.SpriteSizeType): prototype.IconData[]
94
+
95
+ export function technology_icon_constant_damage(this: void, technology_icon: prototype.FileName): prototype.IconData[];
96
+
97
+ export function technology_icon_constant_speed(this: void, technology_icon: prototype.FileName): prototype.IconData[];
98
+
99
+ export function technology_icon_constant_movement_speed(this: void, technology_icon: prototype.FileName): prototype.IconData[];
100
+
101
+ export function technology_icon_constant_range(this: void, technology_icon: prototype.FileName): prototype.IconData[];
102
+
103
+ export function technology_icon_constant_planet(this: void, technology_icon: prototype.FileName): prototype.IconData[];
104
+
105
+ export function technology_icon_constant_equipment(this: void, technology_icon: prototype.FileName): prototype.IconData[];
106
+
107
+ export function technology_icon_constant_followers(this: void, technology_icon: prototype.FileName): prototype.IconData[];
108
+
109
+ export function technology_icon_constant_capacity(this: void, technology_icon: prototype.FileName): prototype.IconData[];
110
+
111
+ export function technology_icon_constant_stack_size(this: void, technology_icon: prototype.FileName): prototype.IconData[];
112
+
113
+ export function technology_icon_constant_productivity(this: void, technology_icon: prototype.FileName): prototype.IconData[];
114
+
115
+ export function technology_icon_constant_recipe_productivity(this: void, technology_icon: prototype.FileName): prototype.IconData[];
116
+
117
+ export function technology_icon_constant_braking_force(this: void, technology_icon: prototype.FileName): prototype.IconData[];
118
+
119
+ export function technology_icon_constant_mining(this: void, technology_icon: prototype.FileName): prototype.IconData[];
120
+
121
+ export function parse_energy(this: void, energy: string): number;
122
+
123
+ export function product_amount(this: void, product: prototype.ProductPrototype): number;
124
+
125
+ export function empty_sprite(this: void): prototype.IconData;
126
+
127
+ export function empty_animation(this: void, animation_length: number): prototype.RotatedAnimation;
128
+
129
+ export function empty_icon(this: void): prototype.IconData;
130
+
131
+ export function draw_as_glow<T extends prototype.AnimationPrototype | prototype.SpritePrototype>(this: void, layer: T): T;
132
+
133
+ export function sprite_load(this: void, path: prototype.FileName, table: prototype.SpriteSheet): prototype.SpriteSheet;
134
+
135
+ export function spritesheets_to_pictures(this: void, spritesheets: prototype.SpriteSheet[]): prototype.SpriteSheet[];
136
+
137
+ /**
138
+ * Does not handle:
139
+ * explicit tile filters in "selection-tool" items
140
+ * ItemPrototype::place_as_tile
141
+ * TilePrototype::next_direction
142
+ * TilePrototype::transition_merges_with_tile
143
+ * general tile transitions, only removes tile names from water_tile_type_names
144
+ */
145
+ export function remove_tile_references(this: void, data: DataType, array_of_tiles_to_remove: string[]): void;
146
+
147
+ export function remove_from_list<T>(this: void, list: T[], value: T): boolean;
148
+
149
+ export function list_to_map<T extends string | number | symbol>(this: void, list: T[]): Record<T, true>;
150
+
151
+ export function normalize_recipe_product<T extends prototype.ProductPrototype>(this: void, raw_product: T): T;
152
+
153
+ export function normalize_recipe_products(this: void, recipe: prototype.RecipePrototype): prototype.ProductPrototype[];
154
+
155
+ /**
156
+ * Returns the normalized main product or nil if the recipe definition is invalid or there is no main product
157
+ */
158
+ export function get_recipe_main_product(this: void, recipe: prototype.RecipePrototype, normalized_products: prototype.ProductPrototype[]): prototype.ProductPrototype;
159
+
160
+ export function is_sprite_def(this: void, array: any): array is prototype.AnimationPrototype | prototype.SpriteParameters;
161
+
162
+ /**
163
+ * Recursively tint all sprite definitions in the given table.
164
+ * If `tint` is `false`, all tinting will be removed
165
+ */
166
+ export function recursive_tint(this: void, array: Array<prototype.AnimationPrototype | prototype.SpriteParameters>, tint: prototype.Color | false): Array<prototype.AnimationPrototype | prototype.SpriteParameters>
167
+ }
package/src/serpent.d.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  // Definition source https://github.com/sguest/factorio-types
5
5
 
6
6
  interface Serpent {
7
- dump(this: void, a: object, options: SerpentOptions): string
8
- line(this: void, a: object, options: SerpentOptions): string
9
- block(this: void, a: object, options: SerpentOptions): string
7
+ dump(this: void, a: object, options?: SerpentOptions): string
8
+ line(this: void, a: object, options?: SerpentOptions): string
9
+ block(this: void, a: object, options?: SerpentOptions): string
10
10
  load(this: void, str: string, options?: {safe?: boolean}): string
11
11
  }
12
12
 
@@ -17,6 +17,7 @@ interface SerpentOptions {
17
17
  sparse?: boolean
18
18
  compact?: boolean
19
19
  fatal?: boolean
20
+ fixradix?: boolean
20
21
  nocode?: boolean
21
22
  nohuge?: boolean
22
23
  maxlevel?: number
@@ -11,5 +11,24 @@
11
11
  "luaTarget": "JIT",
12
12
  "noImplicitSelf": true,
13
13
  "noImplicitGlobalVariables": true,
14
+ "noResolvePaths": [
15
+ "autoplace_utils",
16
+ "collision-mask-defaults",
17
+ "collision-mask-util",
18
+ "crash-site",
19
+ "data-duplicate-checker",
20
+ "event_handler",
21
+ "kill-score",
22
+ "math2d",
23
+ "math3d",
24
+ "meld",
25
+ "mod-gui",
26
+ "production-score",
27
+ "resource-autoplace",
28
+ "silo-script",
29
+ "space-finish-script",
30
+ "surface-render-parameter-effects",
31
+ "util"
32
+ ]
14
33
  },
15
34
  }