hide casing from picker when hidden
This commit is contained in:
parent
8515e21ea9
commit
4d6c0f990d
|
|
@ -31,6 +31,9 @@ function buildBlockPicker() {
|
|||
if (!filter.test(...tooltipDataToPlain(tooltipData))) {
|
||||
item.classList.add("hidden");
|
||||
}
|
||||
if (tooltipData.some(v => v.type === "meta" && v.casing)) {
|
||||
item.dataset.casing = "";
|
||||
}
|
||||
item.appendChild(makeAtlasImage(m.index));
|
||||
item.addEventListener("click", blockPickerClickEvent);
|
||||
grid.addItem(item);
|
||||
|
|
@ -83,6 +86,10 @@ function* getBlockTooltip(metadata) {
|
|||
if ("nuclearcraft:overhaul_sfr:casing" in data.modules) {
|
||||
hasAdditionalData = true;
|
||||
yield "Casing";
|
||||
yield {
|
||||
type: "meta",
|
||||
casing: true,
|
||||
};
|
||||
}
|
||||
|
||||
if ("nuclearcraft:overhaul_sfr:controller" in data.modules) {
|
||||
|
|
@ -114,6 +121,13 @@ function* getBlockTooltip(metadata) {
|
|||
yield "Conductor";
|
||||
}
|
||||
|
||||
if ("nuclearcraft:overhaul_sfr:neutron_source" in data.modules) {
|
||||
hasAdditionalData = true;
|
||||
const neutronSource = data.modules["nuclearcraft:overhaul_sfr:neutron_source"];
|
||||
yield "Neutron Source";
|
||||
yield `Efficiency: ${neutronSource.efficiency}`;
|
||||
}
|
||||
|
||||
if ("nuclearcraft:overhaul_sfr:moderator" in data.modules) {
|
||||
hasAdditionalData = true;
|
||||
const moderator = data.modules["nuclearcraft:overhaul_sfr:moderator"];
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ export async function loadConfiguration(event) {
|
|||
export async function processConfiguration(data) {
|
||||
emitEvent("config:process:start");
|
||||
|
||||
console.log(data);
|
||||
data = configurationDatafixer(data);
|
||||
|
||||
console.log("Configuration: ", data);
|
||||
|
||||
try {
|
||||
await buildAtlas(data);
|
||||
|
|
@ -75,3 +77,16 @@ export async function processConfiguration(data) {
|
|||
|
||||
emitEvent("config:process:end");
|
||||
}
|
||||
|
||||
export function configurationDatafixer(data, options = {}) {
|
||||
if (!options.dontSetSFRCasingForPorts) {
|
||||
for (const block of data.configuration["nuclearcraft:overhaul_sfr"].blocks) {
|
||||
if (block.modules["nuclearcraft:overhaul_sfr:port"] && !block.modules["nuclearcraft:overhaul_sfr:casing"]) {
|
||||
block.modules["nuclearcraft:overhaul_sfr:casing"] = {
|
||||
edge: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ const zoomOptions = [ 0.5, 1, 2, 3, 4, 5 ];
|
|||
const zoomDefault = 2;
|
||||
const zoomStorageKey = "zoom-size";
|
||||
|
||||
const casingStorageKey = "casing";
|
||||
const casingDefault = false; // hidden by default
|
||||
|
||||
const defaultMultiblockSize = [9, 7, 9]; // width (screen x), height (xy grids), depth (screen y)
|
||||
const defaultMultiblockType = "nuclearcraft:overhaul_sfr";
|
||||
const maxMultiblockSize = {
|
||||
|
|
@ -25,9 +28,13 @@ let multiblockType = defaultMultiblockType;
|
|||
registerLoadCallback(() => {
|
||||
listenTo("config:end", buildPlanner);
|
||||
|
||||
const casingShow = recall(casingStorageKey, casingDefault);
|
||||
document.body.dataset.casing = casingShow ? "show" : "hide";
|
||||
getElements("toggle", "planner:toggle-casing")
|
||||
.forEach(e => e.dataset.toggled = casingShow.toString());
|
||||
listenTo("planner:toggle-casing", e => {
|
||||
const planner = document.getElementById("planner");
|
||||
planner.dataset.casing = e.detail.state ? "show" : "hide";
|
||||
save(casingStorageKey, e.detail.state);
|
||||
document.body.dataset.casing = e.detail.state ? "show" : "hide";
|
||||
});
|
||||
|
||||
const zoomLevel = recall(zoomStorageKey, zoomDefault);
|
||||
|
|
@ -92,7 +99,6 @@ function buildPlanner(textures) {
|
|||
if (!Array.isArray(textures)) textures = undefined;
|
||||
|
||||
const planner = document.getElementById("planner");
|
||||
planner.dataset.casing = "hide";
|
||||
|
||||
const list = new DomList(planner);
|
||||
list.clear();
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ function createTooltipDom(id) {
|
|||
rowElem.classList.add("tooltip--item");
|
||||
break;
|
||||
|
||||
case "meta":
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn("unknown tooltip type", row);
|
||||
break;
|
||||
|
|
@ -172,6 +175,7 @@ export function tooltipDataToPlain(data) {
|
|||
if (!row.type) return [];
|
||||
if (row.text) return row.text;
|
||||
if (row.type === "item") return row.name;
|
||||
if (row.type === "meta") return [];
|
||||
return [];
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
|
|||
calc(var(--scale-factor) * var(--size-x, var(--default-size)) * 0.4);
|
||||
background-color: var(--highlight-color, #f808);
|
||||
}
|
||||
[data-casing="hide"] > * {
|
||||
[data-casing="hide"] #planner > * {
|
||||
--width-override: calc(var(--width) - 2);
|
||||
}
|
||||
[data-casing="hide"] [data-casing] {
|
||||
|
|
@ -303,7 +303,7 @@ input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
|
|||
position: static;
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: calc(var(--scale-factor) * var(--recipe-select-item-count, 4));
|
||||
max-height: calc(var(--scale-factor) * var(--default-size) * var(--recipe-select-item-count, 8));
|
||||
overflow: auto;
|
||||
z-index: 10;
|
||||
border: 1px solid var(--recipe-select-border-color, #444);
|
||||
|
|
|
|||
Loading…
Reference in New Issue