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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//! Survivors: lookups, beds, summons and their status.
use c_void;
use crate;
/// A game system asking which entity is a survivor, as
/// [`HostApi::survivor_lookup`](super::HostApi::survivor_lookup) hands it to the mod that answers.
///
/// The game keeps one entity per survivor; a mod that keeps several answers
/// each asker with the one that suits it. Cells are
/// whole 0.5 m cells.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Header, SurvivorLookup};
///
/// let lookup = SurvivorLookup {
/// header: Header::of::<SurvivorLookup>(),
/// survivor: enshwick::survivors::NpcId::new(0x47a1_5e4a),
/// vanilla: enshwick::Entity(4096),
/// purpose: SurvivorLookup::SPAWN,
/// entity: enshwick::Entity(0),
/// cell: [10, 0, 10],
/// bed_of: None,
/// token: core::ptr::null_mut(),
/// };
/// assert_eq!(lookup.purpose, SurvivorLookup::SPAWN);
/// ```
impl_headed!;
/// The mod's survivor lookup: the call and the pointer given at
/// registration; returns 1 with the answer in `out`, or 0 for the game's own.
pub type SurvivorLookupFn = unsafe extern "system" fn ;
/// A survivor's own check that its bed is still its, after the game kept it,
/// as [`HostApi::survivor_bed_check`](super::HostApi::survivor_bed_check) hands it on. Cells are whole 0.5 m
/// cells.
///
/// The name is enshwick's: the game's bed check has none.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{BedCheck, Header};
///
/// let check = BedCheck { header: Header::of::<BedCheck>(), npc_id: enshwick::survivors::NpcId::new(7), entity: enshwick::Entity(4096), bed_id: enshwick::Entity(4100), home: [0; 3], bed_at: [4, 0, 4] };
/// assert_eq!(check.bed_id, enshwick::Entity(4100));
/// ```
impl_headed!;
/// A filter of survivors' beds: returns 0 to make the game clear the bed.
pub type BedCheckFn = unsafe extern "system" fn ;
/// A summoning staff's use about to spawn or move a survivor, as
/// [`HostApi::summon_filter`](super::HostApi::summon_filter) hands it on, and once it worked, as
/// [`HostApi::summoned`](super::HostApi::summoned) does.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Header, Summon};
///
/// let summon = Summon {
/// header: Header::of::<Summon>(),
/// item: enshwick::ItemId::new(0x5e01),
/// ammo: enshwick::ItemId::new(0),
/// template: [0; 16],
/// target: [0; 3],
/// slot: 0x3_0000_0041,
/// pide: enshwick::Entity(900),
/// meter: [2, 3],
/// consumed: 0,
/// reserved: [0; 3],
/// };
/// assert_eq!(summon.meter, [2, 3]);
/// ```
impl_headed!;
/// A summon filter: returns [`Summon::TAKE`] to make the game take the
/// item in the same transaction, and only when the spawn or move works,
/// [`Summon::REFUSE`] to refuse the use, or 0 to leave it.
pub type SummonFn = unsafe extern "system" fn ;
/// The client's survivor menu merging the statuses of every entity of one
/// survivor.
///
/// The survivor, `count` status bytes at `statuses`, valid for the call, and
/// the pointer given at registration; returns [`SURVIVOR_STATUS_SET`] or-ed
/// with the byte to show, or 0 to leave the game's.
pub type SurvivorStatusFn = unsafe extern "system" fn ;
/// The bit of a [`SurvivorStatusFn`] answer that says its low byte is the
/// status to show.
pub const SURVIVOR_STATUS_SET: u32 = 0x100;