• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / arche / 4874413404

03 May 2023 04:46PM CUT coverage: 100.0%. Remained the same
4874413404

push

github

GitHub
Batch-set entity relation, RelationFilter to function (#265)

137 of 137 new or added lines in 6 files covered. (100.0%)

3764 of 3764 relevant lines covered (100.0%)

97404.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ecs/event.go
1
package ecs
2

3
// EntityEvent contains information about component changes to an [Entity].
4
//
5
// To receive change events, register a function func(e *EntityEvent) with [World.SetListener].
6
//
7
// Events notified are entity creation, removal and changes to the component composition.
8
// Events are emitted immediately after the change is applied.
9
//
10
// Except for removed entities, events are always fired when the [World] is in an unlocked state.
11
// Events for removed entities are fired right before removal of the entity,
12
// to allow for inspection of it's components.
13
// Therefore, the [World] is in a locked state during entity removal events.
14
//
15
// Events for batch-creation of entities using a [Builder] are fired after all entities are created.
16
// For batch methods that return a [Query], events are fired after the [Query] is closed (or fully iterated).
17
// This allows the [World] to be in an unlocked state, and notifies after potential entity initialization.
18
//
19
// Note that the event pointer received by the listener function should not be stored,
20
// as the instance behind the pointer might be reused for further notifications.
21
type EntityEvent struct {
22
        Entity                  Entity // The entity that was changed.
23
        OldMask, NewMask        Mask   // The old and new component masks.
24
        Added, Removed, Current []ID   // Components added, removed, and after the change. DO NOT MODIFY!
25
        AddedRemoved            int    // Whether the entity itself was added (> 0), removed (< 0), or only changed (= 0).
26
        OldTarget, NewTarget    Entity // Old and new target entity
27
        TargetChanged           bool   // Whether this is (only) a change of the relation target.
28
}
29

30
// EntityAdded reports whether the entity was newly added.
31
func (e *EntityEvent) EntityAdded() bool {
3✔
32
        return e.AddedRemoved > 0
3✔
33
}
3✔
34

35
// EntityRemoved reports whether the entity was removed.
36
func (e *EntityEvent) EntityRemoved() bool {
1,106✔
37
        return e.AddedRemoved < 0
1,106✔
38
}
1,106✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc