-
Notifications
You must be signed in to change notification settings - Fork 4
/
control.lua
192 lines (164 loc) · 7.15 KB
/
control.lua
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
--
-- Created by IntelliJ IDEA.
-- User: heyqule
-- Date: 12/17/2020
-- Time: 11:29 AM
-- To change this template use File | Settings | File Templates.
--
require('__stdlib__/stdlib/utils/defines/time')
require('util')
require('global')
require('testcase')
local LevelProcessor = require('__enemyracemanager__/lib/level_processor')
local ForceHelper = require('__enemyracemanager__/lib/helper/force_helper')
local BaseBuildProcessor = require('__enemyracemanager__/lib/base_build_processor')
local AttackMeterProcessor = require('__enemyracemanager__/lib/attack_meter_processor')
local AttackGroupBeaconProcessor = require('__enemyracemanager__/lib/attack_group_beacon_processor')
local AttackGroupProcessor = require('__enemyracemanager__/lib/attack_group_processor')
local AttackGroupPathingProcessor = require('__enemyracemanager__/lib/attack_group_pathing_processor')
local AttackGroupHeatProcessor = require('__enemyracemanager__/lib/attack_group_heat_processor')
local ArmyTeleportationProcessor = require('__enemyracemanager__/lib/army_teleportation_processor')
local BossProcessor = require('__enemyracemanager__/lib/boss_processor')
local BossGroupProcessor = require('__enemyracemanager__/lib/boss_group_processor')
local BossAttackProcessor = require('__enemyracemanager__/lib/boss_attack_processor')
local BossRewardProcessor = require('__enemyracemanager__/lib/boss_reward_processor')
local InterplanetaryAttacks = require('__enemyracemanager__/lib/interplanetary_attacks')
require('prototypes/compatibility/controls')
local RemoteApi = require('__enemyracemanager__/lib/remote_api')
remote.add_interface("enemyracemanager", RemoteApi)
local DebugRemoteApi = require('__enemyracemanager__/lib/debug_remote_api')
remote.add_interface("enemyracemanager_debug", DebugRemoteApi)
-- Register Cron Functions
cron_switch = {
-- AttackGroupProcessor
['AttackGroupProcessor.add_to_group'] = function(args)
AttackGroupProcessor.add_to_group_cron(args)
end,
['AttackGroupProcessor.generate_group'] = function(args)
AttackGroupProcessor.generate_group(unpack(args))
end,
['AttackGroupProcessor.spawn_scout'] = function(args)
AttackGroupProcessor.spawn_scout(unpack(args))
end,
['AttackGroupProcessor.clear_invalid_erm_unit_groups'] = function(args)
AttackGroupProcessor.clear_invalid_erm_unit_groups()
end,
['AttackGroupProcessor.clear_invalid_scout_unit_name'] = function(args)
AttackGroupProcessor.clear_invalid_scout_unit_name()
end,
-- AttackMeterProcessor
['AttackMeterProcessor.calculate_points'] = function(args)
AttackMeterProcessor.calculate_points(unpack(args))
end,
['AttackMeterProcessor.form_group'] = function(args)
AttackMeterProcessor.form_group(unpack(args))
end,
-- AttackGroupPathingProcessor
['AttackGroupPathingProcessor.construct_side_attack_commands'] = function(args)
AttackGroupPathingProcessor.construct_side_attack_commands(unpack(args))
end,
['AttackGroupPathingProcessor.construct_brutal_force_commands'] = function(args)
AttackGroupPathingProcessor.construct_brutal_force_commands(unpack(args))
end,
['AttackGroupPathingProcessor.remove_old_nodes'] = function(args)
AttackGroupPathingProcessor.remove_old_nodes()
end,
--AttackGroupHeatProcessor
['AttackGroupHeatProcessor.aggregate_heat'] = function(args)
AttackGroupHeatProcessor.aggregate_heat(unpack(args))
end,
['AttackGroupHeatProcessor.cooldown_heat'] = function(args)
AttackGroupHeatProcessor.cooldown_heat(unpack(args))
end,
--AttackGroupBeaconProcessor
['AttackGroupBeaconProcessor.start_scout_scan'] = function(args)
AttackGroupBeaconProcessor.start_scout_scan()
end,
['AttackGroupBeaconProcessor.scout_scan'] = function(args)
AttackGroupBeaconProcessor.scout_scan(unpack(args))
end,
--ArmyTeleportationProcessor
['ArmyTeleportationProcessor.teleport'] = function(args)
ArmyTeleportationProcessor.teleport(unpack(args))
end,
['ArmyTeleportationProcessor.scan_units'] = function(args)
ArmyTeleportationProcessor.scan_units()
end,
--BaseBuildProcessor
['BaseBuildProcessor.build'] = function(args)
BaseBuildProcessor.build(unpack(args))
end,
-- BossProcessor
['BossProcessor.check_pathing'] = function(args)
BossProcessor.check_pathing()
end,
['BossProcessor.heartbeat'] = function(args)
BossProcessor.heartbeat()
end,
['BossProcessor.units_spawn'] = function(args)
BossProcessor.units_spawn()
end,
['BossProcessor.support_structures_spawn'] = function(args)
BossProcessor.support_structures_spawn()
end,
['BossProcessor.remove_boss_groups'] = function(args)
BossProcessor.remove_boss_groups(unpack(args))
end,
--BossAttackProcessor
['BossAttackProcessor.process_attack'] = function(args)
BossAttackProcessor.process_attack(unpack(args))
end,
--BossGroupProcessor
['BossGroupProcessor.generate_units'] = function(args)
BossGroupProcessor.generate_units(unpack(args))
end,
['BossGroupProcessor.process_attack_groups'] = function(args)
BossGroupProcessor.process_attack_groups()
end,
-- BossRewardProcessor
['BossRewardProcessor.clean_up'] = function(args)
BossRewardProcessor.clean_up()
end,
--ForceHelper
['ForceHelper.refresh_all_enemy_forces'] = function(args)
ForceHelper.refresh_all_enemy_forces()
end,
['InterplanetaryAttacks.queue_scan'] = function(args)
InterplanetaryAttacks.queue_scan()
end,
['InterplanetaryAttacks.scan'] = function(args)
InterplanetaryAttacks.scan(unpack(args))
end,
--LevelProcessor
['LevelProcessor.calculate_multiple_levels'] = function(args)
LevelProcessor.calculate_multiple_levels()
end,
}
require('__enemyracemanager__/controllers/initializer')
require('__enemyracemanager__/controllers/unit_control')
require('__enemyracemanager__/controllers/army_population')
require('__enemyracemanager__/controllers/army_teleportation')
require('__enemyracemanager__/controllers/army_deployment')
--- GUIs
require('__enemyracemanager__/controllers/gui')
require('__enemyracemanager__/controllers/custom-input')
--- Race Data Events
require('__enemyracemanager__/controllers/race_management')
--- Map Processing Events
require('__enemyracemanager__/controllers/map_management')
--- Attack points & group events
require('__enemyracemanager__/controllers/attack_group_management')
require('__enemyracemanager__/controllers/attack_group_beacon')
--- CRON Events
require('__enemyracemanager__/controllers/cron')
--- Script Trigger for all functions
require('__enemyracemanager__/controllers/on_script_trigger_effects')
--- On Rocket Launch Events
require('__enemyracemanager__/controllers/on_rocket_launch')
require('__enemyracemanager__/controllers/debug_events')
-- Commands
require('__enemyracemanager__/controllers/commands')
-- Compatibility
require('__enemyracemanager__/controllers/compatibility/k2')
require('__enemyracemanager__/controllers/compatibility/mining_drone')
require('__enemyracemanager__/controllers/compatibility/space_exploration')