/
main.ts
51 lines (46 loc) · 1.63 KB
/
main.ts
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
//
// ___________________________________________________________
//
// _____ _ _ _______ ______ _______ _____ __ _ ______
// | | \ / |______ |_____/ | | | | | \ | | \
// |_____| \/ |______ | \_ | | | __|__ | \_| |_____/
//
// _______________________ Screeps AI ________________________
//
//
// Overmind repository: github.com/bencbartlett/overmind
//
'use strict';
// Import global settings and prototypes
import './globals';
import './settings/settings_user';
import './prototypes/prototypes_Creep';
import './prototypes/prototypes_Flag';
import './prototypes/prototypes_RoomObject';
import './prototypes/prototypes_RoomPosition';
import './prototypes/prototypes_RoomVisual';
import './prototypes/prototypes_Room';
import './prototypes/prototypes_Structures';
// Configuration, logging, and profiling
import {log} from './lib/logger/log';
import * as Profiler from 'lib/Profiler';
import {taskInstantiator} from './maps/map_tasks';
import {sandbox} from './sandbox/sandbox';
import {Mem} from './memcheck';
import OM from './Overmind';
import {Commands} from './commands';
// Execute this every global reset
global.log = log;
global.Profiler = Profiler.init();
global.taskFromPrototask = taskInstantiator;
Mem.format();
Commands.init();
// Main loop
export function loop(): void {
Mem.clean(); // Clean memory
global.Overmind = new OM(); // Instantiate the Overmind
Overmind.build(); // Build phase: instantiate caches and colony components
Overmind.init(); // Init phase: spawning and energy requests
Overmind.run(); // Run phase: execute state-changing actions
sandbox(); // Sandbox: run any testing code
}