Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes instances in inventory module where unnecessery updates happened #656

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

lukashermansson
Copy link
Contributor

Objective

This pr attempts to solve some components that got triggered unnecessarily

can be observed with a simple system like this:

fn log_inventories(invs: Query<(Entity, &Inventory), Changed<Inventory>>) {
    for inv in invs.iter() {
       println!("inventory updated");
    }
}

the above system will print each tick when an inventory is open, this will result in systems like the one above will trigger unnecessarily

Solution

To solve this I found the places where we currently "reset" some state in the inventory module each tick and replaced the modifications with alternatives that only trigger a modification if the value needed to be reset (was not in the reset state)

@dyc3 dyc3 merged commit 70a266a into valence-rs:main Oct 11, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants