-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate.lua
More file actions
80 lines (75 loc) · 2.27 KB
/
Copy pathstate.lua
File metadata and controls
80 lines (75 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
state = {}
-- The first player, used to request translations and take icons screenshot.
state.player = nil
state.data = {
version = script.active_mods,
flags = {
"fluidCostRatio",
"maximumFactor",
"minimumFactor",
"miningDepletion",
"miningProductivity",
"pollution",
"power",
"researchSpeed"
},
categories = {},
icons = {},
items = {},
recipes = {},
locations = {}
}
-- Optional flags to be added based on data. Record<string, true>
state.flags = {}
-- Icons to be generated during write_icons. { sprite: string, scale: number }[]
state.icons = {}
-- Qualities with level > 0 in this data. Used to generate quality info for entities.
state.abnormal_qualities = {}
-- Meta items. { item: Item, sprite: string, scale: number, proto: Entity }[]
state.items_meta = {}
-- Items used in recipes. Record<string, true>
state.items_used = {}
-- Items removed because they are not needed in the final data. Record<string, true>
state.items_removed = {}
-- Meta recipes. { recipe: Recipe, sprite: string, scale: number, localised_string: string, proto: Entity }[]
state.recipes_meta = {}
-- Recipes that can be enabled in this data set. Record<string, true>
state.recipes_enabled = {}
-- Recipes locked by technologies. Record<string, true>
state.recipes_locked = {}
-- Recipes that are specified as the fixed_recipe of a prototype. Record<string, true>
state.recipes_fixed = {}
-- Producer ids. Record<string, string[]>
state.producers = {
burner = {},
crafting = {},
resource = {},
resource_fluid = {}
}
state.machines = {
boiler = {},
lab = {},
offshore_pump = {},
silo = {}
}
-- Map of item id to item. Record<string, Item>
state.item_map = {}
-- Tick of last log message. number | nil
state.tick = nil
-- Number of entries to process per tick
state.entries_per_tick = 100
for name, quality in pairs(prototypes.quality) do
if quality.level > 0 then
state.abnormal_qualities[name] = quality
end
end
-- Intended for debugging only, should not be used in release
function state.print(message)
if not state.tick then
state.tick = game.tick
end
local ticks = game.tick - state.tick
state.tick = game.tick
state.player.print(message .. " " .. ticks)
end
return state