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
|
use std::collections::HashMap;
use avian3d::prelude::RigidBody;
use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use yarnspinner::core::YarnValue;
/// Payload component that corresponds to [`bevy::prelude::Transform`]
#[derive(Serialize, Deserialize, Clone, Default, Deref, DerefMut, Debug)]
pub struct Transform(pub bevy::prelude::Transform);
/// Transform for the destination of a door
/// Used to determine where to spawn ".." door and player when entering a room
#[derive(Serialize, Deserialize, Clone, Default, Deref, DerefMut, Debug)]
pub struct DoorDestination(pub bevy::prelude::Transform);
/// Payload component that represent's an entity's name
#[derive(Serialize, Deserialize, Clone, Default, Deref, DerefMut, Debug)]
pub struct Name(pub String);
/// Payload component that represents a yarnspinner actor
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct Actor {
/// Actor-local variables
pub local_variables: HashMap<String, YarnValue>,
/// Source for the yarnspinner dialog
pub yarn_source: Vec<u8>,
}
/// Payload component that represents a character's voice. Uses rustysynth to generate random MIDI
/// tones based on given parameters.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Voice {
/// Base MIDI pitch of voice. Defaults to 60
pub pitch: i32,
/// MIDI preset to use for voice. Defaults to 0
pub preset: i32,
/// MIDI bank to use. Defaults to 0
pub bank: i32,
/// Variance in pitch of voice. Defaults to 3
pub variance: u32,
/// Speed of voice. Defaults to 1.0
pub speed: f32,
}
impl Default for Voice {
fn default() -> Self {
Self {
pitch: 60,
preset: 0,
bank: 0,
variance: 3,
speed: 1.0,
}
}
}
/// Payload component that wraps a [`avian3d::prelude::RigidBody`]
#[derive(Serialize, Deserialize, Clone, Default, Deref, DerefMut, Debug)]
pub struct Rigidbody(pub RigidBody);
/// Payload component that represents mesh colliders that will be generated for this entity
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct MeshCollider {
/// Whether the generated colliders should be convex hulls
pub convex: bool,
/// Whether the generated colliders should be triggers
pub sensor: bool,
}
/// Payload component representing a lua script that will be attached to an entity
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct Script {
/// Lua script source
pub lua_source: Vec<u8>,
}
/// Payload component for an arbitrary relationship map, can store 128-bit identifiers indexed by names
#[derive(Serialize, Deserialize, Clone, Default, Deref, DerefMut, Debug)]
pub struct Relationships(pub HashMap<String, [u8; 16]>);
/// Payload component that indicates that this entity should be able to be picked up
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
pub struct Pickup;
|