blob: 3787ffaae489facb786868f6b45a7ec5be3b95b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use super::{Entity, EntityContext};
use anyhow::Result;
use hurrycurry_protocol::{glam::IVec2, Menu, PacketC, PlayerID};
#[derive(Debug, Clone)]
pub struct Book(pub IVec2);
impl Entity for Book {
fn interact(
&mut self,
c: EntityContext<'_>,
pos: Option<IVec2>,
_player: PlayerID,
) -> Result<bool> {
if pos == Some(self.0) {
c.packet_out.push_back(PacketC::Menu(Menu::Book));
return Ok(true);
}
Ok(false)
}
}
|