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
//! [`CustomId`]: the name of a move or event of your own, for [`Mode::Custom`] and
//! [`Event::Custom`].
//!
//! An id is a hash of a name you choose, worked out at compile time, so two abilities from
//! different crates never have to agree on numbers: name them after their crate and move
//! (`"my_crate::lunge"`) and they don't collide. The same name always gives the same id,
//! in every build and on every machine, so replays and cloned worlds stay deterministic.
//!
//! ```
//! use game_toolkit_platformer::sim::CustomId;
//!
//! const LUNGE: CustomId = CustomId::new("my_game::lunge");
//! const POGO: CustomId = CustomId::new("pogo_crate::pogo");
//! assert_ne!(LUNGE, POGO);
//! assert_eq!(LUNGE, CustomId::new("my_game::lunge"));
//! ```
//!
//! [`Mode::Custom`]: super::Mode::Custom
//! [`Event::Custom`]: super::Event::Custom
/// The id of a move or event of your own: a 64-bit hash of its name (see the module docs).
/// Usable in patterns: `Mode::Custom { id: LUNGE, .. }`.
;