amethyst / evoli

An ecosystem-simulation game made with Amethyst
https://community.amethyst.rs/t/evoli-introduction/770
Other
217 stars 33 forks source link

[WIP] add a feed system #69

Closed hbina closed 5 years ago

hbina commented 5 years ago

Attempts to solve #51

hbina commented 5 years ago

It currently does not even compile, I have no idea how to proceed past this wall of error messages.

error[E0599]: no method named `join` found for type `(&specs::storage::Storage<'_, components::combat::Damage, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::combat::Damage>>>, specs::storage::AntiStorage<'_>, &specs::storage::Storage<'_, components::combat::Speed, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::combat::Speed>>>, &mut specs::storage::Storage<'_, components::digestion::Nutrition, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::digestion::Nutrition>>>, &hibitset::BitSet)` in the current scope
  --> src/systems/combat.rs:83:119
   |
83 |             for (damage, _, speed, mut fullness, _) in (&damages, !&cooldowns, &speeds, &mut fullnesses, &attack_set).join() {
   |                                                                                                                       ^^^^
   |
   = note: the method `join` exists but the following trait bounds were not satisfied:
           `(&specs::storage::Storage<'_, components::combat::Damage, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::combat::Damage>>>, specs::storage::AntiStorage<'_>, &specs::storage::Storage<'_, components::combat::Speed, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::combat::Speed>>>, &mut specs::storage::Storage<'_, components::digestion::Nutrition, shred::res::Fetch<'_, specs::storage::MaskedStorage<components::digestion::Nutrition>>>, &hibitset::BitSet) : specs::join::Join`

afaik, I need to implement some trait but I don't know what.

Edit: Okay I fixed the issue now. Not sure if the implementation is correct tho.

erlend-sh commented 5 years ago

If you're able to post a gameplay video with your changes applied then I might be able to tell you if you're on the right track.

Anyhow, great that you've started playing with this feature 👏

hbina commented 5 years ago

@erlend-sh

currently, for some reason, the grass won't be consumed...

https://www.youtube.com/watch?v=EW3lU-dHZiY&feature=youtu.be

I think this have to do with the added constraint in the ( ... ).join() I have added in combat.rs causing grasses to be excluded? I am not sure if herbivores are considered as "attackers" of grasses tho.

sunreef commented 5 years ago

I think that eventually, we'll have to split attacks and feeding actions into their own distinct systems.

hbina commented 5 years ago

@sunreef yep, i did exactly that in my latest commit. do you want me to squash these commits?

https://www.youtube.com/watch?v=DlOHmINbQZA&feature=youtu.be

sunreef commented 5 years ago

@hbina I didn't look at the code before commenting. Sorry 😅 We can wait for @marot or @khskarl to give their opinion before we merge.