Skip to content

v0.5.0 - Merge System Overhaul

Choose a tag to compare

@AlephCubed AlephCubed released this 04 Apr 19:34
· 3 commits to main since this release
12b36fc

What's Changed

Full Changelog: v0.4.0...v0.5.0

Migration Guide

The effect merging system has be overhauled, making temporary entities fully isolated from the main world.

This change also makes merge functions themselves more ergonomic, providing an EntityRef instead of an entity ID. Note that this swaps the direction of the merge! The results of merge logic should now be applied to the existing component.

Before:

fn merge_my_effect(mut new: EntityWorldMut, outgoing: Entity) {
    let outgoing = new.world().get::<MyEffect>(outgoing).unwrap().clone();
    let mut new = new.get_mut::<MyEffect>().unwrap();
    new.0 += outgoing.0;
}

After:

fn merge_my_effect(mut existing: EntityWorldMut, incoming: EntityRef) {
    let mut existing = existing.get_mut::<MyEffect>().unwrap();
    let incoming = incoming.get::<MyEffect>().unwrap();
    existing.0 += incoming.0;
}