Skip to content

Summary: FoodTracker v1.3.0 Release Changes

Latest

Choose a tag to compare

@Boarlock Boarlock released this 01 Sep 11:26
· 14 commits to master since this release

This release represents a major architectural refactor of the nutrition tracking system. Here are the key changes:

Core Architecture Overhaul

Replaced the component system:

  • Removed CompPartialNutrition (stored single nutrition value)
  • Introduced CompFoodTracker (dual-mode nutrition tracking system)
  • Singleton state (PartialNutrition): Tracks individual meal nutrition when stack size = 1
  • Stack state (NutritionEntries list): Tracks individual nutrition values for multi-item stacks
  • Automatically initializes based on stack count during PostSpawnSetup()

Enhanced State Tracking

New IngestionState properties:

  • TraceID: Internal ID to track each ingestion event (for debugging/logging)
  • TotalNutrition: Total nutrition of entire stack being consumed
  • NutritionEntriesBefore: Captures nutritional state before eating
  • IngredientsBefore: Captures ingredients before eating
  • FoodToDestroy & DestroyFoodAfterIngestion: Deferred destruction handling
  • FoodDef, BaseDef: Better food definition tracking

Improved Nutrition Calculation

  • Replaced simple linear nutrition calculations with granular meal-by-meal tracking
  • Eating duration now based on TotalNutrition / 0.9f (scaled with new NutritionConsumptionRateMultiplier)
  • Adjusted MealCompletionThreshold from 0.995f to 0.99f (less strict)
  • Added MealQualifierThreshold (0.225f) to classify batch vs. partial foods

Unified Nutrition Application

  • ApplyNutritionToPawn() now takes IngestionState instead of just Pawn
  • Better encapsulation of nutrition correction logic
  • Removed deprecated GetRemainingNutrition() and SetRemainingNutrition() methods

New Features

1.Stack merging & splitting (MergeAndSplitPatches.cs):

  • Handles Thing.SplitOff() to properly distribute nutrition entries
  • Handles Thing.TryAbsorbStack() to merge nutrition lists
  • Converts between singleton/stack states automatically

2.Nutrition tooltip display (GetExplanationPatch.cs):

  • Inspect screen now shows multiple partial nutrition values for stacked meals
  • Lists individual meal nutrition values for single meals

3.Enhanced destruction handling (DeferredFoodDestruction.cs):

  • Defers food destruction until after ingestion completes
  • Prevents conflicts with vanilla's Thing lifecycle

4.FoodTracker meal detection:

  • New method to handle destroyed FT meals separately (HandleDestroyedFoodTrackerMeal())
  • Better distinction between vanilla foods and FT-tracked foods

Code Quality Improvements

  • Comprehensive logging with TraceID for easier debugging
  • Better validation and error messages
  • Improved handling of edge cases (partial eating, stack disruptions)
  • Cleaner separation of batch food vs. partial-creating meal logic

Removed Components

  • InspectStatOverride.cs (replaced by GetExplanationPatch.cs)
  • CompPartialNutrition.cs (replaced by CompFoodTracker.cs)
  • Project file excludes for unused/replaced files

This release focuses on robustness and precision in nutrition tracking, especially for edge cases like interrupted meals, stack operations, and merging of partial meals.

Full Changelog: v1.2.3...v1.3.0