aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-24 00:38:16 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-24 00:38:46 +0200
commite00492214438711c3af7fcad75505539d41e2285 (patch)
treefaf8d44a5282846b537ed347b2f839607aa9df89 /server/src
parentf1f0ae07172c24deb5815f8ee7926018db6d7dbc (diff)
downloadhurrycurry-e00492214438711c3af7fcad75505539d41e2285.tar
hurrycurry-e00492214438711c3af7fcad75505539d41e2285.tar.bz2
hurrycurry-e00492214438711c3af7fcad75505539d41e2285.tar.zst
pinned orders
Diffstat (limited to 'server/src')
-rw-r--r--server/src/commands.rs7
-rw-r--r--server/src/interaction.rs3
-rw-r--r--server/src/server.rs4
-rw-r--r--server/src/state.rs1
4 files changed, 8 insertions, 7 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs
index c03c8bcd..6fd95eac 100644
--- a/server/src/commands.rs
+++ b/server/src/commands.rs
@@ -23,7 +23,7 @@ use crate::{
use anyhow::{anyhow, bail, Result};
use clap::{Parser, ValueEnum};
use hurrycurry_bot::algos::ALGO_CONSTRUCTORS;
-use hurrycurry_protocol::{Menu, Message, MessageTimeout, PacketC, PlayerID};
+use hurrycurry_protocol::{Menu, Message, PacketC, PlayerID};
use std::{fmt::Write, time::Duration};
#[derive(Parser)]
@@ -294,10 +294,7 @@ impl Server {
id: message_id,
params: arguments.into_iter().map(|c| Message::Text(c)).collect(),
}),
- timeout: Some(MessageTimeout {
- initial: 5.,
- remaining: 5.,
- }),
+ timeout: None,
});
}
}
diff --git a/server/src/interaction.rs b/server/src/interaction.rs
index 7a8c2e9d..74d31cd8 100644
--- a/server/src/interaction.rs
+++ b/server/src/interaction.rs
@@ -15,13 +15,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+use crate::data::index::GamedataIndex;
use hurrycurry_client_lib::{Involvement, Item};
use hurrycurry_protocol::{Gamedata, ItemLocation, PacketC, PlayerID, Recipe, Score, TileIndex};
use log::info;
use std::collections::VecDeque;
-use crate::data::index::GamedataIndex;
-
#[allow(clippy::too_many_arguments)]
pub fn interact(
data: &Gamedata,
diff --git a/server/src/server.rs b/server/src/server.rs
index 06b6e5fd..0c3df634 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -528,8 +528,10 @@ impl Server {
message,
timeout,
player,
+ pin,
} => {
info!("{player:?} message {message:?}");
+ let pin = pin.unwrap_or(false);
if let Some(timeout) = timeout {
if let Some(player) = self.game.players.get_mut(&player) {
player.communicate_persist = message.clone().map(|m| {
@@ -538,6 +540,7 @@ impl Server {
MessageTimeout {
initial: timeout,
remaining: timeout,
+ pinned: pin,
},
)
});
@@ -549,6 +552,7 @@ impl Server {
timeout: timeout.map(|t| MessageTimeout {
initial: t,
remaining: t,
+ pinned: pin,
}),
})
}
diff --git a/server/src/state.rs b/server/src/state.rs
index 9009d4a1..65e6dfd2 100644
--- a/server/src/state.rs
+++ b/server/src/state.rs
@@ -53,6 +53,7 @@ impl Server {
message: Some(Message::Text(text)),
timeout: None,
player,
+ ..
} if let Some(command) = text.strip_prefix("/") => {
match self.handle_command_parse(*player, command).await {
Ok(packets) => return Ok(packets),