Merge branch 'imbris/temp-fix' into 'master'

Temp fix for the /home command

See merge request veloren/veloren!1528
This commit is contained in:
Imbris 2020-11-16 02:58:28 +00:00
commit 4b9bccd6b8
2 changed files with 10 additions and 2 deletions

View File

@ -11,6 +11,14 @@ pub struct Waypoint {
}
impl Waypoint {
// TODO: add actual fix and remove this method
pub fn temp_new(pos: Vec3<f32>, last_save: Time) -> Self {
Self {
pos: pos + Vec3::from(0.25f32).map(|e| e * rand::random::<f32>() - 0.25 / 2.0),
last_save,
}
}
pub fn new(pos: Vec3<f32>, last_save: Time) -> Self { Self { pos, last_save } }
pub fn get_pos(&self) -> Vec3<f32> { self.pos }

View File

@ -379,7 +379,7 @@ fn handle_home(
server.state.write_component(target, comp::Pos(home_pos));
server
.state
.write_component(target, comp::Waypoint::new(home_pos, time));
.write_component(target, comp::Waypoint::temp_new(home_pos, time));
server.state.write_component(target, comp::ForceUpdate);
} else {
server.notify_client(
@ -1208,7 +1208,7 @@ fn handle_waypoint(
.state
.ecs()
.write_storage::<comp::Waypoint>()
.insert(target, comp::Waypoint::new(pos.0, *time));
.insert(target, comp::Waypoint::temp_new(pos.0, *time));
server.notify_client(client, ChatType::CommandInfo.server_msg("Waypoint saved!"));
server.notify_client(
client,