-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontrol.lua
More file actions
147 lines (128 loc) · 4.67 KB
/
control.lua
File metadata and controls
147 lines (128 loc) · 4.67 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
require "lib.lib"
------------------------------------------------------------
--- Globals
------------------------------------------------------------
local function set_globals()
--- player cheat bag
storage.cheat_bag = storage.cheat_bag or {}
--- GUI stuffs
storage.gui = storage.gui or {
item_watch = {},
watchdogs = {[1] = true, [2] = true, [3] = true},
count_watchdogs = 3,
count_watched_item = 0,
item_list = {},
planet_selector_enabled = false,
planet_selector_list = {}
}
--- porm gls (size + surface)
storage.platform = storage.platform or {
warp = {size = dw.platform_size.warp[1]},
factory = {size = 0, surface = nil},
mining = {size = {x=0, y=0}, surface = nil},
power = {size = 0, water = false, surface = nil},
}
-- warp informations
storage.warp = storage.warp or {
number = 0,
current = {},
previous = nil,
status = defines.warp.awaiting,
time = game.tick,
preferred_destination = nil,
}
-- timer informations
storage.timer = storage.timer or { -- timers are in seconds, not ticks
active = false,
base = 20 * 60, -- 20min
warp = nil,
manual_warp = nil,
}
-- vote and player count
storage.votes = storage.votes or {
count = 0,
players = {},
min_vote = 1,
players_count = 0,
}
-- list of teleport locations with status, and both teleporter entity (fom/to)
storage.teleporter = storage.teleporter or {
['warp-to-factory'] = {active = false},
['factory-to-warp'] = {active = false},
['mining-to-factory'] = {active = false},
['factory-to-mining'] = {active = false},
['power-to-mining'] = {active = false},
['mining-to-power'] = {active = false},
['nauvis-gate'] = {active = false},
['warp-gate-to-surface'] = {active = false},
['harvester-left-to-surface'] = {active = false},
['harvester-right-to-surface'] = {active = false},
['surface-to-warp-gate'] = {active = false},
['surface-to-harvester-left'] = {active = false},
['surface-to-harvester-right'] = {active = false},
}
-- timer check for player teleport
storage.players_last_teleport = storage.players_last_teleport or {}
-- stairs (chest/loader/pipes) between surfaces
storage.stairs = storage.stairs or {
chest_number = 2,
chest_type = {input = "dw-chest", output="dw-chest"},
loader_tier = "dw-stair-loader",
pipes_type = "dw-pipe",
chest_pairs = {},
pipe_pairs = {},
chest_loader_pairs = {gate={}, surface={}, produstia={}, smeltus={}, electria={}},
}
-- base global pollution value
storage.pollution = storage.pollution or 1
-- warp gates / harvester gate level
storage.warpgate = storage.warpgate or {
chest_number = 2,
type = "warp-gate",
mobile_chests = {},
mobile_loaders = {}
}
storage.harvesters = storage.harvesters or {
loaders = 2,
loader_tier = "harvest-linked-belt",
pipes_type = "dw-pipe",
left = {gate = nil, area = nil, size=0, loaders = {}},
right = {gate = nil, area = nil, size=0, loaders = {}}
}
storage.agricultural = storage.agricultural or {
yumako_towers = {},
jellynut_towers = {},
}
end
dw.register_event('on_init', set_globals)
dw.register_event('on_configuration_changed', set_globals)
------------------------------------------------------------
--- Warnings
------------------------------------------------------------
local function mod_warning()
if script.active_mods['Repair_Turret'] then
game.print({"dw-warning.repair-tower-mod"})
end
end
dw.register_event('on_init', mod_warning)
dw.register_event('on_configuration_changed', mod_warning)
------------------------------------------------------------
require "scripts.commands"
require "scripts.shortcuts"
require "scripts.misc"
require "scripts.surface-generation"
require "scripts.teleport"
require "scripts.gui"
require "scripts.platforms.surface"
require "scripts.platforms.dimensions"
require "scripts.platforms.harvesters"
require "scripts.scenario.freeplay"
require "scripts.scenario.lab_intro"
require "scripts.warp"
require "scripts.enemies"
require "scripts.entities.warpgate"
require "scripts.entities.rocket_silo"
require "scripts.entities.logistics"
require "scripts.entities.dimension-crane"
require "compatibility.picker-dollies"
-- require "scripts.debug"