-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.capnp
More file actions
59 lines (49 loc) · 1.67 KB
/
Copy pathentity.capnp
File metadata and controls
59 lines (49 loc) · 1.67 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@0x964f5a87dabc5dfc;
# Put everything into the "acp" (AC Protocol) namespace
using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("ACP");
using Util = import "util.capnp";
using World = import "world.capnp";
using Actor = import "actor.capnp";
# S->C, SAVE
struct Entity {
type @0 :Util.ID;
persistentHandle @1 :Util.PersistentHandle;
world @2 :World.WorldID;
pos @3 :World.DecimalWorldPos;
data @4 :List(Util.AnyStructStruct);
actor @5 :Actor.Actor;
aimPos @6 :World.DecimalWorldPos;
}
# S->C when there's a world change for an entity.
# Sent to clients tracking source chunk or target chunk.
struct EntityWorldChange {
entity @0 :Util.PersistentHandle;
# When changing worlds, there's a high probability that the entity is not loaded on clients -> we include it in the world change event itself.
entityData @1 :Entity;
targetWorld @2 :World.WorldID;
targetPos @3 :World.DecimalWorldPos;
reason @4 :Util.Identifier;
}
# C->S when the client needs data for the given entity.
# For success, the entity has to be loaded on the server side and must be accessible to the client.
# Server responds with Entity if the request is valid.
struct EntityRequest {
entity @0 :Util.PersistentHandle;
}
# S->C Copies EA_DamageReceived
struct EntityDamageReceived {
entity @0 :Util.PersistentHandle;
damage @1 :Util.Damage;
actor @2 :Util.PersistentHandle;
item @3 :Util.PersistentHandle;
block @4 :World.WorldBlockContext;
ray @5 :World.CollisionRayState;
}
# S->C
struct EntityVisualAction {
entity @0 :Util.PersistentHandle;
animation @1 :Util.Identifier; # If set, an animation will be played
sound @2 :Util.Identifier; # If set, a characteristic sound will be played
flags @3 :UInt8;
}