Refactor: extract shared helpers across scripts, trim remaining doc redundancy

Deduplication pass (44 extractions):
- New SmoothedLook: shared smoothed yaw/pitch look tick + view seeding
  (FirstPersonController, FreeCamController)
- New CharacterTeleport: disable-CC-around-teleport idiom (rescue,
  owner position apply, free-cam sync)
- New GeometryUtil: RescaleToUnitScale + TransformBounds (concealment
  meter/volume, skinned collider baker)
- Paint family: canonical map read/write shared between Net and
  Persistence, snapshot decode, backend stroke dispatch, RebuildBackend,
  ResolveSeed, chunked RPC send/gate/copy, CamoKnobs/HeightKnobs
  aggregates, SanitizeFileKey, NewMaskTexture, AdoptAlbedo, FindSlider
- Player/modes: GameMode SetPlayerControl/SetPainting/SetOrbitInputEnabled,
  InputUtil.GameplayKeyPressed, NearestClimbHit, ComputeXRay delegates to
  ComputeResolutionFreeze, FingerIK TryInPlaneAngle
- Match/misc: UnhookSessionCallbacks, SendEmptyNamedMessage, SwapScenes,
  RunSessionOpAsync, CovarianceEigen, CollectClusterPoints, MatchHud
  GUIStyle cache, HsvColorPicker rehook, VoxelCenter

Documentation pass: remove 6 triplicated doc blocks and 2 restating
inline comments left after the previous reduction.

Behavior-neutral; hot-path rasterizer loops intentionally untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-02 12:33:48 +02:00
1 parent 066e308cde
commit 2243cc823e
40 files changed
+681 -724

No files matched your search

+17 -28
View File
@@ -145,9 +145,7 @@ public class NetworkPlayerSetup : NetworkBehaviour
// Remote avatar: NetworkTransform owns the transform here, so disable the local
// simulation (input/movement) and the CharacterController's own depenetration.
if (controller) controller.enabled = false;
var cc = GetComponent<CharacterController>();
if (cc) cc.enabled = false;
DisableLocalSimulation();
// The concealment meter (per-frame bake + voxelization + overlap) only feeds the LOCAL player;
// a remote's concealment is computed on its own owner's machine, so here it is wasted CPU.
@@ -206,16 +204,22 @@ public class NetworkPlayerSetup : NetworkBehaviour
if (IsOwner)
{
var controller = GetComponent<PlayerCharacterController>();
if (controller) controller.enabled = false;
var cc = GetComponent<CharacterController>();
if (cc) cc.enabled = false;
DisableLocalSimulation();
var manager = FindFirstObjectByType<GameModeManager>(FindObjectsInactive.Include);
if (manager) manager.BindSpectator();
}
}
// Stops this avatar simulating locally: movement input and the CharacterController's own depenetration.
private void DisableLocalSimulation()
{
var controller = GetComponent<PlayerCharacterController>();
if (controller) controller.enabled = false;
var cc = GetComponent<CharacterController>();
if (cc) cc.enabled = false;
}
private void Update()
{
UpdateVisibility();
@@ -352,11 +356,9 @@ public class NetworkPlayerSetup : NetworkBehaviour
// Buried-hider reveal: already gated to hider + running match on the owner before it is published.
if (_embeddedReveal.Value) return true;
// Resolution reveals every remaining (un-found) hider through walls, on every client.
var match = MatchManager.Instance;
return match && match.MatchActive &&
match.LocalSubPhase == MatchManager.MatchSubPhase.Resolution &&
role == PlayerRole.Hider && !_isFound.Value;
// Resolution reveals every remaining (un-found) hider through walls, on every client -
// exactly the still-in-play-hider-during-Resolution predicate the freeze uses.
return ComputeResolutionFreeze();
}
// True if THIS machine's local player is a Hunter role variant (so it must not see hiders during hide).
@@ -392,10 +394,7 @@ public class NetworkPlayerSetup : NetworkBehaviour
private void ApplyOwnerPosition(Vector3 worldPos)
{
var cc = GetComponent<CharacterController>();
bool reenable = cc && cc.enabled;
if (cc) cc.enabled = false;
transform.position = worldPos;
if (cc) cc.enabled = reenable;
CharacterTeleport.Move(cc, transform, worldPos);
}
// Resolves the spawn-area collider for this avatar: the Role-specific area (Hunter/Hider) takes priority,
@@ -446,12 +445,7 @@ public class NetworkPlayerSetup : NetworkBehaviour
}
Vector3 target = new Vector3(pick.x, b.min.y + spawnAreaGroundLift, pick.z);
var cc = GetComponent<CharacterController>();
bool reenable = cc && cc.enabled;
if (cc) cc.enabled = false;
transform.position = target;
if (cc) cc.enabled = reenable;
ApplyOwnerPosition(target);
}
// Collider.ClosestPoint only constrains to the real shape for primitives and CONVEX mesh colliders;
@@ -481,11 +475,6 @@ public class NetworkPlayerSetup : NetworkBehaviour
// Half-slot stagger per ring so outer slots don't line up radially with inner ones.
float angle = (slot / (float)spawnRingSlots + ring * 0.5f / spawnRingSlots) * Mathf.PI * 2f;
Vector3 offset = new Vector3(Mathf.Cos(angle), 0f, Mathf.Sin(angle)) * radius;
var cc = GetComponent<CharacterController>();
bool reenable = cc && cc.enabled;
if (cc) cc.enabled = false;
transform.position += offset;
if (cc) cc.enabled = reenable;
ApplyOwnerPosition(transform.position + offset);
}
}