mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-29 03:46:50 +01:00
Hold skateboards to their size, and catch one kept on another player
A hacked game was resizing its skateboard and reporting it at another player's position, so everyone saw an oversized board riding on them, and with player collision on it knocked them about. A skateboard is now held to within 10% of its size, apart from the limit on resized body parts: on a dedicated server when its scale limit is on, and in every player's game whatever sent the pose. Another player's board is solid only within 3 m of its own skater; one further off is seen and not felt. Dedicated servers also check for a board kept on another player (Server/board_check.h): one away from its own skater that stays beside one other player while that player travels 8 m over at least 3 seconds. The board is then no longer passed on to the others until it has behaved for half a minute, and the log and the admins in the game are told who. New setting anti_cheat.pinned_board and command board-check: off | warn (default) | kick.
This commit is contained in:
1 parent
b9ffd72409
commit
8044c88373
14 files changed
+289
-13
No files matched your search
@@ -299,9 +299,11 @@ Host::Guest::KeptPose *Host::keep_pose(Guest &from, const Packet &packet) {
|
||||
std::erase_if(kept, [&](const Guest::KeptPose &pose) { return now_ - pose.kept_at > pose_kept_for[std::min<std::size_t>(pose.keep, 3)]; });
|
||||
while (kept.size() >= 96) kept.pop_front();
|
||||
if (!kept.empty() && kept.back().sequence == packet.sequence) return &kept.back();
|
||||
// What a mod resized on its player's skater reaches the others only as far as the server allows.
|
||||
if (config_.bone_scale_limit >= 1.f || config_.bone_reach_limit > 0.f) {
|
||||
// What a mod resized on its player's skater reaches the others only as far as the server allows,
|
||||
// and a board kept on another player (check_board) not at all.
|
||||
if (config_.bone_scale_limit >= 1.f || config_.bone_reach_limit > 0.f || from.board_hidden) {
|
||||
auto pose = packet.pose;
|
||||
if (from.board_hidden) pose.board.clear();
|
||||
limit_bone_scale(pose, config_.bone_scale_limit);
|
||||
limit_bone_reach(pose, config_.bone_reach_limit);
|
||||
kept.push_back({packet.sequence, packet.time_us, now_, 0, pose_codec::quantize(pose)});
|
||||
@@ -552,6 +554,7 @@ void Host::broadcast(const Packet &packet, bool reliable, bool fresh, std::uint6
|
||||
data.packet.pose_interval_us = interval;
|
||||
if (packet.kind == PacketKind::pose) {
|
||||
// What a mod resized on its player's skater reaches the others only as far as the server allows.
|
||||
if (source && source->board_hidden) data.packet.pose.board.clear();
|
||||
if (config_.bone_scale_limit >= 1.f) limit_bone_scale(data.packet.pose, config_.bone_scale_limit);
|
||||
limit_bone_reach(data.packet.pose, config_.bone_reach_limit);
|
||||
}
|
||||
@@ -804,6 +807,7 @@ void Host::change_map(std::string_view map) {
|
||||
g.party_budget = old.party_budget;
|
||||
g.scoring_budget = old.scoring_budget;
|
||||
g.speeding = old.speeding;
|
||||
g.board_hidden = old.board_hidden;
|
||||
g.scoring = old.scoring;
|
||||
g.scoring_mods = std::move(old.scoring_mods);
|
||||
g.scoring_flagged = old.scoring_flagged;
|
||||
@@ -892,7 +896,8 @@ bool Host::accept_data(Guest &source, const Packet &p) {
|
||||
active(source);
|
||||
}
|
||||
}
|
||||
return check_speed(source, p.time_us); // last: a speed-check kick frees `source`
|
||||
// Last: a kick by either check frees `source`.
|
||||
return check_board(source, p.pose) && check_speed(source, p.time_us);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user