Changed buff effects so they did not need to mutably change buffs every tick. Buff system now no longer mutably accesses buffs component.

This commit is contained in:
Sam
2023-03-08 23:10:24 -05:00
parent b1b41e95f6
commit 9efac9957d
11 changed files with 138 additions and 119 deletions

View File

@ -223,6 +223,7 @@ impl StateExt for State {
},
Effect::Buff(buff) => {
let time = self.ecs().read_resource::<Time>();
let stats = self.ecs().read_storage::<comp::Stats>();
self.ecs()
.write_storage::<comp::Buffs>()
.get_mut(entity)
@ -234,6 +235,7 @@ impl StateExt for State {
buff.cat_ids,
comp::BuffSource::Item,
*time,
stats.get(entity),
),
*time,
)