pub struct Loom<L: WorldLoader> { /* private fields */ }Expand description
A ready-to-pump browser core: a Navigator wired to an owned WorldLoader.
Implementations§
Source§impl<L: WorldLoader> Loom<L>
impl<L: WorldLoader> Loom<L>
Sourcepub fn new(worlds_root: impl Into<PathBuf>, loader: L) -> Self
pub fn new(worlds_root: impl Into<PathBuf>, loader: L) -> Self
Build a browser core over loader. worlds_root is the local dev-resolver
root (where thread://host/path falls back to <root>/<path>/world.json).
Sourcepub fn open(&mut self, locator: &str, anchor: Vec3)
pub fn open(&mut self, locator: &str, anchor: Vec3)
Open a world by Locator (the entry to the live Thread). The world loads on
a subsequent update once the async resolve+fetch lands.
Sourcepub fn load_file(&mut self, path: &Path, anchor: Vec3) -> Option<Vec3>
pub fn load_file(&mut self, path: &Path, anchor: Vec3) -> Option<Vec3>
Load a local world.json directly (the offline / startup path). Returns
the spawn to place the player at.
Sourcepub fn update(&mut self, dt: f32, player_pos: Vec3) -> Option<Vec3>
pub fn update(&mut self, dt: f32, player_pos: Vec3) -> Option<Vec3>
Advance one frame: finish an in-flight veilwalk, or begin one if the player
stepped into a veil. Returns Some(spawn) when the player should be moved.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
The active world’s one-line description (may be empty) — arrival cards.
Sourcepub fn portals(&self) -> &[PortalNav]
pub fn portals(&self) -> &[PortalNav]
The veils in the active world (render as doorways / minimap / walk toward).
Sourcepub fn presence_relays(&self) -> &[String]
pub fn presence_relays(&self) -> &[String]
The active world’s presence relays (primary first, then fallbacks).
Sourcepub fn focused(&self, player_pos: Vec3) -> Option<Focus>
pub fn focused(&self, player_pos: Vec3) -> Option<Focus>
The inspectable placement the player is standing at, if any.
Sourcepub fn near_portal(&self, player_pos: Vec3) -> Option<(&str, &str)>
pub fn near_portal(&self, player_pos: Vec3) -> Option<(&str, &str)>
The veil the player is standing in front of, as (label, destination).
Sourcepub fn is_traveling(&self) -> bool
pub fn is_traveling(&self) -> bool
Whether a veilwalk is in flight (show a spinner).
Sourcepub fn last_error(&self) -> Option<&str>
pub fn last_error(&self) -> Option<&str>
The most recent veilwalk failure, if any.
Sourcepub fn locator(&self) -> Option<&str>
pub fn locator(&self) -> Option<&str>
The active world’s Locator (the address bar), if it arrived by one.
Sourcepub fn world_source(&self) -> Option<&str>
pub fn world_source(&self) -> Option<&str>
The active world’s raw manifest text (view-source).
Sourcepub fn interact(&mut self, player_pos: Vec3) -> Vec<Action>
pub fn interact(&mut self, player_pos: Vec3) -> Vec<Action>
The player interacted with whatever they’re standing at → the [Action]s
(see crate::behavior) its bound behavior module asks the browser to
perform. Empty when nothing is bound (fall back to Codex/web focus).
Sourcepub fn tick_behaviors(&mut self, dt: f32) -> Vec<Action>
pub fn tick_behaviors(&mut self, dt: f32) -> Vec<Action>
Advance the active world’s ticking behavior modules — the heartbeat. Returns the Actions ticking Weft behaviors request.
Sourcepub fn back(&mut self, anchor: Vec3) -> bool
pub fn back(&mut self, anchor: Vec3) -> bool
Veilwalk back to the previous world. Returns whether a walk began.
Sourcepub fn go_home(&mut self, anchor: Vec3) -> bool
pub fn go_home(&mut self, anchor: Vec3) -> bool
Veilwalk to the session’s home world (by default, where it opened).
… or the navigator, for the full read API.