Add location position

This commit is contained in:
Misode
2019-10-03 13:22:21 +02:00
parent 0b5f9a1e27
commit 4a50bf4039
6 changed files with 50 additions and 15 deletions
+2 -2
View File
@@ -137,9 +137,9 @@
<span class="input-group-text" data-name></span>
</div>
<span class="input-group-text rounded-0 range" data-i18n="$range.min"></span>
<input type="text" class="form-control range min" value="1" onchange="updateField(this)" onfocus="this.select()">
<input type="text" class="form-control range min" onchange="updateField(this)" onfocus="this.select()">
<span class="input-group-text rounded-0 range" data-i18n="$range.max"></span>
<input type="text" class="form-control range max rounded-right" value="2" onchange="updateField(this)" onfocus="this.select()">
<input type="text" class="form-control range max rounded-right" onchange="updateField(this)" onfocus="this.select()">
</div>
<div class="input-group mt-3" data-type="boolean">
<div class="input-group-prepend">
+6 -4
View File
@@ -241,6 +241,11 @@
},
"$location": {
"position": "Position",
"$position": {
"x": "X",
"y": "Y",
"z": "Z"
},
"biome": "Biome",
"feature": "Feature",
"dimension": "Dimension"
@@ -291,8 +296,5 @@
"tabs": "Tabs",
"title": "Loot Table Generator",
"true": "True",
"unset": "Unset",
"x": "X",
"y": "Y",
"z": "Z"
"unset": "Unset"
}
+6 -4
View File
@@ -238,6 +238,11 @@
},
"$location": {
"position": "Позиция",
"$position": {
"x": "X",
"y": "Y",
"z": "Z"
},
"biome": "Биом",
"feature": "Строение",
"dimension": "Измерение"
@@ -282,8 +287,5 @@
"tabs": "Табуляция",
"title": "Генератор таблицы добычи",
"true": "Да",
"unset": "Не задано",
"x": "X",
"y": "Y",
"z": "Z"
"unset": "Не задано"
}
+6 -4
View File
@@ -237,6 +237,11 @@
},
"$location": {
"position": "位置",
"$position": {
"x": "X 坐标",
"y": "Y 坐标",
"z": "Z 坐标"
},
"biome": "生物群系",
"feature": "结构",
"dimension": "维度"
@@ -281,8 +286,5 @@
"tabs": "Tab 缩进",
"title": "战利品表生成器",
"true": "是",
"unset": "未指定",
"x": "X 坐标",
"y": "Y 坐标",
"z": "Z 坐标"
"unset": "未指定"
}
+6 -1
View File
@@ -275,6 +275,7 @@ function toggleCollapseObject(el) {
function updateField(el) {
let path = getPath(el);
console.log(path);
let $field = $(el).closest('[data-index]');
let field = path.pop();
let node = getNode(path);
@@ -330,7 +331,10 @@ function updateField(el) {
if (value.length === 0) {
value = '';
}
} else if (type === 'range' || type === 'random') {
} else if (type === 'range' || type === 'random' || type === 'boundary') {
if (type === 'boundary' && node[field] === undefined) {
node[field] = {};
}
value = getRangeValue($field, node[field]);
} else if (type === 'checkbox') {
value = $(el).prop('checked');
@@ -361,6 +365,7 @@ function updateRangeType(el) {
}
function getRangeValue($field, data) {
console.log($field, data);
if (typeof data === 'object') {
if (data.type && data.type.match(/(minecraft:)?binomial/)) {
let n = $field.find('.binomial.n').val();
+24
View File
@@ -711,6 +711,30 @@
"type": "object",
"color": "dark",
"fields": [
{
"id": "position",
"type": "object",
"translate": "$location.position",
"color": "dark",
"collapse": true,
"fields": [
{
"id": "x",
"type": "boundary",
"translate": "$location.$position.x"
},
{
"id": "y",
"type": "boundary",
"translate": "$location.$position.y"
},
{
"id": "z",
"type": "boundary",
"translate": "$location.$position.z"
}
]
},
{
"id": "biome",
"type": "enum",