Server: limit how far a mod may resize part of a skater for other players

- bone_scale_limit in ReSkateServer.json, and the bone-scale command:
  the most a bone may be scaled in the poses the server passes on, 1 to
  8, and its inverse the least. 1 shows every skater at the game's own
  proportions; 0 (the default, "bone-scale off") is no limit
- A "big head" mod sets one joint's scale in the body's bind pose
  (animation/dingo/cas_rsp_body_bind, the head from 1 to 4). The game
  applies it to the bone, and the bone's scale travels in every pose,
  which is how players without the mod see it. The game's own skeleton
  has no scaled joint, so 1 changes nothing for anyone else
- The player with the mod still sees it on their own screen: the server
  decides only what the others are sent
- Changing it sends whole states again, so nobody keeps a reference
  with the old sizes in it
- Dedicated servers only; a lobby's host has no such setting
This commit is contained in:
AyeZeeBB committed 2026-10-07 19:42:48 -05:00
1 parent 7ee82b2771
commit 91c939ea4f
8 files changed
+64 -2

No files matched your search

+9
View File
@@ -340,6 +340,15 @@ void coarsen(Transform &t, unsigned bits) noexcept {
t.rotation[largest] = std::sqrt(std::max(0.f, 1.f - sum));
}
} // namespace
void limit_bone_scale(Pose &pose, float limit) noexcept {
if (!(limit >= 1.f)) return;
const auto hold = [&](Transform &t) {
for (float &axis : t.scale) axis = std::isfinite(axis) ? std::clamp(axis, 1.f / limit, limit) : 1.f;
};
hold(pose.root);
for (auto &t : pose.skater) hold(t);
for (auto &t : pose.board) hold(t);
}
void coarsen_rotations(Pose &pose, unsigned bits) noexcept {
bits = std::min(bits, 12U);
coarsen(pose.root, std::min(bits, 6U)); // which way they face matters from further off than a finger does