diff --git a/src/entity.zig b/src/entity.zig index 0ebfa95..575decb 100644 --- a/src/entity.zig +++ b/src/entity.zig @@ -104,9 +104,10 @@ pub fn Entity(comptime ctx: anytype) type { return @alignCast(@ptrCast(c.ecs_get_id(self.world.raw, self.raw, id))); } - pub fn set(self: Self, comptime T: type, value: T) void { + pub fn set(self: Self, comptime T: type, value: T) Self { const id = Lookup(ctx, T).id; _ = c.ecs_set_id(self.world.raw, self.raw, id, @sizeOf(T), &value); + return self; } }; } diff --git a/test/world.zig b/test/world.zig index 0f46e6e..03578f9 100644 --- a/test/world.zig +++ b/test/world.zig @@ -45,8 +45,8 @@ test "World_progress_w_0" { var ctx = util.Probe.init(); c.ecs_set_context(world.raw, &ctx); - e1.set(Position, .{ .x = 0, .y = 0 }); - e1.set(Velocity, .{ .x = 1, .y = 2 }); + _ = e1.set(Position, .{ .x = 0, .y = 0 }); + _ = e1.set(Velocity, .{ .x = 1, .y = 2 }); _ = world.progress(0);