Part of #41: the comments of `benilla-world`, Rust and WGSL, are rewritten to the rule in `docs/METHOD.md`, which is what the code does and the reference fact behind it, in a line. 24,226 comment lines become 8,863. - **The mechanical strip.** The citations that were only a private record number go first, and each edit is shown to be a pure removal. - **Wrong facts corrected.** The rewrite corrects the comments that stated wrong facts. Among them: - `0x6b62e0` is the WMO group's liquid renderer, not a doodad drawer. - The reference creates a WMO's props once, when a group enters its streaming window (`0x698720` → `0x695aa0`). It then admits them each frame the portal walk visits the group (`0x685d70` → `0x6838f0`). The old text had them created per visible group. - The liquid query's comments now state the reference's order: the map-object leg first, then the ADT (`0x69b6d0`). They no longer call the Outdoors/Inside split a match. - The interior probe runs from the character, not the camera. - The reference lights ground clutter. The old comment said it draws unlit. - The model-particle "pool order" deviation was wrong. Each instance is its own mesh, depth-sorted every frame. - The reference's vertical field of view follows the aspect ratio (44.1° at 16:9). The comment now gives it beside our fixed 45°. - The effect shader's far wall is the live `farclip`, 177 to 777 yd, not a fixed 777 yd. - Dozens more turned up on the way: renamed or deleted items, docs sitting on the wrong item, stale counts and links. - **Deviation labels.** "Deviation:" now marks only a choice with a reason. An unbuilt behaviour says so plainly. - **Verification.** Every file strips to identical code, and `cargo fmt --check` is clean. Five second readers compared every file old against new, restored the facts the rewrite had dropped, and checked each new citation against the reference. Defects the rewrite surfaced outside the comments are filed as their own issues (#106, #114, #115, #116). The comments here state what the code does. String literals are untouched; they are #92. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
36 lines
2.0 KiB
Rust
36 lines
2.0 KiB
Rust
//! A body standing in the world: what the engine needs to know about a unit, and nothing about
|
|
//! where it came from. The game puts [`WorldUnit`] on every unit and [`ViewerUnit`] on the one the
|
|
//! eye belongs to.
|
|
//!
|
|
//! State `WorldUnit` at the spawn, like `Transform`, when the body must be live the same frame:
|
|
//! the wire reconciler (`entities::publish_world_units`) runs right after the wire drain, a frame
|
|
//! late for anything spawned later. Its fields copy facts the game owns (`NetEntity::scale`,
|
|
//! `CollisionHeight`), refreshed on change.
|
|
|
|
use bevy::prelude::*;
|
|
|
|
/// A unit body the world can act on: it wades, takes ground shade, claims a WMO room and holds a
|
|
/// rig palette slot. Every field is an engine fact; `benilla-protocol` is not a dependency here.
|
|
#[derive(Component, Clone, Copy, Debug)]
|
|
pub struct WorldUnit {
|
|
/// Whether this body displaces water (a ripple ring and a wake): a creature or a player does,
|
|
/// a chest or a spell's ground anchor does not. A field, so no spawn can leave it unstated.
|
|
pub wades: bool,
|
|
/// The instance's model scale, as the ripple ring's radius input.
|
|
pub scale: f32,
|
|
/// The collision cylinder's height in yards, the ring's other input. Before the display
|
|
/// resolves it is the reference's constructor default, never `0.0`, at which the body swims on
|
|
/// dry land.
|
|
pub height: f32,
|
|
/// The whole-object model-space box the world may cull this body by: from inside a sealed WMO
|
|
/// room the reference never submits an outdoor object (`crate::exterior_cull`). The game
|
|
/// supplies the idle animation's authored CAaBox, unscaled; a body whose model has not resolved
|
|
/// is culled as a degenerate box at its origin, not admitted. `None` is not the world's to
|
|
/// decide: the transport, whose root `Visibility` its own tick writes.
|
|
pub bound: Option<bevy::camera::primitives::Aabb>,
|
|
}
|
|
|
|
/// The viewer's own body; a marker because every use is a query filter.
|
|
#[derive(Component)]
|
|
pub struct ViewerUnit;
|