blob: cdd9cf5017ccd1687941912429ab22b28e4b5f94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
NAME(event);
PARENT(trigger);
INIT {
super("init");
super("target");
this->type = propertyi_default("type", 0);
}
IMPL(init_post) {
if (this->type == EVENT_INIT) {
method("broadcast");
repeat (i, MAX_ENTITIES) {
auto e = &g->entities[i];
e->visible = e->visible_next;
}
method("deinit");
}
}
IMPL(broadcast) {
auto v = g_group(this->target);
repeat (i, v->size)
entity_method(VecEntityP_get(v, i), "enter");
VecEntityP_free(v);
}
UPDATE_POST {
if (!this->visible)
return;
if (this->type == EVENT_JUMP && g->ev.jump)
method("broadcast");
else if (this->type == EVENT_DOUBLEJUMP && g->ev.djump)
method("broadcast");
else if (this->type == EVENT_DEATH && g->ev.death)
method("broadcast");
else if (this->type == EVENT_LASTKEY && g->ev.lastkey)
method("broadcast");
}
|