Skip to content

Commit

Permalink
Display recipes with multiple outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
andev0 committed Aug 16, 2024
1 parent fac0342 commit 375fbc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
6 changes: 4 additions & 2 deletions dist/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ div#node-creation-modal {
background-color: #212121;
border-radius: 8px;
box-sizing: border-box;
display: flex;
gap: 4px;
}

#node-creation-modal div.recipe:hover {
Expand All @@ -309,7 +311,7 @@ div#node-creation-modal {
}

#node-creation-modal .recipe img.item-icon {
height: 100%;
width: 100%;
flex-grow: 1;
min-width: 0;
object-fit: contain;
}
36 changes: 18 additions & 18 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,18 @@ async function main()
let recipeNode = document.createElement("div");
recipeNode.classList.add("recipe");

let itemIcon = document.createElement("img");
itemIcon.classList.add("item-icon");
for (const product of recipe.products)
{
let itemIcon = document.createElement("img");
itemIcon.classList.add("item-icon");

let isEventRecipe = false;
let isEventRecipe = false;

if (recipe.products.length === 1)
{
let resource = satisfactoryData.resources.find(
// I specify type because CD fails otherwise for some reason.
// I specify type because deploy fails otherwise for some reason.
(resource: typeof satisfactoryData.resources[0]) =>
{
return resource.id == recipe.products[0].id;
return resource.id == product.id;
}
);

Expand All @@ -187,20 +187,20 @@ async function main()
itemIcon.src = `GameData/SatisfactoryIcons/${resource.iconPath}`;
isEventRecipe = resource.iconPath.startsWith("Events");
}
}

itemIcon.alt = recipe.displayName;
itemIcon.loading = "lazy";
itemIcon.alt = recipe.displayName;
itemIcon.loading = "lazy";

recipeNode.appendChild(itemIcon);
recipeNode.appendChild(itemIcon);

if (isEventRecipe)
{
eventsRecipesGroup.div.appendChild(recipeNode);
}
else
{
simpleRecipesGroup.appendChild(recipeNode);
if (isEventRecipe)
{
eventsRecipesGroup.div.appendChild(recipeNode);
}
else
{
simpleRecipesGroup.appendChild(recipeNode);
}
}
};
};
Expand Down

0 comments on commit 375fbc9

Please sign in to comment.