Skip to main content

runec/
environment.rs

1//! Engine semantics supplied by an emulator or editor host.
2use crate::pointer::{PointerHolder, PointerSet};
3use crate::symbol::SymbolRegistry;
4use crate::types::Type;
5use std::collections::HashMap;
6
7#[derive(Clone, Debug, Default)]
8pub struct Trigger {
9    pub byte: Option<u8>,
10    pub subject_type: Option<Type>,
11    pub validates_subject: bool,
12    pub is_button: bool,
13    pub allows_returns: bool,
14}
15
16pub type LookupResolver = fn(trigger: &str, subject: &str, registry: &SymbolRegistry) -> i32;
17
18/// A complete engine contract. Empty maps mean unsupported, not an implicit
19/// fallback to a particular game's revision. Legacy directory adapters retain
20/// their existing defaults until a host supplies this profile.
21#[derive(Clone, Debug, Default)]
22pub struct EngineProfile {
23    pub triggers: HashMap<String, Trigger>,
24    pub command_pointers: HashMap<String, PointerHolder>,
25    pub trigger_pointers: HashMap<String, PointerSet>,
26    pub lookup_key: Option<LookupResolver>,
27}