Skip to content

tp to last position if we receive an OOB position#151

Draft
MarkJoaquim wants to merge 2 commits intomasterfrom
server-boundaries
Draft

tp to last position if we receive an OOB position#151
MarkJoaquim wants to merge 2 commits intomasterfrom
server-boundaries

Conversation

@MarkJoaquim
Copy link
Collaborator

Issue: Enforce Map Borders #143

Why: see issue

What: when patchwork receives a position for which there is no map, we call playerstate to send the last position we have for the player

Checks

  • I have performed the manual integration test
  • The output of cargo clippy is empty
  • I have run cargo fmt on my most recent changes
  • [] I haven't read the PR template

Comment on lines -53 to -77
match &patchwork.maps[anchor.map_index].peer_connection {
Some(_) => match msg.packet {
Packet::Unknown => {}
_ => {
trace!(
"Routing packet from conn_id {:?} through anchor",
msg.conn_id
);
player_state.anchored_move_and_look(
msg.conn_id,
extract_player_position((&msg.packet).clone()),
None,
);
messenger.send_packet(anchor.conn_id.unwrap(), msg.packet.clone());
}
},
None => {
trace!("Routing packet from conn_id {:?} locally", msg.conn_id);
gameplay_router::route_packet(
msg.packet.clone(),
msg.conn_id,
player_state.clone(),
sender.clone(),
);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete this? Won't all non-positional packets get ignored now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah whoops, I was just trying to avoid handling position packets that are out of bounds so I moved it to after we check the map position but you're right that this will ignore non position packets...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants