-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.js
59 lines (47 loc) · 2.2 KB
/
config.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2011-2012 Kevin Reid under the terms of the MIT License as detailed
// in the accompanying file README.md or <http://opensource.org/licenses/MIT>.
// Global option structure.
(function () {
"use strict";
var Input = cubes.Input;
var PersistentCell = cubes.storage.PersistentCell;
function Config(storage, storagePrefix) {
var config = this;
function defineOption(name, type, value) {
config[name] = new PersistentCell(storage, storagePrefix + name, type, value);
}
Object.defineProperty(config, "resetAllOptions", {value: function () {
Object.keys(config).forEach(function (k) { config[k].setToDefault(); });
}});
// controls/view options
defineOption("controls", "object", Input.defaultBindings);
defineOption("pitchRelativeFlight", "boolean", false);
defineOption("fov", "number", 60);
defineOption("renderDistance", "number", 100);
defineOption("mouseTurnRate", "number", 4); // radians/second/half-screen-width
// rendering quality options
defineOption("lighting", "boolean", true);
defineOption("smoothLighting", "boolean", true);
defineOption("bumpMapping", "boolean", true);
defineOption("fsaa", "boolean", false);
defineOption("cubeParticles", "boolean", false);
defineOption("sound", "boolean", true);
// debug-ish options
defineOption("noclip", "boolean", false);
defineOption("alwaysGenerateWorld", "boolean", false);
defineOption("debugTextureAllocation", "boolean", false);
defineOption("debugForceRender", "boolean", false);
defineOption("debugPlayerCollision", "boolean", false);
// world generation options
defineOption("generate_wx", "number", 400);
defineOption("generate_wy", "number", 128);
defineOption("generate_wz", "number", 400);
defineOption("generate_shape", "string", "fill");
defineOption("generate_slope", "number", 0.9);
defineOption("generate_tileSize", "number", 16);
defineOption("generate_name", "string", "Untitled");
defineOption("generate_blockset", "string", "Default Blockset"); // TODO UI for this
defineOption("currentTopWorld", "string", "Untitled");
}
cubes.Config = Object.freeze(Config);
}());