pub struct BehaviorRegistry { /* private fields */ }Expand description
The name-addressed registry of config-dispatched native fns, keyed
by (category, name). Built once via build_registry.
entries is the category-agnostic catalog/validation view; the
typed maps hold the function pointers the dispatch sites call.
Implementations§
Source§impl BehaviorRegistry
impl BehaviorRegistry
Sourcepub fn register(&mut self, meta: BehaviorMeta)
pub fn register(&mut self, meta: BehaviorMeta)
Register catalog metadata. Panics on a duplicate
(category, name) — caught at process start / in tests.
Sourcepub fn remove(&mut self, name: &str)
pub fn remove(&mut self, name: &str)
Remove a behavior by name from the catalog and every typed map (used to strip test fixtures from production registries).
pub fn register_event(&mut self, meta: BehaviorMeta, f: EventFn)
pub fn event_fn(&self, name: &str) -> Option<EventFn>
pub fn register_conditional_progress( &mut self, meta: BehaviorMeta, f: ConditionalProgressFn, )
pub fn conditional_progress_fn( &self, name: &str, ) -> Option<ConditionalProgressFn>
pub fn register_currencies(&mut self, meta: BehaviorMeta, f: RewardFn)
pub fn currencies_fn(&self, name: &str) -> Option<RewardFn>
pub fn register_vassal_reward(&mut self, meta: BehaviorMeta, f: VassalRewardFn)
pub fn vassal_reward_fn(&self, name: &str) -> Option<VassalRewardFn>
pub fn register_item_attribute( &mut self, meta: BehaviorMeta, f: ItemAttributeFn, )
pub fn item_attribute_fn(&self, name: &str) -> Option<ItemAttributeFn>
pub fn register_vassal_loyalty( &mut self, meta: BehaviorMeta, f: VassalLoyaltyFn, )
pub fn vassal_loyalty_fn(&self, name: &str) -> Option<VassalLoyaltyFn>
pub fn register_default_loop_task( &mut self, meta: BehaviorMeta, f: DefaultLoopTaskFn, )
pub fn default_loop_task_fn(&self, name: &str) -> Option<DefaultLoopTaskFn>
pub fn register_start_cast_ability( &mut self, meta: BehaviorMeta, f: StartCastAbilityFn, )
pub fn start_cast_ability_fn(&self, name: &str) -> Option<StartCastAbilityFn>
pub fn register_start_cast_projectile( &mut self, meta: BehaviorMeta, f: StartCastProjectileFn, )
pub fn start_cast_projectile_fn( &self, name: &str, ) -> Option<StartCastProjectileFn>
pub fn register_cast_ability(&mut self, meta: BehaviorMeta, f: CastAbilityFn)
pub fn cast_ability_fn(&self, name: &str) -> Option<CastAbilityFn>
pub fn register_cast_projectile( &mut self, meta: BehaviorMeta, f: CastProjectileFn, )
pub fn cast_projectile_fn(&self, name: &str) -> Option<CastProjectileFn>
pub fn register_fight_start(&mut self, meta: BehaviorMeta, f: FightStartFn)
pub fn fight_start_fn(&self, name: &str) -> Option<FightStartFn>
pub fn register_additional_quests( &mut self, meta: BehaviorMeta, f: AdditionalQuestsFn, )
pub fn additional_quests_fn(&self, name: &str) -> Option<AdditionalQuestsFn>
Source§impl BehaviorRegistry
impl BehaviorRegistry
Sourcepub fn new(game_config: &GameConfig) -> Self
pub fn new(game_config: &GameConfig) -> Self
Build the full registry for a game config: registers every config-dispatched behavior and extracts the content lookups.
Lookup extraction MUST happen here: empty ContentLookups silently
breaks fight targeting (is_valid_target reads target_type "" → no
valid targets → entities run through the enemy line).
Sourcepub fn lookups(&self) -> &ContentLookups
pub fn lookups(&self) -> &ContentLookups
Content lookups extracted at init — passed into the *Ctx structs.
Sourcepub fn get(&self, category: BehaviorKind, name: &str) -> Option<&BehaviorMeta>
pub fn get(&self, category: BehaviorKind, name: &str) -> Option<&BehaviorMeta>
Look up a function’s metadata by category + name.
Sourcepub fn contains(&self, category: BehaviorKind, name: &str) -> bool
pub fn contains(&self, category: BehaviorKind, name: &str) -> bool
True if name is registered under category.
Sourcepub fn validate_ref(
&self,
category: BehaviorKind,
name: &str,
) -> Result<(), String>
pub fn validate_ref( &self, category: BehaviorKind, name: &str, ) -> Result<(), String>
Validate a config ScriptRef: the name must exist under category.
On failure it lists the valid names for that category to make the
misconfig obvious.
Sourcepub fn to_catalog(&self) -> BehaviorCatalog
pub fn to_catalog(&self) -> BehaviorCatalog
Serialize to the stable catalog shape: { category -> [meta, ...] },
with every category present (empty array if nothing registered).
Deterministic ordering (categories in BehaviorKind::ALL order,
names sorted by the BTreeMap) so the snapshot test is stable.
Trait Implementations§
Source§impl Debug for BehaviorRegistry
impl Debug for BehaviorRegistry
Source§impl Default for BehaviorRegistry
impl Default for BehaviorRegistry
Source§fn default() -> BehaviorRegistry
fn default() -> BehaviorRegistry
Auto Trait Implementations§
impl Freeze for BehaviorRegistry
impl RefUnwindSafe for BehaviorRegistry
impl Send for BehaviorRegistry
impl Sync for BehaviorRegistry
impl Unpin for BehaviorRegistry
impl UnwindSafe for BehaviorRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].