-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.js
217 lines (198 loc) · 7.69 KB
/
game.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
let createGame = require("voxel-engine-stackgl");
// browserify game.js -o builtgame.js
const init = () => {
createGame({
exposeGlobal: true,
pluginLoaders: {
"voxel-artpacks": require("voxel-artpacks"),
"voxel-wireframe": require("voxel-wireframe"),
"voxel-chunkborder": require("voxel-chunkborder"),
"voxel-outline": require("voxel-outline"),
"voxel-carry": require("voxel-carry"),
"voxel-bucket": require("voxel-bucket"),
"voxel-fluid": require("voxel-fluid"),
"voxel-skyhook": require("voxel-skyhook"),
"voxel-bedrock": require("voxel-bedrock"),
"voxel-recipes": require("voxel-recipes"),
"voxel-quarry": require("voxel-quarry"),
"voxel-measure": require("voxel-measure"),
"voxel-webview": require("voxel-webview"),
"voxel-vr": require("voxel-vr"),
"voxel-workbench": require("voxel-workbench"),
"voxel-furnace": require("voxel-furnace"),
"voxel-chest": require("voxel-chest"),
"voxel-inventory-hotbar": require("voxel-inventory-hotbar"),
"voxel-inventory-crafting": require("voxel-inventory-crafting"),
"voxel-voila": require("voxel-voila"),
"voxel-health": require("voxel-health"),
"voxel-health-bar": require("voxel-health-bar"),
//'voxel-health-fall': require('voxel-health-fall'); // TODO: after https://github.com/deathcap/voxel-health-fall/issues/1
"voxel-food": require("voxel-food"),
"voxel-scriptblock": require("voxel-scriptblock"),
"voxel-sfx": require("voxel-sfx"),
"voxel-flight": require("voxel-flight"),
"voxel-gamemode": require("voxel-gamemode"),
"voxel-sprint": require("voxel-sprint"),
"voxel-decals": require("voxel-decals"),
"voxel-mine": require("voxel-mine"),
"voxel-harvest": require("voxel-harvest"),
"voxel-use": require("voxel-use"),
"voxel-reach": require("voxel-reach"),
"voxel-pickaxe": require("voxel-pickaxe"),
"voxel-hammer": require("voxel-hammer"),
"voxel-wool": require("voxel-wool"),
"voxel-pumpkin": require("voxel-pumpkin"),
"voxel-blockdata": require("voxel-blockdata"),
"voxel-glass": require("voxel-glass"),
"voxel-land": require("voxel-land"),
"voxel-flatland": require("voxel-flatland"),
"voxel-decorative": require("voxel-decorative"),
"voxel-inventory-creative": require("voxel-inventory-creative"),
//'voxel-clientmc': require('voxel-clientmc'); // TODO: after published
"voxel-console": require("voxel-console"),
"voxel-commands": require("voxel-commands"),
"voxel-drop": require("voxel-drop"),
"voxel-zen": require("voxel-zen"),
"camera-debug": require("camera-debug"),
"voxel-plugins-ui": require("voxel-plugins-ui"),
"voxel-fullscreen": require("voxel-fullscreen"),
"voxel-keys": require("voxel-keys"),
"kb-bindings-ui": require("kb-bindings-ui"),
"voxel-player": require("voxel-player"),
//"voxel-web3-login":require("./myVoxelPlugins/voxel-web3-login.js")
//"voxel-modal-dialog": require("voxel-modal-dialog"),
},
pluginOpts: {
"voxel-engine-stackgl": {
appendDocument: true,
exposeGlobal: true, // for debugging
lightsDisabled: true,
arrayTypeSize: 2, // arrayType: Uint16Array
useAtlas: true,
generateChunks: false,
chunkDistance: 2,
worldOrigin: [0, 0, 0],
controls: {
discreteFire: false,
fireRate: 100, // ms between firing
jumpTimer: 25,
},
keybindings: {
// voxel-engine defaults
W: "forward",
A: "left",
S: "backward",
D: "right",
"<up>": "forward",
"<left>": "left",
"<down>": "backward",
"<right>": "right",
"<mouse 1>": "fire",
"<mouse 3>": "firealt",
"<space>": "jump",
"<shift>": "crouch",
"<control>": "alt",
"<tab>": "sprint",
// our extras
F5: "pov",
O: "home",
E: "inventory",
L: "login",
G: "dialog",
T: "console",
"/": "console2",
".": "console3",
P: "packs",
F1: "zen",
},
},
// built-in plugins
"voxel-registry": {},
"voxel-stitch": {
artpacks: ["ProgrammerArt-ResourcePack.zip"],
},
"voxel-shader": {
//cameraFOV: 45,
//cameraFOV: 70,
cameraFOV: 90,
//cameraFOV: 110,
},
"voxel-mesher": {},
"game-shell-fps-camera": {
position: [0, -100, 0],
},
"voxel-artpacks": {},
"voxel-wireframe": {},
"voxel-chunkborder": {},
"voxel-outline": {},
"voxel-recipes": {},
"voxel-quarry": {},
"voxel-measure": {},
"voxel-webview": {},
"voxel-vr": { onDemand: true }, // has to be enabled after gl-init to replace renderer
"voxel-carry": {},
"voxel-bucket": { fluids: ["water", "lava"] },
"voxel-fluid": {},
//'voxel-virus': {materialSource: 'water', material: 'waterFlow', isWater: true}, // requires this.game.materials TODO: water
"voxel-skyhook": {},
"voxel-bedrock": {},
"voxel-blockdata": {},
"voxel-chest": {},
"voxel-workbench": {},
"voxel-furnace": {},
"voxel-pickaxe": {},
"voxel-hammer": {},
"voxel-wool": {},
"voxel-pumpkin": {},
"voxel-glass": {},
"voxel-land": {
populateTrees: true,
seed: "dkfjvbdfjkbvkddfvdfvdvdfvdfvdbjkledvedfb",
},
"voxel-flatland": { block: "bedrock", onDemand: true },
"voxel-decorative": {},
"voxel-inventory-creative": {},
//'voxel-clientmc': {url: 'ws://localhost:1234', onDemand: true}, // TODO
"voxel-console": {},
"voxel-commands": {},
"voxel-drop": {},
"voxel-zen": {},
//'voxel-player': {image: 'player.png', homePosition: [2,14,4], homeRotation: [0,0,0]}, // three.js TODO: stackgl avatar
"voxel-health": {},
"voxel-health-bar": {},
//'voxel-health-fall': {}, // requires voxel-player TODO: enable and test
"voxel-food": {},
"voxel-scriptblock": {},
"voxel-sfx": {},
"voxel-flight": { flySpeed: 0.8, onDemand: true },
"voxel-gamemode": {},
"voxel-sprint": {},
"voxel-inventory-hotbar": { inventorySize: 10, wheelEnable: true },
"voxel-inventory-crafting": {},
"voxel-reach": { reachDistance: 8 },
"voxel-decals": {},
// left-click hold to mine
"voxel-mine": {
instaMine: false,
progressTexturesPrefix: "destroy_stage_",
progressTexturesCount: 9,
},
// right-click to place block (etc.)
"voxel-use": {},
// handles 'break' event from voxel-mine (left-click hold breaks blocks), collects block and adds to inventory
"voxel-harvest": {},
"voxel-voila": {},
"voxel-fullscreen": {},
"voxel-keys": {},
// the GUI window (built-in toggle with 'H')
//'voxel-debug': {}, // heavily three.js dependent TODO: more debugging options for stackgl-based engine besides camera?
"camera-debug": {}, // TODO: port from game-shell-fps-camera
"voxel-plugins-ui": {},
"kb-bindings-ui": {},
"voxel-player": {},
//"voxel-web3-login":{}
//"voxel-modal-dialog": {}
},
});
}
init();