Add table dimensions to scene (defaults merged on validate)
This commit is contained in:
@@ -34,6 +34,7 @@ function validateScene(s) {
|
|||||||
for (const k of ['anchors', 'buildings', 'spawns']) {
|
for (const k of ['anchors', 'buildings', 'spawns']) {
|
||||||
if (!Array.isArray(s[k])) throw new Error(`scene.${k} must be array`);
|
if (!Array.isArray(s[k])) throw new Error(`scene.${k} must be array`);
|
||||||
}
|
}
|
||||||
|
s.table = Object.assign({ width: 120, depth: 100, offsetX: 0, offsetZ: 0, show: true }, s.table || {});
|
||||||
s.paths = Array.isArray(s.paths) ? s.paths : [];
|
s.paths = Array.isArray(s.paths) ? s.paths : [];
|
||||||
for (const pth of s.paths) {
|
for (const pth of s.paths) {
|
||||||
if (!pth.id) throw new Error('path.id required');
|
if (!pth.id) throw new Error('path.id required');
|
||||||
|
|||||||
Reference in New Issue
Block a user