-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.lua
More file actions
63 lines (54 loc) · 1.48 KB
/
init.lua
File metadata and controls
63 lines (54 loc) · 1.48 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
NOverhang = {}
NOverhang.mod_name = 'NOverhang'
--- @alias SupportedEntityType
--- | 'accumulator'
--- | 'assembling-machine'
--- | 'beacon'
--- | 'boiler'
--- | 'burner-generator'
--- | 'furnace'
--- | 'generator'
--- | 'lab'
--- | 'mining-drill'
--- | 'reactor'
--- | 'roboport'
--- | 'storage-tank'
--- @type SupportedEntityType[]
NOverhang.entity_types = {
'accumulator',
'assembling-machine',
'beacon',
'boiler',
'burner-generator',
'furnace',
'generator',
'lab',
'mining-drill',
'reactor',
'roboport',
'storage-tank'
}
--- @param entity_type SupportedEntityType
function NOverhang.process_setting_name(entity_type)
return NOverhang.mod_name..'__process-'..entity_type
end
--- @param entity_type SupportedEntityType
function NOverhang.exclude_setting_name(entity_type)
return NOverhang.mod_name..'__exclude-'..entity_type
end
--- @param entity_type SupportedEntityType
--- @return boolean
function NOverhang.should_process_entity_type(entity_type)
local setting = settings.startup[NOverhang.process_setting_name(entity_type)]
return setting and setting.value
end
--- @param entity_type SupportedEntityType
--- @return { [string]: boolean }
function NOverhang.excluded_entity_names_from_processing(entity_type)
local value = settings.startup[NOverhang.exclude_setting_name(entity_type)].value
local entity_names = {}
for name in string.gmatch(value, '%S+') do
entity_names[name] = true
end
return entity_names
end