Small message error when eating a food without quality

If a hearthling eats an item that hasn’t the quality tag, the game will throw an error from this piece of code: (at eat_item_action.lua)

function EatItem:_get_quality(food)
   local food_data = radiant.entities.get_entity_data(food, 'stonehearth:food', false)
   
   if not food_data then
      radiant.assert(false, 'Trying to eat a piece of food that has no entity data.')
      return -1
   end

   if not food_data.quality then
      log:warning('Food %s has no quality entry, defaulting quality to raw & bland.', radiant.entities.get_display_name(food))
   end
   return food_data.quality or 1
end

The culprit is that log:warning, which is not declared. (I guess it is a left over from tests)

2 Likes

Got it. I’m still bad about properly using our log interface. This is fixed and checked in; it should be in the next release. Thanks for the catch!

2 Likes