Add alert pause durations

This commit is contained in:
ErrorNoInternet 2023-01-23 22:53:35 +08:00
parent 122da153bc
commit 4ac4e2b5a7
Signed by untrusted user who does not match committer: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3
2 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,7 @@ alert_command = [
"-d{player_name} is near your base! Their coordinates are {x} {y} {z}.",
"<your URL here (or a service such as ntfy.sh)>"
]
alert_pause_time = 5 # the amount of seconds to wait between alert messages
cleanup_interval = 300 # the amount of seconds to wait before checking for idle entities
mob_expiry_time = 300 # the maximum amount of time a mob can stay idle before getting cleared
mob_packet_drop_level = 5 # the amount of mob packets to drop (0 = 0%, 5 = 50%, 10 = 100%)

View File

@ -30,6 +30,7 @@ struct BotConfiguration {
alert_location: Vec<i32>,
alert_radius: u32,
alert_command: Vec<String>,
alert_pause_time: u32,
cleanup_interval: u32,
mob_expiry_time: u64,
mob_packet_drop_level: u8,
@ -50,6 +51,7 @@ impl Default for BotConfiguration {
alert_location: vec![0, 0],
alert_radius: 100,
alert_command: Vec::new(),
alert_pause_time: 5,
cleanup_interval: 300,
mob_expiry_time: 300,
mob_packet_drop_level: 5,
@ -279,7 +281,9 @@ async fn handle(mut client: Client, event: Event, mut state: State) -> anyhow::R
}
}
if *state.alert_second_counter.lock().unwrap() >= 5 {
if *state.alert_second_counter.lock().unwrap() as u32
>= state.bot_configuration.alert_pause_time
{
*state.alert_second_counter.lock().unwrap() = 0;
let alert_queue = state.alert_queue.lock().unwrap().to_owned();