-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
36 lines (29 loc) · 1.11 KB
/
bootstrap.js
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
!function() {
let settings = {
bootstrapCode: "",
}
function settingsApplied(values) {
settings = values;
}
function createSettingsProvider() {
let sp = new SettingsProvider(settings, settingsApplied)
let section = sp.addSection("Bootstrap");
section.addString("bootstrapCode",
"<br> Run this code when game starts. My personal favorite is turning off missile smoke particles to reduce a bit of CPU load.",
{maxLength: 200})
return sp
}
SWAM.on("gameRunning", function() {
// For some reason, settings.bootstrapCode did not work. Have to fetch directly from LocalStorage instead oTL
setTimeout(JSON.parse(localStorage.SWAM_Settings).extensions.yutru.bootstrap.bootstrapCode
, 0)
})
SWAM.registerExtension({
name: "Bootstrap",
id: "yutru.bootstrap",
description: "Runs JavaScript code snippet of your choice as soon as the game starts. Great for stuff like customizing your flag or changing game engine settings. My personal favorite is turning off missile smoke particles to reduce a bit of CPU load.",
author: "yutru",
version: "1.0.0",
settingsProvider: createSettingsProvider()
})
}()