Skip to main content

SceneRules

Trait SceneRules 

Source
pub trait SceneRules<D> {
    // Required methods
    fn limits(&self) -> &DialogueLimits;
    fn tokens(&self) -> &dyn Tokens;

    // Provided methods
    fn widths(&self) -> &CellWidths { ... }
    fn names(&self) -> Option<&Names> { ... }
    fn can_speak(&self, _character: &CharacterId) -> bool { ... }
    fn expression_problem(
        &self,
        _character: &CharacterId,
        _expression: &str,
    ) -> Option<String> { ... }
    fn speech_problem(
        &self,
        _speaker: &CharacterId,
        _cells: usize,
    ) -> Option<String> { ... }
    fn music_problem(&self, _cue: &str) -> Option<String> { ... }
    fn scene_problems(&self, _parsed: &ParsedScene<D>) -> Vec<ContentError> { ... }
}
Expand description

What check_scene checks a scene against: the game’s limits, tokens and names, and whatever it knows of its characters, portraits and music. A check the game has nothing for passes.

Required Methods§

Source

fn limits(&self) -> &DialogueLimits

How much text the box and the menu hold.

Source

fn tokens(&self) -> &dyn Tokens

The game’s own {tokens}.

Provided Methods§

Source

fn widths(&self) -> &CellWidths

How many cells each character takes, which the limits count: the font atlas’s (CellWidths::of). One cell for every character, the default, when the game doesn’t say.

Source

fn names(&self) -> Option<&Names>

The names table, when it loaded: name tokens and names written out are checked against it, and every name token counts as its longest name.

Source

fn can_speak(&self, _character: &CharacterId) -> bool

Whether character may be placed and speak.

Source

fn expression_problem( &self, _character: &CharacterId, _expression: &str, ) -> Option<String>

What is wrong with character showing expression, if anything.

Source

fn speech_problem( &self, _speaker: &CharacterId, _cells: usize, ) -> Option<String>

What is wrong with speaker saying a line of cells cells (at most, tokens filled in), if anything, beyond the box’s limit.

Source

fn music_problem(&self, _cue: &str) -> Option<String>

What is wrong with @music <cue>, if anything.

Source

fn scene_problems(&self, _parsed: &ParsedScene<D>) -> Vec<ContentError>

The game’s own checks on parsed, which scripts_from_sources runs after check_scene.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§