amethyst/evoli

Add a feed system

marotili opened this issue · 4 comments

At the moment, entities will starve to death.
In PerformDefaultAttackSystem check if the defending entity dies, if that is the case, add the amount of nutritional value (a new component) to the fullness of the attacking entity.

After this is done we’ll come up with a way for a dead entity to leave a dead body that several predators will feed on. One large herbivore body should be enough to bring several predators to max fullness.

hbina commented

Hi I would love to work on this, I am fairly new to Rust so any guidance is appreciated!

Hi @hbina,
If you have specific questions, feel free to ask them in the Amethyst discord in the #showcase-team channel.
If you already have some code, even if it is not working, you can create a WIP pull request so that we can help you fix errors etc.

What you need to do:

  • Create a NutritionalValue component that stores an f32 value. If you search for Fullness, you should have a very similar example. You should be able to set the component value in the prefabs (resources/prefabs folder).
  • The next step would be to modify PerformDefaultAttackSystem so that it reads the NutritionalValue storage and writes to the Fullness storage. There is code modifying the health in there - that's where you should check if the health turns to 0. In that case, you should add the nutritional value of the defender (defender_set) to the fullness of the attacker (attacker_set).

I hope that helps :)

Implemented in #69