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.
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 anf32
value. If you search forFullness
, 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 theNutritionalValue
storage and writes to theFullness
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 :)