Agriculture only counts one animal for the networth

Each sheep is worth 30 gold. I had one in this test world, and so my town networth was 30. A second sheep was added, but the networth did not increase to 60.

This is because the component is not accumulating the values, just assign it over. In this function:

function ShepherdPastureComponent:_update_score()
   local total_score = 0
   for id, animal_data in pairs(self._sv.tracked_critters) do
      --If the animal is following a shepherd, remove it from the shepherd's folloq queue
      local animal = animal_data.entity
      local networth = radiant.entities.get_entity_data(animal, 'stonehearth:net_worth')
      if networth and networth.value_in_gold then
         total_score = networth.value_in_gold
      end
   end

   stonehearth.score:change_score(self._entity, 'net_worth', 'agriculture', total_score)
end

I think the
total_score = networth.value_in_gold
should be
total_score = total_score + networth.value_in_gold

2 Likes

Unless it was meant to be by pasture instead of by animal :thinking:

@linda do you remember if this was meant to be per animal?
I wouldn’t be surprised that it’s as Bruno says, though. But if we change this now it might increase your net worth too fast when you get a shepherd (guess not that much, but we haven’t added the changes to balance combat campaigns according to military score rather than net worth yet).

The code looks like it was meant to be per animal. For a pasture only, it could be way simpler, just check if animal quantity was above 0, no need to iterate through them all.

A sheep is worth 30 gold, and a full maxed pasture can hold 25 sheep. 750 gold.
Poyo = 8 gold. Maxed pasture have 50 poyos. 400 gold.

I had only 62 agriculture before, now after changing that code I’m at almost 500. I think it will barely change the networth balance. But the new value makes much more sense, considering I’m at 31 hearthlings…

2 Likes

A fully maxed pasture for sheep will only hold 12 sheep, so 360 gold total.

A fully maxed yard for chickens will hold 25, so 200 gold total.

At least that is what the game is set to currently (if those animal prices are correct), but I haven’t checked to see if the actual amount is true in a running game. I’ve never stopped everything else until the pastures and yards are full.

Ops, I doubled the max capacity there. I got the numbers from my head. I really remembered it as being 50 max chickens…

Nope. :merry: Even the rabbits are 25 max.

Thanks for the bug report! Since this may affect net worth balance by a non-trivial amount, we’ll probably get back to this when we do our economy revisit. For now we’ve added this bug it to our issues tracker.

3 Likes

I wouldn’t worry about 2-3 hundred gold, with the merchant hearth you can sometimes suddenly skyrocket a thousand in one go if you sell some stews…

For me it is more about the pride of running a town exclusively with agriculture, I’m talking about having 6 or more shepherds in a town of 20 hearthlings :smile:

Oké that would be cool :stuck_out_tongue:, too bad they still need a farmer to make animal feed (why don’t they graze grass actually?)

1 Like

This is such a good point! If they dont grass, why cant we keep sheeps in the mountains? (or did that change without me noticing it?)
In the dessert they can live on sand (no vegatation to graze)… why oh why…?

:sunny: :jubilant:

1 Like