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
use crate::UserKey;

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum EntityOwner {
    Server,
    Client(UserKey),
    ClientWaiting(UserKey),
    ClientPublic(UserKey),
    Local,
}

impl EntityOwner {
    pub fn is_server(&self) -> bool {
        match self {
            EntityOwner::Server => true,
            _ => false,
        }
    }

    pub fn is_client(&self) -> bool {
        match self {
            EntityOwner::Client(_)
            | EntityOwner::ClientPublic(_)
            | EntityOwner::ClientWaiting(_) => true,
            _ => false,
        }
    }

    pub fn is_public(&self) -> bool {
        match self {
            EntityOwner::ClientPublic(_) | EntityOwner::Server => true,
            _ => false,
        }
    }
}