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.
- package/README.md +17 -3
- package/dist/classes.d.ts +23 -8
- package/dist/concepts.d.ts +26 -5
- package/dist/datacollection.d.ts +1 -1
- package/dist/defines.d.ts +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/global.d.ts +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/prototypes.d.ts +10 -7
- package/dist/types.d.ts +12 -3
- package/index.d.ts +2 -11
- package/package.json +2 -2
- package/src/core.d.ts +9 -4
- package/src/index.d.ts +9 -0
- package/src/lualib/autoplace_utils.d.ts +32 -0
- package/src/lualib/collision-mask-defaults.d.ts +181 -0
- package/src/lualib/collision-mask-util.d.ts +23 -0
- package/src/lualib/crash-site.d.ts +35 -0
- package/src/lualib/data-duplicate-checker.d.ts +6 -0
- package/src/lualib/event_handler.d.ts +16 -0
- package/src/lualib/index.d.ts +22 -0
- package/src/lualib/kill-score.d.ts +8 -0
- package/src/lualib/math2d.d.ts +41 -0
- package/src/lualib/math3d.d.ts +64 -0
- package/src/lualib/meld.d.ts +33 -0
- package/src/lualib/mod-gui.d.ts +25 -0
- package/src/lualib/production-score.d.ts +13 -0
- package/src/lualib/resource-autoplace.d.ts +35 -0
- package/src/lualib/silo-script.d.ts +19 -0
- package/src/lualib/space-finish-script.d.ts +10 -0
- package/src/lualib/surface-render-parameter-effects.d.ts +6 -0
- package/src/lualib/util.d.ts +167 -0
- package/src/serpent.d.ts +4 -3
- package/tsconfig.base.json +19 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/collision-mask-defaults.lua
|
|
2
|
+
declare module "collision-mask-defaults" {
|
|
3
|
+
interface MaskType {
|
|
4
|
+
["agricultural-tower"]: prototype.CollisionMaskConnector,
|
|
5
|
+
["ammo-turret"]: prototype.CollisionMaskConnector,
|
|
6
|
+
["arithmetic-combinator"]: prototype.CollisionMaskConnector,
|
|
7
|
+
["artillery-turret"]: prototype.CollisionMaskConnector,
|
|
8
|
+
["assembling-machine"]: prototype.CollisionMaskConnector,
|
|
9
|
+
["asteroid-chunk"]: prototype.CollisionMaskConnector,
|
|
10
|
+
["asteroid-collector"]: prototype.CollisionMaskConnector,
|
|
11
|
+
["asteroid"]: prototype.CollisionMaskConnector,
|
|
12
|
+
["beacon"]: prototype.CollisionMaskConnector,
|
|
13
|
+
["boiler"]: prototype.CollisionMaskConnector,
|
|
14
|
+
["burner-generator"]: prototype.CollisionMaskConnector,
|
|
15
|
+
["decider-combinator"]: prototype.CollisionMaskConnector,
|
|
16
|
+
["electric-energy-interface"]: prototype.CollisionMaskConnector,
|
|
17
|
+
["electric-turret"]: prototype.CollisionMaskConnector,
|
|
18
|
+
["fluid-turret"]: prototype.CollisionMaskConnector,
|
|
19
|
+
["furnace"]: prototype.CollisionMaskConnector,
|
|
20
|
+
["generator"]: prototype.CollisionMaskConnector,
|
|
21
|
+
["heat-interface"]: prototype.CollisionMaskConnector,
|
|
22
|
+
["infinity-pipe"]: prototype.CollisionMaskConnector,
|
|
23
|
+
["inserter"]: prototype.CollisionMaskConnector,
|
|
24
|
+
["lab"]: prototype.CollisionMaskConnector,
|
|
25
|
+
["market"]: prototype.CollisionMaskConnector,
|
|
26
|
+
["mining-drill"]: prototype.CollisionMaskConnector,
|
|
27
|
+
["offshore-pump"]: prototype.CollisionMaskConnector,
|
|
28
|
+
["pipe-to-ground"]: prototype.CollisionMaskConnector,
|
|
29
|
+
["pipe"]: prototype.CollisionMaskConnector,
|
|
30
|
+
["plant"]: prototype.CollisionMaskConnector,
|
|
31
|
+
["fusion-generator"]: prototype.CollisionMaskConnector,
|
|
32
|
+
["fusion-reactor"]: prototype.CollisionMaskConnector,
|
|
33
|
+
["power-switch"]: prototype.CollisionMaskConnector,
|
|
34
|
+
["programmable-speaker"]: prototype.CollisionMaskConnector,
|
|
35
|
+
["pump"]: prototype.CollisionMaskConnector,
|
|
36
|
+
["radar"]: prototype.CollisionMaskConnector,
|
|
37
|
+
["reactor"]: prototype.CollisionMaskConnector,
|
|
38
|
+
["rocket-silo-rocket-shadow"]: prototype.CollisionMaskConnector,
|
|
39
|
+
["rocket-silo-rocket"]: prototype.CollisionMaskConnector,
|
|
40
|
+
["selector-combinator"]: prototype.CollisionMaskConnector,
|
|
41
|
+
["simple-entity-with-force"]: prototype.CollisionMaskConnector,
|
|
42
|
+
["simple-entity-with-owner"]: prototype.CollisionMaskConnector,
|
|
43
|
+
["simple-entity"]: prototype.CollisionMaskConnector,
|
|
44
|
+
["storage-tank"]: prototype.CollisionMaskConnector,
|
|
45
|
+
["thruster"]: prototype.CollisionMaskConnector,
|
|
46
|
+
["tree"]: prototype.CollisionMaskConnector,
|
|
47
|
+
["turret"]: prototype.CollisionMaskConnector,
|
|
48
|
+
["unit-spawner"]: prototype.CollisionMaskConnector,
|
|
49
|
+
["valve"]: prototype.CollisionMaskConnector,
|
|
50
|
+
["wall"]: prototype.CollisionMaskConnector,
|
|
51
|
+
["display-panel"]: prototype.CollisionMaskConnector,
|
|
52
|
+
|
|
53
|
+
["accumulator"]: prototype.CollisionMaskConnector,
|
|
54
|
+
["cargo-pod"]: prototype.CollisionMaskConnector,
|
|
55
|
+
["constant-combinator"]: prototype.CollisionMaskConnector,
|
|
56
|
+
["electric-pole"]: prototype.CollisionMaskConnector,
|
|
57
|
+
["lamp"]: prototype.CollisionMaskConnector,
|
|
58
|
+
["solar-panel"]: prototype.CollisionMaskConnector,
|
|
59
|
+
["train-stop"]: prototype.CollisionMaskConnector,
|
|
60
|
+
|
|
61
|
+
["cargo-bay"]: prototype.CollisionMaskConnector,
|
|
62
|
+
["cargo-landing-pad"]: prototype.CollisionMaskConnector,
|
|
63
|
+
["lightning-attractor"]: prototype.CollisionMaskConnector,
|
|
64
|
+
["roboport"]: prototype.CollisionMaskConnector,
|
|
65
|
+
["rocket-silo"]: prototype.CollisionMaskConnector,
|
|
66
|
+
["space-platform-hub"]: prototype.CollisionMaskConnector,
|
|
67
|
+
|
|
68
|
+
["container"]: prototype.CollisionMaskConnector,
|
|
69
|
+
["infinity-container"]: prototype.CollisionMaskConnector,
|
|
70
|
+
["linked-container"]: prototype.CollisionMaskConnector,
|
|
71
|
+
["proxy-container"]: prototype.CollisionMaskConnector,
|
|
72
|
+
["logistic-container"]: prototype.CollisionMaskConnector,
|
|
73
|
+
["temporary-container"]: prototype.CollisionMaskConnector,
|
|
74
|
+
|
|
75
|
+
["linked-belt"]: prototype.CollisionMaskConnector,
|
|
76
|
+
["loader-1x1"]: prototype.CollisionMaskConnector,
|
|
77
|
+
["loader"]: prototype.CollisionMaskConnector,
|
|
78
|
+
["splitter"]: prototype.CollisionMaskConnector,
|
|
79
|
+
["lane-splitter"]: prototype.CollisionMaskConnector,
|
|
80
|
+
["transport-belt"]: prototype.CollisionMaskConnector,
|
|
81
|
+
["underground-belt"]: prototype.CollisionMaskConnector,
|
|
82
|
+
|
|
83
|
+
["curved-rail-a"]: prototype.CollisionMaskConnector,
|
|
84
|
+
["curved-rail-b"]: prototype.CollisionMaskConnector,
|
|
85
|
+
["half-diagonal-rail"]: prototype.CollisionMaskConnector,
|
|
86
|
+
["legacy-curved-rail"]: prototype.CollisionMaskConnector,
|
|
87
|
+
["legacy-straight-rail"]: prototype.CollisionMaskConnector,
|
|
88
|
+
["straight-rail"]: prototype.CollisionMaskConnector,
|
|
89
|
+
|
|
90
|
+
["rail-ramp"]: prototype.CollisionMaskConnector,
|
|
91
|
+
["rail-ramp/allow_on_deep_oil_ocean"]: prototype.CollisionMaskConnector,
|
|
92
|
+
|
|
93
|
+
["rail-support"]: prototype.CollisionMaskConnector,
|
|
94
|
+
["rail-support/allow_on_deep_oil_ocean"]: prototype.CollisionMaskConnector,
|
|
95
|
+
|
|
96
|
+
["elevated-curved-rail-a"]: prototype.CollisionMaskConnector,
|
|
97
|
+
["elevated-curved-rail-b"]: prototype.CollisionMaskConnector,
|
|
98
|
+
["elevated-half-diagonal-rail"]: prototype.CollisionMaskConnector,
|
|
99
|
+
["elevated-straight-rail"]: prototype.CollisionMaskConnector,
|
|
100
|
+
|
|
101
|
+
["rail-chain-signal"]: prototype.CollisionMaskConnector,
|
|
102
|
+
["rail-signal"]: prototype.CollisionMaskConnector,
|
|
103
|
+
|
|
104
|
+
["rail-chain-signal/elevated"]: prototype.CollisionMaskConnector,
|
|
105
|
+
["rail-signal/elevated"]: prototype.CollisionMaskConnector,
|
|
106
|
+
|
|
107
|
+
["artillery-wagon"]: prototype.CollisionMaskConnector,
|
|
108
|
+
["infinity-cargo-wagon"]: prototype.CollisionMaskConnector,
|
|
109
|
+
["cargo-wagon"]: prototype.CollisionMaskConnector,
|
|
110
|
+
["fluid-wagon"]: prototype.CollisionMaskConnector,
|
|
111
|
+
["locomotive"]: prototype.CollisionMaskConnector,
|
|
112
|
+
|
|
113
|
+
["artillery-wagon/transition"]: prototype.CollisionMaskConnector,
|
|
114
|
+
["infinity-cargo-wagon/transition"]: prototype.CollisionMaskConnector,
|
|
115
|
+
["cargo-wagon/transition"]: prototype.CollisionMaskConnector,
|
|
116
|
+
["fluid-wagon/transition"]: prototype.CollisionMaskConnector,
|
|
117
|
+
["locomotive/transition"]: prototype.CollisionMaskConnector,
|
|
118
|
+
|
|
119
|
+
["artillery-wagon/elevated"]: prototype.CollisionMaskConnector,
|
|
120
|
+
["infinity-cargo-wagon/elevated"]: prototype.CollisionMaskConnector,
|
|
121
|
+
["cargo-wagon/elevated"]: prototype.CollisionMaskConnector,
|
|
122
|
+
["fluid-wagon/elevated"]: prototype.CollisionMaskConnector,
|
|
123
|
+
["locomotive/elevated"]: prototype.CollisionMaskConnector,
|
|
124
|
+
|
|
125
|
+
["gate"]: prototype.CollisionMaskConnector,
|
|
126
|
+
["gate/opened"]: prototype.CollisionMaskConnector,
|
|
127
|
+
|
|
128
|
+
["arrow"]: prototype.CollisionMaskConnector,
|
|
129
|
+
["artillery-flare"]: prototype.CollisionMaskConnector,
|
|
130
|
+
["artillery-projectile"]: prototype.CollisionMaskConnector,
|
|
131
|
+
["beam"]: prototype.CollisionMaskConnector,
|
|
132
|
+
["capture-robot"]: prototype.CollisionMaskConnector,
|
|
133
|
+
["character-corpse"]: prototype.CollisionMaskConnector,
|
|
134
|
+
["combat-robot"]: prototype.CollisionMaskConnector,
|
|
135
|
+
["construction-robot"]: prototype.CollisionMaskConnector,
|
|
136
|
+
["explosion"]: prototype.CollisionMaskConnector,
|
|
137
|
+
["fire"]: prototype.CollisionMaskConnector,
|
|
138
|
+
["highlight-box"]: prototype.CollisionMaskConnector,
|
|
139
|
+
["item-request-proxy"]: prototype.CollisionMaskConnector,
|
|
140
|
+
["leaf-particle"]: prototype.CollisionMaskConnector,
|
|
141
|
+
["lightning"]: prototype.CollisionMaskConnector,
|
|
142
|
+
["logistic-robot"]: prototype.CollisionMaskConnector,
|
|
143
|
+
["particle-source"]: prototype.CollisionMaskConnector,
|
|
144
|
+
["particle"]: prototype.CollisionMaskConnector,
|
|
145
|
+
["projectile"]: prototype.CollisionMaskConnector,
|
|
146
|
+
["projectile/hit"]: prototype.CollisionMaskConnector,
|
|
147
|
+
["smoke-with-trigger"]: prototype.CollisionMaskConnector,
|
|
148
|
+
["smoke"]: prototype.CollisionMaskConnector,
|
|
149
|
+
["speech-bubble"]: prototype.CollisionMaskConnector,
|
|
150
|
+
["sticker"]: prototype.CollisionMaskConnector,
|
|
151
|
+
["stream"]: prototype.CollisionMaskConnector,
|
|
152
|
+
["tile"]: prototype.CollisionMaskConnector,
|
|
153
|
+
|
|
154
|
+
["car"]: prototype.CollisionMaskConnector,
|
|
155
|
+
["character"]: prototype.CollisionMaskConnector,
|
|
156
|
+
["character/flying"]: prototype.CollisionMaskConnector,
|
|
157
|
+
["cliff"]: prototype.CollisionMaskConnector,
|
|
158
|
+
["corpse"]: prototype.CollisionMaskConnector,
|
|
159
|
+
["deconstructible-tile-proxy"]: prototype.CollisionMaskConnector,
|
|
160
|
+
["entity-ghost"]: prototype.CollisionMaskConnector,
|
|
161
|
+
["fish"]: prototype.CollisionMaskConnector,
|
|
162
|
+
["heat-pipe"]: prototype.CollisionMaskConnector,
|
|
163
|
+
["item-entity"]: prototype.CollisionMaskConnector,
|
|
164
|
+
["land-mine"]: prototype.CollisionMaskConnector,
|
|
165
|
+
["player-port"]: prototype.CollisionMaskConnector,
|
|
166
|
+
["rail-remnants"]: prototype.CollisionMaskConnector,
|
|
167
|
+
["resource"]: prototype.CollisionMaskConnector,
|
|
168
|
+
["spider-leg"]: prototype.CollisionMaskConnector,
|
|
169
|
+
["spider-unit"]: prototype.CollisionMaskConnector,
|
|
170
|
+
["spider-vehicle"]: prototype.CollisionMaskConnector,
|
|
171
|
+
["tile-ghost"]: prototype.CollisionMaskConnector,
|
|
172
|
+
["unit"]: prototype.CollisionMaskConnector,
|
|
173
|
+
["segment"]: prototype.CollisionMaskConnector,
|
|
174
|
+
["segmented-unit"]: prototype.CollisionMaskConnector,
|
|
175
|
+
["decorative"]: prototype.CollisionMaskConnector,
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const masks: MaskType;
|
|
179
|
+
|
|
180
|
+
export default masks;
|
|
181
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare module "collision-mask-util" {
|
|
2
|
+
export function get_default_mask(this: void, type: string): prototype.CollisionMaskConnector;
|
|
3
|
+
|
|
4
|
+
export function get_mask(
|
|
5
|
+
this: void,
|
|
6
|
+
entity_prototpe: { collision_mask: prototype.CollisionMaskConnector, type: string }): prototype.CollisionMaskConnector;
|
|
7
|
+
|
|
8
|
+
export function masks_collide(this: void, mask1: prototype.CollisionMaskConnector, mask2: prototype.CollisionMaskConnector): boolean;
|
|
9
|
+
|
|
10
|
+
export function masks_are_same(this: void, mask1: prototype.CollisionMaskConnector, mask2: prototype.CollisionMaskConnector): boolean;
|
|
11
|
+
|
|
12
|
+
export function collect_prototypes_with_mask(this: void, mask: prototype.CollisionMaskConnector): prototype.AnyPrototype[];
|
|
13
|
+
|
|
14
|
+
export function collect_prototypes_with_layer(this: void, layer: prototype.CollisionLayerID): prototype.AnyPrototype[];
|
|
15
|
+
|
|
16
|
+
export function collect_prototypes_colliding_with_mask(this: void, mask: prototype.CollisionMaskConnector): prototype.AnyPrototype[];
|
|
17
|
+
|
|
18
|
+
export function replace_layer_in_all_prototypes(this: void, old_name: prototype.CollisionLayerID, new_name: prototype.CollisionLayerID): void;
|
|
19
|
+
|
|
20
|
+
export function new_mask(this: void): prototype.CollisionMaskConnector;
|
|
21
|
+
|
|
22
|
+
export function migrate_from_before_1_2_0(this: void, old_mask: Record<prototype.CollisionLayerID, true>): prototype.CollisionMaskConnector;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/crash-site.lua
|
|
2
|
+
declare module "crash-site" {
|
|
3
|
+
export interface ShipPart {
|
|
4
|
+
name: string;
|
|
5
|
+
angle_deviation: number;
|
|
6
|
+
variations?: number;
|
|
7
|
+
max_distance?: number;
|
|
8
|
+
min_separation?: number;
|
|
9
|
+
fire_count?: number;
|
|
10
|
+
explosion_count?: number;
|
|
11
|
+
repeat_count?: number;
|
|
12
|
+
scale_lifetime?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function create_crash_site(
|
|
16
|
+
this: void,
|
|
17
|
+
surface: runtime.LuaSurface,
|
|
18
|
+
position: runtime.MapPosition,
|
|
19
|
+
ship_items: runtime.ItemStackIdentification[],
|
|
20
|
+
part_items: runtime.ItemStackIdentification[],
|
|
21
|
+
ship_parts: ShipPart[]): void;
|
|
22
|
+
|
|
23
|
+
export function create_cutscene(
|
|
24
|
+
this: void,
|
|
25
|
+
player: runtime.LuaPlayer,
|
|
26
|
+
goal_position: runtime.MapPosition): void
|
|
27
|
+
|
|
28
|
+
export function is_crash_site_cutscene(this: void, event: runtime.on_cutscene_waypoint_reached): boolean;
|
|
29
|
+
|
|
30
|
+
export function on_player_display_refresh(
|
|
31
|
+
this: void,
|
|
32
|
+
event: runtime.on_player_display_resolution_changed | runtime.on_player_display_scale_changed): void;
|
|
33
|
+
|
|
34
|
+
export function default_ship_parts(): ShipPart[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/data-duplicate-checker.lua
|
|
2
|
+
declare module "data-duplicate-checker" {
|
|
3
|
+
export function check_for_duplicates(this: void, prototypes: Record<string, prototype.AnyPrototype>, overwrite: prototype.AnyPrototype): void;
|
|
4
|
+
|
|
5
|
+
export function check_for_overwrites(this: void, prototypes: Record<string, prototype.AnyPrototype>, overwrite: prototype.AnyPrototype): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/event_handler.lua
|
|
2
|
+
declare module "event_handler" {
|
|
3
|
+
// Looking at the implementation of these functions, the objects seem close to LuaBootstrap as they have many of the same members
|
|
4
|
+
// on_configuration_changed, on_init, on_load, etc
|
|
5
|
+
// they also have a few additional fields not mentioned elsewhere
|
|
6
|
+
// hopefull this type is close enough
|
|
7
|
+
export type Library = Partial<runtime.LuaBootstrap> & {
|
|
8
|
+
add_remote_interface?: (this: void) => void;
|
|
9
|
+
add_commands?: (this: void) => void;
|
|
10
|
+
events: Record<string, runtime.LuaEventType>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function add_lib(this: void, lib: Library): void;
|
|
14
|
+
|
|
15
|
+
export function add_libraries(this: void, libs: Record<string, Library>): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Type definitions for Factorio modding API
|
|
2
|
+
// Factorio API reference https://lua-api.factorio.com/latest/index.html
|
|
3
|
+
// src mappings manually written to cover aspects not in the machine-readable API spec
|
|
4
|
+
// Definition source https://github.com/sguest/factorio-types
|
|
5
|
+
|
|
6
|
+
/// <reference path="./autoplace_utils.d.ts" />
|
|
7
|
+
/// <reference path="./collision-mask-defaults.d.ts" />
|
|
8
|
+
/// <reference path="./collision-mask-util.d.ts" />
|
|
9
|
+
/// <reference path="./crash-site.d.ts" />
|
|
10
|
+
/// <reference path="./data-duplicate-checker.d.ts" />
|
|
11
|
+
/// <reference path="./event_handler.d.ts" />
|
|
12
|
+
/// <reference path="./kill-score.d.ts" />
|
|
13
|
+
/// <reference path="./math2d.d.ts" />
|
|
14
|
+
/// <reference path="./math3d.d.ts" />
|
|
15
|
+
/// <reference path="./meld.d.ts" />
|
|
16
|
+
/// <reference path="./mod-gui.d.ts" />
|
|
17
|
+
/// <reference path="./production-score.d.ts" />
|
|
18
|
+
/// <reference path="./resource-autoplace.d.ts" />
|
|
19
|
+
/// <reference path="./silo-script.d.ts" />
|
|
20
|
+
/// <reference path="./space-finish-script.d.ts" />
|
|
21
|
+
/// <reference path="./surface-render-parameter-effects.d.ts" />
|
|
22
|
+
/// <reference path="./util.d.ts" />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/kill-score.lua
|
|
2
|
+
declare module "kill-score" {
|
|
3
|
+
export function generate_entity_prices(this: void, param?: { prices?: Record<string,number>, item_prices?: Record<string, number> }): Record<string, number>
|
|
4
|
+
|
|
5
|
+
export function get_kill_scores(this: void, price_list?: Record<string, number>): Record<string, number>;
|
|
6
|
+
|
|
7
|
+
export function get_default_prices(this: void): Record<string, number>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/math2d.lua
|
|
2
|
+
declare module "math2d" {
|
|
3
|
+
export const projection_constant = 0.7071067811865;
|
|
4
|
+
|
|
5
|
+
export const vector: {
|
|
6
|
+
from_orientation(this: void, orientation: number, length: number): runtime.Vector;
|
|
7
|
+
to_orientation(this: void, vec: runtime.Vector): number;
|
|
8
|
+
length(this: void, vec: runtime.Vector): number;
|
|
9
|
+
projected(this: void, vec: runtime.Vector): runtime.Vector;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const position: {
|
|
13
|
+
/**
|
|
14
|
+
* Takes a position that might be either a two element array, or a table
|
|
15
|
+
* with x and y keys, and returns a position with x and y keys.
|
|
16
|
+
*/
|
|
17
|
+
ensure_xy(this: void, pos: runtime.MapPosition): { x: number, y: number };
|
|
18
|
+
distance_squared(this: void, p1: runtime.MapPosition, p2: runtime.MapPosition): number;
|
|
19
|
+
distance(this: void, p1: runtime.MapPosition, p2: runtime.MapPosition): number;
|
|
20
|
+
rotate_vector(this: void, vector: runtime.Vector, angle_in_deg: number): runtime.Vector;
|
|
21
|
+
subtract(this: void, p1: runtime.MapPosition, p2: runtime.MapPosition): runtime.MapPosition;
|
|
22
|
+
add(this: void, p1: runtime.MapPosition, p2: runtime.MapPosition): runtime.MapPosition;
|
|
23
|
+
multiply_scalar(this: void, vec: runtime.Vector, scalar: number): runtime.Vector;
|
|
24
|
+
divide_scalar(this: void, vec: runtime.Vector, scalar: number): runtime.Vector;
|
|
25
|
+
vector_length(this: void, vec: runtime.Vector): number;
|
|
26
|
+
get_normalized(this: void, vec: runtime.Vector): runtime.Vector;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const bounding_box: {
|
|
30
|
+
/**
|
|
31
|
+
* Takes a bounding box with positions that might be either two element arrays, or tables
|
|
32
|
+
* with x and y keys, and returns a bounding box with positions with x and y keys
|
|
33
|
+
*/
|
|
34
|
+
ensure_xy(this: void, bounding_box: runtime.BoundingBox): {left_top: {x : number, y: number}, right_bottom: {x: number, y: number}};
|
|
35
|
+
get_centre(this: void, box: runtime.BoundingBox): runtime.MapPosition;
|
|
36
|
+
contains_point(this: void, box: runtime.BoundingBox, point: runtime.MapPosition): boolean;
|
|
37
|
+
contains_box(this: void, box: runtime.BoundingBox, other: runtime.BoundingBox): boolean;
|
|
38
|
+
collides_with(this: void, box1: runtime.BoundingBox, box2: runtime.BoundingBox): boolean;
|
|
39
|
+
create_from_centre(this: void, centre: runtime.MapPosition, width: number, height: number): runtime.BoundingBox;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/math3d.lua
|
|
2
|
+
|
|
3
|
+
// The Vector4 type doesn't exist at runtime so the vector4 references it from prototype instead of runtime like the rest of the file
|
|
4
|
+
// However, this is all just math and the Vector/Vector3D types are all equivalent between prototype and runtime stages
|
|
5
|
+
// Therefore this is a case where mixing and matching prototype and runtime stage members is OK
|
|
6
|
+
declare module "math3d" {
|
|
7
|
+
export const projection_constant = 0.7071067811865;
|
|
8
|
+
|
|
9
|
+
export function project_vec3(this: void, vec3: runtime.Vector3D): runtime.Vector;
|
|
10
|
+
|
|
11
|
+
export const vector4: {
|
|
12
|
+
zero: [0, 0, 0, 0];
|
|
13
|
+
dot_product(this: void, u: prototype.Vector4f, v: prototype.Vector4f): number;
|
|
14
|
+
add(this: void, u: prototype.Vector4f, v: prototype.Vector4f): prototype.Vector4f;
|
|
15
|
+
sub(this: void, u: prototype.Vector4f, v: prototype.Vector4f): prototype.Vector4f;
|
|
16
|
+
from_vec3(this: void, u: prototype.Vector3D): prototype.Vector4f;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const vector3: {
|
|
20
|
+
zero: [0, 0, 0];
|
|
21
|
+
dot_product(this: void, u: runtime.Vector3D, v: runtime.Vector3D): number;
|
|
22
|
+
add(this: void, u: runtime.Vector3D, v: runtime.Vector3D): runtime.Vector3D;
|
|
23
|
+
sub(this: void, u: runtime.Vector3D, v: runtime.Vector3D): runtime.Vector3D;
|
|
24
|
+
mul(this: void, u: runtime.Vector3D, v: runtime.Vector3D): runtime.Vector3D;
|
|
25
|
+
cross_product(this: void, u: runtime.Vector3D, v: runtime.Vector3D): runtime.Vector3D;
|
|
26
|
+
angle(this: void, u: runtime.Vector3D, v: runtime.Vector3D): number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const vector2: {
|
|
30
|
+
zero: [0, 0];
|
|
31
|
+
dot_product(this: void, u: runtime.Vector, v: runtime.Vector): number;
|
|
32
|
+
add(this: void, u: runtime.Vector, v: runtime.Vector): runtime.Vector;
|
|
33
|
+
sub(this: void, u: runtime.Vector, v: runtime.Vector): runtime.Vector;
|
|
34
|
+
mul(this: void, u: runtime.Vector, k: runtime.Vector): runtime.Vector;
|
|
35
|
+
rotate(this: void, v: runtime.Vector, phi: number): runtime.Vector;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type Matrix4x4 = [
|
|
39
|
+
[number, number, number, number],
|
|
40
|
+
[number, number, number, number],
|
|
41
|
+
[number, number, number, number],
|
|
42
|
+
[number, number, number, number],
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export const matrix4x4: {
|
|
46
|
+
identity: [
|
|
47
|
+
[1, 0, 0, 0],
|
|
48
|
+
[0, 1, 0, 0],
|
|
49
|
+
[0, 0, 1, 0],
|
|
50
|
+
[0, 0, 0, 1],
|
|
51
|
+
];
|
|
52
|
+
rotation_x(this: void, phi: number): Matrix4x4;
|
|
53
|
+
rotation_y(this: void, phi: number): Matrix4x4;
|
|
54
|
+
rotation_z(this: void, phi: number): Matrix4x4;
|
|
55
|
+
translation(this: void, x: number, y: number, z: number): Matrix4x4;
|
|
56
|
+
translation_vec3(this: void, vec3: runtime.Vector3D): Matrix4x4;
|
|
57
|
+
scale(this: void, x: number, y: number, z: number): Matrix4x4;
|
|
58
|
+
column(this: void, mat: Matrix4x4, index: number): [number, number, number, number];
|
|
59
|
+
transpose(this: void, mat: Matrix4x4): Matrix4x4;
|
|
60
|
+
mul_mat(this: void, m1: Matrix4x4, m2: Matrix4x4): Matrix4x4;
|
|
61
|
+
mul_vec3(this: void, mat: Matrix4x4, vec: runtime.Vector3D): runtime.Vector3D;
|
|
62
|
+
compose(this: void, list: Matrix4x4[]): Matrix4x4;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/meld.lua
|
|
2
|
+
|
|
3
|
+
// Lots of "any" types in this declaration - it's not immediately obvious what it's supposed to do and not many example usages in the base mod
|
|
4
|
+
declare module "meld" {
|
|
5
|
+
|
|
6
|
+
export const control_marker: {};
|
|
7
|
+
|
|
8
|
+
export const controler_handlers: {
|
|
9
|
+
delete(this: void, target: any, k: string, v: any): void;
|
|
10
|
+
overwrite(this: void, target: any, k: string, v: any): any;
|
|
11
|
+
invoke(this: void, target: any, k: string, v: any): any;
|
|
12
|
+
append(this: void, target: any, k: string, v: any): void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function _delete(this: void): void;
|
|
16
|
+
export { _delete as delete };
|
|
17
|
+
|
|
18
|
+
export function overwrite(this: void, _new: any): any;
|
|
19
|
+
|
|
20
|
+
export function invoke(this: void, fct: any): any;
|
|
21
|
+
|
|
22
|
+
export function append(this: void, data: any): any;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* recursive table merge but it reuses target table (this: void, does not deepcopy it). When target is not to be reused or more than
|
|
26
|
+
* 2 tables are to be merged, consider using util.merge. When there is conflict of 2 values, a value from the source will
|
|
27
|
+
* win overwriting the existing value. There are also control structures available for extra operations that would not
|
|
28
|
+
* be possible under normal merge rules
|
|
29
|
+
*/
|
|
30
|
+
export function meld(this: void, target: Table, source: Table): Table
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare function meld(this: Table, target: Table, source: Table): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/mod-gui.lua
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Hello script explorer, if you are looking to upgrade your mod to use the mod gui, its pretty simple.
|
|
5
|
+
|
|
6
|
+
Typically you will have something like:
|
|
7
|
+
player.gui.left.add{...}
|
|
8
|
+
|
|
9
|
+
All you will need to do, is change it to:
|
|
10
|
+
mod_gui.get_frame_flow(player).add{...}
|
|
11
|
+
|
|
12
|
+
And for buttons its just the same:
|
|
13
|
+
mod_gui.get_button_flow(player).add{...}
|
|
14
|
+
|
|
15
|
+
It should be as simple as find and replace.
|
|
16
|
+
|
|
17
|
+
Any other questions please feel free to ask on the modding help forum.
|
|
18
|
+
*/
|
|
19
|
+
declare module "mod-gui" {
|
|
20
|
+
export const button_style = "mod_gui_button";
|
|
21
|
+
export const frame_style = "non_draggable_frame"
|
|
22
|
+
|
|
23
|
+
export function get_button_flow(this: void, player: runtime.LuaPlayer): runtime.LuaGuiElement;
|
|
24
|
+
export function get_frame_flow(this: void, player: runtime.LuaPlayer): runtime.LuaGuiElement;
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare module "production-score" {
|
|
2
|
+
export function generate_price_list(this: void, param?: {
|
|
3
|
+
seed_prices?: Record<string, number>,
|
|
4
|
+
ingedient_exponent?: number,
|
|
5
|
+
raw_resource_price?: number,
|
|
6
|
+
resource_ignore?: Record<string, string>,
|
|
7
|
+
round?: (this: void, num: number) => number,
|
|
8
|
+
energy_addition?: (this: void, recipe: runtime.LuaRecipe, cost: number) => number,
|
|
9
|
+
normalise?: (this: void, num: number) => number,
|
|
10
|
+
}): Record<string, number>;
|
|
11
|
+
|
|
12
|
+
export function get_production_scores(this: void, price_list?: Record<string,number>): Record<string, number>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/resource-autoplace.lua
|
|
2
|
+
declare module "resource-autoplace" {
|
|
3
|
+
/**
|
|
4
|
+
* Indicate that a patch set exists and optionally that it also needs a separate starting patch set.
|
|
5
|
+
* Call this to initialize patch sets' indexes in a more deterministic order
|
|
6
|
+
* (see resources.lua for an example) before calling resource_autoplace_settings.
|
|
7
|
+
*/
|
|
8
|
+
export function initialize_patch_set(this: void, patch_set_name: string, has_starting_area_placement: boolean, autoplace_set_name: string): void
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates and returns an AutoplaceSpecification that will generate spot-based ore patches.
|
|
12
|
+
* @param params.name name for the type, used as the default autoplace control name and patch set name (each of which can be overridden separately)
|
|
13
|
+
* @param params.base_density amount of stuff, on average, to be placed per tile
|
|
14
|
+
* @param params.patch_set_name name of the patch set; patches sets of the same name and seed1 will overlap; default: name
|
|
15
|
+
* @param params.autoplace_control_name name of the corresponding autoplace control; default: name
|
|
16
|
+
* @param params.random_probability probability of placement at any given tile within a patch; default: 1
|
|
17
|
+
* @param params.base_spots_per_km2 number of patches per square kilometer near the starting area
|
|
18
|
+
* @param params.has_starting_area_placement true|false|nil - yes, no, and there is no special starting area, respectively
|
|
19
|
+
* @param params.seed1 random seed to use when generating patch positions; default: 100
|
|
20
|
+
*/
|
|
21
|
+
export function resource_autoplace_settings(this: void, params: {
|
|
22
|
+
name: string,
|
|
23
|
+
base_density: number,
|
|
24
|
+
patch_set_name?: string,
|
|
25
|
+
autoplace_control_name?: string,
|
|
26
|
+
random_probability?: number,
|
|
27
|
+
base_spots_per_km2?: number,
|
|
28
|
+
has_starting_area_placement?: boolean | null,
|
|
29
|
+
seed1?: number,
|
|
30
|
+
}): {
|
|
31
|
+
order: string,
|
|
32
|
+
probability_expression: string,
|
|
33
|
+
richness_expression: string,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/silo-script.lua
|
|
2
|
+
declare module "silo-script" {
|
|
3
|
+
export const events: { [defines.events.on_rocket_launched]: (this: void, event: runtime.on_rocket_launched) => void };
|
|
4
|
+
|
|
5
|
+
export function on_configuration_changed(this: void): void;
|
|
6
|
+
|
|
7
|
+
export function on_init(this: void): void;
|
|
8
|
+
|
|
9
|
+
export function on_load(this: void): void;
|
|
10
|
+
|
|
11
|
+
/** legacy */
|
|
12
|
+
export function get_events(this: void): { [defines.events.on_rocket_launched]: (this: void, event: runtime.on_rocket_launched) => void };
|
|
13
|
+
|
|
14
|
+
/** legacy */
|
|
15
|
+
export function add_remote_interface(this: void): void;
|
|
16
|
+
|
|
17
|
+
/** legacy */
|
|
18
|
+
export function add_commands(this: void): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// https://github.com/wube/factorio-data/blob/master/core/lualib/space-finish-script.lua
|
|
2
|
+
declare module "space-finish-script" {
|
|
3
|
+
export const events: { [defines.events.on_space_platform_changed_state]: (this: void, event: runtime.on_space_platform_changed_state) => void }
|
|
4
|
+
|
|
5
|
+
export function on_configuration_changed(this: void): void;
|
|
6
|
+
|
|
7
|
+
export function on_init(this: void): void;
|
|
8
|
+
|
|
9
|
+
export function on_load(this: void): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// github.com/wube/factorio-data/blob/master/core/lualib/surface-render-parameter-effects.lua
|
|
2
|
+
declare module "surface-render-parameter-effects" {
|
|
3
|
+
export function default_clouds_effect_properties(this: void): prototype.CloudsEffectProperties;
|
|
4
|
+
|
|
5
|
+
export function default_fog_effect_properties(this: void): prototype.FogEffectProperties;
|
|
6
|
+
}
|