veloren/common/src/comp/invite.rs
Avi Weinstock c984035976 MR 1775 review fixes.
- Separate `invite` machinery from `group_manip` into it's own thing (includes renaming `group_invite` to `invite` where applicable).
- Move some invite/trade machinery to `ControlEvent`.
- Make `TradePhase` a proper enum instead of a bunch of bools.
- Make `TradeId` a proper newtype.
- Remove trades from `Trades` on accept (previously was only on decline).
- Typo fixes/misc cleanup.
- Add bullet point for trading to the changelog.
2021-02-14 11:13:56 -05:00

32 lines
738 B
Rust

use serde::{Deserialize, Serialize};
use specs::Component;
use specs_idvs::IdvStorage;
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum InviteKind {
Group,
Trade,
}
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum InviteResponse {
Accept,
Decline,
}
pub struct Invite {
pub inviter: specs::Entity,
pub kind: InviteKind,
}
impl Component for Invite {
type Storage = IdvStorage<Self>;
}
/// Pending invites that an entity currently has sent out
/// (invited entity, instant when invite times out)
pub struct PendingInvites(pub Vec<(specs::Entity, InviteKind, std::time::Instant)>);
impl Component for PendingInvites {
type Storage = IdvStorage<Self>;
}