Skip to content

Commit

Permalink
feat: add base effect to entity tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
SWeini authored and shpaass committed Jan 7, 2025
1 parent f7486fa commit ae1bec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Yafc/Widgets/ObjectTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,15 @@ private void BuildEntity(Entity entity, Quality quality, ImGui gui) {
gui.BuildText(DataUtils.FormatAmount(crafter.CraftingSpeed(quality), UnitOfMeasure.Percent, "Crafting speed: "));
}

float productivity = crafter.effectReceiver?.baseEffect.productivity ?? 0;
if (productivity != 0f) {
gui.BuildText(DataUtils.FormatAmount(productivity, UnitOfMeasure.Percent, "Crafting productivity: "));
Effect baseEffect = crafter.effectReceiver.baseEffect;
if (baseEffect.speed != 0f) {
gui.BuildText(DataUtils.FormatAmount(baseEffect.speed, UnitOfMeasure.Percent, "Crafting speed: "));
}
if (baseEffect.productivity != 0f) {
gui.BuildText(DataUtils.FormatAmount(baseEffect.productivity, UnitOfMeasure.Percent, "Crafting productivity: "));
}
if (baseEffect.consumption != 0f) {
gui.BuildText(DataUtils.FormatAmount(baseEffect.consumption, UnitOfMeasure.Percent, "Energy consumption: "));
}

if (crafter.allowedEffects != AllowedEffects.None) {
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
----------------------------------------------------------------------------------------------------------------------
Version:
Date:
Features:
- Apply productivity, speed, and consumption effects to recipes, and show them in tooltips.
Fixes:
- Building emission/absorption (pollution and spores) are displayed in tooltips again.
----------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit ae1bec3

Please sign in to comment.