mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
Resource editor - ability to add bonus if no bonuses
This commit is contained in:
parent
4c1609459c
commit
f49dd657b5
2 changed files with 10 additions and 6 deletions
|
|
@ -294,9 +294,9 @@ function toggleBurgLock(burg) {
|
|||
function showBurgLockTip(burg) {
|
||||
const b = pack.burgs[burg];
|
||||
if (b.lock) {
|
||||
tip('Click to Unlock burg and allow it to be change by regeneration tools');
|
||||
tip('Click to unlock burg and allow it to be change by regeneration tools');
|
||||
} else {
|
||||
tip('Click to Lock burg and prevent changes by regeneration tools');
|
||||
tip('Click to lock burg and prevent changes by regeneration tools');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,9 +70,13 @@ function editResources() {
|
|||
for (const r of pack.resources) {
|
||||
const stroke = Resources.getStroke(r.color);
|
||||
const model = r.model.replaceAll('_', ' ');
|
||||
const bonusArray = Object.entries(r.bonus).map(e => Array(e[1]).fill(e[0])).flat(); //prettier-ignore
|
||||
const bonusArray = Object.entries(r.bonus)
|
||||
.map((e) => Array(e[1]).fill(e[0]))
|
||||
.flat();
|
||||
const bonusHTML = bonusArray.map((bonus) => getBonusIcon(bonus)).join('');
|
||||
const bonusString = Object.entries(r.bonus).map((e) => e.join(': ')).join('; '); //prettier-ignore
|
||||
const bonusString = Object.entries(r.bonus)
|
||||
.map((e) => e.join(': '))
|
||||
.join('; ');
|
||||
|
||||
lines += `<div class="states resources"
|
||||
data-id=${r.i} data-name="${r.name}" data-color="${r.color}"
|
||||
|
|
@ -89,7 +93,7 @@ function editResources() {
|
|||
|
||||
<div data-tip="Resource spread model. Click to change" class="resourceModel hide" ${addTitle(model, 8)}">${model}</div>
|
||||
<input data-tip="Resource basic value. Click and type to change" class="resourceValue hide" value="${r.value}" type="number" min=0 max=100 step=1 />
|
||||
<div data-tip="Resource bonus. Click to change" class="resourceBonus hide" title="${bonusString}">${bonusHTML}</div>
|
||||
<div data-tip="Resource bonus. Click to change" class="resourceBonus hide" title="${bonusString}">${bonusHTML || "<span style='opacity:0'>place</span>"}</div>
|
||||
|
||||
<span data-tip="Toogle resource exclusive visibility (pin)" class="icon-pin inactive hide"></span>
|
||||
<span data-tip="Remove resource" class="icon-trash-empty hide"></span>
|
||||
|
|
@ -285,7 +289,7 @@ function editResources() {
|
|||
const bonusString = Object.entries(bonusObj).map((e) => e.join(': ')).join('; '); //prettier-ignore
|
||||
|
||||
resource.bonus = bonusObj;
|
||||
el.innerHTML = bonusHTML;
|
||||
el.innerHTML = bonusHTML || "<span style='opacity:0'>place</span>";
|
||||
line.dataset.bonus = bonusString;
|
||||
el.setAttribute('title', bonusString);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue