all: use new mach.Entity.Mod query API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-05-07 17:49:24 -07:00 committed by Stephen Gutekanst
parent 541ce9e7c0
commit bd655828e3
13 changed files with 213 additions and 265 deletions

View file

@ -70,14 +70,12 @@ fn audioStateChange(
app: *Mod,
) !void {
// Find audio entities that are no longer playing
var archetypes_iter = audio.__entities.queryDeprecated(.{ .all = &.{
.{ .mach_audio = &.{.playing} },
} });
while (archetypes_iter.next()) |archetype| {
for (
archetype.slice(.entities, .id),
archetype.slice(.mach_audio, .playing),
) |id, playing| {
var q = try entities.query(.{
.ids = mach.Entities.Mod.read(.id),
.playings = mach.Audio.Mod.read(.playing),
});
while (q.next()) |v| {
for (v.ids, v.playings) |id, playing| {
if (playing) continue;
if (app.get(id, .play_after)) |frequency| {