Add minor optimization
This commit is contained in:
parent
37e4c5c8d7
commit
c52613fa20
@ -15,7 +15,7 @@ you are familiar with Rust.
|
||||
intended to be a fun addition to the game that can help players trade items with each other.
|
||||
- This project may have bugs. You are encouraged to report them to the author but the author takes
|
||||
no responsibility for any lost items. **No such incidents have been reported so far.**
|
||||
- This program **handles your password securely** and does nothing with it expect connecting to the
|
||||
- This program **handles your password securely** and does nothing with it except connecting to the
|
||||
veloren server during launch. However, third-party video game software is often infected with
|
||||
malware. You should **review the source code** or ask someone you trust to do so for you.
|
||||
- You are welcome to make changes to the code or fork the project. The author is open to
|
||||
|
@ -443,6 +443,7 @@ impl Bot {
|
||||
);
|
||||
|
||||
if let Some(announcement) = &self.announcement {
|
||||
let announcement = if announcement.contains("{location}") {
|
||||
let location = self
|
||||
.client
|
||||
.sites()
|
||||
@ -458,10 +459,14 @@ impl Bot {
|
||||
}
|
||||
})
|
||||
.unwrap_or(format!("{:?}", self.position));
|
||||
let interpolated_announcement = announcement.replace("{location}", &location);
|
||||
|
||||
announcement.replace("{location}", &location)
|
||||
} else {
|
||||
announcement.clone()
|
||||
};
|
||||
|
||||
self.client
|
||||
.send_command("world".to_string(), vec![interpolated_announcement]);
|
||||
.send_command("world".to_string(), vec![announcement]);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user