Thanks guys, I am actually looking at Cafe mod. I liked it but I didn’t like the thirst and the abundant food types.
I also just saw the observer thingy lol. I am not good at this at all.
Edit: I got the buff to work through potions but can’t get it to work through eating lol. (Tested through potions just to make sure the buff worked. Prob something with the Observer.
Courtesy of [MOD] Stonehearth Cafe (Cooking And Farming Expansion) 1.92
Foodbuff_Observer
local FoodBuffObserver = class()
–Called first every time
function FoodBuffObserver:initialize()
– list all the saved variables
self._sv.entity = nil
end
–Called once on creation
function FoodBuffObserver:create(entity)
self._sv.entity = entity
end
–Always called. If restore, called after restore.
function FoodBuffObserver:activate()
–Wait for eat event.
self._entity = self._sv.entity
self._eat_listener = radiant.events.listen(self._entity, ‘stonehearth:eat_food’, self, self._on_eat)
end
function FoodBuffObserver:_on_eat(e)
– Check the food’s entity data
local food_data = radiant.entities.get_entity_data(e.food_uri, ‘stonehearth:food’)
if not food_data then
return
end
-- Check if there's a buff attached to it
local food_buff = food_data.buff_uri
-- If it is, give it to the worker
if food_buff then
radiant.entities.add_buff(self._entity, food_buff)
end
end
function FoodBuffObserver:destroy()
if self._eat_listener then
self._eat_listener:destroy()
self._eat_listener = nil
end
end
return FoodBuffObserver