diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-18 16:16:58 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-18 16:16:58 +0200 |
commit | 9d1c30cf9ef5a057c760da49b52312de4a5afc6a (patch) | |
tree | f6532fd40259f7e54d068a656f3aaecf98c22682 /server/src/entity/tutorial.rs | |
parent | fb6ca2a4b9d78dd80dbdf37b2926d9ede4108e8b (diff) | |
download | hurrycurry-9d1c30cf9ef5a057c760da49b52312de4a5afc6a.tar hurrycurry-9d1c30cf9ef5a057c760da49b52312de4a5afc6a.tar.bz2 hurrycurry-9d1c30cf9ef5a057c760da49b52312de4a5afc6a.tar.zst |
prevent multiple tutorials at once
Diffstat (limited to 'server/src/entity/tutorial.rs')
-rw-r--r-- | server/src/entity/tutorial.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/entity/tutorial.rs b/server/src/entity/tutorial.rs index 9b2146d2..0d3d512d 100644 --- a/server/src/entity/tutorial.rs +++ b/server/src/entity/tutorial.rs @@ -8,7 +8,7 @@ use hurrycurry_protocol::{ use log::{debug, warn}; pub struct Tutorial { - player: PlayerID, + pub player: PlayerID, target: ItemIndex, current_hint: Option<(Option<IVec2>, Message)>, @@ -30,6 +30,14 @@ impl Entity for Tutorial { fn finished(&self) -> bool { self.delete_timer <= 0. } + fn destructor(&mut self, c: EntityContext<'_>) { + if let Some((position, _)) = self.current_hint { + c.packet_out.push_back(PacketC::ServerHint { + position, + message: None, + }); + } + } fn tick(&mut self, c: EntityContext<'_>) -> Result<()> { let mut hint = StepContext { ent: &c, |