Struct BehaviorRegistry

Source
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

Source

pub fn register(&mut self, meta: BehaviorMeta)

Register catalog metadata. Panics on a duplicate (category, name) — caught at process start / in tests.

Source

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).

Source

pub fn register_event(&mut self, meta: BehaviorMeta, f: EventFn)

Source

pub fn event_fn(&self, name: &str) -> Option<EventFn>

Source

pub fn register_conditional_progress( &mut self, meta: BehaviorMeta, f: ConditionalProgressFn, )

Source

pub fn conditional_progress_fn( &self, name: &str, ) -> Option<ConditionalProgressFn>

Source

pub fn register_currencies(&mut self, meta: BehaviorMeta, f: RewardFn)

Source

pub fn currencies_fn(&self, name: &str) -> Option<RewardFn>

Source

pub fn register_vassal_reward(&mut self, meta: BehaviorMeta, f: VassalRewardFn)

Source

pub fn vassal_reward_fn(&self, name: &str) -> Option<VassalRewardFn>

Source

pub fn register_item_attribute( &mut self, meta: BehaviorMeta, f: ItemAttributeFn, )

Source

pub fn item_attribute_fn(&self, name: &str) -> Option<ItemAttributeFn>

Source

pub fn register_vassal_loyalty( &mut self, meta: BehaviorMeta, f: VassalLoyaltyFn, )

Source

pub fn vassal_loyalty_fn(&self, name: &str) -> Option<VassalLoyaltyFn>

Source

pub fn register_default_loop_task( &mut self, meta: BehaviorMeta, f: DefaultLoopTaskFn, )

Source

pub fn default_loop_task_fn(&self, name: &str) -> Option<DefaultLoopTaskFn>

Source

pub fn register_start_cast_ability( &mut self, meta: BehaviorMeta, f: StartCastAbilityFn, )

Source

pub fn start_cast_ability_fn(&self, name: &str) -> Option<StartCastAbilityFn>

Source

pub fn register_start_cast_projectile( &mut self, meta: BehaviorMeta, f: StartCastProjectileFn, )

Source

pub fn start_cast_projectile_fn( &self, name: &str, ) -> Option<StartCastProjectileFn>

Source

pub fn register_cast_ability(&mut self, meta: BehaviorMeta, f: CastAbilityFn)

Source

pub fn cast_ability_fn(&self, name: &str) -> Option<CastAbilityFn>

Source

pub fn register_cast_projectile( &mut self, meta: BehaviorMeta, f: CastProjectileFn, )

Source

pub fn cast_projectile_fn(&self, name: &str) -> Option<CastProjectileFn>

Source

pub fn register_fight_start(&mut self, meta: BehaviorMeta, f: FightStartFn)

Source

pub fn fight_start_fn(&self, name: &str) -> Option<FightStartFn>

Source

pub fn register_additional_quests( &mut self, meta: BehaviorMeta, f: AdditionalQuestsFn, )

Source

pub fn additional_quests_fn(&self, name: &str) -> Option<AdditionalQuestsFn>

Source§

impl BehaviorRegistry

Source

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).

Source

pub fn lookups(&self) -> &ContentLookups

Content lookups extracted at init — passed into the *Ctx structs.

Source

pub fn get(&self, category: BehaviorKind, name: &str) -> Option<&BehaviorMeta>

Look up a function’s metadata by category + name.

Source

pub fn contains(&self, category: BehaviorKind, name: &str) -> bool

True if name is registered under category.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BehaviorRegistry

Source§

fn default() -> BehaviorRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,